diff --git a/doc/musrSimAna.pdf b/doc/musrSimAna.pdf index b38f357..ec56288 100644 Binary files a/doc/musrSimAna.pdf and b/doc/musrSimAna.pdf differ diff --git a/doc/musrSimAna.tex b/doc/musrSimAna.tex index b6ca25b..0a821a6 100644 --- a/doc/musrSimAna.tex +++ b/doc/musrSimAna.tex @@ -314,6 +314,19 @@ All events should/have to be (?) saved in the Root tree This way the same counter can be used as two independent counters -- e.g.\ once as a veto detector for the M-counter, and simultaneously as a coincidence detector for a P-counter. In both cases the energy threshold and time windows are defined independently. + \item{\bf WRITE\_OUT\_DUMP\_FILE \emph{fileNameString} \emph{clockChannel} \emph{randomJitter}}\\ + If present, this command will create two output files, the so-called ``dump files'':\\ + {\tt data/TDC\_V1190\_200\_dump\_\emph{fileNameString}.bin} -- file that can be used + as an input to the PSI analysis front-end of a real experiment.\\ + {\tt data/TDC\_V1190\_200\_dump\_\emph{fileNameString}.txt} -- file that contains the same + information (hits) as the previous file, however in a human-readable form. The first number in the file + stands for the channel number, the second number stands for the time bin in the TDC bin units.\\ + \emph{clockChannel} ... the channel of the clock signal (typically 15).\\ + \emph{randomJitter} ... this value is in TDC bins, typically 0 or 8000 (?). If \emph{randomJitter} is smaller then + 1, then the hits in the dump files will be sorted according to time. If it is larger than 0, then + subsequent hits can be unordered in time, but the time difference never exceeds the value of \emph{randomJitter}. + This is just a technical thing serving to test the analysis software -- it should not + have any effect on the analysis results. \item{\bf musrTH1D \emph{histoName} \emph{histoTitle} \emph{nBins} \emph{min} \emph{max} \emph{variable} [{\tt rotreference} $\nu_{\rm RRF}$ $\phi_{\rm RRF}$]} \\ Defines a histogram (or more precisely an array of histograms, where the number of histograms @@ -462,6 +475,7 @@ All events should/have to be (?) saved in the Root tree \item[funct4] $=p_3 \exp((- x)/2.19703) \cdot (1+p_2 \cos(p_0 x+p_1)) + p_4$ \end{description} + \end{description} %======================================================================================================== \section{A real-life example: GPD instrument} diff --git a/musrSimAna/Makefile b/musrSimAna/Makefile index 040294a..1b4999b 100644 --- a/musrSimAna/Makefile +++ b/musrSimAna/Makefile @@ -13,7 +13,7 @@ all: musrRoot %.o:%.cxx $(CPP) -c $(CPPFLAGS) $^ -musrRoot: musrSimAna.o musrAnalysis.o musrCounter.o musrTH.o +musrRoot: musrSimAna.o musrAnalysis.o musrCounter.o musrTH.o musrWriteDump.o $(CPP) -o musrSimAna $(LDFLAGS) $^ clean: diff --git a/musrSimAna/musrAnalysis.cxx b/musrSimAna/musrAnalysis.cxx index 6dad6a9..873d284 100644 --- a/musrSimAna/musrAnalysis.cxx +++ b/musrSimAna/musrAnalysis.cxx @@ -8,6 +8,9 @@ #include //#include + +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="< STOP !!!"< STOP !!!"<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 ("<second)->GetNextGoodPositron(evID,dataBinMinimum,dataBinMax,tBin1,tBin2,kEntry,idetP,idetP_ID,idetP_edep); - // // std::cout<<"Debug 40 positronQuality="<0) { - // // std::cout<<"Debug 50"< double hit ==> through away this event. - // // std::cout<<"Debug 60"<2) {std::cout<<"DEBUGEVENT:"<1) goodPositronFound = true; - // } - // // std::cout<<"Debug 80"<0); - // // std::cout<<"Debug 90"< #include #include "musrCounter.hh" +#include "musrWriteDump.hh" //#include "musrTH.hh" #include @@ -300,7 +301,7 @@ public : virtual void PrintHitsInAllCounters(); virtual void InitialiseEvent(); virtual Double_t PreprocessEvent(Long64_t iEn); - virtual Bool_t 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); + virtual Bool_t 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); // virtual Bool_t MuonCounterHit(Int_t evID, Long64_t timeBinMin, Long64_t& timeBin0, Int_t& kEntry, Int_t& idet, Int_t& idetID, Double_t& idetEdep); void CopySubstring(char* inputChar,int iStart,int iEnd,char* outputChar); void MyPrintTree(); @@ -318,6 +319,7 @@ public : // Bool_t bool_debugingRequired; static const Double_t pi=3.14159265358979324; + static musrWriteDump* myWriteDump; private: std::string instrument; diff --git a/musrSimAna/musrCounter.cxx b/musrSimAna/musrCounter.cxx index 25a60bb..8fe3567 100644 --- a/musrSimAna/musrCounter.cxx +++ b/musrSimAna/musrCounter.cxx @@ -12,7 +12,7 @@ Bool_t musrCounter::bool_ignoreUnperfectPositrons = true; Bool_t musrCounter::bool_WriteDataToDumpFile = false; //Long64_t musrCounter::previousClock = -1; //Long64_t musrCounter::CLOCK_INTERVAL = 512000; -ofstream musrCounter::dumpFile; +//ofstream musrCounter::dumpFile; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... @@ -403,7 +403,8 @@ void musrCounter::DumpInfoToDumpFile(Int_t eventNr, Int_t detID, Long64_t tdcBin if (tdcBin>=musrAnalysis::rewindTimeBins) tdcBin -= musrAnalysis::rewindTimeBins; else if (tdcBin<0) tdcBin += musrAnalysis::rewindTimeBins; // Int_t tdc = (tdcBinsend_to_dump(detID,tdcBin,false); } //================================================================ void musrCounter::WriteRewindIntoDumpFile() { diff --git a/musrSimAna/musrCounter.hh b/musrSimAna/musrCounter.hh index ec3527b..0fca77d 100644 --- a/musrSimAna/musrCounter.hh +++ b/musrSimAna/musrCounter.hh @@ -104,7 +104,7 @@ class musrCounter { static Bool_t bool_ignoreUnperfectMuons; static Bool_t bool_ignoreUnperfectPositrons; static Bool_t bool_WriteDataToDumpFile; - static ofstream dumpFile; + // static ofstream dumpFile; // static Long64_t previousClock; // static Long64_t CLOCK_INTERVAL; };