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() ...@@ -57,6 +57,7 @@ void SetProofGlobalValues()
fProof->SetParameter("BaseRootFileName",(TString)fBaseRootFileName); fProof->SetParameter("BaseRootFileName",(TString)fBaseRootFileName);
fProof->SetParameter("DiamantLookUpTable",(TString)fDiamantLookUpTable); fProof->SetParameter("DiamantLookUpTable",(TString)fDiamantLookUpTable);
fProof->SetParameter("DiamantTSPeaks",(TString)fDiamantTSPeaks); fProof->SetParameter("DiamantTSPeaks",(TString)fDiamantTSPeaks);
fProof->SetParameter("DiamantPidPeaks",(TString)fDiamantPidPeaks);
fProof->SetParameter("DiamantCutsLocation",(TString)fDiamantCutsLocation); fProof->SetParameter("DiamantCutsLocation",(TString)fDiamantCutsLocation);
fProof->SetParameter("NedaLookUpTable",(TString)fNedaLookUpTable); fProof->SetParameter("NedaLookUpTable",(TString)fNedaLookUpTable);
fProof->SetParameter("NedaTSPeaks",(TString)fNedaTSPeaks); fProof->SetParameter("NedaTSPeaks",(TString)fNedaTSPeaks);
...@@ -72,6 +73,7 @@ void SetStandardGlobalValues() ...@@ -72,6 +73,7 @@ void SetStandardGlobalValues()
gEnv->SetValue("PrepNeda.BaseRootFileName", (TString)fBaseRootFileName); gEnv->SetValue("PrepNeda.BaseRootFileName", (TString)fBaseRootFileName);
gEnv->SetValue("PrepNeda.DiamantLookUpTable", (TString)fDiamantLookUpTable); gEnv->SetValue("PrepNeda.DiamantLookUpTable", (TString)fDiamantLookUpTable);
gEnv->SetValue("PrepNeda.DiamantTSPeaks", (TString)fDiamantTSPeaks); gEnv->SetValue("PrepNeda.DiamantTSPeaks", (TString)fDiamantTSPeaks);
gEnv->SetValue("PrepNeda.DiamantPidPeaks", (TString)fDiamantPidPeaks);
gEnv->SetValue("PrepNeda.DiamantCutsLocation", (TString)fDiamantCutsLocation); gEnv->SetValue("PrepNeda.DiamantCutsLocation", (TString)fDiamantCutsLocation);
gEnv->SetValue("PrepNeda.NedaLookUpTable", (TString)fNedaLookUpTable); gEnv->SetValue("PrepNeda.NedaLookUpTable", (TString)fNedaLookUpTable);
gEnv->SetValue("PrepNeda.NedaTSPeaks",(TString)fNedaTSPeaks); gEnv->SetValue("PrepNeda.NedaTSPeaks",(TString)fNedaTSPeaks);
...@@ -309,6 +311,13 @@ void ReadConfFile() ...@@ -309,6 +311,13 @@ void ReadConfFile()
delete loa; delete loa;
cout<<"DiamantTSPeaks = "<<fDiamantTSPeaks<<endl; 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")) if(Buffer.BeginsWith("DiamantCutsLocation"))
{ {
TObjArray *loa=Buffer.Tokenize(" "); TObjArray *loa=Buffer.Tokenize(" ");
......
...@@ -58,6 +58,7 @@ TString fBaseRootFileName; ...@@ -58,6 +58,7 @@ TString fBaseRootFileName;
TString fDiamantLookUpTable; TString fDiamantLookUpTable;
TString fDiamantCutsLocation; TString fDiamantCutsLocation;
TString fDiamantTSPeaks; TString fDiamantTSPeaks;
TString fDiamantPidPeaks;
TString fNedaLookUpTable; TString fNedaLookUpTable;
TString fNedaCutsLocation; TString fNedaCutsLocation;
TString fNedaTSPeaks; TString fNedaTSPeaks;
......
...@@ -76,6 +76,7 @@ void PlotResultsSelector::Begin(TTree * /*tree*/) ...@@ -76,6 +76,7 @@ void PlotResultsSelector::Begin(TTree * /*tree*/)
fBaseRootFileName = gEnv->GetValue("PrepNeda.BaseRootFileName", dummy); fBaseRootFileName = gEnv->GetValue("PrepNeda.BaseRootFileName", dummy);
fDiamantLookUpTable = gEnv->GetValue("PrepNeda.DiamantLookUpTable", dummy); fDiamantLookUpTable = gEnv->GetValue("PrepNeda.DiamantLookUpTable", dummy);
fDiamantTSPeaks = gEnv->GetValue("PrepNeda.DiamantTSPeaks", dummy); fDiamantTSPeaks = gEnv->GetValue("PrepNeda.DiamantTSPeaks", dummy);
fDiamantPidPeaks = gEnv->GetValue("PrepNeda.DiamantPidPeaks", dummy);
fDiamantCutsLocation = gEnv->GetValue("PrepNeda.DiamantCutsLocation", dummy); fDiamantCutsLocation = gEnv->GetValue("PrepNeda.DiamantCutsLocation", dummy);
fNedaLookUpTable = gEnv->GetValue("PrepNeda.NedaLookUpTable", dummy); fNedaLookUpTable = gEnv->GetValue("PrepNeda.NedaLookUpTable", dummy);
fNedaTSPeaks = gEnv->GetValue("PrepNeda.NedaTSPeaks", dummy); fNedaTSPeaks = gEnv->GetValue("PrepNeda.NedaTSPeaks", dummy);
...@@ -85,6 +86,8 @@ void PlotResultsSelector::Begin(TTree * /*tree*/) ...@@ -85,6 +86,8 @@ void PlotResultsSelector::Begin(TTree * /*tree*/)
fDiamantLookUpTable.Prepend(Form("%s/",fWorkingDir.Data())); fDiamantLookUpTable.Prepend(Form("%s/",fWorkingDir.Data()));
if(!fDiamantTSPeaks.BeginsWith("/") && fDiamantTSPeaks.Length()) if(!fDiamantTSPeaks.BeginsWith("/") && fDiamantTSPeaks.Length())
fDiamantTSPeaks.Prepend(Form("%s/",fWorkingDir.Data())); fDiamantTSPeaks.Prepend(Form("%s/",fWorkingDir.Data()));
if(!fDiamantPidPeaks.BeginsWith("/") && fDiamantPidPeaks.Length())
fDiamantPidPeaks.Prepend(Form("%s/",fWorkingDir.Data()));
if(!fDiamantCutsLocation.BeginsWith("/") && fDiamantCutsLocation.Length()) if(!fDiamantCutsLocation.BeginsWith("/") && fDiamantCutsLocation.Length())
fDiamantCutsLocation.Prepend(Form("%s/",fWorkingDir.Data())); fDiamantCutsLocation.Prepend(Form("%s/",fWorkingDir.Data()));
if(!fNedaLookUpTable.BeginsWith("/") && fNedaLookUpTable.Length()) if(!fNedaLookUpTable.BeginsWith("/") && fNedaLookUpTable.Length())
...@@ -129,6 +132,7 @@ void PlotResultsSelector::SlaveBegin(TTree * /*tree*/) ...@@ -129,6 +132,7 @@ void PlotResultsSelector::SlaveBegin(TTree * /*tree*/)
fBaseRootFileName = ((TString)((TParameter<TString>*)fInput->FindObject("BaseRootFileName"))->GetVal()); fBaseRootFileName = ((TString)((TParameter<TString>*)fInput->FindObject("BaseRootFileName"))->GetVal());
fDiamantLookUpTable = ((TString)((TParameter<TString>*)fInput->FindObject("DiamantLookUpTable"))->GetVal()); fDiamantLookUpTable = ((TString)((TParameter<TString>*)fInput->FindObject("DiamantLookUpTable"))->GetVal());
fDiamantTSPeaks = ((TString)((TParameter<TString>*)fInput->FindObject("DiamantTSPeaks"))->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()); fDiamantCutsLocation = ((TString)((TParameter<TString>*)fInput->FindObject("DiamantCutsLocation"))->GetVal());
fNedaLookUpTable = ((TString)((TParameter<TString>*)fInput->FindObject("NedaLookUpTable"))->GetVal()); fNedaLookUpTable = ((TString)((TParameter<TString>*)fInput->FindObject("NedaLookUpTable"))->GetVal());
fNedaTSPeaks = ((TString)((TParameter<TString>*)fInput->FindObject("NedaTSPeaks"))->GetVal()); fNedaTSPeaks = ((TString)((TParameter<TString>*)fInput->FindObject("NedaTSPeaks"))->GetVal());
...@@ -138,6 +142,8 @@ void PlotResultsSelector::SlaveBegin(TTree * /*tree*/) ...@@ -138,6 +142,8 @@ void PlotResultsSelector::SlaveBegin(TTree * /*tree*/)
fDiamantLookUpTable.Prepend(Form("%s/",fWorkingDir.Data())); fDiamantLookUpTable.Prepend(Form("%s/",fWorkingDir.Data()));
if(!fDiamantTSPeaks.BeginsWith("/") && fDiamantTSPeaks.Length()) if(!fDiamantTSPeaks.BeginsWith("/") && fDiamantTSPeaks.Length())
fDiamantTSPeaks.Prepend(Form("%s/",fWorkingDir.Data())); fDiamantTSPeaks.Prepend(Form("%s/",fWorkingDir.Data()));
if(!fDiamantPidPeaks.BeginsWith("/") && fDiamantPidPeaks.Length())
fDiamantPidPeaks.Prepend(Form("%s/",fWorkingDir.Data()));
if(!fDiamantCutsLocation.BeginsWith("/") && fDiamantCutsLocation.Length()) if(!fDiamantCutsLocation.BeginsWith("/") && fDiamantCutsLocation.Length())
fDiamantCutsLocation.Prepend(Form("%s/",fWorkingDir.Data())); fDiamantCutsLocation.Prepend(Form("%s/",fWorkingDir.Data()));
if(!fNedaLookUpTable.BeginsWith("/") && fNedaLookUpTable.Length()) if(!fNedaLookUpTable.BeginsWith("/") && fNedaLookUpTable.Length())
...@@ -329,8 +335,11 @@ void PlotResultsSelector::SlaveBegin(TTree * /*tree*/) ...@@ -329,8 +335,11 @@ void PlotResultsSelector::SlaveBegin(TTree * /*tree*/)
Diamant_NProtons_h = BuildHist1D("Diamant_NProtons",Diamant_nprotons,fDiamantHistList); Diamant_NProtons_h = BuildHist1D("Diamant_NProtons",Diamant_nprotons,fDiamantHistList);
Diamant_NAlphas_h = BuildHist1D("Diamant_NAlphas",Diamant_nalphas,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); DiamantEnergyPIDtot_h = BuildHist2D("DiamantEnergyPIDtot",Diamant_Energy,Diamant_PID,fDiamantHistList);
l = new TList;l->SetName("Energy");fDiamantHistList->Add(l); l = new TList;l->SetName("Energy");fDiamantHistList->Add(l);
for (Int_t i=0; i<MaxDIAMANT; i++) for (Int_t i=0; i<MaxDIAMANT; i++)
{ {
...@@ -761,6 +770,41 @@ void PlotResultsSelector::Load_DIAMANT_Infos() ...@@ -761,6 +770,41 @@ void PlotResultsSelector::Load_DIAMANT_Infos()
fUseNEDATSPeak = false; fUseNEDATSPeak = false;
} }
filein.close(); 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() void PlotResultsSelector::FillHistos()
...@@ -803,6 +847,7 @@ void PlotResultsSelector::FillHistos() ...@@ -803,6 +847,7 @@ void PlotResultsSelector::FillHistos()
DiamantEnergy_h[id]->Fill(Diamant_Energy[i]); DiamantEnergy_h[id]->Fill(Diamant_Energy[i]);
DiamantTop_h[id]->Fill(Diamant_Top[i]); DiamantTop_h[id]->Fill(Diamant_Top[i]);
DiamantPID_h[id]->Fill(Diamant_PID[i]); DiamantPID_h[id]->Fill(Diamant_PID[i]);
DiamantPIDtot_h->Fill(Diamant_PID[i]);
DiamantEnergyPID_h[id]->Fill(Diamant_Energy[i], Diamant_PID[i]); DiamantEnergyPID_h[id]->Fill(Diamant_Energy[i], Diamant_PID[i]);
DiamantEnergyPIDtot_h->Fill(Diamant_Energy[i], Diamant_PID[i]); DiamantEnergyPIDtot_h->Fill(Diamant_Energy[i], Diamant_PID[i]);
DiamantDeltaTSTime_h[id]->Fill(Diamant_DeltaTSTime[i]); DiamantDeltaTSTime_h[id]->Fill(Diamant_DeltaTSTime[i]);
...@@ -982,6 +1027,7 @@ Bool_t PlotResultsSelector::Process(Long64_t entry) ...@@ -982,6 +1027,7 @@ Bool_t PlotResultsSelector::Process(Long64_t entry)
/// ****** DIAMANT data treatment ****** /// /// ****** DIAMANT data treatment ****** ///
Diamant_Treatment();
Diamant_Identification(); Diamant_Identification();
int ip = DIAMANT_NProtons; if (ip>7) ip = 7; int ip = DIAMANT_NProtons; if (ip>7) ip = 7;
...@@ -1005,6 +1051,22 @@ Bool_t PlotResultsSelector::Process(Long64_t entry) ...@@ -1005,6 +1051,22 @@ Bool_t PlotResultsSelector::Process(Long64_t entry)
return true; 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() void PlotResultsSelector::Diamant_Identification()
{ {
Long64_t diamantTime; Long64_t diamantTime;
......
////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
// This class has been automatically generated on // This class has been automatically generated on
// Tue Jul 21 17:15:16 2015 by ROOT version 5.34/30 // Tue Jul 21 17:15:16 2015 by ROOT version 5.34/30
// from TTree TreeMaster/GANIL Tree // from TTree TreeMaster/GANIL Tree
...@@ -95,6 +95,7 @@ public : ...@@ -95,6 +95,7 @@ public :
Bool_t fUseNEDATSPeak; Bool_t fUseNEDATSPeak;
Bool_t fUseDIAMANTLUT; Bool_t fUseDIAMANTLUT;
Bool_t fUseDIAMANTTSPeak; Bool_t fUseDIAMANTTSPeak;
Bool_t fUseDIAMANTPIDPeak = false;
//if not using proof //if not using proof
TString fFileNameOut; TString fFileNameOut;
...@@ -103,6 +104,7 @@ public : ...@@ -103,6 +104,7 @@ public :
TString fBaseRootFileName; TString fBaseRootFileName;
TString fDiamantLookUpTable; TString fDiamantLookUpTable;
TString fDiamantTSPeaks; TString fDiamantTSPeaks;
TString fDiamantPidPeaks;
TString fDiamantCutsLocation; TString fDiamantCutsLocation;
TString fNedaLookUpTable; TString fNedaLookUpTable;
TString fNedaTSPeaks; TString fNedaTSPeaks;
...@@ -137,6 +139,7 @@ public : ...@@ -137,6 +139,7 @@ public :
Float_t Diamant_Energy[MaxDIAMANT]; Float_t Diamant_Energy[MaxDIAMANT];
Float_t Diamant_Top[MaxDIAMANT]; Float_t Diamant_Top[MaxDIAMANT];
Float_t Diamant_PID[MaxDIAMANT]; Float_t Diamant_PID[MaxDIAMANT];
Float_t Diamant_RawPID[MaxDIAMANT]; //used if original PID corrected
ULong64_t Diamant_TSHit[MaxDIAMANT]; ULong64_t Diamant_TSHit[MaxDIAMANT];
ULong64_t Diamant_TS; ULong64_t Diamant_TS;
std::map<UShort_t, UShort_t> Diamant_Id_map; // This is used to link a unique id to boardid/channelid 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 : ...@@ -149,6 +152,8 @@ public :
// Bool_t Diamant_deltaTS_is_ok[MaxDIAMANT]; // Bool_t Diamant_deltaTS_is_ok[MaxDIAMANT];
Bool_t Diamant_DeltaTSTimeOK[MaxDIAMANT]; Bool_t Diamant_DeltaTSTimeOK[MaxDIAMANT];
Float_t DiamantPidPeakPos[MaxDIAMANT];
Int_t DIAMANT_NProtons; Int_t DIAMANT_NProtons;
Int_t DIAMANT_NAlphas; Int_t DIAMANT_NAlphas;
Int_t DIAMANT_NDeuterons; Int_t DIAMANT_NDeuterons;
...@@ -251,7 +256,9 @@ public : ...@@ -251,7 +256,9 @@ public :
TH1F *DiamantDeltaTSTime_h[MaxDIAMANT]; TH1F *DiamantDeltaTSTime_h[MaxDIAMANT];
TH1F *DiamantEnergy_h[MaxDIAMANT]; TH1F *DiamantEnergy_h[MaxDIAMANT];
TH1F *DiamantTop_h[MaxDIAMANT]; TH1F *DiamantTop_h[MaxDIAMANT];
TH1F *DiamantPIDtot_h;
TH1F *DiamantPID_h[MaxDIAMANT]; TH1F *DiamantPID_h[MaxDIAMANT];
//Dmitry //Dmitry
TH2F *mDiamantPID; TH2F *mDiamantPID;
...@@ -359,7 +366,7 @@ public : ...@@ -359,7 +366,7 @@ public :
virtual void SlaveTerminate(); virtual void SlaveTerminate();
virtual void Terminate(); virtual void Terminate();
void Diamant_Treatment();
void Diamant_Identification(); void Diamant_Identification();
void Neda_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