Commit 14bcfb9e authored by Jérémie Dudouet's avatar Jérémie Dudouet
Browse files

Add a parameter to activate or not the dump of the bases

parent a1638a54
......@@ -261,6 +261,8 @@ UInt_t PSAFilter::GetParameters(const std::string& confFile, Bool_t doList)
, &fUseMultiHist);
conf.Add("Verbose", "verbosity of printouts"
, &fVerbose);
conf.Add("DumpADLBase", "Dump a binary file contaning the corrected bases (after preampli treatment etc.)"
, &gDumpADLBase);
AlgoParameters(conf); // daughter class can add further commands
......
......@@ -265,6 +265,8 @@ protected:
Bool_t GenerateSlots();
Bool_t gDumpADLBase = false;
public:
static std::string gMotherClass; // Static string containing the name of the base class
static std::string gActualClass; // Static string to choose daughter class at run time
......
......@@ -471,7 +471,7 @@ int PSAFilterGridSearch::MakeSignalBasis()
return rval; // error
//WriteBasisVoxels();
WriteBasisFull("_raw"); // The complete basis as a <short> spectrum. 2 mm packed. Normalization is 30000.
if(gDumpADLBase) WriteBasisFull("_raw"); // The complete basis as a <short> spectrum. 2 mm packed. Normalization is 30000.
WriteBasisSegAverage(1000.f/MAXNORM, "aver_raw");
// Read and apply x-talk corrections
......@@ -498,8 +498,8 @@ int PSAFilterGridSearch::MakeSignalBasis()
// Area of transients and of differentiated net charge (not (yet?) used by the search algorithm)
fBasis.CalculateSumOfSignals();
//Write basis and various other
WriteBasisFull(""); // The complete basis as a <short> spectrum. 2 mm packed. Normalization is 30000.
//Write basis and various other
if(gDumpADLBase) WriteBasisFull(""); // The complete basis as a <short> spectrum. 2 mm packed. Normalization is 30000.
//WriteBasisSegments(0, 5); // The complete basis of the given segments [first,last] as a <float> spectrum. Normalization is 1000.
//WriteBasisSegSum(); // 3D distribution sum of segment signals (2 mm packed)
//WriteBasisSlopes(); // 3D distribution of net-charge SG, CC and NC+CC signal slopes
......@@ -2788,11 +2788,10 @@ bool PSAFilterGridSearch::WriteBasisFull(const std::string& ext)
const int detRadius = 40;
const int detLength = 90;
const int numTraces = NCHAN;
//cout<<"laaaaaaaaaaaaa"<<endl;
//cout<<fineStep<<" "<<numTraces<<endl;
ofstream OutputFile(fOdirPrefix+"PSA_BaseXYZ"+ext+".dat");
SignalBasis::Newbbhit_t trace;
ofstream ADLBase_OutputFile;
if(gDumpADLBase) ADLBase_OutputFile.open(fOdirPrefix+"PSA_BaseXYZ"+ext+".dat");
SignalBasis::ADLDump_bbhit_t trace;
MultiHist<short> *baseXYZ = new MultiHist<short>((2*detRadius)/fineStep, (2*detRadius)/fineStep, detLength/fineStep, numTraces, BSIZE);
baseXYZ->setFileName(fOdirPrefix+"Psa?BaseXYZ.spec"+ext);
......@@ -2801,19 +2800,18 @@ bool PSAFilterGridSearch::WriteBasisFull(const std::string& ext)
float fact = 30000.f/MAXNORM;
for(int ns = 0; ns < NSEGS; ns++) {
for(int np = 0; np < fBasis.numPts[ns]; np++) {
//cout<<fBasis.numPts[ns]<<endl;
pointPsa *bpt = &fBasis.segPts[ns][np];
memcpy(bb, bpt->amplitude, sizeof(bb));
trace.SegTrig= ns;
trace.Pos[0] = bpt->x;
trace.Pos[1] = bpt->y;
trace.Pos[2] = bpt->z;
memcpy(trace.Tr, bb, sizeof(trace.Tr));
if(gDumpADLBase) {
trace.SegTrig= ns;
trace.Pos[0] = bpt->x;
trace.Pos[1] = bpt->y;
trace.Pos[2] = bpt->z;
memcpy(trace.Tr, bb, sizeof(trace.Tr));
ADLBase_OutputFile.write((char*)&trace, sizeof(trace));
}
OutputFile.write((char*)&trace, sizeof(trace));
// copy exactly as is
//for(int ii = 0; ii < BSIZE; ii++) {
// float tmp = bb[ns][ii];
......@@ -2829,18 +2827,15 @@ bool PSAFilterGridSearch::WriteBasisFull(const std::string& ext)
short *pd = baseXYZ->getData(ix, iy, iz, 0);
if(pd) {
for (int is = 0; is < numTraces; is++) {
//if(ns==1) cout<<endl;
for(int it = 0; it < BSIZE; it++) {
*pd++ = short(bb[is][it]*fact);
//if(ns==1) cout<<"iseg: "<<ns<<" - seg: "<<is<<" "<<it<<" "<<bb[is][it]<<" "<<bpt->x<<" "<<bpt->y<<" "<<bpt->z<<endl;
}
}
}
//if(ns==1) cin.get();
}
}
baseXYZ->write();
OutputFile.close();
if(gDumpADLBase) ADLBase_OutputFile.close();
delete baseXYZ;
#endif
return true;
......
......@@ -401,10 +401,8 @@ int SignalBasis::ReadBasisFormatBartB(FILE * ofp1, bool keep, int numSignals)
if(bnn < basis_csamp) {
last = ptf[bnn]*MAXNORM;
}
segPts[ii][jj].amplitude[ns][ann] = last;
//cout<<" seg trig: "<<ii<< " - pos " <<jj<< " - seg " <<ns<< " - bin " <<ann<<" "<<last<<" "<<ptf[bnn]<<endl;
segPts[ii][jj].amplitude[ns][ann] = last;
}
//cin.get();
if(ns==ii) { // neutron damage correction parameters
segPts[ii][jj].ePath = ptf[1]; // distance travelled by the electrons
segPts[ii][jj].eS_SG = ptf[2]; // sensitivity for electrons
......@@ -414,14 +412,6 @@ int SignalBasis::ReadBasisFormatBartB(FILE * ofp1, bool keep, int numSignals)
segPts[ii][jj].hE_SG = ptf[7]; // E-dependent sensitivity for holes
}
}
/* if(ii==0){
cout<<"test ici"<<endl;cin.get();
for(int i=0 ; i<37 ; i++){
for(int j=0 ; j<56 ; j++) cout<<"id 0, pos 0, seg" << i<<" bin " << j << " val: " <<segPts[0][0].amplitude[i][j]<<endl;
cin.get();
}
}
*/
// in Bart's files, CC is in the first position
{
//float *ptf = file_trace;
......@@ -446,7 +436,6 @@ int SignalBasis::ReadBasisFormatBartB(FILE * ofp1, bool keep, int numSignals)
numPts[ii]++;
}
delete [] whichSeg;
return 0;
......
......@@ -91,8 +91,8 @@ public:
typedef struct {
int SegTrig; // Segment containing the interaction
float Pos[3]; // x y z (mm)
float Tr[(NSEGS+1)*BSIZE]; // CC+nSeg traces given in steps of 10 ns.
} Newbbhit_t;
float Tr[(NSEGS+1)*BSIZE]; // CC+nSeg traces given in steps of 10 ns.
} ADLDump_bbhit_t;
// coarse grid
typedef struct {
......
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