From b387d691fd06b10d546d42e8d1896243a287c6d2 Mon Sep 17 00:00:00 2001 From: Vratislav Chudoba Date: Fri, 7 Sep 2018 16:13:03 +0300 Subject: [PATCH] fillChain macro commented --- analysis/fillChain.cxx | 100 +++++++++++++++++++++++------------------ 1 file changed, 57 insertions(+), 43 deletions(-) diff --git a/analysis/fillChain.cxx b/analysis/fillChain.cxx index 06a8ece..787ec59 100644 --- a/analysis/fillChain.cxx +++ b/analysis/fillChain.cxx @@ -40,7 +40,6 @@ Double_t GetClusterPositionMWPC(unsigned short n, unsigned short *x, Float_t pla return position; } //-------------------------------------------------------------------- - void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents = 0) { TString inFile; @@ -62,16 +61,28 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents cout << "Input file: " << inFile << endl; cout << "Output file: " << outFile << endl; + /////////////////////////////////////////////////// + // Input file initialization + /////////////////////////////////////////////////// + TFile *fr = new TFile(inFile); TTree *tr = (TTree*)fr->Get("AnalysisxTree"); TNeEvent *revent = new TNeEvent(); - tr->SetBranchAddress("NeEvent.", &revent); + + /////////////////////////////////////////////////// + // Output file initialization + /////////////////////////////////////////////////// + TFile *fw = new TFile(outFile, "RECREATE"); TTree *tw = new TTree("cal", "Calibrated information"); + /////////////////////////////////////////////////// + // Output tree variables + /////////////////////////////////////////////////// + Int_t trigger; Float_t SQ20E[16]; @@ -127,12 +138,8 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents //left 1 mm position Float_t x1mm, y1mm; - const Float_t z1mm = 230.; Float_t xThin, yThin; - const Float_t zThin = 230.-53.6; - - const Float_t xThinOffset = -3., yThinOffset = -1.8; Int_t mapXbin, mapYbin; @@ -140,6 +147,10 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents TVector3 vNorm(0.,0.,1.); Double_t angleLeft; + /////////////////////////////////////////////////// + // Output tree branches initialization + /////////////////////////////////////////////////// + tw->Branch("trigger",&trigger,"trigger/I"); tw->Branch("angleLeft",&angleLeft,"angleLeft/D"); @@ -223,6 +234,11 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents else nevents = noevents; 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("../SQX_L_EC"); TNeDet16 pSQX_L_EC("./SQX_L"); @@ -240,10 +256,6 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents TNeDet16 pSQ20_EC("./sq20_58"); pSQ20_EC.ReadData(); -// for (Int_t i = 0; i < 32; i++) { -// cout << pSQX_L_EC.Energy(1, i) << endl; -// } - Float_t energy = 0; 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 TH2F *hThickness = new TH2F(*(TH2F*)fThickness.Get("hTh")); // 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_Y_strips = 16; const Int_t kSQL_20_strips = 16; -// const Double_t kSQLY_energy_thr = 1.; -// const Double_t kSQLX_energy_thr = 1.; -// const Double_t kSQL20_energy_thr = 1.2; - + //thin detector const Double_t kSQ20_norm_thickness = 20.; -// for (Int_t yi = 0; yi < kSQL_Y_strips; yi++) { -// cout << "y bin: " << yi+1 << "\t\t"; -// 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; -// } -// } + const Double_t thinXoffset = 1.; + const Double_t thinYoffset = -1.8; + + + //left CsI detectors + const UShort_t CsIleftThr = 180; + + /////////////////////////////////////////////////// + // Individual thresholds + /////////////////////////////////////////////////// + Float_t timeCorr[16] = {0, -2, 0, 2, -2.5, 5, -6, 4, @@ -345,18 +379,6 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents 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(); ////////////////////////////////// @@ -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++) { -// cout << eventNo << endl; - tr->GetEvent(eventNo); trigger = revent->trigger; if (trigger != 3) continue; -// cout << eventNo << endl; -// cout << revent->SQX_L[0] << endl; -// SQLXE[0] = revent->SQX_L[0]; - SQ20Esum = 0.; SQLXEsum = 0.; SQLYEsum = 0.; @@ -394,7 +410,6 @@ void fillTree(const TString beam = "he", Int_t nofile = 0, const Int_t noevents SQ20timeMult = 0; SQLXtimeMult = 0; -// SQLXtimeSum = 0; SQLYtimeMult = 0; CsI_L_veto = kFALSE; @@ -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; } - const Float_t l12 = 546.; - const Float_t lt = 270.; + if (TOF<166. || TOF>181.) continue; /////////////////////////////////////////////// //MWPC's -- 2.18.1