Commit in lcdd/src/lcdd/detectors on MAIN | |||
CellReadout2DSegmentation.cc | +37 | -20 | 1.7 -> 1.8 |
use debugging macro
diff -u -r1.7 -r1.8 --- CellReadout2DSegmentation.cc 6 Sep 2013 04:09:00 -0000 1.7 +++ CellReadout2DSegmentation.cc 9 Sep 2013 22:11:17 -0000 1.8 @@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/CellReadout2DSegmentation.cc,v 1.7 2013/09/06 04:09:00 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/lcdd/detectors/CellReadout2DSegmentation.cc,v 1.8 2013/09/09 22:11:17 jeremy Exp $
// LCDD #include "lcdd/detectors/CellReadout2DSegmentation.hh"
@@ -11,6 +11,9 @@
// STL #include <cmath>
+// Comment out to remove debug prints. +#define CellReadout2DSegmentation_DEBUG 1 +
CellReadout2DSegmentation::CellReadout2DSegmentation(double cellSizeX, double cellSizeY) : Segmentation(Segmentation::eNonprojective, 2) {
@@ -25,7 +28,9 @@
G4ThreeVector CellReadout2DSegmentation::getGlobalHitPosition(const G4Step* aStep) {
+#ifdef CellReadout2DSegmentation_DEBUG
std::cout << "CellReadout2DSegmentation::getGlobalHitPosition" << std::endl;
+#endif
// Setup the readout with step dependent information. setup(aStep);
@@ -33,65 +38,72 @@
// Compute the mid-point of the global step. G4ThreeVector globalStepPosition = ReadoutUtil::computeMidPos(aStep);
- // DEBUG
+#ifdef CellReadout2DSegmentation_DEBUG
std::cout << "globalStepPosition: " << globalStepPosition.x() << " " << globalStepPosition.y() << " " << globalStepPosition.z() << std::endl;
+#endif
// Compute the local step position. G4ThreeVector localStepPosition = ReadoutUtil::transformGlobalToLocal(aStep, globalStepPosition);
- // DEBUG
+#ifdef CellReadout2DSegmentation_DEBUG
std::cout << "localStepPosition: " << localStepPosition.x() << " " << localStepPosition.y() << " " << localStepPosition.z() << std::endl;
+#endif
// Convert into readout coordinates. CellReadout::Position2D readoutStepPosition = localToReadoutCoordinates(localStepPosition);
- // DEBUG
+#ifdef CellReadout2DSegmentation_DEBUG
std::cout << "readoutStepPosition: " << readoutStepPosition.x << " " << readoutStepPosition.y << std::endl;
+#endif
// Compute the cell indices from the position. CellReadout::CellId cell = _readout->cellId(readoutStepPosition);
- // DEBUG
+#ifdef CellReadout2DSegmentation_DEBUG
std::cout << "cell: " << cell.ix << " " << cell.iy << std::endl;
+#endif
// Get the cell's readout position from the cell ID. CellReadout::Position2D cellReadoutPosition = _readout->position(cell);
- // DEBUG
+#ifdef CellReadout2DSegmentation_DEBUG
std::cout << "cellReadoutPosition: " << cellReadoutPosition.x << " " << cellReadoutPosition.y << std::endl;
+#endif
// Convert from readout back to localcoordinates. G4ThreeVector localCellPosition = readoutToLocalCoordinates(cellReadoutPosition);
- // DEBUG
+#ifdef CellReadout2DSegmentation_DEBUG
std::cout << "localCellPosition: "<< localCellPosition.x() << " " << localCellPosition.y() << " " << localCellPosition.z() << std::endl;
+#endif
- // Finally convert from the local coordinates into global.
+ // Finally, convert from the local coordinates into global.
G4ThreeVector globalCellPosition = ReadoutUtil::transformLocalToGlobal(aStep, localCellPosition);
- // DEBUG
+#ifdef CellReadout2DSegmentation_DEBUG
std::cout << "globalCellPosition: " << globalCellPosition.x() << " " << globalCellPosition.y() << " " << globalCellPosition.z() << std::endl;
-
std::cout << std::endl;
+#endif
return globalCellPosition; } void CellReadout2DSegmentation::setBins(const G4Step* aStep) {
- // DEBUG
+#ifdef CellReadout2DSegmentation_DEBUG
std::cout << "CellReadout2DSegmentation::setBins" << std::endl;
+#endif
// Setup the readout with step dependent information. setup(aStep);
- // DEBUG
+#ifdef CellReadout2DSegmentation_DEBUG
G4ThreeVector prePosition = aStep->GetPreStepPoint()->GetPosition();
- //std::setprecision(10);
std::cout << "step pos: " << prePosition.x() << " " << prePosition.y() << " " << prePosition.z() << std::endl;
+#endif
// Set state from current step. setup(aStep);
@@ -99,40 +111,44 @@
// Compute the global mid-point of the step. G4ThreeVector globalStepPos = ReadoutUtil::computeMidPos(aStep);
- // DEBUG
+#ifdef CellReadout2DSegmentation_DEBUG
std::cout << "globalStepPos: " << globalStepPos.x() << " " << globalStepPos.y() << " " << globalStepPos.z() << std::endl;
+#endif
// Compute the local step position from the global mid-point. G4ThreeVector localStepPos = ReadoutUtil::transformGlobalToLocal(aStep, globalStepPos);
- // DEBUG
+#ifdef CellReadout2DSegmentation_DEBUG
std::cout << "localStepPos: " << localStepPos.x() << " " << localStepPos.y() << " " << localStepPos.z() << std::endl;
+#endif
// Compute the X and Y readout coordinates from the local position. CellReadout::Position2D readoutPosition = localToReadoutCoordinates(localStepPos);
- // DEBUG
+#ifdef CellReadout2DSegmentation_DEBUG
std::cout << "readoutPosition: " << readoutPosition.x << " " << readoutPosition.y << std::endl;
+#endif
// Get the cell for the position. CellReadout::CellId cell = _readout->cellId(readoutPosition);
- // DEBUG
+#ifdef CellReadout2DSegmentation_DEBUG
std::cout << "cellID: " << cell.ix << " " << cell.iy << std::endl;
+#endif
// Set the segmentation's bin values. this->setBin(0, readoutPosition.x); this->setBin(1, readoutPosition.y);
- // DEBUG
+#ifdef CellReadout2DSegmentation_DEBUG
// print the neighbor CellIds CellReadout::Neighbors neighbors = _readout->neighbors(cell); std::cout << "neighbors: " << std::endl; for (CellReadout::Neighbors::const_iterator it = neighbors.begin(); it != neighbors.end(); it++) { std::cout << " " << (*it).ix << ", " << (*it).iy << std::endl; }
-
std::cout << std::endl;
+#endif
} void CellReadout2DSegmentation::setBinNames()
@@ -153,8 +169,9 @@
_readout->setDimensionX(box->GetXHalfLength() * 2); _readout->setDimensionY(box->GetYHalfLength() * 2);
- // DEBUG
+#ifdef CellReadout2DSegmentation_DEBUG
std::cout << "set readout dimensions XY: " << _readout->getDimensionX() << " " << _readout->getDimensionY() << std::endl;
+#endif
} CellReadout::Position2D CellReadout2DSegmentation::localToReadoutCoordinates(G4ThreeVector& vec)
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