Commit f92d3873 authored by Agata Analysis's avatar Agata Analysis
Browse files

Added possibility to read DIAMANT PID positions and align detectors in PID

parent 64b3ff1d
......@@ -57,6 +57,7 @@ void SetProofGlobalValues()
fProof->SetParameter("BaseRootFileName",(TString)fBaseRootFileName);
fProof->SetParameter("DiamantLookUpTable",(TString)fDiamantLookUpTable);
fProof->SetParameter("DiamantTSPeaks",(TString)fDiamantTSPeaks);
fProof->SetParameter("DiamantPidPeaks",(TString)fDiamantPidPeaks);
fProof->SetParameter("DiamantCutsLocation",(TString)fDiamantCutsLocation);
fProof->SetParameter("NedaLookUpTable",(TString)fNedaLookUpTable);
fProof->SetParameter("NedaTSPeaks",(TString)fNedaTSPeaks);
......@@ -72,6 +73,7 @@ void SetStandardGlobalValues()
gEnv->SetValue("PrepNeda.BaseRootFileName", (TString)fBaseRootFileName);
gEnv->SetValue("PrepNeda.DiamantLookUpTable", (TString)fDiamantLookUpTable);
gEnv->SetValue("PrepNeda.DiamantTSPeaks", (TString)fDiamantTSPeaks);
gEnv->SetValue("PrepNeda.DiamantPidPeaks", (TString)fDiamantPidPeaks);
gEnv->SetValue("PrepNeda.DiamantCutsLocation", (TString)fDiamantCutsLocation);
gEnv->SetValue("PrepNeda.NedaLookUpTable", (TString)fNedaLookUpTable);
gEnv->SetValue("PrepNeda.NedaTSPeaks",(TString)fNedaTSPeaks);
......@@ -309,6 +311,13 @@ void ReadConfFile()
delete loa;
cout<<"DiamantTSPeaks = "<<fDiamantTSPeaks<<endl;
}
if(Buffer.BeginsWith("DiamantPidPeaks"))
{
TObjArray *loa=Buffer.Tokenize(" ");
fDiamantPidPeaks = ((TString)loa->At(1)->GetName());
delete loa;
cout<<"DiamantPidPeaks = "<<fDiamantPidPeaks<<endl;
}
if(Buffer.BeginsWith("DiamantCutsLocation"))
{
TObjArray *loa=Buffer.Tokenize(" ");
......
......@@ -58,6 +58,7 @@ TString fBaseRootFileName;
TString fDiamantLookUpTable;
TString fDiamantCutsLocation;
TString fDiamantTSPeaks;
TString fDiamantPidPeaks;
TString fNedaLookUpTable;
TString fNedaCutsLocation;
TString fNedaTSPeaks;
......
......@@ -76,6 +76,7 @@ void PlotResultsSelector::Begin(TTree * /*tree*/)
fBaseRootFileName = gEnv->GetValue("PrepNeda.BaseRootFileName", dummy);
fDiamantLookUpTable = gEnv->GetValue("PrepNeda.DiamantLookUpTable", dummy);
fDiamantTSPeaks = gEnv->GetValue("PrepNeda.DiamantTSPeaks", dummy);
fDiamantPidPeaks = gEnv->GetValue("PrepNeda.DiamantPidPeaks", dummy);
fDiamantCutsLocation = gEnv->GetValue("PrepNeda.DiamantCutsLocation", dummy);
fNedaLookUpTable = gEnv->GetValue("PrepNeda.NedaLookUpTable", dummy);
fNedaTSPeaks = gEnv->GetValue("PrepNeda.NedaTSPeaks", dummy);
......@@ -85,6 +86,8 @@ void PlotResultsSelector::Begin(TTree * /*tree*/)
fDiamantLookUpTable.Prepend(Form("%s/",fWorkingDir.Data()));
if(!fDiamantTSPeaks.BeginsWith("/") && fDiamantTSPeaks.Length())
fDiamantTSPeaks.Prepend(Form("%s/",fWorkingDir.Data()));
if(!fDiamantPidPeaks.BeginsWith("/") && fDiamantPidPeaks.Length())
fDiamantPidPeaks.Prepend(Form("%s/",fWorkingDir.Data()));
if(!fDiamantCutsLocation.BeginsWith("/") && fDiamantCutsLocation.Length())
fDiamantCutsLocation.Prepend(Form("%s/",fWorkingDir.Data()));
if(!fNedaLookUpTable.BeginsWith("/") && fNedaLookUpTable.Length())
......@@ -129,6 +132,7 @@ void PlotResultsSelector::SlaveBegin(TTree * /*tree*/)
fBaseRootFileName = ((TString)((TParameter<TString>*)fInput->FindObject("BaseRootFileName"))->GetVal());
fDiamantLookUpTable = ((TString)((TParameter<TString>*)fInput->FindObject("DiamantLookUpTable"))->GetVal());
fDiamantTSPeaks = ((TString)((TParameter<TString>*)fInput->FindObject("DiamantTSPeaks"))->GetVal());
fDiamantPidPeaks = ((TString)((TParameter<TString>*)fInput->FindObject("DiamantPidPeaks"))->GetVal());
fDiamantCutsLocation = ((TString)((TParameter<TString>*)fInput->FindObject("DiamantCutsLocation"))->GetVal());
fNedaLookUpTable = ((TString)((TParameter<TString>*)fInput->FindObject("NedaLookUpTable"))->GetVal());
fNedaTSPeaks = ((TString)((TParameter<TString>*)fInput->FindObject("NedaTSPeaks"))->GetVal());
......@@ -138,6 +142,8 @@ void PlotResultsSelector::SlaveBegin(TTree * /*tree*/)
fDiamantLookUpTable.Prepend(Form("%s/",fWorkingDir.Data()));
if(!fDiamantTSPeaks.BeginsWith("/") && fDiamantTSPeaks.Length())
fDiamantTSPeaks.Prepend(Form("%s/",fWorkingDir.Data()));
if(!fDiamantPidPeaks.BeginsWith("/") && fDiamantPidPeaks.Length())
fDiamantPidPeaks.Prepend(Form("%s/",fWorkingDir.Data()));
if(!fDiamantCutsLocation.BeginsWith("/") && fDiamantCutsLocation.Length())
fDiamantCutsLocation.Prepend(Form("%s/",fWorkingDir.Data()));
if(!fNedaLookUpTable.BeginsWith("/") && fNedaLookUpTable.Length())
......@@ -329,8 +335,11 @@ void PlotResultsSelector::SlaveBegin(TTree * /*tree*/)
Diamant_NProtons_h = BuildHist1D("Diamant_NProtons",Diamant_nprotons,fDiamantHistList);
Diamant_NAlphas_h = BuildHist1D("Diamant_NAlphas",Diamant_nalphas,fDiamantHistList);
DiamantPIDtot_h = BuildHist1D("DiamantPIDtot",Diamant_PID,fDiamantHistList);
DiamantEnergyPIDtot_h = BuildHist2D("DiamantEnergyPIDtot",Diamant_Energy,Diamant_PID,fDiamantHistList);
l = new TList;l->SetName("Energy");fDiamantHistList->Add(l);
for (Int_t i=0; i<MaxDIAMANT; i++)
{
......@@ -761,6 +770,41 @@ void PlotResultsSelector::Load_DIAMANT_Infos()
fUseNEDATSPeak = false;
}
filein.close();
// DIAMANT proton PID position to align detectors in PID
if (fDiamantPidPeaks.Length()>0) {
fUseDIAMANTPIDPeak = true;
}
if (fUseDIAMANTPIDPeak) {
Int_t n_lines = 0;
filein.open( fDiamantPidPeaks.Data() );
if( filein.is_open() == true ) {
Int_t id;
Float_t pos;
std::string str_tmp;
Int_t n_lines = 0;
while ( getline(filein, str_tmp) ) {// read input stream line by line
str_tmp += " ";
if ( str_tmp[0] == '#' ) {// this line is a comment
continue;
}
std::istringstream decode(str_tmp);
decode >> id >> pos;
DiamantPidPeakPos[ id ] = pos;
n_lines++;
}
printf( "%d lines read from file %s\n",n_lines,
fDiamantPidPeaks.Data()); fflush(stdout);
}
else {
printf( "DIAMANT PID positons requested but not found: %s\n",
fDiamantPidPeaks.Data());
fflush(stdout);
exit(0); //do not run
}
filein.close();
}
}
void PlotResultsSelector::FillHistos()
......@@ -803,6 +847,7 @@ void PlotResultsSelector::FillHistos()
DiamantEnergy_h[id]->Fill(Diamant_Energy[i]);
DiamantTop_h[id]->Fill(Diamant_Top[i]);
DiamantPID_h[id]->Fill(Diamant_PID[i]);
DiamantPIDtot_h->Fill(Diamant_PID[i]);
DiamantEnergyPID_h[id]->Fill(Diamant_Energy[i], Diamant_PID[i]);
DiamantEnergyPIDtot_h->Fill(Diamant_Energy[i], Diamant_PID[i]);
DiamantDeltaTSTime_h[id]->Fill(Diamant_DeltaTSTime[i]);
......@@ -982,6 +1027,7 @@ Bool_t PlotResultsSelector::Process(Long64_t entry)
/// ****** DIAMANT data treatment ****** ///
Diamant_Treatment();
Diamant_Identification();
int ip = DIAMANT_NProtons; if (ip>7) ip = 7;
......@@ -1005,6 +1051,22 @@ Bool_t PlotResultsSelector::Process(Long64_t entry)
return true;
}
void PlotResultsSelector::Diamant_Treatment() {
// place for operations like corrections, calibrations, etc.
const Float_t DiamantPidPosSet = 0.5;
if (fUseDIAMANTPIDPeak) {
for( Int_t i = 0; i < nbDIAMANT; i++ ) {
Diamant_RawPID[i] = Diamant_PID[i];
Int_t id = Diamant_Id[i];
Diamant_RawPID[i] = Diamant_PID[i];
// if (Diamant_PID[i]!=0)
Diamant_PID[i] = Diamant_PID[i] - DiamantPidPeakPos[id] + DiamantPidPosSet;
// printf("Id: %d, raw: %f, correction %f, corrected %f\n",
// id, Diamant_RawPID[i], DiamantPidPeakPos[id], Diamant_PID[i] );
}
}
}
void PlotResultsSelector::Diamant_Identification()
{
Long64_t diamantTime;
......
//////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
// This class has been automatically generated on
// Tue Jul 21 17:15:16 2015 by ROOT version 5.34/30
// from TTree TreeMaster/GANIL Tree
......@@ -95,6 +95,7 @@ public :
Bool_t fUseNEDATSPeak;
Bool_t fUseDIAMANTLUT;
Bool_t fUseDIAMANTTSPeak;
Bool_t fUseDIAMANTPIDPeak = false;
//if not using proof
TString fFileNameOut;
......@@ -103,6 +104,7 @@ public :
TString fBaseRootFileName;
TString fDiamantLookUpTable;
TString fDiamantTSPeaks;
TString fDiamantPidPeaks;
TString fDiamantCutsLocation;
TString fNedaLookUpTable;
TString fNedaTSPeaks;
......@@ -137,6 +139,7 @@ public :
Float_t Diamant_Energy[MaxDIAMANT];
Float_t Diamant_Top[MaxDIAMANT];
Float_t Diamant_PID[MaxDIAMANT];
Float_t Diamant_RawPID[MaxDIAMANT]; //used if original PID corrected
ULong64_t Diamant_TSHit[MaxDIAMANT];
ULong64_t Diamant_TS;
std::map<UShort_t, UShort_t> Diamant_Id_map; // This is used to link a unique id to boardid/channelid
......@@ -149,6 +152,8 @@ public :
// Bool_t Diamant_deltaTS_is_ok[MaxDIAMANT];
Bool_t Diamant_DeltaTSTimeOK[MaxDIAMANT];
Float_t DiamantPidPeakPos[MaxDIAMANT];
Int_t DIAMANT_NProtons;
Int_t DIAMANT_NAlphas;
Int_t DIAMANT_NDeuterons;
......@@ -251,7 +256,9 @@ public :
TH1F *DiamantDeltaTSTime_h[MaxDIAMANT];
TH1F *DiamantEnergy_h[MaxDIAMANT];
TH1F *DiamantTop_h[MaxDIAMANT];
TH1F *DiamantPIDtot_h;
TH1F *DiamantPID_h[MaxDIAMANT];
//Dmitry
TH2F *mDiamantPID;
......@@ -359,7 +366,7 @@ public :
virtual void SlaveTerminate();
virtual void Terminate();
void Diamant_Treatment();
void Diamant_Identification();
void Neda_Identification();
......
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