Commit in lcdd/src/lcdd/detectors on LCDD-102_BRANCH
OpticalCalorimeterHitProcessor.cc+37-191.1.2.2 -> 1.1.2.3
fix silly hit lookup bugs in optical cal hit processor

lcdd/src/lcdd/detectors
OpticalCalorimeterHitProcessor.cc 1.1.2.2 -> 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- OpticalCalorimeterHitProcessor.cc	20 Aug 2013 00:09:45 -0000	1.1.2.2
+++ OpticalCalorimeterHitProcessor.cc	20 Aug 2013 22:18:43 -0000	1.1.2.3
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/Attic/OpticalCalorimeterHitProcessor.cc,v 1.1.2.2 2013/08/20 00:09:45 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/Attic/OpticalCalorimeterHitProcessor.cc,v 1.1.2.3 2013/08/20 22:18:43 jeremy Exp $
 
 // LCDD
 #include "lcdd/detectors/OpticalCalorimeterHitProcessor.hh"
@@ -11,23 +11,41 @@
 #include "G4Poisson.hh"
 
 OpticalCalorimeterHitProcessor::OpticalCalorimeterHitProcessor(CalorimeterSD* calorimeter)
-    : CalorimeterHitProcessor(calorimeter)
+    : CalorimeterHitProcessor(calorimeter), _cerenGenerator(0)
 {
-    _cerenGenerator = new Cerenkov();
+    //_cerenGenerator = new Cerenkov();
+	//if (calorimeter == 0) {
+	//	std::cout << "OpticalCalorimeterHitProcessor::OpticalCalorimeterHitProcessor - calorimeter is null!" << std::endl;
+	//}
 }
 
 OpticalCalorimeterHitProcessor::~OpticalCalorimeterHitProcessor()
 {
-    delete _cerenGenerator;
+	if (_cerenGenerator != 0) {
+		delete _cerenGenerator;
+	}
 }
 
 bool OpticalCalorimeterHitProcessor::processHits(G4Step* step)
 {
-    std::cout << "OpticalCalorimeterHitProcessor::processHits" << std::endl;
-    std::cout << "pre-step xyz = " <<
-        step->GetPreStepPoint()->GetPosition().x() << " " <<
-        step->GetPreStepPoint()->GetPosition().y() << " " <<
-        step->GetPreStepPoint()->GetPosition().z() << std::endl;
+	//std::cout << "OpticalCalorimeterHitProcessor::processHits" << std::endl;
+
+	if (_cerenGenerator == 0) {
+		_cerenGenerator = new Cerenkov();
+	}
+
+	//if (_calorimeter == 0) {
+	//	std::cout << "calorimeter is null!" << std::endl;
+	//} else {
+	//	if (_calorimeter->getSegmentation() == 0) {
+	//		std::cout << "segmentation is null!" << std::endl;
+	//	}
+	//}
+
+    //std::cout << "pre-step xyz = " <<
+    //    step->GetPreStepPoint()->GetPosition().x() << " " <<
+    //    step->GetPreStepPoint()->GetPosition().y() << " " <<
+    //    step->GetPreStepPoint()->GetPosition().z() << std::endl;
     //std::cout << std::endl;
     //return false;
 
@@ -40,7 +58,7 @@
     const G4VTouchable* touch = step->GetPreStepPoint()->GetTouchable();
     G4String thematerial = touch->GetVolume()->GetLogicalVolume()->GetMaterial()->GetName();
     G4double MeanNumberOfPhotons = _cerenGenerator->GetAverageNumberOfPhotons(charge, beta, thematerial);
-    std::cout << "MeanNumberOfPhotons: " << MeanNumberOfPhotons << std::endl;
+    //std::cout << "MeanNumberOfPhotons: " << MeanNumberOfPhotons << std::endl;
     if (MeanNumberOfPhotons > 0.0) {
         G4double step_length = step->GetStepLength();
         MeanNumberOfPhotons = MeanNumberOfPhotons * step_length;
@@ -49,20 +67,20 @@
         NCerenPhotons = 0;
     }
 
-    std::cout << "NCerenPhotons: " << NCerenPhotons << std::endl;
+    //std::cout << "NCerenPhotons: " << NCerenPhotons << std::endl;
 
     if (NCerenPhotons <= 0) {
-    	std::cout << "no ceren photons generated; calling CalorimeterHitProcessor::processHits" << std::endl;
+    	//std::cout << "no ceren photons generated; calling CalorimeterHitProcessor::processHits" << std::endl;
         return CalorimeterHitProcessor::processHits(step);
     } else {
         //SensitiveDetector::ProcessHits(aStep, 0);
         G4ThreeVector myPoint = step->GetPreStepPoint()->GetPosition();
         G4StepPoint* apreStepPoint = step->GetPreStepPoint();
-        G4Navigator* theNavigator = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
-        G4VPhysicalVolume* myVolume = theNavigator->LocateGlobalPointAndSetup(myPoint);
+        //G4Navigator* theNavigator = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
+        //G4VPhysicalVolume* myVolume = theNavigator->LocateGlobalPointAndSetup(myPoint);
         //if (_calorimeter->getVerbose() > 2) {
-        G4cout << "Physical volume       = " << myVolume->GetName() << G4endl;
-        G4cout << "Point of interaction  = " << myPoint<< G4endl;
+        //G4cout << "Physical volume       = " << myVolume->GetName() << G4endl;
+        //G4cout << "Point of interaction  = " << myPoint<< G4endl;
         //G4cout << "sdname " << this->_calorimeter->GetName() << "  hcname " <<collectionName[0]<< G4endl;
         //}
             // total photon energy
@@ -79,10 +97,10 @@
         // find hit by simple lkp of new hit with above info
         CalorimeterHit* thisHit = new CalorimeterHit(theEdep, globalCellPos);
         thisHit->setId64bit(id64.getId0(), id64.getId1());
-        CalorimeterHit* foundHit = 0;
+        CalorimeterHit* foundHit = _calorimeter->findHit(thisHit, eCerenkov);
         // hit is not found?
-        if (!(foundHit = _calorimeter->findHit(thisHit, eCerenkov))) {
-            _calorimeter->addHit(foundHit, eCerenkov);
+        if (foundHit == 0) {
+            _calorimeter->addHit(thisHit, eCerenkov);
         } else {
             // found a hit
             // don't need to insert thisHit, so delete it
CVSspam 0.2.12


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