Commit 9d9442d2 authored by Stezowski Olivier's avatar Stezowski Olivier
Browse files

Merge branch 'preprod' into 'master'

Master branch update

See merge request IPNL_GAMMA/narval_emulator!76
parents 3478598b bd7cd715
......@@ -75,6 +75,7 @@ void TB_AGATA_CRYSTAL::InitValues()
}
memset(SegE, 0, sizeof(SegE));
memset(CoreE, 0, sizeof(CoreE));
memset(CoreT, 0, sizeof(CoreT));
}
......@@ -97,6 +98,7 @@ void TB_AGATA_CRYSTAL::InitTree()
}
fTree->Branch("SegE", SegE, Form("SegE[%d]/F",kNSG));
fTree->Branch("CoreE", CoreE, Form("CoreE[%d]/F",kNCC));
fTree->Branch("CoreT", CoreT, Form("CoreT[%d]/F",kNCC));
fTree->Branch("CrystalId", &crystalId, "CrystalId/I");
fTree->Branch("CrystalTS", &crystalTS, "CrystalTS/l");
......@@ -128,6 +130,7 @@ void TB_AGATA_CRYSTAL::Process(Int_t idet)
memcpy(&CoreTraces[i*fTraceLenght],data->GetCore(i)->GetSignal()->Address(CoreTraces),sizeof(Float_t)*fTraceLenght);
CoreE[i] = data->GetCore(i)->GetE();
CoreT[i] = data->GetCore(i)->GetT();
}
for (Int_t i = 0; i < kNSG; i++ ) {
......@@ -740,10 +743,10 @@ void TB_AGATA_Tracking::Process(Int_t idet)
trackZ1[i] = gamma1->GetZ();
//if tracked gamma is photo or pair, the second int point is a copy of the first one (because not useful)
if(trackType[i]==2){
trackX2[i] = gamma1->GetX();
trackY2[i] = gamma1->GetY();
trackZ2[i] = gamma1->GetZ();
if ( gamma1->GetHit(1) ) {
trackX2[i] = gamma1->GetHit(1)->GetX();
trackY2[i] = gamma1->GetHit(1)->GetY();
trackZ2[i] = gamma1->GetHit(1)->GetZ();
}
else {
trackX2[i] = trackX1[i];
......
......@@ -48,6 +48,7 @@ protected:
Float_t SegE[kNSG];
Float_t CoreE[kNCC];
Float_t CoreT[kNCC];
ULong64_t crystalId;
ULong64_t crystalTS;
......
......@@ -27,10 +27,10 @@
using namespace AGAPRO;
TB_Detector::TB_Detector(TString name, TString ADFKey) :
fName(name),
fTriggerName(ADFKey),
gActualClass("TB_Detector"),
Log(Form("Log_%s",name.Data())),
gActualClass("TB_Detector")
fName(name),
fTriggerName(ADFKey)
{
}
......
......@@ -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
......
......@@ -101,6 +101,7 @@ bool doPoly1 = false; // linear
bool doPoly2 = false; // cubic
int numZero = 0; // number of fake peaks at (0,0)
int modXtalk = 0;
bool MaxMode = false; // Dont fit peaks, only use max position
bool useErrors = false; // fit using position and energy errors
double errE = 0.01;
......@@ -609,6 +610,9 @@ getparams(int argc, char *argv[])
else if(!strcmp(cmd, "-zero")) {
numZero++;
}
else if(!strcmp(cmd, "-max")) {
MaxMode = true;
}
else if(!strcmp(cmd, "-errors")) {
numparams(cmd, argc-argn-1);
errE = float(atof(argv[argn++]));
......@@ -1359,6 +1363,7 @@ int FitPeaks(int verbose)
chanA = max(1,chanA);
chanB = min(chanB, specLength-2);
nmult = 0;
if(nn < numpk-2) {
// check if the next peaks are in the same region
for(size_t jj = nn+1; jj < specPeaks.size(); jj++) {
......@@ -1377,6 +1382,7 @@ int FitPeaks(int verbose)
res.area = m_pCFit->Area(jj);
res.ampli = m_pCFit->Amplitude(jj);
res.posi = m_pCFit->Position(jj);
if(MaxMode) res.posi = specPeaks[nn+jj];
res.fw05 = m_pCFit->Fw05(jj);
res.fw01 = m_pCFit->Fw01(jj);
res.fwhm = m_pCFit->Fwhm(jj);
......
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