From 2722289c4033864227425c5068b94ef3e5d4a145 Mon Sep 17 00:00:00 2001 From: fbellini Date: Fri, 9 Jan 2015 17:13:10 +0100 Subject: [PATCH] Substitued At with FindObject + New year's cleanup and minor fixes to plotting style --- TOF/macrosQA/MakeTrendingTOFQA.C | 2806 +++++++++++++++--------------- 1 file changed, 1391 insertions(+), 1415 deletions(-) diff --git a/TOF/macrosQA/MakeTrendingTOFQA.C b/TOF/macrosQA/MakeTrendingTOFQA.C index 5ddf3e209bc..0caa78217f8 100644 --- a/TOF/macrosQA/MakeTrendingTOFQA.C +++ b/TOF/macrosQA/MakeTrendingTOFQA.C @@ -1,1591 +1,1567 @@ /* -fbellini@cern.ch, last update on 12/07/2013 -- added average multi vs. run number trending plot -Previous history - january 2012: -- added flag for displaying reduced n. of trending plots -- now producing tree run by run -- new method to produce trending plots from list of trees + fbellini@cern.ch, last update on 09/01/2015 + - cleanup and fixes for graphics + Previous history: + - added average multi vs. run number trending plot + - added flag for displaying reduced n. of trending plots + - now producing tree run by run + - new method to produce trending plots from list of trees */ Int_t MakeTrendingTOFQA(char * runlist, Int_t year=2012, char *period="LHC12a", char* pass="cpass1", char* nameSuffix ="_barrel",Bool_t isMC=kTRUE, Int_t trainId=0, Bool_t displayAll=kTRUE, Bool_t includeStartTime=kTRUE){ - Int_t filesCounter=0; + Int_t filesCounter=0; - if (!runlist) { - printf("Invalid list of runs given as input: nothing done\n"); - return 1; - } - Int_t runNumber; - char infile[300]; - char postFileName[20]; - char treePostFileName[20]; + if (!runlist) { + printf("Invalid list of runs given as input: nothing done\n"); + return 1; + } + Int_t runNumber; + char infile[300]; + char postFileName[20]; + char treePostFileName[20]; - char trendFileName[100]; - //Define trending output - if (trainId==0){ - sprintf(trendFileName,"treeTOFQA_%s_%s.root",period,pass); - }else{ - sprintf(trendFileName,"treeTOFQA_QA%i_%s_%s.root",trainId,period,pass); - } - TFile * trendFile=new TFile(trendFileName,"recreate"); - FILE * files = fopen(runlist, "r") ; - - //create chain of treePostQA - Long64_t nentries=100000, firstentry=0; - TChain *chainTree = 0; - chainTree=new TChain("trendTree"); + char trendFileName[100]; + //Define trending output + if (trainId==0){ + sprintf(trendFileName,"treeTOFQA_%s_%s.root",period,pass); + }else{ + sprintf(trendFileName,"treeTOFQA_QA%i_%s_%s.root",trainId,period,pass); + } + TFile * trendFile=new TFile(trendFileName,"recreate"); + FILE * files = fopen(runlist, "r") ; + + //create chain of treePostQA + Long64_t nentries=100000, firstentry=0; + TChain *chainTree = 0; + chainTree=new TChain("trendTree"); - while (fscanf(files,"%d",&runNumber)==1 ){ + while (fscanf(files,"%d",&runNumber)==1 ){ - //get QAtrain output - if (trainId==0){ - if (!isMC) sprintf(infile,"alien:///alice/data/%i/%s/000%d/%s/QAresults%s.root",year,period,runNumber,pass,nameSuffix); - else sprintf(infile,"alien:///alice/sim/%i/%s/%d/QAresults%s.root",year,period,runNumber,nameSuffix); - } else{ - if (!isMC) sprintf(infile,"alien:///alice/data/%i/%s/000%d/ESDs/%s/QA%i/QAresults%s.root",year,period,runNumber,pass,trainId,nameSuffix); - else sprintf(infile,"alien:///alice/sim/%i/%s/%d/QA%i/QAresults%s.root",year,period,runNumber,trainId,nameSuffix); - } - - Printf("============== Opening QA file(s) for run %i =======================\n",runNumber); + //get QAtrain output + if (trainId==0){ + if (!isMC) sprintf(infile,"alien:///alice/data/%i/%s/000%d/%s/QAresults%s.root",year,period,runNumber,pass,nameSuffix); + else sprintf(infile,"alien:///alice/sim/%i/%s/%d/QAresults%s.root",year,period,runNumber,nameSuffix); + } else{ + if (!isMC) sprintf(infile,"alien:///alice/data/%i/%s/000%d/ESDs/%s/QA%i/QAresults%s.root",year,period,runNumber,pass,trainId,nameSuffix); + else sprintf(infile,"alien:///alice/sim/%i/%s/%d/QA%i/QAresults%s.root",year,period,runNumber,trainId,nameSuffix); + } + + Printf("============== Opening QA file(s) for run %i =======================\n",runNumber); - //run post-analysis - if (RunESDQApostAnalysis(infile,runNumber,isMC,kTRUE,displayAll,includeStartTime)==0){ - filesCounter++; - sprintf(postFileName,"postQA_%i.root",runNumber); - sprintf(treePostFileName,"treePostQA_%i.root",runNumber); + //run post-analysis + if (RunESDQApostAnalysis(infile,runNumber,isMC,kTRUE,displayAll,includeStartTime)==0){ + filesCounter++; + sprintf(postFileName,"postQA_%i.root",runNumber); + sprintf(treePostFileName,"treePostQA_%i.root",runNumber); - if (MakePostQAtree(runNumber, isMC, postFileName, treePostFileName, includeStartTime)==0){ - chainTree->Add(treePostFileName); - Printf("Tree chain has now %d entries ",(Int_t)chainTree->GetEntries()); - } else { - Printf("Could not get tree with trending quantities for run %i: SKIPPING",runNumber); - } - } else - Printf("Post analysis not run on QA output %s", infile); - } - return MakeTrendingFromTreeWithErrors(chainTree, trendFileName, displayAll, includeStartTime); + if (MakePostQAtree(runNumber, isMC, postFileName, treePostFileName, includeStartTime)==0){ + chainTree->Add(treePostFileName); + Printf("Tree chain has now %d entries ",(Int_t)chainTree->GetEntries()); + } else { + Printf("Could not get tree with trending quantities for run %i: SKIPPING",runNumber); + } + } else + Printf("Post analysis not run on QA output %s", infile); + } + return MakeTrendingFromTreeWithErrors(chainTree, trendFileName, displayAll, includeStartTime); } //----------------------------------------------------------- Int_t MakeTrendingHistoFromTreeList(char * fileList, TString treeName = "trendTree", Bool_t displayAll=kFALSE, Bool_t includeStartTime=kTRUE){ - Int_t filesCounter=0; + Int_t filesCounter=0; - if (!fileList) { - printf("Invalid list of runs given as input: nothing done\n"); - return 1; - } - char infile[300]; - char trendFileName[100]; - //Define trending output - sprintf(trendFileName,"trendingHistoTOFQA_%s.root",fileList); - TFile * trendFile=new TFile(trendFileName,"recreate"); - FILE * files = fopen(fileList, "r") ; - - //create chain of treePostQA - Long64_t nentries=100000, firstentry=0; - TChain *chainTree =new TChain(treeName.Data()); + if (!fileList) { + printf("Invalid list of runs given as input: nothing done\n"); + return 1; + } + char infile[300]; + char trendFileName[100]; + //Define trending output + sprintf(trendFileName,"trendingHistoTOFQA_%s.root",fileList); + TFile * trendFile=new TFile(trendFileName,"recreate"); + FILE * files = fopen(fileList, "r") ; + + //create chain of treePostQA + Long64_t nentries=100000, firstentry=0; + TChain *chainTree =new TChain(treeName.Data()); - while (fscanf(files,"%s",&infile)==1 ){ - if (!TFile::Open(infile,"r")) - Printf("Error: cannot open file %s", infile); - Printf("============== Adding QA tree file %s to the chain",infile); - filesCounter++; - chainTree->Add(infile); - } - return MakeTrendingFromTreeWithErrors(chainTree, trendFileName, displayAll, includeStartTime); + while (fscanf(files,"%s",&infile)==1 ){ + if (!TFile::Open(infile,"r")) + Printf("Error: cannot open file %s", infile); + Printf("============== Adding QA tree file %s to the chain",infile); + filesCounter++; + chainTree->Add(infile); + } + return MakeTrendingFromTreeWithErrors(chainTree, trendFileName, displayAll, includeStartTime); } //______________________________________________________________________________ Int_t MakeTrendingFromTreeWithErrors(TChain * fin,char* trendFileName=NULL, Bool_t displayAll=kFALSE, Bool_t includeStartTime=kTRUE){ - if (!trendFileName) - return 3; + if (!trendFileName) + return 3; - if (!fin) - return 4; - - Int_t runNumber; - Double_t avTime=0., peakTime=0., spreadTime=0., peakTimeErr=0., spreadTimeErr=0.,negTimeRatio=0., - avRawTime=0., peakRawTime=0., spreadRawTime=0., peakRawTimeErr=0., spreadRawTimeErr=0., - avTot=0., peakTot=0.,spreadTot=0., peakTotErr=0.,spreadTotErr=0., - orphansRatio=0., avL=0., negLratio=0., - effPt1=0., effPt2=0., matchEffLinFit1Gev=0.,matchEffLinFit1GevErr=0.; - Double_t avDiffTime=0.,peakDiffTime=0., spreadDiffTime=0.,peakDiffTimeErr=0., spreadDiffTimeErr=0.,avT0fillRes=0.; + if (!fin) + return 4; + + Int_t runNumber; + Double_t avTime=0., peakTime=0., spreadTime=0., peakTimeErr=0., spreadTimeErr=0.,negTimeRatio=0., + avRawTime=0., peakRawTime=0., spreadRawTime=0., peakRawTimeErr=0., spreadRawTimeErr=0., + avTot=0., peakTot=0.,spreadTot=0., peakTotErr=0.,spreadTotErr=0., + orphansRatio=0., avL=0., negLratio=0., + effPt1=0., effPt2=0., matchEffLinFit1Gev=0.,matchEffLinFit1GevErr=0.; + Double_t avDiffTime=0.,peakDiffTime=0., spreadDiffTime=0.,peakDiffTimeErr=0., spreadDiffTimeErr=0.,avT0fillRes=0.; - Double_t avT0A=0.,peakT0A=0., spreadT0A=0.,peakT0AErr=0., spreadT0AErr=0.; - Double_t avT0C=0.,peakT0C=0., spreadT0C=0.,peakT0CErr=0., spreadT0CErr=0.; - Double_t avT0AC=0.,peakT0AC=0., spreadT0AC=0.,peakT0ACErr=0., spreadT0ACErr=0.; - Double_t avT0res=0.,peakT0res=0., spreadT0res=0.,peakT0resErr=0., spreadT0resErr=0.; - Float_t avMulti=0; - Float_t fractionEventsWHits=0.0; - Double_t goodChannelRatio=0.0; + Double_t avT0A=0.,peakT0A=0., spreadT0A=0.,peakT0AErr=0., spreadT0AErr=0.; + Double_t avT0C=0.,peakT0C=0., spreadT0C=0.,peakT0CErr=0., spreadT0CErr=0.; + Double_t avT0AC=0.,peakT0AC=0., spreadT0AC=0.,peakT0ACErr=0., spreadT0ACErr=0.; + Double_t avT0res=0.,peakT0res=0., spreadT0res=0.,peakT0resErr=0., spreadT0resErr=0.; + Float_t avMulti=0; + Float_t fractionEventsWHits=0.0; + Double_t goodChannelRatio=0.0; - TTree * ttree = (TTree*) fin->CloneTree(); - ttree->SetBranchAddress("run",&runNumber); - ttree->SetBranchAddress("avMulti",&avMulti); - ttree->SetBranchAddress("goodChannelsRatio",&goodChannelRatio); - ttree->SetBranchAddress("avTime",&avTime); //mean time - ttree->SetBranchAddress("peakTime",&peakTime); //main peak time after fit - ttree->SetBranchAddress("spreadTime",&spreadTime); //spread of main peak of time after fit - ttree->SetBranchAddress("peakTimeErr",&peakTimeErr); //main peak time after fit error - ttree->SetBranchAddress("spreadTimeErr",&spreadTimeErr); //spread of main peak of time after fit error + TTree * ttree = (TTree*) fin->CloneTree(); + ttree->SetBranchAddress("run",&runNumber); + ttree->SetBranchAddress("avMulti",&avMulti); + ttree->SetBranchAddress("goodChannelsRatio",&goodChannelRatio); + ttree->SetBranchAddress("avTime",&avTime); //mean time + ttree->SetBranchAddress("peakTime",&peakTime); //main peak time after fit + ttree->SetBranchAddress("spreadTime",&spreadTime); //spread of main peak of time after fit + ttree->SetBranchAddress("peakTimeErr",&peakTimeErr); //main peak time after fit error + ttree->SetBranchAddress("spreadTimeErr",&spreadTimeErr); //spread of main peak of time after fit error - ttree->SetBranchAddress("negTimeRatio",&negTimeRatio); //negative time ratio + ttree->SetBranchAddress("negTimeRatio",&negTimeRatio); //negative time ratio - ttree->SetBranchAddress("avRawTime",&avRawTime); //mean raw time - ttree->SetBranchAddress("peakRawTime",&peakRawTime); //mean peak of raw time after fit - ttree->SetBranchAddress("spreadRawTime",&spreadRawTime); //spread of main peak of raw time after fit - ttree->SetBranchAddress("peakRawTimeErr",&peakRawTimeErr); //main peak raw time after fit error - ttree->SetBranchAddress("spreadRawTimeErr",&spreadRawTimeErr); //spread of raw main peak of time after fit error + ttree->SetBranchAddress("avRawTime",&avRawTime); //mean raw time + ttree->SetBranchAddress("peakRawTime",&peakRawTime); //mean peak of raw time after fit + ttree->SetBranchAddress("spreadRawTime",&spreadRawTime); //spread of main peak of raw time after fit + ttree->SetBranchAddress("peakRawTimeErr",&peakRawTimeErr); //main peak raw time after fit error + ttree->SetBranchAddress("spreadRawTimeErr",&spreadRawTimeErr); //spread of raw main peak of time after fit error - ttree->SetBranchAddress("avTot",&avTot); //main peak tot - ttree->SetBranchAddress("peakTot",&peakTot); // main peak of tot after fit - ttree->SetBranchAddress("spreadTot",&spreadTot); //spread of main peak of tot after fit - ttree->SetBranchAddress("peakTotErr",&peakTotErr); // main peak of tot after fit - ttree->SetBranchAddress("spreadTotErr",&spreadTotErr); //spread of main peak of tot after fit + ttree->SetBranchAddress("avTot",&avTot); //main peak tot + ttree->SetBranchAddress("peakTot",&peakTot); // main peak of tot after fit + ttree->SetBranchAddress("spreadTot",&spreadTot); //spread of main peak of tot after fit + ttree->SetBranchAddress("peakTotErr",&peakTotErr); // main peak of tot after fit + ttree->SetBranchAddress("spreadTotErr",&spreadTotErr); //spread of main peak of tot after fit - ttree->SetBranchAddress("orphansRatio",&orphansRatio); //orphans ratio + ttree->SetBranchAddress("orphansRatio",&orphansRatio); //orphans ratio - ttree->SetBranchAddress("avL",&avL); //mean track length - ttree->SetBranchAddress("negLratio",&negLratio);//ratio of tracks with track length <350 cm + ttree->SetBranchAddress("avL",&avL); //mean track length + ttree->SetBranchAddress("negLratio",&negLratio);//ratio of tracks with track length <350 cm - ttree->SetBranchAddress("effPt1",&effPt1);//matching eff at 1 GeV/c - ttree->SetBranchAddress("effPt2",&effPt2); //matching eff at 2 GeV/c - ttree->SetBranchAddress("matchEffLinFit1Gev",&matchEffLinFit1Gev);//matching eff fit param - ttree->SetBranchAddress("matchEffLinFit1GevErr",&matchEffLinFit1GevErr);////matching eff fit param error + ttree->SetBranchAddress("effPt1",&effPt1);//matching eff at 1 GeV/c + ttree->SetBranchAddress("effPt2",&effPt2); //matching eff at 2 GeV/c + ttree->SetBranchAddress("matchEffLinFit1Gev",&matchEffLinFit1Gev);//matching eff fit param + ttree->SetBranchAddress("matchEffLinFit1GevErr",&matchEffLinFit1GevErr);////matching eff fit param error - ttree->SetBranchAddress("avPiDiffTime",&avDiffTime); //mean t-texp - ttree->SetBranchAddress("peakPiDiffTime",&peakDiffTime); //main peak t-texp after fit - ttree->SetBranchAddress("spreadPiDiffTime",&spreadDiffTime); //spread of main peak t-texp after fit - ttree->SetBranchAddress("peakPiDiffTimeErr",&peakDiffTimeErr); //main peak t-texp after fit error - ttree->SetBranchAddress("spreadPiDiffTimeErr",&spreadDiffTimeErr); //spread of main peak of t-texp after fit error + ttree->SetBranchAddress("avPiDiffTime",&avDiffTime); //mean t-texp + ttree->SetBranchAddress("peakPiDiffTime",&peakDiffTime); //main peak t-texp after fit + ttree->SetBranchAddress("spreadPiDiffTime",&spreadDiffTime); //spread of main peak t-texp after fit + ttree->SetBranchAddress("peakPiDiffTimeErr",&peakDiffTimeErr); //main peak t-texp after fit error + ttree->SetBranchAddress("spreadPiDiffTimeErr",&spreadDiffTimeErr); //spread of main peak of t-texp after fit error - ttree->SetBranchAddress("avT0A",&avT0A); //main peak t0A - ttree->SetBranchAddress("peakT0A",&peakT0A); // main peak of t0A after fit - ttree->SetBranchAddress("spreadT0A",&spreadT0A); //spread of main peak of t0A after fit - ttree->SetBranchAddress("peakT0AErr",&peakT0AErr); // main peak of t0A after fit - ttree->SetBranchAddress("spreadT0AErr",&spreadT0AErr); //spread of main peak of t0A after fit + ttree->SetBranchAddress("avT0A",&avT0A); //main peak t0A + ttree->SetBranchAddress("peakT0A",&peakT0A); // main peak of t0A after fit + ttree->SetBranchAddress("spreadT0A",&spreadT0A); //spread of main peak of t0A after fit + ttree->SetBranchAddress("peakT0AErr",&peakT0AErr); // main peak of t0A after fit + ttree->SetBranchAddress("spreadT0AErr",&spreadT0AErr); //spread of main peak of t0A after fit - ttree->SetBranchAddress("avT0C",&avT0C); //main peak t0C - ttree->SetBranchAddress("peakT0C",&peakT0C); // main peak of t0C after fit - ttree->SetBranchAddress("spreadT0C",&spreadT0C); //spread of main peak of t0C after fit - ttree->SetBranchAddress("peakT0CErr",&peakT0CErr); // main peak of t0C after fit - ttree->SetBranchAddress("spreadT0CErr",&spreadT0CErr); //spread of main peak of t0C after fit + ttree->SetBranchAddress("avT0C",&avT0C); //main peak t0C + ttree->SetBranchAddress("peakT0C",&peakT0C); // main peak of t0C after fit + ttree->SetBranchAddress("spreadT0C",&spreadT0C); //spread of main peak of t0C after fit + ttree->SetBranchAddress("peakT0CErr",&peakT0CErr); // main peak of t0C after fit + ttree->SetBranchAddress("spreadT0CErr",&spreadT0CErr); //spread of main peak of t0C after fit - ttree->SetBranchAddress("avT0AC",&avT0AC); //main peak t0AC - ttree->SetBranchAddress("peakT0AC",&peakT0AC); // main peak of t0AC after fit - ttree->SetBranchAddress("spreadT0AC",&spreadT0AC); //spread of main peak of t0AC after fit - ttree->SetBranchAddress("peakT0ACErr",&peakT0ACErr); // main peak of t0AC after fit - ttree->SetBranchAddress("spreadT0ACErr",&spreadT0ACErr); //spread of main peak of t0AC after fit + ttree->SetBranchAddress("avT0AC",&avT0AC); //main peak t0AC + ttree->SetBranchAddress("peakT0AC",&peakT0AC); // main peak of t0AC after fit + ttree->SetBranchAddress("spreadT0AC",&spreadT0AC); //spread of main peak of t0AC after fit + ttree->SetBranchAddress("peakT0ACErr",&peakT0ACErr); // main peak of t0AC after fit + ttree->SetBranchAddress("spreadT0ACErr",&spreadT0ACErr); //spread of main peak of t0AC after fit - ttree->SetBranchAddress("avT0res",&avT0res); //main peak t0AC - ttree->SetBranchAddress("peakT0res",&peakT0res); // main peak of t0AC after fit - ttree->SetBranchAddress("spreadT0res",&spreadT0res); //spread of main peak of t0AC after fit - ttree->SetBranchAddress("peakT0resErr",&peakT0resErr); // main peak of t0AC after fit - ttree->SetBranchAddress("spreadT0resErr",&spreadT0resErr); //spread of main peak of t0AC after fit - ttree->SetBranchAddress("avT0fillRes",&avT0fillRes); //t0 fill res - - Int_t nRuns=ttree->GetEntries(); - TList lista; + ttree->SetBranchAddress("avT0res",&avT0res); //main peak t0AC + ttree->SetBranchAddress("peakT0res",&peakT0res); // main peak of t0AC after fit + ttree->SetBranchAddress("spreadT0res",&spreadT0res); //spread of main peak of t0AC after fit + ttree->SetBranchAddress("peakT0resErr",&peakT0resErr); // main peak of t0AC after fit + ttree->SetBranchAddress("spreadT0resErr",&spreadT0resErr); //spread of main peak of t0AC after fit + ttree->SetBranchAddress("avT0fillRes",&avT0fillRes); //t0 fill res + + Int_t nRuns=ttree->GetEntries(); + TList lista; - TH1F * hAvMulti=new TH1F("hAvMulti","Average multiplicity of matched tracks ;; ", nRuns,0., nRuns);//, 600, 0. , 600.); - hAvMulti->SetDrawOption("E1"); - hAvMulti->SetMarkerStyle(20); - hAvMulti->SetMarkerColor(kBlue); + TH1F * hAvMulti=new TH1F("hAvMulti","Average multiplicity of matched tracks ;; ", nRuns,0., nRuns);//, 600, 0. , 600.); + hAvMulti->SetDrawOption("E1"); + hAvMulti->SetMarkerStyle(20); + hAvMulti->SetMarkerColor(kBlue); - TH1F * hAvDiffTimeVsRun=new TH1F("hAvDiffTimeVsRun","Mean t-t_{exp} (no fit);run; (ps)",nRuns,0., nRuns);//, 600, 0. , 600.); - hAvDiffTimeVsRun->SetDrawOption("E1"); - hAvDiffTimeVsRun->SetMarkerStyle(20); - hAvDiffTimeVsRun->SetMarkerColor(kBlue); - // hAvTimeVsRun->GetYaxis()->SetRangeUser(0.0, 50.0); - - TH1F * hPeakDiffTimeVsRun=new TH1F("hPeakDiffTimeVsRun","t-t_{exp} (gaussian fit) ;; (ps)",nRuns,0., nRuns);//,600, 0. , 600. ); - hPeakDiffTimeVsRun->SetDrawOption("E1"); - hPeakDiffTimeVsRun->SetMarkerStyle(20); - hPeakDiffTimeVsRun->SetMarkerColor(kBlue); + TH1F * hAvDiffTimeVsRun=new TH1F("hAvDiffTimeVsRun","Mean t-t_{exp} (no fit);run; (ps)",nRuns,0., nRuns);//, 600, 0. , 600.); + hAvDiffTimeVsRun->SetDrawOption("E1"); + hAvDiffTimeVsRun->SetMarkerStyle(20); + hAvDiffTimeVsRun->SetMarkerColor(kBlue); + // hAvTimeVsRun->GetYaxis()->SetRangeUser(0.0, 50.0); + + TH1F * hPeakDiffTimeVsRun=new TH1F("hPeakDiffTimeVsRun","t-t_{exp} (gaussian fit) ;; (ps)",nRuns,0., nRuns);//,600, 0. , 600. ); + hPeakDiffTimeVsRun->SetDrawOption("E1"); + hPeakDiffTimeVsRun->SetMarkerStyle(20); + hPeakDiffTimeVsRun->SetMarkerColor(kBlue); - TH1F * hSpreadDiffTimeVsRun=new TH1F("hSpreadDiffTimeVsRun","#sigma(t-t_{exp}) (gaussian fit);; #sigma(t^{TOF}-t_{exp,#pi}) (ns)",nRuns,0., nRuns);//, 100, 0. , 100.); - hSpreadDiffTimeVsRun->SetDrawOption("E1"); - hSpreadDiffTimeVsRun->SetMarkerStyle(20); - hSpreadDiffTimeVsRun->SetMarkerColor(kBlue); - - TH1F * hAvTimeVsRun=new TH1F("hAvTimeVsRun",";; (ns)",nRuns,0., nRuns);//, 600, 0. , 600.); - hAvTimeVsRun->SetDrawOption("E1"); - hAvTimeVsRun->SetMarkerStyle(20); - hAvTimeVsRun->SetMarkerColor(kBlue); - // hAvTimeVsRun->GetYaxis()->SetRangeUser(0.0, 50.0); - - TH1F * hPeakTimeVsRun=new TH1F("hPeakTimeVsRun","Peak value of t^{TOF} (landau fit);;t_{peak}^{TOF} (ns)",nRuns,0., nRuns);//,600, 0. , 600. ); - hPeakTimeVsRun->SetDrawOption("E1"); - hPeakTimeVsRun->SetMarkerStyle(20); - hPeakTimeVsRun->SetMarkerColor(kBlue); + TH1F * hSpreadDiffTimeVsRun=new TH1F("hSpreadDiffTimeVsRun","#sigma(t-t_{exp}) (gaussian fit);; #sigma(t^{TOF}-t_{exp,#pi}) (ns)",nRuns,0., nRuns);//, 100, 0. , 100.); + hSpreadDiffTimeVsRun->SetDrawOption("E1"); + hSpreadDiffTimeVsRun->SetMarkerStyle(20); + hSpreadDiffTimeVsRun->SetMarkerColor(kBlue); + + TH1F * hAvTimeVsRun=new TH1F("hAvTimeVsRun",";; (ns)",nRuns,0., nRuns);//, 600, 0. , 600.); + hAvTimeVsRun->SetDrawOption("E1"); + hAvTimeVsRun->SetMarkerStyle(20); + hAvTimeVsRun->SetMarkerColor(kBlue); + // hAvTimeVsRun->GetYaxis()->SetRangeUser(0.0, 50.0); + + TH1F * hPeakTimeVsRun=new TH1F("hPeakTimeVsRun","Peak value of t^{TOF} (landau fit);;t_{peak}^{TOF} (ns)",nRuns,0., nRuns);//,600, 0. , 600. ); + hPeakTimeVsRun->SetDrawOption("E1"); + hPeakTimeVsRun->SetMarkerStyle(20); + hPeakTimeVsRun->SetMarkerColor(kBlue); - TH1F * hSpreadTimeVsRun=new TH1F("hSpreadTimeVsRun","Spread of t^{TOF} (landau fit);; #sigma(t^{TOF}) (ns)",nRuns,0., nRuns);//, 100, 0. , 100.); - hSpreadTimeVsRun->SetDrawOption("E1"); - hSpreadTimeVsRun->SetMarkerStyle(20); - hSpreadTimeVsRun->SetMarkerColor(kBlue); + TH1F * hSpreadTimeVsRun=new TH1F("hSpreadTimeVsRun","Spread of t^{TOF} (landau fit);; #sigma(t^{TOF}) (ns)",nRuns,0., nRuns);//, 100, 0. , 100.); + hSpreadTimeVsRun->SetDrawOption("E1"); + hSpreadTimeVsRun->SetMarkerStyle(20); + hSpreadTimeVsRun->SetMarkerColor(kBlue); - TH1F * hAvRawTimeVsRun=new TH1F("hAvRawTimeVsRun","Peak value of raw t^{TOF};; (ns)",nRuns,0., nRuns);//, 600, 0. , 600.); - hAvRawTimeVsRun->SetDrawOption("E1"); - hAvRawTimeVsRun->SetMarkerStyle(21); - hAvRawTimeVsRun->SetMarkerColor(kGreen); - - TH1F * hPeakRawTimeVsRun=new TH1F("hPeakRawTimeVsRun","Peak value of raw t^{TOF} (landau fit);;t_{peak,raw}^{TOF} (ns)",nRuns,0., nRuns);//, 600, 0. , 600.); - hPeakRawTimeVsRun->SetDrawOption("E1"); - hPeakRawTimeVsRun->SetMarkerStyle(21); - hPeakRawTimeVsRun->SetMarkerColor(kGreen); - - TH1F * hSpreadRawTimeVsRun=new TH1F("hSpreadRawTimeVsRun","Spread of raw t^{TOF} (landau fit);;#sigma(t_{raw}^{TOF}) (ns)",nRuns,0., nRuns);//, 100, 0. , 100.); - hSpreadRawTimeVsRun->SetDrawOption("E1"); - hSpreadRawTimeVsRun->SetMarkerStyle(21); - hSpreadRawTimeVsRun->SetMarkerColor(kGreen); + TH1F * hAvRawTimeVsRun=new TH1F("hAvRawTimeVsRun","Peak value of raw t^{TOF};; (ns)",nRuns,0., nRuns);//, 600, 0. , 600.); + hAvRawTimeVsRun->SetDrawOption("E1"); + hAvRawTimeVsRun->SetMarkerStyle(21); + hAvRawTimeVsRun->SetMarkerColor(kGreen); + + TH1F * hPeakRawTimeVsRun=new TH1F("hPeakRawTimeVsRun","Peak value of raw t^{TOF} (landau fit);;t_{peak,raw}^{TOF} (ns)",nRuns,0., nRuns);//, 600, 0. , 600.); + hPeakRawTimeVsRun->SetDrawOption("E1"); + hPeakRawTimeVsRun->SetMarkerStyle(21); + hPeakRawTimeVsRun->SetMarkerColor(kGreen); + + TH1F * hSpreadRawTimeVsRun=new TH1F("hSpreadRawTimeVsRun","Spread of raw t^{TOF} (landau fit);;#sigma(t_{raw}^{TOF}) (ns)",nRuns,0., nRuns);//, 100, 0. , 100.); + hSpreadRawTimeVsRun->SetDrawOption("E1"); + hSpreadRawTimeVsRun->SetMarkerStyle(21); + hSpreadRawTimeVsRun->SetMarkerColor(kGreen); - TH1F * hAvTotVsRun=new TH1F("hAvTotVsRun"," (no fit);run; (ns)",nRuns,0., nRuns);//, 50, 0. , 50.); - hAvTotVsRun->SetDrawOption("E1"); - hAvTotVsRun->SetMarkerStyle(22); + TH1F * hAvTotVsRun=new TH1F("hAvTotVsRun"," (no fit);run; (ns)",nRuns,0., nRuns);//, 50, 0. , 50.); + hAvTotVsRun->SetDrawOption("E1"); + hAvTotVsRun->SetMarkerStyle(22); - TH1F * hPeakTotVsRun=new TH1F("hPeakTotVsRun"," (gaussian fit);;ToT_{peak} (ns)",nRuns,0., nRuns);//, 50, 0. , 50.); - hPeakTotVsRun->SetDrawOption("E1"); - hPeakTotVsRun->SetMarkerStyle(22); + TH1F * hPeakTotVsRun=new TH1F("hPeakTotVsRun"," (gaussian fit);;ToT_{peak} (ns)",nRuns,0., nRuns);//, 50, 0. , 50.); + hPeakTotVsRun->SetDrawOption("E1"); + hPeakTotVsRun->SetMarkerStyle(22); - TH1F * hSpreadTotVsRun=new TH1F("hSpreadTotVsRun","#sigma(ToT) (gaussian fit);#sigma(ToT) (ns)",nRuns,0., nRuns);//, 50, 0. , 50.); - hSpreadTotVsRun->SetDrawOption("E1"); - hSpreadTotVsRun->SetMarkerStyle(22); + TH1F * hSpreadTotVsRun=new TH1F("hSpreadTotVsRun","#sigma(ToT) (gaussian fit);#sigma(ToT) (ns)",nRuns,0., nRuns);//, 50, 0. , 50.); + hSpreadTotVsRun->SetDrawOption("E1"); + hSpreadTotVsRun->SetMarkerStyle(22); - TH1F * hNegTimeRatioVsRun=new TH1F("hNegTimeRatioVsRun","Ratio of tracks with t^{TOF}<12.5 ns; ; ratio of tracks with t^{TOF}<12.5 ns (%)",nRuns, 0., nRuns);//, 100, 0. , 100.); - hNegTimeRatioVsRun->SetDrawOption("E"); - - TH1F * hOrphansRatioVsRun=new TH1F("hOrphansRatioVsRun","Ratio of orphans (hits with ToT=0); ; ratio of orphans (%)",nRuns, 0., nRuns);//, 1000, 0. , 100.); - hOrphansRatioVsRun->SetDrawOption("E"); - - TH1F * hMeanLVsRun=new TH1F("hMeanLVsRun","Average track length;; (cm)",nRuns, 0., nRuns);//, 350, 350. , 700.); - hMeanLVsRun->SetDrawOption("E"); - TH1F * hNegLRatioVsRun=new TH1F("hNegLRatioVsRun","Ratio of tracks with L<350 cm;; ratio of tracks with L<350 cm (%)",nRuns, 0., nRuns);//, 1000, 0. , 100.); - hNegLRatioVsRun->SetDrawOption("E"); - TH1F * hMatchEffVsRun=new TH1F("hMatchEffVsRun","Matching efficiency (linear fit for p_{T}>1.0 GeV/c);;matching efficiency (pT>1.0 GeV/c)",nRuns, 0., nRuns);//, 100, 0. , 1.); - hMatchEffVsRun->SetDrawOption("E"); - TH1F * hMatchEffVsRunNormToGoodCh=new TH1F("hMatchEffVsRunNormToGoodCh","Matching efficiency normalized to percentage of TOF good channels;;matching efficiency (pT>1.0 GeV/c)",nRuns, 0., nRuns);//, 100, 0. , 1.); - hMatchEffVsRunNormToGoodCh->SetDrawOption("E"); + TH1F * hNegTimeRatioVsRun=new TH1F("hNegTimeRatioVsRun","Ratio of tracks with t^{TOF}<12.5 ns; ; ratio of tracks with t^{TOF}<12.5 ns (%)",nRuns, 0., nRuns);//, 100, 0. , 100.); + hNegTimeRatioVsRun->SetDrawOption("E"); + + TH1F * hOrphansRatioVsRun=new TH1F("hOrphansRatioVsRun","Ratio of orphans (hits with ToT=0); ; ratio of orphans (%)",nRuns, 0., nRuns);//, 1000, 0. , 100.); + hOrphansRatioVsRun->SetDrawOption("E"); + + TH1F * hMeanLVsRun=new TH1F("hMeanLVsRun","Average track length;; (cm)",nRuns, 0., nRuns);//, 350, 350. , 700.); + hMeanLVsRun->SetDrawOption("E"); + TH1F * hNegLRatioVsRun=new TH1F("hNegLRatioVsRun","Ratio of tracks with L<350 cm;; ratio of tracks with L<350 cm (%)",nRuns, 0., nRuns);//, 1000, 0. , 100.); + hNegLRatioVsRun->SetDrawOption("E"); + TH1F * hMatchEffVsRun=new TH1F("hMatchEffVsRun","Matching efficiency (linear fit for p_{T}>1.0 GeV/c);;matching efficiency (pT>1.0 GeV/c)",nRuns, 0., nRuns);//, 100, 0. , 1.); + hMatchEffVsRun->SetDrawOption("E"); + TH1F * hMatchEffVsRunNormToGoodCh=new TH1F("hMatchEffVsRunNormToGoodCh","Matching efficiency normalized to percentage of TOF good channels;;matching efficiency (pT>1.0 GeV/c)",nRuns, 0., nRuns);//, 100, 0. , 1.); + hMatchEffVsRunNormToGoodCh->SetDrawOption("E"); - TH1F * hMatchEffVsRun1=new TH1F("hMatchEffVsRun1","Matching efficiency (value for p_{T}=1.0 GeV/c);;matching efficiency (pT=1.0 GeV/c)",nRuns, 0., nRuns); - hMatchEffVsRun1->SetDrawOption("E"); - TH1F * hPeakT0AVsRun=new TH1F("hPeakT0AVsRun","Peak value of T0A (gaussian fit);;t0A (ps)",nRuns,0., nRuns); - TH1F * hPeakT0CVsRun=new TH1F("hPeakT0CVsRun","Peak value of T0C (gaussian fit);;t0AC (ps)",nRuns,0., nRuns); - TH1F * hPeakT0ACVsRun=new TH1F("hPeakT0ACVsRun","Peak value of T0AC (gaussian fit);;t0AC (ps)",nRuns,0., nRuns); - TH1F * hT0fillResVsRun=new TH1F("hT0fillResVsRun","t0_fill spread;;t0_spread (ps)",nRuns,0., nRuns); + TH1F * hMatchEffVsRun1=new TH1F("hMatchEffVsRun1","Matching efficiency (value for p_{T}=1.0 GeV/c);;matching efficiency (pT=1.0 GeV/c)",nRuns, 0., nRuns); + hMatchEffVsRun1->SetDrawOption("E"); + TH1F * hPeakT0AVsRun=new TH1F("hPeakT0AVsRun","Peak value of T0A (gaussian fit);;t0A (ps)",nRuns,0., nRuns); + TH1F * hPeakT0CVsRun=new TH1F("hPeakT0CVsRun","Peak value of T0C (gaussian fit);;t0AC (ps)",nRuns,0., nRuns); + TH1F * hPeakT0ACVsRun=new TH1F("hPeakT0ACVsRun","Peak value of T0AC (gaussian fit);;t0AC (ps)",nRuns,0., nRuns); + TH1F * hT0fillResVsRun=new TH1F("hT0fillResVsRun","t0_fill spread;;t0_spread (ps)",nRuns,0., nRuns); - lista.Add(hAvMulti); - lista.Add(hAvDiffTimeVsRun); - lista.Add(hPeakDiffTimeVsRun); - lista.Add(hSpreadDiffTimeVsRun); - lista.Add(hAvTimeVsRun); - lista.Add(hPeakTimeVsRun); - lista.Add(hSpreadTimeVsRun); - lista.Add(hAvRawTimeVsRun); - lista.Add(hPeakRawTimeVsRun); - lista.Add(hSpreadRawTimeVsRun); - lista.Add(hAvTotVsRun); - lista.Add(hPeakTotVsRun); - lista.Add(hSpreadTotVsRun); - lista.Add(hNegTimeRatioVsRun); - lista.Add(hOrphansRatioVsRun); - lista.Add(hMeanLVsRun); - lista.Add(hNegLRatioVsRun); - lista.Add(hMatchEffVsRun); - lista.Add(hMatchEffVsRunNormToGoodCh); - lista.Add(hPeakT0AVsRun); - lista.Add(hPeakT0CVsRun); - lista.Add(hPeakT0ACVsRun); - lista.Add(hT0fillResVsRun); - char runlabel[6]; + lista.Add(hAvMulti); + lista.Add(hAvDiffTimeVsRun); + lista.Add(hPeakDiffTimeVsRun); + lista.Add(hSpreadDiffTimeVsRun); + lista.Add(hAvTimeVsRun); + lista.Add(hPeakTimeVsRun); + lista.Add(hSpreadTimeVsRun); + lista.Add(hAvRawTimeVsRun); + lista.Add(hPeakRawTimeVsRun); + lista.Add(hSpreadRawTimeVsRun); + lista.Add(hAvTotVsRun); + lista.Add(hPeakTotVsRun); + lista.Add(hSpreadTotVsRun); + lista.Add(hNegTimeRatioVsRun); + lista.Add(hOrphansRatioVsRun); + lista.Add(hMeanLVsRun); + lista.Add(hNegLRatioVsRun); + lista.Add(hMatchEffVsRun); + lista.Add(hMatchEffVsRunNormToGoodCh); + lista.Add(hPeakT0AVsRun); + lista.Add(hPeakT0CVsRun); + lista.Add(hPeakT0ACVsRun); + lista.Add(hT0fillResVsRun); + char runlabel[6]; - for (Int_t irun=0;irunGetEntry(irun); + for (Int_t irun=0;irunGetEntry(irun); - sprintf(runlabel,"%i",runNumber); + sprintf(runlabel,"%i",runNumber); - hAvMulti->SetBinContent(irun+1, avMulti); - hAvMulti->GetXaxis()->SetBinLabel(irun+1,runlabel); + hAvMulti->SetBinContent(irun+1, avMulti); + hAvMulti->GetXaxis()->SetBinLabel(irun+1,runlabel); - hAvDiffTimeVsRun->SetBinContent(irun+1, avDiffTime); - hAvDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + hAvDiffTimeVsRun->SetBinContent(irun+1, avDiffTime); + hAvDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - hPeakDiffTimeVsRun->SetBinContent(irun+1,peakDiffTime); - hPeakDiffTimeVsRun->SetBinError(irun+1,peakDiffTimeErr); - hPeakDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + hPeakDiffTimeVsRun->SetBinContent(irun+1,peakDiffTime); + hPeakDiffTimeVsRun->SetBinError(irun+1,peakDiffTimeErr); + hPeakDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - hSpreadDiffTimeVsRun->SetBinContent(irun+1,spreadDiffTime); - hSpreadDiffTimeVsRun->SetBinError(irun+1,spreadDiffTimeErr); - hSpreadDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + hSpreadDiffTimeVsRun->SetBinContent(irun+1,spreadDiffTime); + hSpreadDiffTimeVsRun->SetBinError(irun+1,spreadDiffTimeErr); + hSpreadDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - hAvTimeVsRun->SetBinContent(irun+1, avTime); - hAvTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + hAvTimeVsRun->SetBinContent(irun+1, avTime); + hAvTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - hPeakTimeVsRun->SetBinContent(irun+1,peakTime); - hPeakTimeVsRun->SetBinError(irun+1,peakTimeErr); - hPeakTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + hPeakTimeVsRun->SetBinContent(irun+1,peakTime); + hPeakTimeVsRun->SetBinError(irun+1,peakTimeErr); + hPeakTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - hSpreadTimeVsRun->SetBinContent(irun+1,spreadTime); - hSpreadTimeVsRun->SetBinError(irun+1,spreadTimeErr); - hSpreadTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + hSpreadTimeVsRun->SetBinContent(irun+1,spreadTime); + hSpreadTimeVsRun->SetBinError(irun+1,spreadTimeErr); + hSpreadTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - hAvRawTimeVsRun->SetBinContent(irun+1, avRawTime); - hAvRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + hAvRawTimeVsRun->SetBinContent(irun+1, avRawTime); + hAvRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - hPeakRawTimeVsRun->SetBinContent(irun+1,peakRawTime); - hPeakRawTimeVsRun->SetBinError(irun+1,peakRawTimeErr); - hPeakRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + hPeakRawTimeVsRun->SetBinContent(irun+1,peakRawTime); + hPeakRawTimeVsRun->SetBinError(irun+1,peakRawTimeErr); + hPeakRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - hSpreadRawTimeVsRun->SetBinContent(irun+1,spreadRawTime); - hSpreadRawTimeVsRun->SetBinError(irun+1,spreadRawTimeErr); - hSpreadRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + hSpreadRawTimeVsRun->SetBinContent(irun+1,spreadRawTime); + hSpreadRawTimeVsRun->SetBinError(irun+1,spreadRawTimeErr); + hSpreadRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - hAvTotVsRun->SetBinContent(irun+1,avTot); - hAvTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + hAvTotVsRun->SetBinContent(irun+1,avTot); + hAvTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - hPeakTotVsRun->SetBinContent(irun+1,peakTot); - hPeakTotVsRun->SetBinError(irun+1,peakTotErr); - hPeakTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + hPeakTotVsRun->SetBinContent(irun+1,peakTot); + hPeakTotVsRun->SetBinError(irun+1,peakTotErr); + hPeakTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - hSpreadTotVsRun->SetBinContent(irun+1,spreadTot); - hSpreadTotVsRun->SetBinError(irun+1,spreadTotErr); - hSpreadTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + hSpreadTotVsRun->SetBinContent(irun+1,spreadTot); + hSpreadTotVsRun->SetBinError(irun+1,spreadTotErr); + hSpreadTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - hNegTimeRatioVsRun->SetBinContent(irun+1,negTimeRatio); - hNegTimeRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + hNegTimeRatioVsRun->SetBinContent(irun+1,negTimeRatio); + hNegTimeRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - hOrphansRatioVsRun->SetBinContent(irun+1,orphansRatio); - hOrphansRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + hOrphansRatioVsRun->SetBinContent(irun+1,orphansRatio); + hOrphansRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - hMeanLVsRun->SetBinContent(irun+1,avL); - hMeanLVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + hMeanLVsRun->SetBinContent(irun+1,avL); + hMeanLVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - hNegLRatioVsRun->SetBinContent(irun+1,negLratio); - hNegLRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - - hMatchEffVsRun->SetBinContent(irun+1,matchEffLinFit1Gev); - hMatchEffVsRun->SetBinError(irun+1,matchEffLinFit1GevErr); - hMatchEffVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - hMatchEffVsRun->SetLineColor(kRed); - hMatchEffVsRun->SetLineWidth(2); - - if (goodChannelRatio>0) - hMatchEffVsRunNormToGoodCh->SetBinContent(irun+1,matchEffLinFit1Gev/goodChannelRatio); - else - hMatchEffVsRunNormToGoodCh->SetBinContent(irun+1, 0.0); - hMatchEffVsRunNormToGoodCh->SetBinError(irun+1,matchEffLinFit1GevErr); - hMatchEffVsRunNormToGoodCh->GetXaxis()->SetBinLabel(irun+1,runlabel); - hMatchEffVsRunNormToGoodCh->SetLineColor(kBlue); - hMatchEffVsRunNormToGoodCh->SetLineWidth(2); + hNegLRatioVsRun->SetBinContent(irun+1,negLratio); + hNegLRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + + hMatchEffVsRun->SetBinContent(irun+1,matchEffLinFit1Gev); + hMatchEffVsRun->SetBinError(irun+1,matchEffLinFit1GevErr); + hMatchEffVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + hMatchEffVsRun->SetLineColor(kRed); + hMatchEffVsRun->SetLineWidth(2); + + if (goodChannelRatio>0) + hMatchEffVsRunNormToGoodCh->SetBinContent(irun+1,matchEffLinFit1Gev/goodChannelRatio); + else + hMatchEffVsRunNormToGoodCh->SetBinContent(irun+1, 0.0); + hMatchEffVsRunNormToGoodCh->SetBinError(irun+1,matchEffLinFit1GevErr); + hMatchEffVsRunNormToGoodCh->GetXaxis()->SetBinLabel(irun+1,runlabel); + hMatchEffVsRunNormToGoodCh->SetLineColor(kBlue); + hMatchEffVsRunNormToGoodCh->SetLineWidth(2); - hPeakT0AVsRun->SetBinContent(irun+1,peakT0A); - hPeakT0AVsRun->SetBinError(irun+1,spreadT0A); - hPeakT0AVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + hPeakT0AVsRun->SetBinContent(irun+1,peakT0A); + hPeakT0AVsRun->SetBinError(irun+1,spreadT0A); + hPeakT0AVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - hPeakT0CVsRun->SetBinContent(irun+1,peakT0C); - hPeakT0CVsRun->SetBinError(irun+1,spreadT0C); - hPeakT0CVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + hPeakT0CVsRun->SetBinContent(irun+1,peakT0C); + hPeakT0CVsRun->SetBinError(irun+1,spreadT0C); + hPeakT0CVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - hPeakT0ACVsRun->SetBinContent(irun+1,peakT0AC); - hPeakT0ACVsRun->SetBinError(irun+1,spreadT0AC); - hPeakT0ACVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + hPeakT0ACVsRun->SetBinContent(irun+1,peakT0AC); + hPeakT0ACVsRun->SetBinError(irun+1,spreadT0AC); + hPeakT0ACVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - hT0fillResVsRun->SetBinContent(irun+1,avT0fillRes); - hT0fillResVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); - } + hT0fillResVsRun->SetBinContent(irun+1,avT0fillRes); + hT0fillResVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); + } - char outfilename[200]; - sprintf(outfilename, "trend_%s",trendFileName); - TFile * fout=new TFile(outfilename,"recreate"); - fout->cd(); - lista.Write(); - fout->Close(); + char outfilename[200]; + sprintf(outfilename, "trend_%s",trendFileName); + TFile * fout=new TFile(outfilename,"recreate"); + fout->cd(); + lista.Write(); + fout->Close(); - TString plotDir(Form("PlotsTrending")); - gSystem->Exec(Form("mkdir %s",plotDir.Data())); + TString plotDir(Form("PlotsTrending")); + gSystem->Exec(Form("mkdir %s",plotDir.Data())); - TCanvas* cPeakDiffTimeVsRun = new TCanvas("cPeakDiffTimeVsRun","cPeakDiffTimeVsRun", 50,50,750,550); - hPeakDiffTimeVsRun->GetYaxis()->SetRangeUser(-50.,50.); - hPeakDiffTimeVsRun->Draw(); - cPeakDiffTimeVsRun->Print(Form("%s/cPeakDiffTimeVsRun.png",plotDir.Data())); + TCanvas* cPeakDiffTimeVsRun = new TCanvas("cPeakDiffTimeVsRun","cPeakDiffTimeVsRun", 50,50,750,550); + hPeakDiffTimeVsRun->GetYaxis()->SetRangeUser(-50.,50.); + hPeakDiffTimeVsRun->Draw(); + cPeakDiffTimeVsRun->Print(Form("%s/cPeakDiffTimeVsRun.png",plotDir.Data())); - TCanvas* cSpreadDiffTimeVsRun = new TCanvas("cSpreadDiffTimeVsRun","cSpreadDiffTimeVsRun", 50,50,750,550); - hSpreadDiffTimeVsRun->GetYaxis()->SetRangeUser(200.,400.); - hSpreadDiffTimeVsRun->Draw(); - cSpreadDiffTimeVsRun->Print(Form("%s/cSpreadDiffTimeVsRun.png",plotDir.Data())); - - TCanvas* cMatchEffVsRun = new TCanvas("cMatchEffVsRun","cMatchEffVsRun",50, 50, 750,550); - hMatchEffVsRun->GetYaxis()->SetRangeUser(0.,1.); - hMatchEffVsRun->Draw(); - cMatchEffVsRun->Print(Form("%s/cMatchEffVsRun.png",plotDir.Data())); - - TCanvas* cMatchEffNormToGoodCh = new TCanvas("cMatchEffNormToGoodCh","cMatchEffNormToGoodCh",50, 50,750,550); - hMatchEffVsRunNormToGoodCh->GetYaxis()->SetRangeUser(0.,1.); - hMatchEffVsRunNormToGoodCh->Draw(); - cMatchEffNormToGoodCh->Print(Form("%s/cMatchEffNormToGoodCh.png",plotDir.Data())); + TCanvas* cSpreadDiffTimeVsRun = new TCanvas("cSpreadDiffTimeVsRun","cSpreadDiffTimeVsRun", 50,50,750,550); + hSpreadDiffTimeVsRun->GetYaxis()->SetRangeUser(200.,400.); + hSpreadDiffTimeVsRun->Draw(); + cSpreadDiffTimeVsRun->Print(Form("%s/cSpreadDiffTimeVsRun.png",plotDir.Data())); + + TCanvas* cMatchEffVsRun = new TCanvas("cMatchEffVsRun","cMatchEffVsRun",50, 50, 750,550); + hMatchEffVsRun->GetYaxis()->SetRangeUser(0.,1.); + hMatchEffVsRun->Draw(); + cMatchEffVsRun->Print(Form("%s/cMatchEffVsRun.png",plotDir.Data())); + + TCanvas* cMatchEffNormToGoodCh = new TCanvas("cMatchEffNormToGoodCh","cMatchEffNormToGoodCh",50, 50,750,550); + hMatchEffVsRunNormToGoodCh->GetYaxis()->SetRangeUser(0.,1.); + hMatchEffVsRunNormToGoodCh->Draw(); + cMatchEffNormToGoodCh->Print(Form("%s/cMatchEffNormToGoodCh.png",plotDir.Data())); - TCanvas* cPeakT0AVsRun = new TCanvas("cPeakT0AVsRun","cPeakT0AVsRun", 50,50,750,550); - hPeakT0AVsRun->Draw(); - cPeakT0AVsRun->Print(Form("%s/cPeakT0AVsRun.png",plotDir.Data())); - - TCanvas* cPeakT0CVsRun = new TCanvas("cPeakT0CVsRun","cPeakT0CVsRun", 50,50,750,550); - hPeakT0CVsRun->Draw(); - cPeakT0CVsRun->Print(Form("%s/cPeakT0CVsRun.png",plotDir.Data())); - - TCanvas* cPeakT0ACVsRun = new TCanvas("cPeakT0ACVsRun","cPeakT0ACVsRun", 50,50,750,550); - hPeakT0ACVsRun->Draw(); - cPeakT0ACVsRun->Print(Form("%s/cPeakT0ACVsRun.png",plotDir.Data())); - - TCanvas* cT0fillResVsRun = new TCanvas("cT0fillResVsRun","cT0fillResVsRun", 50,50,750,550); - hT0fillResVsRun->Draw(); - cT0fillResVsRun->Print(Form("%s/cT0fillResVsRun.png",plotDir.Data())); - - if (displayAll) { - TCanvas* cAvDiffTimeVsRun = new TCanvas("cAvDiffTimeVsRun","cAvDiffTimeVsRun",50,50,750,550); - gPad->SetGridx(); - gPad->SetGridy(); - hAvDiffTimeVsRun->Draw(); - cAvDiffTimeVsRun->Print(Form("%s/cAvDiffTimeVsRun.png",plotDir.Data())); + TCanvas* cPeakT0AVsRun = new TCanvas("cPeakT0AVsRun","cPeakT0AVsRun", 50,50,750,550); + hPeakT0AVsRun->Draw(); + cPeakT0AVsRun->Print(Form("%s/cPeakT0AVsRun.png",plotDir.Data())); + + TCanvas* cPeakT0CVsRun = new TCanvas("cPeakT0CVsRun","cPeakT0CVsRun", 50,50,750,550); + hPeakT0CVsRun->Draw(); + cPeakT0CVsRun->Print(Form("%s/cPeakT0CVsRun.png",plotDir.Data())); + + TCanvas* cPeakT0ACVsRun = new TCanvas("cPeakT0ACVsRun","cPeakT0ACVsRun", 50,50,750,550); + hPeakT0ACVsRun->Draw(); + cPeakT0ACVsRun->Print(Form("%s/cPeakT0ACVsRun.png",plotDir.Data())); + + TCanvas* cT0fillResVsRun = new TCanvas("cT0fillResVsRun","cT0fillResVsRun", 50,50,750,550); + hT0fillResVsRun->Draw(); + cT0fillResVsRun->Print(Form("%s/cT0fillResVsRun.png",plotDir.Data())); + + if (displayAll) { + TCanvas* cAvDiffTimeVsRun = new TCanvas("cAvDiffTimeVsRun","cAvDiffTimeVsRun",50,50,750,550); + gPad->SetGridx(); + gPad->SetGridy(); + hAvDiffTimeVsRun->Draw(); + cAvDiffTimeVsRun->Print(Form("%s/cAvDiffTimeVsRun.png",plotDir.Data())); - TCanvas* cAvTimeVsRun = new TCanvas("cAvTimeVsRun","cAvTimeVsRun", 50,50,750,550); - hAvTimeVsRun->Draw(); - cAvTimeVsRun->Print(Form("%s/cAvTimeVsRun.png",plotDir.Data())); + TCanvas* cAvTimeVsRun = new TCanvas("cAvTimeVsRun","cAvTimeVsRun", 50,50,750,550); + hAvTimeVsRun->Draw(); + cAvTimeVsRun->Print(Form("%s/cAvTimeVsRun.png",plotDir.Data())); - TCanvas* cPeakTimeVsRun = new TCanvas("cPeakTimeVsRun","cPeakTimeVsRun", 50,50,750,550); - hPeakTimeVsRun->Draw(); - cPeakTimeVsRun->Print(Form("%s/cPeakTimeVsRun.png",plotDir.Data())); + TCanvas* cPeakTimeVsRun = new TCanvas("cPeakTimeVsRun","cPeakTimeVsRun", 50,50,750,550); + hPeakTimeVsRun->Draw(); + cPeakTimeVsRun->Print(Form("%s/cPeakTimeVsRun.png",plotDir.Data())); - TCanvas* cSpreadTimeVsRun = new TCanvas("cSpreadTimeVsRun","cSpreadTimeVsRun", 50,50,750,550); - hSpreadTimeVsRun->Draw(); - cSpreadTimeVsRun->Print(Form("%s/cSpreadTimeVsRun.png",plotDir.Data())); + TCanvas* cSpreadTimeVsRun = new TCanvas("cSpreadTimeVsRun","cSpreadTimeVsRun", 50,50,750,550); + hSpreadTimeVsRun->Draw(); + cSpreadTimeVsRun->Print(Form("%s/cSpreadTimeVsRun.png",plotDir.Data())); - TCanvas* cAvRawTimeVsRun = new TCanvas("cAvRawTimeVsRun","cAvRawTimeVsRun", 50,50,750,550); - hAvRawTimeVsRun->Draw(); - cAvRawTimeVsRun->Print(Form("%s/cAvRawTimeVsRun.png",plotDir.Data())); + TCanvas* cAvRawTimeVsRun = new TCanvas("cAvRawTimeVsRun","cAvRawTimeVsRun", 50,50,750,550); + hAvRawTimeVsRun->Draw(); + cAvRawTimeVsRun->Print(Form("%s/cAvRawTimeVsRun.png",plotDir.Data())); - TCanvas* cPeakRawTimeVsRun = new TCanvas("cPeakRawTimeVsRun","cPeakRawTimeVsRun", 50,50,750,550); - hPeakRawTimeVsRun->Draw(); - cPeakRawTimeVsRun->Print(Form("%s/cPeakRawTimeVsRun.png",plotDir.Data())); + TCanvas* cPeakRawTimeVsRun = new TCanvas("cPeakRawTimeVsRun","cPeakRawTimeVsRun", 50,50,750,550); + hPeakRawTimeVsRun->Draw(); + cPeakRawTimeVsRun->Print(Form("%s/cPeakRawTimeVsRun.png",plotDir.Data())); - TCanvas* cSpreadRawTimeVsRun = new TCanvas("cSpreadRawTimeVsRun","cSpreadRawTimeVsRun", 50,50,750,550); - hSpreadRawTimeVsRun->Draw(); - cSpreadRawTimeVsRun->Print(Form("%s/cSpreadRawTimeVsRun.png",plotDir.Data())); + TCanvas* cSpreadRawTimeVsRun = new TCanvas("cSpreadRawTimeVsRun","cSpreadRawTimeVsRun", 50,50,750,550); + hSpreadRawTimeVsRun->Draw(); + cSpreadRawTimeVsRun->Print(Form("%s/cSpreadRawTimeVsRun.png",plotDir.Data())); - TCanvas* cAvTotVsRun = new TCanvas("cAvTotVsRun","cAvTotVsRun", 50,50,750,550); - hAvTotVsRun->Draw(); - cAvTotVsRun->Print(Form("%s/cAvTotVsRun.png",plotDir.Data())); + TCanvas* cAvTotVsRun = new TCanvas("cAvTotVsRun","cAvTotVsRun", 50,50,750,550); + hAvTotVsRun->Draw(); + cAvTotVsRun->Print(Form("%s/cAvTotVsRun.png",plotDir.Data())); - TCanvas* cPeakTotVsRun = new TCanvas("cPeakTotVsRun","cPeakTotVsRun", 50,50,750,550); - hPeakTotVsRun->Draw(); - cPeakTotVsRun->Print(Form("%s/cPeakTotVsRun.png",plotDir.Data())); + TCanvas* cPeakTotVsRun = new TCanvas("cPeakTotVsRun","cPeakTotVsRun", 50,50,750,550); + hPeakTotVsRun->Draw(); + cPeakTotVsRun->Print(Form("%s/cPeakTotVsRun.png",plotDir.Data())); - TCanvas* cSpreadTotVsRun = new TCanvas("cSpreadTotVsRun","cSpreadTotVsRun", 50,50,750,550); - hSpreadTotVsRun->Draw(); - cSpreadTotVsRun->Print(Form("%s/cSpreadTotVsRun.png",plotDir.Data())); + TCanvas* cSpreadTotVsRun = new TCanvas("cSpreadTotVsRun","cSpreadTotVsRun", 50,50,750,550); + hSpreadTotVsRun->Draw(); + cSpreadTotVsRun->Print(Form("%s/cSpreadTotVsRun.png",plotDir.Data())); - TCanvas* cNegTimeRatioVsRun = new TCanvas("cNegTimeRatioVsRun","cNegTimeRatioVsRun", 50,50,750,550); - hNegTimeRatioVsRun->Draw(); - cNegTimeRatioVsRun->Print(Form("%s/cNegTimeRatioVsRun.png",plotDir.Data())); + TCanvas* cNegTimeRatioVsRun = new TCanvas("cNegTimeRatioVsRun","cNegTimeRatioVsRun", 50,50,750,550); + hNegTimeRatioVsRun->Draw(); + cNegTimeRatioVsRun->Print(Form("%s/cNegTimeRatioVsRun.png",plotDir.Data())); - TCanvas* cOrphansRatioVsRun = new TCanvas("cOrphansRatioVsRun","cOrphansRatioVsRun", 50,50,750,550); - hOrphansRatioVsRun->Draw(); - cOrphansRatioVsRun->Print(Form("%s/cOrphansRatioVsRun.png",plotDir.Data())); + TCanvas* cOrphansRatioVsRun = new TCanvas("cOrphansRatioVsRun","cOrphansRatioVsRun", 50,50,750,550); + hOrphansRatioVsRun->Draw(); + cOrphansRatioVsRun->Print(Form("%s/cOrphansRatioVsRun.png",plotDir.Data())); - TCanvas* cMeanLVsRun = new TCanvas("cMeanLVsRun","cMeanLVsRun", 50,50,750,550); - hMeanLVsRun->Draw(); - cMeanLVsRun->Print(Form("%s/cMeanLVsRun.png",plotDir.Data())); + TCanvas* cMeanLVsRun = new TCanvas("cMeanLVsRun","cMeanLVsRun", 50,50,750,550); + hMeanLVsRun->Draw(); + cMeanLVsRun->Print(Form("%s/cMeanLVsRun.png",plotDir.Data())); - TCanvas* cNegLRatioVsRun = new TCanvas("cNegLRatioVsRun","cNegLRatioVsRun", 50,50,750,550); - hNegLRatioVsRun->Draw(); - cNegLRatioVsRun->Print(Form("%s/cNegLRatioVsRun.png",plotDir.Data())); - } + TCanvas* cNegLRatioVsRun = new TCanvas("cNegLRatioVsRun","cNegLRatioVsRun", 50,50,750,550); + hNegLRatioVsRun->Draw(); + cNegLRatioVsRun->Print(Form("%s/cNegLRatioVsRun.png",plotDir.Data())); + } - return 0; + return 0; } //------------------------------------------------------------------------- Int_t MakePostQAtree(Int_t runNumber, Bool_t isMC=kFALSE, char * postFileName="postQA.0.root",char * treePostFileName="treePostQA.0.root", Bool_t includeStartTime=kTRUE){ - TFile *postfile=TFile::Open(postFileName); - if (!postfile) { - printf("Post-analysis output not found - cannot perform trending analysis. Exiting."); - return -1; - } - Printf("============== Getting post-analysis info for run %i ===============\n",runNumber); - TFile * trendFile=new TFile(treePostFileName,"recreate"); - - Double_t avTime=-9999., peakTime=-9999., spreadTime=-9999., peakTimeErr=-9999., spreadTimeErr=-9999., negTimeRatio=-9999., - avRawTime=-9999., peakRawTime=-9999., spreadRawTime=-9999., peakRawTimeErr=-9999., spreadRawTimeErr=-9999., - avTot=-9999., peakTot=-9999.,spreadTot=-9999., peakTotErr=-9999.,spreadTotErr=-9999., - orphansRatio=-9999., avL=-9999., negLratio=-9999., - effPt1=-9999., effPt2=-9999., matchEffLinFit1Gev=-9999.,matchEffLinFit1GevErr=-9999.; + TFile *postfile=TFile::Open(postFileName); + if (!postfile) { + printf("Post-analysis output not found - cannot perform trending analysis. Exiting."); + return -1; + } + Printf("============== Getting post-analysis info for run %i ===============\n",runNumber); + TFile * trendFile=new TFile(treePostFileName,"recreate"); + + Double_t avTime=-9999., peakTime=-9999., spreadTime=-9999., peakTimeErr=-9999., spreadTimeErr=-9999., negTimeRatio=-9999., + avRawTime=-9999., peakRawTime=-9999., spreadRawTime=-9999., peakRawTimeErr=-9999., spreadRawTimeErr=-9999., + avTot=-9999., peakTot=-9999.,spreadTot=-9999., peakTotErr=-9999.,spreadTotErr=-9999., + orphansRatio=-9999., avL=-9999., negLratio=-9999., + effPt1=-9999., effPt2=-9999., matchEffLinFit1Gev=-9999.,matchEffLinFit1GevErr=-9999.; - Double_t avPiDiffTime=-9999.,peakPiDiffTime=-9999., spreadPiDiffTime=-9999.,peakPiDiffTimeErr=-9999., spreadPiDiffTimeErr=-9999.; + Double_t avPiDiffTime=-9999.,peakPiDiffTime=-9999., spreadPiDiffTime=-9999.,peakPiDiffTimeErr=-9999., spreadPiDiffTimeErr=-9999.; - Double_t avT0A=-9999.,peakT0A=-9999., spreadT0A=-9999.,peakT0AErr=-9999., spreadT0AErr=-9999.; - Double_t avT0C=-9999.,peakT0C=-9999., spreadT0C=-9999.,peakT0CErr=-9999., spreadT0CErr=-9999.; - Double_t avT0AC=-9999.,peakT0AC=-9999., spreadT0AC=-9999.,peakT0ACErr=-9999., spreadT0ACErr=-9999.; - Double_t avT0res=-9999.,peakT0res=-9999., spreadT0res=-9999.,peakT0resErr=-9999., spreadT0resErr=-9999.; - Double_t avT0fillRes=-9999.; - - Float_t avMulti=0; - Float_t fractionEventsWHits=-9999.; - /*number of good (HW ok && efficient && !noisy) TOF channels from OCDB*/ - Double_t goodChannelRatio=0.0; - - TTree * ttree=new TTree("trendTree","tree of trending variables"); - ttree->Branch("run",&runNumber,"run/I"); - ttree->Branch("avMulti",&avMulti,"avMulti/F"); - ttree->Branch("fractionEventsWHits",&fractionEventsWHits,"fractionEventsWHits/F"); - ttree->Branch("goodChannelsRatio",&goodChannelRatio,"goodChannelRatio/D"); - ttree->Branch("avTime",&avTime,"avTime/D"); //mean time - ttree->Branch("peakTime",&peakTime,"peakTime/D"); //main peak time after fit - ttree->Branch("spreadTime",&spreadTime,"spreadTime/D"); //spread of main peak of time after fit - ttree->Branch("peakTimeErr",&peakTimeErr,"peakTimeErr/D"); //main peak time after fit error - ttree->Branch("spreadTimeErr",&spreadTimeErr,"spreadTimeErr/D"); //spread of main peak of time after fit error - ttree->Branch("negTimeRatio",&negTimeRatio,"negTimeRatio/D"); //negative time ratio + Double_t avT0A=-9999.,peakT0A=-9999., spreadT0A=-9999.,peakT0AErr=-9999., spreadT0AErr=-9999.; + Double_t avT0C=-9999.,peakT0C=-9999., spreadT0C=-9999.,peakT0CErr=-9999., spreadT0CErr=-9999.; + Double_t avT0AC=-9999.,peakT0AC=-9999., spreadT0AC=-9999.,peakT0ACErr=-9999., spreadT0ACErr=-9999.; + Double_t avT0res=-9999.,peakT0res=-9999., spreadT0res=-9999.,peakT0resErr=-9999., spreadT0resErr=-9999.; + Double_t avT0fillRes=-9999.; + + Float_t avMulti=0; + Float_t fractionEventsWHits=-9999.; + /*number of good (HW ok && efficient && !noisy) TOF channels from OCDB*/ + Double_t goodChannelRatio=0.0; + + TTree * ttree=new TTree("trendTree","tree of trending variables"); + ttree->Branch("run",&runNumber,"run/I"); + ttree->Branch("avMulti",&avMulti,"avMulti/F"); + ttree->Branch("fractionEventsWHits",&fractionEventsWHits,"fractionEventsWHits/F"); + ttree->Branch("goodChannelsRatio",&goodChannelRatio,"goodChannelRatio/D"); + ttree->Branch("avTime",&avTime,"avTime/D"); //mean time + ttree->Branch("peakTime",&peakTime,"peakTime/D"); //main peak time after fit + ttree->Branch("spreadTime",&spreadTime,"spreadTime/D"); //spread of main peak of time after fit + ttree->Branch("peakTimeErr",&peakTimeErr,"peakTimeErr/D"); //main peak time after fit error + ttree->Branch("spreadTimeErr",&spreadTimeErr,"spreadTimeErr/D"); //spread of main peak of time after fit error + ttree->Branch("negTimeRatio",&negTimeRatio,"negTimeRatio/D"); //negative time ratio - ttree->Branch("avRawTime",&avRawTime,"avRawTime/D"); //mean raw time - ttree->Branch("peakRawTime",&peakRawTime,"peakRawTime/D"); //mean peak of RAW TIME after fit - ttree->Branch("spreadRawTime",&spreadRawTime,"spreadRawTime/D"); //spread of main peak of raw time after fit - ttree->Branch("peakRawTimeErr",&peakRawTimeErr,"peakRawTimeErr/D"); //main peak raw time after fit error - ttree->Branch("spreadRawTimeErr",&spreadRawTimeErr,"spreadRawTimeErr/D"); //spread of raw main peak of time after fit error + ttree->Branch("avRawTime",&avRawTime,"avRawTime/D"); //mean raw time + ttree->Branch("peakRawTime",&peakRawTime,"peakRawTime/D"); //mean peak of RAW TIME after fit + ttree->Branch("spreadRawTime",&spreadRawTime,"spreadRawTime/D"); //spread of main peak of raw time after fit + ttree->Branch("peakRawTimeErr",&peakRawTimeErr,"peakRawTimeErr/D"); //main peak raw time after fit error + ttree->Branch("spreadRawTimeErr",&spreadRawTimeErr,"spreadRawTimeErr/D"); //spread of raw main peak of time after fit error - ttree->Branch("avTot",&avTot,"avTot/D"); //main peak tot - ttree->Branch("peakTot",&peakTot,"peakTot/D"); // main peak of tot after fit - ttree->Branch("spreadTot",&spreadTot,"spreadTot/D"); //spread of main peak of tot after fit - ttree->Branch("peakTotErr",&peakTotErr,"peakTotErr/D"); // main peak of tot after fit - ttree->Branch("spreadTotErr",&spreadTotErr,"spreadTotErr/D"); //spread of main peak of tot after fit + ttree->Branch("avTot",&avTot,"avTot/D"); //main peak tot + ttree->Branch("peakTot",&peakTot,"peakTot/D"); // main peak of tot after fit + ttree->Branch("spreadTot",&spreadTot,"spreadTot/D"); //spread of main peak of tot after fit + ttree->Branch("peakTotErr",&peakTotErr,"peakTotErr/D"); // main peak of tot after fit + ttree->Branch("spreadTotErr",&spreadTotErr,"spreadTotErr/D"); //spread of main peak of tot after fit - ttree->Branch("orphansRatio",&orphansRatio,"orphansRatio/D"); //orphans ratio - - ttree->Branch("avL",&avL,"avL/D"); //mean track length - ttree->Branch("negLratio",&negLratio,"negLratio/D");//ratio of tracks with track length <350 cm - ttree->Branch("effPt1",&effPt1,"effPt1/D");//matching eff at 1 GeV/c - ttree->Branch("effPt2",&effPt2,"effPt2/D"); //matching eff at 2 GeV/c - ttree->Branch("matchEffLinFit1Gev",&matchEffLinFit1Gev,"matchEffLinFit1Gev/D");//matching eff fit param - ttree->Branch("matchEffLinFit1GevErr",&matchEffLinFit1GevErr,"matchEffLinFit1GevErr/D");////matching eff fit param error + ttree->Branch("orphansRatio",&orphansRatio,"orphansRatio/D"); //orphans ratio + + ttree->Branch("avL",&avL,"avL/D"); //mean track length + ttree->Branch("negLratio",&negLratio,"negLratio/D");//ratio of tracks with track length <350 cm + ttree->Branch("effPt1",&effPt1,"effPt1/D");//matching eff at 1 GeV/c + ttree->Branch("effPt2",&effPt2,"effPt2/D"); //matching eff at 2 GeV/c + ttree->Branch("matchEffLinFit1Gev",&matchEffLinFit1Gev,"matchEffLinFit1Gev/D");//matching eff fit param + ttree->Branch("matchEffLinFit1GevErr",&matchEffLinFit1GevErr,"matchEffLinFit1GevErr/D");////matching eff fit param error - ttree->Branch("avPiDiffTime",&avPiDiffTime,"avPiDiffTime/D"); //mean t-texp - ttree->Branch("peakPiDiffTime",&peakPiDiffTime,"peakPiDiffTime/D"); //main peak t-texp after fit - ttree->Branch("spreadPiDiffTime",&spreadPiDiffTime,"spreadPiDiffTime/D"); //spread of main peak t-texp after fit - ttree->Branch("peakPiDiffTimeErr",&peakPiDiffTimeErr,"peakPiDiffTimeErr/D"); //main peak t-texp after fit error - ttree->Branch("spreadPiDiffTimeErr",&spreadPiDiffTimeErr,"spreadPiDiffTimeErr/D"); //spread of main peak of t-texp after fit error - - ttree->Branch("avT0A",&avT0A,"avT0A/D"); //main peak t0A - ttree->Branch("peakT0A",&peakT0A,"peakT0A/D"); // main peak of t0A after fit - ttree->Branch("spreadT0A",&spreadT0A,"spreadTot/D"); //spread of main peak of t0A after fit - ttree->Branch("peakT0AErr",&peakT0AErr,"peakT0AErr/D"); // main peak of t0A after fit - ttree->Branch("spreadT0AErr",&spreadT0AErr,"spreadT0AErr/D"); //spread of main peak of t0A after fit - - ttree->Branch("avT0C",&avT0C,"avT0C/D"); //main peak t0C - ttree->Branch("peakT0C",&peakT0C,"peakT0C/D"); // main peak of t0C after fit - ttree->Branch("spreadT0C",&spreadT0C,"spreadT0C/D"); //spread of main peak of t0C after fit - ttree->Branch("peakT0CErr",&peakT0CErr,"peakT0CErr/D"); // main peak of t0C after fit - ttree->Branch("spreadT0CErr",&spreadT0CErr,"spreadT0CErr/D"); //spread of main peak of t0C after fit + ttree->Branch("avPiDiffTime",&avPiDiffTime,"avPiDiffTime/D"); //mean t-texp + ttree->Branch("peakPiDiffTime",&peakPiDiffTime,"peakPiDiffTime/D"); //main peak t-texp after fit + ttree->Branch("spreadPiDiffTime",&spreadPiDiffTime,"spreadPiDiffTime/D"); //spread of main peak t-texp after fit + ttree->Branch("peakPiDiffTimeErr",&peakPiDiffTimeErr,"peakPiDiffTimeErr/D"); //main peak t-texp after fit error + ttree->Branch("spreadPiDiffTimeErr",&spreadPiDiffTimeErr,"spreadPiDiffTimeErr/D"); //spread of main peak of t-texp after fit error + + ttree->Branch("avT0A",&avT0A,"avT0A/D"); //main peak t0A + ttree->Branch("peakT0A",&peakT0A,"peakT0A/D"); // main peak of t0A after fit + ttree->Branch("spreadT0A",&spreadT0A,"spreadTot/D"); //spread of main peak of t0A after fit + ttree->Branch("peakT0AErr",&peakT0AErr,"peakT0AErr/D"); // main peak of t0A after fit + ttree->Branch("spreadT0AErr",&spreadT0AErr,"spreadT0AErr/D"); //spread of main peak of t0A after fit + + ttree->Branch("avT0C",&avT0C,"avT0C/D"); //main peak t0C + ttree->Branch("peakT0C",&peakT0C,"peakT0C/D"); // main peak of t0C after fit + ttree->Branch("spreadT0C",&spreadT0C,"spreadT0C/D"); //spread of main peak of t0C after fit + ttree->Branch("peakT0CErr",&peakT0CErr,"peakT0CErr/D"); // main peak of t0C after fit + ttree->Branch("spreadT0CErr",&spreadT0CErr,"spreadT0CErr/D"); //spread of main peak of t0C after fit - ttree->Branch("avT0AC",&avT0AC,"avT0AC/D"); //main peak t0AC - ttree->Branch("peakT0AC",&peakT0AC,"peakT0AC/D"); // main peak of t0AC after fit - ttree->Branch("spreadT0AC",&spreadT0AC,"spreadT0AC/D"); //spread of main peak of t0AC after fit - ttree->Branch("peakT0ACErr",&peakT0ACErr,"peakT0ACErr/D"); // main peak of t0AC after fit - ttree->Branch("spreadT0ACErr",&spreadT0ACErr,"spreadT0ACErr/D"); //spread of main peak of t0AC after fit + ttree->Branch("avT0AC",&avT0AC,"avT0AC/D"); //main peak t0AC + ttree->Branch("peakT0AC",&peakT0AC,"peakT0AC/D"); // main peak of t0AC after fit + ttree->Branch("spreadT0AC",&spreadT0AC,"spreadT0AC/D"); //spread of main peak of t0AC after fit + ttree->Branch("peakT0ACErr",&peakT0ACErr,"peakT0ACErr/D"); // main peak of t0AC after fit + ttree->Branch("spreadT0ACErr",&spreadT0ACErr,"spreadT0ACErr/D"); //spread of main peak of t0AC after fit - ttree->Branch("avT0res",&avT0res,"avT0res/D"); //main peak t0AC - ttree->Branch("peakT0res",&peakT0res,"peakT0res/D"); // main peak of t0AC after fit - ttree->Branch("spreadT0res",&spreadT0res,"spreadT0res/D"); //spread of main peak of t0AC after fit - ttree->Branch("peakT0resErr",&peakT0resErr,"peakT0resErr/D"); // main peak of t0AC after fit - ttree->Branch("spreadT0resErr",&spreadT0resErr,"spreadT0resErr/D"); //spread of main peak of t0AC after fit - ttree->Branch("avT0fillRes",&avT0fillRes,"avT0fillRes/D"); //t0 fill res - - //postfile->ls(); - //save quantities for trending - goodChannelRatio=(Double_t)GetGoodTOFChannelsRatio(runNumber); + ttree->Branch("avT0res",&avT0res,"avT0res/D"); //main peak t0AC + ttree->Branch("peakT0res",&peakT0res,"peakT0res/D"); // main peak of t0AC after fit + ttree->Branch("spreadT0res",&spreadT0res,"spreadT0res/D"); //spread of main peak of t0AC after fit + ttree->Branch("peakT0resErr",&peakT0resErr,"peakT0resErr/D"); // main peak of t0AC after fit + ttree->Branch("spreadT0resErr",&spreadT0resErr,"spreadT0resErr/D"); //spread of main peak of t0AC after fit + ttree->Branch("avT0fillRes",&avT0fillRes,"avT0fillRes/D"); //t0 fill res + + //postfile->ls(); + //save quantities for trending + goodChannelRatio=(Double_t)GetGoodTOFChannelsRatio(runNumber); - //--------------------------------- Multiplicity ----------------------------------// - TH1F*hMulti=(TH1F*)postfile->Get("hTOFmatchedPerEvt"); - if ((hMulti)&&(hMulti->GetEntries()>0)) { - avMulti=hMulti->GetMean(); - } + //--------------------------------- Multiplicity ----------------------------------// + TH1F*hMulti=(TH1F*)postfile->Get("hTOFmatchedPerEvt"); + if ((hMulti)&&(hMulti->GetEntries()>0)) { + avMulti=hMulti->GetMean(); + } - //--------------------------------- T0F signal ----------------------------------// + //--------------------------------- T0F signal ----------------------------------// - TH1F*hTime=(TH1F*)postfile->Get("hTOFmatchedESDtime"); - if ((hTime)&&(hTime->GetEntries()>0)) { - avTime=hTime->GetMean(); - hTime->Fit("landau","","",0.,50.); - peakTime=(hTime->GetFunction("landau"))->GetParameter(1); - spreadTime=(hTime->GetFunction("landau"))->GetParameter(2); - peakTimeErr=(hTime->GetFunction("landau"))->GetParError(1); - spreadTimeErr=(hTime->GetFunction("landau"))->GetParError(2); + TH1F*hTime=(TH1F*)postfile->Get("hTOFmatchedESDtime"); + if ((hTime)&&(hTime->GetEntries()>0)) { + avTime=hTime->GetMean(); + hTime->Fit("landau","","",0.,50.); + peakTime=(hTime->GetFunction("landau"))->GetParameter(1); + spreadTime=(hTime->GetFunction("landau"))->GetParameter(2); + peakTimeErr=(hTime->GetFunction("landau"))->GetParError(1); + spreadTimeErr=(hTime->GetFunction("landau"))->GetParError(2); - negTimeRatio=((Double_t)hTime->Integral(1,3)*100.)/((Double_t)hTime->Integral()); - printf("Main peak time (landau): mean = %f +- %f\n",peakTime,peakTimeErr ); - printf("Main peak time (landau): spread = %f +- %f\n",spreadTime,spreadTimeErr ); - printf("Ratio of tracks with time<12.5 ns / total = %f\n",negTimeRatio ); + negTimeRatio=((Double_t)hTime->Integral(1,3)*100.)/((Double_t)hTime->Integral()); + printf("Main peak time (landau): mean = %f +- %f\n",peakTime,peakTimeErr ); + printf("Main peak time (landau): spread = %f +- %f\n",spreadTime,spreadTimeErr ); + printf("Ratio of tracks with time<12.5 ns / total = %f\n",negTimeRatio ); - //add integral of main peak over total - } - printf("---------------------------------------------------------------- \n"); - TH1F * hRawTime = (TH1F*)postfile->Get("hTOFmatchedESDrawTime"); - if ((hRawTime)&&(hRawTime->GetEntries()>0)){ - avRawTime=hRawTime->GetMean(); - if (!isMC){ - hRawTime->Fit("landau","","",200.,250.); - peakRawTime=(hRawTime->GetFunction("landau"))->GetParameter(1); - spreadRawTime=(hRawTime->GetFunction("landau"))->GetParameter(2); - peakRawTimeErr=(hRawTime->GetFunction("landau"))->GetParError(1); - spreadRawTimeErr=(hRawTime->GetFunction("landau"))->GetParError(2); - printf("Main peak raw time (landau): mean = %f +- %f\n",peakTime,peakTimeErr ); - printf("Main peak raw time (landau): spread = %f +- %f\n",spreadRawTime,spreadRawTimeErr ); - } else { - printf("Reminder: Raw time not available in MC simulated data."); - } - } + //add integral of main peak over total + } + printf("---------------------------------------------------------------- \n"); + TH1F * hRawTime = (TH1F*)postfile->Get("hTOFmatchedESDrawTime"); + if ((hRawTime)&&(hRawTime->GetEntries()>0)){ + avRawTime=hRawTime->GetMean(); + if (!isMC){ + hRawTime->Fit("landau","","",200.,250.); + peakRawTime=(hRawTime->GetFunction("landau"))->GetParameter(1); + spreadRawTime=(hRawTime->GetFunction("landau"))->GetParameter(2); + peakRawTimeErr=(hRawTime->GetFunction("landau"))->GetParError(1); + spreadRawTimeErr=(hRawTime->GetFunction("landau"))->GetParError(2); + printf("Main peak raw time (landau): mean = %f +- %f\n",peakTime,peakTimeErr ); + printf("Main peak raw time (landau): spread = %f +- %f\n",spreadRawTime,spreadRawTimeErr ); + } else { + printf("Reminder: Raw time not available in MC simulated data."); + } + } - printf("---------------------------------------------------------------- \n"); + printf("---------------------------------------------------------------- \n"); - TH1F * hTot = (TH1F*)postfile->Get("hTOFmatchedESDToT"); - if ((hTot)&&(hTot->GetEntries()>0)){ - avTot=hTot->GetMean(); - hTot->Fit("gaus","","",0.,50.); - peakTot=(hTot->GetFunction("gaus"))->GetParameter(1); - spreadTot=(hTot->GetFunction("gaus"))->GetParameter(2); - peakTotErr=(hTot->GetFunction("gaus"))->GetParError(1); - spreadTotErr=(hTot->GetFunction("gaus"))->GetParError(2); - printf("Main peak ToT (gaus): mean = %f +- %f\n",peakTot,peakTotErr ); - printf("Main peak ToT (gaus): spread = %f +- %f\n",spreadTot,spreadTotErr ); - } - printf("---------------------------------------------------------------- \n"); - TH1F * hOrphansRatio=(TH1F*)postfile->Get("hOrphansRatio"); - if (hOrphansRatio) - orphansRatio=hOrphansRatio->GetMean(); + TH1F * hTot = (TH1F*)postfile->Get("hTOFmatchedESDToT"); + if ((hTot)&&(hTot->GetEntries()>0)){ + avTot=hTot->GetMean(); + hTot->Fit("gaus","","",0.,50.); + peakTot=(hTot->GetFunction("gaus"))->GetParameter(1); + spreadTot=(hTot->GetFunction("gaus"))->GetParameter(2); + peakTotErr=(hTot->GetFunction("gaus"))->GetParError(1); + spreadTotErr=(hTot->GetFunction("gaus"))->GetParError(2); + printf("Main peak ToT (gaus): mean = %f +- %f\n",peakTot,peakTotErr ); + printf("Main peak ToT (gaus): spread = %f +- %f\n",spreadTot,spreadTotErr ); + } + printf("---------------------------------------------------------------- \n"); + TH1F * hOrphansRatio=(TH1F*)postfile->Get("hOrphansRatio"); + if (hOrphansRatio) + orphansRatio=hOrphansRatio->GetMean(); - TH1F * hL=(TH1F*)postfile->Get("hTOFmatchedESDtrkLength"); - if (hL) - avL=hL->GetMean(); + TH1F * hL=(TH1F*)postfile->Get("hTOFmatchedESDtrkLength"); + if (hL) + avL=hL->GetMean(); - TH1F *hLnegRatio =(TH1F*)postfile->Get("hLnegRatio"); - if (hLnegRatio) - negLratio=hLnegRatio->GetMean(); + TH1F *hLnegRatio =(TH1F*)postfile->Get("hLnegRatio"); + if (hLnegRatio) + negLratio=hLnegRatio->GetMean(); - //--------------------------------- matching eff ----------------------------------// + //--------------------------------- matching eff ----------------------------------// - //Double_t linFitEff1Param[3]={0.,0.,0.}; - TH1F *hMatchingVsPt =(TH1F*)postfile->Get("hTOFmatchedESDPt"); - if (hMatchingVsPt) { - if (hMatchingVsPt->GetEntries()>0){ - hMatchingVsPt->Fit("pol0","","",1.0,5.); - hMatchingVsPt->Draw(); - if (hMatchingVsPt->GetFunction("pol0")){ - matchEffLinFit1Gev=(hMatchingVsPt->GetFunction("pol0"))->GetParameter(0); - matchEffLinFit1GevErr=(hMatchingVsPt->GetFunction("pol0"))->GetParError(0); - printf("Matching efficiency fit param is %f +- %f\n",matchEffLinFit1Gev,matchEffLinFit1GevErr ); - } - } else { - printf("WARNING: matching efficiency plot has 0 entries. Skipped!\n"); - } - } else { - printf("WARNING: cannot retrieve matching efficiency plot\n"); - } + //Double_t linFitEff1Param[3]={0.,0.,0.}; + TH1F *hMatchingVsPt =(TH1F*)postfile->Get("hTOFmatchedESDPt"); + if (hMatchingVsPt) { + if (hMatchingVsPt->GetEntries()>0){ + hMatchingVsPt->Fit("pol0","","",1.0,5.); + hMatchingVsPt->Draw(); + if (hMatchingVsPt->GetFunction("pol0")){ + matchEffLinFit1Gev=(hMatchingVsPt->GetFunction("pol0"))->GetParameter(0); + matchEffLinFit1GevErr=(hMatchingVsPt->GetFunction("pol0"))->GetParError(0); + printf("Matching efficiency fit param is %f +- %f\n",matchEffLinFit1Gev,matchEffLinFit1GevErr ); + } + } else { + printf("WARNING: matching efficiency plot has 0 entries. Skipped!\n"); + } + } else { + printf("WARNING: cannot retrieve matching efficiency plot\n"); + } - //--------------------------------- t-texp ----------------------------------// + //--------------------------------- t-texp ----------------------------------// - TH1F*hPiDiffTime=(TH1F*)postfile->Get("hTOFmatchedExpTimePi"); - if ((hPiDiffTime)&&(hPiDiffTime->GetEntries()>0)) { - avPiDiffTime=hPiDiffTime->GetMean(); - hPiDiffTime->Fit("gaus","","",-1000.,500.); - if (hPiDiffTime->GetFunction("gaus")){ - peakPiDiffTime=(hPiDiffTime->GetFunction("gaus"))->GetParameter(1); - spreadPiDiffTime=(hPiDiffTime->GetFunction("gaus"))->GetParameter(2); - peakPiDiffTimeErr=(hPiDiffTime->GetFunction("gaus"))->GetParError(1); - spreadPiDiffTimeErr=(hPiDiffTime->GetFunction("gaus"))->GetParError(2); - printf("Main peak t-t_exp (gaus): mean = %f +- %f\n",peakPiDiffTime,peakPiDiffTimeErr ); - printf("Main peak t-t_exp (gaus): spread = %f +- %f\n",spreadPiDiffTime,spreadPiDiffTimeErr ); - } - } - //--------------------------------- T0 detector ----------------------------------// + TH1F*hPiDiffTime=(TH1F*)postfile->Get("hTOFmatchedExpTimePi"); + if ((hPiDiffTime)&&(hPiDiffTime->GetEntries()>0)) { + avPiDiffTime=hPiDiffTime->GetMean(); + hPiDiffTime->Fit("gaus","","",-1000.,500.); + if (hPiDiffTime->GetFunction("gaus")){ + peakPiDiffTime=(hPiDiffTime->GetFunction("gaus"))->GetParameter(1); + spreadPiDiffTime=(hPiDiffTime->GetFunction("gaus"))->GetParameter(2); + peakPiDiffTimeErr=(hPiDiffTime->GetFunction("gaus"))->GetParError(1); + spreadPiDiffTimeErr=(hPiDiffTime->GetFunction("gaus"))->GetParError(2); + printf("Main peak t-t_exp (gaus): mean = %f +- %f\n",peakPiDiffTime,peakPiDiffTimeErr ); + printf("Main peak t-t_exp (gaus): spread = %f +- %f\n",spreadPiDiffTime,spreadPiDiffTimeErr ); + } + } + //--------------------------------- T0 detector ----------------------------------// - TH1F*hT0A=(TH1F*)postfile->Get("hEventT0DetA"); - if ((hT0A)&&(hT0A->GetEntries()>0)) { - avT0A=hT0A->GetMean(); - hT0A->Fit("gaus"); - peakT0A=(hT0A->GetFunction("gaus"))->GetParameter(1); - spreadT0A=(hT0A->GetFunction("gaus"))->GetParameter(2); - peakT0AErr=(hT0A->GetFunction("gaus"))->GetParError(1); - spreadT0AErr=(hT0A->GetFunction("gaus"))->GetParError(2); - printf("Main peak T0A(gaus): mean = %f +- %f\n",peakT0A,peakT0AErr ); - printf("Main peak T0A (gaus): spread = %f +- %f\n",spreadT0A,spreadT0AErr ); - //add integral of main peak over total - } + TH1F*hT0A=(TH1F*)postfile->Get("hEventT0DetA"); + if ((hT0A)&&(hT0A->GetEntries()>0)) { + avT0A=hT0A->GetMean(); + hT0A->Fit("gaus"); + peakT0A=(hT0A->GetFunction("gaus"))->GetParameter(1); + spreadT0A=(hT0A->GetFunction("gaus"))->GetParameter(2); + peakT0AErr=(hT0A->GetFunction("gaus"))->GetParError(1); + spreadT0AErr=(hT0A->GetFunction("gaus"))->GetParError(2); + printf("Main peak T0A(gaus): mean = %f +- %f\n",peakT0A,peakT0AErr ); + printf("Main peak T0A (gaus): spread = %f +- %f\n",spreadT0A,spreadT0AErr ); + //add integral of main peak over total + } - TH1F*hT0C=(TH1F*)postfile->Get("hEventT0DetC"); - if ((hT0C)&&(hT0C->GetEntries()>0)) { - avT0C=hT0C->GetMean(); - hT0C->Fit("gaus"); - peakT0C=(hT0C->GetFunction("gaus"))->GetParameter(1); - spreadT0C=(hT0C->GetFunction("gaus"))->GetParameter(2); - peakT0CErr=(hT0C->GetFunction("gaus"))->GetParError(1); - spreadT0CErr=(hT0C->GetFunction("gaus"))->GetParError(2); - printf("Main peak T0C(gaus): mean = %f +- %f\n",peakT0C,peakT0CErr ); - printf("Main peak T0C (gaus): spread = %f +- %f\n",spreadT0C,spreadT0CErr ); - //add integral of main peak over total - } + TH1F*hT0C=(TH1F*)postfile->Get("hEventT0DetC"); + if ((hT0C)&&(hT0C->GetEntries()>0)) { + avT0C=hT0C->GetMean(); + hT0C->Fit("gaus"); + peakT0C=(hT0C->GetFunction("gaus"))->GetParameter(1); + spreadT0C=(hT0C->GetFunction("gaus"))->GetParameter(2); + peakT0CErr=(hT0C->GetFunction("gaus"))->GetParError(1); + spreadT0CErr=(hT0C->GetFunction("gaus"))->GetParError(2); + printf("Main peak T0C(gaus): mean = %f +- %f\n",peakT0C,peakT0CErr ); + printf("Main peak T0C (gaus): spread = %f +- %f\n",spreadT0C,spreadT0CErr ); + //add integral of main peak over total + } - TH1F*hT0AC=(TH1F*)postfile->Get("hEventT0DetAND"); - if ((hT0AC)&&(hT0AC->GetEntries()>0)) { - avT0AC=hT0AC->GetMean(); - hT0AC->Fit("gaus"); - peakT0AC=(hT0AC->GetFunction("gaus"))->GetParameter(1); - spreadT0AC=(hT0AC->GetFunction("gaus"))->GetParameter(2); - peakT0ACErr=(hT0AC->GetFunction("gaus"))->GetParError(1); - spreadT0ACErr=(hT0AC->GetFunction("gaus"))->GetParError(2); - printf("Main peak T0AC(gaus): mean = %f +- %f\n",peakT0AC,peakT0ACErr ); - printf("Main peak T0AC (gaus): spread = %f +- %f\n",spreadT0AC,spreadT0ACErr ); - } + TH1F*hT0AC=(TH1F*)postfile->Get("hEventT0DetAND"); + if ((hT0AC)&&(hT0AC->GetEntries()>0)) { + avT0AC=hT0AC->GetMean(); + hT0AC->Fit("gaus"); + peakT0AC=(hT0AC->GetFunction("gaus"))->GetParameter(1); + spreadT0AC=(hT0AC->GetFunction("gaus"))->GetParameter(2); + peakT0ACErr=(hT0AC->GetFunction("gaus"))->GetParError(1); + spreadT0ACErr=(hT0AC->GetFunction("gaus"))->GetParError(2); + printf("Main peak T0AC(gaus): mean = %f +- %f\n",peakT0AC,peakT0ACErr ); + printf("Main peak T0AC (gaus): spread = %f +- %f\n",spreadT0AC,spreadT0ACErr ); + } - TH1F*hT0res=(TH1F*)postfile->Get("hT0DetRes"); - if ((hT0res)&&(hT0res->GetEntries()>0)) { - avT0res=hT0res->GetMean(); - hT0res->Fit("gaus"); - peakT0res=(hT0res->GetFunction("gaus"))->GetParameter(1); - spreadT0res=(hT0res->GetFunction("gaus"))->GetParameter(2); - peakT0resErr=(hT0res->GetFunction("gaus"))->GetParError(1); - spreadT0resErr=(hT0res->GetFunction("gaus"))->GetParError(2); - printf("Main peak T0res(gaus): mean = %f +- %f\n",peakT0res,peakT0resErr ); - printf("Main peak T0res (gaus): spread = %f +- %f\n",spreadT0res,spreadT0resErr ); - //add integral of main peak over total - } + TH1F*hT0res=(TH1F*)postfile->Get("hT0DetRes"); + if ((hT0res)&&(hT0res->GetEntries()>0)) { + avT0res=hT0res->GetMean(); + hT0res->Fit("gaus"); + peakT0res=(hT0res->GetFunction("gaus"))->GetParameter(1); + spreadT0res=(hT0res->GetFunction("gaus"))->GetParameter(2); + peakT0resErr=(hT0res->GetFunction("gaus"))->GetParError(1); + spreadT0resErr=(hT0res->GetFunction("gaus"))->GetParError(2); + printf("Main peak T0res(gaus): mean = %f +- %f\n",peakT0res,peakT0resErr ); + printf("Main peak T0res (gaus): spread = %f +- %f\n",spreadT0res,spreadT0resErr ); + //add integral of main peak over total + } - TH1F*hT0fillRes=(TH1F*)postfile->Get("hT0fillRes"); - if ((hT0fillRes)&&(hT0fillRes->GetEntries()>0)) { - avT0fillRes=hT0fillRes->GetMean(); - } + TH1F*hT0fillRes=(TH1F*)postfile->Get("hT0fillRes"); + if ((hT0fillRes)&&(hT0fillRes->GetEntries()>0)) { + avT0fillRes=hT0fillRes->GetMean(); + } - ttree->Fill(); - printf("============== Saving trending quantities in tree for run %i ===============\n",runNumber); - if (postfile->IsOpen()) { - printf("Trying to close\n"); - postfile->Close(); - } - - trendFile->cd(); - ttree->Write(); - trendFile->Close(); - return 0; + ttree->Fill(); + printf("============== Saving trending quantities in tree for run %i ===============\n",runNumber); + if (postfile->IsOpen()) { + printf("Trying to close\n"); + postfile->Close(); + } + + trendFile->cd(); + ttree->Write(); + trendFile->Close(); + return 0; } //------------------------------------------------------------------------------------ Int_t RunESDQApostAnalysis(char *qafilename=NULL, Int_t runNumber=-1, Bool_t isMC=kFALSE, Bool_t IsOnGrid=kFALSE, Bool_t displayAll=kFALSE, Bool_t includeStartTime=kTRUE) { - Bool_t debug=kFALSE; + Bool_t debug=kFALSE; - /*access qa PWGPP output files - saved locally or on grid as specified by the second argument */ + /*access qa PWGPP output files - saved locally or on grid as specified by the second argument */ - char defaultQAoutput[30]="QAresults.root"; - if (IsOnGrid) TGrid::Connect("alien://"); - TFile * fin= TFile::Open(qafilename,"r"); - printf("Opening file %s\n",qafilename); - if (!fin) { - printf("ERROR: QA output not found. Exiting with status -1\n"); - return 1; - } else { - printf("INFO: QA output file %s open. \n",fin->GetName()); - } + char defaultQAoutput[30]="QAresults.root"; + if (IsOnGrid) TGrid::Connect("alien://"); + TFile * fin= TFile::Open(qafilename,"r"); + printf("Opening file %s\n",qafilename); + if (!fin) { + printf("ERROR: QA output not found. Exiting with status -1\n"); + return 1; + } else { + printf("INFO: QA output file %s open. \n",fin->GetName()); + } - //access histograms lists - char tofQAdirName[15]="TOF_Performance"; - char PIDqaListName[6]="PIDqa"; - char genListName[15]="cGeneralTOFqa"; - char t0ListName[15]="cTimeZeroTOFqa"; - char pidListName[15]="cPIDTOFqa"; - char posListName[15]="cPositiveTOFqa"; - char negListName[15]="cNegativeTOFqa"; + //access histograms lists + char tofQAdirName[15]="TOF_Performance"; + char PIDqaListName[6]="PIDqa"; + char genListName[15]="cGeneralTOFqa"; + char t0ListName[15]="cTimeZeroTOFqa"; + char pidListName[15]="cPIDTOFqa"; + char posListName[15]="cPositiveTOFqa"; + char negListName[15]="cNegativeTOFqa"; - TDirectoryFile * tofQAdir=(TDirectoryFile*)fin->Get(tofQAdirName); - TDirectoryFile * pidQAdir=(TDirectoryFile*)fin->Get(PIDqaListName); - - if(debug){ - printf("------------------------------------------------------------------\n"); - tofQAdir->ls(); - printf("------------------------------------------------------------------\n"); - if(includeStartTime){ - pidQAdir->ls(); - printf("------------------------------------------------------------------\n"); - } - } + TDirectoryFile * tofQAdir=(TDirectoryFile*)fin->Get(tofQAdirName); + TDirectoryFile * pidQAdir=(TDirectoryFile*)fin->Get(PIDqaListName); + + if(debug){ + printf("------------------------------------------------------------------\n"); + tofQAdir->ls(); + printf("------------------------------------------------------------------\n"); + if(includeStartTime){ + pidQAdir->ls(); + printf("------------------------------------------------------------------\n"); + } + } - TList * generalList=(TList*)tofQAdir->Get(genListName); - TList *timeZeroList=(TList*)tofQAdir->Get(t0ListName); - TList *pidList=(TList*)tofQAdir->Get(pidListName); - TList *posList=(TList*)tofQAdir->Get(posListName); - TList *negList=(TList*)tofQAdir->Get(negListName); - - if(!pidQAdir) - printf("WARNING: PIDqa histograms not available\n"); - else{ - TList *pidListT0=(TList*)pidQAdir->Get(PIDqaListName); - TList *tofPidListT0=(TList*)pidListT0->FindObject("TOF"); - } - if (!generalList) printf("WARNING: general QA histograms absent or not accessible\n"); - if (!timeZeroList) printf("WARNING: timeZero QA histograms absent or not accessible\n"); - if (!pidList) printf("WARNING: PID QA histograms absent or not accessible\n"); - if (!posList) printf("WARNING: general QA histograms for positive tracks absent or not accessible\n"); - if (!negList) printf("WARNING: general QA histograms for negative tracks absent or not accessible\n"); - - if ( (!generalList) && (!timeZeroList) && (!pidList) ){ - printf("ERROR: no QA available \n"); - return 1; - } + TList * generalList=(TList*)tofQAdir->Get(genListName); + TList *timeZeroList=(TList*)tofQAdir->Get(t0ListName); + TList *pidList=(TList*)tofQAdir->Get(pidListName); + TList *posList=(TList*)tofQAdir->Get(posListName); + TList *negList=(TList*)tofQAdir->Get(negListName); + + if(!pidQAdir) + printf("WARNING: PIDqa histograms not available\n"); + else{ + TList *pidListT0=(TList*)pidQAdir->Get(PIDqaListName); + TList *tofPidListT0=(TList*)pidListT0->FindObject("TOF"); + } + if (!generalList) printf("WARNING: general QA histograms absent or not accessible\n"); + if (!timeZeroList) printf("WARNING: timeZero QA histograms absent or not accessible\n"); + if (!pidList) printf("WARNING: PID QA histograms absent or not accessible\n"); + if (!posList) printf("WARNING: general QA histograms for positive tracks absent or not accessible\n"); + if (!negList) printf("WARNING: general QA histograms for negative tracks absent or not accessible\n"); + + if ( (!generalList) && (!timeZeroList) && (!pidList) ){ + printf("ERROR: no QA available \n"); + return 1; + } - if (debug){ - generalList->ls(); - printf("------------------------------------------------------------------\n"); - timeZeroList->ls(); - printf("------------------------------------------------------------------\n"); - pidList->ls(); - printf("------------------------------------------------------------------\n"); - } - - /*set graphic style*/ - gStyle->SetCanvasColor(kWhite); - gStyle->SetFrameFillColor(kWhite); - gStyle->SetFrameBorderMode(0); - gStyle->SetCanvasBorderMode(0); - gStyle->SetTitleFillColor(kWhite); - gStyle->SetTitleBorderSize(0) ; - gStyle->SetTitleFont(42); - gStyle->SetTextFont(42); - //gStyle->SetPalette(1); - gStyle->SetStatColor(kWhite); - gStyle->SetStatBorderSize(1); - gStyle->SetOptStat(0); + if (debug){ + generalList->ls(); + printf("------------------------------------------------------------------\n"); + timeZeroList->ls(); + printf("------------------------------------------------------------------\n"); + pidList->ls(); + printf("------------------------------------------------------------------\n"); + } + + /*set graphic style*/ + gStyle->SetCanvasColor(kWhite); + gStyle->SetFrameFillColor(kWhite); + gStyle->SetFrameBorderMode(0); + gStyle->SetCanvasBorderMode(0); + gStyle->SetTitleFillColor(kWhite); + gStyle->SetTitleBorderSize(0) ; + gStyle->SetTitleFont(42); + gStyle->SetTextFont(42); + //gStyle->SetPalette(1); + gStyle->SetStatColor(kWhite); + gStyle->SetStatBorderSize(1); + gStyle->SetOptStat(0); - //DEFINE OUTPUT FILE - char outfilename[60]; - sprintf(outfilename,"postQA_%i.root",runNumber); - TFile * fout=new TFile(outfilename,"recreate"); - - TH1I* hRunNumber=new TH1I("hRunNumber","hRunNumber;run",1,runNumber,runNumber+1); - hRunNumber->Fill(runNumber); - - //------------------------------------------------------------- - /*GENERAL MONITOR - MULTIPLICITY*/ - TH1F*hMulti= (TH1F*) generalList->At(0); - - TH1F* hFractionEventsWhits=new TH1F("hFractionEventsWhits","hFractionEventsWhits;fraction of events with hits (%)",200,0.,100.); - if (hMulti->GetEntries()<1) return 2; - Float_t fraction=0.0; - if (hMulti->GetEntries()>0.0) fraction=((Float_t) hMulti->GetBinContent(1))/((Float_t) hMulti->GetEntries()); - else fraction=0.0; - hFractionEventsWhits->Fill(fraction*100.); - //------------------------------------------------------------- - /*GENERAL MONITOR - TIMING AND GEOMETRY*/ - TH1F * hTime = (TH1F*) generalList->At(1); - if (hTime->GetEntries()<1) return 2; - hTime->SetMarkerStyle(8); - hTime->SetMarkerSize(0.7); - hTime->SetMarkerColor(kBlue); - hTime->SetLineColor(kBlue); - hTime->SetFillColor(kBlue); - hTime->SetFillStyle(3001); - hTime->Rebin(2); - hTime->GetYaxis()->SetTitle("matched tracks"); - hTime->GetYaxis()->SetTitleOffset(1.35); + //DEFINE OUTPUT FILE + char outfilename[60]; + sprintf(outfilename,"postQA_%i.root",runNumber); + TFile * fout=new TFile(outfilename,"recreate"); + + TH1I* hRunNumber=new TH1I("hRunNumber","hRunNumber;run",1,runNumber,runNumber+1); + hRunNumber->Fill(runNumber); + + //------------------------------------------------------------- + /*GENERAL MONITOR - MULTIPLICITY*/ + TH1F*hMulti= (TH1F*) generalList->FindObject("hTOFmatchedPerEvt"); + + TH1F* hFractionEventsWhits=new TH1F("hFractionEventsWhits","hFractionEventsWhits;fraction of events with hits (%)",200,0.,100.); + if (hMulti->GetEntries()<1) return 2; + Float_t fraction=0.0; + if (hMulti->GetEntries()>0.0) fraction=((Float_t) hMulti->GetBinContent(1))/((Float_t) hMulti->GetEntries()); + else fraction=0.0; + hFractionEventsWhits->Fill(fraction*100.); + //------------------------------------------------------------- + /*GENERAL MONITOR - TIMING AND GEOMETRY*/ + TH1F * hTime = (TH1F*) generalList->FindObject("hTOFmatchedESDtime"); + if (hTime->GetEntries()<1) return 2; + hTime->SetMarkerStyle(8); + hTime->SetMarkerSize(0.7); + hTime->SetMarkerColor(kBlue); + hTime->SetLineColor(kBlue); + hTime->SetFillColor(kBlue); + hTime->SetFillStyle(3001); + hTime->Rebin(2); + hTime->GetYaxis()->SetTitle("matched tracks"); + hTime->GetYaxis()->SetTitleOffset(1.35); - TH1F * hRawTime = (TH1F*) generalList->At(2); - hRawTime->SetMarkerStyle(21); - hRawTime->SetMarkerSize(0.7); - hRawTime->SetMarkerColor(kGreen); - hRawTime->SetLineColor(kGreen); - hRawTime->SetFillColor(kGreen); - hRawTime->SetFillStyle(3001); - hRawTime->Rebin(2); - hRawTime->GetYaxis()->SetTitle("matched tracks"); - hRawTime->GetYaxis()->SetTitleOffset(1.35); + TH1F * hRawTime = (TH1F*) generalList->FindObject("hTOFmatchedESDrawTime"); + hRawTime->SetMarkerStyle(21); + hRawTime->SetMarkerSize(0.7); + hRawTime->SetMarkerColor(kGreen); + hRawTime->SetLineColor(kGreen); + hRawTime->SetFillColor(kGreen); + hRawTime->SetFillStyle(3001); + hRawTime->Rebin(2); + hRawTime->GetYaxis()->SetTitle("matched tracks"); + hRawTime->GetYaxis()->SetTitleOffset(1.35); - TLegend *lTime = new TLegend(0.7125881,0.6052519,0.979435,0.7408306,NULL,"brNDC"); - lTime->SetTextSize(0.04281433); - lTime->AddEntry(hRawTime, "raw","L"); - lTime->AddEntry(hTime, "ESD","L"); - lTime->SetFillColor(kWhite); - lTime->SetShadowColor(0); - - TH1F * hTot = (TH1F*) generalList->At(3); - hTot->SetMarkerStyle(8); - hTot->SetMarkerSize(0.7); - hTot->SetMarkerColor(kViolet-3); - hTot->SetLineColor(kViolet-3); - hTot->SetFillColor(kViolet-3); - hTot->SetFillStyle(3001); - //hTime->SetDrawOption(); - hTot->GetYaxis()->SetTitle("matched tracks"); - hTot->GetYaxis()->SetTitleOffset(1.35); + TLegend *lTime = new TLegend(0.7125881,0.6052519,0.979435,0.7408306,NULL,"brNDC"); + lTime->SetTextSize(0.04281433); + lTime->AddEntry(hRawTime, "raw","L"); + lTime->AddEntry(hTime, "ESD","L"); + lTime->SetFillColor(kWhite); + lTime->SetShadowColor(0); + + TH1F * hTot = (TH1F*) generalList->FindObject("hTOFmatchedESDToT"); + hTot->SetMarkerStyle(8); + hTot->SetMarkerSize(0.7); + hTot->SetMarkerColor(kViolet-3); + hTot->SetLineColor(kViolet-3); + hTot->SetFillColor(kViolet-3); + hTot->SetFillStyle(3001); + //hTime->SetDrawOption(); + hTot->GetYaxis()->SetTitle("matched tracks"); + hTot->GetYaxis()->SetTitleOffset(1.35); - char orphansTxt[200]; - Float_t orphansRatio=0.0; - if (hTot->GetEntries()>1){ - orphansRatio=((Float_t) hTot->GetBinContent(1))/((Float_t) hTot->GetEntries()) ; - } - sprintf(orphansTxt,"orphans/matched tracks = %.4f ",orphansRatio); - TH1F * hOrphansRatio=new TH1F("hOrphansRatio","Percentage of signals with only leading edge; percentage (%)",1000,0.,100.); - hOrphansRatio->Fill(orphansRatio*100.); - - - TPaveText *tOrphans = new TPaveText(0.38,0.63,0.88,0.7, "NDC"); - //NDC sets coords relative to pad - tOrphans->SetBorderSize(0); - tOrphans->SetTextSize(0.045); - tOrphans->SetFillColor(0); //white background - tOrphans->SetTextAlign(12); - tOrphans->SetTextColor(kViolet-3); - tOrphans->AddText(orphansTxt); + char orphansTxt[200]; + Float_t orphansRatio=0.0; + if (hTot->GetEntries()>1){ + orphansRatio=((Float_t) hTot->GetBinContent(1))/((Float_t) hTot->GetEntries()) ; + } + sprintf(orphansTxt,"orphans/matched tracks = %.4f ",orphansRatio); + TH1F * hOrphansRatio=new TH1F("hOrphansRatio","Percentage of signals with only leading edge; percentage (%)",1000,0.,100.); + hOrphansRatio->Fill(orphansRatio*100.); + + + TPaveText *tOrphans = new TPaveText(0.38,0.63,0.88,0.7, "NDC"); + //NDC sets coords relative to pad + tOrphans->SetBorderSize(0); + tOrphans->SetTextSize(0.045); + tOrphans->SetFillColor(0); //white background + tOrphans->SetTextAlign(12); + tOrphans->SetTextColor(kViolet-3); + tOrphans->AddText(orphansTxt); - TH1F * hL = (TH1F*) generalList->At(4); - hL->SetMarkerStyle(8); - hL->SetMarkerSize(0.7); - hL->SetMarkerColor(kOrange-3); - hL->SetLineColor(kOrange-3); - hL->SetFillColor(kOrange-3); - hL->SetFillStyle(3001); - //hTime->SetDrawOption(); - hL->GetYaxis()->SetTitle("matched tracks"); - hL->GetYaxis()->SetTitleOffset(1.35); - - char negLengthTxt[200]; - Float_t negLengthRatio=0.0; - if (hL->GetEntries()>1){ - negLengthRatio=(hL->Integral(1,750))/((Float_t) hL->GetEntries()) ; - } - sprintf(negLengthTxt,"tracks with L<350cm /matched tracks = %.5f ",negLengthRatio); - TH1F * hLnegRatio=new TH1F("hLnegRatio","Ratio of TOF-matched tracks with L<350cm; ratio (%)",10000,0.,100.); - hLnegRatio->Fill(negLengthRatio*100); + TH1F * hL = (TH1F*) generalList->FindObject("hTOFmatchedESDtrkLength"); + hL->SetMarkerStyle(8); + hL->SetMarkerSize(0.7); + hL->SetMarkerColor(kOrange-3); + hL->SetLineColor(kOrange-3); + hL->SetFillColor(kOrange-3); + hL->SetFillStyle(3001); + //hTime->SetDrawOption(); + hL->GetYaxis()->SetTitle("matched tracks"); + hL->GetYaxis()->SetTitleOffset(1.35); + + char negLengthTxt[200]; + Float_t negLengthRatio=0.0; + if (hL->GetEntries()>1){ + negLengthRatio=(hL->Integral(1,750))/((Float_t) hL->GetEntries()) ; + } + sprintf(negLengthTxt,"tracks with L<350cm /matched tracks = %.5f ",negLengthRatio); + TH1F * hLnegRatio=new TH1F("hLnegRatio","Ratio of TOF-matched tracks with L<350cm; ratio (%)",10000,0.,100.); + hLnegRatio->Fill(negLengthRatio*100); - TPaveText *tLength = new TPaveText(0.15,0.83,0.65,0.87, "NDC"); - //NDC sets coords relative to pad - tLength->SetBorderSize(0); - tLength->SetTextSize(0.04); - tLength->SetFillColor(0); //white background - tLength->SetTextAlign(11); - tLength->SetTextColor(kOrange-3); - tLength->AddText(negLengthTxt); + TPaveText *tLength = new TPaveText(0.15,0.83,0.65,0.87, "NDC"); + //NDC sets coords relative to pad + tLength->SetBorderSize(0); + tLength->SetTextSize(0.04); + tLength->SetFillColor(0); //white background + tLength->SetTextAlign(11); + tLength->SetTextColor(kOrange-3); + tLength->AddText(negLengthTxt); - if (displayAll){ - TCanvas *cTrackProperties= new TCanvas("cTrackProperties","summary of matched tracks properties",900,900); - cTrackProperties->Divide(2,2); - cTrackProperties->cd(1); - gPad->SetLogy(); - gPad->SetGridx(); - gPad->SetGridy(); - hTime->Draw("BAR"); - hRawTime ->Draw("BARsame"); - lTime->Draw(); - cTrackProperties->cd(2); - gPad->SetGridx(); - gPad->SetGridy(); - gPad->SetLogy(); - hTot->Draw("BAR"); - tOrphans->Draw(); - cTrackProperties->cd(3); - gPad->SetGridx(); - gPad->SetGridy(); - gPad->SetLogy(); - hL->Draw("BAR"); - tLength->Draw(); - } - fout->cd(); - hRunNumber->Write(); - hMulti->Write(); - hFractionEventsWhits->Write(); - hTime->Write(); - hRawTime->Write(); - hTot->Write(); - hOrphansRatio->Write(); - hL->Write(); - hLnegRatio->Write(); + if (displayAll){ + TCanvas *cTrackProperties= new TCanvas("cTrackProperties","summary of matched tracks properties",900,900); + cTrackProperties->Divide(2,2); + cTrackProperties->cd(1); + gPad->SetLogy(); + gPad->SetGridx(); + gPad->SetGridy(); + hTime->Draw("BAR"); + hRawTime ->Draw("BARsame"); + lTime->Draw(); + cTrackProperties->cd(2); + gPad->SetGridx(); + gPad->SetGridy(); + gPad->SetLogy(); + hTot->Draw("BAR"); + tOrphans->Draw(); + cTrackProperties->cd(3); + gPad->SetGridx(); + gPad->SetGridy(); + gPad->SetLogy(); + hL->Draw("BAR"); + tLength->Draw(); + } + fout->cd(); + hRunNumber->Write(); + hMulti->Write(); + hFractionEventsWhits->Write(); + hTime->Write(); + hRawTime->Write(); + hTot->Write(); + hOrphansRatio->Write(); + hL->Write(); + hLnegRatio->Write(); - TH2F* hDxPos4profile = (TH2F*) generalList->At(14); - TH2F* hDxNeg4profile = (TH2F*) generalList->At(13); + TH2F* hDxPos4profile = (TH2F*) generalList->FindObject("hTOFmatchedDxVsPtPos"); + TH2F* hDxNeg4profile = (TH2F*) generalList->FindObject("hTOFmatchedDxVsPtNeg"); - char profilename[30]; - const Int_t ybinMin = 0; - const Int_t ybinMax =hDxPos4profile->GetYaxis()->GetNbins() ; - sprintf(profilename,"profDxPos"); - TProfile * profDxPos = (TProfile*)hDxPos4profile->ProfileX(profilename, ybinMin,ybinMax); - sprintf(profilename,"profDxNeg"); - profDxPos->SetLineWidth(2); - TProfile * profDxNeg = (TProfile*)hDxNeg4profile->ProfileX(profilename, ybinMin, ybinMax); - profDxNeg->SetLineWidth(2); + char profilename[30]; + const Int_t ybinMin = 0; + const Int_t ybinMax =hDxPos4profile->GetYaxis()->GetNbins() ; + sprintf(profilename,"profDxPos"); + TProfile * profDxPos = (TProfile*)hDxPos4profile->ProfileX(profilename, ybinMin,ybinMax); + sprintf(profilename,"profDxNeg"); + profDxPos->SetLineWidth(2); + TProfile * profDxNeg = (TProfile*)hDxNeg4profile->ProfileX(profilename, ybinMin, ybinMax); + profDxNeg->SetLineWidth(2); - TH1 *profRatioPosOverNegDx = (TH1*) profDxPos->Clone(); - profRatioPosOverNegDx->SetName("profRatioPosOverNegDx"); - profRatioPosOverNegDx->Divide((TH1*) profDxNeg); - profRatioPosOverNegDx->GetYaxis()->SetRangeUser(-5.,5.); - profRatioPosOverNegDx->GetXaxis()->SetRangeUser(0.,2.); - if (displayAll){ - TCanvas *residuals= new TCanvas("residuals","residuals",900,450); - residuals->Divide(2,1); - residuals->cd(1); - gPad->SetGridx(); - gPad->SetGridy(); - hDxPos4profile->GetYaxis()->SetRangeUser(-5.,5.); - hDxPos4profile->Draw("colz"); - profDxPos->SetLineColor(kRed); - profDxPos ->Draw("same"); - residuals->cd(2); - gPad->SetGridx(); - gPad->SetGridy(); - hDxNeg4profile->GetYaxis()->SetRangeUser(-5.,5.); - hDxNeg4profile->Draw("colz"); - profDxNeg->SetLineColor(kBlue); - profDxNeg->Draw("same"); - } - - fout->cd(); - hDxPos4profile->Write(); - hDxNeg4profile->Write(); - profDxPos->Write(); - profDxNeg->Write(); - profRatioPosOverNegDx->Write(); - //------------------------------------------------------------- - /* T0 DETECTOR MONITOR*/ - - TH1F * hT0AC = (TH1F*) timeZeroList->At(0); - hT0AC->SetMarkerStyle(8); - hT0AC->SetMarkerSize(0.7); - hT0AC->SetMarkerColor(kRed); - hT0AC->SetLineColor(kRed); - hT0AC->SetFillColor(kRed); - hT0AC->SetFillStyle(1001); - hT0AC->Rebin(2); - hT0AC->GetYaxis()->SetTitle("events"); - hT0AC->GetYaxis()->SetTitleOffset(1.35); - hT0AC->GetXaxis()->SetLabelSize(0.03); + TH1 *profRatioPosOverNegDx = (TH1*) profDxPos->Clone(); + profRatioPosOverNegDx->SetName("profRatioPosOverNegDx"); + profRatioPosOverNegDx->Divide((TH1*) profDxNeg); + profRatioPosOverNegDx->GetYaxis()->SetRangeUser(-5.,5.); + profRatioPosOverNegDx->GetXaxis()->SetRangeUser(0.,2.); + if (displayAll){ + TCanvas *residuals= new TCanvas("residuals","residuals",900,450); + residuals->Divide(2,1); + residuals->cd(1); + gPad->SetGridx(); + gPad->SetGridy(); + hDxPos4profile->GetYaxis()->SetRangeUser(-5.,5.); + hDxPos4profile->Draw("colz"); + profDxPos->SetLineColor(kRed); + profDxPos ->Draw("same"); + residuals->cd(2); + gPad->SetGridx(); + gPad->SetGridy(); + hDxNeg4profile->GetYaxis()->SetRangeUser(-5.,5.); + hDxNeg4profile->Draw("colz"); + profDxNeg->SetLineColor(kBlue); + profDxNeg->Draw("same"); + } + + fout->cd(); + hDxPos4profile->Write(); + hDxNeg4profile->Write(); + profDxPos->Write(); + profDxNeg->Write(); + profRatioPosOverNegDx->Write(); + //------------------------------------------------------------- + /* T0 DETECTOR MONITOR*/ + + TH1F * hT0AC = (TH1F*) timeZeroList->FindObject("hEventT0DetAND"); + hT0AC->SetMarkerStyle(8); + hT0AC->SetMarkerSize(0.7); + hT0AC->SetMarkerColor(kRed); + hT0AC->SetLineColor(kRed); + hT0AC->SetFillColor(kRed); + hT0AC->SetFillStyle(1001); + hT0AC->Rebin(2); + hT0AC->GetYaxis()->SetTitle("events"); + hT0AC->GetYaxis()->SetTitleOffset(1.35); + hT0AC->GetXaxis()->SetLabelSize(0.03); - TH1F * hT0A = (TH1F*) timeZeroList->At(1); - hT0A->SetMarkerStyle(8); - hT0A->SetMarkerSize(0.7); - hT0A->SetMarkerColor(kBlue); - hT0A->SetLineColor(kBlue); - hT0A->SetFillColor(kBlue); - hT0A->SetFillStyle(1001); - hT0A->Rebin(2); - hT0A->GetYaxis()->SetTitle("events"); - hT0A->GetYaxis()->SetTitleOffset(1.35); - hT0A->GetXaxis()->SetLabelSize(0.03); - - TH1F * hT0C = (TH1F*) timeZeroList->At(2); - hT0C->SetMarkerStyle(8); - hT0C->SetMarkerSize(0.7); - hT0C->SetMarkerColor(kGreen); - hT0C->SetLineColor(kGreen); - hT0C->SetFillColor(kGreen); - hT0C->SetFillStyle(1001); - hT0C->Rebin(2); - hT0C->GetYaxis()->SetTitle("events"); - hT0C->GetYaxis()->SetTitleOffset(1.35); - hT0C->GetXaxis()->SetLabelSize(0.03); + TH1F * hT0A = (TH1F*) timeZeroList->FindObject("hEventT0DetA"); + hT0A->SetMarkerStyle(8); + hT0A->SetMarkerSize(0.7); + hT0A->SetMarkerColor(kBlue); + hT0A->SetLineColor(kBlue); + hT0A->SetFillColor(kBlue); + hT0A->SetFillStyle(1001); + hT0A->Rebin(2); + hT0A->GetYaxis()->SetTitle("events"); + hT0A->GetYaxis()->SetTitleOffset(1.35); + hT0A->GetXaxis()->SetLabelSize(0.03); + + TH1F * hT0C = (TH1F*) timeZeroList->FindObject("hEventT0DetC"); + hT0C->SetMarkerStyle(8); + hT0C->SetMarkerSize(0.7); + hT0C->SetMarkerColor(kGreen); + hT0C->SetLineColor(kGreen); + hT0C->SetFillColor(kGreen); + hT0C->SetFillStyle(1001); + hT0C->Rebin(2); + hT0C->GetYaxis()->SetTitle("events"); + hT0C->GetYaxis()->SetTitleOffset(1.35); + hT0C->GetXaxis()->SetLabelSize(0.03); - TLegend *lT0 = new TLegend(0.7125881,0.6052519,0.979435,0.7408306,NULL,"brNDC"); - lT0->SetTextSize(0.041); - lT0->AddEntry(hT0AC, "T0 A&C","L"); - lT0->AddEntry(hT0A, "T0 A","L"); - lT0->AddEntry(hT0C, "T0 C","L"); - lT0->SetFillColor(kWhite); - lT0->SetShadowColor(0); - - TH1F * hT0res = (TH1F*) timeZeroList->At(3); - hT0res->GetXaxis()->SetLabelSize(0.03); - if (displayAll){ - TCanvas *cT0detector= new TCanvas("cT0detector","T0 detector",900,450); - cT0detector->Divide(2,1); - cT0detector->cd(1); - gPad->SetGridx(); - gPad->SetGridy(); - hT0AC->Draw("BAR"); - hT0AC->SetTitle("timeZero measured by T0 detector"); - hT0A ->Draw("BARsame"); - hT0C ->Draw("BARsame"); - lT0->Draw(); - cT0detector->cd(2); - gPad->SetGridx(); - gPad->SetGridy(); - // gPad->SetLogy(); - hT0res->Draw(); - // myText1->Draw(); - // cTrackProperties->cd(3); - // gPad->SetLogy(); - // hL->Draw("BAR"); - // myText2->Draw(); - } - - TH1F * hT0fillRes = (TH1F*) timeZeroList->At(8); - hT0fillRes->GetXaxis()->SetLabelSize(0.03); - - fout->cd(); - hT0AC->Write(); - hT0A->Write(); - hT0C->Write(); - hT0res->Write(); - hT0fillRes->Write(); - lT0->Write(); + TLegend *lT0 = new TLegend(0.7125881,0.6052519,0.979435,0.7408306,NULL,"brNDC"); + lT0->SetTextSize(0.041); + lT0->AddEntry(hT0AC, "T0 A&C","L"); + lT0->AddEntry(hT0A, "T0 A","L"); + lT0->AddEntry(hT0C, "T0 C","L"); + lT0->SetFillColor(kWhite); + lT0->SetShadowColor(0); + TH1F * hT0res = (TH1F*) timeZeroList->FindObject("hT0DetRes"); + hT0res->GetXaxis()->SetLabelSize(0.03); + if (displayAll){ + TCanvas *cT0detector= new TCanvas("cT0detector","T0 detector",900,450); + cT0detector->Divide(2,1); + cT0detector->cd(1); + gPad->SetGridx(); + gPad->SetGridy(); + hT0AC->Draw("BAR"); + hT0AC->SetTitle("timeZero measured by T0 detector"); + hT0A ->Draw("BARsame"); + hT0C ->Draw("BARsame"); + lT0->Draw(); + cT0detector->cd(2); + gPad->SetGridx(); + gPad->SetGridy(); + // gPad->SetLogy(); + hT0res->Draw(); + // myText1->Draw(); + // cTrackProperties->cd(3); + // gPad->SetLogy(); + // hL->Draw("BAR"); + // myText2->Draw(); + } - //------------------------------------------------------------- - /*MATCHING EFFICIENCY MONITOR*/ + TH1F * hT0fillRes = (TH1F*) timeZeroList->FindObject("hT0fillRes"); + hT0fillRes->GetXaxis()->SetLabelSize(0.03); - //TH1F * hMatchingVsP =new TH1F("hMatchingVsP","Matching probability vs. P; P(GeV/c); matching probability", 50, 0., 5. ); - - TH1F * hMatchingVsPt =new TH1F("hMatchingVsPt","Matching probability vs. Pt; Pt(GeV/c); matching probability", 50, 0., 5. ); + fout->cd(); + hT0AC->Write(); + hT0A->Write(); + hT0C->Write(); + hT0res->Write(); + hT0fillRes->Write(); + lT0->Write(); - TH1F * hMatchingVsEta =new TH1F("hMatchingVsEta","Matching probability vs. #\Eta; #\Eta; matching probability", 20, -1., 1.); - - TH1F * hMatchingVsPhi =new TH1F("hMatchingVsPhi","Matching probability vs. Phi; Phi(rad); matching probability", 628, 0., 6.28); + + //------------------------------------------------------------- + /*MATCHING EFFICIENCY MONITOR*/ + + //TH1F * hMatchingVsP =new TH1F("hMatchingVsP","Matching probability vs. P; P(GeV/c); matching probability", 50, 0., 5. ); - /*/matching as function of p - TH1F * hDenom=(TH1F*)generalList->At(9); - if (hDenom) { - hMatchingVsP=(TH1F*) generalList->At(5); - hMatchingVsP->Rebin(5); - hDenom->Rebin(5); - hMatchingVsP->Divide(hDenom); - hMatchingVsP->GetYaxis()->SetTitle("matching efficiency"); - hMatchingVsP->SetTitle("TOF matching efficiency as function of momentum"); - }*/ + TH1F * hMatchingVsPt =new TH1F("hMatchingVsPt","Matching probability vs. Pt; Pt(GeV/c); matching probability", 50, 0., 5. ); - //matching as function of pT + TH1F * hMatchingVsEta =new TH1F("hMatchingVsEta","Matching probability vs. #\Eta; #\Eta; matching probability", 20, -1., 1.); - // hDenom->Clear(); - TH1F * hDenom=(TH1F*)generalList->At(10); - if (hDenom) { - hMatchingVsPt=(TH1F*) generalList->At(6); - hMatchingVsPt->Rebin(5); - hDenom->Rebin(5); - hMatchingVsPt->Divide(hDenom); - hMatchingVsPt->GetYaxis()->SetTitle("matching efficiency"); - hMatchingVsPt->SetTitle("TOF matching efficiency as function of transverse momentum"); - hMatchingVsPt->GetYaxis()->SetRangeUser(0,1.2); - } + TH1F * hMatchingVsPhi =new TH1F("hMatchingVsPhi","Matching probability vs. Phi; Phi(rad); matching probability", 628, 0., 6.28); + + //matching as function of pT + TH1F * hDenom=(TH1F*)generalList->FindObject("hESDprimaryTrackPt"); + if (hDenom) { + hMatchingVsPt=(TH1F*) generalList->FindObject("hTOFmatchedESDPt"); + hMatchingVsPt->Rebin(5); + hDenom->Rebin(5); + hMatchingVsPt->Divide(hDenom); + hMatchingVsPt->GetYaxis()->SetTitle("matching efficiency"); + hMatchingVsPt->SetTitle("TOF matching efficiency as function of transverse momentum"); + hMatchingVsPt->GetYaxis()->SetRangeUser(0,1.2); + } - //matching as function of eta - hDenom->Clear(); - hDenom=(TH1F*)generalList->At(11); - if (hDenom) { - hMatchingVsEta=(TH1F*) generalList->At(7); - hMatchingVsEta->Rebin(5); - hDenom->Rebin(5); - hMatchingVsEta->Divide(hDenom); - hMatchingVsEta->GetXaxis()->SetRangeUser(-1,1); - hMatchingVsEta->GetYaxis()->SetTitle("matching efficiency"); - hMatchingVsEta->GetYaxis()->SetRangeUser(0,1.2); - hMatchingVsEta->SetTitle("TOF matching efficiency as function of pseudorapidity"); - } - //matching as function of phi - hDenom->Clear(); - hDenom=(TH1F*)generalList->At(12); - if (hDenom) { - hMatchingVsPhi=(TH1F*) generalList->At(8); - //hMatchingVsPhi->Rebin(5); - //hDenom->Rebin(5); - hMatchingVsPhi->Divide(hDenom); - hMatchingVsPhi->GetYaxis()->SetTitle("matching efficiency"); - hMatchingVsPhi->SetTitle("TOF matching efficiency as function of phi"); - hMatchingVsPhi->GetYaxis()->SetRangeUser(0,1.2); - } - if ( displayAll){ - TCanvas *cMatchingPerformance= new TCanvas("cMatchingPerformance","summary of matching performance",700,400); - cMatchingPerformance->Divide(2,2); - cMatchingPerformance->cd(1); - gPad->SetGridx(); - gPad->SetGridy(); - hMatchingVsPt->Draw(); - cMatchingPerformance->cd(2); - gPad->SetGridx(); - gPad->SetGridy(); - hMatchingVsEta->Draw(); - cMatchingPerformance->cd(3); - gPad->SetGridx(); - gPad->SetGridy(); - hMatchingVsPhi->Draw(); - } - fout->cd(); - hMatchingVsPt->Write(); - hMatchingVsEta->Write(); - hMatchingVsPhi->Write(); + //matching as function of eta + hDenom->Clear(); + hDenom=(TH1F*)generalList->FindObject("hTOFprimaryESDeta"); + if (hDenom) { + hMatchingVsEta=(TH1F*) generalList->FindObject("hTOFmatchedESDeta"); + hMatchingVsEta->Rebin(5); + hDenom->Rebin(5); + hMatchingVsEta->Divide(hDenom); + hMatchingVsEta->GetXaxis()->SetRangeUser(-1,1); + hMatchingVsEta->GetYaxis()->SetTitle("matching efficiency"); + hMatchingVsEta->GetYaxis()->SetRangeUser(0,1.2); + hMatchingVsEta->SetTitle("TOF matching efficiency as function of pseudorapidity"); + } + //matching as function of phi + hDenom->Clear(); + hDenom=(TH1F*)generalList->FindObject("hTOFprimaryESDphi"); + if (hDenom) { + hMatchingVsPhi=(TH1F*) generalList->FindObject("hTOFmatchedESDphi"); + //hMatchingVsPhi->Rebin(5); + //hDenom->Rebin(5); + hMatchingVsPhi->Divide(hDenom); + hMatchingVsPhi->GetYaxis()->SetTitle("matching efficiency"); + hMatchingVsPhi->SetTitle("TOF matching efficiency as function of phi"); + hMatchingVsPhi->GetYaxis()->SetRangeUser(0,1.2); + } + if (displayAll){ + TCanvas *cMatchingPerformance= new TCanvas("cMatchingPerformance","summary of matching performance",700,400); + cMatchingPerformance->Divide(2,2); + cMatchingPerformance->cd(1); + gPad->SetGridx(); + gPad->SetGridy(); + hMatchingVsPt->Draw(); + cMatchingPerformance->cd(2); + gPad->SetGridx(); + gPad->SetGridy(); + hMatchingVsEta->Draw(); + cMatchingPerformance->cd(3); + gPad->SetGridx(); + gPad->SetGridy(); + hMatchingVsPhi->Draw(); + } + TH2F* hTOFmatchedDzVsStrip = (TH2F*) generalList->FindObject("hTOFmatchedDzVsStrip"); - //---------------------------------------------------- - /* PID PERFORMANCE MONITOR */ - - TH2F * hBetaP=(TH2F*)pidList->At(0); - if (hBetaP) hBetaP->GetYaxis()->SetRangeUser(0.,1.2); - else Printf("Plot hBetaP not available (old aliroot?)"); - TH1F * hMass=(TH1F*)pidList->At(1); - if (hMass){ - //hMass->SetMarkerColor(kBlue); - //hMass->SetLineColor(kBlue); - hMass->SetFillColor(kAzure+10); - hMass->SetFillStyle(1001); - hMass->Rebin(2); - hMass->GetYaxis()->SetTitle("tracks"); - hMass->GetYaxis()->SetTitleOffset(1.35); - hMass->GetXaxis()->SetLabelSize(0.03); - } else - Printf("Plot hMass not available (old aliroot?)"); + fout->cd(); + if (hMatchingVsPt) hMatchingVsPt->Write(); + if (hMatchingVsEta) hMatchingVsEta->Write(); + if (hMatchingVsPhi) hMatchingVsPhi->Write(); + if (hTOFmatchedDzVsStrip)hTOFmatchedDzVsStrip->Write(); + + //---------------------------------------------------- + /* PID PERFORMANCE MONITOR */ + + TH2F * hBetaP=(TH2F*)pidList->FindObject("hTOFmatchedESDpVsBeta"); + if (hBetaP) hBetaP->GetYaxis()->SetRangeUser(0.,1.2); + else Printf("Plot hBetaP not available (old aliroot?)"); + TH1F * hMass=(TH1F*)pidList->FindObject("hTOFmatchedMass"); + if (hMass){ + //hMass->SetMarkerColor(kBlue); + //hMass->SetLineColor(kBlue); + hMass->SetFillColor(kAzure+10); + hMass->SetFillStyle(1001); + hMass->Rebin(2); + hMass->GetYaxis()->SetTitle("tracks"); + hMass->GetYaxis()->SetTitleOffset(1.35); + hMass->GetXaxis()->SetLabelSize(0.03); + } else + Printf("Plot hMass not available (old aliroot?)"); - TH1F * hPionDiff=(TH1F*)pidList->At(3); - - TH2F * hDiffTimePi=(TH2F*)pidList->At(4); - if (!hDiffTimePi) { - Printf("Plot hDiffTimePi not available (old aliroot?)"); - } else { - hDiffTimePi->SetTitle("PIONS t-t_{exp,#pi} (from tracking) vs. P"); - hDiffTimePi->GetYaxis()->SetRangeUser(-2000.,2000.); - //hDiffTimePi->GetYaxis()->Rebin(2);//1 bin=10 ps - } + TH1F * hPionDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimePiVsEta"); + + TH2F * hDiffTimePi=(TH2F*)pidList->FindObject("hTOFmatchedExpTimePiVsP"); + if (!hDiffTimePi) { + Printf("Plot hDiffTimePi not available (old aliroot?)"); + } else { + hDiffTimePi->SetTitle("PIONS t-t_{exp,#pi} (from tracking) vs. P"); + hDiffTimePi->GetYaxis()->SetRangeUser(-2000.,2000.); + //hDiffTimePi->GetYaxis()->Rebin(2);//1 bin=10 ps + } - TH2F * hDiffTimePiTh=(TH2F*)pidList->At(6); - if (!hDiffTimePiTh) { - Printf("Plot hDiffTimePiTh not available (old aliroot?)"); - } else { - hDiffTimePiTh->SetTitle("PIONS t-t_{exp,#pi} (theoretical) vs. P"); - hDiffTimePiTh->GetYaxis()->SetRangeUser(-2000.,2000.); - //hDiffTimePiTh->GetYaxis()->Rebin(2);//1 bin=10 ps - } - - TH2F * hDiffTimeKa=(TH2F*)pidList->At(9); - if (!hDiffTimeKa) { - Printf("Plot hDiffTimeKa not available (old aliroot?)"); - } else { - hDiffTimeKa->SetTitle("KAONS t-t_{exp,K} (from tracking) vs. P"); - hDiffTimeKa->GetYaxis()->SetRangeUser(-2000.,2000.); - //hDiffTimeKa->GetYaxis()->Rebin(2);//1 bin=10 ps - } - - TH2F * hDiffTimeKaTh=(TH2F*)pidList->At(11); - if (!hDiffTimeKaTh) { - Printf("Plot hDiffTimeKaTh not available (old aliroot?)"); - } else { - hDiffTimeKaTh->SetTitle("KAONS t-t_{exp,K} (theoretical) vs. P"); - hDiffTimeKaTh->GetYaxis()->SetRangeUser(-2000.,2000.); - //hDiffTimeKaTh->GetYaxis()->Rebin(2);//1 bin=10 ps - } - - TH2F * hDiffTimePro=(TH2F*)pidList->At(14); - if (!hDiffTimePro) { - Printf("Plot hDiffTimePro not available (old aliroot?)"); - } else { - hDiffTimePro->SetTitle("PROTONS t-t_{exp,p} (from tracking) vs. P"); - hDiffTimePro->GetYaxis()->SetRangeUser(-2000.,2000.); - //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps - } + TH2F * hDiffTimePiTh=(TH2F*)pidList->FindObject("hTOFtheoreticalExpTimePiVsP"); + if (!hDiffTimePiTh) { + Printf("Plot hDiffTimePiTh not available (old aliroot?)"); + } else { + hDiffTimePiTh->SetTitle("PIONS t-t_{exp,#pi} (theoretical) vs. P"); + hDiffTimePiTh->GetYaxis()->SetRangeUser(-2000.,2000.); + //hDiffTimePiTh->GetYaxis()->Rebin(2);//1 bin=10 ps + } + + TH2F * hDiffTimeKa=(TH2F*)pidList->FindObject("hTOFmatchedExpTimeKaVsP"); + if (!hDiffTimeKa) { + Printf("Plot hDiffTimeKa not available (old aliroot?)"); + } else { + hDiffTimeKa->SetTitle("KAONS t-t_{exp,K} (from tracking) vs. P"); + hDiffTimeKa->GetYaxis()->SetRangeUser(-2000.,2000.); + //hDiffTimeKa->GetYaxis()->Rebin(2);//1 bin=10 ps + } + + TH2F * hDiffTimeKaTh=(TH2F*)pidList->FindObject("hTOFtheoreticalExpTimeKaVsP"); + if (!hDiffTimeKaTh) { + Printf("Plot hDiffTimeKaTh not available (old aliroot?)"); + } else { + hDiffTimeKaTh->SetTitle("KAONS t-t_{exp,K} (theoretical) vs. P"); + hDiffTimeKaTh->GetYaxis()->SetRangeUser(-2000.,2000.); + //hDiffTimeKaTh->GetYaxis()->Rebin(2);//1 bin=10 ps + } + + TH2F * hDiffTimePro=(TH2F*)pidList->FindObject("hTOFmatchedExpTimeProVsP"); + if (!hDiffTimePro) { + Printf("Plot hDiffTimePro not available (old aliroot?)"); + } else { + hDiffTimePro->SetTitle("PROTONS t-t_{exp,p} (from tracking) vs. P"); + hDiffTimePro->GetYaxis()->SetRangeUser(-2000.,2000.); + //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps + } - TH2F * hDiffTimeProTh=(TH2F*)pidList->At(16); - if (!hDiffTimeProTh) { - Printf("Plot hDiffTimeProTh not available (old aliroot?)"); - } else { - hDiffTimePro->SetTitle("PROTONS t-t_{exp,p} (theoretical) vs. P"); - hDiffTimeProTh->GetYaxis()->SetRangeUser(-2000.,2000.); - //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps - } - - if (displayAll){ - TCanvas *cPidPerformance= new TCanvas("cPidPerformance","summary of pid performance",800,800); - cPidPerformance->Divide(2,1); - cPidPerformance->cd(1); - gPad->SetGridy(); - gPad->SetGridx(); - gPad->SetLogz(); - if (hBetaP) hBetaP->Draw("colz"); + TH2F * hDiffTimeProTh=(TH2F*)pidList->FindObject("hTOFtheoreticalExpTimeProVsP"); + if (!hDiffTimeProTh) { + Printf("Plot hDiffTimeProTh not available (old aliroot?)"); + } else { + hDiffTimePro->SetTitle("PROTONS t-t_{exp,p} (theoretical) vs. P"); + hDiffTimeProTh->GetYaxis()->SetRangeUser(-2000.,2000.); + //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps + } + + if (displayAll){ + TCanvas *cPidPerformance= new TCanvas("cPidPerformance","summary of pid performance",800,800); + cPidPerformance->Divide(2,1); + cPidPerformance->cd(1); + gPad->SetGridy(); + gPad->SetGridx(); + gPad->SetLogz(); + if (hBetaP) hBetaP->Draw("colz"); - cPidPerformance->cd(2); - gPad->SetGridx(); - gPad->SetGridy(); - gPad->SetLogy(); - if (hMass) hMass->Draw("HIST BAR"); + cPidPerformance->cd(2); + gPad->SetGridx(); + gPad->SetGridy(); + gPad->SetLogy(); + if (hMass) hMass->Draw("HIST BAR"); - gStyle->SetOptStat(10); - TCanvas *cPidPerformance2= new TCanvas("cPidPerformance2","summary of pid performance - tracking",700,700); - cPidPerformance2->Divide(2,2); - cPidPerformance2->cd(1); - gPad->SetLogz(); - gPad->SetGridx(); - gPad->SetGridy(); - if (hDiffTimePi) hDiffTimePi->Draw("colz"); - cPidPerformance2->cd(2); - gPad->SetLogz(); - gPad->SetGridx(); - gPad->SetGridy(); - if (hDiffTimeKa) hDiffTimeKa->Draw("colz"); - cPidPerformance2->cd(3); - gPad->SetLogz(); - if (hDiffTimePro) hDiffTimePro->Draw("colz"); - - TCanvas *cPidPerformanceTh= new TCanvas("cPidPerformanceTh","summary of pid performance - theoretical times",700,700); - cPidPerformanceTh->Divide(2,2); - cPidPerformanceTh->cd(1); - gPad->SetLogz(); - gPad->SetGridx(); - gPad->SetGridy(); - if (hDiffTimePiTh) hDiffTimePiTh->Draw("colz"); - cPidPerformanceTh->cd(2); - gPad->SetLogz(); - gPad->SetGridx(); - gPad->SetGridy(); - if (hDiffTimeKaTh) hDiffTimeKaTh->Draw("colz"); - cPidPerformanceTh->cd(3); - gPad->SetLogz(); - gPad->SetGridx(); - gPad->SetGridy(); - if (hDiffTimeProTh) hDiffTimeProTh->Draw("colz"); - } + gStyle->SetOptStat(10); + TCanvas *cPidPerformance2= new TCanvas("cPidPerformance2","summary of pid performance - tracking",700,700); + cPidPerformance2->Divide(2,2); + cPidPerformance2->cd(1); + gPad->SetLogz(); + gPad->SetGridx(); + gPad->SetGridy(); + if (hDiffTimePi) hDiffTimePi->Draw("colz"); + cPidPerformance2->cd(2); + gPad->SetLogz(); + gPad->SetGridx(); + gPad->SetGridy(); + if (hDiffTimeKa) hDiffTimeKa->Draw("colz"); + cPidPerformance2->cd(3); + gPad->SetLogz(); + if (hDiffTimePro) hDiffTimePro->Draw("colz"); + + TCanvas *cPidPerformanceTh= new TCanvas("cPidPerformanceTh","summary of pid performance - theoretical times",700,700); + cPidPerformanceTh->Divide(2,2); + cPidPerformanceTh->cd(1); + gPad->SetLogz(); + gPad->SetGridx(); + gPad->SetGridy(); + if (hDiffTimePiTh) hDiffTimePiTh->Draw("colz"); + cPidPerformanceTh->cd(2); + gPad->SetLogz(); + gPad->SetGridx(); + gPad->SetGridy(); + if (hDiffTimeKaTh) hDiffTimeKaTh->Draw("colz"); + cPidPerformanceTh->cd(3); + gPad->SetLogz(); + gPad->SetGridx(); + gPad->SetGridy(); + if (hDiffTimeProTh) hDiffTimeProTh->Draw("colz"); + } - TH1F * hPionDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimePi"); - TH1F * hKaonDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimeKa"); - TH1F * hProtonDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimePro"); - TH2F * hDiffTimeT0TOFPion1GeV=(TH2F*)pidList->FindObject("hTOFmatchedTimePion1GeV"); - - fout->cd(); - if (hPionDiff) hPionDiff->Write(); - if (hKaonDiff) hKaonDiff->Write(); - if (hProtonDiff) hProtonDiff->Write(); - if (hBetaP) hBetaP->Write(); - if (hMass) hMass->Write(); - if (hDiffTimeT0TOFPion1GeV) hDiffTimeT0TOFPion1GeV->Write(); - if (hDiffTimePi) hDiffTimePi->Write(); - if (hDiffTimeKa) hDiffTimeKa->Write(); - if (hDiffTimePro) hDiffTimePro->Write(); - if (hDiffTimePiTh) hDiffTimePiTh->Write(); - if (hDiffTimeKaTh) hDiffTimeKaTh->Write(); - if (hDiffTimeProTh) hDiffTimeProTh->Write(); - - //SIGMAS PID - TH2F * hSigmaPi=(TH2F*)pidList->At(7); - TProfile * profSigmaPi = 0x0; - if (!hSigmaPi){ - Printf("Plot hSigmaPi not available (old aliroot?)"); - } else { - sprintf(profilename,"profSigmaPi"); - hSigmaPi->GetYaxis()->SetRangeUser(-5.,5.); - hSigmaPi->GetXaxis()->SetRangeUser(0.2,10.); - profSigmaPi = (TProfile*)hSigmaPi->ProfileX(profilename); - profSigmaPi->SetLineWidth(2); - profSigmaPi->SetLineColor(kRed+2); - } - - TH2F * hSigmaKa=(TH2F*)pidList->At(12); - TProfile * profSigmaKa = 0x0; - if (!hSigmaKa){ - Printf("Plot hSigmaKa not available (old aliroot?)"); - } else { - sprintf(profilename,"profSigmaKa"); - hSigmaKa->GetYaxis()->SetRangeUser(-5.,5.); - hSigmaKa->GetXaxis()->SetRangeUser(0.2,10.); - profSigmaKa = (TProfile*)hSigmaKa->ProfileX(profilename); - profSigmaKa->SetLineWidth(2); - profSigmaKa->SetLineColor(kBlue); - } + TH1F * hPionDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimePi"); + TH1F * hKaonDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimeKa"); + TH1F * hProtonDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimePro"); + TH2F * hDiffTimeT0TOFPion1GeV=(TH2F*)pidList->FindObject("hTOFmatchedTimePion1GeV"); + + fout->cd(); + if (hPionDiff) hPionDiff->Write(); + if (hKaonDiff) hKaonDiff->Write(); + if (hProtonDiff) hProtonDiff->Write(); + if (hBetaP) hBetaP->Write(); + if (hMass) hMass->Write(); + if (hDiffTimeT0TOFPion1GeV) hDiffTimeT0TOFPion1GeV->Write(); + if (hDiffTimePi) hDiffTimePi->Write(); + if (hDiffTimeKa) hDiffTimeKa->Write(); + if (hDiffTimePro) hDiffTimePro->Write(); + if (hDiffTimePiTh) hDiffTimePiTh->Write(); + if (hDiffTimeKaTh) hDiffTimeKaTh->Write(); + if (hDiffTimeProTh) hDiffTimeProTh->Write(); + + //SIGMAS PID + TH2F * hSigmaPi=(TH2F*)pidList->FindObject("hTOFExpSigmaPi"); + TProfile * profSigmaPi = 0x0; + if (!hSigmaPi){ + Printf("Plot hSigmaPi not available (old aliroot?)"); + } else { + sprintf(profilename,"profSigmaPi"); + hSigmaPi->GetYaxis()->SetRangeUser(-5.,5.); + hSigmaPi->GetXaxis()->SetRangeUser(0.2,10.); + profSigmaPi = (TProfile*)hSigmaPi->ProfileX(profilename); + profSigmaPi->SetLineWidth(2); + profSigmaPi->SetLineColor(kRed+2); + } + + TH2F * hSigmaKa=(TH2F*)pidList->FindObject("hTOFExpSigmaKa"); + TProfile * profSigmaKa = 0x0; + if (!hSigmaKa){ + Printf("Plot hSigmaKa not available (old aliroot?)"); + } else { + sprintf(profilename,"profSigmaKa"); + hSigmaKa->GetYaxis()->SetRangeUser(-5.,5.); + hSigmaKa->GetXaxis()->SetRangeUser(0.2,10.); + profSigmaKa = (TProfile*)hSigmaKa->ProfileX(profilename); + profSigmaKa->SetLineWidth(2); + profSigmaKa->SetLineColor(kBlue); + } - TH2F * hSigmaPro=(TH2F*)pidList->At(17); - TProfile * profSigmaPro = 0x0; - if (!hSigmaPro){ - Printf("Plot hSigmaPro not available (old aliroot?)"); - } else { - sprintf(profilename,"profSigmaPro"); - hSigmaPro->GetYaxis()->SetRangeUser(-5.,5.); - hSigmaPro->GetXaxis()->SetRangeUser(0.2,10.); - profSigmaPro = (TProfile*)hSigmaPro->ProfileX(profilename); - profSigmaPro->SetLineWidth(2); - profSigmaPro->SetLineColor(kGreen+2); - } - - if(includeStartTime){ - if(pidQAdir){ - TH2F * hSigmaPiT0=(TH2F*)tofPidListT0->FindObject("hNsigmaP_TOF_pion"); - hSigmaPiT0->GetYaxis()->SetRangeUser(-5.,5.); - hSigmaPiT0->GetXaxis()->SetRangeUser(0.2,10.); - hSigmaPiT0->FitSlicesY(); - TH1D * hSigmaPiT0_1 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_pion_1"); - TH1D * hSigmaPiT0_2 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_pion_2"); - hSigmaPiT0_1->SetLineColor(1); - hSigmaPiT0_1->SetLineWidth(2); - hSigmaPiT0_2->SetLineColor(2); - hSigmaPiT0_2->SetLineWidth(2); - - TH2F * hSigmaKaT0=(TH2F*)tofPidListT0->FindObject("hNsigmaP_TOF_kaon"); - hSigmaKaT0->GetYaxis()->SetRangeUser(-5.,5.); - hSigmaKaT0->GetXaxis()->SetRangeUser(0.2,10.); - hSigmaKaT0->FitSlicesY(); - TH1D * hSigmaKaT0_1 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_kaon_1"); - TH1D * hSigmaKaT0_2 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_kaon_2"); - hSigmaKaT0_1->SetLineColor(1); - hSigmaKaT0_1->SetLineWidth(2); - hSigmaKaT0_2->SetLineColor(2); - hSigmaKaT0_2->SetLineWidth(2); + TH2F * hSigmaPro=(TH2F*)pidList->FindObject("hTOFExpSigmaPro"); + TProfile * profSigmaPro = 0x0; + if (!hSigmaPro){ + Printf("Plot hSigmaPro not available (old aliroot?)"); + } else { + sprintf(profilename,"profSigmaPro"); + hSigmaPro->GetYaxis()->SetRangeUser(-5.,5.); + hSigmaPro->GetXaxis()->SetRangeUser(0.2,10.); + profSigmaPro = (TProfile*)hSigmaPro->ProfileX(profilename); + profSigmaPro->SetLineWidth(2); + profSigmaPro->SetLineColor(kGreen+2); + } + + if(includeStartTime && pidQAdir){ + TH2F * hSigmaPiT0=(TH2F*)tofPidListT0->FindObject("hNsigmaP_TOF_pion"); + hSigmaPiT0->GetYaxis()->SetRangeUser(-5.,5.); + hSigmaPiT0->GetXaxis()->SetRangeUser(0.2,10.); + hSigmaPiT0->FitSlicesY(); + TH1D * hSigmaPiT0_1 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_pion_1"); + TH1D * hSigmaPiT0_2 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_pion_2"); + hSigmaPiT0_1->SetLineColor(1); + hSigmaPiT0_1->SetLineWidth(2); + hSigmaPiT0_2->SetLineColor(2); + hSigmaPiT0_2->SetLineWidth(2); + + TH2F * hSigmaKaT0=(TH2F*)tofPidListT0->FindObject("hNsigmaP_TOF_kaon"); + hSigmaKaT0->GetYaxis()->SetRangeUser(-5.,5.); + hSigmaKaT0->GetXaxis()->SetRangeUser(0.2,10.); + hSigmaKaT0->FitSlicesY(); + TH1D * hSigmaKaT0_1 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_kaon_1"); + TH1D * hSigmaKaT0_2 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_kaon_2"); + hSigmaKaT0_1->SetLineColor(1); + hSigmaKaT0_1->SetLineWidth(2); + hSigmaKaT0_2->SetLineColor(2); + hSigmaKaT0_2->SetLineWidth(2); - TH2F * hSigmaProT0=(TH2F*)tofPidListT0->FindObject("hNsigmaP_TOF_proton"); - hSigmaProT0->GetYaxis()->SetRangeUser(-5.,5.); - hSigmaProT0->GetXaxis()->SetRangeUser(0.2,10.); - hSigmaProT0->FitSlicesY(); - TH1D * hSigmaProT0_1 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_proton_1"); - TH1D * hSigmaProT0_2 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_proton_2"); - hSigmaProT0_1->SetLineColor(1); - hSigmaProT0_1->SetLineWidth(2); - hSigmaProT0_2->SetLineColor(2); - hSigmaProT0_2->SetLineWidth(2); - } - } - if (displayAll){ - - TLegend * lSigmaPid=new TLegend(0.75,0.75,0.95,0.95,"#sigma_{PID}"); - lSigmaPid->AddEntry(profSigmaPi,"#pi^{#pm}","l"); - lSigmaPid->AddEntry(profSigmaKa,"K^{#pm}","l"); - lSigmaPid->AddEntry(profSigmaPro,"p^{#pm}","l"); + TH2F * hSigmaProT0=(TH2F*)tofPidListT0->FindObject("hNsigmaP_TOF_proton"); + hSigmaProT0->GetYaxis()->SetRangeUser(-5.,5.); + hSigmaProT0->GetXaxis()->SetRangeUser(0.2,10.); + hSigmaProT0->FitSlicesY(); + TH1D * hSigmaProT0_1 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_proton_1"); + TH1D * hSigmaProT0_2 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_proton_2"); + hSigmaProT0_1->SetLineColor(1); + hSigmaProT0_1->SetLineWidth(2); + hSigmaProT0_2->SetLineColor(2); + hSigmaProT0_2->SetLineWidth(2); + } + - TCanvas *cPidPerformance3= new TCanvas("cPidPerformance3","summary of pid performance - sigmas",1200,400); - cPidPerformance3->Divide(3,1); - cPidPerformance3->cd(1); - gPad->SetLogz(); - gPad->SetLogx(); - gPad->SetGridx(); - gPad->SetGridy(); - if (hSigmaPi){ - hSigmaPi->Draw("colz"); - profSigmaPi->Draw("same"); - } - cPidPerformance3->cd(2); - gPad->SetLogz(); - gPad->SetLogx(); - gPad->SetGridx(); - gPad->SetGridy(); - if (hSigmaKa){ - hSigmaKa->Draw("colz"); - profSigmaKa->Draw("same"); - } - cPidPerformance3->cd(3); - gPad->SetGridx(); - gPad->SetGridy(); - gPad->SetLogz(); - gPad->SetLogx(); - if (hSigmaPro){ - hSigmaPro->Draw("colz"); - profSigmaPro->Draw("same"); - } - - if(includeStartTime){ - if(pidQAdir){ - TLine *l1=new TLine(0.,0.,5.,0.); - TLine *l2=new TLine(0.,1.,5.,1.); - TCanvas *cPidPerformance3T0 = new TCanvas("cPidPerformance3T0","summary of pid performance - sigmas - with StartTime",1200,500); - cPidPerformance3T0->Divide(3,1); - cPidPerformance3T0->cd(1); - gPad->SetLogz(); - gPad->SetLogx(); - gPad->SetGridx(); - gPad->SetGridy(); - hSigmaPiT0->Draw("colz"); - hSigmaPiT0_1->Draw("same"); - hSigmaPiT0_2->Draw("same"); - l1->Draw("same"); - l2->Draw("same"); - cPidPerformance3T0->cd(2); - gPad->SetLogz(); - gPad->SetLogx(); - gPad->SetGridx(); - gPad->SetGridy(); - hSigmaKaT0->Draw("colz"); - hSigmaKaT0_1->Draw("same"); - hSigmaKaT0_2->Draw("same"); - l1->Draw("same"); - l2->Draw("same"); - cPidPerformance3T0->cd(3); - gPad->SetLogz(); - gPad->SetLogx(); - gPad->SetGridx(); - gPad->SetGridy(); - hSigmaProT0->Draw("colz"); - hSigmaProT0_1->Draw("same"); - hSigmaProT0_2->Draw("same"); - l1->Draw("same"); - l2->Draw("same"); - } - } - } - - fout->cd(); - if (hSigmaPi){ - hSigmaPi->Write(); - profSigmaPi->Write(); - } - if (hSigmaKa){ - hSigmaKa->Write(); - profSigmaKa->Write(); - } - if (hSigmaPro){ - hSigmaPro->Write(); - profSigmaPro->Write(); - } - if(includeStartTime) - { - if(pidQAdir){ - hSigmaPiT0->Write(); - hSigmaKaT0->Write(); - hSigmaProT0->Write(); + TCanvas *cPidPerformance3= new TCanvas("cPidPerformance3","summary of pid performance - sigmas",1200,400); + cPidPerformance3->Divide(3,1); + cPidPerformance3->cd(1); + gPad->SetLogz(); + gPad->SetLogx(); + gPad->SetGridx(); + gPad->SetGridy(); + if (hSigmaPi){ + hSigmaPi->Draw("colz"); + profSigmaPi->Draw("same"); + } + cPidPerformance3->cd(2); + gPad->SetLogz(); + gPad->SetLogx(); + gPad->SetGridx(); + gPad->SetGridy(); + if (hSigmaKa){ + hSigmaKa->Draw("colz"); + profSigmaKa->Draw("same"); + } + cPidPerformance3->cd(3); + gPad->SetGridx(); + gPad->SetGridy(); + gPad->SetLogz(); + gPad->SetLogx(); + if (hSigmaPro){ + hSigmaPro->Draw("colz"); + profSigmaPro->Draw("same"); + } + + if(includeStartTime && pidQAdir){ + TLine *l1=new TLine(0.,0.,5.,0.); + TLine *l2=new TLine(0.,1.,5.,1.); + TCanvas *cPidPerformance3T0 = new TCanvas("cPidPerformance3T0","summary of pid performance - sigmas - with StartTime",1200,500); + cPidPerformance3T0->Divide(3,1); + cPidPerformance3T0->cd(1); + gPad->SetLogz(); + gPad->SetLogx(); + gPad->SetGridx(); + gPad->SetGridy(); + hSigmaPiT0->Draw("colz"); + hSigmaPiT0_1->Draw("same"); + hSigmaPiT0_2->Draw("same"); + l1->Draw("same"); + l2->Draw("same"); + cPidPerformance3T0->cd(2); + gPad->SetLogz(); + gPad->SetLogx(); + gPad->SetGridx(); + gPad->SetGridy(); + hSigmaKaT0->Draw("colz"); + hSigmaKaT0_1->Draw("same"); + hSigmaKaT0_2->Draw("same"); + l1->Draw("same"); + l2->Draw("same"); + cPidPerformance3T0->cd(3); + gPad->SetLogz(); + gPad->SetLogx(); + gPad->SetGridx(); + gPad->SetGridy(); + hSigmaProT0->Draw("colz"); + hSigmaProT0_1->Draw("same"); + hSigmaProT0_2->Draw("same"); + l1->Draw("same"); + l2->Draw("same"); + } + + if (hSigmaPi){ + hSigmaPi->Write(); + profSigmaPi->Write(); + } + if (hSigmaKa){ + hSigmaKa->Write(); + profSigmaKa->Write(); + } + if (hSigmaPro){ + hSigmaPro->Write(); + profSigmaPro->Write(); + } + if(includeStartTime && pidQAdir){ + hSigmaPiT0->Write(); + hSigmaKaT0->Write(); + hSigmaProT0->Write(); - hSigmaPiT0_1->Write(); - hSigmaKaT0_1->Write(); - hSigmaProT0_1->Write(); - - hSigmaPiT0_2->Write(); - hSigmaKaT0_2->Write(); - hSigmaProT0_2->Write(); - } - } - TH2F* hTOFmatchedDzVsStrip = (TH2F*)generalList->FindObject("hTOFmatchedDzVsStrip"); - - if (displayAll){ - TCanvas* cProfile = new TCanvas("cProfile","cProfile",50,50,750,550); - gStyle->SetOptStat(0); - hTOFmatchedDzVsStrip->Draw("colz"); - Int_t binmin = hTOFmatchedDzVsStrip->GetYaxis()->FindBin(-3); - Int_t binmax = hTOFmatchedDzVsStrip->GetYaxis()->FindBin(3); - TProfile* hDzProfile = (TProfile*)hTOFmatchedDzVsStrip->ProfileX("hDzProfile",binmin, binmax); - hDzProfile->SetLineWidth(3); - hDzProfile->Draw("same"); - cProfile->SetGridx(); - cProfile->SetGridy(); - TString plotDir(Form("Plots_run%d",runNumber)); - gSystem->Exec(Form("mkdir %s",plotDir.Data())); - cPidPerformance3->Print(Form("%s/PID_sigmas.png",plotDir.Data())); - if(includeStartTime){ - if(pidQAdir) - cPidPerformance3T0->Print(Form("%s/%i_PID_sigmaStartTime.png", plotDir.Data())); - } - cPidPerformance->Print(Form("%s/PID.png",plotDir.Data())); - cPidPerformanceTh->Print(Form("%s/PID_theoreticalTimes.png",plotDir.Data())); - cPidPerformance2->Print(Form("%s/PID_ExpTimes.png",plotDir.Data())); - cMatchingPerformance->Print(Form("%s/Matching.png",plotDir.Data())); - cT0detector->Print(Form("%s/T0Detector.png",plotDir.Data())); - cTrackProperties->Print(Form("%s/TrackProperties.png",plotDir.Data())); - residuals->Print(Form("%s/Residuals.png",plotDir.Data())); - cProfile->Print(Form("%s/ProfileDZvsStripNumber.png",plotDir.Data())); - } - fout->cd(); - hTOFmatchedDzVsStrip->Write(); - fout->Close(); - fin->Close(); - return 0; + hSigmaPiT0_1->Write(); + hSigmaKaT0_1->Write(); + hSigmaProT0_1->Write(); + + hSigmaPiT0_2->Write(); + hSigmaKaT0_2->Write(); + hSigmaProT0_2->Write(); + } + + + if (displayAll){ + TCanvas* cProfile = new TCanvas("cProfile","cProfile",50,50,750,550); + gStyle->SetOptStat(0); + hTOFmatchedDzVsStrip->Draw("colz"); + Int_t binmin = hTOFmatchedDzVsStrip->GetYaxis()->FindBin(-3); + Int_t binmax = hTOFmatchedDzVsStrip->GetYaxis()->FindBin(3); + TProfile* hDzProfile = (TProfile*)hTOFmatchedDzVsStrip->ProfileX("hDzProfile",binmin, binmax); + hDzProfile->SetLineWidth(3); + hDzProfile->Draw("same"); + cProfile->SetGridx(); + cProfile->SetGridy(); + TString plotDir(Form("Plots_run%d",runNumber)); + gSystem->Exec(Form("mkdir %s",plotDir.Data())); + cPidPerformance->Print(Form("%s/PID.png",plotDir.Data())); + cPidPerformance2->Print(Form("%s/PID_ExpTimes.png",plotDir.Data())); + cPidPerformance3->Print(Form("%s/PID_sigmas.png",plotDir.Data())); + if(includeStartTime && pidQAdir) + cPidPerformance3T0->Print(Form("%s/%i_PID_sigmaStartTime.png", plotDir.Data())); + cMatchingPerformance->Print(Form("%s/Matching.png",plotDir.Data())); + residuals->Print(Form("%s/Residuals.png",plotDir.Data())); + cProfile->Print(Form("%s/ProfileDZvsStripNumber.png",plotDir.Data())); + if (displayAll) { + cPidPerformanceTh->Print(Form("%s/PID_theoreticalTimes.png",plotDir.Data())); + cT0detector->Print(Form("%s/T0Detector.png",plotDir.Data())); + cTrackProperties->Print(Form("%s/TrackProperties.png",plotDir.Data())); + } + } + fout->cd(); + fout->Close(); + fin->Close(); + return 0; } //---------------------------------------------------------- char * SetQAtrainOutputName(Int_t run=0,Int_t year=2011,char *period="LHC11a", char* pass="cpass1",Int_t trainId=76){ - char infile[200]; - sprintf(infile,"alien:///alice/data/%i/%s/000%d/ESDs/%s/QA%i/QAresults.root",year,period,runNumber,pass,trainId); - return infile; + char infile[200]; + sprintf(infile,"alien:///alice/data/%i/%s/000%d/ESDs/%s/QA%i/QAresults.root",year,period,runNumber,pass,trainId); + return infile; } -- 2.43.0