|
|
|
@ -8,6 +8,9 @@
|
|
|
|
|
#include <TF1.h>
|
|
|
|
|
//#include <math.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
musrWriteDump* musrAnalysis::myWriteDump = NULL;
|
|
|
|
|
|
|
|
|
|
void musrAnalysis::Loop(char* runChar, char* v1190FileName, Int_t nrEvents)
|
|
|
|
|
{
|
|
|
|
|
// In a ROOT session, you can do:
|
|
|
|
@ -228,21 +231,24 @@ void musrAnalysis::ReadInInputParameters(char* charV1190FileName) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(tmpString0,"WRITE_OUT_DUMP_FILE")==0) {
|
|
|
|
|
// int clock_channelID_tmp;
|
|
|
|
|
int clock_channelID;
|
|
|
|
|
int max_timeBin_jitter;
|
|
|
|
|
// int clock_interval_tmp;
|
|
|
|
|
// sscanf(&line[0],"%*s %s %d %d",tmpString1,&clock_channelID_tmp,&clock_interval_tmp);
|
|
|
|
|
sscanf(&line[0],"%*s %s",tmpString1);
|
|
|
|
|
sscanf(&line[0],"%*s %s %d %d",tmpString1,&clock_channelID,&max_timeBin_jitter);
|
|
|
|
|
// clock_channelID = clock_channelID_tmp;
|
|
|
|
|
// clock_interval = clock_interval_tmp;
|
|
|
|
|
musrCounter::bool_WriteDataToDumpFile = true;
|
|
|
|
|
// std::cout<<"tmpString1="<<tmpString1<<std::endl;
|
|
|
|
|
if ((strcmp(tmpString1,"")!=0)&&(strcmp(tmpString1,"Unset")!=0)) musrCounter::dumpFile.open(tmpString1);
|
|
|
|
|
// musrCounter::dumpFile.open("dumpFile.txt");
|
|
|
|
|
if (! (musrCounter::dumpFile.is_open()) ) {
|
|
|
|
|
std::cout<<"Writing data into a DumpFile was requested, but the dump file can not be opened!"<<std::cout;
|
|
|
|
|
std::cout<<" ===> STOP !!!"<<std::endl;
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
// if ((strcmp(tmpString1,"")!=0)&&(strcmp(tmpString1,"Unset")!=0)) musrCounter::dumpFile.open(tmpString1);
|
|
|
|
|
// // musrCounter::dumpFile.open("dumpFile.txt");
|
|
|
|
|
// if (! (musrCounter::dumpFile.is_open()) ) {
|
|
|
|
|
// std::cout<<"Writing data into a DumpFile was requested, but the dump file can not be opened!"<<std::cout;
|
|
|
|
|
// std::cout<<" ===> STOP !!!"<<std::endl;
|
|
|
|
|
// exit(1);
|
|
|
|
|
// }
|
|
|
|
|
// myWriteDump = new musrWriteDump(charV1190FileName,clock_channelID,max_timeBin_jitter);
|
|
|
|
|
myWriteDump = new musrWriteDump(tmpString1,clock_channelID,max_timeBin_jitter);
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(tmpString0,"USE_UNPERFECT_POSITRONS_IN_DOUBLE_HITS")==0) {
|
|
|
|
|
musrCounter::bool_ignoreUnperfectPositrons = false;
|
|
|
|
@ -905,8 +911,14 @@ void musrAnalysis::SaveHistograms(char* runChar, char* v1190FileName) {
|
|
|
|
|
fHistograms->Close();
|
|
|
|
|
delete fHistograms;
|
|
|
|
|
|
|
|
|
|
if (musrCounter::bool_WriteDataToDumpFile==true) {
|
|
|
|
|
musrCounter::dumpFile.close();
|
|
|
|
|
// if (musrCounter::bool_WriteDataToDumpFile==true) {
|
|
|
|
|
// musrCounter::dumpFile.close();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if (musrCounter::bool_WriteDataToDumpFile) {
|
|
|
|
|
if (myWriteDump!=NULL) {
|
|
|
|
|
delete myWriteDump;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//==============================
|
|
|
|
@ -1087,9 +1099,12 @@ void musrAnalysis::FillHistograms(Int_t iiiEntry) {
|
|
|
|
|
numberOfGoodMuons++;
|
|
|
|
|
Long64_t dataBinMin = timeBin0+dataWindowBinMin;
|
|
|
|
|
Long64_t dataBinMax = timeBin0+dataWindowBinMax;
|
|
|
|
|
pCounterHitExistsForThisEventID = PositronCounterHit(eventID,dataBinMin,dataBinMax,timeBin1,timeBin2,posEntry,idetP,idetP_ID,idetP_edep);
|
|
|
|
|
// Long64_t positronBinMax = timeBin0+pileupWindowBinMax+dataWindowBinMin;
|
|
|
|
|
Long64_t positronBinMax = dataBinMax-dataWindowBinMin; // note that "dataWindowBinMin" is normally negative, i.e. positronBinMax > dataBinMax !!!
|
|
|
|
|
pCounterHitExistsForThisEventID = PositronCounterHit(eventID,dataBinMin,dataBinMax,positronBinMax,timeBin1,timeBin2,posEntry,idetP,idetP_ID,idetP_edep);
|
|
|
|
|
if (debugEventMap[eventID]>2) {
|
|
|
|
|
if (pCounterHitExistsForThisEventID) {std::cout<<"FillHistograms: GOOD positron candidate found ("<<timeBin1<<")"<<std::endl;}
|
|
|
|
|
if (pCounterHitExistsForThisEventID) {std::cout<<"FillHistograms: GOOD positron candidate found: timeBin1="<<timeBin1
|
|
|
|
|
<<", deltat+800="<<timeBin1-timeBin0+800 <<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;
|
|
|
|
@ -1390,7 +1405,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) {
|
|
|
|
|
Bool_t musrAnalysis::PositronCounterHit(Int_t evID, Long64_t dataBinMin, Long64_t dataBinMax, Long64_t positronBinMax, 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]>4) {std::cout<<"PositronCounterHit: pCounterMap.size()="<<pCounterMap.size()<<std::endl;}
|
|
|
|
@ -1404,7 +1419,8 @@ Bool_t musrAnalysis::PositronCounterHit(Int_t evID, Long64_t dataBinMin, Long64_
|
|
|
|
|
if (musrMode=='D') {
|
|
|
|
|
// 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);
|
|
|
|
|
// positronQuality = (it->second)->GetNextGoodPositron(evID,dataBinMin,dataBinMax,tBin1,tBin2,kEntry,idetP,idetP_ID,idetP_edep);
|
|
|
|
|
positronQuality = (it->second)->GetNextGoodPositron(evID,dataBinMin,positronBinMax,tBin1,tBin2,kEntry,idetP,idetP_ID,idetP_edep);
|
|
|
|
|
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;
|
|
|
|
@ -1419,33 +1435,9 @@ Bool_t musrAnalysis::PositronCounterHit(Int_t evID, Long64_t dataBinMin, Long64_
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Long64_t dataBinMinimum = dataBinMin;
|
|
|
|
|
// do {
|
|
|
|
|
// // std::cout<<"Debug 30"<<std::endl;
|
|
|
|
|
// positronQuality = (it->second)->GetNextGoodPositron(evID,dataBinMinimum,dataBinMax,tBin1,tBin2,kEntry,idetP,idetP_ID,idetP_edep);
|
|
|
|
|
// // std::cout<<"Debug 40 positronQuality="<<positronQuality<<std::endl;
|
|
|
|
|
// dataBinMinimum=tBin1+1; // If a positron is found, one needs to search again through the remaining hits in this counter.
|
|
|
|
|
// if (positronQuality>0) {
|
|
|
|
|
// // std::cout<<"Debug 50"<<std::endl;
|
|
|
|
|
// if (positronHitFound) { // Positron found now but also previously ==> double hit ==> through away this event.
|
|
|
|
|
// // std::cout<<"Debug 60"<<std::endl;
|
|
|
|
|
// if (bool_debugingRequired) {
|
|
|
|
|
// if (debugEventMap[eventID]>2) {std::cout<<"DEBUGEVENT:"<<eventID
|
|
|
|
|
// <<"\"PositronCounterHit\": Coincidence with other positron candidate in other counter."<<std::endl;}
|
|
|
|
|
// }
|
|
|
|
|
// return false;
|
|
|
|
|
// } // end of "positronHitFound"
|
|
|
|
|
// // std::cout<<"Debug 70"<<std::endl;
|
|
|
|
|
// positronHitFound = true;
|
|
|
|
|
// if (positronQuality>1) goodPositronFound = true;
|
|
|
|
|
// }
|
|
|
|
|
// // std::cout<<"Debug 80"<<std::endl;
|
|
|
|
|
// } while (positronQuality>0);
|
|
|
|
|
// // std::cout<<"Debug 90"<<std::endl;
|
|
|
|
|
// }
|
|
|
|
|
// std::cout<<"Debug 100 positronQuality="<<positronQuality<<std::endl;
|
|
|
|
|
|
|
|
|
|
if (goodPositronFound) return true;
|
|
|
|
|
// if (goodPositronFound) return true;
|
|
|
|
|
if (goodPositronFound&&(tBin1<dataBinMax)) return true;
|
|
|
|
|
}
|
|
|
|
|
// std::cout<<"Debug 110"<<std::endl;
|
|
|
|
|
return false;
|
|
|
|
|