diff --git a/convertRawToAnalyzed/analyse.cpp b/convertRawToAnalyzed/analyse.cpp index 0d979c61918ddac1326f5e5434a9cb5780879a46..cd69f879871a79d2237d0ea40901fb01216378f3 100644 --- a/convertRawToAnalyzed/analyse.cpp +++ b/convertRawToAnalyzed/analyse.cpp @@ -14,9 +14,9 @@ int main(int argc, char* argv[]) { //to be extracted from the source as parameters - const Int_t noBranches = 4; + const Int_t noBranches = 2; const Double_t cfRatio = 0.3; - const Double_t cfTD = 1.5; //in ns + const Double_t cfTD = 0.6; //in ns Double_t noiseMin = 5; Double_t noiseMax = 25; Int_t nump = 5; //number of points for smoothing diff --git a/convertTektronix/read2.cpp b/convertTektronix/read2.cpp index 4587f76ecf8e18be793cfc42c2f48ff46eb8c982..a791e87b11436870ec4d3ed0b5b7866cf52da620 100644 --- a/convertTektronix/read2.cpp +++ b/convertTektronix/read2.cpp @@ -5,86 +5,93 @@ #include "TError.h" #include "TTree.h" -#include "../dataClasses/RawEvent.h" +//#include "../dataClasses/RawEvent.h" + void read2() { -// std::cout << argv[1] << "says hello, " << argv[2] << "!" << std::endl; -// std::cout << infiles << "says hello, " << ofile << "!" << std::endl; -// return 0; - + // find . -type f | wc -l для подсчёта файлов в папке +// cout << gSystem->Load("../libData.so") << endl; gSystem->Load("../libData.so"); - Double_t A1[1000],A2[1000]; - Double_t T1[1000],T2[1000]; - Int_t k,n,p,Nchannel,nHun,nDec; + + using std::cout; + using std::endl; + + Int_t k,n,p,Nchannel,nHun,nDec,counter; TString line1,line2,filename1,filename2; Double_t amp1,amp2,time1,time2; - const Int_t nfiles = 400; - const Int_t Nlines = 500; + const Int_t nfiles = 5000; + const Int_t NEvents = 1000; + //Double_t A1[1000],A2[1000]; + //Double_t T1[1000],T2[1000]; + p=0; + TFile *f1 = new TFile("../data/rawDataTektronix/GSItests/1000v_5mv.root","RECREATE"); + //TFile *f1 = new TFile("1000V_10mv.root","RECREATE"); + TTree *rtree = new TTree("rtree","signal"); - TFile *f1 = new TFile("source.root","RECREATE"); - TTree *tree = new TTree("rtree","signal"); - tree->Branch("A1",A1,"A1[1000]/D"); - tree->Branch("A2",A2,"A2[1000]/D"); +/* rtree->Branch("A1",A1,"A1[1000]/D"); + rtree->Branch("A2",A2,"A2[1000]/D"); - tree->Branch("T1",T1,"T1[1000]/D"); - tree->Branch("T2",T2,"T2[1000]/D"); + rtree->Branch("T1",T1,"T1[1000]/D"); + rtree->Branch("T2",T2,"T2[1000]/D");*/ - ifstream myfile1,myfile2; - Int_t i=0; - //for(Int_t i=0;iBronch("ch0.", "RawEvent", &event1); + RawEvent *event2 = new RawEvent(1000); + rtree->Bronch("ch1.", "RawEvent", &event2); + RawEvent *event3 = new RawEvent(1000); + rtree->Bronch("ch2.", "RawEvent", &event3); + RawEvent *event4 = new RawEvent(1000); + rtree->Bronch("ch3.", "RawEvent", &event4); + counter = 0; + ifstream myfile1,myfile2; // i=0; + for(Int_t i=0; iFill(); + event1->SetAmp(amp1, j); + event2->SetAmp(amp2, j); + event1->SetTime(time1, j); + event2->SetTime(time2, j); + } + rtree->Fill(); + counter++; + //cout<Reset(); + event2->Reset(); + } + myfile1.close(); + myfile2.close(); + } + else{ + Error("read2.cpp", "Some error when opening file %s", filename2.Data()); + return; + } } - myfile1.close(); - myfile2.close(); - } - - tree->Write(); + else{ + Error("read2.cpp", "Some error when opening file %s", filename1.Data()); + return; + }//*/ + } //for + cout << p << " files processed" << endl; + rtree->Write(); f1->Close(); } diff --git a/data/rawDataTektronix/SORCE/trigger_10mv/try.txt~ b/data/rawDataTektronix/SORCE/trigger_10mv/try.txt~ index cb8764f8da9fff66eb09c944602503b830b6256c..785c6ce9d299d5ba45afebc4b1c47771d7d3c149 100644 --- a/data/rawDataTektronix/SORCE/trigger_10mv/try.txt~ +++ b/data/rawDataTektronix/SORCE/trigger_10mv/try.txt~ @@ -1 +1,6 @@ +1 +2 +3 +4 +5 123.123,1.2 diff --git a/dataClasses/AEvent.cpp b/dataClasses/AEvent.cpp index 07d29de21c28959806f6b1567ced2f10b1d684dd..6564087afa27dce34f750f35dc6be720ad700fa2 100644 --- a/dataClasses/AEvent.cpp +++ b/dataClasses/AEvent.cpp @@ -6,7 +6,6 @@ */ #include "AEvent.h" - AEvent::AEvent() : fNPoints(1024) { //fNPoints is number of points in one event, 1024 or 1000 Init(); @@ -66,7 +65,7 @@ void AEvent::ProcessEvent(Bool_t bSmooth) { SetChargeLED(); SetChargeTF(); SetToT(); - + SetThreshold(); // SmoothGraphs(); return; @@ -96,6 +95,8 @@ void AEvent::Reset() { fChargeCFD = -10.; fChargeLED = -10.; fTimeFront = -100.; + fTimeThreshBack = -100.; + fTimeThresh = -100.; } void AEvent::SetInputEvent(RawEvent** event) { @@ -185,7 +186,7 @@ void AEvent::SetCFD() { Int_t i = 0; //for graph //while goes by the graph with the step of timeStep - while( mytime < (200. - fCFtimeDelay) ) { + while( mytime < (fTimeLast - fCFtimeDelay) ) { ampCFD = fGraphSignal->Eval(mytime)*fCFratio*(-1) + fGraphSignal->Eval(mytime - fCFtimeDelay); fGraphCFD->SetPoint(i, mytime, ampCFD); @@ -223,7 +224,7 @@ void AEvent::FindFrontProperties() { const Double_t timeStep = 0.05; //in ns Double_t time = 0; //in ns - Double_t mytime = 0.; + Double_t mytime = fTimeAmpMax; if (!fGraphSignal) { Warning("AEvent::FindFrontProperties", "Graph was not set"); @@ -261,14 +262,12 @@ void AEvent::FindFrontProperties() { b = fit1->GetParameter(0); line->SetParameter(0,b); line->SetParameter(1,a); - //cout<<"par 0 "<Eval(mytime) <= 0 && mytime <= 200.) { + while(line->Eval(mytime) >=0 && mytime <= fTimeLast && mytime>=0) { //cout<< "mytime "< (fTimeCFD + tmin) && fTime[i] < (fTimeCFD + tmax) ) { @@ -326,7 +325,7 @@ void AEvent::SetChargeLED(Int_t tmin, Int_t tmax) { // tmin = -3, tmax = 17 Double_t integral = 0.; //voltage Double_t time_sig = 0; //approximate signal duration in seconds const Double_t res = 50.; //resistance 50 Om - time_sig = (double)(-tmin + tmax)*(1e-9); + time_sig = (double)(-tmin + tmax); /* for(Int_t i = 0; i < fNPoints; i++) { if( fTime[i] > (fTimeLED + tmin) && fTime[i] < (fTimeLED + tmax) ) { @@ -335,12 +334,12 @@ void AEvent::SetChargeLED(Int_t tmin, Int_t tmax) { // tmin = -3, tmax = 17 }*/ Int_t imin = 0, imax = 0; - - Int_t i = 0; + + Int_t i = 0; while ( fTime[i] < (fTimeLED + tmin) && (i < (fGraphSignal->GetN()-1)) ) { imin = i; i++; } -// i = 0; - while ( fTime[i] < (fTimeLED + tmax) && (i < (fGraphSignal->GetN()-1)) ) { imax = i; i++; } - +// i = 0; + while ( fTime[i] < (fTimeLED + tmax) && (i < (fGraphSignal->GetN()-1)) ) { imax = i; i++; } + integral = fGraphSignal->Integral(imin, imax); fChargeLED = integral*time_sig/res; @@ -354,7 +353,7 @@ void AEvent::SetChargeTF(Int_t tmin, Int_t tmax) { // tmin = -3, tmax = 17 Double_t integral = 0.; //voltage Double_t time_sig = 0; //approximate signal duration in seconds const Double_t res = 50.; //resistance 50 Om - time_sig = (double)(-tmin + tmax)*(1e-9); + time_sig = (double)(-tmin + tmax); Int_t imin = 0, imax = 0; @@ -379,6 +378,10 @@ Double_t AEvent::GetfLED() { return fTimeLED; } +Double_t AEvent::GetfThresh() { + return fTimeThresh; +} + Double_t AEvent::GetOnefTime(Int_t i) { return fTime[i]; } @@ -403,6 +406,14 @@ Double_t AEvent::GetEdgeXi() { return fEdgeXi; } +Double_t AEvent::GetfChargeCFD() { + return fChargeCFD; +} + +Double_t AEvent::GetfChargeTF() { + return fChargeTF; +} + void AEvent::SetMaxAmplitudes() { Double_t maxAmp = 0.; Double_t maxAmpT = 0.; @@ -416,7 +427,7 @@ void AEvent::SetMaxAmplitudes() { } fAmpMax = maxAmp; fTimeAmpMax = maxAmpT; - + fTimeLast = fTime[fNPoints-1]; } void AEvent::SetLED(Double_t threshold) { @@ -432,16 +443,36 @@ void AEvent::SetLED(Double_t threshold) { } +void AEvent::SetThreshold(Double_t thresholdBack, Double_t threshRise) { + + Double_t time = fTimeAmpMax; + const Double_t timeStep = 0.05; + while( time < fTimeLast && fGraphSignal->Eval(time) >= thresholdBack ) { + fTimeThreshBack = time; + time = time + timeStep; + } + + time = fTimeAmpMax; + + while( time >0 && fGraphSignal->Eval(time) >= threshRise) { + fTimeThresh = time; + time = time - timeStep; + } + //fTimeLED = time; найти номера точек которые лежат на 3 нс раньше и на 20 нс позже чем точка с временем timeled (искать точки в пределах условных) + // сделать через функцию getpoint и цикл по точкам от + +} + void AEvent::SetToT() { - Double_t time = fTimeMid; - Double_t timeBack = 0; - const Double_t ns = 15.; //withing this interval signal should end for sure, in nanosec + Double_t time = fTimeAmpMax; + Double_t timeBack; + const Double_t ns = 10.; //withing this interval signal should end for sure, in nanosec const Double_t timeStep = 0.05; //cout<<"fAmpMid "<Eval(time) >= fAmpMid && time < fTimeMid + ns) { + while( fGraphSignal->Eval(time) >= fAmpMid && time < fTimeLast) { //cout<<"timeback "<Eval(time) "<Eval(time)<>>>>>> 5eb9075c10d86d66bba9b5c694fbdb722d11105d Double_t fChargeLED; //charge of the signal in Coulomb Double_t fChargeTF; // diff --git a/macros/histCorr.C b/macros/histCorr.C index 8f7e008c8c79c0a1139311a2cba276e980302ecd..db4c90013ad3827c784debe0c322dc9b6438f392 100644 --- a/macros/histCorr.C +++ b/macros/histCorr.C @@ -6,167 +6,136 @@ void histCorr( - -// const char *filename = "Neurad_7_08_NEW.root", - const char *filename1 = "analysis_08_2.root", - const char *filename = "analysis_07_8.root", - const char *foldername = "report", -// const char *foldername = "8_2", -// const char *ext = ".eps", - const char *ext = ".gif", - - const Bool_t can1 = 1, const Bool_t can2 = 0, // delta tLed and delta tcfd // dvumerki - const Bool_t can3 = 0, const Bool_t can4 = 0, + const Bool_t can1 = 0, const Bool_t can2 = 0, + const Bool_t can3 = 1, const Bool_t can4 = 0, const Bool_t can5 = 0, const Bool_t can6 = 0) // tLEd and CFD for colollinated and NONcollimated data { - Double_t rMin[4]; - Double_t rMax[4]; - + //TString foldername = "30_06 + Double_t rMin; + Double_t rMax; + TF1 *g1 = new TF1("g1","gaus",0,100); using std::cout; using std::endl; gSystem->Load("../libData.so"); - TFile *f = new TFile(Form("../data/dataDSR4/%s", filename)); -// TFile *f = new TFile("../data/dataDSR4/analysis_08_2.root"); - TTree *t = (TTree*)f->Get("atree"); - - TFile *f1 = new TFile(Form("../data/dataDSR4/%s", filename1)); // TFile *f = new TFile("../data/dataDSR4/analysis_08_2.root"); - TTree *t1 = (TTree*)f1->Get("atree"); + TFile *f = new TFile("../data/dataTektronix/GSItests/1000V_trigg5mv/analize.root"); - gStyle->SetCanvasDefH(900); - gStyle->SetCanvasDefW(1500); -// gStyle->SetCanvas + //TFile *f = new TFile("../data/dataTektronix/GSItests/1000V_trigg5mv/analize.root"); + TTree *t = (TTree*)f->Get("atree"); - if (can1) { // t1 - коллимированные данные!!! + gStyle->SetOptFit(); + if (can1) { TCanvas *c1 = new TCanvas("c5", "Changing CFD parameters"); c1->Divide(2,2); c1->cd(1); - TF1 *g1 = new TF1("g1","gaus",0,20); g1->SetParLimits(0,1e+2,1e+4); g1->SetParLimits(1,-100,100); g1->SetParLimits(2,0.1,10); - - rMin[0]= -4.8; rMax[0] = 0.8; - rMin[1]= -7.6; rMax[1] = -0.8; - rMin[2]= 9.2; rMax[2] = 12.8; - rMin[3]= 6.8; rMax[3] = 12.4; - - TH1F *h1 = new TH1F("h1", "delta tau_CFD for NONcollimated data",1000 , -200., 200); - - t->Draw("Ach0.fTimeCFD - Ach3.fTimeCFD >> h1","(Ach0.fTimeCFD - Ach3.fTimeCFD)>-20 && (Ach0.fTimeCFD - Ach3.fTimeCFD)<10",""); - h1->GetXaxis()->SetRangeUser(-20, 10); - h1->GetXaxis()->SetTitle("delta tauCFD [ns]"); + TH1F *h1 = new TH1F("h1", "tau_CFD",100, 3., 20.); +// t->Draw("Ach0.fTimeCFD - Ach1.fTimeCFD >> h1","(Ach0.fTimeCFD - Ach1.fTimeCFD) < 20 && (Ach0.fTimeCFD - Ach1.fTimeCFD) > -20 && (Ach0.fTimeThreshBack - Ach0.fTimeThresh)>0 && (Ach0.fTimeThreshBack - Ach0.fTimeThresh)>3",""); + t->Draw("Ach0.fTimeCFD - Ach1.fTimeCFD >> h1","(Ach0.fTimeCFD - Ach1.fTimeCFD) < 20 && (Ach0.fTimeCFD - Ach1.fTimeCFD) > 3",""); + h1->GetXaxis()->SetRangeUser(3, 20); + h1->GetXaxis()->SetTitle("tauCFD [ns]"); h1->GetXaxis()->CenterTitle(); - g1->SetRange(rMin[0],rMax[0]); - h1->Fit("g1","R"); - cout<<"sigma= "<GetParameter(2)<SetRange(2.8,6.5); + //h1->Fit("g1","R"); + //cout<<"sigma= "<GetParameter(2)<cd(2); - TH1F *h2 = new TH1F("h2", "delta tau_LED for NONcollimated data",1000, -200., 200); + TH1F *h2 = new TH1F("h2", "tau_LED",100, 3., 20.); + h2->GetXaxis()->SetRangeUser(3, 20); + t->Draw("Ach0.fTimeLED - Ach1.fTimeLED >> h2","(Ach0.fTimeLED - Ach1.fTimeLED) < 20 && (Ach0.fTimeLED - Ach1.fTimeLED) > 3",""); - t->Draw("Ach0.fTimeLED - Ach3.fTimeLED >> h2","(Ach0.fTimeLED - Ach3.fTimeLED)>-20 && (Ach0.fTimeLED - Ach3.fTimeLED)<10",""); - //t->Draw("Ach0.fTimeLED - Ach3.fTimeLED >> h2","",""); - h2->GetXaxis()->SetRangeUser(-20, 10); - h2->GetXaxis()->SetTitle("delta tauLED [ns]"); + h2->GetXaxis()->SetTitle("tauLED [ns]"); h2->GetXaxis()->CenterTitle(); - g1->SetRange(rMin[1],rMax[1]); - h2->Fit("g1","R"); - cout<<"sigma= "<GetParameter(2)<cd(3); - - TH1F *h3 = new TH1F("h3", "delta tau_CFD for collimated data",1000 , -200, 200); - - t1->Draw("Ach0.fTimeCFD - Ach1.fTimeCFD >> h3","(Ach0.fTimeCFD - Ach1.fTimeCFD)>0 && (Ach0.fTimeCFD - Ach1.fTimeCFD)<20",""); - //t1->Draw("Ach0.fTimeCFD - Ach1.fTimeCFD >> h3","",""); - h3->GetXaxis()->SetRangeUser(0, 20); - h3->GetXaxis()->SetTitle("delta tauCFD [ns]"); - h3->GetXaxis()->CenterTitle(); - g1->SetRange(rMin[2],rMax[2]); - h3->Fit("g1","R"); - cout<<"sigma= "<GetParameter(2)<cd(4); - TH1F *h4 = new TH1F("h4", "delta tau_LED for collimated data",1000 , -200., 200); - - t1->Draw("Ach0.fTimeLED - Ach1.fTimeLED >> h4","(Ach0.fTimeLED - Ach1.fTimeLED)>0 && (Ach0.fTimeLED - Ach1.fTimeLED)<20",""); - //t1->Draw("Ach0.fTimeLED - Ach1.fTimeLED >> h4","",""); - h4->GetXaxis()->SetRangeUser(0,20); - h4->GetXaxis()->SetTitle("delta tauLED [ns]"); - h4->GetXaxis()->CenterTitle(); - g1->SetRange(rMin[3],rMax[3]); - h4->Fit("g1","R"); - cout<<"sigma= "<GetParameter(2)<Update(); - c1->Print(Form("../macros/picsDRS4/%s/deltaT%s", foldername, ext)); + g1->SetRange(3.6,7); + // h2->Fit("g1","R"); + //cout<<"sigma= "<GetParameter(2)<Print("../data/dataTektronix/GSItests/1000V_trigg10mv/30_06_10mv_35mv/pic/tauLEDCFD.gif"); } - if (can2) { - TCanvas *c2 = new TCanvas("c2", "Correlation pictures: Integrals and amplitudes"); + if (can2) { /// ToT pics + gStyle->SetOptFit(); + TCanvas *c2 = new TCanvas("c2", "Threshold properties"); c2->Divide(2,2); - TH2F *h5 = new TH2F("h5", "maxapl of the first channel vs maxamp of the second channel", 300, 0 ,0.1, 300, 0, 0.2); + TH1F *h5 = new TH1F("h5", "time of 25mv back threshold trigger", 300, 0 ,100); c2->cd(1); - t1->Draw("Ach0.fAmpMax : Ach1.fAmpMax >> h5","","col"); - //x - h5->GetXaxis()->SetTitle("Max_ampl_{1} [V]"); + //t->Draw("Ach0.fTimeThreshBack >> h5","Ach0.fTimeThreshBack>40 && Ach0.fTimeThreshBack<60 ",""); + t->Draw("Ach0.fTimeThreshBack"); + //h5->GetXaxis()->SetRangeUser(40, 60); + h5->GetXaxis()->SetTitle("time thresh back [ns]"); h5->GetXaxis()->CenterTitle(); - //y - h5->GetYaxis()->SetTitle("Max_ampl_{0} [V]"); - h5->GetYaxis()->CenterTitle(); - c2->Update(); + rMin = 50.67; + rMax = 53.33; + //g1->SetRange(rMin,rMax); + //h5->Fit("g1","R"); - TH2F *h6 = new TH2F("h6", "tau(fTimeLed0-fTimeLed1) vs amplitude of the trigered channel", 200, 0 ,0.5, 200, 5, 15); + TH1F *h6 = new TH1F("h6", "Time over my Threshold trigg", 100, 0 ,10); c2->cd(2); - t1->Draw("Ach0.fTimeLED - Ach1.fTimeLED : Ach0.fAmpMax >> h6","","col"); - //x - h6->GetXaxis()->SetTitle("Max_ampl_{0} [V]"); + //t->Draw("Ach0.fTimeThreshBack - Ach0.fTimeThresh >> h6 ","(Ach0.fTimeThreshBack - Ach0.fTimeThresh)>0 && (Ach0.fTimeThreshBack - Ach0.fTimeThresh)<10",""); + //h6->GetXaxis()->SetRangeUser(0, 10); + h6->GetXaxis()->SetTitle("time over my threshold [ns]"); h6->GetXaxis()->CenterTitle(); - //y - h6->GetYaxis()->SetTitle("tau_LED [V]"); - h6->GetYaxis()->CenterTitle(); - c2->Update(); - - TH2F *h7 = new TH2F("h7", "tau(fTimeLed0-fTimeLed1) vs summ of amplitudes", 200, 0 ,0.5, 200, 5, 15); + rMin = 50.67; + rMax = 53.33; + //g1->SetRange(rMin,rMax); + //h6->Fit("g1","R"); +/* + TH1F *h7 = new TH1F("h7", "time of 25mv back threshold nontrigg", 300, 0 ,100); c2->cd(3); - t1->Draw("Ach0.fTimeLED - Ach1.fTimeLED : Ach0.fAmpMax + Ach1.fAmpMax >> h7","","col"); - //x - h7->GetXaxis()->SetTitle("summ_Amps [V]"); + t->Draw("Ach1.fTimeThreshBack >> h7","Ach1.fTimeThreshBack>40 && Ach1.fTimeThreshBack<60",""); + //t->Draw("Ach1.fTimeThreshBack "); + //h7->GetXaxis()->SetRangeUser(40, 60); + h7->GetXaxis()->SetTitle("time thresh back [ns]"); h7->GetXaxis()->CenterTitle(); - //y - h7->GetYaxis()->SetTitle("tau_LED [V]"); - h7->GetYaxis()->CenterTitle(); - c2->Update(); + rMin = 45.67; + rMax = 49.67; + //g1->SetRange(rMin,rMax); + //h7->Fit("g1","R"); - TH2F *h8 = new TH2F("h8", "tau(fTimeCFD0-fTimeCFD1) vs summ of amplitudes", 200, 0 ,0.5, 200, -150, 150); + TH1F *h8 = new TH1F("h8", "Time over my Threshold nontrigg", 100, 0 ,10); c2->cd(4); - t1->Draw("Ach0.fTimeCFD - Ach1.fTimeCFD : Ach0.fAmpMax + Ach1.fAmpMax >> h8","","col"); - //x - h8->GetXaxis()->SetTitle("summ_Amps [V]"); + t->Draw("Ach1.fTimeThreshBack - Ach1.fTimeThresh >> h8 ","(Ach1.fTimeThreshBack - Ach1.fTimeThresh)>0 && (Ach1.fTimeThreshBack - Ach1.fTimeThresh)<10",""); + //h8->GetXaxis()->SetRangeUser(0, 10); + h8->GetXaxis()->SetTitle("time over my threshold [ns]"); h8->GetXaxis()->CenterTitle(); - //y - h8->GetYaxis()->SetTitle("tau_CFD [V]"); - h8->GetYaxis()->CenterTitle(); - c2->Update(); + rMin = 50.67; + rMax = 53.33; + //g1->SetRange(rMin,rMax); + //h6->Fit("g1","R"); - - //c2->Print(Form("../macros/picsDRS4/%s/tauVSAmpl%s", foldername, ext)); + /*TH1F *h7 = new TH1F("h7", "Time over 50% Threshold", 100, 0 ,10); + c2->cd(3); + t->Draw("Ach0.fToT >> h7","Ach0.fToT>0 && Ach0.fToT<10",""); + h7->GetXaxis()->SetRangeUser(0, 10); + h7->GetXaxis()->SetTitle("time over 50% threshold [ns]"); + h7->GetXaxis()->CenterTitle(); + c2->Update(); + rMin = 50.67; + rMax = 53.33; + g1->SetRange(rMin,rMax); + //h7->Fit("g1","R");*/ + //c2->Print("../data/dataTektronix/GSItests/1000V_trigg10mv/30_06_10mv_35mv/pic/ToTtimes.gif");*/ } if (can3) { TCanvas *c3 = new TCanvas("c3", "Correlation pictures: Integrals and amplitudes"); - c3->Divide(2,2); + //c3->Divide(2,2); + t->Draw("Ach0.fChargeTF - Ach1.fChargeTF"); - TH2F *h9 = new TH2F("h9", "tau_led vs chargeLed KOLLIMATED", 200, 0 ,5e-10, 200, 5, 15); + /*TH2F *h9 = new TH2F("h9", "tau_led vs chargeLed KOLLIMATED", 200, 0 ,5e-10, 200, 5, 15); c3->cd(1); t1->Draw("Ach0.fTimeLED - Ach1.fTimeLED : Ach0.fChargeLED >> h9","","col"); //x @@ -211,23 +180,50 @@ void histCorr( c3->Update(); - c3->Print(Form("../macros/picsDRS4/%s/tauVSCHARGE%s", foldername, ext)); + //c3->Print(Form("../macros/picsDRS4/%s/tauVSCHARGE%s", foldername, ext));*/ } if (can4) { - TCanvas *c4 = new TCanvas("c4", "Correlation pictures: XiSquares"); - TH2F *h11 = new TH2F("h11", "Time difference between two channels vs XiSquare of edge",100, -0., 5., 100, 0., 0.005); - t->Draw("Ach0.fEdgeXi : (Ach0.fTime90 - Ach0.fTime10) >> h11","","col"); - //t->Draw("Ach1.fEdgeXi : (Ach1.fTime90 - Ach1.fTime10) >> h11","(Ach1.fTime90 - Ach1.fTime10)>0","col"); - //x - h11->GetXaxis()->SetTitle("\\Delta \\tau_{1}^{(rise)} [ns]"); - h11->GetXaxis()->CenterTitle(); - //y - h11->GetYaxis()->SetTitle("fEdgeXi"); - h11->GetYaxis()->CenterTitle(); - c4->Update(); - //c4->Print(Form("../macros/picsDRS4/file%s/XiSquares%s", foldername, ext)); + gStyle->SetOptFit(); + + TCanvas *c4 = new TCanvas("c4", "time rising edge and full charge"); + c4->Divide(2,2); + c4->cd(1); + TH1F *h13 = new TH1F("h13", "Time front line crossing zero line trigg",300, 38., 52. ); + t->Draw("Ach0.fTimeFront >> h13","Ach0.fTimeFront > 38 && Ach0.fTimeFront < 52",""); + h13->GetXaxis()->SetRangeUser(38, 52); + h13->GetXaxis()->SetTitle("TimeFront [ns]"); + h13->GetXaxis()->CenterTitle(); + g1->SetRange(49.35,49.9); + h13->Fit("g1","R"); + + c4->cd(2); + TH1F *h141 = new TH1F("h141", "Time front line crossing zero line nontrigg",300, 38., 52. ); + t->Draw("Ach1.fTimeFront >> h141","Ach1.fTimeFront > 38 && Ach1.fTimeFront < 52 ",""); + h141->GetXaxis()->SetRangeUser(38, 52); + h141->GetXaxis()->SetTitle("TimeFront [ns]"); + h141->GetXaxis()->CenterTitle(); + g1->SetRange(49.35,49.9); + //h14->Fit("g1","R"); + + c4->cd(3); + TH1F *h16 = new TH1F("h14", "tau Front Time",300, -10, 10. ); + t->Draw("Ach0.fTimeFront - Ach1.fTimeFront"); + h16->GetXaxis()->SetRangeUser(38, 52); + h16->GetXaxis()->SetTitle("tau Front time [ns]"); + h16->GetXaxis()->CenterTitle(); + g1->SetRange(49.35,49.9); + //h14->Fit("g1","R"); + + c4->cd(4); + TH1F *h15 = new TH1F("h15", "summCharge",300, 0., 0.4. ); + t->Draw("Ach0.fChargeLED + Ach1.fChargeLED>>h15","Ach0.fChargeLED + Ach1.fChargeLED<0.4",""); + h15->GetXaxis()->SetRangeUser(0, 0.4); + h15->GetXaxis()->SetTitle("FullCharge"); + h15->GetXaxis()->CenterTitle(); + //h14->Fit("g1","R"); + c4->Print("../data/dataTektronix/GSItests/1000V_trigg10mv/30_06_10mv_35mv/pic/front&Charge.gif"); } @@ -248,51 +244,51 @@ void histCorr( g5->SetParLimits(1,10,1000); g5->SetParLimits(2,0.1,10); - TH1F *h12 = new TH1F("h12", "tau_CFD triggered channel for NONcollimated data",1000, 0., 200); - - t->Draw("Ach0.fTimeCFD >> h12","Ach0.fTimeCFD>132 && Ach0.fTimeCFD<150",""); - h12->GetXaxis()->SetRangeUser(132, 150); + TH1F *h12 = new TH1F("h12", "tau_CFD triggered channel for NONcollimated data",1000, 0., 50); + + t->Draw("Ach0.fTimeCFD >> h12","",""); + //h12->GetXaxis()->SetRangeUser(132, 150); h12->GetXaxis()->SetTitle("tauCFD_{0} [ns]"); - h12->GetXaxis()->CenterTitle(); + h12->GetXaxis()->CenterTitle(); g5->SetRange(rMin[0],rMax[0]); - h12->Fit("g5","R"); + //h12->Fit("g5","R"); cout<<"sigma= "<GetParameter(2)<cd(2); - TH1F *h13 = new TH1F("h13", "tau LED triggered channel for NONcollimated data",1000, 0., 200); + TH1F *h13 = new TH1F("h13", "tau LED triggered channel for NONcollimated data",1000, 0., 50); - t->Draw("Ach0.fTimeLED >> h13","Ach0.fTimeLED>132 && Ach0.fTimeLED<150",""); - h13->GetXaxis()->SetRangeUser(132, 150); + t->Draw("Ach0.fTimeLED >> h13","",""); + //h13->GetXaxis()->SetRangeUser(132, 150); h13->GetXaxis()->SetTitle("tauLED_{0} [ns]"); h13->GetXaxis()->CenterTitle(); g5->SetRange(rMin[1],rMax[1]); - h13->Fit("g5","R"); + //h13->Fit("g5","R"); cout<<"sigma= "<GetParameter(2)<cd(3); - TH1F *h14 = new TH1F("h14", "tau_CFD nontriggered channel for NONcollimated data",1000 , 0., 200); + TH1F *h14 = new TH1F("h14", "tau_CFD nontriggered channel for NONcollimated data",1000 , 0., 50); - t->Draw("Ach1.fTimeCFD >> h14","Ach1.fTimeCFD > 132 && Ach1.fTimeCFD<150",""); - h14->GetXaxis()->SetRangeUser(132, 150); + t->Draw("Ach1.fTimeCFD >> h14","",""); + //h14->GetXaxis()->SetRangeUser(132, 150); h14->GetXaxis()->SetTitle("tauCFD_{0} [ns]"); h14->GetXaxis()->CenterTitle(); g5->SetRange(rMin[2],rMax[2]); - h14->Fit("g5","R"); + //h14->Fit("g5","R"); cout<<"sigma= "<GetParameter(2)<cd(4); - TH1F *h15 = new TH1F("h15", "tau LED nontriggered channel for NONcollimated data",1000 , 0., 200); + TH1F *h15 = new TH1F("h15", "tau LED nontriggered channel for NONcollimated data",1000 , 0., 50); - t->Draw("Ach1.fTimeLED >> h15","Ach1.fTimeLED>132 && Ach1.fTimeLED<150",""); - h15->GetXaxis()->SetRangeUser(132, 150); + t->Draw("Ach1.fTimeLED >> h15","",""); + //h15->GetXaxis()->SetRangeUser(132, 150); h15->GetXaxis()->SetTitle("tauLED_{0} [ns]"); h15->GetXaxis()->CenterTitle(); g5->SetRange(rMin[3],rMax[3]); - h15->Fit("g5","R"); + //h15->Fit("g5","R"); cout<<"sigma= "<GetParameter(2)<Update(); - c5->Print(Form("../macros/picsDRS4/%s/NONcollimatedT%s", foldername, ext)); + //c5->Print(Form("../macros/picsDRS4/%s/NONcollimatedT%s", foldername, ext)); } if (can6) { diff --git a/macros/histCorrNew01.C b/macros/histCorrNew01.C index 9858788c2957ac1e7dd2074dd992559f5474840e..da401bca2a4855282ce51f45e50ce6d41935068c 100644 --- a/macros/histCorrNew01.C +++ b/macros/histCorrNew01.C @@ -5,16 +5,16 @@ void histCorrNew01 ( //01 means it is used for channels 0 and 1 -// const char *filename = "analysis_07_8.root", //considered non-collimated + const char *filename = "analysis_07_8.root", //considered non-collimated // const char *filename = "analysis_07_2.root", //collimated? // const char *filename = "analysis_07_4.root", - const char *filename = "analysis_08_2.root", +// const char *filename = "analysis_08_2.root", const char *foldername = "7_8/chpair01", // const char *ext = ".eps", const char *ext = ".gif", - const Bool_t can1 = 0, const Bool_t can2 = 0, - const Bool_t can3 = 0, const Bool_t can4 = 1) + const Bool_t can1 = 1, const Bool_t can2 = 0, + const Bool_t can3 = 0, const Bool_t can4 = 0) //const Bool_t can5 = 0, const Bool_t can6 = 0) { using std::cout; @@ -29,11 +29,12 @@ void histCorrNew01 ( if(can1){ TCanvas *c1 = new TCanvas("c1", "Correlation pictures for non-collimated data: delta t and integrals"); - c1->Divide(2,2); +// c1->Divide(2,2); - c1->cd(1); - TH2F *h1 = new TH2F("h1", "front time tau vs charge TF 0 ", 200, 0 ,0.5e-9, 100, 5, 15 ); - t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach0.fChargeTF >> h1","","col"); +/* c1->cd(1); + TH2F *h1 = new TH2F("h1", "front time tau vs charge TF 0 ", 200, 0 ,1.0e-9, 200, -40, 40 ); + // t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach0.fChargeTF >> h1","","col"); + t->Draw(" Ach0.fTimeLED - Ach1.fTimeLED : Ach0.fChargeLED >> h1","","col"); //x h1->GetXaxis()->SetTitle("Charge [C]"); h1->GetXaxis()->CenterTitle(); @@ -44,8 +45,9 @@ void histCorrNew01 ( c1->Update(); c1->cd(2); - TH2F *h2 = new TH2F("h2", "front time tau vs charge TF 1 ", 200, 0, 0.5e-9, 200, 5 ,15); - t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach1.fChargeTF >> h2","","col"); + TH2F *h2 = new TH2F("h2", "front time tau vs charge TF 1 ", 200, 0, 0.5e-9, 200, -20 ,30); + // t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach1.fChargeTF >> h2","","col"); + t->Draw(" Ach0.fTimeLED - Ach1.fTimeLED : Ach1.fChargeLED >> h2","","col"); //x h2->GetXaxis()->SetTitle("Charge [C]"); h2->GetXaxis()->CenterTitle(); @@ -56,8 +58,9 @@ void histCorrNew01 ( c1->Update(); c1->cd(3); - TH2F *h3 = new TH2F("h3", "charge TF 1 vs charge TF 0", 200, 0 ,0.5e-9, 200, 0, 0.5e-9); - t->Draw(" Ach0.fChargeTF : Ach1.fChargeTF >> h3","","col"); + TH2F *h3 = new TH2F("h3", "charge TF 1 vs charge TF 0", 400, 0.02 ,0.7e-9, 400, 0.06, 0.5e-9); + // t->Draw(" Ach0.fChargeTF : Ach1.fChargeTF >> h3","","col"); + t->Draw(" Ach0.fChargeLED : Ach1.fChargeLED >> h3","","col"); //x h3->GetXaxis()->SetTitle("Charge_0 [C]"); h3->GetXaxis()->CenterTitle(); @@ -66,7 +69,62 @@ void histCorrNew01 ( h3->GetYaxis()->CenterTitle(); c1->Update(); +*/ +//pictures for latex report, LED + c1->Divide(2,1); + c1->cd(1); + TH2F *h2 = new TH2F("h2", "time difference (LED method) vs charge of non-trigger channel ", 100, -12 ,5, 100, 0, 0.17e-9); + // t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach1.fChargeTF >> h2","","col"); + t->Draw(" Ach1.fChargeLED : Ach0.fTimeLED - Ach1.fTimeLED >> h2","","col"); + //x + h2->GetXaxis()->SetTitle("time [ns]"); + h2->GetXaxis()->CenterTitle(); + //y + h2->GetYaxis()->SetTitle("Q [C]"); + h2->GetYaxis()->CenterTitle(); + + c1->Update(); + + c1->cd(2); + TH2F *h3 = new TH2F("h3", "charge of trigger channel vs charge of non-trigger channel", 400, 0.02 ,0.7e-9, 400, 0.06, 0.5e-9); + // t->Draw(" Ach0.fChargeTF : Ach1.fChargeTF >> h3","","col"); + t->Draw(" Ach0.fChargeLED : Ach1.fChargeLED >> h3","","col"); + //x + h3->GetXaxis()->SetTitle("Q_{0} [C]"); + h3->GetXaxis()->CenterTitle(); + //y + h3->GetYaxis()->SetTitle("Q_{1} [C]"); + h3->GetYaxis()->CenterTitle(); + + c1->Update(); + +//pictures for latex report, CFD +/* c1->Divide(2,1); + c1->cd(1); + TH2F *h2 = new TH2F("h2", "time difference (CFD method) vs charge of non-trigger channel ", 100, -12 ,5, 100, 0, 0.17e-9); + // t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach1.fChargeTF >> h2","","col"); + t->Draw(" Ach1.fChargeCFD : Ach0.fTimeCFD - Ach1.fTimeCFD >> h2","","col"); + //x + h2->GetXaxis()->SetTitle("time [ns]"); + h2->GetXaxis()->CenterTitle(); + //y + h2->GetYaxis()->SetTitle("Q [C]"); + h2->GetYaxis()->CenterTitle(); + + c1->Update(); + c1->cd(2); + TH2F *h3 = new TH2F("h3", "charge of trigger channel vs charge of non-trigger channel", 400, 0.02 ,0.7e-9, 400, 0.06, 0.5e-9); + // t->Draw(" Ach0.fChargeTF : Ach1.fChargeTF >> h3","","col"); + t->Draw(" Ach0.fChargeCFD : Ach1.fChargeCFD >> h3","","col"); + //x + h3->GetXaxis()->SetTitle("Q_{0} [C]"); + h3->GetXaxis()->CenterTitle(); + //y + h3->GetYaxis()->SetTitle("Q_{1} [C]"); + h3->GetYaxis()->CenterTitle(); +*/ + c1->Update(); // c1->Print(Form("../macros/picsDRS4/file%s/time_front_corr1%s", foldername, ext)); } diff --git a/macros/histCorrNew02.C b/macros/histCorrNew02.C index 98d51b1b2ff7802394662e1bb22de814c4c1e314..611fd0457aef766f1b11f7e9c67b1675a990c5a7 100644 --- a/macros/histCorrNew02.C +++ b/macros/histCorrNew02.C @@ -10,9 +10,9 @@ void histCorrNew02 ( // const char *ext = ".eps", const char *ext = ".gif", - const Bool_t can1 = 0, const Bool_t can2 = 0, + const Bool_t can1 = 1, const Bool_t can2 = 0, const Bool_t can3 = 0, const Bool_t can4 = 0, - const Bool_t can5 = 0 , const Bool_t can6 = 1) + const Bool_t can5 = 0, const Bool_t can6 = 0) { using std::cout; using std::endl; @@ -29,7 +29,7 @@ void histCorrNew02 ( c1->Divide(2,2); c1->cd(1); - TH2F *h1 = new TH2F("h1", "front time tau vs charge TF 0 ", 200, 0 ,0.5e-9, 100, 5, 15 ); + TH2F *h1 = new TH2F("h1", "front time tau vs charge TF 0 ", 200, 0 ,1.0e-9, 200, -40, 40 ); t->Draw(" Ach0.fTimeFront - Ach2.fTimeFront : Ach0.fChargeTF >> h1","","col"); //x h1->GetXaxis()->SetTitle("Charge [C]"); @@ -41,7 +41,7 @@ void histCorrNew02 ( c1->Update(); c1->cd(2); - TH2F *h2 = new TH2F("h2", "front time tau vs charge TF 2 ", 200, 0, 0.5e-9, 200, 5 ,15); + TH2F *h2 = new TH2F("h2", "front time tau vs charge TF 2 ", 200, 0, 0.5e-9, 200, -20 ,30); t->Draw(" Ach0.fTimeFront - Ach2.fTimeFront : Ach2.fChargeTF >> h2","","col"); //x h2->GetXaxis()->SetTitle("Charge [C]"); @@ -53,7 +53,7 @@ void histCorrNew02 ( c1->Update(); c1->cd(3); - TH2F *h3 = new TH2F("h3", "charge TF 2 vs charge TF 0", 200, 0 ,0.5e-9, 200, 0, 0.5e-9); + TH2F *h3 = new TH2F("h3", "charge TF 2 vs charge TF 0", 200, 0 ,2.0e-9, 200, 0, 2.0e-9); t->Draw(" Ach0.fChargeTF : Ach2.fChargeTF >> h3","","col"); //x h3->GetXaxis()->SetTitle("Charge_0 [C]"); diff --git a/macros/histPresent.C b/macros/histPresent.C new file mode 100644 index 0000000000000000000000000000000000000000..80dbc9ac8f9f1e211a85b405a97c5f169028ff57 --- /dev/null +++ b/macros/histPresent.C @@ -0,0 +1,181 @@ +#include "TH2F.h" +#include "TH3F.h" +#include "TStyle.h" + +void histPresent ( + + const char *filename = "analysis_07_8.root", +// const char *filename = "analysis_07_8_smooth.root", +// const char *filename = "analysis_08_2.root", +// const char *filename = "analysis_08_2_smooth.root", + const char *foldername = "nustar_present", +// const char *ext = ".eps", + const char *ext = ".pdf", + + const Bool_t can1 = 1, const Bool_t can2 = 1, + const Bool_t can3 = 1, const Bool_t can4 = 0) + //const Bool_t can5 = 0/*, const Bool_t can6 = 0*/) +{ + using std::cout; + using std::endl; + gSystem->Load("../libData.so"); + TFile *f = new TFile(Form("../data/dataDSR4/%s", filename)); + TTree *t = (TTree*)f->Get("atree"); + + if(can1){ + + TCanvas *c1 = new TCanvas("c1", "canvas 1"); + c1->Divide(2,2); + + c1->cd(1); + //TH1F *h1 = new TH1F("h1", "CFD", 50, -15, 15); + TH1F *h1 = new TH1F("h1", "CFD", 50, 0, 20); + t->Draw("Ach0.fTimeCFD - Ach1.fTimeCFD >> h1","Ach0.fTimeCFD>100. && Ach0.fTimeCFD<160 && Ach1.fTimeCFD>100. && Ach1.fTimeCFD<160",""); + //x + h1->GetXaxis()->SetTitle("Time difference [ns]"); + h1->GetXaxis()->CenterTitle(); + //h1->Fit("gaus", "","",-3,2); + h1->Fit("gaus", "","",8,13); + gStyle->SetOptFit(); + + c1->Update(); + + c1->cd(2); + //TH1F *h2 = new TH1F("h2", "LED",50, -10, 10); + TH1F *h2 = new TH1F("h2", "LED",50, 0, 20); + t->Draw("Ach0.fTimeLED - Ach1.fTimeLED >> h2","Ach0.fTimeLED>100. && Ach0.fTimeLED < 150 && Ach1.fTimeLED>100 && Ach1.fTimeLED < 150","col"); + //x + h2->GetXaxis()->SetTitle("Time difference [ns]"); + h2->GetXaxis()->CenterTitle(); + //h2->Fit("gaus", "","",-3,1); + h2->Fit("gaus", "","",7,12); + gStyle->SetOptFit(); + + c1->Update(); + +/* c1->cd(3); + //TH1F *h3 = new TH1F("h3", "Front edge fit crossing zero level", 100, -20, 20); + TH1F *h3 = new TH1F("h3", "Front edge fit crossing zero level", 100,0, 20); + t->Draw("Ach0.fTimeFront - Ach1.fTimeFront >> h3","Ach0.fTimeFront>100. && Ach0.fTimeFront < 150 && Ach1.fTimeFront>100 && Ach1.fTimeFront < 150","col"); + //x + h3->GetXaxis()->SetTitle("Time difference [ns]"); + h3->GetXaxis()->CenterTitle(); + //h3->Fit("gaus", "","",-3,2); + h3->Fit("gaus", "","",9,12); + gStyle->SetOptFit();*/ + + c1->cd(3); + //TH1F *h3 = new TH1F("h3", "Front edge fit crossing zero level", 100, -20, 20); + TH1F *h3 = new TH1F("h3", "Middle point of front level", 100,1, 20); + t->Draw("Ach0.fTimeMid - Ach1.fTimeMid >> h3","","col"); + //x + h3->GetXaxis()->SetTitle("Time difference [ns]"); + h3->GetXaxis()->CenterTitle(); + //h3->Fit("gaus", "","",-3,2); + h3->Fit("gaus", "","",9,12); + gStyle->SetOptFit(); + + c1->Update(); + + c1->cd(4); + //TH1F *h4 = new TH1F("h4", "the middle point of front edge", 50, -10, 10); + TH1F *h4 = new TH1F("h4", "the 10 percent point of front edge", 80, 1, 20); + t->Draw("Ach0.fTime10 - Ach1.fTime10 >> h4","",""); + h4->GetXaxis()->SetTitle("Time difference [ns]"); + h4->GetXaxis()->CenterTitle(); + //h4->Fit("gaus","","",-3,1); + h4->Fit("gaus","","",9,13); + gStyle->SetOptFit(); + + + + c1->Print(Form("../macros/picsDRS4/%s/Smoothed_deltas%s", foldername, ext)); + } + + if(can2){ + + TCanvas *c2 = new TCanvas("c2", "canvas 2"); + c2->Divide(2,2); + + c2->cd(1); + //TH1F *h1 = new TH1F("h1", "CFD", 50, -15, 15); + TH1F *h5 = new TH1F("h5", "ToT", 50, 0, 12); + t->Draw("Ach0.fToT >> h5","Ach0.fToT > 0",""); + //x + h5->GetXaxis()->SetTitle("Time over threshold [ns]"); + h5->GetXaxis()->CenterTitle(); + //h1->Fit("gaus", "","",-3,2); + //h1->Fit("gaus", "","",8,13); + //gStyle->SetOptFit(); + + c2->Update(); + + c2->cd(2); + //TH1F *h2 = new TH1F("h2", "LED",50, -10, 10); + TH1F *h6 = new TH1F("h6", "ToT",50, 0, 12); + t->Draw("Ach1.fToT >> h6","Ach1.fToT > 0","col"); + //x + h6->GetXaxis()->SetTitle("Time over threshold [ns]"); + h6->GetXaxis()->CenterTitle(); + //h2->Fit("gaus", "","",-3,1); + //h2->Fit("gaus", "","",7,12); + //gStyle->SetOptFit(); + + c2->Update(); + + c2->cd(3); + //TH1F *h3 = new TH1F("h3", "Front edge fit crossing zero level", 100, -20, 20); + TH1F *h7 = new TH1F("h7", "Middle point of front level", 80,1, 20); + t->Draw("Ach0.fTimeMid - Ach1.fTimeMid >> h7","Ach0.fToT > 2. && Ach0.fToT < 6. && Ach1.fToT > 2. && Ach1.fToT < 6. ","col"); + //x + h7->GetXaxis()->SetTitle("Time difference [ns]"); + h7->GetXaxis()->CenterTitle(); + //h3->Fit("gaus", "","",-3,2); + h7->Fit("gaus", "","",9,12); + gStyle->SetOptFit(); + + c2->Update(); + + c2->cd(4); + //TH1F *h4 = new TH1F("h4", "the middle point of front edge", 50, -10, 10); + TH1F *h8 = new TH1F("h8", "the 10 percent point of front edge", 80, 1, 20); + t->Draw("Ach0.fTime10 - Ach1.fTime10 >> h8"," Ach0.fToT > 2. && Ach0.fToT < 6. && Ach1.fToT > 2. && Ach1.fToT < 6.",""); + h8->GetXaxis()->SetTitle("Time difference [ns]"); + h8->GetXaxis()->CenterTitle(); + //h4->Fit("gaus","","",-3,1); + h8->Fit("gaus","","",9,13); + gStyle->SetOptFit(); + + c2->Print(Form("../macros/picsDRS4/%s/Smoothed_deltas_tot_corr%s", foldername, ext)); + + } + + + if(can3){ + + TCanvas *c3 = new TCanvas("c3", "canvas 3"); + c3->Divide(2,2); + + c3->cd(1); + TH1F *h9 = new TH1F("h9", "Charge CFD", 200, 0 ,0.5e-9); + t->Draw("Ach0.fChargeCFD >> h9","",""); + c3->Update(); + + c3->cd(2); + TH1F *h10 = new TH1F("h10", "Charge LED",200, 0 ,0.5e-9); + t->Draw("Ach0.fChargeLED >> h10","",""); + c3->Update(); + + c3->cd(3); + TH1F *h11 = new TH1F("h11", "Sum of charges CFD for 4 channels",200, 0 ,10e-9); + t->Draw("Ach0.fChargeCFD + Ach1.fChargeCFD + Ach2.fChargeCFD + Ach3.fChargeCFD >> h11","",""); + c3->Update(); + + c3->cd(4); + TH1F *h12 = new TH1F("h12", "Sum of charges LED for 4 channels",200, 0 ,10e-9); + t->Draw("Ach0.fChargeLED + Ach1.fChargeLED + Ach2.fChargeLED + Ach3.fChargeLED >> h12","",""); + c3->Update(); + + } + +} diff --git a/macros/integralFormSignal.cpp b/macros/integralFormSignal.cpp index 51bb917898d81ecbdc2a7051b6a666d6aaf7a217..c91fd91ae8eefa924c1fb92a85b24e4e3660ff73 100644 --- a/macros/integralFormSignal.cpp +++ b/macros/integralFormSignal.cpp @@ -1,7 +1,7 @@ { gSystem->Load("../libData.so"); - TFile *f = new TFile("../data/dataDSR4/Neurad_081216_2NEW.root"); + TFile *f = new TFile("../data/dataDSR4/analysis_07_8.root"); TTree *tr = (TTree*)f->Get("atree"); const Int_t nP = 1024; diff --git a/macros/testShowCFD.cxx b/macros/testShowCFD.cxx index af19fa9c7f6eb1f73d36a69f9169df80009cefed..8d6efef5ae1570786e7c64d86a66f97bfeab451d 100644 --- a/macros/testShowCFD.cxx +++ b/macros/testShowCFD.cxx @@ -3,10 +3,13 @@ void testShowCFD() gSystem->Load("../libData.so"); - const Long64_t kFirstEvent = 128; + const Long64_t kFirstEvent = 133; + const char *foldername = "nustar_present"; + const char *ext = ".pdf"; // TFile fr("../data/dataDSR4/analysis_08_2_CFD02_06.root"); - TFile fr("../data/dataDSR4/analysis_08_2.root"); +// TFile fr("../data/dataDSR4/analysis_08_2.root"); + TFile fr("../data/dataDSR4/analysis_08_2_smooth.root"); TTree *tr = (TTree*)fr.Get("atree"); AEvent *revent = new AEvent(); @@ -23,12 +26,32 @@ void testShowCFD() TCanvas *c1 = new TCanvas("c1","CFD implementation",10,10,1000,600); - c1->Divide(3,4); - for (Int_t i = 0; i < 12; i++) { +// four event picture +/* c1->Divide(2,2); + + for (Int_t i = 0; i < 4; i++) { c1->cd(i+1); - gr[i]->Draw(""); + + gr[i]->GetXaxis()->SetRangeUser(130, 175); + gr[i]->GetXaxis()->SetTitle("Time [ns]"); + gr[i]->GetXaxis()->CenterTitle(); + gr[i]->GetYaxis()->SetTitle("Signal CFD [V]"); + gr[i]->GetYaxis()->CenterTitle(); + gr[i]->Draw("AL*"); } + c1->Print(Form("../macros/picsDRS4/%s/Signal_shapes_CFD%s", foldername, ext));*/ + +//one event picture + gr[2]->GetXaxis()->SetRangeUser(130, 160); + gr[2]->GetXaxis()->SetTitle("Time [ns]"); + gr[2]->GetXaxis()->CenterTitle(); + gr[2]->GetYaxis()->SetTitle("Signal [V]"); + gr[2]->GetYaxis()->CenterTitle(); + gr[2]->Draw("AL*"); + //f1->SetRange(t10[2], t90[2]); + //gr[2]->Fit(f1, "RQ"); + c1->Print(Form("../macros/picsDRS4/%s/CFD_one_signal_shape%s", foldername, ext)); // c1->cd(2); // tr->Draw("gAmp.Draw()","","goff",1,124); diff --git a/macros/testShowGraphs.cxx b/macros/testShowGraphs.cxx index 7d802976c1aa6df5d80c0e89da427708a7baccb6..9eabe228b935fa96ab2174027dfa31e7c561bf3f 100644 --- a/macros/testShowGraphs.cxx +++ b/macros/testShowGraphs.cxx @@ -13,21 +13,22 @@ void testShowGraphs() gStyle->SetCanvasDefH(900); gStyle->SetCanvasDefW(1500); - const char *foldername = "7_8"; - const char *ext = ".gif"; +// const char *foldername = "7_8"; + const char *foldername = "nustar_present"; + const char *ext = ".pdf"; gSystem->Load("../libData.so"); - const Long64_t kFirstEvent = 128; + const Long64_t kFirstEvent = 110; // TFile fr("../data/dataDSR4/Neurad_7_08_NEW.root"); -// TFile fr("../data/dataDSR4/analysis_07_8.root"); + TFile fr("../data/dataDSR4/analysis_07_8.root"); // TFile fr("../data/dataDSR4/Neurad_081216_2NEW.root"); // TFile fr("../data/dataTektronix/exp18.root"); - TFile fr("../data/dataDSR4/analysis_07_8.root"); + //TFile fr("../data/dataDSR4/analysis_07_8_smooth.root"); // TFile fr("../data/dataDSR4/Neurad_081216_2NEW.root"); // TFile fr("../data/dataTektronix/exp18.root"); @@ -60,15 +61,13 @@ void testShowGraphs() }//for over events - - TCanvas *c1 = new TCanvas("c1","test",10,10,1000,600); - c1->Divide(2,2); - - TF1 *f1 = new TF1("f1name", "[0]+x*[1]"); -// TF1 *f1 = new TF1("pol1", ); + TCanvas *c1 = new TCanvas("c1","Signal shape",10,10,1000,600); + //c1->Divide(3,4); +// four event picture + c1->Divide(2,2); for (Int_t k = 0; k < 4; k++) { c1->cd(k+1); gr[k]->GetXaxis()->SetRangeUser(130, 175); @@ -81,7 +80,42 @@ void testShowGraphs() //f1->SetRange(t10[k], t90[k]); //gr[k]->Fit(f1, "RQ"); } - //c1->Print(Form("../macros/picsDRS4/file%s/signals%s", foldername, ext)); -// c1->cd(2); -// tr->Draw("gAmp.Draw()","","goff",1,124); + c1->Print(Form("../macros/picsDRS4/%s/Signal_shapes_bad%s", foldername, ext)); + +// one event picture +/* gr[4]->GetXaxis()->SetRangeUser(130, 160); + gr[4]->GetXaxis()->SetTitle("Time [ns]"); + gr[4]->GetXaxis()->CenterTitle(); + gr[4]->GetYaxis()->SetTitle("Signal [V]"); + gr[4]->GetYaxis()->CenterTitle(); + gr[4]->Draw("AL*"); + f1->SetRange(t10[4], t90[4]); + gr[4]->Fit(f1, "RQ"); + c1->Print(Form("../macros/picsDRS4/%s/One_signal_shape%s", foldername, ext)); + + + + + //c1->Print(Form("../macros/picsDRS4/%s/Signal_shapes_with_fit%s", foldername, ext)); +*/ + +// picture for TDR + /* + c1->Divide(1,2); + c1->cd(1); + gr[2]->GetXaxis()->SetRangeUser(130, 175); + gr[2]->GetXaxis()->SetTitle("Time [ns]"); + gr[2]->GetXaxis()->CenterTitle(); + gr[2]->GetYaxis()->SetTitle("Signal [V]"); + gr[2]->GetYaxis()->CenterTitle(); + gr[2]->Draw("AL*"); + + c1->cd(2); + gr[3]->GetXaxis()->SetRangeUser(130, 175); + gr[3]->GetXaxis()->SetTitle("Time [ns]"); + gr[3]->GetXaxis()->CenterTitle(); + gr[3]->GetYaxis()->SetTitle("Signal [V]"); + gr[3]->GetYaxis()->CenterTitle(); + gr[3]->Draw("AL*"); + */ } diff --git a/macros/walk_corr.C b/macros/walk_corr.C new file mode 100644 index 0000000000000000000000000000000000000000..f93cddfafa51c306c6dd5d09e3564c3cc3518cdb --- /dev/null +++ b/macros/walk_corr.C @@ -0,0 +1,82 @@ +#include "TH2F.h" +#include "TH3F.h" +#include "TStyle.h" + +void walk_corr( +//01 means it is used for channels 0 and 1 + + const char *filename = "analysis_07_8.root", //considered non-collimated +// const char *filename = "analysis_08_2.root", + const Bool_t can1 = 1) + +{ + using std::cout; + using std::endl; + gSystem->Load("../libData.so"); + TFile *f = new TFile(Form("../data/dataDSR4/%s", filename)); + TTree *t = (TTree*)f->Get("atree"); + + if(can1){ + + TCanvas *c1 = new TCanvas("c1", "Trying to correct the walk effect"); + +//pictures for latex report, LED +/* c1->Divide(2,1); + c1->cd(1); + TH2F *h2 = new TH2F("h2", "time difference (LED method) vs charge of non-trigger channel ", 100, -12 ,5, 100, 0, 0.14e-9); + t->Draw(" Ach1.fChargeLED : Ach0.fTimeLED - Ach1.fTimeLED >> h2","","col"); + //x + h2->GetXaxis()->SetTitle("time [ns]"); + h2->GetXaxis()->CenterTitle(); + //y + h2->GetYaxis()->SetTitle("Q [C]"); + h2->GetYaxis()->CenterTitle(); + +// c1->cd(2); + TProfile *prof1 = new TProfile("prof1","Profile of y vs x",100, -12, 5, 0, 0.17e-9); + prof1 = h2->ProfileX(); +// prof1->Fit("pol2","","",-6,0); + prof1->Draw("same"); +*/ + +//pictures for latex report, CFD + c1->Divide(2,2); + c1->cd(1); + TH2F *h2 = new TH2F("h2", "time difference (CFD method) vs charge of non-trigger channel ", 100, -12 ,5, 100, 0, 0.17e-9); + t->Draw(" Ach1.fChargeCFD : Ach0.fTimeCFD - Ach1.fTimeCFD >> h2","","col"); + //x + h2->GetXaxis()->SetTitle("time [ns]"); + h2->GetXaxis()->CenterTitle(); + //y + h2->GetYaxis()->SetTitle("Q [C]"); + h2->GetYaxis()->CenterTitle(); + h2->SetMaximum(10); + c1->Update(); + + c1->cd(2); + //TProfile *prof1 = new TProfile("prof1","Profile of y vs x"/*,100, -12, 5, 0, 0.17e-9, "o"*/); + TProfile *prof1 = h2->ProfileX(); + //prof1 = h2->ProfileY(); + TF1 *myfit = new TF1("myfit","[0] - [1]*exp([2]/sqrt(x))"); + myfit->SetRange(0.0, 0.08); + prof1->Fit("pol1","","",-4,0); + //prof1->Fit("myfit","R");//,0,0.06); + prof1->Draw(); + + c1->cd(3); + TH2F *h3 = new TH2F("h3", "time difference (CFD method) vs charge of non-trigger channel AFTER CORRECTION", 100, -12 ,5, 100, 0, 0.17e-9); + h3->SetMaximum(10); + t->Draw("Ach1.fChargeCFD : (Ach0.fTimeCFD - Ach1.fTimeCFD) + 0.550*1.58e-11/Ach1.fChargeCFD >> h3","","col"); + + c1->cd(4); + TH1F *h4 = new TH1F("h4", "time difference AFTER CORRECTION", 50, -8, 8); + t->Draw(" (Ach0.fTimeCFD - Ach1.fTimeCFD) + 0.550*1.58e-11/Ach1.fChargeCFD >> h4","Ach0.fTimeCFD>100. && Ach0.fTimeCFD<160 && Ach1.fTimeCFD>100. && Ach1.fTimeCFD<160",""); + h4->GetXaxis()->SetTitle("Time difference [ns]"); + h4->GetXaxis()->CenterTitle(); + //h4->Fit("gaus","","",-3,1); + h4->Fit("gaus","","",-2,1.5); + gStyle->SetOptFit(); + + } + +}