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

Add the possibility to give in the Conf file the min number of entries in each...

Add the possibility to give in the Conf file the min number of entries in each spectra to be saved (avoid useless memory usage)
parent 2fe707f5
......@@ -47,17 +47,30 @@ TreeName TreeMaster
#
FileNameOut Auto
### Remove Histograms with stat lower or equal than StatMin
#StatMin 1000
# In the following, paths can be set in absolute or relative path
##############
## NEDA ##
##############
#NEDA Paths
NedaLookUpTable /some/absolute/path/to/this/folder/InputPars/neda_id_lookup
NedaCutsLocation /some/absolute/path/to/this/folder/InputPars/CutNEDA
### Neda time gate ==> Give min and max value in TS units (10 ns)
#NedaTimeGate -10 5
#############
## DIAMANT ##
#############
#DIAMANT Paths
DiamantLookUpTable /some/absolute/path/to/this/folder/InputPars/diamant_id_lookup
DiamantCutsLocation /some/absolute/path/to/this/folder/InputPars/CutDIAMANT
#DiamantTSPeaks /some/absolute/path/to/this/folder/InputPars/diamant_ts_peaks
### Diamant time gate ==> Give min and max value in TS units (10 ns)
#DiamantTimeGate -15 5
......@@ -64,6 +64,7 @@ void SetProofGlobalValues()
fProof->SetParameter("UseProof",(Int_t)1);
fProof->SetParameter("NedaTimeGateFormula",(TString)fNedaTimeGateFormula);
fProof->SetParameter("DiamantTimeGateFormula",(TString)fDiamantTimeGateFormula);
fProof->SetParameter("StatMin",(Int_t)fStatMin);
}
void SetStandardGlobalValues()
......@@ -81,6 +82,7 @@ void SetStandardGlobalValues()
gEnv->SetValue("UseProof", (Int_t)0);
gEnv->SetValue("NedaTimeGateFormula", (TString)fNedaTimeGateFormula);
gEnv->SetValue("DiamantTimeGateFormula", (TString)fDiamantTimeGateFormula);
gEnv->SetValue("StatMin", (Int_t)fStatMin);
}
void ReadChain()
......@@ -358,8 +360,13 @@ void ReadConfFile()
delete loa;
cout<<"DiamantTimeGate (min;max) = ("<<fDiamantTimeGateFormula<<")"<<endl;
}
if(Buffer.BeginsWith("StatMin"))
{
TObjArray *loa=Buffer.Tokenize(" ");
fStatMin = ((TString)loa->At(1)->GetName()).Atoi();
delete loa;
cout<<"minimal statistics to save spectra = "<<fStatMin<< " events"<<endl;
}
}
FileConf.close();
......
......@@ -73,6 +73,7 @@ TString fListOfZToPlot;
TString fNedaTimeGateFormula = "";
TString fDiamantTimeGateFormula = "";
Int_t fStatMin=-1;
Bool_t fUseProof;
......
......@@ -71,6 +71,8 @@ void PlotResultsSelector::Begin(TTree * /*tree*/)
if(fUseProof == false)
{
const char *dummy = "";
Int_t dummyint=-1;
fWorkingDir = gEnv->GetValue("WorkingDir", dummy );
fFileNameOut = gEnv->GetValue("FileNameOut", dummy);
fBaseRootFileName = gEnv->GetValue("BaseRootFileName", dummy);
......@@ -99,6 +101,8 @@ void PlotResultsSelector::Begin(TTree * /*tree*/)
}
delete arr;
fStatMin = gEnv->GetValue("StatMin", dummyint);
if(!fDiamantLookUpTable.BeginsWith("/") && fDiamantLookUpTable.Length())
fDiamantLookUpTable.Prepend(Form("%s/",fWorkingDir.Data()));
if(!fDiamantTSPeaks.BeginsWith("/") && fDiamantTSPeaks.Length())
......@@ -170,6 +174,7 @@ void PlotResultsSelector::SlaveBegin(TTree * /*tree*/)
}
delete arr;
fStatMin = ((Int_t)((TParameter<Int_t>*)fInput->FindObject("StatMin"))->GetVal());
if(!fDiamantLookUpTable.BeginsWith("/") && fDiamantLookUpTable.Length())
fDiamantLookUpTable.Prepend(Form("%s/",fWorkingDir.Data()));
......@@ -545,7 +550,6 @@ void PlotResultsSelector::Load_NEDA_Infos()
TString FileName;
#ifdef USE_NEDA_ENERGY_CC_CUTS
printf( "\n\033[1;32mWill now try to open individual cuts for neda (CC vs Energy). If the TFile do not exist, this default cut will be taken:\n%sNEDAEnergyCc_cut.root\033[0m\n\n", fNedaCutsLocation.Data() ); fflush(stdout);
TList *ECCList = new TList;
......@@ -597,7 +601,6 @@ void PlotResultsSelector::Load_NEDA_Infos()
printf( "\n\033[1;31m%s/NEDAEnergyCc_cut%02i.root not found", fNedaCutsLocation.Data(),i ); fflush(stdout);
}
}
#endif
/// Load neda lookup table
......@@ -1035,7 +1038,6 @@ void PlotResultsSelector::Neda_Identification()
NEDA_NNeutrons = 0;
memset(NEDA_NNeutrons_ind,0,sizeof(Int_t)*MaxNEDA);
#ifdef USE_NEDA_ENERGY_CC_CUTS
for( int i = 0; i < nbNEDA; i++ )
{
Int_t id = Neda_Id[i];
......@@ -1081,8 +1083,6 @@ void PlotResultsSelector::Neda_Identification()
NEDA_NNeutrons += NEDA_NNeutrons_ind[i];
}
#endif
}
TH1F *PlotResultsSelector::BuildHist1D(TString HistName, Binning BinsX, TList *list)
......@@ -1129,113 +1129,146 @@ void PlotResultsSelector::SlaveTerminate()
// have been processed. When running with PROOF SlaveTerminate() is called
// on each slave server.
#ifdef REMOVE_EMPTY_HISTOGRAMS
TObject *o1 = 0x0;
TIter *iter = new TIter(fNedaHistList);
while( (o1 = iter->Next()))
if(fStatMin>=0)
{
TH1 *h = (TH1*)o1;
if(h->InheritsFrom("TH1") && h->GetEntries()==0)
for(int ilist=0 ; ilist<fListOfHists->GetEntries() ; ilist++)
{
fNedaHistList->Remove(h);
}
TList *l = (TList*)o1;
if(l->InheritsFrom("TList"))
{
TIter *iter12 = new TIter(l);
while( (o1 = iter12->Next()))
{
TH1 *h = (TH1*)o1;
if(h && h->GetEntries()==0)
{
l->Remove(h);
}
}
}
}
TList *alist = (TList*)fListOfHists->At(ilist);
TObject *o2 = 0x0;
TIter *iter2 = new TIter(fDiamantHistList);
while( (o2 = iter2->Next()))
{
TH1 *h = (TH1*)o2;
if(h->InheritsFrom("TH1") && h->GetEntries()==0)
{
fDiamantHistList->Remove(h);
}
TObject *o1 = 0x0;
TIter *iter = new TIter(alist);
TList *l = (TList*)o2;
if(l->InheritsFrom("TList"))
{
TIter *iter22 = new TIter(l);
while( (o2 = iter22->Next()))
while( (o1 = iter->Next()))
{
TH1 *h = (TH1*)o2;
if(h && h->GetEntries()==0)
TH1 *h = (TH1*)o1;
if(h->InheritsFrom("TH1") && h->GetEntries()<=fStatMin)
{
l->Remove(h);
alist->Remove(h);
}
}
}
}
TObject *o3 = 0x0;
TIter *iter3 = new TIter(fAgataHistList);
while( (o3 = iter3->Next()))
{
TH1 *h = (TH1*)o3;
if(h->InheritsFrom("TH1") && h->GetEntries()==0)
{
fAgataHistList->Remove(h);
}
TList *l = (TList*)o3;
if(l->InheritsFrom("TList"))
{
TIter *iter32 = new TIter(l);
while( (o3 = iter32->Next()))
{
TH1 *h = (TH1*)o3;
if(h && h->GetEntries()==0)
TList *l = (TList*)o1;
if(l->InheritsFrom("TList"))
{
l->Remove(h);
TIter *iter12 = new TIter(l);
while( (o1 = iter12->Next()))
{
TH1 *h = (TH1*)o1;
if(h->InheritsFrom("TH1") && h->GetEntries()<=fStatMin)
{
l->Remove(h);
}
}
}
}
}
}
TObject *o4 = 0x0;
TIter *iter4 = new TIter(fGlobHistList);
while( (o4 = iter4->Next()))
{
TH1 *h = (TH1*)o4;
if(h->InheritsFrom("TH1") && h->GetEntries()==0)
{
fGlobHistList->Remove(h);
}
TList *l = (TList*)o4;
if(l->InheritsFrom("TList"))
{
TIter *iter42 = new TIter(l);
while( (o4 = iter42->Next()))
{
TH1 *h = (TH1*)o4;
if(h && h->GetEntries()==0)
{
l->Remove(h);
}
}
}
}
#endif
// TObject *o1 = 0x0;
// TIter *iter = new TIter(fNedaHistList);
// while( (o1 = iter->Next()))
// {
// TH1 *h = (TH1*)o1;
// if(h->InheritsFrom("TH1") && h->GetEntries()<=fStatMin)
// {
// fNedaHistList->Remove(h);
// }
// TList *l = (TList*)o1;
// if(l->InheritsFrom("TList"))
// {
// TIter *iter12 = new TIter(l);
// while( (o1 = iter12->Next()))
// {
// TH1 *h = (TH1*)o1;
// if(h && h->GetEntries()<=fStatMin)
// {
// l->Remove(h);
// }
// }
// }
// }
// TObject *o2 = 0x0;
// TIter *iter2 = new TIter(fDiamantHistList);
// while( (o2 = iter2->Next()))
// {
// TH1 *h = (TH1*)o2;
// if(h->InheritsFrom("TH1") && h->GetEntries()<=fStatMin)
// {
// fDiamantHistList->Remove(h);
// }
// TList *l = (TList*)o2;
// if(l->InheritsFrom("TList"))
// {
// TIter *iter22 = new TIter(l);
// while( (o2 = iter22->Next()))
// {
// TH1 *h = (TH1*)o2;
// if(h && h->GetEntries()<=fStatMin)
// {
// l->Remove(h);
// }
// }
// }
// }
// TObject *o3 = 0x0;
// TIter *iter3 = new TIter(fAgataHistList);
// while( (o3 = iter3->Next()))
// {
// TH1 *h = (TH1*)o3;
// if(h->InheritsFrom("TH1") && h->GetEntries()<=fStatMin)
// {
// fAgataHistList->Remove(h);
// }
// TList *l = (TList*)o3;
// if(l->InheritsFrom("TList"))
// {
// TIter *iter32 = new TIter(l);
// while( (o3 = iter32->Next()))
// {
// TH1 *h = (TH1*)o3;
// if(h && h->GetEntries()<=fStatMin)
// {
// l->Remove(h);
// }
// }
// }
// }
// TObject *o4 = 0x0;
// TIter *iter4 = new TIter(fGlobHistList);
// while( (o4 = iter4->Next()))
// {
// TH1 *h = (TH1*)o4;
// if(h->InheritsFrom("TH1") && h->GetEntries()<=fStatMin)
// {
// fGlobHistList->Remove(h);
// }
// TList *l = (TList*)o4;
// if(l->InheritsFrom("TList"))
// {
// TIter *iter42 = new TIter(l);
// while( (o4 = iter42->Next()))
// {
// TH1 *h = (TH1*)o4;
// if(h && h->GetEntries()<=fStatMin)
// {
// l->Remove(h);
// }
// }
// }
// }
// }
}
void PlotResultsSelector::Terminate()
......
......@@ -32,9 +32,6 @@
#include "TRandom3.h"
#include "TEnv.h"
#define USE_NEDA_ENERGY_CC_CUTS
#define REMOVE_EMPTY_HISTOGRAMS
using namespace std;
class Binning
......@@ -135,6 +132,9 @@ public :
bool fApplyDiamantTimeGate = false;
pair<float, float> fDiamantTimeGate;
Int_t fStatMin;
Int_t nbDIAMANT;
UShort_t Diamant_BoardId[MaxDIAMANT];
UShort_t Diamant_ChannelId[MaxDIAMANT];
......
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