Commit in projects/lcdd/trunk/src/lcdd/segmentation on MAIN
Segmentation.cc+7-123004 -> 3005
Add vector.reserve() call to resetBins() just in case.  Use bracket operator for setting bin values instead of insert() method.  Minor cleanup.

projects/lcdd/trunk/src/lcdd/segmentation
Segmentation.cc 3004 -> 3005
--- projects/lcdd/trunk/src/lcdd/segmentation/Segmentation.cc	2014-02-14 23:03:35 UTC (rev 3004)
+++ projects/lcdd/trunk/src/lcdd/segmentation/Segmentation.cc	2014-02-14 23:12:50 UTC (rev 3005)
@@ -6,6 +6,7 @@
 
 Segmentation::Segmentation(EType segType, int nbins) :
         _numBins(nbins), _type(segType) {
+
     // reserve nbins
     _bins.reserve(_numBins);
 
@@ -17,7 +18,7 @@
 }
 
 void Segmentation::setBin(int binIdx, int binVal) {
-    _bins.insert(_bins.begin() + binIdx, binVal);
+    _bins[binIdx] = binVal;
 }
 
 int Segmentation::getNumberOfBins() {
@@ -32,23 +33,17 @@
     return _type;
 }
 
-//G4ThreeVector Segmentation::getGlobalHitPos(const G4Step* aStep)
-//{
-//    return ReadoutUtil::computeMidPos(aStep);
-//}
-
-//G4ThreeVector Segmentation::getGlobalHitPosPreStep(const G4StepPoint* aPreStepPoint)
-//{
-//    //G4Exception("Do not use this method!");
-//    return aPreStepPoint->GetPosition();
-//}
-
 G4ThreeVector Segmentation::getLocalHitPosition(const G4ThreeVector& localStepPos) {
     return localStepPos;
 }
 
 void Segmentation::resetBins() {
+
+    // Clear the bin values.
     _bins.clear();
+
+    // Re-reserve space for new bin values, just in case.
+    _bins.reserve(_numBins);
 }
 
 void Segmentation::printOutBins(std::ostream& os, const std::vector<int>& bins) {
SVNspam 0.1


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