updates to produce summary plots on the grid (if our request will be approved). Markus
authorabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 1 Jul 2010 12:24:51 +0000 (12:24 +0000)
committerabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 1 Jul 2010 12:24:51 +0000 (12:24 +0000)
PWG1/TRD/AliTRDcheckDET.cxx
PWG1/TRD/AliTRDcheckDET.h
PWG1/TRD/AliTRDcheckESD.cxx
PWG1/TRD/AliTRDcheckESD.h
PWG1/TRD/AliTRDrecoTask.cxx
PWG1/TRD/AliTRDrecoTask.h
PWG1/TRD/macros/makeResults.C

index b0e252c..abdb5b2 100644 (file)
@@ -228,29 +228,42 @@ Bool_t AliTRDcheckDET::PostProcess(){
 }
 
 //_______________________________________________________
+void AliTRDcheckDET::MakeSummary(){
+  //
+  // Create summary plots for TRD check DET
+  // This function creates 2 summary plots:
+  // - General Quantities
+  // - PHS
+  // The function will reuse GetRefFigure
+  //
+  
+  TCanvas *cOut = new TCanvas(Form("summary%s1", GetName()), Form("Summary 1 for task %s", GetName()), 1024, 768);
+  cOut->Divide(3,3);
+
+  // Create figures using GetRefFigure
+  cOut->cd(1); GetRefFigure(kFigNtracksEvent);  
+  cOut->cd(2); GetRefFigure(kFigNtracksSector);
+  cOut->cd(3); GetRefFigure(kFigNclustersTrack);
+  cOut->cd(4); GetRefFigure(kFigNclustersTracklet);
+  cOut->cd(5); GetRefFigure(kFigNtrackletsTrack);
+  cOut->cd(6); GetRefFigure(kFigNTrackletsP);
+  cOut->cd(7); GetRefFigure(kFigChargeCluster);
+  cOut->cd(8); GetRefFigure(kFigChargeTracklet);
+  cOut->SaveAs(Form("TRDsummary%s1.gif", GetName()));
+  delete cOut;
+
+  // Second Plot: PHS
+  cOut = new TCanvas(Form("summary%s2", GetName()), Form("Summary 2 for task %s", GetName()), 1024, 512);
+  cOut->cd(); GetRefFigure(kFigPH);
+  cOut->SaveAs(Form("TRDsummary%s2.gif", GetName())); 
+  delete cOut;
+}
+
+//_______________________________________________________
 Bool_t AliTRDcheckDET::GetRefFigure(Int_t ifig){
   //
   // Setting Reference Figures
   //
-  enum FigureType_t{
-    kFigNclustersTrack,
-    kFigNclustersTracklet,
-    kFigNtrackletsTrack,
-    kFigNTrackletsP,
-    kFigNtrackletsCross,
-    kFigNtrackletsFindable,
-    kFigNtracksEvent,
-    kFigNtracksSector,
-    kFigTrackStatus,
-    kFigTrackletStatus,
-    kFigChi2,
-    kFigPH,
-    kFigChargeCluster,
-    kFigChargeTracklet,
-    kFigNeventsTrigger,
-    kFigNeventsTriggerTracks,
-    kFigTriggerPurity
-  };
   gPad->SetLogy(0);
   gPad->SetLogx(0);
   TH1 *h = NULL; TObjArray *arr=NULL;
@@ -325,6 +338,7 @@ Bool_t AliTRDcheckDET::GetRefFigure(Int_t ifig){
     gPad->SetLogy(0);
     return kTRUE;
   case kFigChi2:
+    return kTRUE;
     MakePlotChi2();
     return kTRUE;
   case kFigPH:
@@ -727,7 +741,8 @@ TH1 *AliTRDcheckDET::PlotNTrackletsTrack(const AliTRDtrackV1 *track){
       AliError("Input track params missing");
       return NULL;
     }
-    hBarrel->Fill(par->P(), nTracklets);
+    p = par->P(); // p needed later in the debug streaming
+    hBarrel->Fill(p, nTracklets);
   } else {
     // Stand alone Track: momentum dependence not usefull
     method = 0;
@@ -740,32 +755,30 @@ TH1 *AliTRDcheckDET::PlotNTrackletsTrack(const AliTRDtrackV1 *track){
 
   if(DebugLevel() > 2){
     AliTRDseedV1 *tracklet = NULL;
-    Int_t sector = -1;
+    Int_t sector = -1, stack = -1, detector;
     for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){
       if(!(tracklet = fkTrack->GetTracklet(itl)) || !(tracklet->IsOK())) continue;
-      sector = fGeo->GetSector(tracklet->GetDetector());
+      detector = tracklet->GetDetector();
+      sector = fGeo->GetSector(detector);
+      stack = fGeo->GetStack(detector);
       break;
     }
     (*DebugStream()) << "NTrackletsTrack"
       << "Sector="      << sector
+      << "Stack="        << stack 
       << "NTracklets="  << nTracklets
       << "Method="      << method
       << "p="           << p
       << "\n";
   }
   if(DebugLevel() > 3){
-    if(nTracklets == 1){
-      // If we have one Tracklet, check in which layer this happens
-      Int_t layer = -1;
-      AliTRDseedV1 *tracklet = NULL;
-      for(Int_t il = 0; il < AliTRDgeometry::kNlayer; il++){
-        if((tracklet = fkTrack->GetTracklet(il)) && tracklet->IsOK()){layer =  il; break;}
-      }
-      if(layer >= 0){
+    AliTRDseedV1 *tracklet = NULL;
+    for(Int_t il = 0; il < AliTRDgeometry::kNlayer; il++){
+      if((tracklet = fkTrack->GetTracklet(il)) && tracklet->IsOK()){
         (*DebugStream()) << "NTrackletsLayer"
-          << "Layer=" << layer
-          << "p=" << p
-          << "\n";
+        << "Layer=" << il
+        << "p=" << p
+        << "\n";
       }
     }
   }
@@ -978,24 +991,28 @@ TH1 *AliTRDcheckDET::PlotPHt(const AliTRDtrackV1 *track){
       h->Fill(localtime, absoluteCharge);
       phs2D->Fill(localtime, absoluteCharge); 
       if(DebugLevel() > 3){
+        Int_t inChamber = c->IsInChamber() ? 1 : 0;
         Double_t distance[2];
         GetDistanceToTracklet(distance, tracklet, c);
         Float_t theta = TMath::ATan(tracklet->GetZref(1));
         Float_t phi = TMath::ATan(tracklet->GetYref(1));
-        Float_t momentum = 0.;
+        AliExternalTrackParam *trdPar = fkTrack->GetTrackIn();
+        Float_t momentumMC = 0, momentumRec = trdPar ? trdPar->P() : track->P(); // prefer Track Low
         Int_t pdg = 0;
         Int_t kinkIndex = fkESD ? fkESD->GetKinkIndex() : 0;
         UShort_t TPCncls = fkESD ? fkESD->GetTPCncls() : 0;
         if(fkMC){
-          if(fkMC->GetTrackRef()) momentum = fkMC->GetTrackRef()->P();
+          if(fkMC->GetTrackRef()) momentumMC = fkMC->GetTrackRef()->P();
           pdg = fkMC->GetPDG();
         }
         (*DebugStream()) << "PHt"
           << "Detector="       << detector
           << "crossing="       << crossing
+          << "inChamber=" << inChamber
           << "Timebin="                << localtime
           << "Charge="         << absoluteCharge
-          << "momentum="       << momentum
+          << "momentumMC="     << momentumMC
+          << "momentumRec="    << momentumRec
           << "pdg="                            << pdg
           << "theta="                  << theta
           << "phi="                            << phi
@@ -1353,6 +1370,7 @@ Bool_t AliTRDcheckDET::MakePlotPulseHeight(){
   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");
@@ -1392,6 +1410,7 @@ Bool_t AliTRDcheckDET::MakePlotPulseHeight(){
 
   output->cd(2);
   TH2 *ph2d = (TH2F *)arr->At(2);
+  ph2d->GetYaxis()->SetTitleOffset(1.8);
   ph2d->SetStats(kFALSE);
   ph2d->Draw("colz");
   return kTRUE;
index bd824b7..5779791 100644 (file)
@@ -48,7 +48,26 @@ public:
     kTrackletStatus     = 17,
     kNTrackletsP        = 18
   };
-
+  enum FigureType_t{
+    kFigNclustersTrack,
+    kFigNclustersTracklet,
+    kFigNtrackletsTrack,
+    kFigNTrackletsP,
+    kFigNtrackletsCross,
+    kFigNtrackletsFindable,
+    kFigNtracksEvent,
+    kFigNtracksSector,
+    kFigTrackStatus,
+    kFigTrackletStatus,
+    kFigChi2,
+    kFigPH,
+    kFigChargeCluster,
+    kFigChargeTracklet,
+    kFigNeventsTrigger,
+    kFigNeventsTriggerTracks,
+    kFigTriggerPurity
+  };
   AliTRDcheckDET();
   AliTRDcheckDET(char* name);
   virtual ~AliTRDcheckDET();
@@ -74,6 +93,7 @@ public:
 
   virtual Bool_t PostProcess();
   virtual Bool_t GetRefFigure(Int_t ifig);
+  virtual void MakeSummary();
   
   Bool_t IsUsingClustersOutsideChamber() const {return TESTBIT(fFlags, kUseClustersOutsideChamber);}
   void UseClustersOutsideChamber(Bool_t b = kTRUE) {if(b) SETBIT(fFlags, kUseClustersOutsideChamber); else CLRBIT(fFlags, kUseClustersOutsideChamber);}
index 942abbc..69ec288 100644 (file)
@@ -27,6 +27,7 @@
 //////////////////////////////////////////////////////
 
 #include <TClonesArray.h>
+#include <TCanvas.h>
 #include <TObjArray.h>
 #include <TPad.h>
 #include <TLegend.h>
@@ -139,6 +140,18 @@ void AliTRDcheckESD::UserCreateOutputObjects()
   Histos();
 }
 
+//____________________________________________________________________
+void AliTRDcheckESD::MakeSummary(){
+  TCanvas *cOut = new TCanvas(Form("summary%s1", GetName()), Form("Summary 1 for task %s", GetName()), 1024, 768);
+  cOut->cd();
+  GetRefFigure(4);
+  cOut->SaveAs(Form("TRDsummary%s1.gif", GetName()));
+
+  cOut = new TCanvas(Form("summary%s2", GetName()), Form("Summary 2 for task %s", GetName()), 1024, 768);
+  cOut->cd();
+  GetRefFigure(5);
+  cOut->SaveAs(Form("TRDsummary%s2.gif", GetName()));
+}
 
 //____________________________________________________________________
 Bool_t AliTRDcheckESD::GetRefFigure(Int_t ifig)
index dbd39b4..51eeefa 100644 (file)
@@ -102,6 +102,7 @@ public:
   void          SetMC(Bool_t mc = kTRUE) { mc ? SETBIT(fStatus, kMC) : CLRBIT(fStatus, kMC);}
   Bool_t        PutTrendValue(const Char_t *name, Double_t val);
   void          Terminate(Option_t *);
+  void          MakeSummary();
 
 private:
   static const Float_t fgkxTPC; // end radial position of TPC
index f652f95..17870d7 100644 (file)
@@ -225,6 +225,12 @@ Bool_t AliTRDrecoTask::PostProcess()
 }
 
 //_______________________________________________________
+void AliTRDrecoTask::MakeSummary(){
+// To be implemented by particular tasks
+  AliWarning("Summary not available");
+}
+
+//_______________________________________________________
 void AliTRDrecoTask::SetDebugLevel(Int_t level)
 {
 // Generic debug handler
index dace87c..8d377bd 100644 (file)
@@ -47,6 +47,7 @@ public:
   const Char_t*  GetNameId() const       { return fNameId;}
   TList*         GetPlotFunctors() const { return fPlotFuncList;}
   virtual Bool_t GetRefFigure(Int_t ifig);
+  virtual void   MakeSummary();
 
   Bool_t         HasFriends() const      { return TestBit(kFriends);};
   Bool_t         HasMCdata() const       { return TestBit(kMCdata);};
index b8f83bd..21ede5f 100644 (file)
@@ -75,10 +75,11 @@ Char_t *libs[] = {"libProofPlayer.so", "libANALYSIS.so", "libANALYSISalice.so",
 // define setup
 TCanvas *c = 0x0;
 Bool_t mc(kFALSE), friends(kFALSE);
+Bool_t summary(kTRUE);
 
 void processTRD(TNamed* task, const Char_t *filename);
 void processESD(TNamed* task, const Char_t *filename);
-void makeResults(Char_t *opt = "ALL", const Char_t *files="QAResults.root", Char_t *cid = "", Bool_t kGRID=kFALSE)
+void makeResults(Char_t *opt = "ALL", const Char_t *files="QAResults.root", Char_t *cid = "", Bool_t kGRID=kFALSE, Bool_t dosummary = kTRUE)
 {
   if(kGRID){
     if(!gSystem->Getenv("GSHELL_ROOT")){
@@ -110,7 +111,10 @@ void makeResults(Char_t *opt = "ALL", const Char_t *files="QAResults.root", Char
   }
   Int_t fSteerTask = ParseOptions(opt);
 
-  if(!c) c=new TCanvas("c", "Performance", 10, 10, 800, 500);
+  if(!dosummary){
+    summary = kFLASE;
+    if(!c) c=new TCanvas("c", "Performance", 10, 10, 800, 500);
+  }
 
   TClass *ctask = new TClass;
   AliAnalysisTask *task = 0x0;
@@ -151,10 +155,13 @@ void processTRD(TNamed *otask, const Char_t *filename)
     delete task;
     return;
   }
-  for(Int_t ipic=0; ipic<task->GetNRefFigures(); ipic++){
-    c->Clear();
-    if(!task->GetRefFigure(ipic)) continue;
-    c->SaveAs(Form("%s_Fig%02d.gif", task->GetName(), ipic), "gif");
+  if(summary) task->MakeSummary();
+  else{
+    for(Int_t ipic=0; ipic<task->GetNRefFigures(); ipic++){
+      c->Clear();
+      if(!task->GetRefFigure(ipic)) continue;
+      c->SaveAs(Form("%s_Fig%02d.gif", task->GetName(), ipic), "gif");
+    }
   }
   delete task;
 }
@@ -177,11 +184,14 @@ void processESD(TNamed *otask, const Char_t *filename)
     return;
   }
   esd->Terminate(NULL);
-
-  for(Int_t ipic(0); ipic<esd->GetNRefFigures(); ipic++){
-    c->Clear(); 
-    if(!esd->GetRefFigure(ipic)) continue;
-    c->SaveAs(Form("%s_Fig%02d.gif", esd->GetName(), ipic));
+  
+  if(summary) esd->MakeSummary();
+  else{
+    for(Int_t ipic(0); ipic<esd->GetNRefFigures(); ipic++){
+      c->Clear(); 
+      if(!esd->GetRefFigure(ipic)) continue;
+      c->SaveAs(Form("%s_Fig%02d.gif", esd->GetName(), ipic));
+    }
   }
   delete esd;
 }