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

Merge branch 'DumpADLBases' into 'preprod'

Dump adl bases

See merge request IPNL_GAMMA/narval_emulator!72
parents f0bf644c 14bcfb9e
......@@ -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
......@@ -499,7 +499,7 @@ int PSAFilterGridSearch::MakeSignalBasis()
fBasis.CalculateSumOfSignals();
//Write basis and various other
//WriteBasisFull(""); // The complete basis as a <short> spectrum. 2 mm packed. Normalization is 30000.
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,6 +2788,11 @@ bool PSAFilterGridSearch::WriteBasisFull(const std::string& ext)
const int detRadius = 40;
const int detLength = 90;
const int numTraces = NCHAN;
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);
baseXYZ->setComment("the whole PSA signal basis");
......@@ -2797,6 +2802,16 @@ bool PSAFilterGridSearch::WriteBasisFull(const std::string& ext)
for(int np = 0; np < fBasis.numPts[ns]; np++) {
pointPsa *bpt = &fBasis.segPts[ns][np];
memcpy(bb, bpt->amplitude, sizeof(bb));
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));
}
// copy exactly as is
//for(int ii = 0; ii < BSIZE; ii++) {
// float tmp = bb[ns][ii];
......@@ -2820,6 +2835,7 @@ bool PSAFilterGridSearch::WriteBasisFull(const std::string& ext)
}
}
baseXYZ->write();
if(gDumpADLBase) ADLBase_OutputFile.close();
delete baseXYZ;
#endif
return true;
......
......@@ -124,6 +124,7 @@ int SignalBasis::ReadBasis(std::string fname, bool keep)
fclose(ofp1);
return 130;
}
double tfinish = get_wall_time();
double elapsed = tfinish-tstart;
cout << setw(5) << (int)(1000*elapsed+0.5) << "ms to read basis" << endl;
......
......@@ -86,6 +86,14 @@ public:
float Tr[(1+NSEGS)*120]; // CC+nSeg traces given in steps of 5 ns. The first 10 samples are empty (pretrigger of 50 ns)
} bbhit_t;
// Jeremie's file format
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.
} ADLDump_bbhit_t;
// coarse grid
typedef struct {
float x; // coordinates the point
......
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