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

ProdHist: Remove baseline, add signals

Prepro: Add T0, Add DeltaT,
Add PSAHist
parent ed173089
#define MAX_TH1BINS 4096
#define MAX_TH2BINS 1024
#define MAX_TH2BINSPSA 50
#define MAX_CHAR_SIZE 200
#define MAX_NUM_SIGNALS 10
//38*ERaw + 2*timestamps
#define N_TH1HISTS_PROD 40
//38*ERaw + 2*timestamps + MAX_NUM_SIGNALS*38
#define N_TH1HISTS_PROD 420
#define N_TH2HISTS_PROD 0
//38*ERaw + 38*Baseline + 2*timestamps
#define N_TH1HISTS_PREP 78
//38*ERaw + 38*Baseline + 38*T0 + 2*timestamps + 1*DeltaT
#define N_TH1HISTS_PREP 117
//1*EvsId
#define N_TH2HISTS_PREP 1
//38*Ampli + 2*CoreT + 2*timestamps + HitMult
#define N_TH1HISTS_PSA 43
//6*YvsX slices + ZvsX + ZvsR
#define N_TH2HISTS_PSA 8
struct Hist
{
Int_t nevts = 0;
......@@ -42,6 +51,17 @@ struct Hist2F : Hist
char ytitle[MAX_CHAR_SIZE];
};
struct Hist2F_PSA : Hist
{
Float_t ybinmin = -1;
Float_t ybinmax = -1;
Int_t ynbins = -1;
Float_t bins[(MAX_TH2BINSPSA+2)*(MAX_TH2BINSPSA+2)]; // +2 for underflow and overflow bins
char ytitle[MAX_CHAR_SIZE];
};
struct ProdMap
{
int N_TH1_Entries = 0; // number of 1d histograms
......@@ -57,3 +77,13 @@ struct PrepMap
Hist1F hist1f_list[N_TH1HISTS_PREP];
Hist2F hist2f_list[N_TH2HISTS_PREP];
};
struct PSAMap
{
int N_TH1_Entries = 0; // number of 1d histograms
int N_TH2_Entries = 0; // number of 2d histograms
int N_TH2_heavy_Entries = 0; // number of 2d histograms
Hist1F hist1f_list[N_TH1HISTS_PSA];
Hist2F_PSA hist2f_list[N_TH2HISTS_PSA];
Hist2F hist2f_heavy_list[1];
};
......@@ -79,6 +79,8 @@ UInt_t Histogramer::ProcessBlock(ADF::FrameBlock &inBlock)
UInt_t error_code = 0;
UInt_t nevs = 0;
fFirstBlock = true;
while ( fFrameIO.Notify() )
{
// fill local variables with data from the input
......@@ -215,11 +217,14 @@ Hist1F *Histogramer::NewHist1F(std::string name, std::string title, std::string
ProdMap *prodmap = nullptr;
PrepMap *prepmap = nullptr;
PSAMap *psamap = nullptr;
if(fBasePortNumber==10)
prodmap = static_cast<ProdMap*>(map_ptr);
else if(fBasePortNumber==11)
prepmap = static_cast<PrepMap*>(map_ptr);
else if(fBasePortNumber==12)
psamap = static_cast<PSAMap*>(map_ptr);
else return nullptr;
if(nbins>MAX_TH1BINS)
......@@ -241,6 +246,12 @@ Hist1F *Histogramer::NewHist1F(std::string name, std::string title, std::string
Log << "Cannot allocate more than " << N_TH1HISTS_PREP << " TH1F at preprocessing level, in the shared memory" << dolog;
return nullptr;
}
if(psamap && psamap->N_TH1_Entries == N_TH1HISTS_PSA)
{
Log.SetLevel(LogMessage::kError);
Log << "Cannot allocate more than " << N_TH1HISTS_PSA << " TH1F at psa level, in the shared memory" << dolog;
return nullptr;
}
Hist1F *histptr = nullptr;
......@@ -248,6 +259,8 @@ Hist1F *Histogramer::NewHist1F(std::string name, std::string title, std::string
histptr = &prodmap->hist1f_list[prodmap->N_TH1_Entries];
else if(prepmap)
histptr = &prepmap->hist1f_list[prepmap->N_TH1_Entries];
else if(psamap)
histptr = &psamap->hist1f_list[psamap->N_TH1_Entries];
strcpy(histptr->name,name.data());
strcpy(histptr->title,title.data());
......@@ -257,6 +270,8 @@ Hist1F *Histogramer::NewHist1F(std::string name, std::string title, std::string
histptr->spec_number = PortNumber*10000+1000 + prodmap->N_TH1_Entries; //2 first digits: actor ; 3 next: crystal id ; 1next: (1 -> TH1 ; 2 -> TH2) ; 3 next, spectrum id
else if(prepmap)
histptr->spec_number = PortNumber*10000+1000 + prepmap->N_TH1_Entries; //2 first digits: actor ; 3 next: crystal id ; 1next: (1 -> TH1 ; 2 -> TH2) ; 3 next, spectrum id
else if(psamap)
histptr->spec_number = PortNumber*10000+1000 + psamap->N_TH1_Entries; //2 first digits: actor ; 3 next: crystal id ; 1next: (1 -> TH1 ; 2 -> TH2) ; 3 next, spectrum id
histptr->nevts = 0;
......@@ -270,11 +285,13 @@ Hist1F *Histogramer::NewHist1F(std::string name, std::string title, std::string
prodmap->N_TH1_Entries++;
if(prepmap)
prepmap->N_TH1_Entries++;
if(psamap)
psamap->N_TH1_Entries++;
return histptr;
}
Hist2F *Histogramer::NewHist2F(std::string name, std::string title, std::string xtitle, std::string ytitle, std::string gruname, int nbinsx, float xmin, float xmax, int nbinsy, float ymin, float ymax, void *map_ptr, Int_t PortNumber)
void *Histogramer::NewHist2F(std::string name, std::string title, std::string xtitle, std::string ytitle, std::string gruname, int nbinsx, float xmin, float xmax, int nbinsy, float ymin, float ymax, void *map_ptr, Int_t PortNumber)
{
Log.ClearMessage();
Log.SetProcessMethod("NewHist2F");
......@@ -282,21 +299,32 @@ Hist2F *Histogramer::NewHist2F(std::string name, std::string title, std::string
ProdMap *prodmap = nullptr;
PrepMap *prepmap = nullptr;
PSAMap *psamap = nullptr;
Hist2F *histptr = nullptr;
Hist2F_PSA *histptr_psa = nullptr;
if(fBasePortNumber==10)
prodmap = static_cast<ProdMap*>(map_ptr);
else if(fBasePortNumber==11)
prepmap = static_cast<PrepMap*>(map_ptr);
else if(fBasePortNumber==12)
psamap = static_cast<PSAMap*>(map_ptr);
else return nullptr;
Hist2F *histptr = nullptr;
if(nbinsx>MAX_TH2BINS || nbinsy>MAX_TH2BINS)
if((prodmap || prepmap) && (nbinsx>MAX_TH2BINS || nbinsy>MAX_TH2BINS))
{
Log.SetLevel(LogMessage::kError);
Log << name << ": Cannot define more than " << MAX_TH2BINS << " in TH2F axis" << dolog;
return nullptr;
}
if(psamap && (nbinsx>MAX_TH2BINSPSA || nbinsy>MAX_TH2BINSPSA))
{
Log.SetLevel(LogMessage::kError);
Log << name << ": Cannot define more than " << MAX_TH2BINSPSA << " in TH2F of PSA actor axis" << dolog;
return nullptr;
}
if(prodmap && prodmap->N_TH2_Entries == N_TH2HISTS_PROD)
{
......@@ -312,38 +340,77 @@ Hist2F *Histogramer::NewHist2F(std::string name, std::string title, std::string
return nullptr;
}
if(psamap && psamap->N_TH2_Entries == N_TH2HISTS_PSA)
{
Log.SetLevel(LogMessage::kError);
Log << "Cannot allocate more than " << N_TH2HISTS_PSA << " TH2F at psa level, in the shared memory" << dolog;
return nullptr;
}
if(prodmap)
histptr = &prodmap->hist2f_list[prodmap->N_TH2_Entries];
else if(prepmap)
histptr = &prepmap->hist2f_list[prepmap->N_TH2_Entries];
else if(psamap)
histptr_psa = &psamap->hist2f_list[psamap->N_TH2_Entries];
strcpy(histptr->name,name.data());
strcpy(histptr->title,title.data());
strcpy(histptr->gruname,gruname.data());
if(histptr_psa)
{
strcpy(histptr_psa->name,name.data());
strcpy(histptr_psa->title,title.data());
strcpy(histptr_psa->gruname,gruname.data());
if(prodmap)
histptr->spec_number = PortNumber*10000+2000 + prodmap->N_TH2_Entries; //2 first digits: actor ; 3 next: crystal id ; 1next: (1 -> TH1 ; 2 -> TH2) ; 3 next, spectrum id
else if(prepmap)
histptr->spec_number = PortNumber*10000+2000 + prepmap->N_TH2_Entries; //2 first digits: actor ; 3 next: crystal id ; 1next: (1 -> TH1 ; 2 -> TH2) ; 3 next, spectrum id
histptr_psa->nevts = 0;
histptr->nevts = 0;
histptr_psa->xnbins = nbinsx;
histptr_psa->xbinmin= xmin;
histptr_psa->xbinmax= xmax;
strcpy(histptr_psa->xtitle,xtitle.data());
histptr->xnbins = nbinsx;
histptr->xbinmin= xmin;
histptr->xbinmax= xmax;
strcpy(histptr->xtitle,xtitle.data());
histptr_psa->ynbins = nbinsy;
histptr_psa->ybinmin= ymin;
histptr_psa->ybinmax= ymax;
strcpy(histptr_psa->ytitle,ytitle.data());
memset(histptr_psa->bins, 0, sizeof(histptr_psa->bins));
}
else
{
strcpy(histptr->name,name.data());
strcpy(histptr->title,title.data());
strcpy(histptr->gruname,gruname.data());
histptr->ynbins = nbinsy;
histptr->ybinmin= ymin;
histptr->ybinmax= ymax;
strcpy(histptr->ytitle,ytitle.data());
histptr->nevts = 0;
memset(histptr->bins, 0, sizeof(histptr->bins));
histptr->xnbins = nbinsx;
histptr->xbinmin= xmin;
histptr->xbinmax= xmax;
strcpy(histptr->xtitle,xtitle.data());
histptr->ynbins = nbinsy;
histptr->ybinmin= ymin;
histptr->ybinmax= ymax;
strcpy(histptr->ytitle,ytitle.data());
memset(histptr->bins, 0, sizeof(histptr->bins));
}
if(prodmap)
histptr->spec_number = PortNumber*10000+2000 + prodmap->N_TH2_Entries; //2 first digits: actor ; 3 next: crystal id ; 1next: (1 -> TH1 ; 2 -> TH2) ; 3 next, spectrum id
else if(prepmap)
histptr->spec_number = PortNumber*10000+2000 + prepmap->N_TH2_Entries; //2 first digits: actor ; 3 next: crystal id ; 1next: (1 -> TH1 ; 2 -> TH2) ; 3 next, spectrum id
else if(psamap)
histptr_psa->spec_number = PortNumber*10000+2000 + psamap->N_TH2_Entries; //2 first digits: actor ; 3 next: crystal id ; 1next: (1 -> TH1 ; 2 -> TH2) ; 3 next, spectrum id
if(prodmap)
prodmap->N_TH2_Entries++;
else if(prepmap)
prepmap->N_TH2_Entries++;
else if(psamap)
{
psamap->N_TH2_Entries++;
return histptr_psa;
}
return histptr;
}
......@@ -375,20 +442,46 @@ void Histogramer::FillHist1F(Hist1F *hist, Float_t val, Float_t weight)
// cout<<"val = "<<val<<" ; bin "<<bin<<" filled : "<<hist->bins[bin]<<" ; nevts = "<<hist->nevts<<endl;
}
void Histogramer::FillHist2F(Hist2F *hist, Float_t valx, Float_t valy, Float_t weight)
void Histogramer::FillHist2F(void *hist, Float_t valx, Float_t valy, Float_t weight)
{
Int_t binx = 1 + Int_t(hist->xnbins*(valx-hist->xbinmin)/(hist->xbinmax-hist->xbinmin));
if(binx<0) binx=0;
else if(binx>hist->xnbins) binx=hist->xnbins+1;
Hist2F *hist2f = nullptr;
Hist2F_PSA *hist2fPSA = nullptr;
Int_t biny = 1 + Int_t(hist->ynbins*(valy-hist->ybinmin)/(hist->ybinmax-hist->ybinmin));
if(biny<0) biny=0;
else if(biny>hist->ynbins) biny=hist->ynbins+1;
if(fBasePortNumber==12)
hist2fPSA = static_cast<Hist2F_PSA*>(hist);
else
hist2f = static_cast<Hist2F*>(hist);
Int_t bin = biny*(hist->xnbins+2) + binx;
if(hist2f)
{
Int_t binx = 1 + Int_t(hist2f->xnbins*(valx-hist2f->xbinmin)/(hist2f->xbinmax-hist2f->xbinmin));
if(binx<0) binx=0;
else if(binx>hist2f->xnbins) binx=hist2f->xnbins+1;
hist->bins[bin] += weight;
hist->nevts++;
Int_t biny = 1 + Int_t(hist2f->ynbins*(valy-hist2f->ybinmin)/(hist2f->ybinmax-hist2f->ybinmin));
if(biny<0) biny=0;
else if(biny>hist2f->ynbins) biny=hist2f->ynbins+1;
Int_t bin = biny*(hist2f->xnbins+2) + binx;
hist2f->bins[bin] += weight;
hist2f->nevts++;
}
else if(hist2fPSA)
{
Int_t binx = 1 + Int_t(hist2fPSA->xnbins*(valx-hist2fPSA->xbinmin)/(hist2fPSA->xbinmax-hist2fPSA->xbinmin));
if(binx<0) binx=0;
else if(binx>hist2fPSA->xnbins) binx=hist2fPSA->xnbins+1;
Int_t biny = 1 + Int_t(hist2fPSA->ynbins*(valy-hist2fPSA->ybinmin)/(hist2fPSA->ybinmax-hist2fPSA->ybinmin));
if(biny<0) biny=0;
else if(biny>hist2fPSA->ynbins) biny=hist2fPSA->ynbins+1;
Int_t bin = biny*(hist2fPSA->xnbins+2) + binx;
hist2fPSA->bins[bin] += weight;
hist2fPSA->nevts++;
}
// cout<<hist->nevts<<" "<<bin<<" "<< binx << " " << valx << " " << biny << " " << valy <<" "<<hist->bins[bin]<<endl;
}
......@@ -396,7 +489,7 @@ void Histogramer::FillHist2F(Hist2F *hist, Float_t valx, Float_t valy, Float_t w
void *Histogramer::CreateNewSMz(const char *name, Int_t Size, Int_t PortNumber)
{
Log.ClearMessage();
Log.SetProcessMethod("NewHist2F");
Log.SetProcessMethod("CreateNewSMz");
fFrameIO.Print(Log());
int fd;
......@@ -404,6 +497,7 @@ void *Histogramer::CreateNewSMz(const char *name, Int_t Size, Int_t PortNumber)
ProdMap *prodmap = nullptr;
PrepMap *prepmap = nullptr;
PSAMap *psamap = nullptr;
bool SMZ_exists = TestSMZ(name);
......@@ -477,23 +571,30 @@ void *Histogramer::CreateNewSMz(const char *name, Int_t Size, Int_t PortNumber)
fprintf(stderr, "Open failed for hist %s :%s\n",name, strerror(errno));
exit(EXIT_FAILURE);
}
//alocate the size of the shared memory zone
if (ftruncate(fd, Size) == -1)
{
fprintf(stderr, "truncate failed for hist %s :%s\n",name, strerror(errno));
exit(EXIT_FAILURE);
}
//map the data on a ActorMap pointer
if(fBasePortNumber==10)
prodmap = (ProdMap*) mmap(NULL, Size, PROT_WRITE, MAP_SHARED, fd, 0);
else if(fBasePortNumber==11)
prepmap = (PrepMap*) mmap(NULL, Size, PROT_WRITE, MAP_SHARED, fd, 0);
else if(fBasePortNumber==12)
psamap = (PSAMap*) mmap(NULL, Size, PROT_WRITE, MAP_SHARED, fd, 0);
if ((prodmap && prodmap == MAP_FAILED) || (prepmap && prepmap == MAP_FAILED))
if ((prodmap && prodmap == MAP_FAILED) ||
(prepmap && prepmap == MAP_FAILED) ||
(psamap && psamap == MAP_FAILED))
{
fprintf(stderr, "Map failed for hist %s :%s\n",name,strerror(errno));
exit(EXIT_FAILURE);
}
if(prodmap)
{
prodmap->N_TH1_Entries = 0;
......@@ -508,7 +609,17 @@ void *Histogramer::CreateNewSMz(const char *name, Int_t Size, Int_t PortNumber)
return prepmap;
}
else return nullptr;
else if(psamap)
{
psamap->N_TH1_Entries = 0;
psamap->N_TH2_Entries = 0;
return psamap;
}
else
{
return nullptr;
}
}
bool Histogramer::TestSMZ(const char *name)
......
......@@ -73,6 +73,8 @@ protected:
Int_t fBasePortNumber;
Bool_t fFirstBlock;
Float_t fRefreshTime = 2.0;
public:
......@@ -114,11 +116,11 @@ protected:
bool TestSMZ(const char *name);
Hist1F *NewHist1F(std::string name, std::string title, std::string xtitle, std::string gruname, int nbins, float min, float max, void *map_ptr, Int_t PortNumber);
Hist2F *NewHist2F(std::string name, std::string title, std::string xtitle, std::string ytitle, std::string gruname, int nbinsx, float xmin, float xmax, int nbinsy, float ymin, float ymax, void *map_ptr, Int_t PortNumber);
void *NewHist2F(std::string name, std::string title, std::string xtitle, std::string ytitle, std::string gruname, int nbinsx, float xmin, float xmax, int nbinsy, float ymin, float ymax, void *map_ptr, Int_t PortNumber);
void ResetHist1F(Hist1F *hist);
void FillHist1F(Hist1F *hist, Float_t val, Float_t weight=1.);
void FillHist2F(Hist2F *hist, Float_t valx, Float_t valy, Float_t weight=1.);
void FillHist2F(void *hist, Float_t valx, Float_t valy, Float_t weight=1.);
};
}
......
......@@ -7,5 +7,6 @@ MESSAGE("[AGAPRO] + ${PROJECT_NAME}")
add_subdirectory(ProdHist)
add_subdirectory(PreproHist)
add_subdirectory(PSAHist)
......@@ -59,6 +59,12 @@ PreproHist::PreproHist() :
vector<void* > BaselineList;
fListOfHists.push_back(BaselineList);
vector<void* > T0List;
fListOfHists.push_back(T0List);
vector<void* > DeltaTList;
fListOfHists.push_back(DeltaTList);
vector<void* > TimeStampList;
fListOfHists.push_back(TimeStampList);
......@@ -66,7 +72,6 @@ PreproHist::PreproHist() :
fNextCycleMin = 720.;
fNextCycleH = 48.;
fTraceLengthRaw = defTraceLengthRaw;
fTraceLengthPSA = defTraceLengthPSA;
memset(fTracesSG, 0, sizeof(fTracesSG));
......@@ -98,7 +103,6 @@ UInt_t PreproHist::Process()
Log.SetPID(GetPID());
vector< void* > Amplilist = fListOfHists[(Int_t)HistLib::Ampli];
if(fPlotAmpli && Amplilist.size() == (kNSG+kNCC))
{
for(int nn = 0; nn < kNSG; nn++)
......@@ -129,10 +133,9 @@ UInt_t PreproHist::Process()
}
vector< void* > Baselinelist = fListOfHists[(Int_t)HistLib::Baseline];
if(fPlotBaseline && Baselinelist.size() == (kNSG+kNCC))
{
int baseLen = (fTraceLengthRaw+4)/5;
int baseLen = (fTraceLengthPSA+4)/5;
baseLen = max(1, baseLen);
for(int nn = 0; nn < kNSG; nn++)
{
......@@ -160,14 +163,39 @@ UInt_t PreproHist::Process()
}
}
vector< void* > TSlist = fListOfHists[(Int_t)HistLib::TimeStamps];
vector< void* > T0list = fListOfHists[(Int_t)HistLib::T0];
if(fPlotT0 && T0list.size() == (kNSG+kNCC))
{
vector< void* > T0list = fListOfHists[(Int_t)HistLib::T0];
int T0 = CalcT0();
if(T0>0)
{
auto hist = (Hist1F*)T0list[netChargeSegs[0]];
FillHist1F(hist,T0); // relative time placed at the center of spectrum
hist = (Hist1F*)T0list[kNSG+0];
FillHist1F(hist,CoreT[0]);
hist = (Hist1F*)T0list[kNSG+1];
FillHist1F(hist,CoreT[1]);
}
}
vector< void* > DeltaTlist = fListOfHists[(Int_t)HistLib::DeltaT];
if(fPlotDeltaT && DeltaTlist.size() == 1 && fLastTS != 0)
{
auto hist = (Hist1F*)DeltaTlist[0];
FillHist1F(hist,timestamp-fLastTS);
}
vector< void* > TSlist = fListOfHists[(Int_t)HistLib::TimeStamps];
if(fPlotTimeStamps && TSlist.size() == 2)
{
if(fFirstTS == 0)
{
fFirstTS = timestamp;
// cout<<"First TS : "<<fFirstTS<<endl;
}
if(timestamp != 0 && timestamp>fLastTS)
{
......@@ -243,10 +271,10 @@ void PreproHist::process_initialise (UInt_t *error_code)
}
for(int nn = 0; nn < kNSG; nn++) {
fTracesSG[nn] = new Float_t [defTraceLengthRaw];
fTracesSG[nn] = new Float_t [defTraceLengthPSA];
}
for(int nn = 0; nn < kNCC; nn++) {
fTracesCC[nn] = new Float_t [defTraceLengthRaw];
fTracesCC[nn] = new Float_t [defTraceLengthPSA];
}
// state set to kIdle so that the data can be treated
......@@ -271,23 +299,21 @@ Int_t PreproHist::SetInput()
frame_in->Read();
// get the real length from the data (assuming all traces have the same length)
fTraceLengthRaw = cdata->GetCore(0)->GetSignal()->GetLength();
fTraceLengthPSA = cdata->GetCore(0)->GetSignal()->GetLength();
for(int iseg = 0; iseg < kNSG; iseg++)
{
seg = cdata->GetSegment(iseg);
SegE[iseg] = (Float_t)seg->GetE();
seg->GetSignal()->Get(fTracesSG[iseg], fTraceLengthRaw);
seg->GetSignal()->Get(fTracesSG[iseg], fTraceLengthPSA);
}
for(UShort_t icc=0; icc<kNCC; icc++)
{
core = cdata->GetCore(icc);
CoreE[icc] = (Float_t)core->GetE();
CoreT[icc] = (Float_t)core->GetT();
core->GetSignal()->Get(fTracesCC[icc], fTraceLengthRaw);
core->GetSignal()->Get(fTracesCC[icc], fTraceLengthPSA);
}
evnumber = ( ( AgataKey * ) frame_in->GetKey() )->GetEventNumber();
......@@ -310,6 +336,10 @@ UInt_t PreproHist::GetParameters(const std::string& confFile, Bool_t doList)
, &fAmplivsIdBinning.NBinsY, &fAmplivsIdBinning.YMin, &fAmplivsIdBinning.YMax);
conf.Add("PlotBaseline", "Binning of the baseline spectra"
, &fBaselineBinning.NBins, &fBaselineBinning.Min, &fBaselineBinning.Max);
conf.Add("PlotT0", "Binning of the T0 spectra"
, &fT0Binning.NBins, &fT0Binning.Min, &fT0Binning.Max);
conf.Add("PlotDeltaT", "Binning of the DeltaT spectrum"
, &fDeltaTBinning.NBins, &fDeltaTBinning.Min, &fDeltaTBinning.Max);
conf.Add("PlotTimeStamps", "Plot Timestamp spectra, optionnal: define the ref T0 TimeStamp (1 TSRef)"
, &fPlotTimeStamps, &fFirstTS).SetRequired(1);
......@@ -322,6 +352,8 @@ UInt_t PreproHist::GetParameters(const std::string& confFile, Bool_t doList)
if(fAmpliBinning.NBins>0) fPlotAmpli = true;
if(fAmplivsIdBinning.NBinsX>0) fPlotAmplivsId = true;
if(fBaselineBinning.NBins>0) fPlotBaseline = true;
if(fT0Binning.NBins>0) fPlotT0 = true;
if(fDeltaTBinning.NBins>0) fPlotDeltaT = true;
// To randomize the refresh time among the different crystals
fRefreshTime = fRefreshTime - 0.5 + ((double) rand() / (RAND_MAX));
......@@ -385,10 +417,10 @@ void PreproHist::InitSMZ(Int_t id)
YTitle<<"[0;36]: Segment Id ; 37: Core HG ; 38: Core LG)";
GruName<<"Prepro/Ampli_vs_SegId/Cry"<<CrystalName.data();
Hist2F *hist2F = NewHist2F(Name.str(),Title.str(),XTitle.str(),YTitle.str(),GruName.str(),
Hist2F *hist2F = static_cast<Hist2F*>(NewHist2F(Name.str(),Title.str(),XTitle.str(),YTitle.str(),GruName.str(),
fAmplivsIdBinning.NBinsX,fAmplivsIdBinning.XMin,fAmplivsIdBinning.XMax,
fAmplivsIdBinning.NBinsY,fAmplivsIdBinning.YMin,fAmplivsIdBinning.YMax,
map_ptr,PortNumber);
map_ptr,PortNumber));
Name.str("");Title.str("");XTitle.str("");YTitle.str("");GruName.str("");
......@@ -421,6 +453,55 @@ void PreproHist::InitSMZ(Int_t id)
if(hist1F) list.push_back(hist1F);
}
}
if(fPlotT0)
{
vector<void *>& list = fListOfHists[(Int_t)HistLib::T0];
for(auto i=0 ; i<kNSG ; i++)
{
Name<<"Prepro_T0_Cry" << id << "_Seg" << i;
Title<<"Prepro_T0_Cry"<<CrystalName.data()<<"_Seg"<<GetSegmentNameFromID(i).data();
XTitle<<"relative time compared to Core0";
GruName<<"Prepro/T0/Cry"<<CrystalName.data();
Hist1F *hist1F = NewHist1F(Name.str(),Title.str(),XTitle.str(),GruName.str(),fT0Binning.NBins,fT0Binning.Min,fT0Binning.Max,map_ptr,PortNumber);
Name.str("");Title.str("");XTitle.str("");GruName.str("");
if(hist1F) list.push_back(hist1F);
}
for(auto i=0 ; i<kNCC ; i++)
{
Name<<"Prepro_T0_Cry" << id << "_Core" << i;
if(i==0)
{
Title<<"Prepro_T0_Cry"<<CrystalName.data()<<"_AllSegs";
XTitle<<"relative time compared to Core0 for all segments";
}