From 93f182e718db3889c47a3d9f11443500ceda494c Mon Sep 17 00:00:00 2001 From: martinez Date: Wed, 16 Nov 2011 18:28:21 +0000 Subject: [PATCH] Trending QA plots for Muon Tracking both for p-p and PbPb (Cynthia) --- PWG3/muon/{PlotMuonQApp.C => PlotMuonQA.C} | 859 ++++++++--- PWG3/muon/PlotMuonQAPbPb.C | 1572 -------------------- 2 files changed, 620 insertions(+), 1811 deletions(-) rename PWG3/muon/{PlotMuonQApp.C => PlotMuonQA.C} (62%) delete mode 100644 PWG3/muon/PlotMuonQAPbPb.C diff --git a/PWG3/muon/PlotMuonQApp.C b/PWG3/muon/PlotMuonQA.C similarity index 62% rename from PWG3/muon/PlotMuonQApp.C rename to PWG3/muon/PlotMuonQA.C index 2767abeb5b4..11489d760ed 100644 --- a/PWG3/muon/PlotMuonQApp.C +++ b/PWG3/muon/PlotMuonQA.C @@ -16,6 +16,9 @@ // // Author: Philippe Pillot - SUBATECH Nantes // Modified by Christophe Suire, Cynthia Hadjidakis - IPN Orsay +// To be done: +// - reorganize last part (reading and extracting info from run per run histos) +// - warning and error messages //-------------------------------------------------------------------------- #if !defined(__CINT__) || defined(__MAKECINT__) @@ -46,30 +49,33 @@ #endif TString GetRunList(const char *runList, TObjArray *runs, TObjArray *runs2); -//Bool_t GetTriggerLists(const char *triggerList, TObjArray *triggersB=0, TObjArray *triggersAC=0, TObjArray *triggersE=0); Bool_t GetTriggerLists(const char *triggerList, TString listFromContainer, TObjArray *triggersB=0, TObjArray *triggersAC=0, TObjArray *triggersE=0); void SetCanvas(TCanvas *canvas, Int_t logy=1); -TH1* ProcessHisto( AliCounterCollection* counter, TString variable, TString selection, TString hName="", TString xName="", TString yName="", Int_t color=1); +TH1* ProcessHisto( AliCounterCollection* counter, TString variable, TString selection, TString hName="", TString xName="", TString yName="", Int_t color=1, Bool_t empty = kFALSE); TH2* ProcessHisto2D( AliCounterCollection* counter, TString hVariable, TString hVariable2, TString hSelection, TString hName); TCanvas *ProcessCanvasTriggerContent(TObjArray *array, TH1 **histo, TH1 **histo2, TString canvasName); TCanvas *ProcessCanvasRelativeTriggerContent(TObjArray *array, TH1 **histo, TString canvasName, Int_t *colorTab); -TCanvas *ProcessCanvasPhysSelCut(TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TH1 **hBNoPS, TH1 **hACNoPS,TH1 **hENoPS, TH1 **hBWithPS, TString canvasName, Int_t *colorInd); -TCanvas *ProcessCanvasTracksoverTrigger(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName); -TCanvas *ProcessCanvasTrackMultB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName); -TCanvas *ProcessCanvasRatioTrackB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName); -TCanvas *ProcessCanvasAsymMatched(TObjArray *triggersB, TH1 **hPosMatchedB, TH1 **hNegMatchedB, TH1 **hAllMatchedB, Int_t indTrigger, TString canvasName); -TCanvas *ProcessCanvasHighPtMuons(TObjArray *triggersB, TH1 **hB, TH1 **hMatchedLowPtB, TH1 **hAllMatchedHightPtB, Int_t indTrigger, TString canvasName); +TCanvas *ProcessCanvasPhysSelCut(TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TH1 **hBNoPS, TH1 **hACNoPS,TH1 **hENoPS, TH1 **hBWithPS, TString canvasName, Int_t *colorInd, Bool_t isHeavyIon = kFALSE); +TCanvas *ProcessCanvasPhysSelCutCentrality(TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TH1 **hBNoPS, TH1 **hACNoPS, TH1 **hENoPS, TH1 **hBWithPS, Int_t k, TString canvasName, Int_t *colorInd, TString *legendHeader, Bool_t isHeavyIon = kFALSE); +TCanvas *ProcessCanvasCentralityPercentile(TObjArray *triggersB, TH1 **hBNoPSCent, TH1 **hBWithPSCent, Int_t k, TString canvasName, Int_t *colorInd, TString *legendHeader); +TCanvas *ProcessCanvasTracksoverTrigger(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader=""); +TCanvas *ProcessCanvasTrackMultB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader=""); +TCanvas *ProcessCanvasRatioTrackB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader=""); +TCanvas *ProcessCanvasAsymMatched(TObjArray *triggersB, TH1 **hPosMatchedB, TH1 **hNegMatchedB, TH1 **hAllMatchedB, Int_t indTrigger, TString canvasName,TString legendHeader=""); +TCanvas *ProcessCanvasHighPtMuons(TObjArray *triggersB, TH1 **hB, TH1 **hMatchedLowPtB, TH1 **hAllMatchedHightPtB, Int_t indTrigger, TString canvasName,TString legendHeader=""); Bool_t IsTrigger(TObjArray *array, Int_t index, TString name); +Bool_t IsHeavyIonCollision(AliCounterCollection *eventCounters); //-------------------------------------------------------------------------- -void PlotMuonQApp(const char* baseDir, const char* runList = 0x0, const char * triggerList = 0x0, Bool_t selectPhysics = kFALSE, const char *LHCPeriod = "LHC11c", const char *QAFileName = "QAresults.root") { +void PlotMuonQA(const char* baseDir, const char* runList = 0x0, const char * triggerList = 0x0, Bool_t selectPhysics = kFALSE, const char *LHCPeriod = "LHC11c", const char *QAFileName = "QAresults.root") { /// Macro for QA monitoring. /// Example: baseDir = "alien:///alice/cern.ch/user/p/ppillot/pp7TeV/LHC10d/MuonQA/pass1/results/". /// If runList != 0x0: only the given runs will be used. Otherwise use all runs found in baseDir. - + /// If triggerList !=0x0: only the given triggers are displayed. Otherwise use the default list of triggers (see GetTriggerLists) + #if defined(__CINT__) && !defined(__MAKECINT__) gSystem->Load("libTree"); gSystem->Load("libGeom"); @@ -119,21 +125,19 @@ void PlotMuonQApp(const char* baseDir, const char* runList = 0x0, const char * t } - //---------------------------------- // - // Run selection // - //---------------------------------- // + cout<<"//---------------------------------- //"<SetOwner(kTRUE); TObjArray *runs2 = new TObjArray(); runs2->SetOwner(kTRUE); TString selectRuns = GetRunList(runList,runs,runs2); - + // physics selection TString select = selectPhysics ? "selected:yes" : ""; - - - + cout<<"//---------------------------------- //"<GetKeyWords("trigger"); Bool_t success = GetTriggerLists(triggerList, listFromContainer, triggersB, triggersAC, triggersE); if(!success) return; - + + cout<<"//---------------------------------- //"<SetLeftMargin(0.18); cAll->cd(); //TH2* hAll = (TH2*) ProcessHisto2D(eventCounters, "trigger", "run", Form("run:any/%s",select.Data()) , ""); TH2* hAll = (TH2*) ProcessHisto2D(eventCounters, "trigger", "run", "run:any" , ""); + for ( Int_t ibin=1; ibin<=hAll->GetYaxis()->GetNbins(); ++ibin ) { + TString currLabel = hAll->GetYaxis()->GetBinLabel(ibin); + TObjArray* labelArray = currLabel.Tokenize("-"); + labelArray->SetOwner(); + TString newLabel = labelArray->At(0)->GetName(); + if ( labelArray->GetEntries() >= 2 ) newLabel = Form("%s-%s", newLabel.Data(), labelArray->At(1)->GetName()); + hAll->GetYaxis()->SetBinLabel(ibin, newLabel.Data()); + delete labelArray; + } hAll->Draw("TEXT"); @@ -188,130 +208,161 @@ void PlotMuonQApp(const char* baseDir, const char* runList = 0x0, const char * t TCanvas *c1 = new TCanvas(CanvasName.Data(),CanvasName.Data()); c1->cd(); - TH1* hBNoPS[10]={}; - TH1* hBWithPS[10]={}; - TH1* hB[10]={}; - TH1* hTriggerB[10], *hTrackerB[10], *hMatchedB[10], *hAllTracksB[10], *hMatchedLowPtB[10], *hMatchedHighPtB[10]; - TH1* hMatchedLowPtBNoPS[10], *hMatchedHighPtBNoPS[10]; - TH1* hPosMatchedB[10], *hNegMatchedB[10], *hAllMatchedB[10]; - TH1 *hACWithPS[10]={}; - TH1 *hACNoPS[10]={}; - TH1 *hEWithPS[10]={}; - TH1 *hENoPS[10]={}; + //Add a dimension here: All collisions / M.B / low mult. / high mult. + + //loop on centrality + Int_t centBin = 3; + Int_t const centBinMax = 4; + Int_t centBinMaxLoop = centBinMax; + if(!isHeavyIon) centBinMaxLoop = 1; + TString centBinName[centBinMax] = {"v0mult:any/","v0mult:low,int,high/","v0mult:low/","v0mult:high/"}; + TString centLegendName[centBinMax] ={"All collisions","[0-80%] from V0 amplitude","low mult. [60-80%] from V0 amplitude","high mult. [0-10%] from V0 amplitude"}; + TString centLegendNameShort[centBinMax] ={"All","[0-80%]","[60-80%]","[0-10%]"}; + TString selectionCent; + + + TH1* hBNoPS[centBinMax][10]={}; + TH1* hBWithPS[centBinMax][10]={}; + TH1* hB[centBinMax][10]={}; + TH1* hTriggerB[centBinMax][10], *hTrackerB[centBinMax][10], *hMatchedB[centBinMax][10], *hAllTracksB[centBinMax][10], *hMatchedLowPtB[centBinMax][10], *hMatchedHighPtB[centBinMax][10]; + TH1* hMatchedLowPtBNoPS[centBinMax][10], *hMatchedHighPtBNoPS[centBinMax][10]; + TH1* hPosMatchedB[centBinMax][10], *hNegMatchedB[centBinMax][10], *hAllMatchedB[centBinMax][10]; + TH1 *hACWithPS[centBinMax][10]={}; + TH1 *hACNoPS[centBinMax][10]={}; + TH1 *hEWithPS[centBinMax][10]={}; + TH1 *hENoPS[centBinMax][10]={}; if(triggersB->GetEntriesFast()>=10){ cout<<"Too many triggers"<GetEntriesFast(); i++){ + + + //loop on centrality + for(centBin = 0; centBin < centBinMaxLoop; centBin++){ + selectionCent = centBinName[centBin]; + + //Loop on trigger (last is all triggers, then for each defined trigger) + for(Int_t i = 0; i < triggersB->GetEntriesFast(); i++){ - TString histoNameBase = "h_trig", histoName; - histoNameBase+= i+1; + TString histoNameBase = "h_trig", histoName; + histoNameBase+= i+1; + Bool_t empty = kFALSE; - TString triggerName = ( (TObjString*) triggersB->At(i) )->GetString(); - // Histo trigger without Phys. Sel. - selection = Form("trigger:%s/%s", triggerName.Data(), selectRuns.Data()); - cout<At(i) )->GetString(); + if(triggerName.EqualTo(" ")) continue; + // Histo trigger without Phys. Sel. + selection = selectionCent; selection += Form("trigger:%s/%s", triggerName.Data(), selectRuns.Data()); + cout<At(i) )->GetString(); - // Histo trigger without Phys. Sel. AC - histoName = histoNameBase; - histoName += "ACNoPS"; - selection = Form("trigger:%s/%s", triggerNameAC.Data(), selectRuns.Data()); - hACNoPS[i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName); - // Histo trigger with Phys. Sel. AC - selection = Form("trigger:%s/%s/selected:yes", triggerNameAC.Data(), selectRuns.Data()); - histoName = histoNameBase; - histoName += "ACWithPS"; - hACWithPS[i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName); + TString triggerNameAC = ( (TObjString*) triggersAC->At(i) )->GetString(); + if(triggerNameAC.EqualTo(" ")) empty = kTRUE; + //if(empty == kTRUE) cout<< "test B="<At(i) )->GetString(); - // Histo trigger without Phys. Sel. E - selection = Form("trigger:%s/%s", triggerNameE.Data(), selectRuns.Data()); - histoName = histoNameBase; - histoName += "ENoPS"; - hENoPS[i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName); - // Histo trigger with Phys. Sel. E - selection = Form("trigger:%s/%s/selected:yes", triggerNameE.Data(), selectRuns.Data()); - histoName = histoNameBase; - histoName += "EWithPS"; - hEWithPS[i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName); - - // Histo tracking : Phys. Sel. is selected or not depending on the macro arguments - selection = Form("track:triggeronly/trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data()); - hTriggerB[i] = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); + TString triggerNameE = ( (TObjString*) triggersE->At(i) )->GetString(); + if(triggerNameE.EqualTo(" ")) empty = kTRUE; + //if(empty == kTRUE) cout<< "test B="<GetEntriesFast(); i++){ - count_trigger += hBNoPS[i]->GetEntries(); + count_trigger += hBNoPS[centBin][i]->GetEntries(); } if(count_trigger<=0) return; - Int_t NumOfBNoPS[10]; - Int_t NumOfBWithPS[10]; - Int_t NumOfACNoPS[10]; - Int_t NumOfENoPS[10]; - Int_t NumOfACWithPS[10]; - Int_t NumOfEWithPS[10]; - - for(Int_t i = 0; i < triggersB->GetEntriesFast(); i++){ - NumOfBNoPS[i] = hBNoPS[i]->Integral(); - NumOfBWithPS[i] = hBWithPS[i]->Integral(); - NumOfACNoPS[i] = hACNoPS[i]->Integral(); - NumOfENoPS[i] = hENoPS[i]->Integral(); - NumOfACWithPS[i] = hACWithPS[i]->Integral(); - NumOfEWithPS[i] = hEWithPS[i]->Integral(); + Int_t NumOfBNoPS[centBinMax][10]; + Int_t NumOfBWithPS[centBinMax][10]; + Int_t NumOfACNoPS[centBinMax][10]; + Int_t NumOfENoPS[centBinMax][10]; + Int_t NumOfACWithPS[centBinMax][10]; + Int_t NumOfEWithPS[centBinMax][10]; + + for(centBin = 0; centBin < centBinMaxLoop; centBin++){ + for(Int_t i = 0; i < triggersB->GetEntriesFast(); i++){ + NumOfBNoPS[centBin][i] = hBNoPS[centBin][i]->Integral(); + NumOfBWithPS[centBin][i] = hBWithPS[centBin][i]->Integral(); + NumOfACNoPS[centBin][i] = hACNoPS[centBin][i]->Integral(); + NumOfENoPS[centBin][i] = hENoPS[centBin][i]->Integral(); + NumOfACWithPS[centBin][i] = hACWithPS[centBin][i]->Integral(); + NumOfEWithPS[centBin][i] = hEWithPS[centBin][i]->Integral(); + } } - + centBin = 0; + cout<<"//==================================================================================="<Draw(); cTriggerContent->Print(OutFileNamePDF.Data()); cTriggerContent->Write(); @@ -335,7 +386,7 @@ void PlotMuonQApp(const char* baseDir, const char* runList = 0x0, const char * t cout<<"// new canvas with the relative content of each trigger w/o physics selection"<Draw(); cRelativeTriggerContent->Print(OutFileNamePDF.Data()); cRelativeTriggerContent->Write(); @@ -344,85 +395,184 @@ void PlotMuonQApp(const char* baseDir, const char* runList = 0x0, const char * t cout<<"// new canvas with effect from physics selection for each trigger and background trigger "<Draw(); cPhysSelCut->Print(OutFileNamePDF.Data()); cPhysSelCut->Write(); + + cout<<"//==================================================================================="<GetEntriesFast(); k++){ + //skip sum of all triggers + if(k == (triggersB->GetEntriesFast()-1)) continue; + //skip some triggers + if( !IsTrigger(triggersB,k,"CMB")&&!IsTrigger(triggersB, k, "CPBI") ) continue; + + canvasName = "PhysSel_trigger"; + canvasName +=k; + + TH1* hBNoPSCent[centBinMax-1]={hBNoPS[1][k],hBNoPS[2][k],hBNoPS[3][k]}; + TH1* hACNoPSCent[centBinMax-1]={hACNoPS[1][k],hACNoPS[2][k],hACNoPS[3][k]}; + TH1* hENoPSCent[centBinMax-1]={hENoPS[1][k],hENoPS[2][k],hENoPS[3][k]}; + TH1* hBWithPSCent[centBinMax-1]={hBWithPS[1][k],hBWithPS[2][k],hBWithPS[3][k]}; + + cPhysSelCutCentrality[k] = ProcessCanvasPhysSelCutCentrality(triggersB, triggersAC, triggersE, hBNoPSCent, hACNoPSCent, hENoPSCent, hBWithPSCent, k, canvasName, colorInd, centLegendNameShort+1, isHeavyIon); + cPhysSelCutCentrality[k]->Draw(); + cPhysSelCutCentrality[k]->Print(OutFileNamePDF.Data()); + cPhysSelCutCentrality[k]->Write(); + + } + } + + + cout<<"//==================================================================================="<GetEntriesFast(); k++){ + //skip sum of all triggers + if(k == (triggersB->GetEntriesFast()-1)) continue; + //skip some triggers + if( !IsTrigger(triggersB,k,"CMB")&&!IsTrigger(triggersB, k, "CPBI") ) continue; + + canvasName = "CentralityCheck_trigger"; + canvasName +=k; + + TH1* hBNoPSCent[centBinMax-1]={hBNoPS[1][k],hBNoPS[2][k],hBNoPS[3][k]}; + TH1* hBWithPSCent[centBinMax-1]={hBWithPS[1][k],hBWithPS[2][k],hBWithPS[3][k]}; + + cCentralityCheck[k] = ProcessCanvasCentralityPercentile(triggersB,hBNoPSCent,hBWithPSCent,k,canvasName,colorInd,centLegendNameShort+1 ); + + cCentralityCheck[k]->Draw(); + cCentralityCheck[k]->Print(OutFileNamePDF.Data()); + cCentralityCheck[k]->Write(); + + } + } + + cout<<"//==================================================================================="<GetEntriesFast(); k++){ - //skip sum of all triggers - if(k == (triggersB->GetEntriesFast()-1)) continue; - //skip some triggers - if( !IsTrigger(triggersB, k, "INT") && !IsTrigger(triggersB, k, "MUS" ) && !IsTrigger(triggersB, k, "ANY") && !IsTrigger(triggersB,k,"CMB") ) continue; + + + //loop on centrality bin + for ( centBin = 0; centBin < centBinMaxLoop; centBin++){ + if ( isHeavyIon ) legendHeader = centLegendName[centBin]; + //loop over trigger + for(k = 0; k < triggersB->GetEntriesFast(); k++){ + //skip sum of all triggers + if(k == (triggersB->GetEntriesFast()-1)) continue; + //skip some triggers + if( !IsTrigger(triggersB, k, "INT") && !IsTrigger(triggersB, k, "MUS" ) && !IsTrigger(triggersB, k, "ANY") && !IsTrigger(triggersB,k,"CMB")&&!IsTrigger(triggersB, k, "CPBI") ) continue; - cTracksoverTrigger[k]= ProcessCanvasTracksoverTrigger(triggersB, hB, hTrackerB, hTriggerB, hMatchedB, hAllTracksB, k, "RatioTrackTypes"); - cTracksoverTrigger[k]->Draw(); - cTracksoverTrigger[k]->Print(OutFileNamePDF.Data()); - cTracksoverTrigger[k]->Write(); - - cTrackMultB[k]= ProcessCanvasTrackMultB(triggersB, hB, hTrackerB, hTriggerB, hMatchedB, hAllTracksB, k, "TrackMult"); - cTrackMultB[k]->Draw(); - cTrackMultB[k]->Print(OutFileNamePDF.Data()); - cTrackMultB[k]->Write(); - - cRatioTrackB[k]= ProcessCanvasRatioTrackB(triggersB, hB, hTrackerB, hTriggerB, hMatchedB, hAllTracksB, k, "RatioTrackB"); - cRatioTrackB[k]->Draw(); - cRatioTrackB[k]->Print(OutFileNamePDF.Data()); - cRatioTrackB[k]->Write(); + canvasName = "RatioTrackTypes_cent"; + canvasName += centBin; + canvasName +="trigger"; + canvasName +=k; + cTracksoverTrigger[centBin][k]= ProcessCanvasTracksoverTrigger(triggersB, hB[centBin], hTrackerB[centBin], hTriggerB[centBin], hMatchedB[centBin], hAllTracksB[centBin], k, canvasName,legendHeader); + cTracksoverTrigger[centBin][k]->Draw(); + cTracksoverTrigger[centBin][k]->Print(OutFileNamePDF.Data()); + cTracksoverTrigger[centBin][k]->Write(); + + canvasName = "TrackMult_cent"; + canvasName += centBin; + canvasName +="trigger"; + canvasName +=k; + cTrackMultB[centBin][k]= ProcessCanvasTrackMultB(triggersB, hB[centBin], hTrackerB[centBin], hTriggerB[centBin], hMatchedB[centBin], hAllTracksB[centBin], k, canvasName, legendHeader); + cTrackMultB[centBin][k]->Draw(); + cTrackMultB[centBin][k]->Print(OutFileNamePDF.Data()); + cTrackMultB[centBin][k]->Write(); + + canvasName = "RatioTrackB_cent"; + canvasName += centBin; + canvasName +="trigger"; + canvasName +=k; + cRatioTrackB[centBin][k]= ProcessCanvasRatioTrackB(triggersB, hB[centBin], hTrackerB[centBin], hTriggerB[centBin], hMatchedB[centBin], hAllTracksB[centBin], k, canvasName, legendHeader); + cRatioTrackB[centBin][k]->Draw(); + cRatioTrackB[centBin][k]->Print(OutFileNamePDF.Data()); + cRatioTrackB[centBin][k]->Write(); + } } - cout<<"//===================================================="<GetEntriesFast(); k++){ - //skip sum of all triggers - if(k == (triggersB->GetEntriesFast()-1)) continue; - //skip some triggers - if( !IsTrigger(triggersB, k, "MUS" ) ) continue; - - cAsymMatched[k]= ProcessCanvasAsymMatched(triggersB, hPosMatchedB, hNegMatchedB, hAllMatchedB, k, "AsymMatched"); - cAsymMatched[k]->Draw(); - cAsymMatched[k]->Print(OutFileNamePDF.Data()); - cAsymMatched[k]->Write(); + TCanvas *cAsymMatched[centBinMax][10]; + + //Loop on centrality + for ( centBin = 0; centBin < centBinMaxLoop; centBin++){ + if ( isHeavyIon ) legendHeader = centLegendName[centBin]; + //loop over trigger + for(k = 0; k < triggersB->GetEntriesFast(); k++){ + //skip sum of all triggers + if(k == (triggersB->GetEntriesFast()-1)) continue; + //skip some triggers + if( !(IsTrigger(triggersB, k, "INT") || IsTrigger(triggersB, k, "MUS" ) || IsTrigger(triggersB,k,"CMB")|| IsTrigger(triggersB, k, "CPBI")) ) continue; + + canvasName = "AsymMatched"; + canvasName += centBin; + canvasName +="trigger"; + canvasName +=k; + cAsymMatched[centBin][k]= ProcessCanvasAsymMatched(triggersB, hPosMatchedB[centBin], hNegMatchedB[centBin], hAllMatchedB[centBin], k, canvasName,legendHeader); + cAsymMatched[centBin][k]->Draw(); + cAsymMatched[centBin][k]->Print(OutFileNamePDF.Data()); + cAsymMatched[centBin][k]->Write(); + } } - cout<<"//=================================================="<GetEntriesFast(); k++){ - //skip sum of all triggers - if(k == (triggersB->GetEntriesFast()-1)) continue; - //skip some triggers - if( !IsTrigger(triggersB, k, "MUS" ) ) continue; + TCanvas *cHighPtMuons[3][10]; + + //Loop on centrality + for ( centBin = 0; centBin < centBinMaxLoop; centBin++){ + if ( isHeavyIon ) legendHeader = centLegendName[centBin]; + //loop over trigger + for(k = 0; k < triggersB->GetEntriesFast(); k++){ + //skip sum of all triggers + if(k == (triggersB->GetEntriesFast()-1)) continue; + //skip some triggers + if( !(IsTrigger(triggersB, k, "INT") || IsTrigger(triggersB, k, "MUS" ) || IsTrigger(triggersB,k,"CMB")|| IsTrigger(triggersB, k, "CPBI")) ) continue; - cHighPtMuons[k]= ProcessCanvasHighPtMuons(triggersB, hB, hMatchedLowPtB, hMatchedHighPtB, k, "HighPtMuons"); - cHighPtMuons[k]->Draw(); - cHighPtMuons[k]->Print(OutFileNamePDF.Data()); - cHighPtMuons[k]->Write(); + canvasName = "HighPtMuons"; + canvasName += centBin; + canvasName +="trigger"; + canvasName +=k; + + cHighPtMuons[centBin][k]= ProcessCanvasHighPtMuons(triggersB, hB[centBin], hMatchedLowPtB[centBin], hMatchedHighPtB[centBin], k, canvasName,legendHeader); + cHighPtMuons[centBin][k]->Draw(); + cHighPtMuons[centBin][k]->Print(OutFileNamePDF.Data()); + cHighPtMuons[centBin][k]->Write(); + } } // close merged file @@ -432,52 +582,55 @@ void PlotMuonQApp(const char* baseDir, const char* runList = 0x0, const char * t //Print out the number of trigger without and with Phys. Sel. //=================================================================================== + centBin = 0; cout << endl << endl; //==================================================== if (PRINTSTAT){ - // set the format to print labels - THashList* labels = hBWithPS[kCMUS]->GetXaxis()->GetLabels(); - TString format(Form("\n%%%ds %%9d",0)); - Int_t nRuns=0; + if ( triggersB->At(kCMUS) ) { - // print value for each label - TObjString* label = 0x0; - TIter nextLabel(labels); - cout << "-------------------------------------------------" << endl; - cout << "Run Number" << "\t Number of "<< ( (TObjString*) triggersB->At(kCMUS) )->GetString()<<" after Phys. Sel. " << endl ; - while ((label = static_cast(nextLabel()))) { - nRuns++; - Int_t bin = (Int_t) label->GetUniqueID(); - printf(format.Data(), label->String().Data(), (Int_t) hBWithPS[kCMUS]->GetBinContent(bin)); - } - printf("\n========== Total #runs = %d ==============\n",nRuns); - printf("\n\n"); + // set the format to print labels + THashList* labels = hBWithPS[centBin][kCMUS]->GetXaxis()->GetLabels(); + TString format(Form("\n%%%ds %%9d",0)); + Int_t nRuns=0; + // print value for each label + TObjString* label = 0x0; + TIter nextLabel(labels); + cout << "-------------------------------------------------" << endl; + cout << "Run Number" << "\t Number of "<< ( (TObjString*) triggersB->At(kCMUS) )->GetString()<<" after Phys. Sel. " << endl ; + while ((label = static_cast(nextLabel()))) { + nRuns++; + Int_t bin = (Int_t) label->GetUniqueID(); + printf(format.Data(), label->String().Data(), (Int_t) hBWithPS[centBin][kCMUS]->GetBinContent(bin)); + } + printf("\n========== Total #runs = %d ==============\n",nRuns); + printf("\n\n"); - cout << "-------------------------------------------------" << endl; - cout << "Total statistic" << endl; - cout << " " << endl ; - cout << "-------------------------------------------------------------------" << endl; - cout<<"Number of triggers w/o Phys. Sel./ w/ Phys. Sel (Phys. Sel. cut in %)"<GetEntriesFast()-1; i++){ - TString triggerNameB = ( (TObjString*) triggersB->At(i) )->GetString(); - TString triggerNameAC = ( (TObjString*) triggersAC->At(i) )->GetString(); - TString triggerNameE = ( (TObjString*) triggersE->At(i) )->GetString(); + cout << "-------------------------------------------------" << endl; + cout << "Total statistic" << endl; + cout << " " << endl ; + + cout << "-------------------------------------------------------------------" << endl; + cout<<"Number of triggers w/o Phys. Sel./ w/ Phys. Sel (Phys. Sel. cut in %)"<GetEntriesFast()-1; i++){ + TString triggerNameB = ( (TObjString*) triggersB->At(i) )->GetString(); + TString triggerNameAC = ( (TObjString*) triggersAC->At(i) )->GetString(); + TString triggerNameE = ( (TObjString*) triggersE->At(i) )->GetString(); - Int_t cutinpercent = 0; - printf("%10s %30s %30s\n",triggerNameB.Data(),triggerNameAC.Data(),triggerNameE.Data()); - if(NumOfBNoPS[i]) cutinpercent = (Int_t) ((Double_t)(NumOfBNoPS[i]-NumOfBWithPS[i])/(NumOfBNoPS[i])*100.); - printf("%5.2e / %.2e (%d%%)", (Double_t) NumOfBNoPS[i],(Double_t) NumOfBWithPS[i],cutinpercent); - cutinpercent = 0; - if(NumOfACNoPS[i]) cutinpercent = (Int_t) ((Double_t)(NumOfACNoPS[i]-NumOfACWithPS[i])/(NumOfACNoPS[i])*100.); - printf("%15.2e / %.2e (%d%%)", (Double_t)NumOfACNoPS[i],(Double_t)NumOfACWithPS[i],cutinpercent); - cutinpercent = 0; - if(NumOfENoPS[i]) cutinpercent = (Int_t) ((Double_t)(NumOfENoPS[i]-NumOfEWithPS[i])/(NumOfENoPS[i])*100.); - printf("%15.2e / %.2e (%d%%)\n", (Double_t)NumOfENoPS[i],(Double_t)NumOfEWithPS[i],cutinpercent); + Int_t cutinpercent = 0; + printf("%10s %30s %30s\n",triggerNameB.Data(),triggerNameAC.Data(),triggerNameE.Data()); + if(NumOfBNoPS[centBin][i]) cutinpercent = (Int_t) ((Double_t)(NumOfBNoPS[centBin][i]-NumOfBWithPS[centBin][i])/(NumOfBNoPS[centBin][i])*100.); + printf("%5.2e / %.2e (%d%%)", (Double_t) NumOfBNoPS[centBin][i],(Double_t) NumOfBWithPS[centBin][i],cutinpercent); + cutinpercent = 0; + if(NumOfACNoPS[centBin][i]) cutinpercent = (Int_t) ((Double_t)(NumOfACNoPS[centBin][i]-NumOfACWithPS[centBin][i])/(NumOfACNoPS[centBin][i])*100.); + printf("%15.2e / %.2e (%d%%)", (Double_t)NumOfACNoPS[centBin][i],(Double_t)NumOfACWithPS[centBin][i],cutinpercent); + cutinpercent = 0; + if(NumOfENoPS[centBin][i]) cutinpercent = (Int_t) ((Double_t)(NumOfENoPS[centBin][i]-NumOfEWithPS[centBin][i])/(NumOfENoPS[centBin][i])*100.); + printf("%15.2e / %.2e (%d%%)\n", (Double_t)NumOfENoPS[centBin][i],(Double_t)NumOfEWithPS[centBin][i],cutinpercent); - } - + } + } } @@ -538,7 +691,7 @@ void PlotMuonQApp(const char* baseDir, const char* runList = 0x0, const char * t command = Form("find %s/ %s/%s", alienBaseDir.Data(), run.Data(), QAFileName); res = gGrid->Command(command); if (!res) { - Error("PlotMUONQApp","no result for the command: %s",command.Data()); + Error("PlotMuonQA","no result for the command: %s",command.Data()); return; } } @@ -590,14 +743,14 @@ void PlotMuonQApp(const char* baseDir, const char* runList = 0x0, const char * t if(iLoop>iLoopMax) break; if (!objs || !objs->GetString().Length()) { - Error("PlotMUONQApp","turl/obj not found for the run %s... SKIPPING", run.Data()); + Error("PlotMuonQA","turl/obj not found for the run %s... SKIPPING", run.Data()); continue; } // open the outfile for this run TFile *runFile = TFile::Open(objs->GetString()); if (!runFile || ! runFile->IsOpen()) { - Error("PlotMUONQApp","failed to open file: %s", objs->GetName()); + Error("PlotMuonQA","failed to open file: %s", objs->GetName()); continue;//return; } runFile->Cd("MUON_QA"); @@ -608,7 +761,7 @@ void PlotMuonQApp(const char* baseDir, const char* runList = 0x0, const char * t TObjArray* expert = static_cast(runFile->FindObjectAny("expert")); if (!general1 || !general2 || !expert){ - Error("PlotMUONQApp","All objects not here !!! ===> Skipping...for %s",objs->GetName()); + Error("PlotMuonQA","All objects not here !!! ===> Skipping...for %s",objs->GetName()); continue; } @@ -666,7 +819,7 @@ void PlotMuonQApp(const char* baseDir, const char* runList = 0x0, const char * t // skip empty runs... not anymore ! cs ! if (!hNClustersPerCh) { - Warning("PlotMUONQApp","File: %s has empty histograms !", objs->GetName()); + Warning("PlotMUONQA","File: %s has empty histograms !", objs->GetName()); hNClustersPerTrackVsRun_Mean->SetBinContent(ibin, 0.); hNClustersPerTrackVsRun_Mean->SetBinError(ibin, 1.); hNClustersPerTrackVsRun_Sigma->SetBinContent(ibin, 0.); @@ -720,6 +873,10 @@ void PlotMuonQApp(const char* baseDir, const char* runList = 0x0, const char * t run.ReplaceAll(alienBaseDir, ""); run.Remove(TString::kLeading, '/'); run.Remove(TString::kLeading, '0'); + for ( Int_t ihisto=0; ihisto<2; ++ihisto ) { + hTriggerCutVsRun[ihisto]->GetXaxis()->SetBinLabel(ibin,run.Data()); + hTriggerCutWidthVsRun[ihisto]->GetXaxis()->SetBinLabel(ibin,run.Data()); + } hNClustersPerTrackVsRun_Mean->GetXaxis()->SetBinLabel(ibin, run.Data()); hNClustersPerTrackVsRun_Sigma->GetXaxis()->SetBinLabel(ibin, run.Data()); hNChamberHitPerTrack_Mean->GetXaxis()->SetBinLabel(ibin, run.Data()); @@ -974,6 +1131,21 @@ Bool_t IsTrigger(TObjArray *array, Int_t index, TString name){ return process; } +Bool_t IsHeavyIonCollision(AliCounterCollection *eventCounters){ + + if(!eventCounters) return kFALSE; + + Double_t sum = eventCounters->GetSum("v0mult:low,int,high"); + Bool_t result = kTRUE; + if(sum<=0) result = kFALSE; + + cout<<" Collision type is set to "; + if( result == kFALSE) cout<<"p-p"<GetEntriesFast(); i++){ //skip the sum of all triggers - if( i== (array->GetEntriesFast()-1) ) continue; + if( i == (array->GetEntriesFast()-1) ) continue; hBNoPS[i]->SetLineStyle(2); if(i==0){ hBNoPS[i]->SetMinimum(1e-3); @@ -1059,10 +1231,14 @@ TCanvas *ProcessCanvasRelativeTriggerContent(TObjArray *triggersB, TH1 **histo, return cRelativeTriggerContent; } -TCanvas *ProcessCanvasPhysSelCut(TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TH1 **hBNoPS, TH1 **hACNoPS, TH1 **hENoPS, TH1 **hBWithPS, TString canvasName, Int_t *colorInd){ +TCanvas *ProcessCanvasPhysSelCut(TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TH1 **hBNoPS, TH1 **hACNoPS, TH1 **hENoPS, TH1 **hBWithPS, TString canvasName, Int_t *colorInd, Bool_t isHeavyIon){ if(!triggersB || !triggersE || !triggersAC || !hBNoPS || !hACNoPS || !hENoPS || !hBWithPS || !colorInd) return 0x0; + //Multiplicative factor for A,C and E triggers + Float_t scale = 3; //3 for pp - 10 for PbPb + if(isHeavyIon) scale = 10; + TString cName = "c"; cName += canvasName; TCanvas *c1 = new TCanvas(canvasName,cName,1200,900); @@ -1077,6 +1253,11 @@ TCanvas *ProcessCanvasPhysSelCut(TObjArray *triggersB, TObjArray *triggersAC, TO TString hName; for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){ + + //scale A, C and E triggers + hACNoPS[i]->Scale(scale); + hENoPS[i]->Scale(scale); + hName = "ratio"; hName += ( (TObjString*) triggersB->At(i) )->GetString(); ratioB[i] = static_cast (hBWithPS[i]->Clone(hName)); @@ -1120,9 +1301,10 @@ TCanvas *ProcessCanvasPhysSelCut(TObjArray *triggersB, TObjArray *triggersAC, TO if(i==0){ ratioB[i]->SetMaximum(1.5); - ratioB[i]->SetMinimum(0.001); + ratioB[i]->SetMinimum(0.05); ratioB[i]->SetLabelSize(0.02); - ratioB[i]->GetYaxis()->SetTitle("Relative trigger content w/ and w/o Phys. Sel."); + ratioB[i]->GetYaxis()->SetTitle("Accepted / All from Phys. Sel."); + ratioB[i]->SetTitle("Phys. Sel. for all selected triggers"); ratioB[i]->Draw("E"); //ratioBNoPS[i]->Draw("EPSAME"); ratioACNoPS[i]->Draw("EPSAME"); @@ -1143,8 +1325,135 @@ TCanvas *ProcessCanvasPhysSelCut(TObjArray *triggersB, TObjArray *triggersAC, TO legcRTC->AddEntry(".","not applied :",""); for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){ //legcRTC->AddEntry(ratioBNoPS[i],(( (TObjString*) triggersB->At(i) )->GetString()).Data(),"pl"); - legcRTC->AddEntry(ratioACNoPS[i],(( (TObjString*) triggersAC->At(i) )->GetString()).Data(),"pl"); - legcRTC->AddEntry(ratioENoPS[i],(( (TObjString*) triggersE->At(i) )->GetString()).Data(),"pl"); + TString textLegend = ( (TObjString*) triggersAC->At(i) )->GetString(); + if( textLegend.CompareTo(" ") ){ + textLegend += " x"; + textLegend += scale; + legcRTC->AddEntry(ratioACNoPS[i],textLegend.Data(),"pl"); + } + textLegend = ( (TObjString*) triggersE->At(i) )->GetString(); + if( textLegend.CompareTo(" ") ){ + //cout<<"trigger="<AddEntry(ratioENoPS[i],textLegend.Data(),"pl"); + } + } + legcRTC->Draw("same"); + + + return c1; +} + +TCanvas *ProcessCanvasPhysSelCutCentrality(TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TH1 **hBNoPSCent, TH1 **hACNoPSCent, TH1 **hENoPSCent, TH1 **hBWithPSCent, Int_t k, TString canvasName, Int_t *colorInd, TString *legendHeader, Bool_t isHeavyIon){ + + if(!triggersB || !triggersE || !triggersAC || !hBNoPSCent || !hACNoPSCent || !hENoPSCent || !hBWithPSCent || !colorInd || !legendHeader) return 0x0; + + //Multiplicative factor for A,C and E triggers + Float_t scale = 3; //3 for pp - 10 for PbPb + if(isHeavyIon) scale = 10; + + TString cName = "c"; + cName += canvasName; + TCanvas *c1 = new TCanvas(canvasName,cName,1200,900); + SetCanvas(c1); + c1->cd(); + + Int_t const centBinMax =3; + TH1* ratioB[centBinMax], *ratioBNoPS[centBinMax]; + TH1* ratioACNoPS[centBinMax]; + TH1* ratioENoPS[centBinMax]; + TLegend* legcRTC = new TLegend(0.2,0.15,0.50,0.40); + legcRTC->SetHeader("Physics Selection"); + + TString hName; + + Float_t yMin = 0.05, yMax = 2; + + for(Int_t centBin = 0; centBin < centBinMax; centBin++){ + //scale A, C and E triggers + hACNoPSCent[centBin]->Scale(scale); + hENoPSCent[centBin]->Scale(scale); + + hName = "ratio"; + hName += ( (TObjString*) triggersB->At(k) )->GetString(); + ratioB[centBin] = static_cast (hBWithPSCent[centBin]->Clone(hName)); + ratioB[centBin]->Divide(hBNoPSCent[centBin]); + ratioB[centBin]->SetLineWidth(2); + ratioB[centBin]->SetLineColor(colorInd[centBin]); + hName = "ratioNoPS"; + hName += ( (TObjString*) triggersB->At(k) )->GetString(); + ratioBNoPS[centBin] = static_cast (hBNoPSCent[centBin]->Clone(hName)); + ratioBNoPS[centBin]->Divide(hBNoPSCent[centBin]); + ratioBNoPS[centBin]->SetLineWidth(0); + ratioBNoPS[centBin]->SetLineStyle(1); + ratioBNoPS[centBin]->SetMarkerStyle(24+centBin); + ratioBNoPS[centBin]->SetMarkerSize(1); + ratioBNoPS[centBin]->SetLineColor(colorInd[centBin]); + ratioBNoPS[centBin]->SetMarkerColor(colorInd[centBin]); + + hName = "ratioACNoPS"; + hName += ( (TObjString*) triggersAC->At(k) )->GetString(); + ratioACNoPS[centBin] = static_cast (hACNoPSCent[centBin]->Clone(hName)); + ratioACNoPS[centBin]->Divide(hBNoPSCent[centBin]); + ratioACNoPS[centBin]->SetLineWidth(0); + ratioACNoPS[centBin]->SetLineStyle(2); + ratioACNoPS[centBin]->SetMarkerStyle(24+centBin); + ratioACNoPS[centBin]->SetMarkerSize(1); + ratioACNoPS[centBin]->SetLineColor(colorInd[centBin]); + ratioACNoPS[centBin]->SetMarkerColor(colorInd[centBin]); + + + hName = "ratioENoPS"; + hName += ( (TObjString*) triggersE->At(k) )->GetString(); + ratioENoPS[centBin] = static_cast (hENoPSCent[centBin]->Clone(hName)); + ratioENoPS[centBin]->Divide(hBNoPSCent[centBin]); + ratioENoPS[centBin]->SetLineWidth(0); + ratioENoPS[centBin]->SetLineStyle(3); + ratioENoPS[centBin]->SetMarkerStyle(24+centBin); + ratioENoPS[centBin]->SetMarkerSize(1); + ratioENoPS[centBin]->SetLineColor(colorInd[centBin]); + ratioENoPS[centBin]->SetMarkerColor(colorInd[centBin]); + + + if(centBin==0){ + ratioB[centBin]->SetMaximum(yMax); + ratioB[centBin]->SetMinimum(yMin); + ratioB[centBin]->SetLabelSize(0.02); + ratioB[centBin]->GetYaxis()->SetTitle("Accepted / All from Phys. Sel."); + ratioB[centBin]->SetTitle(Form("Phys. Sel. for %s - Multiplicity from V0 amplitude",(( (TObjString*) triggersB->At(k) )->GetString()).Data() )); + ratioB[centBin]->Draw("E"); + //ratioBNoPS[centBin]->Draw("EPSAME"); + ratioACNoPS[centBin]->Draw("EPSAME"); + ratioENoPS[centBin]->Draw("EPSAME"); + } + else{ + ratioB[centBin]->Draw("ESAME"); + //ratioBNoPS[centBin]->Draw("EPSAME"); + ratioACNoPS[centBin]->Draw("EPSAME"); + ratioENoPS[centBin]->Draw("EPSAME"); + } + } + + legcRTC->AddEntry(".","applied :",""); + for(Int_t centBin = 0; centBin < centBinMax; centBin++){ + legcRTC->AddEntry(ratioB[centBin],(legendHeader[centBin]).Data(),"l"); + } + legcRTC->AddEntry(".","not applied :",""); + for(Int_t centBin = 0; centBin < centBinMax; centBin++){ + TString textLegend = ( (TObjString*) triggersAC->At(k) )->GetString(); + if( textLegend.CompareTo(" ") && ratioACNoPS[centBin]->GetMaximum() > yMin ){ + textLegend += " x"; + textLegend += scale; + legcRTC->AddEntry(ratioACNoPS[centBin],textLegend.Data(),"pl"); + } + textLegend = ( (TObjString*) triggersE->At(k) )->GetString(); + if( textLegend.CompareTo(" ") && ratioENoPS[centBin]->GetMaximum() > yMin){ + //cout<<"trigger="<AddEntry(ratioENoPS[centBin],textLegend.Data(),"pl"); + } } legcRTC->Draw("same"); @@ -1152,8 +1461,76 @@ TCanvas *ProcessCanvasPhysSelCut(TObjArray *triggersB, TObjArray *triggersAC, TO return c1; } +TCanvas *ProcessCanvasCentralityPercentile(TObjArray *triggersB, TH1 **hBNoPSCent, TH1 **hBWithPSCent, Int_t k, TString canvasName, Int_t *colorInd, TString *legendHeader){ + + if(!triggersB || !hBNoPSCent || !hBWithPSCent || !colorInd || !legendHeader) return 0x0; + + TString cName = "c"; + cName += canvasName; + TCanvas *c1 = new TCanvas(canvasName,cName,1200,900); + SetCanvas(c1,0); + c1->cd(); + + Int_t const centBinMax =2; + TH1* ratioB[centBinMax], *ratioBNoPS[centBinMax]; + TLegend* legcRTC = new TLegend(0.2,0.15,0.50,0.40); + legcRTC->SetHeader("Physics Selection"); + + TString hName; + + Float_t yMin = 0., yMax = 0.3; + + for(Int_t centBin = 0; centBin < centBinMax; centBin++){ + + hName = "ratio"; + hName += ( (TObjString*) triggersB->At(k) )->GetString(); + ratioB[centBin] = static_cast (hBWithPSCent[centBin+1]->Clone(hName)); + ratioB[centBin]->Divide(hBWithPSCent[0]); + ratioB[centBin]->Scale(0.8); + ratioB[centBin]->SetLineWidth(2); + ratioB[centBin]->SetLineColor(colorInd[centBin+1]); + hName = "ratioNoPS"; + hName += ( (TObjString*) triggersB->At(k) )->GetString(); + ratioBNoPS[centBin] = static_cast (hBNoPSCent[centBin+1]->Clone(hName)); + ratioBNoPS[centBin]->Divide(hBNoPSCent[0]); + ratioBNoPS[centBin]->Scale(0.8); + ratioBNoPS[centBin]->SetLineWidth(0); + ratioBNoPS[centBin]->SetLineStyle(1); + ratioBNoPS[centBin]->SetMarkerStyle(24+centBin+1); + ratioBNoPS[centBin]->SetMarkerSize(1); + ratioBNoPS[centBin]->SetLineColor(colorInd[centBin+1]); + ratioBNoPS[centBin]->SetMarkerColor(colorInd[centBin+1]); + + if(centBin==0){ + ratioB[centBin]->SetMaximum(yMax); + ratioB[centBin]->SetMinimum(yMin); + ratioB[centBin]->SetLabelSize(0.02); + ratioB[centBin]->GetYaxis()->SetTitle("Centrality percentile check"); + ratioB[centBin]->SetTitle(Form("Centrality percentile check for %s - Multiplicity from V0 amplitude",(( (TObjString*) triggersB->At(k) )->GetString()).Data() )); + ratioB[centBin]->Draw("E"); + ratioBNoPS[centBin]->Draw("EPSAME"); + } + else{ + ratioB[centBin]->Draw("ESAME"); + ratioBNoPS[centBin]->Draw("EPSAME"); + } + } + + legcRTC->AddEntry(".","applied :",""); + for(Int_t centBin = 0; centBin < centBinMax; centBin++){ + legcRTC->AddEntry(ratioB[centBin],(legendHeader[centBin+1]).Data(),"l"); + } + legcRTC->AddEntry(".","not applied :",""); + for(Int_t centBin = 0; centBin < centBinMax; centBin++){ + legcRTC->AddEntry(ratioBNoPS[centBin],(legendHeader[centBin+1]).Data(),"l"); + } + legcRTC->Draw("same"); + + + return c1; +} -TCanvas *ProcessCanvasTracksoverTrigger(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName){ +TCanvas *ProcessCanvasTracksoverTrigger(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName, TString legendHeader){ if(!triggersB || !hB || !hTrackerB || !hTriggerB || !hMatchedB || !hAllTracksB || indTrigger<0 ) return 0x0; @@ -1189,7 +1566,7 @@ TCanvas *ProcessCanvasTracksoverTrigger(TObjArray *triggersB, TH1 **hB, TH1 **hT hAllTracksPerB->Divide(hB[indTrigger]); hAllTracksPerB->SetLineWidth(3); hAllTracksPerB->SetLineColor(kBlack); - hAllTracksPerB->SetTitle(Form("Ratio (Number of Tracks)/%s",hNameBase.Data())); + hAllTracksPerB->SetTitle(Form("Number of Tracks /%s for %s",hNameBase.Data(),legendHeader.Data())); hAllTracksPerB->SetMinimum(0.0001); hAllTracksPerB->SetLabelSize(0.02); @@ -1224,7 +1601,7 @@ TCanvas *ProcessCanvasTracksoverTrigger(TObjArray *triggersB, TH1 **hB, TH1 **hT } -TCanvas *ProcessCanvasTrackMultB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName){ +TCanvas *ProcessCanvasTrackMultB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader){ if(!triggersB || !hB || !hTrackerB || !hTriggerB || !hMatchedB || !hAllTracksB || indTrigger<0 ) return 0x0; @@ -1249,7 +1626,7 @@ TCanvas *ProcessCanvasTrackMultB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB hSumTriggerOverB->Add(hMatchedB[indTrigger]); hSumTriggerOverB->Divide(hB[indTrigger]); - hName = Form("Sum of trigger tracks (matched+trigger-only) / # events in %s",hNameBase.Data()); + hName = Form("Sum of trigger tracks (matched+trigger-only) / # events in %s for %s",hNameBase.Data(),legendHeader.Data()); hSumTriggerOverB->SetTitle(hName); hSumTriggerOverB->SetLabelSize(0.02); hSumTriggerOverB->SetLineWidth(2); @@ -1258,7 +1635,7 @@ TCanvas *ProcessCanvasTrackMultB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB hSumTrackerOverB = static_cast(hTrackerB[indTrigger]->Clone(hName)); hSumTrackerOverB->Add(hMatchedB[indTrigger]); hSumTrackerOverB->Divide(hB[indTrigger]); - hName = Form("Sum of tracker tracks (matched+tracker-only) / # events in %s",hNameBase.Data()); + hName = Form("Sum of tracker tracks (matched+tracker-only) / # events in %s for %s",hNameBase.Data(),legendHeader.Data()); hSumTrackerOverB->SetTitle(hName); //hSumTrackerOverCINT1B->LabelsOption("u"); hSumTrackerOverB->SetLabelSize(0.02); @@ -1275,7 +1652,7 @@ TCanvas *ProcessCanvasTrackMultB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB } -TCanvas *ProcessCanvasRatioTrackB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName){ +TCanvas *ProcessCanvasRatioTrackB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader){ if(!triggersB || !hB || !hTrackerB || !hTriggerB || !hMatchedB || !hAllTracksB || indTrigger<0 ) return 0x0; @@ -1292,7 +1669,7 @@ TCanvas *ProcessCanvasRatioTrackB(TObjArray *triggersB, TH1 **hB, TH1 **hTracker TString hName = Form("hTrackerOverTrigger%s",hNameBase.Data()); hTrackerOverTriggerB = static_cast(hTrackerB[indTrigger]->Clone(hName)); hTrackerOverTriggerB->Divide(hTriggerB[indTrigger]); - hName = Form("# tracker tracks / # trigger tracks in %s",hNameBase.Data()); + hName = Form("# tracker tracks / # trigger tracks in %s for %s",hNameBase.Data(),legendHeader.Data()); hTrackerOverTriggerB->SetTitle(hName); //hTrackerOverTriggerCINT1B->LabelsOption("u"); hTrackerOverTriggerB->SetLabelSize(0.02); @@ -1303,7 +1680,7 @@ TCanvas *ProcessCanvasRatioTrackB(TObjArray *triggersB, TH1 **hB, TH1 **hTracker hMatchedOverTriggerB = static_cast(hMatchedB[indTrigger]->Clone(hName)); hMatchedOverTriggerB->Divide(hTriggerB[indTrigger]); - hName = Form("# matched tracks / # trigger tracks in %s",hNameBase.Data()); + hName = Form("# matched tracks / # trigger tracks in %s for %s",hNameBase.Data(),legendHeader.Data()); hMatchedOverTriggerB->SetTitle(hName); //hMatchedOverTriggerCINT1B->LabelsOption("u"); hMatchedOverTriggerB->SetLabelSize(0.02); @@ -1313,7 +1690,7 @@ TCanvas *ProcessCanvasRatioTrackB(TObjArray *triggersB, TH1 **hB, TH1 **hTracker hName = Form("hMatchedOverTracker%s",hNameBase.Data()); hMatchedOverTrackerB = static_cast(hMatchedB[indTrigger]->Clone(hName)); hMatchedOverTrackerB->Divide(hTrackerB[indTrigger]); - hName = Form("# matched tracks / # tracker tracks in %s",hNameBase.Data()); + hName = Form("# matched tracks / # tracker tracks in %s for %s",hNameBase.Data(),legendHeader.Data()); hMatchedOverTrackerB->SetTitle(hName); //hMatchedOverTrackerCINT1B->LabelsOption("u"); hMatchedOverTrackerB->SetLabelSize(0.02); @@ -1333,7 +1710,7 @@ TCanvas *ProcessCanvasRatioTrackB(TObjArray *triggersB, TH1 **hB, TH1 **hTracker } -TCanvas *ProcessCanvasAsymMatched(TObjArray *triggersB, TH1 **hPosMatchedB, TH1 **hNegMatchedB, TH1 **hAllMatchedB, Int_t indTrigger, TString canvasName){ +TCanvas *ProcessCanvasAsymMatched(TObjArray *triggersB, TH1 **hPosMatchedB, TH1 **hNegMatchedB, TH1 **hAllMatchedB, Int_t indTrigger, TString canvasName,TString legendHeader){ if(!triggersB || !hPosMatchedB || !hNegMatchedB || !hAllMatchedB || indTrigger<0 ) return 0x0; @@ -1359,7 +1736,7 @@ TCanvas *ProcessCanvasAsymMatched(TObjArray *triggersB, TH1 **hPosMatchedB, TH1 hAsymMatchedCMUS1B->SetMinimum(-0.3); hAsymMatchedCMUS1B->SetMaximum(0.3); hAsymMatchedCMUS1B->SetLabelSize(0.02); - hName = Form("Matched tracks asymmetry for %s with acc. cuts",hNameBase.Data()); + hName = Form("Matched tracks charge asymmetry for %s with acc. cuts for %s",hNameBase.Data(),legendHeader.Data()); hAsymMatchedCMUS1B->SetTitle(hName); hAsymMatchedCMUS1B->GetYaxis()->SetTitle("Charged tracks asymmetry"); @@ -1369,7 +1746,7 @@ TCanvas *ProcessCanvasAsymMatched(TObjArray *triggersB, TH1 **hPosMatchedB, TH1 } -TCanvas *ProcessCanvasHighPtMuons(TObjArray *triggersB, TH1 **hB, TH1 **hMatchedLowPtB, TH1 **hMatchedHighPtB, Int_t indTrigger, TString canvasName){ +TCanvas *ProcessCanvasHighPtMuons(TObjArray *triggersB, TH1 **hB, TH1 **hMatchedLowPtB, TH1 **hMatchedHighPtB, Int_t indTrigger, TString canvasName, TString legendHeader){ if(!triggersB || !hB || !hMatchedLowPtB || !hMatchedHighPtB || indTrigger<0 ) return 0x0; @@ -1406,12 +1783,13 @@ TCanvas *ProcessCanvasHighPtMuons(TObjArray *triggersB, TH1 **hB, TH1 **hMatched hMatchedHighPtPerB->SetLineWidth(2); hMatchedHighPtPerB->SetLineColor(kRed); + hName = Form("Number of matched track per %s (include Vtx and R_{Abs} cuts) for %s",hNameBase.Data(),legendHeader.Data()); + hMatchedLowPtPerB->SetTitle(hName); hMatchedLowPtPerB->Draw("E"); hMatchedHighPtPerB->Draw("Esame"); legcHPM = new TLegend(0.60,0.45,0.98,0.65); - hName = Form("Number of matched track per %s (include Vtx and R_{Abs} cuts)",hNameBase.Data()); - legcHPM->SetHeader(hName); + //legcHPM->SetHeader(hName); legcHPM->AddEntry(".","Physics selection applied :",""); legcHPM->AddEntry(hMatchedLowPtPerB," p_{T} > 1 GeV/c ","l"); legcHPM->AddEntry(hMatchedHighPtPerB," p_{T} > 2 GeV/c ","l"); @@ -1422,13 +1800,13 @@ TCanvas *ProcessCanvasHighPtMuons(TObjArray *triggersB, TH1 **hB, TH1 **hMatched } -TH1* ProcessHisto( AliCounterCollection* counter, TString hVariable, TString hSelection, TString hName, TString xName, TString yName, Int_t color){ +TH1* ProcessHisto( AliCounterCollection* counter, TString hVariable, TString hSelection, TString hName, TString xName, TString yName, Int_t color, Bool_t empty ){ TH1* h1 = 0x0; if( !counter ) return h1; - - h1 = (TH1*) counter->Draw(hVariable,hSelection); + + if ( empty==kFALSE ) h1 = (TH1*) counter->Draw(hVariable,hSelection); if ( !h1 ) h1 = new TH1D(hName,"",10,0,10); else { h1->Sumw2(); @@ -1462,13 +1840,14 @@ TH2* ProcessHisto2D( AliCounterCollection* counter, TString hVariable, TString h return h1; } + Bool_t GetTriggerLists(const char* triggerList, TString listFromContainer, TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE){ //Get the trigger list from a file //The file should consist of a line for each trigger with the following layout: - // triggernameB triggerNameAC triggerNameE - // or triggernameB triggerNameA,triggerNameC triggerNameE - // or triggernameB triggerNameACE notrigger + // triggernameB triggerNameAC triggerNameE + // or triggernameB triggerNameA,triggerNameC triggerNameE + // or triggernameB triggerNameACE notrigger //if filename is 0, then default trigger names (pp 2011) are used if( !triggersB || !triggersAC || !triggersE) return kFALSE; @@ -1488,7 +1867,7 @@ Bool_t GetTriggerLists(const char* triggerList, TString listFromContainer, TObjA // only the ones in the triggerList ifstream inFile(triggerList); if (!inFile.is_open()) { - Error("PlotMUONQApp","unable to open file %s", triggerList); + Error("PlotMuonQA","unable to open file %s", triggerList); return kFALSE; } @@ -1583,7 +1962,7 @@ TString GetRunList(const char *runList, TObjArray *runs, TObjArray *runs2){ // only the ones in the runList ifstream inFile(runList); if (!inFile.is_open()) { - Error("PlotMUONQApp","unable to open file %s", runList); + Error("PlotMuonQA","unable to open file %s", runList); return selectRuns; } @@ -1592,7 +1971,7 @@ TString GetRunList(const char *runList, TObjArray *runs, TObjArray *runs2){ currRun.ReadLine(inFile, kTRUE); if (currRun.IsNull()) continue; if (!currRun.IsDigit()) { - Error("PlotMUONQApp","invalid run number: %s", currRun.Data()); + Error("PlotMuonQA","invalid run number: %s", currRun.Data()); return selectRuns; } if(runs) runs->AddLast(new TObjString(Form("%09d", currRun.Atoi()))); @@ -1608,5 +1987,7 @@ TString GetRunList(const char *runList, TObjArray *runs, TObjArray *runs2){ if(runs2) runs2->AddLast(new TObjString("*")); } + printf("selected runs from runlist %s: %s\n",runList, selectRuns.Data()); + return selectRuns; } diff --git a/PWG3/muon/PlotMuonQAPbPb.C b/PWG3/muon/PlotMuonQAPbPb.C deleted file mode 100644 index dc41a3d5bc9..00000000000 --- a/PWG3/muon/PlotMuonQAPbPb.C +++ /dev/null @@ -1,1572 +0,0 @@ -//-------------------------------------------------------------------------- -// Macro for QA monitoring. -// -// In case it is not run with full aliroot, it needs the following libraries to compile: -// - libSTEERBase.so -// - libESD.so -// - libAOD.so -// - libANALYSIS.so -// - libANALYSISalice.so -// - libCORRFW.so -// - libPWG3muon.so -// -// The macro reads results of the QA task and produce monitoring plots. -// -// Author: Philippe Pillot - SUBATECH Nantes, Christophe Suire - IPN Orsay -// and Cynthia Hadjidakis - IPN Orsay -//-------------------------------------------------------------------------- - -#if !defined(__CINT__) || defined(__MAKECINT__) - -#include - -// ROOT includes -#include "TMath.h" -#include "TGrid.h" -#include "TFile.h" -#include "TH1.h" -#include "TSystem.h" -#include "TStyle.h" -#include "TCanvas.h" -#include "TPad.h" - -// ALIROOT includes -#include "../PWG3/base/AliCounterCollection.h" - -#endif - -//-------------------------------------------------------------------------- -void PlotMuonQAPbPb(const char* baseDir, const char* runList = 0x0, Bool_t selectPhysics = kFALSE) -{ - /// Macro for QA monitoring. - /// Examples: - /// baseDir = "alien:///alice/cern.ch/user/p/ppillot/pp7TeV/LHC10d/MuonQA/pass1/results" - /// baseDir = "results" - /// If runList != 0x0: only the given runs will be used. Otherwise use all runs found in baseDir. - /// Usage (local/grid) - /// .x PlotMuonQAPbPb.C("alien:///alice/cern.ch/user/s/suire/QAP2LHC10h/output",0,kTRUE) - - - #if defined(__CINT__) && !defined(__MAKECINT__) - gSystem->Load("libTree"); - gSystem->Load("libGeom"); - gSystem->Load("libVMC"); - gSystem->Load("libPhysics"); - gSystem->Load("libSTEERBase"); - gSystem->Load("libESD"); - gSystem->Load("libAOD"); - gSystem->Load("libANALYSIS"); - gSystem->Load("libANALYSISalice"); - gSystem->Load("libCORRFW"); - gSystem->Load("libPWG3base"); - gSystem->Load("libPWG3muon"); - #endif - - // Cosmetics and configuration - gStyle->SetFillColor(10); - gStyle->SetPadGridX(kTRUE); - gStyle->SetPadGridY(kTRUE); - gStyle->SetPadRightMargin(0.01); - - TString LHCPeriod = "LHC10hpass2"; - - TString OutFileName = "muonQA_"; OutFileName += LHCPeriod; - TString OutFileNamePDF= OutFileName.Data(); OutFileNamePDF+= ".pdf"; - TString OutFileNamePDF_open = OutFileNamePDF.Data(); OutFileNamePDF_open += "["; - TString OutFileNamePDF_close= OutFileNamePDF.Data(); OutFileNamePDF_close += "]"; - TString OutFileNameROOT= OutFileName.Data(); OutFileNameROOT+= ".root"; - - //TString QAFileName = "QAresults.root"; - TString QAFileName = "AnalysisResults.root"; - TString MergedQAFileName = "Merged"; MergedQAFileName+= QAFileName.Data(); - - Int_t PRINTSTAT = 1; - - Int_t ALIENFASTREAD = 0 ; - - if (ALIENFASTREAD){ // Equivalent to the fast read option - gEnv->SetValue("XNet.ConnectTimeout",10); - gEnv->SetValue("XNet.RequestTimeout",10); - gEnv->SetValue("XNet.MaxRedirectCount",2); - gEnv->SetValue("XNet.ReconnectTimeout",10); - gEnv->SetValue("XNet.FirstConnectMaxCnt",1); - } - - TH1::AddDirectory(kFALSE); - - TString alienBaseDir = baseDir; - - if (alienBaseDir.Contains("alien:") && !TGrid::Connect("alien://")) { - Error("PlotMuonQA","cannot connect to grid"); - return; - } - - Float_t LabelSize = 0.03; - - - //---------------------------------- // - // Run selection // - //---------------------------------- // - - - // list runs to be analyzed - TString selectRuns = "run:"; - TObjArray runs; - runs.SetOwner(); - if (runList) { - - // only the ones in the runList - ifstream inFile(runList); - if (!inFile.is_open()) { - Error("PlotMuonQAPbPb",Form("unable to open file %s", runList)); - return; - } - - TString currRun; - while (!inFile.eof()) { - currRun.ReadLine(inFile, kTRUE); - if (currRun.IsNull()) continue; - if (!currRun.IsDigit()) { - Error("PlotMuonQAPbPb","invalid run number: %s", currRun.Data()); - return; - } - runs.AddLast(new TObjString(Form("%09d", currRun.Atoi()))); - selectRuns += Form("%s,",currRun.Data()); - } - selectRuns.Remove(TString::kTrailing, ','); - - inFile.close(); - - } else { - - // all runs - runs.AddLast(new TObjString("*")); - - } - - // physics selection - TString select = selectPhysics ? "selected:yes" : ""; - - - //---------------------------------- // - // plot global counter // - //---------------------------------- // - - TFile *globalFile = TFile::Open(Form("%s/%s", baseDir,MergedQAFileName.Data())); - if (!globalFile || ! globalFile->IsOpen()) { - Error("PlotQA", Form("failed to open file: %s/%s", baseDir,MergedQAFileName.Data())); - return; - } - globalFile->Cd("MUON_QA"); - - - - // get counters - AliCounterCollection* eventCounters = static_cast(globalFile->FindObjectAny("eventCounters")); - AliCounterCollection* trackCounters = static_cast(globalFile->FindObjectAny("trackCounters")); - if (!runList) selectRuns += trackCounters->GetKeyWords("run"); - - - //declare a default canvas c1 - TString CanvasName = "c1"; - TCanvas *c1 = new TCanvas(CanvasName.Data()); - c1->cd(); - - //TString allTriggers = "trigger:CMBAC-B,CMBS2A-B,CMBS2C-B,CMBACS2-B,C0SMH-B"; - //TString minBiasTrigers = "trigger:CMBAC-B,CMBS2A-B,CMBS2C-B,CMBACS2-B"; - TString allTriggers = "trigger:any"; //"trigger:CMBAC-B,CMBS2A-B,CMBS2C-B,C0SMH-B"; - TString minBiasTrigers = "trigger:any"; //CMBAC-B,CMBS2A-B,CMBS2C-B"; - TString bckTriggers = "trigger:CMBACS2-A,CMBACS2-C,CMBS2A-A,CMBS2A-C,CMBS2C-A,CMBS2C-C,CMBAC-A,CMBAC-A,C0SMH-A,C0SMH-C"; - - // Histo trigger without Phys. Sel. - TH1* hAllTriggersNoPS = eventCounters->Draw("run",Form("%s/%s",allTriggers.Data(), selectRuns.Data())); - hAllTriggersNoPS->Sumw2(); - Int_t NumOfAllTriggersNoPS = hAllTriggersNoPS->Integral(); - TH1* hAllTriggerslowNoPS = eventCounters->Draw("run",Form("v0mult:low/%s/%s",allTriggers.Data(), selectRuns.Data())); - hAllTriggerslowNoPS->Sumw2(); - TH1* hAllTriggershighNoPS = eventCounters->Draw("run",Form("v0mult:high/%s/%s",allTriggers.Data(), selectRuns.Data())); - hAllTriggershighNoPS->Sumw2(); - TH1* hMBBNoPS = eventCounters->Draw("run",Form("v0mult:low,int,high/%s/%s",minBiasTrigers.Data(), selectRuns.Data())); - hMBBNoPS->Sumw2(); - Int_t NumOfMBBNoPS = hMBBNoPS->Integral(); - TH1* hMBBlowNoPS = eventCounters->Draw("run",Form("v0mult:low/%s/%s",minBiasTrigers.Data(), selectRuns.Data())); - hMBBlowNoPS->Sumw2(); - Int_t NumOfMBBlowNoPS = hMBBlowNoPS->Integral(); - TH1* hMBBhighNoPS = eventCounters->Draw("run",Form("v0mult:high/%s/%s",minBiasTrigers.Data(), selectRuns.Data())); - hMBBhighNoPS->Sumw2(); - Int_t NumOfMBBhighNoPS = hMBBhighNoPS->Integral(); - //TH1* hCMUS1BNoPS = eventCounters->Draw("run",Form("trigger:CMUS1B/%s", selectRuns.Data())); - //hCMUS1BNoPS->Sumw2(); - //Int_t NumOfCMUS1BNoPS = hCMUS1BNoPS->Integral(); - //TH1* hCSH1BNoPS = eventCounters->Draw("run",Form("trigger:CSH1B/%s", selectRuns.Data())); - //hCSH1BNoPS->Sumw2(); - //Int_t NumOfCSH1BNoPS = hCSH1BNoPS->Integral(); - - TH1* hBckTriggersNoPS = eventCounters->Draw("run",Form("v0mult:low,int,high/%s/%s",bckTriggers.Data(), selectRuns.Data())); - hBckTriggersNoPS->Sumw2(); - - - // Histo trigger with Phys. Sel. - TH1* hAllTriggersWithPS = eventCounters->Draw("run",Form("%s/%s/selected:yes",allTriggers.Data(), selectRuns.Data())); - hAllTriggersWithPS->Sumw2(); - Int_t NumOfAllTriggersWithPS = hAllTriggersWithPS->Integral(); - TH1* hAllTriggersLowWithPS = eventCounters->Draw("run",Form("v0mult:low/%s/%s/selected:yes",allTriggers.Data(), selectRuns.Data())); - hAllTriggersWithPS->Sumw2(); - TH1* hAllTriggersHighWithPS = eventCounters->Draw("run",Form("v0mult:high/%s/%s/selected:yes",allTriggers.Data(), selectRuns.Data())); - hAllTriggersWithPS->Sumw2(); - TH1* hMBBWithPS = eventCounters->Draw("run",Form("v0mult:low,int,high/%s/%s/selected:yes",minBiasTrigers.Data(), selectRuns.Data())); - hMBBWithPS->Sumw2(); - Int_t NumOfMBBWithPS = hMBBWithPS->Integral(); - TH1* hMBBlowWithPS = eventCounters->Draw("run",Form("v0mult:low/%s/%s/selected:yes",minBiasTrigers.Data(), selectRuns.Data())); - hMBBlowWithPS->Sumw2(); - Int_t NumOfMBBlowWithPS = hMBBlowWithPS->Integral(); - TH1* hMBBhighWithPS = eventCounters->Draw("run",Form("v0mult:high/%s/%s/selected:yes",minBiasTrigers.Data(), selectRuns.Data())); - hMBBhighWithPS->Sumw2(); - Int_t NumOfMBBhighWithPS = hMBBhighWithPS->Integral(); - - // Histo trigger : Phys. Sel. is selected or not depending on the macro arguments - TH1* hAllTriggers = eventCounters->Draw("run",Form("%s/%s/%s",allTriggers.Data(), selectRuns.Data(), select.Data())); - hAllTriggers->Sumw2(); - TH1* hMBB = eventCounters->Draw("run",Form("v0mult:low,int,high/%s/%s/%s",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hMBB->Sumw2(); - TH1* hMBBlow = eventCounters->Draw("run",Form("v0mult:low/%s/%s/%s",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hMBBlow->Sumw2(); - TH1* hMBBhigh = eventCounters->Draw("run",Form("v0mult:high/%s/%s/%s",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hMBBhigh->Sumw2(); - - // Histo tracking : Phys. Sel. is selected or not depending on the macro arguments - TH1* hAllTracksMBB = trackCounters->Draw("run",Form("v0mult:low,int,high/%s/%s/%s",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hAllTracksMBB->Sumw2(); - TH1* hTriggerMBB = trackCounters->Draw("run",Form("v0mult:low,int,high/track:triggeronly/%s/%s/%s",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hTriggerMBB->Sumw2(); - TH1* hTrackerMBB = trackCounters->Draw("run",Form("v0mult:low,int,high/track:trackeronly/%s/%s/%s",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hTrackerMBB->Sumw2(); - TH1* hMatchedMBB = trackCounters->Draw("run",Form("v0mult:low,int,high/track:matched/%s/%s/%s",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hMatchedMBB->Sumw2(); - TH1* hAllTracksMBBlow = trackCounters->Draw("run",Form("v0mult:low/%s/%s/%s",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hAllTracksMBBlow->Sumw2(); - TH1* hTriggerMBBlow = trackCounters->Draw("run",Form("v0mult:low/track:triggeronly/%s/%s/%s",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hTriggerMBBlow->Sumw2(); - TH1* hTrackerMBBlow = trackCounters->Draw("run",Form("v0mult:low/track:trackeronly/%s/%s/%s",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hTrackerMBBlow->Sumw2(); - TH1* hMatchedMBBlow = trackCounters->Draw("run",Form("v0mult:low/track:matched/%s/%s/%s",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hMatchedMBBlow->Sumw2(); - TH1* hAllTracksMBBhigh = trackCounters->Draw("run",Form("v0mult:high/%s/%s/%s",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hAllTracksMBBhigh->Sumw2(); - TH1* hTriggerMBBhigh = trackCounters->Draw("run",Form("v0mult:high/track:triggeronly/%s/%s/%s",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hTriggerMBBhigh->Sumw2(); - TH1* hTrackerMBBhigh = trackCounters->Draw("run",Form("v0mult:high/track:trackeronly/%s/%s/%s",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hTrackerMBBhigh->Sumw2(); - TH1* hMatchedMBBhigh = trackCounters->Draw("run",Form("v0mult:high/track:matched/%s/%s/%s",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hMatchedMBBhigh->Sumw2(); - - TH1* hMatchedLowPtMBB = trackCounters->Draw("run",Form("v0mult:low,int,high/track:matched/acc:in/%s/%s/%s/pt:low",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hMatchedLowPtMBB->Sumw2(); - TH1* hMatchedHighPtMBB = trackCounters->Draw("run",Form("v0mult:low,int,high/track:matched/acc:in/%s/%s/%s/pt:high",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hMatchedHighPtMBB->Sumw2(); - TH1* hMatchedLowPtMBBlow = trackCounters->Draw("run",Form("v0mult:low/track:matched/acc:in/%s/%s/%s/pt:low",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hMatchedLowPtMBBlow->Sumw2(); - TH1* hMatchedHighPtMBBlow = trackCounters->Draw("run",Form("v0mult:low/track:matched/acc:in/%s/%s/%s/pt:high",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hMatchedHighPtMBBlow->Sumw2(); - TH1* hMatchedLowPtMBBhigh = trackCounters->Draw("run",Form("v0mult:high/track:matched/acc:in/%s/%s/%s/pt:low",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hMatchedLowPtMBBhigh->Sumw2(); - TH1* hMatchedHighPtMBBhigh = trackCounters->Draw("run",Form("v0mult:high/track:matched/acc:in/%s/%s/%s/pt:high",minBiasTrigers.Data(), selectRuns.Data(), select.Data())); - hMatchedHighPtMBBhigh->Sumw2(); - - - // for MBB only, low and high mult - TH1 *hPosMatchedMBBlow = trackCounters->Draw("run",Form("v0mult:low/track:matched/charge:pos/acc:in/%s/%s/%s",minBiasTrigers.Data(),select.Data(),selectRuns.Data())); - hPosMatchedMBBlow->Sumw2(); - TH1 *hNegMatchedMBBlow= trackCounters->Draw("run",Form("v0mult:low/track:matched/charge:neg/acc:in/%s/%s/%s",minBiasTrigers.Data(),select.Data(),selectRuns.Data())); - hNegMatchedMBBlow->Sumw2(); - TH1 *hAllMatchedMBBlow= trackCounters->Draw("run",Form("v0mult:low/track:matched/acc:in/%s/%s/%s",minBiasTrigers.Data(),select.Data(),selectRuns.Data())); - hAllMatchedMBBlow->Sumw2(); - TH1 *hPosMatchedMBBhigh = trackCounters->Draw("run",Form("v0mult:high/track:matched/charge:pos/acc:in/%s/%s/%s",minBiasTrigers.Data(),select.Data(),selectRuns.Data())); - hPosMatchedMBBhigh->Sumw2(); - TH1 *hNegMatchedMBBhigh= trackCounters->Draw("run",Form("v0mult:high/track:matched/charge:neg/acc:in/%s/%s/%s",minBiasTrigers.Data(),select.Data(),selectRuns.Data())); - hNegMatchedMBBhigh->Sumw2(); - TH1 *hAllMatchedMBBhigh= trackCounters->Draw("run",Form("v0mult:high/track:matched/acc:in/%s/%s/%s",minBiasTrigers.Data(),select.Data(),selectRuns.Data())); - hAllMatchedMBBhigh->Sumw2(); - - - TH1* hAll = eventCounters->Draw("trigger","run","run:any/selected:yes"); - hAll->Draw("TEXT"); - - - //=================================================================================== - // Put all plots in a pdf file, easier to publish (Twiki) - c1->Print(OutFileNamePDF_open.Data()); - - TFile *rootFileOut = TFile::Open(OutFileNameROOT.Data(),"RECREATE"); - - //=================================================================================== - // new canvas of the statistic wrt trigger w/ physics selection - CanvasName = LHCPeriod.Data() ; - CanvasName += "_StatByTrigger"; - TCanvas *cStatByTrigger = new TCanvas(CanvasName.Data(),"cStatByTrigger",1200,900); - cStatByTrigger->SetTopMargin(0.05); - cStatByTrigger->SetRightMargin(0.01); - cStatByTrigger->SetGridy(1); - cStatByTrigger->SetLogy(1); - cStatByTrigger->cd(); - - //hAllTriggersWithPS->SetLabelSize(LabelSize); - //hAllTriggersWithPS->SetTitle("Statistic per trigger w/ Phys. Sel."); - hAllTriggersWithPS->SetTitle(""); - hAllTriggersWithPS->SetLineWidth(2); - hAllTriggersWithPS->SetMinimum(10); - hAllTriggersWithPS->SetLabelSize(LabelSize); - - hAllTriggersWithPS->Draw("E"); - hMBBWithPS->SetLineWidth(2); - hMBBWithPS->SetLineColor(kBlue); - hMBBWithPS->Draw("ESAME"); - hMBBlowWithPS->SetMarkerStyle(27); - hMBBlowWithPS->SetMarkerSize(2); - hMBBlowWithPS->SetMarkerColor(kBlue); - hMBBlowWithPS->SetLineColor(kBlue); - hMBBlowWithPS->Draw("ESAME"); - hMBBhighWithPS->SetMarkerStyle(24); - hMBBhighWithPS->SetMarkerSize(2); - hMBBhighWithPS->SetMarkerColor(kBlue); - hMBBhighWithPS->SetLineColor(kBlue); - hMBBhighWithPS->Draw("ESAME"); - - - TLegend* legcSBT = new TLegend(0.12,0.15,0.42,0.3); - legcSBT->SetHeader("Trigger Statistic w/ Phys. Sel."); - legcSBT->AddEntry(hAllTriggersWithPS,"All collisions triggers","l"); - legcSBT->AddEntry(hMBBWithPS,"Min Bias [0-80]% from V0 amplitude","l"); - legcSBT->AddEntry(hMBBlowWithPS,"MB low multiplicity events [60-80]%","p"); - legcSBT->AddEntry(hMBBhighWithPS,"MB high multiplicity events [0-10]%","p"); - legcSBT->Draw("same"); - - cStatByTrigger->Print(OutFileNamePDF.Data()); - cStatByTrigger->Write(); - - - //=================================================================================== - // new canvas with the relative content of each trigger w/ and w/o physics selection - TH1 *ratioMBB = static_cast(hMBBWithPS->Clone("ratioMBB")); - ratioMBB->Divide(hMBBNoPS); - ratioMBB->SetLineColor(kBlack); - ratioMBB->SetLineWidth(2); - TH1 *ratioMBBlow = static_cast(hMBBlowWithPS->Clone("ratioMBBlow")); - ratioMBBlow->Divide(hMBBlowNoPS); - ratioMBBlow->SetLineColor(kBlue); - ratioMBBlow->SetLineWidth(2); - ratioMBBlow->SetMarkerSize(0); - ratioMBBlow->SetMarkerColor(kBlue); - TH1 *ratioMBBhigh = static_cast(hMBBhighWithPS->Clone("ratioMBBhigh")); - ratioMBBhigh->Divide(hMBBhighNoPS); - ratioMBBhigh->SetLineColor(kRed); - ratioMBBhigh->SetLineWidth(2); - ratioMBBhigh->SetMarkerSize(0); - ratioMBBhigh->SetMarkerColor(kRed); - - - TH1 *ratioMBBNoPS = static_cast(hMBBNoPS->Clone("ratioMBBNoPS")); - ratioMBBNoPS->Divide(hMBBNoPS); - ratioMBBNoPS->SetLineColor(kBlack); - ratioMBBNoPS->SetLineWidth(0); - ratioMBBNoPS->SetLineStyle(2); - ratioMBBNoPS->SetMarkerColor(kBlack); - ratioMBBNoPS->SetMarkerStyle(24); - ratioMBBNoPS->SetMarkerSize(1); - TH1 *ratioMBBlowNoPS = static_cast(hMBBlowNoPS->Clone("ratioMBBlowNoPS")); - ratioMBBlowNoPS->Divide(hMBBlowNoPS); - ratioMBBlowNoPS->SetLineColor(kBlue); - ratioMBBlowNoPS->SetLineWidth(0); - ratioMBBlowNoPS->SetLineStyle(2); - ratioMBBlowNoPS->SetMarkerColor(kBlue); - ratioMBBlowNoPS->SetMarkerStyle(24); - ratioMBBlowNoPS->SetMarkerSize(1); - TH1 *ratioMBBhighNoPS = static_cast(hMBBhighNoPS->Clone("ratioMBBhighNoPS")); - ratioMBBhighNoPS->Divide(hMBBhighNoPS); - ratioMBBhighNoPS->SetLineColor(kRed); - ratioMBBhighNoPS->SetLineWidth(0); - ratioMBBhighNoPS->SetLineStyle(2); - ratioMBBhighNoPS->SetMarkerColor(kRed); - ratioMBBhighNoPS->SetMarkerStyle(24); - ratioMBBhighNoPS->SetMarkerSize(1); - - - TH1 *ratioBck = static_cast(hBckTriggersNoPS->Clone("ratioBck")); - ratioBck->Divide(hMBBNoPS); - ratioBck->SetLineColor(kBlack); - ratioBck->SetLineWidth(3); - ratioBck->SetLineStyle(3); - ratioBck->Scale(10); - - CanvasName = LHCPeriod.Data() ; - CanvasName += "_RelativeTriggerContent"; - TCanvas *cRelativeTriggerContent = new TCanvas(CanvasName.Data(),"cRelativeTriggerContent",1200,900); - cRelativeTriggerContent->SetTopMargin(0.05); - cRelativeTriggerContent->SetRightMargin(0.01); - cRelativeTriggerContent->SetGridy(1); - //cRelativeTriggerContent->SetLogy(1); - cRelativeTriggerContent->cd(); - - ratioMBB->SetMaximum(1.0); - ratioMBB->SetMinimum(0.05); - ratioMBB->SetTitle(""); - ratioMBB->SetLabelSize(LabelSize); - ratioMBB->LabelsOption("v"); - ratioMBB->GetYaxis()->SetTitle("Relative trigger content w/ and w/o Phys. Sel."); - - ratioMBB->Draw("E"); - ratioMBBlow->Draw("ESAME"); - ratioMBBhigh->Draw("ESAME"); - ratioMBBNoPS->Draw("EPSAME"); - ratioMBBlowNoPS->Draw("EPSAME"); - ratioMBBhighNoPS->Draw("EPSAME"); - ratioBck->Draw("EPSAME"); - - TLegend* legcRTC = new TLegend(0.4,0.25,0.70,0.45); - legcRTC->SetHeader("Physics Selection"); - legcRTC->AddEntry(".","applied :",""); - legcRTC->AddEntry(ratioMBB,"MBB","l"); - legcRTC->AddEntry(ratioMBBlow,"MBB low mult.","l"); - legcRTC->AddEntry(ratioMBBhigh,"MBB high mult.","l"); - legcRTC->AddEntry(".","not applied :",""); - legcRTC->AddEntry(ratioMBBNoPS,"MBB","p"); - legcRTC->AddEntry(ratioMBBlowNoPS,"MBB low mult.","p"); - legcRTC->AddEntry(ratioMBBhighNoPS,"MBB high mult.","p"); - legcRTC->AddEntry(ratioBck,"Background (x10)","l"); - legcRTC->Draw("same"); - - cRelativeTriggerContent->Print(OutFileNamePDF.Data()); - cRelativeTriggerContent->Write(); - - - //=================================================================================== - // new canvas with the relative ratio of multiplicity bin after physic selection - TH1 *relratioMBBlow = static_cast(hMBBlowWithPS->Clone("relratioMBBlow")); - relratioMBBlow->Divide(hMBBWithPS); - relratioMBBlow->SetLineColor(kBlue); - relratioMBBlow->SetLineWidth(2); - relratioMBBlow->SetMarkerSize(0); - TH1 *relratioMBBhigh = static_cast(hMBBhighWithPS->Clone("relratioMBBhigh")); - relratioMBBhigh->Divide(hMBBWithPS); - relratioMBBhigh->SetLineColor(kRed); - relratioMBBhigh->SetLineWidth(2); - relratioMBBhigh->SetMarkerSize(0); - - - TH1 *relratioMBBlowNoPS = static_cast(hMBBlowNoPS->Clone("relratioMBBlowNoPS")); - relratioMBBlowNoPS->Divide(hMBBNoPS); - relratioMBBlowNoPS->SetLineColor(kBlue); - relratioMBBlowNoPS->SetLineWidth(0); - relratioMBBlowNoPS->SetLineStyle(2); - relratioMBBlowNoPS->SetMarkerColor(kBlue); - relratioMBBlowNoPS->SetMarkerStyle(24); - relratioMBBlowNoPS->SetMarkerSize(1); - TH1 *relratioMBBhighNoPS = static_cast(hMBBhighNoPS->Clone("relratioMBBhighNoPS")); - relratioMBBhighNoPS->Divide(hMBBNoPS); - relratioMBBhighNoPS->SetLineColor(kRed); - relratioMBBhighNoPS->SetLineWidth(0); - relratioMBBhighNoPS->SetLineStyle(2); - relratioMBBhighNoPS->SetMarkerColor(kRed); - relratioMBBhighNoPS->SetMarkerStyle(24); - relratioMBBhighNoPS->SetMarkerSize(1); - - CanvasName = LHCPeriod.Data() ; - CanvasName += "_CentralityPercentileCheck"; - TCanvas *cCentralityPercentileCheck = new TCanvas(CanvasName.Data(),"CentralityPercentileCheck",1200,900); - cCentralityPercentileCheck->SetTopMargin(0.05); - cCentralityPercentileCheck->SetRightMargin(0.01); - cCentralityPercentileCheck->SetGridy(1); - //cCentralityPercentileCheck->SetLogy(1); - cCentralityPercentileCheck->cd(); - - relratioMBBlow->Scale(0.8); - relratioMBBhigh->Scale(0.8); - relratioMBBlowNoPS->Scale(0.8); - relratioMBBhighNoPS->Scale(0.8); - - relratioMBBlow->SetMaximum(0.3); - relratioMBBlow->SetMinimum(0.01); - relratioMBBlow->SetTitle(""); - relratioMBBlow->SetLabelSize(LabelSize); - relratioMBBlow->GetYaxis()->SetTitle("Centrality percentile check"); - - relratioMBBlow->Draw(); - relratioMBBhigh->Draw("ESAME"); - relratioMBBlowNoPS->Draw("EPSAME"); - relratioMBBhighNoPS->Draw("EPSAME"); - - TLegend* legcCPC = new TLegend(0.12,0.15,0.42,0.30); - legcCPC->SetHeader("Physics Selection"); - legcCPC->AddEntry(".","applied :",""); - legcCPC->AddEntry(relratioMBBlow,"MBB low mult.","l"); - legcCPC->AddEntry(relratioMBBhigh,"MBB high mult.","l"); - legcCPC->AddEntry(".","not applied :",""); - legcCPC->AddEntry(relratioMBBlowNoPS,"MBB low mult.","p"); - legcCPC->AddEntry(relratioMBBhighNoPS,"MBB high mult.","p"); - legcCPC->Draw("same"); - - cCentralityPercentileCheck->Print(OutFileNamePDF.Data()); - cCentralityPercentileCheck->Write(); - - - //==================================================== - // Draw ratio of tracks over MBB versus run - TH1* hTrackerPerMBB= static_cast(hTrackerMBB->Clone("hTrackerPerMBB")); - hTrackerPerMBB->Divide(hMBB); - hTrackerPerMBB->SetLineWidth(2); - hTrackerPerMBB->SetLineColor(kRed); - - TH1* hTriggerPerMBB= static_cast(hTriggerMBB->Clone("hTriggerPerMBB")); - hTriggerPerMBB->Divide(hMBB); - hTriggerPerMBB->SetLineWidth(2); - hTriggerPerMBB->SetLineColor(kBlue); - - - TH1* hMatchedPerMBB= static_cast(hMatchedMBB->Clone("hMatchedPerMBB")); - hMatchedPerMBB->Divide(hMBB); - hMatchedPerMBB->SetLineWidth(2); - hMatchedPerMBB->SetLineColor(kViolet); - - - TH1* hAllTracksPerMBB= static_cast(hAllTracksMBB->Clone("hAllTracksPerMBB")); - hAllTracksPerMBB->Divide(hMBB); - hAllTracksPerMBB->SetLineWidth(3); - hAllTracksPerMBB->SetLineColor(kBlack); - - - CanvasName = LHCPeriod.Data() ; - CanvasName += "_RatioTrackTypesMBB"; - TCanvas *cRatioTrackTypesMBB = new TCanvas(CanvasName.Data(),"cRatioTrackTypesMBB",1200,900); - cRatioTrackTypesMBB->SetRightMargin(0.01); - cRatioTrackTypesMBB->SetGridy(1); - //cRatioTrackTypesMBB->SetLogy(1); - cRatioTrackTypesMBB->cd(); - - hAllTracksPerMBB->SetTitle("Ratio (Number of Tracks)/MBB for [0-80]% centrality"); - hAllTracksPerMBB->SetMaximum(4); - hAllTracksPerMBB->SetMinimum(0.1); - hAllTracksPerMBB->SetLabelSize(LabelSize); - hAllTracksPerMBB->Draw("E"); - - hTrackerPerMBB->Draw("Esame"); - hMatchedPerMBB->Draw("Esame"); - hTriggerPerMBB->Draw("Esame"); - - TLegend* legcTTMBB = new TLegend(0.15,0.50,0.35,0.70); - legcTTMBB->AddEntry(hAllTracksPerMBB,"All tracks","l"); - legcTTMBB->AddEntry(hTrackerPerMBB,"Tracking (only) tracks","l"); - legcTTMBB->AddEntry(hMatchedPerMBB,"Matched tracks","l"); - legcTTMBB->AddEntry(hTriggerPerMBB,"Trigger (only) tracks","l"); - legcTTMBB->Draw("same"); - - cRatioTrackTypesMBB->Print(OutFileNamePDF.Data()); - cRatioTrackTypesMBB->Write(); - - //========================================================================== - // Draw ratio of tracks over MBB versus runs and low and high multiplicities - - TH1* hTrackerPerMBBlow= static_cast(hTrackerMBBlow->Clone("hTrackerPerMBBlow")); - hTrackerPerMBBlow->Divide(hMBBlow); - hTrackerPerMBBlow->SetLineWidth(2); - hTrackerPerMBBlow->SetLineStyle(2); - hTrackerPerMBBlow->SetLineColor(kRed); - hTrackerPerMBBlow->SetMarkerColor(kRed); - hTrackerPerMBBlow->SetMarkerSize(2); - hTrackerPerMBBlow->SetMarkerStyle(27); - TH1* hTrackerPerMBBhigh= static_cast(hTrackerMBBhigh->Clone("hTrackerPerMBBhigh")); - hTrackerPerMBBhigh->Divide(hMBBhigh); - hTrackerPerMBBhigh->SetLineWidth(2); - hTrackerPerMBBhigh->SetLineStyle(2); - hTrackerPerMBBhigh->SetLineColor(kRed); - hTrackerPerMBBhigh->SetMarkerColor(kRed); - hTrackerPerMBBhigh->SetMarkerSize(2); - hTrackerPerMBBhigh->SetMarkerStyle(24); - - - TH1* hTriggerPerMBBlow= static_cast(hTriggerMBBlow->Clone("hTriggerPerMBBlow")); - hTriggerPerMBBlow->Divide(hMBBlow); - hTriggerPerMBBlow->SetLineWidth(2); - hTriggerPerMBBlow->SetLineStyle(2); - hTriggerPerMBBlow->SetLineColor(kBlue); - hTriggerPerMBBlow->SetMarkerColor(kBlue); - hTriggerPerMBBlow->SetMarkerSize(2); - hTriggerPerMBBlow->SetMarkerStyle(27); - TH1* hTriggerPerMBBhigh= static_cast(hTriggerMBBhigh->Clone("hTriggerPerMBBhigh")); - hTriggerPerMBBhigh->Divide(hMBBhigh); - hTriggerPerMBBhigh->SetLineWidth(2); - hTriggerPerMBBhigh->SetLineStyle(2); - hTriggerPerMBBhigh->SetLineColor(kBlue); - hTriggerPerMBBhigh->SetMarkerColor(kBlue); - hTriggerPerMBBhigh->SetMarkerSize(2); - hTriggerPerMBBhigh->SetMarkerStyle(24); - - - TH1* hMatchedPerMBBlow= static_cast(hMatchedMBBlow->Clone("hMatchedPerMBBlow")); - hMatchedPerMBBlow->Divide(hMBBlow); - hMatchedPerMBBlow->SetLineWidth(2); - hMatchedPerMBBlow->SetLineStyle(2); - hMatchedPerMBBlow->SetLineColor(kViolet); - hMatchedPerMBBlow->SetMarkerColor(kViolet); - hMatchedPerMBBlow->SetMarkerSize(2); - hMatchedPerMBBlow->SetMarkerStyle(27); - TH1* hMatchedPerMBBhigh= static_cast(hMatchedMBBhigh->Clone("hMatchedPerMBBhigh")); - hMatchedPerMBBhigh->Divide(hMBBhigh); - hMatchedPerMBBhigh->SetLineWidth(2); - hMatchedPerMBBhigh->SetLineStyle(2); - hMatchedPerMBBhigh->SetLineColor(kViolet); - hMatchedPerMBBhigh->SetMarkerColor(kViolet); - hMatchedPerMBBhigh->SetMarkerSize(2); - hMatchedPerMBBhigh->SetMarkerStyle(24); - - - TH1* hAllTracksPerMBBlow= static_cast(hAllTracksMBBlow->Clone("hAllTracksPerMBBlow")); - hAllTracksPerMBBlow->Divide(hMBBlow); - hAllTracksPerMBBlow->SetLineWidth(2); - hAllTracksPerMBBlow->SetLineStyle(2); - hAllTracksPerMBBlow->SetLineColor(kBlack); - hAllTracksPerMBBlow->SetMarkerColor(kBlack); - hAllTracksPerMBBlow->SetMarkerSize(2); - hAllTracksPerMBBlow->SetMarkerStyle(27); - TH1* hAllTracksPerMBBhigh= static_cast(hAllTracksMBBhigh->Clone("hAllTracksPerMBBhigh")); - hAllTracksPerMBBhigh->Divide(hMBBhigh); - hAllTracksPerMBBhigh->SetLineWidth(2); - hAllTracksPerMBBhigh->SetLineStyle(2); - hAllTracksPerMBBhigh->SetLineColor(kBlack); - hAllTracksPerMBBhigh->SetMarkerColor(kBlack); - hAllTracksPerMBBhigh->SetMarkerSize(2); - hAllTracksPerMBBhigh->SetMarkerStyle(24); - - - CanvasName = LHCPeriod.Data() ; - CanvasName += "_RatioTrackTypesMBBVsMult"; - TCanvas *cRatioTrackTypesMBBVsMult = new TCanvas(CanvasName.Data(),"cRatioTrackTypesMBBVsMult",1200,900); - cRatioTrackTypesMBBVsMult->SetRightMargin(0.01); - cRatioTrackTypesMBBVsMult->SetGridy(1); - //cRatioTrackTypesMBBVsMult->SetLogy(1); - - - cRatioTrackTypesMBBVsMult->Divide(1,2); - - - cRatioTrackTypesMBBVsMult->cd(1); - - hAllTracksPerMBBlow->SetTitle("Ratio (Number of Tracks)/MBB low mult"); - hAllTracksPerMBBlow->SetMaximum(0.30); - hAllTracksPerMBBlow->SetMinimum(0.001); - hAllTracksPerMBBlow->SetLabelSize(LabelSize); - hAllTracksPerMBBlow->Draw("E"); - hTrackerPerMBBlow->Draw("Esame"); - hTriggerPerMBBlow->Draw("Esame"); - hMatchedPerMBBlow->Draw("Esame"); - - TLegend* legcTTMBBlow = new TLegend(0.40,0.8,0.60,1.); - legcTTMBBlow->AddEntry(hAllTracksPerMBBlow,"All tracks","p"); - legcTTMBBlow->AddEntry(hTrackerPerMBBlow,"Tracking (only) tracks","p"); - legcTTMBBlow->AddEntry(hMatchedPerMBBlow,"Matched tracks","p"); - legcTTMBBlow->AddEntry(hTriggerPerMBBlow,"Trigger (only) tracks","p"); - legcTTMBBlow->Draw("same"); - - - cRatioTrackTypesMBBVsMult->cd(2); - hAllTracksPerMBBhigh->SetTitle("Ratio (Number of Tracks)/MBB high mult"); - hAllTracksPerMBBhigh->SetMaximum(15); - hAllTracksPerMBBhigh->SetMinimum(0.01); - hAllTracksPerMBBhigh->SetLabelSize(LabelSize); - hAllTracksPerMBBhigh->Draw("E"); - hTrackerPerMBBhigh->Draw("Esame"); - hTriggerPerMBBhigh->Draw("Esame"); - hMatchedPerMBBhigh->Draw("Esame"); - - - - TLegend* legcTTMBBhigh = new TLegend(0.40,0.8,0.60,1.); - legcTTMBBhigh->AddEntry(hAllTracksPerMBBhigh,"All tracks","p"); - legcTTMBBhigh->AddEntry(hTrackerPerMBBhigh,"Tracking (only) tracks","p"); - legcTTMBBhigh->AddEntry(hMatchedPerMBBhigh,"Matched tracks","p"); - legcTTMBBhigh->AddEntry(hTriggerPerMBBhigh,"Trigger (only) tracks","p"); - legcTTMBBhigh->Draw("same"); - - - // cRatioTrackTypesMBBVsMult->cd(); - // TPaveText pt1(0.2,0.2,0.7,0.9); - // TText* t1=pt1.AddText("All tracks (tracking-only + trigger-only + matched)"); - // t1->SetTextColor(kBlack); - // pt1.Draw(); - // break; - - cRatioTrackTypesMBBVsMult->Print(OutFileNamePDF.Data()); - cRatioTrackTypesMBBVsMult->Write(); - - - //=========================================== - // draw ratio of track (summed, i.e all trigger=(matched+trigger-only)) for MB versus run for low mult - CanvasName = LHCPeriod.Data() ; - CanvasName += "_TrackMultBBlow"; - TCanvas* cTrackMultBBlow = new TCanvas("cTrackMultBBlow","cTrackMultBBlow",1200,900); - // must be applied on the pads created by divide - cTrackMultBBlow->Divide(1,2); - cTrackMultBBlow->cd(1); - - TH1* hSumTriggerOverMBBlow = static_cast(hTriggerMBBlow->Clone("hSumTriggerOverMBBlow")); - hSumTriggerOverMBBlow->Add(hMatchedMBBlow); - hSumTriggerOverMBBlow->Divide(hMBBlow); - hSumTriggerOverMBBlow->SetTitle("Sum of trigger tracks (matched+trigger-only) in MBB events / # MBB events in low mult."); - //hSumTriggerOverMBBlow->LabelsOption("u"); - hSumTriggerOverMBBlow->SetLabelSize(LabelSize); - hSumTriggerOverMBBlow->SetLineWidth(2); - hSumTriggerOverMBBlow->SetLineColor(kBlue); - hSumTriggerOverMBBlow->Draw("e"); - cTrackMultBBlow->cd(2); - TH1* hSumTrackerOverMBBlow = static_cast(hTrackerMBBlow->Clone("hSumTrackerOverMBBlow")); - hSumTrackerOverMBBlow->Add(hMatchedMBBlow); - hSumTrackerOverMBBlow->Divide(hMBBlow); - hSumTrackerOverMBBlow->SetTitle("Sum tracker tracks (matched+tracker-only) in MBB events / # MBB events in low mult."); - //hSumTrackerOverMBBlow->LabelsOption("u"); - hSumTrackerOverMBBlow->SetLabelSize(LabelSize); - hSumTrackerOverMBBlow->SetLineWidth(2); - hSumTrackerOverMBBlow->SetLineColor(kBlue); - hSumTrackerOverMBBlow->Draw("e"); - - - cTrackMultBBlow->Print(OutFileNamePDF.Data()); - cTrackMultBBlow->Write(); - - - - //=========================================== - // draw ratio of track (summed, i.e all trigger=(matched+trigger-only)) for MB versus run for high mult - CanvasName = LHCPeriod.Data() ; - CanvasName += "_TrackMultBBhigh"; - TCanvas* cTrackMultBBhigh = new TCanvas("cTrackMultBBhigh","cTrackMultBBhigh",1200,900); - // must be applied on the pads created by divide - cTrackMultBBhigh->Divide(1,2); - cTrackMultBBhigh->cd(1); - - TH1* hSumTriggerOverMBBhigh = static_cast(hTriggerMBBhigh->Clone("hSumTriggerOverMBBhigh")); - hSumTriggerOverMBBhigh->Add(hMatchedMBBhigh); - hSumTriggerOverMBBhigh->Divide(hMBBhigh); - hSumTriggerOverMBBhigh->SetTitle("Sum of trigger tracks (matched+trigger-only) in MBB events / # MBB events in high mult."); - //hSumTriggerOverMBBhigh->LabelsOption("u"); - hSumTriggerOverMBBhigh->SetLabelSize(LabelSize); - hSumTriggerOverMBBhigh->SetLineWidth(2); - hSumTriggerOverMBBhigh->SetLineColor(kBlue); - hSumTriggerOverMBBhigh->Draw("e"); - cTrackMultBBhigh->cd(2); - TH1* hSumTrackerOverMBBhigh = static_cast(hTrackerMBBhigh->Clone("hSumTrackerOverMBBhigh")); - hSumTrackerOverMBBhigh->Add(hMatchedMBBhigh); - hSumTrackerOverMBBhigh->Divide(hMBBhigh); - hSumTrackerOverMBBhigh->SetTitle("Sum tracker tracks (matched+tracker-only) in MBB events / # MBB events in high mult."); - //hSumTrackerOverMBBhigh->LabelsOption("u"); - hSumTrackerOverMBBhigh->SetLabelSize(LabelSize); - hSumTrackerOverMBBhigh->SetLineWidth(2); - hSumTrackerOverMBBhigh->SetLineColor(kBlue); - hSumTrackerOverMBBhigh->Draw("e"); - - - cTrackMultBBhigh->Print(OutFileNamePDF.Data()); - cTrackMultBBhigh->Write(); - - - - //=========================================== - // draw mixed ratio of track over track versus run for MBB in low mult - CanvasName = LHCPeriod.Data() ; - CanvasName += "_RatioTrackMBBlow"; - TCanvas* cRatioTrackMBBlow = new TCanvas("cRatioTrackMBBlow","cRatioTrackMBBlow",1200,900); - cRatioTrackMBBlow->Divide(1,3); - - cRatioTrackMBBlow->cd(1); - TH1* hTrackerOverTriggerMBBlow = static_cast(hTrackerMBBlow->Clone("hTrackerOverTriggerMBBlow")); - hTrackerOverTriggerMBBlow->Divide(hTriggerMBBlow); - hTrackerOverTriggerMBBlow->SetTitle("# tracker tracks / # trigger tracks in MBB low mult."); - //hTrackerOverTriggerMBBlow->LabelsOption("u"); - hTrackerOverTriggerMBBlow->SetLabelSize(LabelSize); - hTrackerOverTriggerMBBlow->SetLineWidth(2); - hTrackerOverTriggerMBBlow->SetLineColor(kBlue); - hTrackerOverTriggerMBBlow->Draw("e"); - - cRatioTrackMBBlow->cd(2); - TH1* hMatchedOverTriggerMBBlow = static_cast(hMatchedMBBlow->Clone("hMatchedOverTriggerMBBlow")); - hMatchedOverTriggerMBBlow->Divide(hTriggerMBBlow); - hMatchedOverTriggerMBBlow->SetTitle("# matched tracks / # trigger tracks in MBB low mult."); - //hMatchedOverTriggerMBBlow->LabelsOption("u"); - hMatchedOverTriggerMBBlow->SetLabelSize(LabelSize); - hMatchedOverTriggerMBBlow->SetLineWidth(2); - hMatchedOverTriggerMBBlow->SetLineColor(kBlue); - hMatchedOverTriggerMBBlow->Draw("e"); - - cRatioTrackMBBlow->cd(3); - TH1* hMatchedOverTrackerMBBlow = static_cast(hMatchedMBBlow->Clone("hMatchedOverTrackerMBBlow")); - hMatchedOverTrackerMBBlow->Divide(hTrackerMBBlow); - hMatchedOverTrackerMBBlow->SetTitle("# matched tracks / # tracker tracks in MBB low mult."); - //hMatchedOverTrackerMBBlow->LabelsOption("u"); - hMatchedOverTrackerMBBlow->SetLabelSize(LabelSize); - hMatchedOverTrackerMBBlow->SetLineWidth(2); - hMatchedOverTrackerMBBlow->SetLineColor(kBlue); - hMatchedOverTrackerMBBlow->Draw("e"); - - cRatioTrackMBBlow->Print(OutFileNamePDF.Data()); - cRatioTrackMBBlow->Write(); - - - //=========================================== - // draw mixed ratio of track over track versus run for MBB in high mult - CanvasName = LHCPeriod.Data() ; - CanvasName += "_RatioTrackMBBhigh"; - TCanvas* cRatioTrackMBBhigh = new TCanvas("cRatioTrackMBBhigh","cRatioTrackMBBhigh",1200,900); - cRatioTrackMBBhigh->Divide(1,3); - - cRatioTrackMBBhigh->cd(1); - TH1* hTrackerOverTriggerMBBhigh = static_cast(hTrackerMBBhigh->Clone("hTrackerOverTriggerMBBhigh")); - hTrackerOverTriggerMBBhigh->Divide(hTriggerMBBhigh); - hTrackerOverTriggerMBBhigh->SetTitle("# tracker tracks / # trigger tracks in MBB high mult."); - //hTrackerOverTriggerMBBhigh->LabelsOption("u"); - hTrackerOverTriggerMBBhigh->SetLabelSize(LabelSize); - hTrackerOverTriggerMBBhigh->SetLineWidth(2); - hTrackerOverTriggerMBBhigh->SetLineColor(kBlue); - hTrackerOverTriggerMBBhigh->Draw("e"); - - cRatioTrackMBBhigh->cd(2); - TH1* hMatchedOverTriggerMBBhigh = static_cast(hMatchedMBBhigh->Clone("hMatchedOverTriggerMBBhigh")); - hMatchedOverTriggerMBBhigh->Divide(hTriggerMBBhigh); - hMatchedOverTriggerMBBhigh->SetTitle("# matched tracks / # trigger tracks in MBB high mult."); - //hMatchedOverTriggerMBBhigh->LabelsOption("u"); - hMatchedOverTriggerMBBhigh->SetLabelSize(LabelSize); - hMatchedOverTriggerMBBhigh->SetLineWidth(2); - hMatchedOverTriggerMBBhigh->SetLineColor(kBlue); - hMatchedOverTriggerMBBhigh->Draw("e"); - - cRatioTrackMBBhigh->cd(3); - TH1* hMatchedOverTrackerMBBhigh = static_cast(hMatchedMBBhigh->Clone("hMatchedOverTrackerMBBhigh")); - hMatchedOverTrackerMBBhigh->Divide(hTrackerMBBhigh); - hMatchedOverTrackerMBBhigh->SetTitle("# matched tracks / # tracker tracks in MBB high mult."); - //hMatchedOverTrackerMBBhigh->LabelsOption("u"); - hMatchedOverTrackerMBBhigh->SetLabelSize(LabelSize); - hMatchedOverTrackerMBBhigh->SetLineWidth(2); - hMatchedOverTrackerMBBhigh->SetLineColor(kBlue); - hMatchedOverTrackerMBBhigh->Draw("e"); - - cRatioTrackMBBhigh->Print(OutFileNamePDF.Data()); - cRatioTrackMBBhigh->Write(); - - - - - -// //=========================================== -// // Draw ratio of tracks over CMUS1B versus run -// TH1* hTrackerPerCMUS1B= static_cast(hTrackerCMUS1B->Clone("hTrackerPerCMUS1B")); -// hTrackerPerCMUS1B->Divide(hCMUS1B); -// hTrackerPerCMUS1B->SetLineWidth(2); -// hTrackerPerCMUS1B->SetLineColor(kRed); - -// TH1* hTriggerPerCMUS1B= static_cast(hTriggerCMUS1B->Clone("hTriggerPerCMUS1B")); -// hTriggerPerCMUS1B->Divide(hCMUS1B); -// hTriggerPerCMUS1B->SetLineWidth(2); -// hTriggerPerCMUS1B->SetLineColor(kBlue); - -// TH1* hMatchedPerCMUS1B= static_cast(hMatchedCMUS1B->Clone("hMatchedPerCMUS1B")); -// hMatchedPerCMUS1B->Divide(hCMUS1B); -// hMatchedPerCMUS1B->SetLineWidth(2); -// hMatchedPerCMUS1B->SetLineColor(kViolet); - - -// TH1* hAllTracksPerCMUS1B= static_cast(hAllTracksCMUS1B->Clone("hAllTracksPerCMUS1B")); -// hAllTracksPerCMUS1B->Divide(hCMUS1B); -// hAllTracksPerCMUS1B->SetLineWidth(3); -// hAllTracksPerCMUS1B->SetLineColor(kBlack); - - -// CanvasName = LHCPeriod.Data() ; -// CanvasName += "_RatioTrackTypesCMUS1B"; -// TCanvas *cRatioTrackTypesCMUS1B = new TCanvas(CanvasName.Data(),"cRatioTrackTypesCMUS1B",1200,900); -// cRatioTrackTypesCMUS1B->SetRightMargin(0.01); -// cRatioTrackTypesCMUS1B->SetGridy(1); -// cRatioTrackTypesCMUS1B->cd(); - -// hAllTracksPerCMUS1B->SetTitle("Ratio (Number of Tracks)/CMUS1B"); -// hAllTracksPerCMUS1B->SetMinimum(0.01); -// hAllTracksPerCMUS1B->SetLabelSize(LabelSize); -// hAllTracksPerCMUS1B->Draw("E"); - -// hTrackerPerCMUS1B->Draw("Esame"); -// hMatchedPerCMUS1B->Draw("Esame"); -// hTriggerPerCMUS1B->Draw("Esame"); - -// TLegend* legcTTCMUS1B = new TLegend(0.75,0.55,0.90,0.75); -// legcTTCMUS1B->AddEntry(hAllTracksPerCMUS1B,"All tracks","l"); -// legcTTCMUS1B->AddEntry(hTrackerPerCMUS1B,"Tracking (only) tracks","l"); -// legcTTCMUS1B->AddEntry(hMatchedPerCMUS1B,"Matched tracks","l"); -// legcTTCMUS1B->AddEntry(hTriggerPerCMUS1B,"Trigger (only) tracks","l"); -// legcTTCMUS1B->Draw("same"); - -// cRatioTrackTypesCMUS1B->Print(OutFileNamePDF.Data()); -// cRatioTrackTypesCMUS1B->Write(); - - -// //=========================================== -// // draw ratio of track (summed, i.e all trigger=(matched+trigger-only)) over CMUS1B versus run -// TCanvas* cTrackMultCMUS1B = new TCanvas("cTrackMultCMUS1B","cTrackMultCMUS1B",1200,900); -// cTrackMultCMUS1B->Divide(1,2); -// cTrackMultCMUS1B->cd(1); -// TH1* hSumTriggerOverCMUS1B = static_cast(hTriggerCMUS1B->Clone("hSumTriggerOverCMUS1B")); -// hSumTriggerOverCMUS1B->Add(hMatchedCMUS1B); -// hSumTriggerOverCMUS1B->Divide(hCMUS1B); -// hSumTriggerOverCMUS1B->SetTitle("Sum of trigger tracks (matched+trigger-only) in CMUS1B events / # CMUS1B events"); -// //hSumTriggerOverCMUS1B->LabelsOption("u"); -// hSumTriggerOverCMUS1B->SetLabelSize(LabelSize); -// hSumTriggerOverCMUS1B->SetLineWidth(2); -// hSumTriggerOverCMUS1B->SetLineColor(kRed); -// hSumTriggerOverCMUS1B->Draw("e"); - -// cTrackMultCMUS1B->cd(2); -// TH1* hSumTrackerOverCMUS1B = static_cast(hTrackerCMUS1B->Clone("hSumTrackerOverCMUS1B")); -// hSumTrackerOverCMUS1B->Add(hMatchedCMUS1B); -// hSumTrackerOverCMUS1B->Divide(hCMUS1B); -// hSumTrackerOverCMUS1B->SetTitle("Sum of tracker tracks (matched+tracker-only) in CMUS1B events / # CMUS1B events"); -// //hSumTrackerOverCMUS1B->LabelsOption("u"); -// hSumTrackerOverCMUS1B->SetLabelSize(LabelSize); -// hSumTrackerOverCMUS1B->SetLineWidth(2); -// hSumTrackerOverCMUS1B->SetLineColor(kRed); -// hSumTrackerOverCMUS1B->Draw("e"); - -// cTrackMultCMUS1B->Print(OutFileNamePDF.Data()); -// cTrackMultCMUS1B->Write(); - -// //=========================================== -// // draw mixed ratio of track over track versus run for CMUS1B -// TCanvas* cRatioTrackCMUS1B = new TCanvas("cRatioTrackCMUS1B","cRatioTrackCMUS1B",1200,900); -// cRatioTrackCMUS1B->Divide(1,3); - -// cRatioTrackCMUS1B->cd(1); -// TH1* hTrackerOverTriggerCMUS1B = static_cast(hTrackerCMUS1B->Clone("hTrackerOverTriggerCMUS1B")); -// hTrackerOverTriggerCMUS1B->Divide(hTriggerCMUS1B); -// hTrackerOverTriggerCMUS1B->SetTitle("# tracker tracks / # trigger tracks in CMUS1B"); -// //hTrackerOverTriggerCMUS1B->LabelsOption("u"); -// hTrackerOverTriggerCMUS1B->SetLabelSize(LabelSize); -// hTrackerOverTriggerCMUS1B->SetLineWidth(2); -// hTrackerOverTriggerCMUS1B->SetLineColor(kRed); -// hTrackerOverTriggerCMUS1B->Draw("e"); - -// cRatioTrackCMUS1B->cd(2); -// TH1* hMatchedOverTriggerCMUS1B = static_cast(hMatchedCMUS1B->Clone("hMatchedOverTriggerCMUS1B")); -// hMatchedOverTriggerCMUS1B->Divide(hTriggerCMUS1B); -// hMatchedOverTriggerCMUS1B->SetTitle("# matched tracks / # trigger tracks in CMUS1B"); -// //hMatchedOverTriggerCMUS1B->LabelsOption("u"); -// hMatchedOverTriggerCMUS1B->SetLabelSize(LabelSize); -// hMatchedOverTriggerCMUS1B->SetLineWidth(2); -// hMatchedOverTriggerCMUS1B->SetLineColor(kRed); -// hMatchedOverTriggerCMUS1B->Draw("e"); - -// cRatioTrackCMUS1B->cd(3); -// TH1* hMatchedOverTrackerCMUS1B = static_cast(hMatchedCMUS1B->Clone("hMatchedOverTrackerCMUS1B")); -// hMatchedOverTrackerCMUS1B->Divide(hTrackerCMUS1B); -// hMatchedOverTrackerCMUS1B->SetTitle("# matched tracks / # tracker tracks in CMUS1B"); -// //hMatchedOverTrackerCMUS1B->LabelsOption("u"); -// hMatchedOverTrackerCMUS1B->SetLabelSize(LabelSize); -// hMatchedOverTrackerCMUS1B->SetLineWidth(2); -// hMatchedOverTrackerCMUS1B->SetLineColor(kRed); -// hMatchedOverTrackerCMUS1B->Draw("e"); - -// cRatioTrackCMUS1B->Print(OutFileNamePDF.Data()); -// cRatioTrackCMUS1B->Write(); - - //================================================== - // Draw matched tracks charge asymetry in low mult for MBB triggers - TH1 *hDiffMatchedMBBlow= static_cast(hPosMatchedMBBlow->Clone("hDiffMatchedMBBlow")); - hDiffMatchedMBBlow->Add(hNegMatchedMBBlow,-1); - hDiffMatchedMBBlow->Sumw2(); - - TH1 *hAsymMatchedMBBlow= static_cast(hDiffMatchedMBBlow->Clone("hAsymMatchedMBBlow")); - hAsymMatchedMBBlow->Divide(hAllMatchedMBBlow); - hAsymMatchedMBBlow->SetLineColor(kBlue); - hAsymMatchedMBBlow->SetLineWidth(2); - hAsymMatchedMBBlow->SetMinimum(-0.2); - hAsymMatchedMBBlow->SetMaximum(0.2); - hAsymMatchedMBBlow->SetLabelSize(LabelSize); - hAsymMatchedMBBlow->SetTitle("Matched tracks charge asymmetry in Physics Selected events for MBB low (blue) and high (red) mult."); - - TH1 *hDiffMatchedMBBhigh= static_cast(hPosMatchedMBBhigh->Clone("hDiffMatchedMBBhigh")); - hDiffMatchedMBBhigh->Add(hNegMatchedMBBhigh,-1); - hDiffMatchedMBBhigh->Sumw2(); - - TH1 *hAsymMatchedMBBhigh= static_cast(hDiffMatchedMBBhigh->Clone("hAsymMatchedMBBhigh")); - hAsymMatchedMBBhigh->Divide(hAllMatchedMBBhigh); - hAsymMatchedMBBhigh->SetLineColor(kRed); - hAsymMatchedMBBhigh->SetLineWidth(2); - hAsymMatchedMBBhigh->SetMinimum(-0.2); - hAsymMatchedMBBhigh->SetMaximum(0.2); - hAsymMatchedMBBhigh->SetLabelSize(LabelSize); - hAsymMatchedMBBhigh->SetTitle("Matched tracks asymetry in Physics Selected events"); - - - CanvasName = LHCPeriod.Data() ; - CanvasName += "_AsymMatched"; - TCanvas *cAsymMatched = new TCanvas(CanvasName.Data(),"cAsymMatched",1200,900); - cAsymMatched->SetRightMargin(0.01); - cAsymMatched->SetGridy(1); - cAsymMatched->cd(); - hAsymMatchedMBBlow->GetYaxis()->SetTitle("Charge asymmetry"); - hAsymMatchedMBBlow->Draw("EH"); - hAsymMatchedMBBhigh->Draw("EHsame"); - - TLegend* legcAMT = new TLegend(0.60,0.25,0.98,0.45); - legcAMT->SetHeader("Charge asymmetry of matched track per MBB (include Vtx, #eta and R_{Abs} cuts) "); - legcAMT->AddEntry(hAsymMatchedMBBlow," Low mult. events","l"); - legcAMT->AddEntry(hAsymMatchedMBBhigh," High mult. events ","l"); - legcAMT->Draw("same"); - - cAsymMatched->Print(OutFileNamePDF.Data()); - cAsymMatched->Write(); - - - //========================================================= - // Draw low/high pt tracks in acceptance per MBB all mult - TH1* hMatchedLowPtPerMBB = static_cast (hMatchedLowPtMBB->Clone("hMatchedLowPtPerMBB")); - hMatchedLowPtPerMBB->Sumw2(); - hMatchedLowPtPerMBB->Divide(hMBB); - hMatchedLowPtPerMBB->SetLineWidth(2); - hMatchedLowPtPerMBB->SetLineColor(kBlue); - - TH1* hMatchedHighPtPerMBB = static_cast (hMatchedHighPtMBB->Clone("hMatchedHighPtPerMBB")); - hMatchedHighPtPerMBB->Sumw2(); - hMatchedHighPtPerMBB->Divide(hMBB); - hMatchedHighPtPerMBB->SetLineWidth(2); - hMatchedHighPtPerMBB->SetLineColor(kRed); - - TH1* hMatchedLowPtPerMBBlow = static_cast (hMatchedLowPtMBBlow->Clone("hMatchedLowPtPerMBBlow")); - hMatchedLowPtPerMBBlow->Sumw2(); - hMatchedLowPtPerMBBlow->Divide(hMBBlow); - hMatchedLowPtPerMBBlow->SetLineWidth(2); - hMatchedLowPtPerMBBlow->SetMarkerSize(2); - hMatchedLowPtPerMBBlow->SetMarkerStyle(27); - hMatchedLowPtPerMBBlow->SetMarkerColor(kBlue); - hMatchedLowPtPerMBBlow->SetLineWidth(2); - hMatchedLowPtPerMBBlow->SetLineColor(kBlue); - - TH1* hMatchedHighPtPerMBBlow = static_cast (hMatchedHighPtMBBlow->Clone("hMatchedHighPtPerMBBlow")); - hMatchedHighPtPerMBBlow->Sumw2(); - hMatchedHighPtPerMBBlow->Divide(hMBB); - hMatchedHighPtPerMBBlow->SetLineWidth(2); - hMatchedHighPtPerMBBlow->SetLineColor(kRed); - hMatchedHighPtPerMBBlow->SetMarkerSize(2); - hMatchedHighPtPerMBBlow->SetMarkerStyle(27); - hMatchedHighPtPerMBBlow->SetMarkerColor(kRed); - - TH1* hMatchedLowPtPerMBBhigh = static_cast (hMatchedLowPtMBBhigh->Clone("hMatchedLowPtPerMBBhigh")); - hMatchedLowPtPerMBBhigh->Sumw2(); - hMatchedLowPtPerMBBhigh->Divide(hMBBhigh); - hMatchedLowPtPerMBBhigh->SetLineWidth(2); - hMatchedLowPtPerMBBhigh->SetLineColor(kBlue); - hMatchedLowPtPerMBBhigh->SetMarkerSize(2); - hMatchedLowPtPerMBBhigh->SetMarkerStyle(24); - hMatchedLowPtPerMBBhigh->SetMarkerColor(kBlue); - - - TH1* hMatchedHighPtPerMBBhigh = static_cast (hMatchedHighPtMBBhigh->Clone("hMatchedHighPtPerMBBhigh")); - hMatchedHighPtPerMBBhigh->Sumw2(); - hMatchedHighPtPerMBBhigh->Divide(hMBB); - hMatchedHighPtPerMBBhigh->SetLineWidth(2); - hMatchedHighPtPerMBBhigh->SetLineColor(kRed); - hMatchedHighPtPerMBBhigh->SetMarkerSize(2); - hMatchedHighPtPerMBBhigh->SetMarkerStyle(24); - hMatchedHighPtPerMBBhigh->SetMarkerColor(kRed); - - - CanvasName = LHCPeriod.Data() ; - CanvasName += "_HighPtMuons"; - TCanvas *cHighPtMuons = new TCanvas(CanvasName.Data(),"cHighPtMuons",1200,900); - cHighPtMuons->SetTopMargin(0.05); - cHighPtMuons->SetRightMargin(0.01); - //cHighPtMuons->SetLogy(1); - cHighPtMuons->SetGridy(1); - cHighPtMuons->cd(); - - hMatchedLowPtPerMBB->SetTitle(""); - hMatchedLowPtPerMBB->GetYaxis()->SetTitle("Ratio per MBB"); - hMatchedLowPtPerMBB->SetMaximum(0.13); - hMatchedLowPtPerMBB->SetMinimum(0.02); - hMatchedLowPtPerMBB->SetLabelSize(LabelSize); - - hMatchedLowPtPerMBB->Draw("E"); - hMatchedHighPtPerMBB->Scale(5); - hMatchedHighPtPerMBB->Draw("Esame"); - - TLegend* legcHPM = new TLegend(0.60,0.50,0.98,0.65); - legcHPM->SetHeader("Number of matched track per MBB (include Vtx, #eta and R_{Abs} cuts) "); - legcHPM->AddEntry(hMatchedLowPtPerMBB," p_{T} > 1 GeV/c ","l"); - legcHPM->AddEntry(hMatchedHighPtPerMBB," (x5) p_{T} > 2 GeV/c ","l"); - legcHPM->Draw("same"); - - cHighPtMuons->Print(OutFileNamePDF.Data()); - cHighPtMuons->Write(); - - - //===================================================================== - // Draw low/high pt tracks in acceptance per MBB in low and high mult - CanvasName = LHCPeriod.Data() ; - CanvasName += "_HighPtMuonsVsMult"; - TCanvas *cHighPtMuonsVsMult = new TCanvas(CanvasName.Data(),"cHighPtMuonsVsMult",1200,900); - cHighPtMuonsVsMult->SetTopMargin(0.05); - cHighPtMuonsVsMult->SetRightMargin(0.01); - cHighPtMuonsVsMult->SetLogy(1); - cHighPtMuonsVsMult->SetGridy(1); - cHighPtMuonsVsMult->Divide(1,2); - - - cHighPtMuonsVsMult->cd(1); - - hMatchedLowPtPerMBBlow->SetTitle(""); - hMatchedLowPtPerMBBlow->GetYaxis()->SetTitle("Ratio per MBB in low mult"); - hMatchedLowPtPerMBBlow->SetMaximum(0.015); - hMatchedLowPtPerMBBlow->SetMinimum(0.000001); - hMatchedLowPtPerMBBlow->SetLabelSize(LabelSize); - - hMatchedLowPtPerMBBlow->Draw("E"); - hMatchedHighPtPerMBBlow->Scale(10); - hMatchedHighPtPerMBBlow->Draw("Esame"); - TLegend* legcHPMlow = new TLegend(0.60,0.35,0.98,0.5); - legcHPMlow->SetHeader("Number of matched track per MBB (include Vtx, #eta and R_{Abs} cuts) "); - legcHPMlow->AddEntry(hMatchedLowPtPerMBBlow," p_{T} > 1 GeV/c in low mult","p"); - legcHPMlow->AddEntry(hMatchedHighPtPerMBBlow,"(x10) p_{T} > 2 GeV/c in low mult","p"); - legcHPMlow->Draw("same"); - - - cHighPtMuonsVsMult->cd(2); - hMatchedLowPtPerMBBhigh->SetTitle(""); - hMatchedLowPtPerMBBhigh->GetYaxis()->SetTitle("Ratio per MBB in high mult"); - hMatchedLowPtPerMBBhigh->SetMinimum(0.005); - hMatchedLowPtPerMBBhigh->Draw("E"); - hMatchedHighPtPerMBBhigh->Scale(10); - hMatchedHighPtPerMBBhigh->Draw("Esame"); - - TLegend* legcHPMhigh = new TLegend(0.60,0.4,0.98,0.55); - legcHPMhigh->SetHeader("Number of matched track per MBB (include Vtx, #eta and R_{Abs} cuts) "); - legcHPMhigh->AddEntry(hMatchedLowPtPerMBBhigh," p_{T} > 1 GeV/c in high mult","p"); - legcHPMhigh->AddEntry(hMatchedHighPtPerMBBhigh,"(x10) p_{T} > 2 GeV/c in high mult","p"); - legcHPMhigh->Draw("same"); - - cHighPtMuonsVsMult->Print(OutFileNamePDF.Data()); - cHighPtMuonsVsMult->Write(); - - // close merged file - globalFile->Close(); - - - //--------------------------------------------- // - // monitor quantities run per run // - //--------------------------------------------- // - - - // Are the runs stored locally or in alien? - Int_t isAlienFile = 0; - if(alienBaseDir.Contains("alien:")){ - isAlienFile = 1; - alienBaseDir.ReplaceAll("alien://",""); - } - - /* if ( ! alienBaseDir.Contains("alien:")){ - Info("PlotMuonQA","Working locally, stopping here"); - rootFileOut->Close(); - return; - } - */ - // else (!TGrid::Connect("alien://")) { - // Error("PlotMuonQA","cannot connect to grid. It's really needed here"); - // c1->Print(OutFileNamePDF_close.Data()); - // rootFileOut->Close(); - // return; - // } - - TH1F* hNClustersPerTrackVsRun_Mean = new TH1F("hNClustersPerTrackVsRun_Mean", "averaged number of associated clusters per track;run;",10000,1,10000); - TH1F* hNClustersPerTrackVsRun_Sigma = new TH1F("hNClustersPerTrackVsRun_Sigma", "dispersion of the number of associated clusters per track;run;#sigma_{n_{clusters}}",10000,1,10000); - TH1F* hNChamberHitPerTrack_Mean = new TH1F("hNChamberHitPerTrack_Mean", "averaged number of chambers hit per track;run;",10000,1,10000); - TH1F* hNChamberHitPerTrack_Sigma = new TH1F("hNChamberHitPerTrack_Sigma", "dispersion of the number of chambers hit per track;run;#sigma_{n_{chamber hit}}",10000,1,10000); - TH1F* hChi2_Mean = new TH1F("hChi2_Mean", "averaged normalized #chi^{2} distribution;run;<#chi^{2} / ndf>",10000,1,10000); - TH1F* hChi2_Sigma = new TH1F("hChi2_Sigma", "dispersion of normalized #chi^{2} distribution;run;#sigma_{#chi^{2} / ndf}",10000,1,10000); - TH1F* hNClustersInCh[10]; - for (Int_t ich=0; ich<10; ich++){ - hNClustersInCh[ich] = new TH1F(Form("hNClustersInCh%d",ich+1), Form("averaged number of clusters in chamber %d per track;run;",ich+1),10000,1,10000); - } - TH1F* hClusterHitMapXInCh[10]; - for (Int_t ich=0; ich<10; ich++){ - hClusterHitMapXInCh[ich] = new TH1F(Form("hClusterHitMapXInCh%d",ich+1), Form("averaged cluster position distribution in chamber %d;X (cm)",ich+1),10000,1,10000); - } - TH1F* hClusterHitMapYInCh[10]; - for (Int_t ich=0; ich<10; ich++){ - hClusterHitMapYInCh[ich] = new TH1F(Form("hClusterHitMapYInCh%d",ich+1), Form("averaged cluster position distribution in chamber %d;Y (cm)",ich+1),10000,1,10000); - } - - Int_t ibin = 1; - - // loop over runs - for ( Int_t irun=0; irunGetString(); - // get the file (or list of files) to be analyzed - TString command; - TGridResult *res = 0; - TObjString *objs = 0; - - if(isAlienFile){ - // get the file (or list of files) to be analyzed - command = Form("find %s/ %s/%s", alienBaseDir.Data(), run.Data(), QAFileName.Data()); - res = gGrid->Command(command); - if (!res) { - Error("PlotMuonQAPbPb",Form("no result for the command: %s",command.Data())); - return; - } - } - else{ - res = new TGridResult(); - - if(runList){ - objs = new TObjString(Form("%s/%s/AnalysisResults.root", alienBaseDir.Data(), run.Data())); - res->Add(objs); - } - else { - //loop over the directory to find the root files - void *dir = gSystem->OpenDirectory(alienBaseDir.Data()); - TString sDirFilename; - Int_t iEntry=0, iFile=0; - - while(kTRUE){ - iEntry++; - const char* dirFilename = gSystem->GetDirEntry(dir); - if(!dirFilename) break; - sDirFilename = dirFilename; - if(!sDirFilename.IsDigit()) continue; - iFile++; - objs = new TObjString(Form("%s/%s/AnalysisResults.root", alienBaseDir.Data(), sDirFilename.Data())); - res->Add(objs); - } - } - } - - // Loop over the 'find' results and get next LFN - TIter nextmap(res); - TMap *map = 0; - TObjString *objs; - - //some checks - Int_t iLoop=0, iLoopMax=1000; - - while (kTRUE){ - // get the current file url - if(isAlienFile){ - map=(TMap*)nextmap(); - if(!map) break; - objs = dynamic_cast(map->GetValue("turl")); - } - else{ - objs=(TObjString*)nextmap(); - if(!objs) break; - } - - //in case of infinite loop - iLoop++; - if(iLoop>iLoopMax) break; - - - if (!objs || !objs->GetString().Length()) { - Error("PlotMuonQA","turl not found for the run %s... SKIPPING", run.Data()); - continue; - } - - // open the outfile for this run - TFile *runFile = TFile::Open(objs->GetString()); - if (!runFile || ! runFile->IsOpen()) { - Error("PlotMuonQA", Form("failed to open file: %s", objs->GetName())); - return; - } - - // change here - runFile->Cd("MUON_QA"); - - // get interesting histos - TObjArray* general1 = static_cast(runFile->FindObjectAny("general1")); - TObjArray* general2 = static_cast(runFile->FindObjectAny("general2")); - TObjArray* expert = static_cast(runFile->FindObjectAny("expert")); - - if (!general1 || !general2 || !expert){ - Error("PlotMUONQAPbPb", Form("All objects not here !!! ===> Skipping...for %s",objs->GetName())); - continue; - } - - TH1* hNClustersPerTrack = static_cast(general1->FindObject("hNClustersPerTrack")); - TH1* hNChamberHitPerTrack = static_cast(general1->FindObject("hNChamberHitPerTrack")); - TH1* hChi2 = static_cast(general1->FindObject("hChi2")); - TH1* hNClustersPerCh = static_cast(general2->FindObject("hNClustersPerCh")); - - TH2* hClusterHitMapInCh[10]; - for(Int_t ich=0; ich<10; ich++) hClusterHitMapInCh[ich] = static_cast(expert->FindObject(Form("hClusterHitMapInCh%d",ich+1))); - - // do not skip empty runs butrather set values to 0 - if (!hNClustersPerCh) { - Warning("PlotQA", Form("File: %s has empty histograms !", objs->GetName())); - hNClustersPerTrackVsRun_Mean->SetBinContent(ibin, 0.); - hNClustersPerTrackVsRun_Mean->SetBinError(ibin, 1.); - hNClustersPerTrackVsRun_Sigma->SetBinContent(ibin, 0.); - hNClustersPerTrackVsRun_Sigma->SetBinError(ibin, 1.); - hNChamberHitPerTrack_Mean->SetBinContent(ibin, 0.); - hNChamberHitPerTrack_Mean->SetBinError(ibin, 1.); - hNChamberHitPerTrack_Sigma->SetBinContent(ibin, 0.); - hNChamberHitPerTrack_Sigma->SetBinError(ibin, 1.); - hChi2_Mean->SetBinContent(ibin, 0.); - hChi2_Mean->SetBinError(ibin, 1.); - hChi2_Sigma->SetBinContent(ibin, 0.); - hChi2_Sigma->SetBinError(ibin, 1.); - for (Int_t ich=0; ich<10; ich++) { - hNClustersInCh[ich]->SetBinContent(ibin,0.); - hNClustersInCh[ich]->SetBinError(ibin,1.); - hClusterHitMapXInCh[ich]->SetBinContent(ibin,0.); - hClusterHitMapXInCh[ich]->SetBinError(ibin,1.); - hClusterHitMapYInCh[ich]->SetBinContent(ibin,0.); - hClusterHitMapYInCh[ich]->SetBinError(ibin,1.); - } - //runFile->Close(); - //continue; - } - else { - // fill monitoring plots - hNClustersPerTrackVsRun_Mean->SetBinContent(ibin, hNClustersPerTrack->GetMean()); - hNClustersPerTrackVsRun_Mean->SetBinError(ibin, hNClustersPerTrack->GetMeanError()); - hNClustersPerTrackVsRun_Sigma->SetBinContent(ibin, hNClustersPerTrack->GetRMS()); - hNClustersPerTrackVsRun_Sigma->SetBinError(ibin, hNClustersPerTrack->GetRMSError()); - hNChamberHitPerTrack_Mean->SetBinContent(ibin, hNChamberHitPerTrack->GetMean()); - hNChamberHitPerTrack_Mean->SetBinError(ibin, hNChamberHitPerTrack->GetMeanError()); - hNChamberHitPerTrack_Sigma->SetBinContent(ibin, hNChamberHitPerTrack->GetRMS()); - hNChamberHitPerTrack_Sigma->SetBinError(ibin, hNChamberHitPerTrack->GetRMSError()); - hChi2_Mean->SetBinContent(ibin, hChi2->GetMean()); - hChi2_Mean->SetBinError(ibin, hChi2->GetMeanError()); - hChi2_Sigma->SetBinContent(ibin, hChi2->GetRMS()); - hChi2_Sigma->SetBinError(ibin, hChi2->GetRMSError()); - for (Int_t ich=0; ich<10; ich++) { - hNClustersInCh[ich]->SetBinContent(ibin,hNClustersPerCh->GetBinContent(ich+1)); - hNClustersInCh[ich]->SetBinError(ibin,hNClustersPerCh->GetBinError(ich+1)); - hClusterHitMapXInCh[ich]->SetBinContent(ibin,hClusterHitMapInCh[ich]->GetMean(1)); - hClusterHitMapXInCh[ich]->SetBinError(ibin,hClusterHitMapInCh[ich]->GetMeanError(1)); - hClusterHitMapYInCh[ich]->SetBinContent(ibin,hClusterHitMapInCh[ich]->GetMean(2)); - hClusterHitMapYInCh[ich]->SetBinError(ibin,hClusterHitMapInCh[ich]->GetMeanError(2)); - } - } - - // set labels - run = objs->GetString(); - run.ReplaceAll(baseDir, ""); - run.Remove(TString::kLeading, '/'); - run.Remove(TString::kLeading, '0'); - run.ReplaceAll(QAFileName.Data(),""); - run.Remove(TString::kTrailing, '/'); - hNClustersPerTrackVsRun_Mean->GetXaxis()->SetBinLabel(ibin, run.Data()); - hNClustersPerTrackVsRun_Sigma->GetXaxis()->SetBinLabel(ibin, run.Data()); - hNChamberHitPerTrack_Mean->GetXaxis()->SetBinLabel(ibin, run.Data()); - hNChamberHitPerTrack_Sigma->GetXaxis()->SetBinLabel(ibin, run.Data()); - hChi2_Mean->GetXaxis()->SetBinLabel(ibin, run.Data()); - hChi2_Sigma->GetXaxis()->SetBinLabel(ibin, run.Data()); - for (Int_t ich=0; ich<10; ich++) { - hNClustersInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data()); - hClusterHitMapXInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data()); - hClusterHitMapYInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data()); - } - // close outfile for this run - runFile->Close(); - ibin++; - } - - delete res; - } - - //sort label - hNClustersPerTrackVsRun_Mean->LabelsOption("a"); - hNClustersPerTrackVsRun_Sigma->LabelsOption("a"); - hNChamberHitPerTrack_Mean->LabelsOption("a"); - hNChamberHitPerTrack_Sigma->LabelsOption("a"); - hChi2_Mean->LabelsOption("a"); - hChi2_Sigma->LabelsOption("a"); - - for(Int_t ich=0; ich<10; ich++){ - hNClustersInCh[ich]->LabelsOption("a"); - hClusterHitMapXInCh[ich]->LabelsOption("a"); - hClusterHitMapYInCh[ich]->LabelsOption("a"); - } - - TString dirToGo = OutFileNameROOT.Data(); dirToGo+=":/"; - gDirectory->Cd(dirToGo.Data()); - //================================================== - //Display Mean and Sigma of the number of associated clusters to a track - TLegend *lNClusters = new TLegend(0.75,0.85,0.99,0.99); - lNClusters->AddEntry(hNClustersPerTrackVsRun_Mean,"clusters","PL"); - lNClusters->AddEntry(hNChamberHitPerTrack_Mean,"chamber hit","PL"); - - TCanvas* cNClusters = new TCanvas("cNClusters","cNClusters",1200,900); - cNClusters->SetLogy(0); - cNClusters->Divide(1,2); - cNClusters->cd(1); - //hNClustersPerTrackVsRun_Mean->SetMaximum(11); - hNClustersPerTrackVsRun_Mean->SetMinimum(7); - hNClustersPerTrackVsRun_Mean->SetStats(kFALSE); - hNClustersPerTrackVsRun_Mean->GetXaxis()->SetRange(1,ibin-1); - hNClustersPerTrackVsRun_Mean->GetXaxis()->SetNdivisions(1,kFALSE); - //hNClustersPerTrackVsRun_Mean->LabelsOption("u"); - hNClustersPerTrackVsRun_Mean->SetLabelSize(LabelSize); - hNClustersPerTrackVsRun_Mean->SetTitle("averaged number of associated clusters or of the number of chamber hit per track"); - hNClustersPerTrackVsRun_Mean->SetLineWidth(2); - hNClustersPerTrackVsRun_Mean->Draw("e"); - hNChamberHitPerTrack_Mean->SetLineColor(kRed); - hNChamberHitPerTrack_Mean->SetLineWidth(2); - hNChamberHitPerTrack_Mean->Draw("esame"); - lNClusters->Draw("same"); - - cNClusters->cd(2); - //hNClustersPerTrackVsRun_Sigma->SetMaximum(1.1); - hNClustersPerTrackVsRun_Sigma->SetMinimum(0.4); - hNClustersPerTrackVsRun_Sigma->SetStats(kFALSE); - hNClustersPerTrackVsRun_Sigma->GetXaxis()->SetRange(1,ibin-1); - hNClustersPerTrackVsRun_Sigma->GetXaxis()->SetNdivisions(1,kFALSE); - //hNClustersPerTrackVsRun_Sigma->LabelsOption("u"); - hNClustersPerTrackVsRun_Sigma->SetLabelSize(LabelSize); - hNClustersPerTrackVsRun_Sigma->SetTitle("dispersion of the number of associated clusters or of the number of chamber hit per track"); - hNClustersPerTrackVsRun_Sigma->SetLineWidth(2); - hNClustersPerTrackVsRun_Sigma->Draw("e"); - hNChamberHitPerTrack_Sigma->SetLineWidth(2); - hNChamberHitPerTrack_Sigma->SetLineColor(kRed); - hNChamberHitPerTrack_Sigma->Draw("esame"); - lNClusters->Draw("same"); - - cNClusters->Print(OutFileNamePDF.Data()); - cNClusters->Write(); - - - //================================================== - // Display average number of cluster per chamber - TLegend *lNClustersPerCh = new TLegend(0.92,0.45,0.99,0.99); - TCanvas* cNClustersPerCh = new TCanvas("cNClustersPerCh","cNClustersPerCh",1200,900); - cNClustersPerCh->cd(); - cNClustersPerCh->SetRightMargin(0.1); - hNClustersInCh[0]->SetStats(kFALSE); - hNClustersInCh[0]->GetXaxis()->SetRange(1,ibin-1); - hNClustersInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE); - //hNClustersInCh[0]->LabelsOption("u"); - hNClustersInCh[0]->SetLabelSize(LabelSize); - hNClustersInCh[0]->SetTitle("averaged number of clusters in chamber i per track"); - hNClustersInCh[0]->SetMaximum(1.2); - hNClustersInCh[0]->SetMinimum(0.01); - for (Int_t ich=0; ich<10; ich++) { - hNClustersInCh[ich]->SetLineColor(ich+1+ich/9); - hNClustersInCh[ich]->SetLineWidth(2); - if (ich == 0) hNClustersInCh[ich]->Draw("e"); - else hNClustersInCh[ich]->Draw("esame"); - lNClustersPerCh->AddEntry(hNClustersInCh[ich],Form("ch%d",ich+1),"PL"); - } - lNClustersPerCh->Draw("same"); - - cNClustersPerCh->Print(OutFileNamePDF.Data()); - cNClustersPerCh->Write(); - - //================================================== - // Display average X and Y position of clusters per chamber - TLegend *lClusterHitMapPerCh = new TLegend(0.92,0.45,0.99,0.99); - TCanvas* cClusterHitMapPerCh = new TCanvas("cClusterHitMapPerCh","cClusterHitMapPerCh",1200,900); - cClusterHitMapPerCh->Divide(1,2); - cClusterHitMapPerCh->GetPad(1)->SetRightMargin(0.1); - cClusterHitMapPerCh->GetPad(2)->SetRightMargin(0.1); - - cClusterHitMapPerCh->cd(1); - hClusterHitMapXInCh[0]->SetStats(kFALSE); - hClusterHitMapXInCh[0]->GetXaxis()->SetRange(1,ibin-1); - hClusterHitMapXInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE); - //hNClustersInCh[0]->LabelsOption("u"); - hClusterHitMapXInCh[0]->SetLabelSize(LabelSize); - hClusterHitMapXInCh[0]->SetTitle(" of clusters - associated to a track - in chamber i"); - hClusterHitMapXInCh[0]->SetMaximum(30); - hClusterHitMapXInCh[0]->SetMinimum(-30); - for (Int_t ich=0; ich<10; ich++) { - hClusterHitMapXInCh[ich]->SetLineColor(ich+1+ich/9); - hClusterHitMapXInCh[ich]->SetLineWidth(2); - if (ich == 0) hClusterHitMapXInCh[ich]->Draw("e"); - else hClusterHitMapXInCh[ich]->Draw("esame"); - - lClusterHitMapPerCh->AddEntry(hClusterHitMapXInCh[ich],Form("ch%d",ich+1),"PL"); - } - lClusterHitMapPerCh->Draw("same"); - - cClusterHitMapPerCh->cd(2); - hClusterHitMapYInCh[0]->SetStats(kFALSE); - hClusterHitMapYInCh[0]->GetXaxis()->SetRange(1,ibin-1); - hClusterHitMapYInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE); - //hNClustersInCh[0]->LabelsOption("u"); - hClusterHitMapYInCh[0]->SetLabelSize(LabelSize); - hClusterHitMapYInCh[0]->SetTitle(" of clusters - associated to a track - in chamber i"); - hClusterHitMapYInCh[0]->SetMaximum(30); - hClusterHitMapYInCh[0]->SetMinimum(-30); - for (Int_t ich=0; ich<10; ich++) { - hClusterHitMapYInCh[ich]->SetLineColor(ich+1+ich/9); - hClusterHitMapYInCh[ich]->SetLineWidth(2); - if (ich == 0) hClusterHitMapYInCh[ich]->Draw("e"); - else hClusterHitMapYInCh[ich]->Draw("esame"); - } - lClusterHitMapPerCh->Draw("same"); - - cClusterHitMapPerCh->Print(OutFileNamePDF.Data()); - cClusterHitMapPerCh->Write(); - - - //================================================== - // Display tracks ChiSquare - TCanvas* cChi2 = new TCanvas("cChi2","cChi2",1200,900); - cChi2->Divide(1,2); - cChi2->cd(1); - hChi2_Mean->SetStats(kFALSE); - hChi2_Mean->GetXaxis()->SetRange(1,ibin-1); - hChi2_Mean->GetXaxis()->SetNdivisions(1,kFALSE); - //hChi2_Mean->LabelsOption("u"); - hChi2_Mean->SetLabelSize(LabelSize); - hChi2_Mean->SetLineWidth(2); - hChi2_Mean->Draw("e"); - - cChi2->cd(2); - hChi2_Sigma->SetStats(kFALSE); - hChi2_Sigma->GetXaxis()->SetRange(1,ibin-1); - hChi2_Sigma->GetXaxis()->SetNdivisions(1,kFALSE); - //hChi2_Sigma->LabelsOption("u"); - hChi2_Sigma->SetLabelSize(LabelSize); - hChi2_Sigma->SetLineWidth(2); - hChi2_Sigma->Draw("e"); - - cChi2->Print(OutFileNamePDF.Data()); - cChi2->Write(); - - // close the PDF file - c1->Print(OutFileNamePDF_close.Data()); - rootFileOut->Close(); - - //==================================================== - if (PRINTSTAT){ - // set the format to print labels - THashList* labels = hMBB->GetXaxis()->GetLabels(); - TString format(Form("\n%%%ds %%9d",0)); - - // print value for each label - TObjString* label = 0x0; - TIter nextLabel(labels); - cout << "-------------------------------------------------" << endl; - cout << "Run Number" << "\t Number of CMBB after Phys. Sel. " << endl ; - while ((label = static_cast(nextLabel()))) { - Int_t bin = (Int_t) label->GetUniqueID(); - printf(format.Data(), label->String().Data(), (Int_t) hMBB->GetBinContent(bin)); - } - printf("\n\n"); - - - cout << "-------------------------------------------------" << endl; - cout << "Total statistic" << endl; - cout << " " << endl ; - cout << "Number of NumOfAllTriggers " << endl ; - cout << "\t before selection " << NumOfAllTriggersNoPS << "\t after selection " << NumOfAllTriggersWithPS << " --> rejection = " << (Double_t) (NumOfAllTriggersNoPS-NumOfAllTriggersWithPS)/(NumOfAllTriggersNoPS)*100. << "%" << endl ; - cout << "Number of NumOfCMBB " << endl ; - cout << "\t before selection " << NumOfMBBNoPS << "\t after selection " << NumOfMBBWithPS << " --> rejection = " << (Double_t) (NumOfMBBNoPS-NumOfMBBWithPS)/(NumOfMBBNoPS)*100. << "%" << endl ; - cout << " " << endl ; - - } -} -- 2.43.0