Commit d1b255a7 authored by dino's avatar dino
Browse files

Put back the pseudo PSA placing the interaction point at the segment center

git-svn-id: svn://gal-serv.lnl.infn.it/agata/trunk/narval_emulator@924 170316e4-aea8-4b27-aad4-0380ec0519c9
parent 741feff8
......@@ -30,7 +30,8 @@ const bool doFit_T0 = false;
PSAFilterGridSearch::PSAFilterGridSearch()
{
fpPsaTraces = NULL;
fpPsaHits = NULL;
fpPsaHits = NULL;
fPsaIndex = 0;
for(int nn = 0; nn < NCHAN; nn++) {
memset(hmask[nn], ' ', NCHAN);
......@@ -201,10 +202,12 @@ Int_t PSAFilterGridSearch::AlgoSpecificInitialise()
matrSeg->setComment("hits in the segments");
hGroup.add(matrSeg);
matrRZE = new nDhist<unsigned short>(4, 50, 50, 2000);
matrRZE->setFileName(fOdirPrefix+"Psa?RZE.matr");
matrRZE->setComment("core and segment energy as a function of RZ {E = (E_keV-1000)*5}");
hGroup.add(matrRZE);
if(!fPsaSegCenter) {
matrRZE = new nDhist<unsigned short>(4, 50, 50, 2000);
matrRZE->setFileName(fOdirPrefix+"Psa?RZE.matr");
matrRZE->setComment("core and segment energy as a function of RZ {E = (E_keV-1000)*5}");
hGroup.add(matrRZE);
}
#endif //PSA_LOCALSPECTRA
......@@ -217,7 +220,7 @@ Int_t PSAFilterGridSearch::AlgoSpecificInitialise()
// Limit the maximum number of fired segments
fPsaMaxSegMult = min(12, fPsaMaxSegMult);
if(fWriteNumTraces > 0) {
if(fWriteNumTraces>0 && !fPsaSegCenter) {
std::ostringstream filename;
filename << "Psa__" << fWriteNumTraces << "-2-" << WCHAN << "-" << WSAMP << "-S__Traces.samp";
fnPsaTraces = fOdirPrefix+filename.str();
......@@ -244,6 +247,7 @@ Int_t PSAFilterGridSearch::AlgoSpecificInitialise()
cout << "Error: could not open " << fnPsaHits << endl;
return 1;
}
fPsaIndex = 0;
}
return 0;
......@@ -600,6 +604,8 @@ void PSAFilterGridSearch::SetToSegCenter(PsaData *pD, pointFull *pS)
pOut->netChargeSeg = netChSeg;
pOut->bestPoint = -1;
}
pD->numHits = sMult;
pD->selectIt = pS->selectIt;
}
Float_t PSAFilterGridSearch::FitT0FromCore(pointFull &pS, int tsamp)
......@@ -1084,10 +1090,15 @@ Int_t PSAFilterGridSearch::PostProcess(int slot)
return rv;
}
if(fpPsaHits && numHits==1) {
int rv = WritePsaHits(pD->PsaOut);
if(rv)
return rv;
if(fpPsaHits /*&& numHits==1*/) {
// bits index(4) nhits(8) segnum(8); index*256 + numHits done in WritePsaHits
int index = fPsaIndex*256 + numHits;
for(int nh = 0; nh < numHits; nh++) {
int rv = WritePsaHits(pD->PsaOut + nh, index);
if(rv)
return rv;
}
fPsaIndex = (fPsaIndex+1)%16;
}
// Segment and core energy after charge-trapping correction
......@@ -1189,9 +1200,8 @@ Int_t PSAFilterGridSearch::PostProcess(int slot)
}
}
if(specStat) {
if(numHits < 20)
specStat->Incr(numHits, netChSeg); // distribution of segments for n-hits
specStat->Incr(20, netChSeg); // total distribution of segments
specStat->Incr(numHits, netChSeg); // distribution of segments for n-hits
specStat->Incr(36, netChSeg); // total distribution of segments
}
if(specTzero) {
// t0 after grid-search (possibly not up to date)
......@@ -1249,7 +1259,7 @@ Int_t PSAFilterGridSearch::PostProcess(int slot)
return 0;
}
Int_t PSAFilterGridSearch::WritePsaHits(PsaOut_t *pOut)
Int_t PSAFilterGridSearch::WritePsaHits(PsaOut_t *pOut, int index)
{
// the PSA hits and the sensitivity info written to Psa__0-16-F__Hits.fdat
if(fpPsaHits) {
......@@ -1264,7 +1274,7 @@ Int_t PSAFilterGridSearch::WritePsaHits(PsaOut_t *pOut)
vv[ 2] = pOut->fx;
vv[ 3] = pOut->fy;
vv[ 4] = pOut->fz;
vv[ 5] = (float)netCharge;
vv[ 5] = float(index*256 + netCharge);
vv[ 6] = pBpt->ePath;
vv[ 7] = pBpt->hPath;
vv[ 8] = pBpt->eS_CC;
......@@ -1282,4 +1292,4 @@ Int_t PSAFilterGridSearch::WritePsaHits(PsaOut_t *pOut)
}
return 0;
}
\ No newline at end of file
}
......@@ -77,6 +77,7 @@ private:
std::string fnPsaHits;
FILE *fpPsaHits;
Int_t fPsaIndex;
#ifdef PSA_FromGRU_
GNetServerRoot *PSANetworkRoot;
......@@ -112,7 +113,7 @@ public:
void SetHitSegThreshold(Float_t thres) {fHitSegThreshold = thres;}
Float_t GetHitSegThreshold() {return fHitSegThreshold;}
int WriteTraces(PsaData *pD);
int WritePsaHits(PsaOut_t *pOut);
int WritePsaHits(PsaOut_t *pOut, int index = 0);
void StorePartialTrace(pointFull &pS, pointPsa *bestPoint, float scaleFact);
int WritePartialTrace(pointFull &pS, pointPsa *bestPoint, float scaleFact);
void SaveTotalTrace (pointFull &pS, PsaData *pD);
......
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