Commit in projects/lcdd/branches/v05-00-00-dev/src/lcdd on MAIN | |||
detectors/DDSegmentationCalorimeterHitProcessor.cc | +74 | -29 | 3293 -> 3294 |
id/IdFactory.cc | -3 | 3293 -> 3294 | |
+74 | -32 |
Cleanup debug output. Use macro in DDSegmentationCalorimeterHitProcessor to enable debug prints (off by default).
--- projects/lcdd/branches/v05-00-00-dev/src/lcdd/detectors/DDSegmentationCalorimeterHitProcessor.cc 2014-09-02 20:24:59 UTC (rev 3293) +++ projects/lcdd/branches/v05-00-00-dev/src/lcdd/detectors/DDSegmentationCalorimeterHitProcessor.cc 2014-09-02 20:32:38 UTC (rev 3294) @@ -19,6 +19,10 @@
#include "G4Geantino.hh" #include "G4ChargedGeantino.hh"
+#include <math.h> + +//#define DDSegmentationCalorimeterHitProcessor_DEBUG +
DDSegmentationCalorimeterHitProcessor::DDSegmentationCalorimeterHitProcessor() { }
@@ -27,11 +31,15 @@
bool DDSegmentationCalorimeterHitProcessor::processHits(G4Step* step) {
- //G4cout << "DDSegmentationCalorimeterHitProcessor::processHits" << G4endl;
+#ifdef DDSegmentationCalorimeterHitProcessor_DEBUG + G4cout << "DDSegmentationCalorimeterHitProcessor::processHits" << G4endl; +#endif
// Get the energy deposition. G4double edep = step->GetTotalEnergyDeposit();
- //G4cout << " edep: " << edep << G4endl;
+#ifdef DDSegmentationCalorimeterHitProcessor_DEBUG + G4cout << " edep: " << edep << G4endl; +#endif
// Check for Geantino particle type. G4ParticleDefinition* def = step->GetTrack()->GetDefinition();
@@ -40,15 +48,22 @@
isGeantino = true; }
+ // Get touchable from the PreStepPoint. + G4TouchableHandle touchable = step->GetPreStepPoint()->GetTouchableHandle(); +#ifdef DDSegmentationCalorimeterHitProcessor_DEBUG + G4cout << " stepLen: " << step->GetStepLength() << G4endl; + G4cout << " lvol: " << touchable->GetVolume()->GetLogicalVolume()->GetName() << G4endl; + G4cout << " mat: " << touchable->GetVolume()->GetLogicalVolume()->GetMaterial()->GetName() << G4endl; +#endif +
// Cut on energy deposition <= cut but allow Geantinos. if (edep <= _calorimeter->getEnergyCut() && isGeantino == false) {
- //G4cout << " cut on low energy" << G4endl;
+#ifdef DDSegmentationCalorimeterHitProcessor_DEBUG + G4cout << " cut on low energy: " << edep << G4endl; +#endif
return false; }
- // Get touchable from the PreStepPoint. - G4TouchableHandle touchable = step->GetPreStepPoint()->GetTouchableHandle(); -
// Get the Segmentation object. DD4hep::DDSegmentation::Segmentation* segmentation = _calorimeter->getDDSegmentation();
@@ -58,13 +73,31 @@
// Compute the global midpoint of the step using the pre and post step points. G4ThreeVector globalMidVec = (0.5 * (step->GetPreStepPoint()->GetPosition() + step->GetPostStepPoint()->GetPosition()));
+#ifdef DDSegmentationCalorimeterHitProcessor_DEBUG + G4cout << " globalMidVec: " << globalMidVec.x() << " " << globalMidVec.y() << " " << globalMidVec.z() << G4endl; +#endif +
// Create the global position for input to the Segmentation. DD4hep::DDSegmentation::Vector3D globalPosition = DD4hep::DDSegmentation::Vector3D(globalMidVec.x(), globalMidVec.y(), globalMidVec.z());
+#ifdef DDSegmentationCalorimeterHitProcessor_DEBUG + G4cout << " globalPosition: " << globalPosition.x() << " " << globalPosition.y() << " " << globalPosition.z() << G4endl; +#endif +
// Compute the local step position for input to the Segmentation. G4ThreeVector localVec = touchable->GetHistory()->GetTopTransform().TransformPoint(globalMidVec);
+ +#ifdef DDSegmentationCalorimeterHitProcessor_DEBUG + G4cout << " localVec: " << localVec.x() << " " << localVec.y() << " " << localVec.z() << G4endl; +#endif +
DD4hep::DDSegmentation::Vector3D localPosition = DD4hep::DDSegmentation::Vector3D(localVec.x(), localVec.y(), localVec.z());
+ //DD4hep::DDSegmentation::Vector3D localPosition = DD4hep::DDSegmentation::Vector3D(localVec.x(), localVec.y(), 0);
+#ifdef DDSegmentationCalorimeterHitProcessor_DEBUG + G4cout << " localPosition: " << localPosition.x() << " " << localPosition.y() << " " << localPosition.z() << G4endl; +#endif +
// Create the VolumeID which does not have Segmentation bin values. DD4hep::DDSegmentation::VolumeID volumeId = IdFactory::createVolumeId(step, _calorimeter->getIdSpec());
@@ -77,33 +110,37 @@
// Was there a hit found with this identifier? if (hit == NULL) {
- //G4cout << " creating a new hit " << G4endl; - //G4cout << " cellID: " << std::hex << cellId << G4endl;
+#ifdef DDSegmentationCalorimeterHitProcessor_DEBUG + G4cout << " creating a new hit " << G4endl; + G4cout << " cellID: " << std::hex << cellId << G4endl; + G4cout << " fieldDescription: " << segmentation->decoder()->fieldDescription() << G4endl; + int size = segmentation->decoder()->size(); + G4cout << " size: " << size << G4endl; + for (int i=0; i<size; i++) { + G4cout << " value[" << i << "] = " << std::dec << (*segmentation->decoder())[i] << G4endl; + } +#endif
- //G4cout << " fieldDescription: " << segmentation->decoder()->fieldDescription() << G4endl; - - //int size = segmentation->decoder()->size(); - //G4cout << " size: " << size << G4endl; - //for (int i=0; i<size; i++) { - // G4cout << " value[" << i << "] = " << std::dec << (*segmentation->decoder())[i] << G4endl; - //} -
int id0 = segmentation->decoder()->lowWord(); int id1 = segmentation->decoder()->highWord(); Id64bit id = Id64bit(id0, id1);
- //G4cout << " id0: " << std::hex << id0 << G4endl; - //G4cout << " id1: " << std::hex << id1 << G4endl;
+#ifdef DDSegmentationCalorimeterHitProcessor_DEBUG + G4cout << " id0: " << std::hex << id0 << G4endl; + G4cout << " id1: " << std::hex << id1 << G4endl; +#endif
// Get the global cell position from the Segmentation. DD4hep::DDSegmentation::Vector3D localCellPosition = segmentation->position(cellId);
- //G4cout << "local cell position: " - // << std::dec - // << localCellPosition.x() << ", " - // << localCellPosition.y() << ", " - // << localCellPosition.z() << G4endl;
+#ifdef DDSegmentationCalorimeterHitProcessor_DEBUG + G4cout << " localCellPosition: " + << std::dec + << localCellPosition.x() << " " + << localCellPosition.y() << " " + << localCellPosition.z() << G4endl; +#endif
// Create a G4ThreeVector for the hit's local cell position. G4ThreeVector localCellVec = G4ThreeVector(localCellPosition.x(), localCellPosition.y(), localCellPosition.z());
@@ -111,11 +148,13 @@
// Compute the global cell position from the local. G4ThreeVector globalCellVec = touchable->GetHistory()->GetTopTransform().Inverse().TransformPoint(localCellVec);
- //G4cout << "global cell position: " - // << std::dec - // << globalCellVec.x() << ", " - // << globalCellVec.y() << ", " - // << globalCellVec.z() << G4endl;
+#ifdef DDSegmentationCalorimeterHitProcessor_DEBUG + G4cout << " globalCellPosition: " + << std::dec + << globalCellVec.x() << ", " + << globalCellVec.y() << ", " + << globalCellVec.z() << G4endl; +#endif
// No hit was found, so a new one is created. hit = new CalorimeterHit(id, edep, globalCellVec);
@@ -125,7 +164,9 @@
} else {
- //G4cout << "adding " << std::dec << edep << " to existing hit" << G4endl;
+#ifdef DDSegmentationCalorimeterHitProcessor_DEBUG + G4cout << " adding " << std::dec << edep << " to existing hit" << G4endl; +#endif
// Add energy deposition to an existing hit. hit->addEdep(edep);
@@ -135,6 +176,10 @@
// FIXME: This should pass a pointer to a new object. It is copied, which is inefficient. hit->addHitContribution(HitContribution(CurrentTrackState::getCurrentTrackID(), step));
+#ifdef DDSegmentationCalorimeterHitProcessor_DEBUG + G4cout << " done!" << G4endl; +#endif +
// Return true, indicating that a hit was added or modified. return true; }
--- projects/lcdd/branches/v05-00-00-dev/src/lcdd/id/IdFactory.cc 2014-09-02 20:24:59 UTC (rev 3293) +++ projects/lcdd/branches/v05-00-00-dev/src/lcdd/id/IdFactory.cc 2014-09-02 20:32:38 UTC (rev 3294) @@ -383,20 +383,17 @@
} DD4hep::DDSegmentation::VolumeID IdFactory::createVolumeId(G4Step* aStep, IdSpec* idspec) {
- //std::cout << "IdFactory::createVolumeId" << std::endl;
IdVec idvec; for (IdSpec::IdFields::const_iterator iter = idspec->IdFieldsBegin(); iter != idspec->IdFieldsEnd(); iter++) { IdField* field = *iter; std::vector<G4VPhysicalVolume*> pvolumes = ReadoutUtil::getPhysVolList(aStep); if (hasPhysVolId(pvolumes, field->getLabel())) { int pvolId = findIdInPhysVols(pvolumes, field->getLabel());
- //G4cout << "VolumeId::" << field->getLabel() << " = " << pvolId << G4endl;
idvec.addFieldValue(pvolId); } else { idvec.addFieldValue(0); } }
- G4cout << G4endl;
Id64bit id = IdFactory::createIdentifier(idvec, idspec); id.encode(); Id64bit::ValueType volId = id.getValue();
Use REPLY-ALL to reply to list
To unsubscribe from the LCDET-SVN list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCDET-SVN&A=1