Linear Collider Forum



Home » Analysis and Reconstruction » Reconstruction » Matching
Matching [message #1814] Wed, 22 July 2009 06:54
bweinert
Messages: 16
Registered: September 2008
Location: University of Rochester
Hi, I tried to create a matching program between virtual hits and real hits in order to get the tracks. I did this by trying to match the cartesian coordinates, but it doesn't seem to produce the right results. It only matches a few hits every few events. Is there anything wrong with the code?

-Ben

double [] VirtPos = new double [3];
.
.
.

VirtPos[0] = rpVect[0];

VirtPos[1] = rpVect[1];


VirtPos[2] = rpVect[2];

VirtPosList.add(VirtPos);
.
.
.

if(subdetName.equals(hcalSubdetName))
{
List<CalorimeterHit> hits = null;
try {
hits = event.get( CalorimeterHit.class, hcalHitmapName);
}
catch (Exception e) {}
if(hits==null) return;

for( int i = 0; i<hits.size(); ++i ) {
CalorimeterHit ihit = hits.get(i);
matchHitsXYZ(ihit.getPosition());}
}
.
.
.

else if(subdetName.equals(ecalSubdetName))
{
List<CalorimeterHit> hitsE1 = null;
try {
hitsE1 = event.get( CalorimeterHit.class, ecalHitmapName);
}
catch (Exception e) {}
if(hitsE1==null) return;

for( int i = 0; i<hitsE1.size(); ++i ) {
CalorimeterHit ihit = hitsE1.get(i);
matchHitsXYZ(ihit.getPosition());}
}
.
.
.

protected void matchHitsXYZ(double [] realPos)
{

AIDA aida = AIDA.defaultInstance();
int nhitsTotal = 0;

// loop through virtual hits
for (double [] virtPos : VirtPosList) {

if (((realPos[0])-1)<=virtPos[0] && virtPos[0]<=((realPos[0])+1))
{
if(((realPos[1])-1)<=virtPos[1] && virtPos[1]<=((realPos[1])+1))
{
if( ((realPos[2])-1)<=virtPos[2] && virtPos[2]<=((realPos[2])+1))
{
System.out.println("Matched Hit at: (" + realPos[0] +","+ realPos[1] +"," +realPos[2] +")");

aida.cloud2D("Y vs. X Matched").fill(realPos[1], realPos[0]);
MatchedPosList.add(realPos);
foundHits.add(new BasicHep3Vector(realPos[0], realPos[1], realPos[2]));

nhitsTotal++;
MatchedPosList.add(realPos);
System.out.println("Number of virtual hits : " + VirtPosList.size() + " Number of real hits : " +nhitsTotal);
}
} }
}
}

 
Read Message
Previous Topic:muon never reconstructed?
Next Topic:Skip events & LCFI package
Goto Forum:
  


Current Time: Wed Oct 17 07:29:59 Pacific Daylight Time 2018
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.1.
Copyright ©2001-2010 FUDforum Bulletin Board Software