Commit in lcdd/src/lcdd/detectors on MAIN | |||
OpticalCalorimeterHitProcessor.cc | +18 | -17 | 1.3 -> 1.4 |
change to use the new way of hit lookup
diff -u -r1.3 -r1.4 --- OpticalCalorimeterHitProcessor.cc 14 Sep 2013 02:06:35 -0000 1.3 +++ OpticalCalorimeterHitProcessor.cc 14 Sep 2013 02:17:12 -0000 1.4 @@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/OpticalCalorimeterHitProcessor.cc,v 1.3 2013/09/14 02:06:35 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/OpticalCalorimeterHitProcessor.cc,v 1.4 2013/09/14 02:17:12 jeremy Exp $
// LCDD #include "lcdd/detectors/OpticalCalorimeterHitProcessor.hh"
@@ -59,26 +59,27 @@
_calorimeter->getSegmentation()->resetBins(); // set the seg bins _calorimeter->getSegmentation()->setBins(step);
- // create id and pack into 64
+ + // Create an identifier.
Id64bit id64 = _calorimeter->makeIdentifier(step);
- // find hit by simple lkp of new hit with above info - CalorimeterHit* thisHit = new CalorimeterHit(id64, theEdep, globalCellPos); - CalorimeterHit* foundHit = _calorimeter->findHit(thisHit, eCerenkov); - // hit is not found? - if (foundHit == 0) { - _calorimeter->addHit(thisHit, eCerenkov);
+ + // Look for existing hit. + CalorimeterHit* hit = _calorimeter->findHit(hit->getId64bit()); + + // Was hit found? + if (hit == 0) { + + // Hit was not found, so new one is created. + hit = new CalorimeterHit(id64, theEdep, globalCellPos); + + // Add hit to calorimeter. + _calorimeter->addHit(hit, eCerenkov);
} else {
- // found a hit - // don't need to insert thisHit, so delete it - delete thisHit; - thisHit = 0; - // incr total edep of the hit - foundHit->addEdep(theEdep); - // for setting contrib - thisHit = foundHit;
+ // Add energy deposition to existing hit. + hit->addEdep(theEdep);
} // add McpHitContrib to this hit, setting info from step info
- thisHit->addHitContribution(HitContribution(step));
+ hit->addHitContribution(HitContribution(step));
return true; } // end Cerenkov photon treatment }
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1