#include "TSystem.h" #include "TFile.h" #include "TTree.h" #include "TChain.h" #include "TCanvas.h" #include "TBox.h" #include "TCut.h" #include "TCutG.h" #include "TStopwatch.h" using std::cout; using std::endl; void searchOfThresholds() { Long64_t drawEntries = 10000000; // TFile *fr = new TFile("~/data/exp1804/h5_11_00.root"); TChain *tr = new TChain("AnalysisxTree"); tr->Add("~/data/exp1804/h5_14_0?.root"); // tr->Add("~/data/exp1804/be10_0?_?0.root"); TChain *trCal = new TChain("cal"); // trCal->Add("~/data/exp1804/h5_11_0?_calib.root"); // trCal->Add("~/data/exp1804/h5_14_0?_calib.root"); // trCal->Add("~/data/exp1804/be10_0?_?0_calib.root"); //calibration file for thin detector TFile *fcal = new TFile("~/data/exp1804/calib/si_20_03.root"); TTree *tAlphaCal = (TTree*)fcal->Get("AnalysisxTree"); //calibration file for 1mm left detector TFile *fcal1000 = new TFile("~/data/exp1804/calib/si_1000_LR_02.root"); TTree *tAlphaCal1000 = (TTree*)fcal1000->Get("AnalysisxTree"); tr->GetListOfFiles()->Print(); trCal->GetListOfFiles()->Print(); cout << tr->GetEntries() << " events." << endl; cout << trCal->GetEntries() << " calibrated events." << endl; TString varName; TString condition; Int_t firstThinStrip = 5; TStopwatch stopwatch; stopwatch.Start(); //return; ///////////////////////////////////////////////////////////////////// // c0_1: thresholds search for SQ20 in channels: /*TCanvas *c0_1 = new TCanvas("c0_1", "amplitudes in ADC channel unit", 1600, 1200); c0_1->Divide(4,4); firstThinStrip = 0; //according to calibration data // Int_t thinChThresholds[16] = { // 110, 112, 113, 115, // 112, 118, 113, 110, // 104, 115, 120, 113, // 115, 119, 113, 102 // }; //according to experimental data Int_t thinChThresholds[16] = { 113, 121, 125, 125, 125, 132, 130, 115, 118, 128, 132, 130, 130, 130, 130, 112 }; cout << tr->GetEntries() << " events." << endl; cout << trCal->GetEntries() << " calibrated events." << endl; drawEntries = 10000000; cout << drawEntries << " entries in input chain will be processed." << endl; for (Int_t i = 0; i < 16; i++) { c0_1->cd(i+1); gPad->SetLogy(); varName.Form("SQ20[%d]", i+firstThinStrip); condition.Form("SQ20[%d]>0 && SQ20[%d]<1200", i+firstThinStrip, i+firstThinStrip); tAlphaCal->SetLineColor(kBlack); tAlphaCal->Draw(varName, condition, "", drawEntries); c0_1->Update(); condition.Form("SQ20[%d]>%d && SQ20[%d]<1200", i+firstThinStrip, thinChThresholds[i], i+firstThinStrip); cout << condition << endl; tAlphaCal->SetLineColor(kRed); tAlphaCal->Draw(varName, condition, "same", drawEntries); c0_1->Update(); }//*/ // return; ///////////////////////////////////////////////////////////////////// // c0_1_check: check of thresholds for SQ20 in channels // on real experimental data: /*TCanvas *c0_1_check = new TCanvas("c0_1_check", "amplitudes in ADC channel unit", 1600, 1200); c0_1_check->Divide(4,4); firstThinStrip = 0; cout << tr->GetEntries() << " events." << endl; cout << trCal->GetEntries() << " calibrated events." << endl; drawEntries = 1000000; cout << drawEntries << " entries in input chain will be processed." << endl; for (Int_t i = 0; i < 16; i++) { c0_1_check->cd(i+1); gPad->SetLogy(); varName.Form("SQ20[%d]", i+firstThinStrip); condition.Form("SQ20[%d]>0 && SQ20[%d]<200", i+firstThinStrip, i+firstThinStrip); tr->SetLineColor(kBlack); tr->Draw(varName, condition, "", drawEntries); c0_1_check->Update(); condition.Form("SQ20[%d]>%d && SQ20[%d]<200", i+firstThinStrip, thinChThresholds[i], i+firstThinStrip); cout << condition << endl; tr->SetLineColor(kRed); tr->Draw(varName, condition, "same", drawEntries); c0_1_check->Update(); }//*/ // return; ///////////////////////////////////////////////////////////////////// // c0_2: thresholds search for SQX_L in channels: /*TCanvas *c0_2 = new TCanvas("c0_2", "amplitudes in ADC channel unit (0-15)", 1600, 1200); c0_2->Divide(4,4); TCanvas *c0_2_2 = new TCanvas("c0_2_2", "amplitudes in ADC channel unit (15-32)", 1600, 1200); c0_2_2->Divide(4,4); firstThinStrip = 0; Int_t thickChThresholds[32] = { 60, 45, 45, 45, 45, 4000, 4000, 45, 45, 45, 45, 45, 45, 45, 45, 45, ///// 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 60 }; cout << tr->GetEntries() << " events." << endl; cout << trCal->GetEntries() << " calibrated events." << endl; drawEntries = 10000000; cout << drawEntries << " entries in input chain will be processed." << endl; for (Int_t i = 0; i < 32; i++) { if (i<16) c0_2->cd(i+1); if (i>15) c0_2_2->cd(i-16+1); gPad->SetLogy(); varName.Form("SQX_L[%d]", i+firstThinStrip); condition.Form("SQX_L[%d]>200 && SQX_L[%d]<2000", i+firstThinStrip, i+firstThinStrip); tAlphaCal1000->SetLineColor(kBlack); tAlphaCal1000->Draw(varName, condition, "", drawEntries); c0_2->Update(); c0_2_2->Update(); condition.Form("SQX_L[%d]>%d && SQX_L[%d]<2000", i+firstThinStrip, thickChThresholds[i], i+firstThinStrip); cout << condition << endl; tAlphaCal1000->SetLineColor(kRed); tAlphaCal1000->Draw(varName, condition, "same", drawEntries); c0_2->Update(); c0_2_2->Update(); }//*/ // return; ///////////////////////////////////////////////////////////////////// // c0_2_check: check of thresholds for SQX_L in channels // on real experimental data: /*TCanvas *c0_2_check = new TCanvas("c0_2_check", "amplitudes in ADC channel unit (0-15); exp", 1600, 1200); c0_2_check->Divide(4,4); TCanvas *c0_2_2_check = new TCanvas("c0_2_2_check", "amplitudes in ADC channel unit (15-32); exp", 1600, 1200); c0_2_2_check->Divide(4,4); firstThinStrip = 0; cout << tr->GetEntries() << " events." << endl; cout << trCal->GetEntries() << " calibrated events." << endl; drawEntries = 1000000; cout << drawEntries << " entries in input chain will be processed." << endl; for (Int_t i = 0; i < 32; i++) { if (i<16) c0_2_check->cd(i+1); if (i>15) c0_2_2_check->cd(i-16+1); gPad->SetLogy(); varName.Form("SQX_L[%d]", i+firstThinStrip); condition.Form("SQX_L[%d]>0 && SQX_L[%d]<400", i+firstThinStrip, i+firstThinStrip); tr->SetLineColor(kBlack); tr->Draw(varName, condition, "", drawEntries); c0_2_check->Update(); c0_2_2_check->Update(); condition.Form("SQX_L[%d]>%d && SQX_L[%d]<400", i+firstThinStrip, thickChThresholds[i], i+firstThinStrip); cout << condition << endl; tr->SetLineColor(kRed); tr->Draw(varName, condition, "same", drawEntries); c0_2_check->Update(); c0_2_2_check->Update(); }//*/ // return; ///////////////////////////////////////////////////////////////////// // c0_3: thresholds search for SQY_L in channels: /*TCanvas *c0_3 = new TCanvas("c0_3", "amplitudes in ADC channel unit (0-15); Y-strips", 1600, 1200); c0_3->Divide(4,4); firstThinStrip = 0; //according to calibration data // Int_t thickYChThresholds[16] = { // 4000, 130, 80, 110, // 90, 120, 80, 110, // 80, 110, 80, 110, // 80, 110, 90, 115, // }; //according to experimental data Int_t thickYChThresholds[16] = { 4000, 130, 82, 110, 87, 112, 82, 108, 82, 112, 82, 108, 80, 110, 90, 105, }; cout << tr->GetEntries() << " events." << endl; cout << trCal->GetEntries() << " calibrated events." << endl; drawEntries = 10000000; cout << drawEntries << " entries in input chain will be processed." << endl; for (Int_t i = 0; i < 16; i++) { c0_3->cd(i+1); gPad->SetLogy(); varName.Form("SQY_L[%d]", i+firstThinStrip); condition.Form("SQY_L[%d]>0 && SQY_L[%d]<2000", i+firstThinStrip, i+firstThinStrip); tAlphaCal1000->SetLineColor(kBlack); tAlphaCal1000->Draw(varName, condition, "", drawEntries); c0_3->Update(); condition.Form("SQY_L[%d]>%d && SQY_L[%d]<2000", i+firstThinStrip, thickYChThresholds[i], i+firstThinStrip); cout << condition << endl; tAlphaCal1000->SetLineColor(kRed); tAlphaCal1000->Draw(varName, condition, "same", drawEntries); c0_3->Update(); }//*/ // return; ///////////////////////////////////////////////////////////////////// // c0_3_check: check of thresholds for SQY_L in channels // on real experimental data: /*TCanvas *c0_3_check = new TCanvas("c0_3_check", "amplitudes in ADC channel unit (0-15); Y-strips; exp", 1600, 1200); c0_3_check->Divide(4,4); firstThinStrip = 0; cout << tr->GetEntries() << " events." << endl; cout << trCal->GetEntries() << " calibrated events." << endl; drawEntries = 1000000; cout << drawEntries << " entries in input chain will be processed." << endl; for (Int_t i = 0; i < 16; i++) { c0_3_check->cd(i+1); gPad->SetLogy(); varName.Form("SQY_L[%d]", i+firstThinStrip); condition.Form("SQY_L[%d]>0 && SQY_L[%d]<200", i+firstThinStrip, i+firstThinStrip); tr->SetLineColor(kBlack); tr->Draw(varName, condition, "", drawEntries); c0_3_check->Update(); condition.Form("SQY_L[%d]>%d && SQY_L[%d]<200", i+firstThinStrip, thickYChThresholds[i], i+firstThinStrip); cout << condition << endl; tr->SetLineColor(kRed); tr->Draw(varName, condition, "same", drawEntries); c0_3_check->Update(); }//*/ ///////////////////////////////////////////////////////////////////// // c0_3_check: check of thresholds for SQY_L in channels // on real experimental data: TCanvas *c2_check = new TCanvas("c2_check", "amplitudes in ADC channel unit; CsI_left; exp", 1200, 1100); c2_check->Divide(4,4); firstThinStrip = 0; cout << tr->GetEntries() << " events." << endl; cout << trCal->GetEntries() << " calibrated events." << endl; drawEntries = 1000000; cout << drawEntries << " entries in input chain will be processed." << endl; for (Int_t i = 0; i < 16; i++) { c2_check->cd(i+1); // gPad->SetLogy(); varName.Form("CsI_L[%d]", i+firstThinStrip); condition.Form("CsI_L[%d]>0 && CsI_L[%d]<2000", i+firstThinStrip, i+firstThinStrip); tr->SetLineColor(kBlack); tr->Draw(varName, condition, "", drawEntries); c2_check->Update(); condition.Form("CsI_L[%d]>%d && CsI_L[%d]<2000", i+firstThinStrip, 180, i+firstThinStrip); cout << condition << endl; tr->SetLineColor(kRed); tr->Draw(varName, condition, "same", drawEntries); c2_check->Update(); }//*/ return; }