updates in centrality dependence for DET monitoring task (Markus)
authorabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 28 Feb 2011 07:32:11 +0000 (07:32 +0000)
committerabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 28 Feb 2011 07:32:11 +0000 (07:32 +0000)
PWG1/TRD/AliTRDcheckDET.cxx
PWG1/TRD/AliTRDcheckDET.h
PWG1/TRD/AliTRDrecoTask.h

index f2affc9..081ace2 100644 (file)
@@ -23,6 +23,7 @@
 //                                                                        //
 ////////////////////////////////////////////////////////////////////////////
 
+#include <TArrayD.h>
 #include <TAxis.h>
 #include <TCanvas.h>
 #include <TFile.h>
 #include "info/AliTRDeventInfo.h"
 #include "AliTRDinfoGen.h"
 #include "AliTRDcheckDET.h"
+#include "AliTRDpwg1Helper.h"
 
 #include <cstdio>
 #include <iostream>
 
 ClassImp(AliTRDcheckDET)
 
+const Color_t AliTRDcheckDET::fkColorsCentrality[AliTRDeventInfo::kCentralityClasses] = {kTeal, kOrange, kGreen, kBlue ,kRed};
+
 //_______________________________________________________
 AliTRDcheckDET::AliTRDcheckDET():
   AliTRDrecoTask()
@@ -165,6 +169,7 @@ void AliTRDcheckDET::UserExec(Option_t *opt){
 
 
 //_______________________________________________________
+//_______________________________________________________
 Bool_t AliTRDcheckDET::PostProcess(){
   //
   // Do Postprocessing (for the moment set the number of Reference histograms)
@@ -226,7 +231,6 @@ Bool_t AliTRDcheckDET::PostProcess(){
   return kTRUE;
 }
 
-//_______________________________________________________
 void AliTRDcheckDET::MakeSummary(){
   //
   // Create summary plots for TRD check DET
@@ -267,117 +271,112 @@ void AliTRDcheckDET::MakeSummary(){
 
 //_______________________________________________________
 Bool_t AliTRDcheckDET::GetRefFigure(Int_t ifig){
-  //
-  // Setting Reference Figures
-  //
-  gPad->SetLogy(0);
-  gPad->SetLogx(0);
-  TH1 *h = NULL; TObjArray *arr=NULL;
-  TLegend *leg = NULL;
-  Bool_t kFIRST(1);
-  switch(ifig){
-  case kFigNclustersTrack:
-    (h=(TH1F*)fContainer->FindObject("hNcls"))->Draw("pl");
-    PutTrendValue("NClustersTrack", h->GetMean());
-    PutTrendValue("NClustersTrackRMS", h->GetRMS());
-    return kTRUE;
-  case kFigNclustersTracklet:
-    (h =(TH1F*)fContainer->FindObject("hNclTls"))->Draw("pc");
-    PutTrendValue("NClustersTracklet", h->GetMean());
-    PutTrendValue("NClustersTrackletRMS", h->GetRMS());
-    return kTRUE;
-  case kFigNtrackletsTrack:
-    h=MakePlotNTracklets();
-    if(h){
-      PutTrendValue("NTrackletsTrack", h->GetMean());
-      PutTrendValue("NTrackletsTrackRMS", h->GetRMS());
-    }
-    return kTRUE;
-  case kFigNTrackletsP:
-    MakePlotnTrackletsVsP();
-    return kTRUE;
-  case kFigNtrackletsCross:
-    h = (TH1F*)fContainer->FindObject("hNtlsCross");
-    if(!MakeBarPlot(h, kRed)) break;
-    PutTrendValue("NTrackletsCross", h->GetMean());
-    PutTrendValue("NTrackletsCrossRMS", h->GetRMS());
-    return kTRUE;
-  case kFigNtrackletsFindable:
-    h = (TH1F*)fContainer->FindObject("hNtlsFindable");
-    if(!MakeBarPlot(h, kGreen)) break;
-    PutTrendValue("NTrackletsFindable", h->GetMean());
-    PutTrendValue("NTrackletsFindableRMS", h->GetRMS());
-    return kTRUE;
-  case kFigNtracksEvent:
-    (h = (TH1F*)fContainer->FindObject("hNtrks"))->Draw("pl");
-    PutTrendValue("NTracksEvent", h->GetMean());
-    PutTrendValue("NTracksEventRMS", h->GetRMS());
-    return kTRUE;
-  case kFigNtracksSector:
-    h = (TH1F*)fContainer->FindObject("hNtrksSector");
-    if(!MakeBarPlot(h, kGreen)) break;
-    PutTrendValue("NTracksSector", h->Integral()/h->GetNbinsX());
-    return kTRUE;
-  case kFigTrackStatus:
-    if(!(h=(TH1F *)fContainer->FindObject("hTrackStatus"))) break;
-    h->GetXaxis()->SetRangeUser(0.5, -1);
-    h->GetYaxis()->CenterTitle();
-    h->Draw("c");
-    PutTrendValue("TrackStatus", h->Integral());
-    gPad->SetLogy(0);
-    return kTRUE;
-  case kFigTrackletStatus:
-    if(!(arr = dynamic_cast<TObjArray*>(fContainer->At(kTrackletStatus)))) break;
-    leg = new TLegend(.68, .7, .97, .97);
-    leg->SetBorderSize(0);leg->SetFillStyle(0);
-    leg->SetHeader("TRD layer");
-    for(Int_t ily=AliTRDgeometry::kNlayer; ily--;){
-      if(!(h=dynamic_cast<TH1F*>(arr->At(ily)))) continue;
-      if(kFIRST){
-        h->Draw("pl");
-        h->GetXaxis()->SetRangeUser(0.5, -1);
-        h->GetYaxis()->CenterTitle();
-        kFIRST = kFALSE;
-      } else h->Draw("samepl");
-      leg->AddEntry(h, Form("ly = %d", ily), "l");
-      PutTrendValue(Form("TrackletStatus%d", ily), h->Integral());
-    }
-    leg->Draw();
-    gPad->SetLogy(0);
-    return kTRUE;
-  case kFigChi2:
-    MakePlotChi2();
-    return kTRUE;
-  case kFigPH:
-    gPad->SetMargin(0.125, 0.015, 0.1, 0.1);
-    MakePlotPulseHeight();
-    gPad->SetLogy(0);
-    return kTRUE;
-  case kFigChargeCluster:
-    (h = (TH1F*)fContainer->FindObject("hQcl"))->Draw("c");
-    gPad->SetLogy(1);
-    PutTrendValue("ChargeCluster", h->GetMaximumBin());
-    PutTrendValue("ChargeClusterRMS", h->GetRMS());
-    return kTRUE;
-  case kFigChargeTracklet:
-    (h=(TH1F*)fContainer->FindObject("hQtrklt"))->Draw("c");
-    PutTrendValue("ChargeTracklet", h->GetMaximumBin());
-    PutTrendValue("ChargeTrackletRMS", h->GetRMS());
-    return kTRUE;
-  case kFigNeventsTrigger:
-    ((TH1F*)fContainer->FindObject("hEventsTrigger"))->Draw("");
-    return kTRUE;
-  case kFigNeventsTriggerTracks:
-    ((TH1F*)fContainer->FindObject("hEventsTriggerTracks"))->Draw("");
-    return kTRUE;
-  case kFigTriggerPurity: 
-    if(!MakeBarPlot((TH1F*)fContainer->FindObject("hTriggerPurity"), kGreen)) break;
-    break;
-  default:
-    break;
-  }
-  AliInfo(Form("Reference plot [%d] missing result", ifig));
-  return kFALSE;
+       //
+       // Setting Reference Figures
+       //
+       gPad->SetLogy(0);
+       gPad->SetLogx(0);
+       TH1 *h = NULL; TObjArray *arr=NULL;
+       TLegend *leg = NULL;
+       Bool_t kFIRST(1);
+       switch(ifig){
+       case kFigNclustersTrack:
+               MakePlotNclustersTrack();
+               return kTRUE;
+       case kFigNclustersTracklet:
+               MakePlotNclustersTracklet();
+               return kTRUE;
+       case kFigNtrackletsTrack:
+               h=MakePlotNTracklets();
+               if(h){
+                       PutTrendValue("NTrackletsTrack", h->GetMean());
+                       PutTrendValue("NTrackletsTrackRMS", h->GetRMS());
+               }
+               return kTRUE;
+       case kFigNTrackletsP:
+               MakePlotnTrackletsVsP();
+               return kTRUE;
+       case kFigNtrackletsCross:
+               h = ProjectCentrality((TH2*)fContainer->FindObject("hNtlsCross"), -1);
+               if(!MakeBarPlot(h, kRed)) break;
+               PutTrendValue("NTrackletsCross", h->GetMean());
+               PutTrendValue("NTrackletsCrossRMS", h->GetRMS());
+               return kTRUE;
+       case kFigNtrackletsFindable:
+               h = ProjectCentrality((TH2*)fContainer->FindObject("hNtlsFindable"), -1);
+               if(!MakeBarPlot(h, kGreen)) break;
+               PutTrendValue("NTrackletsFindable", h->GetMean());
+               PutTrendValue("NTrackletsFindableRMS", h->GetRMS());
+               return kTRUE;
+       case kFigNtracksEvent:
+               (h = (TH1F*)fContainer->FindObject("hNtrks"))->Draw("pl");
+               PutTrendValue("NTracksEvent", h->GetMean());
+               PutTrendValue("NTracksEventRMS", h->GetRMS());
+               return kTRUE;
+       case kFigNtracksSector:
+               h = (TH1F*)fContainer->FindObject("hNtrksSector");
+               if(!MakeBarPlot(h, kGreen)) break;
+               PutTrendValue("NTracksSector", h->Integral()/h->GetNbinsX());
+               return kTRUE;
+       case kFigTrackStatus:
+               if(!(h=(TH1F *)fContainer->FindObject("hTrackStatus"))) break;
+               h->GetXaxis()->SetRangeUser(0.5, -1);
+               h->GetYaxis()->CenterTitle();
+               h->Draw("c");
+               PutTrendValue("TrackStatus", h->Integral());
+               gPad->SetLogy(0);
+               return kTRUE;
+       case kFigTrackletStatus:
+               if(!(arr = dynamic_cast<TObjArray*>(fContainer->At(kTrackletStatus)))) break;
+               leg = new TLegend(.68, .7, .97, .97);
+               leg->SetBorderSize(0);leg->SetFillStyle(0);
+               leg->SetHeader("TRD layer");
+               for(Int_t ily=AliTRDgeometry::kNlayer; ily--;){
+                       if(!(h=dynamic_cast<TH1F*>(arr->At(ily)))) continue;
+                       if(kFIRST){
+                               h->Draw("pl");
+                               h->GetXaxis()->SetRangeUser(0.5, -1);
+                               h->GetYaxis()->CenterTitle();
+                               kFIRST = kFALSE;
+                       } else h->Draw("samepl");
+                       leg->AddEntry(h, Form("ly = %d", ily), "l");
+                       PutTrendValue(Form("TrackletStatus%d", ily), h->Integral());
+               }
+               leg->Draw();
+               gPad->SetLogy(0);
+               return kTRUE;
+       case kFigChi2:
+               MakePlotChi2();
+               return kTRUE;
+       case kFigPH:
+               gPad->SetMargin(0.125, 0.015, 0.1, 0.1);
+               MakePlotPulseHeight();
+               gPad->SetLogy(0);
+               return kTRUE;
+       case kFigChargeCluster:
+               h = ProjectCentrality((TH2*)fContainer->FindObject("hQcl"), -1);
+               h->Draw("c");
+               gPad->SetLogy(1);
+               PutTrendValue("ChargeCluster", h->GetMaximumBin());
+               PutTrendValue("ChargeClusterRMS", h->GetRMS());
+               return kTRUE;
+       case kFigChargeTracklet:
+               MakePlotTrackletCharge();
+               return kTRUE;
+       case kFigNeventsTrigger:
+               ((TH1F*)fContainer->FindObject("hEventsTrigger"))->Draw("");
+               return kTRUE;
+       case kFigNeventsTriggerTracks:
+               ((TH1F*)fContainer->FindObject("hEventsTriggerTracks"))->Draw("");
+               return kTRUE;
+       case kFigTriggerPurity:
+               if(!MakeBarPlot((TH1F*)fContainer->FindObject("hTriggerPurity"), kGreen)) break;
+               break;
+       default:
+               break;
+       }
+       AliInfo(Form("Reference plot [%d] missing result", ifig));
+       return kFALSE;
 }
 
 //_______________________________________________________
@@ -545,6 +544,18 @@ TObjArray *AliTRDcheckDET::Histos(){
   return fContainer;
 }
 
+//_______________________________________________________
+TH1 *AliTRDcheckDET::ProjectCentrality(TH2 *hIn, Int_t centralityBin){
+  //
+  // Project histogram to a given centrality Bin
+  //
+  if(!hIn) return NULL;
+  if(centralityBin >= AliTRDeventInfo::kCentralityClasses) centralityBin = -1;
+  Int_t binMin = centralityBin > -1 ? centralityBin + 2 : 0, 
+        binMax = centralityBin > -1 ? centralityBin + 2 : -1;
+  return hIn->ProjectionX(Form("%s_%d", hIn->GetName(), centralityBin), binMin, binMax);
+}
+
 /*
 * Plotting Functions
 */
@@ -1268,50 +1279,248 @@ TH1* AliTRDcheckDET::MakePlotChi2() const
 
 //________________________________________________________
 TH1* AliTRDcheckDET::MakePlotNTracklets(){
-  //
-  // Make nice bar plot of the number of tracklets in each method
-  //
-  TH2F *tmp = (TH2F *)fContainer->FindObject("hNtlsBAR");
-  TH1D *hBAR = tmp->ProjectionY();
-  TH1F *hSTA = (TH1F *)fContainer->FindObject("hNtlsSTA");
-  TH1F *hCON = (TH1F *)fContainer->FindObject("hNtls");
-  TLegend *leg = new TLegend(0.13, 0.75, 0.39, 0.89);
-  leg->SetBorderSize(1);
-  leg->SetFillColor(0);
-
-  Float_t scale = hCON->Integral();
-  if(scale) hCON->Scale(100./scale);
-  hCON->SetFillColor(kRed);hCON->SetLineColor(kRed);
-  hCON->SetBarWidth(0.2);
-  hCON->SetBarOffset(0.6);
-  hCON->SetStats(kFALSE);
-  hCON->GetYaxis()->SetRangeUser(0.,40.);
-  hCON->GetYaxis()->SetTitleOffset(1.2);
-  hCON->Draw("bar1"); leg->AddEntry(hCON, "Total", "f");
-  hCON->SetMaximum(55.);
-
-  if(scale) hBAR->Scale(100./scale);
-  hBAR->SetFillColor(kGreen);hBAR->SetLineColor(kGreen);
-  hBAR->SetBarWidth(0.2);
-  hBAR->SetBarOffset(0.2);
-  hBAR->SetTitle("");
-  hBAR->SetStats(kFALSE);
-  hBAR->GetYaxis()->SetRangeUser(0.,40.);
-  hBAR->GetYaxis()->SetTitleOffset(1.2);
-  hBAR->Draw("bar1same"); leg->AddEntry(hBAR, "Barrel", "f");
-
-  if(scale) hSTA->Scale(100./scale);
-  hSTA->SetFillColor(kBlue);hSTA->SetLineColor(kBlue);
-  hSTA->SetBarWidth(0.2);
-  hSTA->SetBarOffset(0.4);
-  hSTA->SetTitle("");
-  hSTA->SetStats(kFALSE);
-  hSTA->GetYaxis()->SetRangeUser(0.,40.);
-  hSTA->GetYaxis()->SetTitleOffset(1.2);
-  hSTA->Draw("bar1same"); leg->AddEntry(hSTA, "Stand Alone", "f");
-  leg->Draw();
-  gPad->Update();
-  return hCON;
+       //
+       // Make nice bar plot of the number of tracklets in each method
+       //
+       TH3 *hTracklets3D = dynamic_cast<TH3F *>(fContainer->FindObject("hNtlsBAR"));
+       if(!hTracklets3D){
+               AliError("Tracklet Histogram not found");
+               return NULL;
+       }
+       TH1 *hBAR = hTracklets3D->Project3D("y");
+       hBAR->SetName("hBAR");
+       hBAR->SetTitle("Number of Tracklets");
+       hBAR->Scale(1./hBAR->Integral());
+       hBAR->SetLineColor(kBlack);
+       hBAR->SetLineWidth(2);
+       hBAR->Draw();
+
+       // Draw also centrality-dependent plots
+       TH1 *hBarCent[AliTRDeventInfo::kCentralityClasses];
+       Int_t nHistsCentrality = 0;
+       for(Int_t icent = 0; icent < AliTRDeventInfo::kCentralityClasses; icent++){
+               hTracklets3D->GetZaxis()->SetRange(icent+2, icent+2);
+               hBarCent[icent] = hTracklets3D->Project3D("y");
+               if(!(hBarCent[icent] && hBarCent[icent]->GetEntries())){
+                       delete hBarCent[icent];
+                       hBarCent[icent] = NULL;
+                       continue;
+               }
+               hBarCent[icent]->SetName(Form("hBarCent_%d", icent));
+               hBarCent[icent]->SetTitle("Number of Tracklets");
+               hBarCent[icent]->Scale(1./hBarCent[icent]->Integral());
+               hBarCent[icent]->SetLineColor(fkColorsCentrality[icent]);
+               hBarCent[icent]->Draw("same");
+               nHistsCentrality++;
+       }
+       hTracklets3D->GetZaxis()->SetRange(0, hTracklets3D->GetNbinsZ());
+       AliInfo(Form("Number of Centrality Classes: %d", nHistsCentrality));
+       if(nHistsCentrality){
+               TLegend *leg = new TLegend(0.5, 0.6, 0.89, 0.89);
+               leg->SetBorderSize(0);
+               leg->SetFillStyle(0);
+               for(Int_t icent = 0; icent < AliTRDeventInfo::kCentralityClasses; icent++)
+                       if(hBarCent[icent]) leg->AddEntry(hBarCent[icent], Form("Centrality Class %d", icent), "l");
+               leg->Draw();
+               gPad->Update();
+       }
+       return hBAR;
+
+       /*
+         TH2F *tmp = (TH2F *)fContainer->FindObject("hNtlsBAR");
+         TH1D *hBAR = tmp->ProjectionY();
+         TH1F *hSTA = (TH1F *)fContainer->FindObject("hNtlsSTA");
+         TH1F *hCON = (TH1F *)fContainer->FindObject("hNtls");
+         TLegend *leg = new TLegend(0.13, 0.75, 0.39, 0.89);
+         leg->SetBorderSize(1);
+         leg->SetFillColor(0);
+
+         Float_t scale = hCON->Integral();
+         if(scale) hCON->Scale(100./scale);
+         hCON->SetFillColor(kRed);hCON->SetLineColor(kRed);
+         hCON->SetBarWidth(0.2);
+         hCON->SetBarOffset(0.6);
+         hCON->SetStats(kFALSE);
+         hCON->GetYaxis()->SetRangeUser(0.,40.);
+         hCON->GetYaxis()->SetTitleOffset(1.2);
+         hCON->Draw("bar1"); leg->AddEntry(hCON, "Total", "f");
+         hCON->SetMaximum(55.);
+
+         if(scale) hBAR->Scale(100./scale);
+         hBAR->SetFillColor(kGreen);hBAR->SetLineColor(kGreen);
+         hBAR->SetBarWidth(0.2);
+         hBAR->SetBarOffset(0.2);
+         hBAR->SetTitle("");
+         hBAR->SetStats(kFALSE);
+         hBAR->GetYaxis()->SetRangeUser(0.,40.);
+         hBAR->GetYaxis()->SetTitleOffset(1.2);
+         hBAR->Draw("bar1same"); leg->AddEntry(hBAR, "Barrel", "f");
+
+         if(scale) hSTA->Scale(100./scale);
+         hSTA->SetFillColor(kBlue);hSTA->SetLineColor(kBlue);
+         hSTA->SetBarWidth(0.2);
+         hSTA->SetBarOffset(0.4);
+         hSTA->SetTitle("");
+         hSTA->SetStats(kFALSE);
+         hSTA->GetYaxis()->SetRangeUser(0.,40.);
+         hSTA->GetYaxis()->SetTitleOffset(1.2);
+         hSTA->Draw("bar1same"); leg->AddEntry(hSTA, "Stand Alone", "f");
+         leg->Draw();
+         gPad->Update();
+         return hCON;
+        */
+}
+
+//________________________________________________________
+void AliTRDcheckDET::MakePlotNclustersTrack(){
+       //
+       // Plot number of clusters
+       // Put histos from all centrality classes into one pad
+       //
+       TH2 *hClusters = dynamic_cast<TH2 *>(fContainer->FindObject("hNcls"));
+       if(!hClusters){
+               AliError("Cluster histogram not found in the output");
+       }
+       TH1 *hAllCentrality = hClusters->ProjectionX("hNcls_all");
+       hAllCentrality->SetTitle("Number of clusters/track");
+       hAllCentrality->Scale(1./hAllCentrality->Integral());
+       hAllCentrality->SetLineColor(kBlack);
+       hAllCentrality->SetLineWidth(2);
+       hAllCentrality->GetYaxis()->SetRangeUser(0, 0.02);
+       hAllCentrality->Draw();
+       PutTrendValue("NClustersTrack", hAllCentrality->GetMean());
+       PutTrendValue("NClustersTrackRMS", hAllCentrality->GetRMS());
+
+       // Now look at single centrality classes
+       TH1 *hProjCentral[AliTRDeventInfo::kCentralityClasses];
+       Int_t nHistsCentrality = 0;
+       for(Int_t icent = 0; icent < AliTRDeventInfo::kCentralityClasses; icent++){
+               hProjCentral[icent] = hClusters->ProjectionX(Form("hNcls_%d", icent), icent+1, icent+1);
+               if(!hProjCentral[icent]->GetEntries()){
+                       delete hProjCentral[icent];
+                       hProjCentral[icent] = NULL;
+                       continue;
+               }
+               hProjCentral[icent]->Scale(1./hProjCentral[icent]->Integral());
+               hProjCentral[icent]->SetTitle("Number of clusters/track");
+               hProjCentral[icent]->SetLineColor(fkColorsCentrality[icent]);
+               hProjCentral[icent]->GetYaxis()->SetRangeUser(0, 0.03);
+               hProjCentral[icent]->Draw("same");
+               nHistsCentrality++;
+       }
+       AliInfo(Form("%d centrality classes found", nHistsCentrality));
+       if(nHistsCentrality){
+               // Draw nice legend
+               TLegend *leg = new TLegend(0.5, 0.6, 0.89, 0.89);
+               leg->SetBorderSize(0);
+               leg->SetFillStyle(0);
+               for(Int_t icent = 0; icent < AliTRDeventInfo::kCentralityClasses; icent++){
+                       if(hProjCentral[icent]) leg->AddEntry(hProjCentral[icent], Form("Centrality Class %d", icent), "l");
+               }
+               leg->Draw();
+               gPad->Update();
+       }
+}
+
+//________________________________________________________
+void AliTRDcheckDET::MakePlotNclustersTracklet(){
+       //
+       // Plot number of clusters for different centrality classes
+       //
+       TH2 *hClusters = dynamic_cast<TH2*>(fContainer->FindObject("hNclTls"));
+       if(!hClusters){
+               AliError("Histogram for the number of clusters per tracklet not available");
+               return;
+       }
+       TH1 *hAllCentrality = hClusters->ProjectionX("hNclsTls_all");
+       hAllCentrality->SetTitle("Number of clusters/track");
+       hAllCentrality->Scale(1./hAllCentrality->Integral());
+       hAllCentrality->SetLineColor(kBlack);
+       hAllCentrality->SetLineWidth(2);
+       hAllCentrality->GetYaxis()->SetRangeUser(0, 0.3);
+       hAllCentrality->Draw("pc");
+       PutTrendValue("NClustersTracklet", hAllCentrality->GetMean());
+       PutTrendValue("NClustersTrackletRMS", hAllCentrality->GetRMS());
+
+       // Now look at single centrality classes
+       TH1 *hProjCentral[AliTRDeventInfo::kCentralityClasses];
+       Int_t nHistsCentrality = 0;
+       for(Int_t icent = 0; icent < AliTRDeventInfo::kCentralityClasses; icent++){
+               hProjCentral[icent] = hClusters->ProjectionX(Form("hNclsTls_%d", icent), icent+1, icent+1);
+               if(!hProjCentral[icent]->GetEntries()){
+                       delete hProjCentral[icent];
+                       hProjCentral[icent] = NULL;
+                       continue;
+               }
+               hProjCentral[icent]->Scale(1./hProjCentral[icent]->Integral());
+               hProjCentral[icent]->SetTitle("Number of clusters/track");
+               hProjCentral[icent]->SetLineColor(fkColorsCentrality[icent]);
+               hProjCentral[icent]->GetYaxis()->SetRangeUser(0, 0.3);
+               hProjCentral[icent]->Draw("pcsame");
+               nHistsCentrality++;
+       }
+       AliInfo(Form("%d centrality classes found", nHistsCentrality));
+       if(nHistsCentrality){
+               // Draw nice legend
+               TLegend *leg = new TLegend(0.5, 0.6, 0.89, 0.89);
+               leg->SetBorderSize(0);
+               leg->SetFillStyle(0);
+               for(Int_t icent = 0; icent < AliTRDeventInfo::kCentralityClasses; icent++){
+                       if(hProjCentral[icent]) leg->AddEntry(hProjCentral[icent], Form("Centrality Class %d", icent), "l");
+               }
+               leg->Draw();
+               gPad->Update();
+       }
+}
+
+//________________________________________________________
+void AliTRDcheckDET::MakePlotTrackletCharge(){
+       //
+       // Draw tracklet charge for different centrality classes
+       //
+       TH2 *hQt = dynamic_cast<TH2*>(fContainer->FindObject("hQtrklt"));
+       if(!hQt){
+               AliError("Histogram for tracklet charges not found");
+               return;
+       }
+       // First Project all charhes
+       TH1 *hQtAll = hQt->ProjectionX("hQtAll");
+       hQtAll->SetTitle("Tracklet Charge");
+       Double_t scalefactor = 0.7 * hQtAll->Integral() / hQtAll->GetMaximum();
+       hQtAll->Scale(scalefactor/hQtAll->Integral());
+       hQtAll->GetYaxis()->SetRangeUser(0., 1.);
+       hQtAll->SetLineColor(kBlack);
+       hQtAll->SetLineWidth(2);
+       hQtAll->Draw("c");
+       PutTrendValue("ChargeTracklet", hQtAll->GetMaximumBin());
+       PutTrendValue("ChargeTrackletRMS", hQtAll->GetRMS());
+
+       TH1 *hQtCent[AliTRDeventInfo::kCentralityClasses];
+       Int_t nHistsCentrality = 0;
+       for(Int_t icent = 0; icent < AliTRDeventInfo::kCentralityClasses; icent++){
+               hQtCent[icent] = hQt->ProjectionX(Form("hQt_%d", icent), icent+1, icent+1);
+               if(!hQtCent[icent]->GetEntries()){
+                       delete hQtCent[icent];
+                       continue;
+               }
+               hQtCent[icent]->SetTitle("Tracklet Charge");
+               hQtCent[icent]->Scale(scalefactor/hQtCent[icent]->Integral());
+               hQtCent[icent]->GetYaxis()->SetRangeUser(0., 1.);
+               hQtCent[icent]->SetLineColor(fkColorsCentrality[icent]);
+               hQtCent[icent]->Draw("csame");
+               nHistsCentrality++;
+       }
+       AliInfo(Form("%d centrality classes found", nHistsCentrality));
+       if(nHistsCentrality){
+               TLegend *leg = new TLegend(0.5, 0.6, 0.89, 0.89);
+               leg->SetBorderSize(0);
+               leg->SetFillStyle(0);
+               for(Int_t icent = 0; icent < AliTRDeventInfo::kCentralityClasses; icent++){
+                       if(hQtCent[icent]) leg->AddEntry(hQtCent[icent], Form("Centrality Class %d", icent), "l");
+               }
+               leg->Draw();
+               gPad->Update();
+       }
 }
 
 //________________________________________________________
@@ -1320,9 +1529,6 @@ void AliTRDcheckDET::MakePlotnTrackletsVsP(){
   // Plot abundance of tracks with number of tracklets as function of momentum
   //
 
-
-
-
   Color_t color[AliTRDgeometry::kNlayer] = {kBlue, kOrange, kBlack, kGreen, kCyan, kRed};
   TH1 *h(NULL); TGraphErrors *g[AliTRDgeometry::kNlayer];
   for(Int_t itl(0); itl<AliTRDgeometry::kNlayer; itl++){
@@ -1332,7 +1538,12 @@ void AliTRDcheckDET::MakePlotnTrackletsVsP(){
     g[itl]->SetMarkerStyle(20 + itl);
   }
 
-  TH2 *hBar = (TH2F *)fContainer->FindObject("hNtlsBAR");
+  TH3 *hBar3D = dynamic_cast<TH3F *>(fContainer->FindObject("hNtlsBAR"));
+  if(!hBar3D){
+         AliError("Histogram for the number of tracklets vs p not available");
+         return;
+  }
+  TH2 *hBar = (TH2 *)hBar3D->Project3D("yx");
   TAxis *ax(hBar->GetXaxis());
   Int_t np(ax->GetNbins());
   for(Int_t ipBin(1); ipBin<np; ipBin++){
@@ -1374,67 +1585,132 @@ void AliTRDcheckDET::MakePlotnTrackletsVsP(){
 
 //________________________________________________________
 Bool_t AliTRDcheckDET::MakePlotPulseHeight(){
-  //
-  // Create Plot of the Pluse Height Spectrum
-  //
-  TCanvas *output = gPad->GetCanvas();
-  output->Divide(2);
-  output->cd(1);
-  TH1 *h, *h1, *h2;
-  TObjArray *arr = (TObjArray*)fContainer->FindObject("<PH>");
-  h = (TH1F*)arr->At(0);
-  if((Int_t)h->GetEntries()){
-    h->SetMarkerStyle(24);
-    h->SetMarkerColor(kBlack);
-    h->SetLineColor(kBlack);
-    h->GetYaxis()->SetTitleOffset(1.5);
-    h->Draw("e1");
-    // Trending for the pulse height: plateau value, slope and timebin of the maximum
-    TLinearFitter fit(1,"pol1");
-    Double_t time = 0.;
-    for(Int_t itime = 10; itime <= 20; itime++){
-      time = Double_t(itime);
-      Double_t err(h->GetBinError(itime + 1));
-      if(err>1.e-10) fit.AddPoint(&time, h->GetBinContent(itime + 1), err);
-    }
-    if(!fit.Eval()){
-      Double_t plateau = fit.GetParameter(0) + 12 * fit.GetParameter(1);
-      Double_t slope = fit.GetParameter(1);
-      PutTrendValue("PHplateau", plateau);
-      PutTrendValue("PHslope", slope);
-      PutTrendValue("PHamplificationPeak", static_cast<Double_t>(h->GetMaximumBin()-1));
-      AliDebug(1, Form("plateau %f, slope %f, MaxTime %f", plateau, slope, static_cast<Double_t>(h->GetMaximumBin()-1)));
-    }
-  }
-  //   copy the second histogram in a new one with the same x-dimension as the phs with respect to time
-  h1 = (TH1F *)arr->At(1);
-  h2 = new TH1F("hphs1","Average PH", 31, -0.5, 30.5);
-  for(Int_t ibin = h1->GetXaxis()->GetFirst(); ibin < h1->GetNbinsX(); ibin++) 
-    h2->SetBinContent(ibin, h1->GetBinContent(ibin));
-  h2->SetMarkerStyle(22);
-  h2->SetMarkerColor(kBlue);
-  h2->SetLineColor(kBlue);
-  h2->Draw("e1same");
-  gPad->Update();
-  
-//   create axis according to the histogram dimensions of the original second histogram
-  TGaxis *axis = new TGaxis(gPad->GetUxmin(),
-                    gPad->GetUymax(),
-                    gPad->GetUxmax(),
-                    gPad->GetUymax(),
-                    -0.08, 4.88, 510,"-L");
-  axis->SetLineColor(kBlue);
-  axis->SetLabelColor(kBlue);
-  axis->SetTextColor(kBlue);
-  axis->SetTitle("x_{0}-x_{c} [cm]");
-  axis->Draw();
-
-  output->cd(2);
-  TH2 *ph2d = (TH2F *)arr->At(2);
-  ph2d->GetYaxis()->SetTitleOffset(1.8);
-  ph2d->SetStats(kFALSE);
-  ph2d->Draw("colz");
-  return kTRUE;
+       //
+       // Create Plot of the Pluse Height Spectrum
+       //
+       TCanvas *output = gPad->GetCanvas();
+       output->Divide(2);
+       output->cd(1);
+
+       TObjArray *arr = (TObjArray*)fContainer->FindObject("<PH>");
+       //TH3F *hPhx = dynamic_cast<TH3F *>(arr->At(0)),
+       TH3F *hPht = dynamic_cast<TH3F *>(arr->At(1));
+       if(!hPht) return kFALSE;
+       // Project centrality of the 2 histograms
+       //TH2 *hProjCentX = dynamic_cast<TH2 *>(hPhx->Project3D("yx")),
+       TH2 *hProjCentT = dynamic_cast<TH2 *>(hPht->Project3D("yx"));
+       //hProjCentX->SetName("hProjCentX");
+       hProjCentT->SetName("hProjCentT");
+       // Draw 2D histogram versus time on pad 2
+       output->cd(2);
+       hProjCentT->SetTitle("2D Pulse Height vs. Time");
+       hProjCentT->GetYaxis()->SetTitleOffset(1.8);
+       hProjCentT->SetStats(kFALSE);
+       hProjCentT->Draw("colz");
+
+       // Fill 1D PHS as function of time resp. radius (same binning of the 2 histograms)
+       //TH1 *hPhsX = new TH1F("hPhsX", "Average PH vs X", hProjCentT->GetXaxis()->GetNbins(), hProjCentT->GetXaxis()->GetXbins()->GetArray()),
+       TH1     *hPhsT = new TH1F("hPhsT", "Average Ph vs Time", hProjCentT->GetXaxis()->GetNbins(), hProjCentT->GetXaxis()->GetXbins()->GetArray()),
+               *htmp = NULL;
+       /*for(Int_t irad = 1; irad <= hProjCentX->GetXaxis()->GetNbins(); irad++){
+               htmp = hProjCentX->ProjectionY("tmp", irad, irad);
+               hPhsX->SetBinContent(irad, htmp->GetMean());
+               hPhsX->SetBinError(irad, htmp->GetMeanError());
+               delete htmp;
+       }*/
+       for(Int_t it = 1; it <= hProjCentT->GetXaxis()->GetNbins(); it++){
+               htmp = hProjCentT->ProjectionY("tmp", it, it);
+               hPhsT->SetBinContent(it, htmp->GetMean());
+               hPhsT->SetBinError(it, htmp->GetMeanError());
+               delete htmp;
+       }
+       output->cd(1);
+       // Draw 1D histograms
+       if(hPhsT->GetEntries()){
+               hPhsT->SetMarkerStyle(24);
+               hPhsT->SetMarkerColor(kBlack);
+               hPhsT->SetLineColor(kBlack);
+               hPhsT->GetYaxis()->SetTitleOffset(1.5);
+               hPhsT->Draw("e1");
+               // Now fit the PHS with respect to time to get plateau and slope
+               // Trending for the pulse height: plateau value, slope and timebin of the maximum
+               TLinearFitter fit(1,"pol1");
+               Double_t time = 0.;
+               for(Int_t itime = 10; itime <= 20; itime++){
+                       time = Double_t(itime);
+                       Double_t err(hPhsT->GetBinError(itime + 1));
+                       if(err>1.e-10) fit.AddPoint(&time, hPhsT->GetBinContent(itime + 1), err);
+               }
+               if(!fit.Eval()){
+                       Double_t plateau = fit.GetParameter(0) + 12 * fit.GetParameter(1);
+                       Double_t slope = fit.GetParameter(1);
+                       PutTrendValue("PHplateau", plateau);
+                       PutTrendValue("PHslope", slope);
+                       PutTrendValue("PHamplificationPeak", static_cast<Double_t>(hPhsT->GetMaximumBin()-1));
+                       AliDebug(1, Form("plateau %f, slope %f, MaxTime %f", plateau, slope, static_cast<Double_t>(hPhsT->GetMaximumBin()-1)));
+               }
+       }
+       /*if(hPhsX->GetEntries()){
+               hPhsX->SetMarkerStyle(22);
+               hPhsX->SetMarkerColor(kBlue);
+               hPhsX->SetLineColor(kBlue);
+               hPhsX->GetYaxis()->SetTitleOffset(1.5);
+               hPhsX->Draw("e1same");
+               // create axis according to the histogram dimensions of the original second histogram
+               TGaxis *axis = new TGaxis(gPad->GetUxmin(),
+                               gPad->GetUymax(),
+                               gPad->GetUxmax(),
+                               gPad->GetUymax(),
+                               -0.08, 4.88, 510,"-L");
+               axis->SetLineColor(kBlue);
+               axis->SetLabelColor(kBlue);
+               axis->SetTextColor(kBlue);
+               axis->SetTitle("x_{0}-x_{c} [cm]");
+               axis->Draw();
+               gPad->Update();
+       }*/
+
+       // Centrality-dependent Pulse-Height Spectrum
+       TH1 *hPhtCent[AliTRDeventInfo::kCentralityClasses];
+       TH2 *hPtmp;
+       Int_t nHistsCentrality = 0;
+       for(Int_t icent = 0; icent < AliTRDeventInfo::kCentralityClasses; icent++){
+               hPht->GetZaxis()->SetRange(icent+2,icent+2);
+               hPtmp = dynamic_cast<TH2*>(hPht->Project3D("yx"));
+               if(!(hPtmp && hPtmp->GetEntries())){
+                       hPhtCent[icent] = NULL;
+                       continue;
+               }
+               hPhtCent[icent] = new TH1F(Form("hPhtCent_%d", icent), "Average Ph vs Time", hPtmp->GetNbinsX(), hPtmp->GetXaxis()->GetXbins()->GetArray());
+               for(Int_t it = 1; it <= hPtmp->GetNbinsX(); it++){
+                       htmp = hPtmp->ProjectionY("htmp", it, it);
+                       hPhtCent[icent]->SetBinContent(it, htmp->GetMean());
+                       hPhtCent[icent]->SetBinError(it, htmp->GetMeanError());
+                       delete htmp;
+               }
+               delete hPtmp;
+               hPhtCent[icent]->SetMarkerStyle(24);
+               hPhtCent[icent]->SetMarkerColor(fkColorsCentrality[icent]);
+               hPhtCent[icent]->SetLineColor(fkColorsCentrality[icent]);
+               hPhtCent[icent]->Draw("e1same");
+               nHistsCentrality++;
+       }
+       hPht->GetZaxis()->SetRange(0, hPht->GetNbinsZ());
+       if(nHistsCentrality){
+               TLegend *leg = new TLegend(0.5, 0.6, 0.89, 0.89);
+               leg->SetBorderSize(0);
+               leg->SetFillStyle(0);
+               for(Int_t icent = 0; icent < AliTRDeventInfo::kCentralityClasses; icent++){
+                       if(hPhtCent[icent]) leg->AddEntry(hPhtCent[icent], Form("Centrality Class %d", icent), "p");
+               }
+               leg->Draw();
+               gPad->Update();
+       }
+
+       // delete 2D Projection of the PHS vs x since it is only used to calculate the 1D projection
+       //delete hProjCentX;
+
+       return kTRUE;
 }
 
 //________________________________________________________
index 8e32762..586568c 100644 (file)
@@ -104,18 +104,26 @@ private:
   AliTRDcheckDET(const AliTRDcheckDET &);
   AliTRDcheckDET& operator=(const AliTRDcheckDET &);
   void GetDistanceToTracklet(Double_t *dist, AliTRDseedV1 * const tracklet, AliTRDcluster * const c);
+  //----------------------------------------------------
+  // Functions creating the reference figures
   TH1* MakePlotChi2() const;
   TH1* MakePlotNTracklets();
   Bool_t MakePlotPulseHeight();
   void MakePlotnTrackletsVsP();
   void MakePlotMeanClustersLayer();
+  void MakePlotNclustersTrack();
+  void MakePlotNclustersTracklet();
+  void MakePlotTrackletCharge();
   Bool_t MakeBarPlot(TH1 *histo, Int_t Color);
+  //----------------------------------------------------
   void GetEtaPhiAt(const AliExternalTrackParam *track, Double_t x, Double_t &eta, Double_t &phi);
+  TH1 *ProjectCentrality(TH2 *h2d, Int_t centralityBin = -1);
 
   Int_t fCentralityClass;              // Centrality Class
   TMap *fTriggerNames;                 //! Containing trigger class names
   UChar_t fFlags;                      // Flags for setting
-    
+
+  static const Color_t fkColorsCentrality[AliTRDeventInfo::kCentralityClasses];                // Colors for the different centrality classes in the Ref Figures
   ClassDef(AliTRDcheckDET, 2)
 };
 #endif
index 716ed67..8f3fd5d 100644 (file)
 #include "info/AliTRDtrackInfo.h"\r
 #endif\r
 \r
+#ifndef ALITRDEVENTINFO_H\r
+#include "info/AliTRDeventInfo.h"\r
+#endif\r
+\r
 class TH1;\r
 class TF1;\r
 class TList;\r
 class TObjArray;\r
 class TTreeSRedirector;\r
 class AliTRDtrackV1;\r
-class AliTRDeventInfo;\r
 \r
 class AliTRDrecoTask : public AliAnalysisTaskSE \r
 {\r