Commit 5184fd31 authored by dino's avatar dino
Browse files

recovered r1271M replayed on top of r1271

git-svn-id: svn://gal-serv.lnl.infn.it/agata/trunk/narval_emulator@1272 170316e4-aea8-4b27-aad4-0380ec0519c9
parent b7cf5393
...@@ -10,6 +10,7 @@ using namespace std; ...@@ -10,6 +10,7 @@ using namespace std;
#define EXCLUDE_TST_ZERO // discard events with timestamp=0; count them as errors #define EXCLUDE_TST_ZERO // discard events with timestamp=0; count them as errors
//#define CHECK_DETAILS // DEBUG //#define CHECK_DETAILS // DEBUG
const bool discardOutOfOrderEvents = true; // if true, doReorderEvents is redundant
const bool doReorderEvents = true; // fix timestamp inversion events while they are inserted into the queue const bool doReorderEvents = true; // fix timestamp inversion events while they are inserted into the queue
UInt_t EventQueue::addData(UInt_t * i4dat, UInt_t n4dat, Int_t tstCorr) UInt_t EventQueue::addData(UInt_t * i4dat, UInt_t n4dat, Int_t tstCorr)
...@@ -81,10 +82,17 @@ UInt_t EventQueue::addData(UInt_t * i4dat, UInt_t n4dat, Int_t tstCorr) ...@@ -81,10 +82,17 @@ UInt_t EventQueue::addData(UInt_t * i4dat, UInt_t n4dat, Int_t tstCorr)
tstNew += tstCorr; // apply timestamp correction tstNew += tstCorr; // apply timestamp correction
if(tstNew < tstLast)
if (tstNew < tstLast) {
errCount++; // timestamp inversions counted as errors errCount++; // timestamp inversions counted as errors
if (discardOutOfOrderEvents) {
i4dat += i4len; // remove this event from the input buffer
n4dat -= i4len;
continue;
}
}
if(!doReorderEvents || tstNew >= tstLast || numEvts==0) { if (tstNew >= tstLast || numEvts == 0 || !doReorderEvents) {
// don't care, or no inversion, or queue is empty // don't care, or no inversion, or queue is empty
memcpy(data+indNext, i4dat, i4len*sizeof(UInt_t)); memcpy(data+indNext, i4dat, i4len*sizeof(UInt_t));
if(tstCorr) if(tstCorr)
......
#ifndef COMMONDEFS_H #ifndef COMMONDEFS_H
#define COMMONDEFS_H #define COMMONDEFS_H
/* /*
* From the manpages of gcc. * From the manpages of gcc.
* to show all the predefined macros: * to show all the predefined macros:
......
...@@ -895,10 +895,11 @@ Int_t PostPSAFilter::Process() ...@@ -895,10 +895,11 @@ Int_t PostPSAFilter::Process()
} }
#endif #endif
// 12) fix the timing // 12) fix the timing
CoreT[0] += fShiftTimeCC*0.1f; CoreT[0] += fShiftTimeCC*0.1f;
//CoreT[1] += fShiftTimeCC*0.1f; // leave here the old value //CoreT[1] += fShiftTimeCC*0.1f; // leave here the old value
#if 1 #if 1 // Should be a Parameter //
// Move the integer part of the trace position to the timestamp ==> // Move the integer part of the trace position to the timestamp ==>
// removes most of the time-walk due to the use of a LE trigger in the preprocessing elctronics. // removes most of the time-walk due to the use of a LE trigger in the preprocessing elctronics.
// CoreT[0] holds the fractional part; CoreT[1] is left unchanged for control purposes // CoreT[0] holds the fractional part; CoreT[1] is left unchanged for control purposes
...@@ -988,7 +989,27 @@ Int_t PostPSAFilter::Process() ...@@ -988,7 +989,27 @@ Int_t PostPSAFilter::Process()
} }
#ifdef PPS_MULTIHIST #ifdef PPS_MULTIHIST
// 16) repeat PostMatrXYZ, but only for total projections, placed at the last position
// 16-1) flat histograms of the final event
if (PostSpecEner) {
float efinalSG = 0;
float efinalCC = 0;
for (UInt_t nh = 0; nh < number_of_hits; nh++) {
locHit_t *pLoc = locHit + nh;
if (!pLoc->valid)
continue;
int netSeg = pLoc->Sg;
PostSpecEner->Incr(4, netSeg, (int)(pLoc->eSGcorr*fEnergyGain)); //
PostSpecEner->Incr(4, kNSG, (int)(pLoc->eSGcorr*fEnergyGain)); // 36 OR SG
PostSpecEner->Incr(4, kNSG + 1, (int)(pLoc->eCCcorr*fEnergyGain)); // 37 OR CC
efinalSG += pLoc->eSGcorr;
efinalCC += pLoc->eCCcorr;
}
PostSpecEner->Incr(4, kNSG + 2, (int)(efinalSG*fEnergyGain)); // 38 sum of segments
PostSpecEner->Incr(4, kNSG + 3, (int)(CoreE[0]*fEnergyGain)); // 39 core
}
// 16-2) repeat PostMatrXYZ, but only for total projections, placed at the last position
if(PostMatrXYZ && (fSegCenter || fDetCenter)) { if(PostMatrXYZ && (fSegCenter || fDetCenter)) {
#define xAddr(fx) ( int((fx+matOff)/matPack) ) #define xAddr(fx) ( int((fx+matOff)/matPack) )
...@@ -1128,7 +1149,7 @@ void PostPSAFilter::InitMultiHist(bool reset) ...@@ -1128,7 +1149,7 @@ void PostPSAFilter::InitMultiHist(bool reset)
if(!fUseMultiHist) if(!fUseMultiHist)
return; return;
PostSpecEner = new MultiHist<unsigned int>(4, 40, specLenE); PostSpecEner = new MultiHist<unsigned int>(5, 40, specLenE);
PostSpecEner->setFileName(fOdirPrefix+"Post?Ener.spec"); PostSpecEner->setFileName(fOdirPrefix+"Post?Ener.spec");
PostSpecEner->setComment("Energy spectra before and after Trapping correction"); PostSpecEner->setComment("Energy spectra before and after Trapping correction");
hGroup.add(PostSpecEner); hGroup.add(PostSpecEner);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment