2.11.2011 Kamil Sedlak

1) Correcting bugs with the (multi)map treatment in routines
   musrCounter.cxx and musrScintSD.cc - the elements of the (multi)maps
   were erased in a loop over the (multi)maps, which is wrong.
2) Also the time variation is moved back to "process event" rather
   then "end of event" in the musrScintSD.cc  (is probably more realistic).
This commit is contained in:
2011-11-02 14:45:44 +00:00
parent f93a3c070b
commit db0c8f35ee
3 changed files with 80 additions and 29 deletions

View File

@ -218,7 +218,14 @@ void musrAnalysis::ReadInInputParameters(char* charV1190FileName) {
int ieventToDebug_tmp, iLevelToDebug_tmp;
sscanf(&line[0],"%*s %d %d",&ieventToDebug_tmp,&iLevelToDebug_tmp);
bool_debugingRequired=true;
debugEventMap.insert(std::pair<int,int>(ieventToDebug_tmp,iLevelToDebug_tmp));
if (ieventToDebug_tmp>-1) {
debugEventMap.insert(std::pair<int,int>(ieventToDebug_tmp,iLevelToDebug_tmp));
}
else {
for (int j=0; j<=-ieventToDebug_tmp;j++) {
debugEventMap.insert(std::pair<int,int>(j,iLevelToDebug_tmp));
}
}
}
else if (strcmp(tmpString0,"WRITE_OUT_DUMP_FILE")==0) {
// int clock_channelID_tmp;
@ -933,7 +940,7 @@ void musrAnalysis::AnalyseEvent(Long64_t iiiEntry) {
// Loop over several next event and preprocess them (i.e. fill
// them into the lists/maps of the class musrCounter).
if (bool_debugingRequired) {
if (debugEventMap[eventID]>0) {std::cout<<"DEBUGEVENT "<<eventID<<"_________________(before \"PreprocessEvent\"_________"<<std::endl;}
if (debugEventMap[eventID]>0) {std::cout<<"DEBUGEVENT "<<eventID<<"_________________ \"Preprocessing Event\"_________"<<std::endl;}
}
while (((iiiEntry>lastPreprocessedEntry)||(((nextUnfilledEventTime-currentTime)<safeTimeWindow))&&(!boolInfinitelyLowMuonRate)) && (lastPreprocessedEntry+1<nentries)) {
Double_t deltaT = PreprocessEvent(lastPreprocessedEntry+1);
@ -942,7 +949,7 @@ void musrAnalysis::AnalyseEvent(Long64_t iiiEntry) {
fChain->GetEntry(iiiEntry); InitialiseEvent();
if (bool_debugingRequired) {
if (debugEventMap[eventID]>2) PrintHitsInAllCounters();
if (debugEventMap[eventID]>1) {std::cout<<"DEBUGEVENT "<<eventID<<"_________________(after \"PreprocessEvent\"_________"<<std::endl;}
// if (debugEventMap[eventID]>1) {std::cout<<"DEBUGEVENT "<<eventID<<"_________________(after \"PreprocessEvent\"_________"<<std::endl;}
}
// Loop over all interesting "moments", which are:
@ -959,11 +966,12 @@ void musrAnalysis::AnalyseEvent(Long64_t iiiEntry) {
// (*it).second->myPrintThisCounter(eventID);
// }
if (bool_debugingRequired) {
if (debugEventMap[eventID]>1) {std::cout<<"DEBUGEVENT "<<eventID<<"_________________(before \"FillHistograms\"_________"<<std::endl;}
if (debugEventMap[eventID]>1) {std::cout<<"DEBUGEVENT "<<eventID<<"_________________(\"Filling Histograms\"_________"<<std::endl;}
}
FillHistograms(iiiEntry);
if (bool_debugingRequired) {
if (debugEventMap[eventID]>1) {std::cout<<"DEBUGEVENT "<<eventID<<"_________________(after \"FillHistograms\"_________"<<std::endl;}
// if (debugEventMap[eventID]>1) {std::cout<<"DEBUGEVENT "<<eventID<<"_________________(after \"FillHistograms\"_________"<<std::endl;}
if (debugEventMap[eventID]>1) {std::cout<<"____________________________________________________________________"<<std::endl;}
}
@ -1015,7 +1023,7 @@ void musrAnalysis::RewindAllTimeInfo() {
//================================================================
void musrAnalysis::PrintHitsInAllCounters() {
std::cout<<"___________________\n";
// std::cout<<"___________________\n";
for (counterMapType::const_iterator it = allCounterMap.begin(); it!=allCounterMap.end(); ++it) {
(*it).second->myPrintThisCounter(eventID,0);
}
@ -1080,6 +1088,10 @@ void musrAnalysis::FillHistograms(Int_t iiiEntry) {
Long64_t dataBinMin = timeBin0+dataWindowBinMin;
Long64_t dataBinMax = timeBin0+dataWindowBinMax;
pCounterHitExistsForThisEventID = PositronCounterHit(eventID,dataBinMin,dataBinMax,timeBin1,timeBin2,posEntry,idetP,idetP_ID,idetP_edep);
if (debugEventMap[eventID]>2) {
if (pCounterHitExistsForThisEventID) {std::cout<<"FillHistograms: GOOD positron candidate found ("<<timeBin1<<")"<<std::endl;}
else {std::cout<<"FillHistograms: NO positron candidate found"<<std::endl;}
}
//cDEL if (pCounterHitExistsForThisEventID) std::cout<<" timeBin1-timeBin2 = "<<timeBin1<<"-"<<timeBin2<<"="<<timeBin1-timeBin2 <<std::endl;
//
if (pCounterHitExistsForThisEventID&&(posEntry>0)) {
@ -1381,7 +1393,7 @@ Double_t musrAnalysis::PreprocessEvent(Long64_t iEn) {
Bool_t musrAnalysis::PositronCounterHit(Int_t evID, Long64_t dataBinMin, Long64_t dataBinMax, Long64_t& tBin1, Long64_t& tBin2, Int_t& kEntry, Int_t& idetP, Int_t& idetP_ID, Double_t& idetP_edep) {
if (bool_debugingRequired) {
if (debugEventMap[eventID]>2) {std::cout<<"DEBUGEVENT:"<<eventID<<"\"PositronCounterHit\": pCounterMap.size()="<<pCounterMap.size()<<std::endl;}
if (debugEventMap[eventID]>4) {std::cout<<"PositronCounterHit: pCounterMap.size()="<<pCounterMap.size()<<std::endl;}
}
if (pCounterMap.empty()) return false;
@ -1393,9 +1405,15 @@ Bool_t musrAnalysis::PositronCounterHit(Int_t evID, Long64_t dataBinMin, Long64_
// Loop over all positron counters
for (counterMapType::const_iterator it = pCounterMap.begin(); it!=pCounterMap.end(); ++it) {
positronQuality = (it->second)->GetNextGoodPositron(evID,dataBinMin,dataBinMax,tBin1,tBin2,kEntry,idetP,idetP_ID,idetP_edep);
if (positronQuality==3) return false; // double hit was found in the same counter
if (positronQuality==3) { // double hit was found in the same counter
if (debugEventMap[eventID]>3) {std::cout<<"PositronCounterHit: positron candidate killed - double hit in the same counter"<<std::endl;}
return false;
}
if (positronQuality==2) {
if (goodPositronFound) return false; // double hit was found in a different counter
if (goodPositronFound) {
if (debugEventMap[eventID]>3) {std::cout<<"PositronCounterHit: positron candidate killed - double hit in a different counter"<<std::endl;}
return false; // double hit was found in a different counter
}
goodPositronFound = true;
}
}