Commit in lcdd/src/lcdd on LCDD-102_BRANCH
detectors/CalorimeterSD.cc+28-91.6.2.1 -> 1.6.2.2
         /LegacyCalorimeterHitProcessor.cc+4-31.1 -> 1.1.2.1
         /OpticalCalorimeterHitProcessor.cc+3-361.1.2.3 -> 1.1.2.4
         /SensitiveDetector.cc+1-111.5.2.1 -> 1.5.2.2
         /SensitiveDetectorFactory.cc+30-151.4.2.4 -> 1.4.2.5
         /TrackerSD.cc+1-671.4.2.1 -> 1.4.2.2
processes/hits_collectionProcess.cc+1-31.1.2.1 -> 1.1.2.2
+68-144
7 modified files
cleanup

lcdd/src/lcdd/detectors
CalorimeterSD.cc 1.6.2.1 -> 1.6.2.2
diff -u -r1.6.2.1 -r1.6.2.2
--- CalorimeterSD.cc	14 Aug 2013 00:23:22 -0000	1.6.2.1
+++ CalorimeterSD.cc	22 Aug 2013 20:24:38 -0000	1.6.2.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/CalorimeterSD.cc,v 1.6.2.1 2013/08/14 00:23:22 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/CalorimeterSD.cc,v 1.6.2.2 2013/08/22 20:24:38 jeremy Exp $
 
 // LCDD
 #include "lcdd/detectors/CalorimeterSD.hh"
@@ -24,8 +24,13 @@
                 SensitiveDetector::eCalorimeter),
         _segmentation(sdSeg)
 {
+
+	_hitsVector.clear();
+	_hitsCollections.clear();
+
     _hitsCollections.push_back(_collection);
     _hitsVector.push_back(_hits);
+
     if (compare == 0)
         _hitCompare = new PositionComparator();
     else
@@ -43,7 +48,12 @@
                 SensitiveDetector::eCalorimeter),
         _segmentation(sdSeg)
 {
-    _hitsVector.push_back(_hits); // What does this do???
+
+	_hitsVector.clear();
+	_hitsCollections.clear();
+
+    _hitsVector.push_back(_hits);
+
     for (int i = 0; i < (int) hcNames.size(); i++) {
         _hitsVector.push_back(_hits);
         _hitsVector[i].clear();
@@ -76,18 +86,25 @@
 {
     clearHits();
 
-    // new cal hits collection
+    // new cal hits collectithe loss of habitat hits even harderon
     for (int i = 0; i < getNumberOfHitsCollections(); i++) {
 
+    	//std::cout << "initializing hits collection: " << collectionName[i] << std::endl;
+
+    	// This overwrites the existing dummy collection that was added in the constructor.
         _hitsCollections[i] = new CalorimeterHitsCollection(GetName(), collectionName[i]);
 
-        // Set HCID as it has a dummy value of zero by default.
+        // Set the HCID as it has a dummy value of zero by default.
         if (getHCID(i) < 0) {
+        	//std::cout << "set HCID: " << GetCollectionID(i) << std::endl;
+        	// This will set the HC ID in the list that is contained in SensitiveDetector parent class.
             setHCID(GetCollectionID(i), i);
         }
 
         // Add the hit collection to the hit collections of the event.
         HCE->AddHitsCollection(getHCID(i), _hitsCollections[i]);
+
+        // FIXME: Should _hitsVector also be setup here?
     }
 }
 
@@ -115,14 +132,16 @@
 
 CalorimeterHit* CalorimeterSD::findHit(CalorimeterHit* aHit, G4int nHC) const
 {
-    CalorimeterHit* fndHit = 0;
-    for (CalorimeterHitList::const_iterator iter = _hitsVector[nHC].begin(); iter != _hitsVector[nHC].end(); iter++) {
-        if (_hitCompare->compare(**iter, *aHit)) {
-            fndHit = *iter;
+    CalorimeterHit* foundHit = 0;
+    for (CalorimeterHitList::const_iterator it   = _hitsVector[nHC].begin();
+    		it != _hitsVector[nHC].end();
+    		it++) {
+        if (_hitCompare->compare(**it, *aHit)) {
+            foundHit = *it;
             break;
         }
     }
-    return fndHit;
+    return foundHit;
 }
 
 std::ostream& CalorimeterSD::printHits(std::ostream& os)

lcdd/src/lcdd/detectors
LegacyCalorimeterHitProcessor.cc 1.1 -> 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- LegacyCalorimeterHitProcessor.cc	11 Jul 2013 20:41:54 -0000	1.1
+++ LegacyCalorimeterHitProcessor.cc	22 Aug 2013 20:24:38 -0000	1.1.2.1
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/LegacyCalorimeterHitProcessor.cc,v 1.1 2013/07/11 20:41:54 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/LegacyCalorimeterHitProcessor.cc,v 1.1.2.1 2013/08/22 20:24:38 jeremy Exp $
 
 // LCDD
 #include "lcdd/detectors/LegacyCalorimeterHitProcessor.hh"
@@ -54,11 +54,12 @@
     newHit->setId64bit(id.getId0(), id.getId1());
 
     // Look for a matching hit.
-    CalorimeterHit* foundHit = 0;
-    if (!(foundHit = _calorimeter->findHit(newHit))) {
+    CalorimeterHit* foundHit = _calorimeter->findHit(newHit);
+    if (foundHit == 0) {
         // Add a new hit to the SD.
         _calorimeter->addHit(newHit);
     } else {
+
         // Delete the hit that was just created.
         delete newHit;
         newHit = 0;

lcdd/src/lcdd/detectors
OpticalCalorimeterHitProcessor.cc 1.1.2.3 -> 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- OpticalCalorimeterHitProcessor.cc	20 Aug 2013 22:18:43 -0000	1.1.2.3
+++ OpticalCalorimeterHitProcessor.cc	22 Aug 2013 20:24:38 -0000	1.1.2.4
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/Attic/OpticalCalorimeterHitProcessor.cc,v 1.1.2.3 2013/08/20 22:18:43 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/Attic/OpticalCalorimeterHitProcessor.cc,v 1.1.2.4 2013/08/22 20:24:38 jeremy Exp $
 
 // LCDD
 #include "lcdd/detectors/OpticalCalorimeterHitProcessor.hh"
@@ -13,10 +13,6 @@
 OpticalCalorimeterHitProcessor::OpticalCalorimeterHitProcessor(CalorimeterSD* calorimeter)
     : CalorimeterHitProcessor(calorimeter), _cerenGenerator(0)
 {
-    //_cerenGenerator = new Cerenkov();
-	//if (calorimeter == 0) {
-	//	std::cout << "OpticalCalorimeterHitProcessor::OpticalCalorimeterHitProcessor - calorimeter is null!" << std::endl;
-	//}
 }
 
 OpticalCalorimeterHitProcessor::~OpticalCalorimeterHitProcessor()
@@ -28,27 +24,12 @@
 
 bool OpticalCalorimeterHitProcessor::processHits(G4Step* step)
 {
-	//std::cout << "OpticalCalorimeterHitProcessor::processHits" << std::endl;
-
+	// FIXME: This initialization should not happen here.
+	//        Put into PhysicsManager as statically accessible.
 	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;
-
     G4int NCerenPhotons = 0;
     G4Track* theTrack = step->GetTrack();
     const G4double charge = theTrack->GetDefinition()->GetPDGCharge();
@@ -58,7 +39,6 @@
     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;
     if (MeanNumberOfPhotons > 0.0) {
         G4double step_length = step->GetStepLength();
         MeanNumberOfPhotons = MeanNumberOfPhotons * step_length;
@@ -67,24 +47,11 @@
         NCerenPhotons = 0;
     }
 
-    //std::cout << "NCerenPhotons: " << NCerenPhotons << std::endl;
-
     if (NCerenPhotons <= 0) {
-    	//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);
-        //if (_calorimeter->getVerbose() > 2) {
-        //G4cout << "Physical volume       = " << myVolume->GetName() << G4endl;
-        //G4cout << "Point of interaction  = " << myPoint<< G4endl;
-        //G4cout << "sdname " << this->_calorimeter->GetName() << "  hcname " <<collectionName[0]<< G4endl;
-        //}
-            // total photon energy
-            // G4double theEdep = aTrack->GetTotalEnergy();
         G4double theEdep = double(NCerenPhotons);
         // get global cell pos from seg
         G4ThreeVector globalCellPos = getGlobalHitPosition(apreStepPoint);

lcdd/src/lcdd/detectors
SensitiveDetector.cc 1.5.2.1 -> 1.5.2.2
diff -u -r1.5.2.1 -r1.5.2.2
--- SensitiveDetector.cc	14 Aug 2013 00:23:23 -0000	1.5.2.1
+++ SensitiveDetector.cc	22 Aug 2013 20:24:38 -0000	1.5.2.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/SensitiveDetector.cc,v 1.5.2.1 2013/08/14 00:23:23 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/SensitiveDetector.cc,v 1.5.2.2 2013/08/22 20:24:38 jeremy Exp $
 
 // LCDD
 #include "lcdd/detectors/SensitiveDetector.hh"
@@ -91,15 +91,12 @@
 
 G4bool SensitiveDetector::ProcessHits(G4Step* aStep, G4TouchableHistory*)
 {
-    std::cout << "SensitiveDetector::ProcessHits" << std::endl;
-
     // Set the cached step data.
     setStep(aStep);
 
     // Call the processHits() methods of the registered HitProcessors.
     bool madeHits = false;
     for (HitProcessors::iterator it = _hitProcessors.begin(); it != _hitProcessors.end(); it++) {
-        std::cout << "calling hits processor" << std::endl;
         bool processorMadeHit = (*it)->processHits(aStep);
         if (processorMadeHit == true && madeHits == false) {
             madeHits = true;
@@ -355,10 +352,3 @@
         _hitProcessors.push_back(*it);
     }
 }
-
-//void SensitiveDetector::addHitsCollection(G4String collectionName)
-//{
-//    std::cout << "SensitiveDetector::addHitsCollection - " << collectionName << std::endl;
-//    this->collectionName.insert(collectionName);
-//    _hcids.push_back(-1);
-//}

lcdd/src/lcdd/detectors
SensitiveDetectorFactory.cc 1.4.2.4 -> 1.4.2.5
diff -u -r1.4.2.4 -r1.4.2.5
--- SensitiveDetectorFactory.cc	17 Aug 2013 23:51:14 -0000	1.4.2.4
+++ SensitiveDetectorFactory.cc	22 Aug 2013 20:24:38 -0000	1.4.2.5
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/SensitiveDetectorFactory.cc,v 1.4.2.4 2013/08/17 23:51:14 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/SensitiveDetectorFactory.cc,v 1.4.2.5 2013/08/22 20:24:38 jeremy Exp $
 
 // LCDD
 #include "lcdd/detectors/SensitiveDetectorFactory.hh"
@@ -18,6 +18,7 @@
     SensitiveDetector* sensitiveDetector = 0;
     IdSpec* idspec = 0;
     std::vector<HitProcessor*> hitProcessors;
+    std::vector<std::string> hitProcessorNames;
     std::vector<G4String> hitsCollections;
 
     // The SAXObject must extend SensitiveDetectorType.
@@ -54,19 +55,8 @@
                 // Cast object to appropriate element type.
                 const hit_processor* hitProcessor = dynamic_cast<const hit_processor*>(seq->content(i).object);
 
-                // Get the type of the HitProcessor.
-                std::string type = hitProcessor->get_type();
-
-                // Lookup the HitProcessor type using the manager.
-                HitProcessorFactory* hitProcessorFactory = HitProcessorManager::instance()->getFactory(type);
-                if (hitProcessorFactory == 0) {
-                    std::cerr << "HitProcessorFactory was not found for type: " << hitProcessor->get_type() << std::endl;
-                    G4Exception("", "", FatalException, "HitProcessor not found");
-                }
-                HitProcessor* processor = hitProcessorFactory->createHitProcessor(sensitiveDetector);
-
-                // Add the HitProcessor to the list.
-                hitProcessors.push_back(processor);
+                // Push type name of HitProcessor onto list to be created later once SD is available.
+                hitProcessorNames.push_back(hitProcessor->get_type());
 
             // Process hits_collection child tag.
             } else if (childTag == "hits_collection") {
@@ -82,7 +72,8 @@
             }
         }
 
-        // Backward compatibility if hits collection is specified as an attribute value on the detector's XML element.
+        // This is for backward compatibility when hits collection is specified as an attribute value
+        // on the detector's XML element.
         std::string hitsCollectionName = sensitiveDetectorType->get_hitsCollectionName();
         if (hitsCollectionName != "") {
             hitsCollections.push_back(sensitiveDetectorType->get_hitsCollectionName());
@@ -114,6 +105,22 @@
         // Set the IdSpec.
         sensitiveDetector->setIdSpec(idspec);
 
+        // Create HitProcessors from list of type names.
+        for (std::vector<std::string>::iterator it = hitProcessorNames.begin(); it != hitProcessorNames.end(); it++) {
+        	std::string type = (*it);
+        	HitProcessorFactory* hitProcessorFactory = HitProcessorManager::instance()->getFactory(type);
+        	if (hitProcessorFactory == 0) {
+        		std::cerr << "HitProcessorFactory was not found for type: " << type << std::endl;
+        		G4Exception("", "", FatalException, "HitProcessor not found");
+        	}
+        	HitProcessor* processor = hitProcessorFactory->createHitProcessor(sensitiveDetector);
+
+        	std::cout << "create hits processor: " << type << std::endl;
+
+        	// Add the HitProcessor to the list.
+        	hitProcessors.push_back(processor);
+        }
+
         // Add the HitProcessors from the list.
         if (hitProcessors.size() > 0) {
             // Add HitProcessors created from XML if they were listed explicitly as child elements.
@@ -131,6 +138,12 @@
 
         // Register the SensitiveDetector with the LCDDProcessor.
         std::string sensitiveDetectorName = sensitiveDetector->GetName();
+        std::cout << "adding sensitive detector: " << sensitiveDetectorName << std::endl;
+        std::cout << "  HCs: ";
+        for (std::vector<G4String>::iterator it = hitsCollections.begin(); it != hitsCollections.end(); it++) {
+        	std::cout << (*it) << " ";
+        }
+        std::cout << std::endl;
         LCDDProcessor::instance()->addSensitiveDetector(sensitiveDetectorName, sensitiveDetector);
     } else {
         // This should never really happen.
@@ -190,6 +203,8 @@
     std::string hitsCollectionName = hitsCollections[0];
 
     // Create the basic TrackerSD.
+    std::cout << "creating new tracker: " << trackerElement->get_name() << std::endl;
+    std::cout << "  HC: " << hitsCollectionName << std::endl;
     TrackerSD* sd = new TrackerSD(trackerElement->get_name(), hitsCollectionName);
 
     return sd;

lcdd/src/lcdd/detectors
TrackerSD.cc 1.4.2.1 -> 1.4.2.2
diff -u -r1.4.2.1 -r1.4.2.2
--- TrackerSD.cc	14 Aug 2013 00:23:23 -0000	1.4.2.1
+++ TrackerSD.cc	22 Aug 2013 20:24:38 -0000	1.4.2.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/TrackerSD.cc,v 1.4.2.1 2013/08/14 00:23:23 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/TrackerSD.cc,v 1.4.2.2 2013/08/22 20:24:38 jeremy Exp $
 
 // LCDD
 //#include "lcdd/id/IdManager.hh"
@@ -21,12 +21,6 @@
     _hits.clear();
 }
 
-//TrackerSD::TrackerSD(G4String sdName) :
-//        SensitiveDetector(sdName, SensitiveDetector::eTracker), _HC(0)
-//{
-//    _hits.clear();
-//}
-
 TrackerSD::~TrackerSD()
 {
 }
@@ -53,66 +47,6 @@
     return SensitiveDetector::ProcessHits(aStep, 0);
 }
 
-/*
-G4bool TrackerSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
-{
-    // set cached step
-    SensitiveDetector::ProcessHits(aStep, 0);
-
-    // edep
-    G4double e = edep();
-
-    // check edep < cut
-    if (e <= getEnergyCut() && !isGeantino()) {
-        return false;
-    }
-
-    // get track information
-    TrackInformation* trkInfo = trackInformation();
-
-    // set hit flag in trk info
-    trkInfo->setHasTrackerHit(true);
-
-    // hit data
-    G4int trkID = trackID();
-    G4double tdep = globalTime();
-    G4ThreeVector midPos = midPosition();
-    G4ThreeVector prePos = aStep->GetPreStepPoint()->GetPosition();
-    G4ThreeVector postPos = aStep->GetPostStepPoint()->GetPosition();
-    double avgMom = (pre()->GetMomentum().mag() + post()->GetMomentum().mag()) / 2;
-    G4ThreeVector mom = (postPos - prePos);
-    if (mom.mag() > 0) {
-        mom.setMag(avgMom);
-    } else {
-        std::cerr << "prePos - postPos = 0 --> " << prePos << " | " << postPos << std::endl;
-    }
-
-    G4double pathLength = ReadoutUtil::computeDistance(aStep);
-
-    // create hit
-    TrackerHit* trkHit = new TrackerHit();
-
-    // create id vector
-    Id64bit id64 = makeId();
-
-    // set track hit info
-    trkHit->setTrackID(trkID);
-    trkHit->setEdep(e);
-    trkHit->setPos(midPos);
-    trkHit->setMomentum(mom);
-    trkHit->setTdep(tdep);
-    trkHit->setId(id64.getId0());
-    trkHit->setLength(pathLength);
-
-    // add to HC
-    _HC->insert(trkHit);
-
-    _hits.push_back(trkHit);
-
-    return true;
-}
-*/
-
 std::ostream& TrackerSD::printHits(std::ostream& os)
 {
     for (G4TrackerHitList::const_iterator iter = _hits.begin(); iter != _hits.end(); iter++) {

lcdd/src/lcdd/processes
hits_collectionProcess.cc 1.1.2.1 -> 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- hits_collectionProcess.cc	14 Aug 2013 00:23:23 -0000	1.1.2.1
+++ hits_collectionProcess.cc	22 Aug 2013 20:24:38 -0000	1.1.2.2
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/processes/Attic/hits_collectionProcess.cc,v 1.1.2.1 2013/08/14 00:23:23 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/processes/Attic/hits_collectionProcess.cc,v 1.1.2.2 2013/08/22 20:24:38 jeremy Exp $
 
 // LCDD
 #include "lcdd/processes/hits_collectionProcess.hh"
@@ -27,8 +27,6 @@
     SAXObject** obj = Context()->GetTopObject();
     hits_collection* hitsCollection = new hits_collection;
 
-    std::cout << "setting hits_collection name: " << attrs.getValue("name") << std::endl;
-
     hitsCollection->set_name(attrs.getValue("name"));
 
     _obj = hitsCollection;
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