Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

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

Add an option to dump the ADL bases

parent f0bf644c
......@@ -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.
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.
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,12 @@ 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;
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");
......@@ -2795,8 +2801,19 @@ 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));
OutputFile.write((char*)&trace, sizeof(trace));
// copy exactly as is
//for(int ii = 0; ii < BSIZE; ii++) {
// float tmp = bb[ns][ii];
......@@ -2812,14 +2829,18 @@ 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();
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;
......@@ -400,8 +401,10 @@ int SignalBasis::ReadBasisFormatBartB(FILE * ofp1, bool keep, int numSignals)
if(bnn < basis_csamp) {
last = ptf[bnn]*MAXNORM;
}
segPts[ii][jj].amplitude[ns][ann] = last;
segPts[ii][jj].amplitude[ns][ann] = last;
//cout<<" seg trig: "<<ii<< " - pos " <<jj<< " - seg " <<ns<< " - bin " <<ann<<" "<<last<<" "<<ptf[bnn]<<endl;
}
//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
......@@ -411,6 +414,14 @@ 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;
......@@ -435,6 +446,7 @@ int SignalBasis::ReadBasisFormatBartB(FILE * ofp1, bool keep, int numSignals)
numPts[ii]++;
}
delete [] whichSeg;
return 0;
......
......@@ -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.
} Newbbhit_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