Commit b387d691 authored by Vratislav Chudoba's avatar Vratislav Chudoba

fillChain macro commented

parent c8d06270
...@@ -40,7 +40,6 @@ Double_t GetClusterPositionMWPC(unsigned short n, unsigned short *x, Float_t pla ...@@ -40,7 +40,6 @@ Double_t GetClusterPositionMWPC(unsigned short n, unsigned short *x, Float_t pla
return position; return position;
} //-------------------------------------------------------------------- } //--------------------------------------------------------------------
void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents = 0) { void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents = 0) {
TString inFile; TString inFile;
...@@ -62,16 +61,28 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents ...@@ -62,16 +61,28 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents
cout << "Input file: " << inFile << endl; cout << "Input file: " << inFile << endl;
cout << "Output file: " << outFile << endl; cout << "Output file: " << outFile << endl;
///////////////////////////////////////////////////
// Input file initialization
///////////////////////////////////////////////////
TFile *fr = new TFile(inFile); TFile *fr = new TFile(inFile);
TTree *tr = (TTree*)fr->Get("AnalysisxTree"); TTree *tr = (TTree*)fr->Get("AnalysisxTree");
TNeEvent *revent = new TNeEvent(); TNeEvent *revent = new TNeEvent();
tr->SetBranchAddress("NeEvent.", &revent); tr->SetBranchAddress("NeEvent.", &revent);
///////////////////////////////////////////////////
// Output file initialization
///////////////////////////////////////////////////
TFile *fw = new TFile(outFile, "RECREATE"); TFile *fw = new TFile(outFile, "RECREATE");
TTree *tw = new TTree("cal", "Calibrated information"); TTree *tw = new TTree("cal", "Calibrated information");
///////////////////////////////////////////////////
// Output tree variables
///////////////////////////////////////////////////
Int_t trigger; Int_t trigger;
Float_t SQ20E[16]; Float_t SQ20E[16];
...@@ -127,12 +138,8 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents ...@@ -127,12 +138,8 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents
//left 1 mm position //left 1 mm position
Float_t x1mm, y1mm; Float_t x1mm, y1mm;
const Float_t z1mm = 230.;
Float_t xThin, yThin; Float_t xThin, yThin;
const Float_t zThin = 230.-53.6;
const Float_t xThinOffset = -3., yThinOffset = -1.8;
Int_t mapXbin, mapYbin; Int_t mapXbin, mapYbin;
...@@ -140,6 +147,10 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents ...@@ -140,6 +147,10 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents
TVector3 vNorm(0.,0.,1.); TVector3 vNorm(0.,0.,1.);
Double_t angleLeft; Double_t angleLeft;
///////////////////////////////////////////////////
// Output tree branches initialization
///////////////////////////////////////////////////
tw->Branch("trigger",&trigger,"trigger/I"); tw->Branch("trigger",&trigger,"trigger/I");
tw->Branch("angleLeft",&angleLeft,"angleLeft/D"); tw->Branch("angleLeft",&angleLeft,"angleLeft/D");
...@@ -223,6 +234,11 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents ...@@ -223,6 +234,11 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents
else nevents = noevents; else nevents = noevents;
if (nevents > tr->GetEntries()) nevents = tr->GetEntries(); if (nevents > tr->GetEntries()) nevents = tr->GetEntries();
///////////////////////////////////////////////////
// calibration coefficients and thickness map
///////////////////////////////////////////////////
// TNeDet16 *pSQX_L_EC = new TNeDet16("SQX_L_EC"); // TNeDet16 *pSQX_L_EC = new TNeDet16("SQX_L_EC");
// TNeDet16 pSQX_L_EC("../SQX_L_EC"); // TNeDet16 pSQX_L_EC("../SQX_L_EC");
TNeDet16 pSQX_L_EC("./SQX_L"); TNeDet16 pSQX_L_EC("./SQX_L");
...@@ -240,10 +256,6 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents ...@@ -240,10 +256,6 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents
TNeDet16 pSQ20_EC("./sq20_58"); TNeDet16 pSQ20_EC("./sq20_58");
pSQ20_EC.ReadData(); pSQ20_EC.ReadData();
// for (Int_t i = 0; i < 32; i++) {
// cout << pSQX_L_EC.Energy(1, i) << endl;
// }
Float_t energy = 0; Float_t energy = 0;
cout << nevents << " entries will be treated." << endl; cout << nevents << " entries will be treated." << endl;
...@@ -254,26 +266,48 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents ...@@ -254,26 +266,48 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents
TH2F *hThickness = new TH2F(*(TH2F*)fThickness.Get("hTh")); TH2F *hThickness = new TH2F(*(TH2F*)fThickness.Get("hTh"));
// hThickness->Draw("col"); // hThickness->Draw("col");
// std::cout << std::setprecision(1) << std::fixed;
///////////////////////////////////////////////////
// Parameters related to geometry
///////////////////////////////////////////////////
//MWPC //todo: convert to minus
const Float_t l12 = 546.; //z coordinate of the center of MWPC1
const Float_t lt = 270.; //z coordinate of the center of MWPC2
//offsets taken from S. Krupko
const Float_t MWPC1_X_offset = -1.0;
const Float_t MWPC1_Y_offset = -2.1375;
const Float_t MWPC2_X_offset = 0.2;
const Float_t MWPC2_Y_offset = -1.125;
//left telescope
const Float_t z1mm = 230.;
const Float_t zThin = 230.-53.6;
const Float_t xThinOffset = -3.;
const Float_t yThinOffset = -1.8;
//todo: add sign taking into account direction of numbering
const Int_t kSQL_X_strips = 32; const Int_t kSQL_X_strips = 32;
const Int_t kSQL_Y_strips = 16; const Int_t kSQL_Y_strips = 16;
const Int_t kSQL_20_strips = 16; const Int_t kSQL_20_strips = 16;
// const Double_t kSQLY_energy_thr = 1.; //thin detector
// const Double_t kSQLX_energy_thr = 1.;
// const Double_t kSQL20_energy_thr = 1.2;
const Double_t kSQ20_norm_thickness = 20.; const Double_t kSQ20_norm_thickness = 20.;
// for (Int_t yi = 0; yi < kSQL_Y_strips; yi++) { const Double_t thinXoffset = 1.;
// cout << "y bin: " << yi+1 << "\t\t"; const Double_t thinYoffset = -1.8;
// for (Int_t xi = 0; xi < kSQL_X_strips; xi++) {
// cout << hThickness->GetBinContent(xi+1, yi+1) << "\t";
// if (xi == kSQL_X_strips-1) cout << endl; //left CsI detectors
// } const UShort_t CsIleftThr = 180;
// }
///////////////////////////////////////////////////
// Individual thresholds
///////////////////////////////////////////////////
Float_t timeCorr[16] = {0, -2, 0, 2, Float_t timeCorr[16] = {0, -2, 0, 2,
-2.5, 5, -6, 4, -2.5, 5, -6, 4,
...@@ -345,18 +379,6 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents ...@@ -345,18 +379,6 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents
460, 460, 460, 453 460, 460, 460, 453
}; };
const UShort_t CsIleftThr = 180;
const Double_t thinXoffset = 1.;
const Double_t thinYoffset = -1.8;
const Float_t MWPC1_X_offset = -1.0;
const Float_t MWPC1_Y_offset = -2.1375;
const Float_t MWPC2_X_offset = 0.2;
const Float_t MWPC2_Y_offset = -1.125;
fw->cd(); fw->cd();
////////////////////////////////// //////////////////////////////////
...@@ -365,18 +387,12 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents ...@@ -365,18 +387,12 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents
for (Int_t eventNo = 0; eventNo < nevents; eventNo++) { for (Int_t eventNo = 0; eventNo < nevents; eventNo++) {
// cout << eventNo << endl;
tr->GetEvent(eventNo); tr->GetEvent(eventNo);
trigger = revent->trigger; trigger = revent->trigger;
if (trigger != 3) continue; if (trigger != 3) continue;
// cout << eventNo << endl;
// cout << revent->SQX_L[0] << endl;
// SQLXE[0] = revent->SQX_L[0];
SQ20Esum = 0.; SQ20Esum = 0.;
SQLXEsum = 0.; SQLXEsum = 0.;
SQLYEsum = 0.; SQLYEsum = 0.;
...@@ -394,7 +410,6 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents ...@@ -394,7 +410,6 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents
SQ20timeMult = 0; SQ20timeMult = 0;
SQLXtimeMult = 0; SQLXtimeMult = 0;
// SQLXtimeSum = 0;
SQLYtimeMult = 0; SQLYtimeMult = 0;
CsI_L_veto = kFALSE; CsI_L_veto = kFALSE;
...@@ -422,8 +437,7 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents ...@@ -422,8 +437,7 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents
TOF = ( (revent->tF5[0]+revent->tF5[1]+revent->tF5[2]+revent->tF5[3]) - (revent->tF3[0]+revent->tF3[1]+revent->tF3[2]+revent->tF3[3]) )/4.*0.125+89.165; TOF = ( (revent->tF5[0]+revent->tF5[1]+revent->tF5[2]+revent->tF5[3]) - (revent->tF3[0]+revent->tF3[1]+revent->tF3[2]+revent->tF3[3]) )/4.*0.125+89.165;
} }
const Float_t l12 = 546.; if (TOF<166. || TOF>181.) continue;
const Float_t lt = 270.;
/////////////////////////////////////////////// ///////////////////////////////////////////////
//MWPC's //MWPC's
......
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