FinishTaskOuptut and trending information implemented (M. Knichel)
authorjotwinow <jotwinow@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 15 Oct 2010 14:24:09 +0000 (14:24 +0000)
committerjotwinow <jotwinow@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 15 Oct 2010 14:24:09 +0000 (14:24 +0000)
PWG1/TPC/AliPerformanceDEdx.cxx
PWG1/TPC/AliPerformanceDEdx.h
PWG1/TPC/AliPerformanceObject.cxx
PWG1/TPC/AliPerformanceObject.h
PWG1/TPC/AliPerformanceTPC.cxx
PWG1/TPC/AliPerformanceTPC.h
PWG1/TPC/AliPerformanceTask.cxx
PWG1/TPC/AliPerformanceTask.h
PWG1/TPC/AliTPCPerformanceSummary.cxx
PWG1/TPC/AliTPCPerformanceSummary.h
PWG1/TPC/macros/AddTaskPerformanceTPCdEdxQA.C

index 935396e..2a79e91 100644 (file)
@@ -8,7 +8,7 @@
 // a data of AliPerformanceDEdx.
 //  
 // Author: J.Otwinowski 04/02/2008 
-// Changes by M.Knichel 24/09/2010
+// Changes by M.Knichel 15/10/2010
 //------------------------------------------------------------------------------
 
 /*
 
 */
 
-#include <TDirectory.h>
-#include <TAxis.h>
-#include <TCanvas.h>
-#include <TH1.h>
-#include <TH2.h>
-#include <TF1.h>
-
-#include "AliPerformanceDEdx.h" 
+#include "TDirectory.h"
+#include "TAxis.h"
+#include "TCanvas.h"
+#include "TH1.h"
+#include "TH2.h"
+#include "TF1.h"
+#include "TSystem.h"
+#include "TChain.h"
+
+#include "AliPerformanceDEdx.h"
+#include "AliPerformanceTPC.h"
+#include "AliTPCPerformanceSummary.h"
 #include "AliESDEvent.h"
 #include "AliTracker.h"
 #include "AliMCEvent.h"
@@ -166,10 +170,12 @@ void AliPerformanceDEdx::Init()
    //fDeDxHisto->Sumw2();
 
    // Init cuts
-   if(!fCutsMC) 
+   if(!fCutsMC) {
      AliDebug(AliLog::kError, "ERROR: Cannot find AliMCInfoCuts object");
-   if(!fCutsRC) 
+   }
+   if(!fCutsRC) {
      AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object");
+   }
 
    // init folder
    fAnalysisFolder = CreateFolder("folderDEdx","Analysis de/dx Folder");
@@ -550,3 +556,10 @@ TFolder *folder = 0;
   return folder;
 }
 
+//_____________________________________________________________________________
+TTree* AliPerformanceDEdx::CreateSummary()
+{
+    // implementaion removed, switched back to use AliPerformanceSummary (now called in AliPerformanceTask)
+    return 0;
+}
+
index 40a91d1..0fdc086 100644 (file)
@@ -6,7 +6,7 @@
 // reconstructed and MC particle tracks (TPC dE/dx).   
 // 
 // Author: J.Otwinowski 04/02/2008 
-// Changes by M.Knichel 24/09/2010
+// Changes by M.Knichel 15/10/2010
 //------------------------------------------------------------------------------
 
 class TCanvas;
@@ -62,6 +62,10 @@ public :
   void  ProcessTPCITS(AliStack* const stack, AliESDtrack *const esdTrack);      // not implemented
   void  ProcessConstrained(AliStack* const stack, AliESDtrack *const esdTrack); // not implemented
 
+  
+  // produce summary (currently not used)
+  virtual TTree* CreateSummary();
+
   // Selection cuts
   void SetAliRecInfoCuts(AliRecInfoCuts* const cuts=0) {fCutsRC = cuts;}
   void SetAliMCInfoCuts(AliMCInfoCuts* const cuts=0)   {fCutsMC = cuts;} 
@@ -94,7 +98,7 @@ private:
   AliPerformanceDEdx(const AliPerformanceDEdx&); // not implemented
   AliPerformanceDEdx& operator=(const AliPerformanceDEdx&); // not implemented
 
-  ClassDef(AliPerformanceDEdx,2);
+  ClassDef(AliPerformanceDEdx,3);
 };
 
 #endif
index 02759a5..dc24d77 100644 (file)
@@ -18,7 +18,7 @@
 // comparison of reconstructed and MC particle tracks. 
 //
 // Author: J.Otwinowski 14/04/2008 
-// Changes by M.Knichel 24/09/2010
+// Changes by M.Knichel 15/10/2010
 //------------------------------------------------------------------------------
 
 #include <iostream>
@@ -44,6 +44,7 @@ ClassImp(AliPerformanceObject)
 AliPerformanceObject::AliPerformanceObject():
   TNamed("AliPerformanceObject","AliPerformanceObject"),
   fAnalysisMode(-1),
+  fRunNumber(-1),
   fHptGenerator(kFALSE),
   fTriggerClass(0),
   fUseTrackVertex(kFALSE),
@@ -53,9 +54,10 @@ AliPerformanceObject::AliPerformanceObject():
 }
 
 //_____________________________________________________________________________
-AliPerformanceObject::AliPerformanceObject(const char* name, const char* title):
+AliPerformanceObject::AliPerformanceObject(const char* name, const char* title, Int_t run):
   TNamed(name,title),
   fAnalysisMode(-1),
+  fRunNumber(run),
   fHptGenerator(kFALSE),
   fTriggerClass(0),
   fUseTrackVertex(kFALSE),
index 52f6397..ba22a72 100644 (file)
@@ -6,13 +6,14 @@
 // reconstructed and MC particle tracks.   \r
 // \r
 // Author: J.Otwinowski 04/14/2008 \r
-// Changes by M.Knichel 24/09/2010\r
+// Changes by M.Knichel 15/10/2010\r
 //------------------------------------------------------------------------------\r
 \r
 #include "TNamed.h"\r
 #include "TFolder.h"\r
 #include "THnSparse.h"\r
 \r
+class TTree;\r
 class AliMCEvent;\r
 class AliESDEvent;\r
 class AliRecInfoCuts;\r
@@ -23,7 +24,7 @@ class AliESDVertex;
 class AliPerformanceObject : public TNamed {\r
 public :\r
   AliPerformanceObject(); \r
-  AliPerformanceObject(const char* name="AliPerformanceObject", const char* title="AliPerformanceObject"); \r
+  AliPerformanceObject(const char* name="AliPerformanceObject", const char* title="AliPerformanceObject", Int_t run=-1); \r
   virtual ~AliPerformanceObject();\r
 \r
   // Init data members\r
@@ -46,6 +47,11 @@ public :
 \r
   // Get output folder for analysed histograms\r
   virtual TFolder* GetAnalysisFolder() const = 0;\r
+  \r
+  // create a summary stored in a ttree \r
+  // has to be implented\r
+  // virtual TTree* CreateSummary() = 0;\r
+  virtual TTree* CreateSummary() { return 0; }\r
 \r
   // \r
   virtual void SetAliRecInfoCuts(AliRecInfoCuts* const cuts=0) = 0;\r
@@ -74,6 +80,9 @@ public :
   Bool_t IsUseTrackVertex() { return fUseTrackVertex; }\r
   \r
   Bool_t IsHighMultiplicity() { return fHighMultiplicity; }  \r
+  \r
+  void SetRunNumber(Int_t run) { fRunNumber = run; }\r
+  Int_t GetRunNumber() const { return fRunNumber; }\r
 \r
 protected: \r
 \r
@@ -84,6 +93,8 @@ protected:
   // analysis mode\r
   Int_t fAnalysisMode;  // 0-TPC, 1-TPCITS, 2-Constrained, 3-TPC inner wall, 4-TPC outer wall\r
 \r
+  Int_t fRunNumber;\r
+\r
   // hpt generator\r
   Bool_t fHptGenerator; // hpt event generator\r
 \r
@@ -99,7 +110,7 @@ protected:
   AliPerformanceObject(const AliPerformanceObject&); // not implemented\r
   AliPerformanceObject& operator=(const AliPerformanceObject&); // not implemented\r
 \r
-  ClassDef(AliPerformanceObject,2);\r
+  ClassDef(AliPerformanceObject,3);\r
 };\r
 \r
 #endif\r
index ceedc30..1ffb4b0 100644 (file)
@@ -8,7 +8,7 @@
 // a data member of AliPerformanceTPC.
 //
 // Author: J.Otwinowski 04/02/2008 
-// Changes by M.Knichel 24/09/2010
+// Changes by M.Knichel 15/10/2010
 //------------------------------------------------------------------------------
 
 /*
 #include "TAxis.h"
 #include "TPostScript.h"
 #include "TString.h"
+#include "TUUID.h"
+#include "TTree.h"
+#include "TChain.h"
+#include "AliTPCPerformanceSummary.h"
+#include "TSystem.h"
 
 #include "AliPerformanceTPC.h" 
 #include "AliESDEvent.h" 
@@ -70,6 +75,7 @@ Bool_t AliPerformanceTPC::fgMergeTHnSparse = kFALSE;
 
 
 //_____________________________________________________________________________
+/*
 AliPerformanceTPC::AliPerformanceTPC():
   AliPerformanceObject("AliPerformanceTPC"),
   fTPCClustHisto(0),
@@ -89,11 +95,11 @@ AliPerformanceTPC::AliPerformanceTPC():
 {
   Init();
 }
-
+*/
 
 //_____________________________________________________________________________
-AliPerformanceTPC::AliPerformanceTPC(Char_t* name="AliPerformanceTPC", Char_t* title="AliPerformanceTPC",Int_t analysisMode=0,Bool_t hptGenerator=kFALSE):
-  AliPerformanceObject(name,title),
+AliPerformanceTPC::AliPerformanceTPC(Char_t* name, Char_t* title,Int_t analysisMode,Bool_t hptGenerator, Int_t run):
+  AliPerformanceObject(name,title,run),
   fTPCClustHisto(0),
   fTPCEventHisto(0),
   fTPCTrackHisto(0),
@@ -160,19 +166,22 @@ void AliPerformanceTPC::Init()
     ptMin = 0.; ptMax = 100.; 
   }
   */
-  // 
-  // 
-  //padRow:phi:TPCSide
-  Int_t binsTPCClustHisto[3] =   {160,  180,  2 };
-  Double_t minTPCClustHisto[3] = {0.,   0.,   0.};
-  Double_t maxTPCClustHisto[3] = {160., 2.*TMath::Pi(), 2.};
+  //
+
+  //
+  //padRow:phi:TPCSide:pad:detector
+  Int_t binsTPCClustHisto[5] =   {160,  180,  2, 256, 512};
+  Double_t minTPCClustHisto[5] = {0.,   0.,   0., -128, 0};
+  Double_t maxTPCClustHisto[5] = {160., 2.*TMath::Pi(), 2., 128, 512};
 
-  fTPCClustHisto = new THnSparseF("fTPCClustHisto","padRow:phi:TPCSide",3,binsTPCClustHisto,minTPCClustHisto,maxTPCClustHisto);
+  fTPCClustHisto = new THnSparseF("fTPCClustHisto","padRow:phi:TPCSide:pad:detector",5,binsTPCClustHisto,minTPCClustHisto,maxTPCClustHisto);
   fTPCClustHisto->GetAxis(0)->SetTitle("padRow");
   fTPCClustHisto->GetAxis(1)->SetTitle("phi (rad)");
   fTPCClustHisto->GetAxis(2)->SetTitle("TPCSide");
+  fTPCClustHisto->GetAxis(3)->SetTitle("pad");
+  fTPCClustHisto->GetAxis(4)->SetTitle("detector");
   //fTPCClustHisto->Sumw2();
+  
   Int_t maxMult;
   if (fHighMultiplicity) { maxMult = 4001; } else { maxMult = 151; }
   // Xv:Yv:Zv:mult:multP:multN:vertStatus
@@ -219,10 +228,12 @@ void AliPerformanceTPC::Init()
   //fTPCTrackHisto->Sumw2();
 
   // Init cuts 
-  if(!fCutsMC) 
+  if(!fCutsMC) {
     AliDebug(AliLog::kError, "ERROR: Cannot find AliMCInfoCuts object");
-  if(!fCutsRC) 
-    AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object");
+  }
+  if(!fCutsRC) {
+    AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object"); 
+  }
 
   // init folder
   fAnalysisFolder = CreateFolder("folderTPC","Analysis Resolution Folder");
@@ -483,10 +494,12 @@ void AliPerformanceTPC::Exec(AliMCEvent* const mcEvent, AliESDEvent *const esdEv
              //fTPCClustHisto1->Fill(vTPCClust1);
 
              //  
+             Float_t pad = cluster->GetPad();
+             Int_t detector = cluster->GetDetector();
             Double_t phi = TMath::ATan2(gclf[1],gclf[0]);
             if(phi < 0) phi += 2.*TMath::Pi();
            
-             Double_t vTPCClust[3] = { irow, phi, TPCside };
+             Double_t vTPCClust[5] = { irow, phi, TPCside, pad, detector };
              fTPCClustHisto->Fill(vTPCClust);
         }
       }
@@ -730,7 +743,8 @@ return count;
 
 
 //_____________________________________________________________________________
-TFolder* AliPerformanceTPC::CreateFolder(TString name, TString title) { 
+TFolder* AliPerformanceTPC::CreateFolder(TString name, TString title) 
+{ 
 // create folder for analysed histograms
 //
 TFolder *folder = 0;
@@ -739,3 +753,10 @@ TFolder *folder = 0;
   return folder;
 }
 
+//_____________________________________________________________________________
+TTree* AliPerformanceTPC::CreateSummary()
+{
+    // implementaion removed, switched back to use AliPerformanceSummary (now called in AliPerformanceTask)
+    return 0;
+}
+
index 73a1882..81cea9a 100644 (file)
@@ -6,7 +6,7 @@
 // reconstructed and MC particle tracks (TPC resolution).   
 // 
 // Author: J.Otwinowski 04/02/2008 
-// Changes by M.Knichel 24/09/2010
+// Changes by M.Knichel 15/10/2010
 //------------------------------------------------------------------------------
 
 class TString;
@@ -30,8 +30,9 @@ class AliRecInfoCuts;
 
 class AliPerformanceTPC : public AliPerformanceObject {
 public :
-  AliPerformanceTPC(); 
-  AliPerformanceTPC(Char_t* name, Char_t* title, Int_t analysisMode, Bool_t hptGenerator);
+  //AliPerformanceTPC(); 
+  AliPerformanceTPC(Char_t* name="AliPerformanceTPC", Char_t* title="AliPerformanceTPC",Int_t analysisMode=0,Bool_t hptGenerator=kFALSE, Int_t run=-1);
+
   virtual ~AliPerformanceTPC();
 
   // Init data members
@@ -47,6 +48,9 @@ public :
 
   // Get analysis folder
   virtual TFolder* GetAnalysisFolder() const {return fAnalysisFolder;}
+  
+  // produce summary
+  virtual TTree* CreateSummary();
 
   // Process events
   void ProcessConstrained(AliStack* const stack, AliESDtrack *const esdTrack, AliESDEvent *const esdEvent);
@@ -63,8 +67,8 @@ public :
   void SetAliRecInfoCuts(AliRecInfoCuts* const cuts=0) {fCutsRC = cuts;}   
   void SetAliMCInfoCuts(AliMCInfoCuts* const cuts=0) {fCutsMC = cuts;}  
    
-  AliRecInfoCuts*  GetAliRecInfoCuts() const {return fCutsRC;}  
-  AliMCInfoCuts*   GetAliMCInfoCuts()  const {return fCutsMC;}  
+  AliRecInfoCuts*  GetAliRecInfoCuts() const {return fCutsRC;}
+  AliMCInfoCuts*   GetAliMCInfoCuts()  const {return fCutsMC;}
 
   // getters
   //
@@ -85,7 +89,7 @@ private:
   static Bool_t fgMergeTHnSparse;
 
   // TPC histogram
-  THnSparseF *fTPCClustHisto; //-> padRow:phi:TPCSide
+  THnSparseF *fTPCClustHisto; //-> padRow:phi:TPCside:pad:detector
   THnSparseF *fTPCEventHisto;  //-> Xv:Yv:Zv:mult:multP:multN:vertStatus
   THnSparseF *fTPCTrackHisto;  //-> nClust:chi2PerClust:nClust/nFindableClust:DCAr:DCAz:eta:phi:pt:charge:vertStatus
   TObjArray* fFolderObj; // array of analysed histograms
@@ -102,7 +106,7 @@ private:
   AliPerformanceTPC(const AliPerformanceTPC&); // not implemented
   AliPerformanceTPC& operator=(const AliPerformanceTPC&); // not implemented
 
-  ClassDef(AliPerformanceTPC,7);
+  ClassDef(AliPerformanceTPC,8);
 };
 
 #endif
index 779a32a..bac3109 100644 (file)
@@ -23,7 +23,7 @@
 // are stored in the output file (details in description of these classes).\r
 // \r
 // Author: J.Otwinowski 01/04/2009 \r
-// Changes by M.Knichel and H.Erdal 27/07/2010\r
+// Changes by M.Knichel 15/10/2010\r
 //------------------------------------------------------------------------------\r
 \r
 #include "iostream"\r
@@ -34,6 +34,7 @@
 #include "TCanvas.h"\r
 #include "TList.h"\r
 #include "TFile.h"\r
+#include "TSystem.h"\r
 \r
 #include "AliAnalysisTask.h"\r
 #include "AliAnalysisManager.h"\r
 #include "AliRecInfoCuts.h"\r
 #include "AliComparisonObject.h"\r
 #include "AliPerformanceObject.h"\r
+#include "AliTPCPerformanceSummary.h"\r
+#include "AliPerformanceTPC.h"\r
+#include "AliPerformanceDEdx.h"\r
 #include "AliPerformanceTask.h"\r
 \r
+\r
 using namespace std;\r
 \r
 ClassImp(AliPerformanceTask)\r
@@ -66,6 +71,7 @@ AliPerformanceTask::AliPerformanceTask()
   , fESDfriend(0)\r
   , fMC(0)\r
   , fOutput(0)\r
+  , fOutputSummary(0)\r
   , fPitList(0)\r
   , fCompList(0)\r
   , fUseMCInfo(kFALSE)\r
@@ -83,6 +89,7 @@ AliPerformanceTask::AliPerformanceTask(const char *name, const char */*title*/)
   , fESDfriend(0)\r
   , fMC(0)\r
   , fOutput(0)\r
+  , fOutputSummary(0)\r
   , fPitList(0)\r
   , fCompList(0)\r
   , fUseMCInfo(kFALSE)\r
@@ -93,6 +100,7 @@ AliPerformanceTask::AliPerformanceTask(const char *name, const char */*title*/)
 \r
   // Define input and output slots here\r
   DefineOutput(1, TList::Class());\r
+  DefineOutput(2, TTree::Class());\r
 \r
   // create the list for comparison objects\r
   fCompList = new TList;\r
@@ -101,8 +109,9 @@ AliPerformanceTask::AliPerformanceTask(const char *name, const char */*title*/)
 //_____________________________________________________________________________\r
 AliPerformanceTask::~AliPerformanceTask()\r
 {\r
-  if(fOutput)     delete fOutput;    fOutput   = 0; \r
-  if(fCompList)   delete fCompList;  fCompList = 0; \r
+  if (fOutput)     delete fOutput;    fOutput   = 0; \r
+  if (fOutputSummary) delete fOutputSummary; fOutputSummary = 0;\r
+  if (fCompList)   delete fCompList;  fCompList = 0; \r
 }\r
 \r
 //_____________________________________________________________________________\r
@@ -130,7 +139,10 @@ void AliPerformanceTask::UserCreateOutputObjects()
   fOutput = new TList;\r
   fOutput->SetOwner();\r
   fPitList = fOutput->MakeIterator();\r
-\r
+  \r
+  // create output list\r
+  //fOutputSummary = new TTree;\r
+  \r
   // add comparison objects to the output\r
   AliPerformanceObject *pObj=0;\r
   Int_t count=0;\r
@@ -141,6 +153,9 @@ void AliPerformanceTask::UserCreateOutputObjects()
     count++;\r
   }\r
   Printf("UserCreateOutputObjects(): Number of output comparison objects: %d \n", count);\r
+  \r
+  PostData(1, fOutput);  \r
+  //PostData(2, fOutputSummary);  \r
 }\r
 \r
 //_____________________________________________________________________________\r
@@ -212,19 +227,59 @@ void AliPerformanceTask::Terminate(Option_t *)
   // Called once at the end \r
   \r
   // check output data\r
-  fOutput = dynamic_cast<TList*> (GetOutputData(1));\r
-  if (!fOutput) {\r
-    Printf("ERROR: AliPerformanceTask::Terminate(): fOutput data not avaiable  ..." );\r
-    return;\r
-  }\r
+    fOutputSummary = dynamic_cast<TTree*> (GetOutputData(2));\r
+    fOutput = dynamic_cast<TList*> (GetOutputData(1));\r
+    if (!fOutput) {\r
+        Printf("ERROR: AliPerformanceTask::FinishTaskOutput(): fOutput data not available  ..." );\r
+        return;\r
+   }\r
+    if (fOutputSummary) { delete fOutputSummary; fOutputSummary=0; }      \r
+    AliPerformanceObject* pObj=0;\r
+    AliPerformanceTPC*  pTPC = 0;\r
+    AliPerformanceDEdx* pDEdx = 0;\r
+    TIterator* itOut = fOutput->MakeIterator();\r
+    itOut->Reset();\r
+    while(( pObj = dynamic_cast<AliPerformanceObject*>(itOut->Next())) != NULL) { \r
+        if (!  pTPC) {  pTPC = dynamic_cast<AliPerformanceTPC*>(pObj); }\r
+        if (! pDEdx) { pDEdx = dynamic_cast<AliPerformanceDEdx*>(pObj); }\r
+    }\r
+    TUUID uuid;\r
+    TString tmpFile = gSystem->TempDirectory() + TString("/TPCQASummary.") + uuid.AsString() + TString(".root");\r
+    AliTPCPerformanceSummary::WriteToFile(pTPC, pDEdx, tmpFile.Data());\r
+    TChain* chain = new TChain("tpcQA");\r
+    chain->Add(tmpFile.Data());\r
+    TTree *tree = chain->CopyTree("1");\r
+    if (chain) { delete chain; chain=0; }\r
+    fOutputSummary = tree;\r
+      \r
+     // Post output data.\r
+     PostData(2, fOutputSummary);\r
 \r
-  AliPerformanceObject* pObj=0;\r
-  TIterator* itOut = fOutput->MakeIterator();  \r
-  itOut->Reset();\r
-  while(( pObj = dynamic_cast<AliPerformanceObject*>(itOut->Next())) != NULL) {\r
-    pObj->Analyse();\r
-  }\r
+}\r
+\r
+//_____________________________________________________________________________\r
+void AliPerformanceTask::FinishTaskOutput()\r
+{\r
+    // called once at the end of each job (on the workernode)\r
+    //\r
+    // projects THnSparse to TH1,2,3\r
+    \r
+    fOutput = dynamic_cast<TList*> (GetOutputData(1));\r
+    if (!fOutput) {\r
+        Printf("ERROR: AliPerformanceTask::FinishTaskOutput(): fOutput data not available  ..." );\r
+        return;\r
+   }\r
 \r
+      AliPerformanceObject* pObj=0;\r
+      TIterator* itOut = fOutput->MakeIterator();  \r
+      itOut->Reset();\r
+      while(( pObj = dynamic_cast<AliPerformanceObject*>(itOut->Next())) != NULL) {\r
+          pObj->SetRunNumber(fCurrentRunNumber);\r
+          pObj->Analyse();\r
+      }\r
+      \r
+     // Post output data.\r
+     PostData(1, fOutput);\r
 }\r
 \r
 //_____________________________________________________________________________\r
index 6060bf9..0f63e1a 100644 (file)
@@ -5,7 +5,7 @@
 // Task to run reconstruction performance. 
 // 
 // Author: J.Otwinowski 01/04/2009 
-// Changes by M.Knichel and H.Erdal 27/07/2010
+// Changes by M.Knichel 15/10/2010
 //------------------------------------------------------------------------------
 
 class AliESDEvent;
@@ -14,6 +14,7 @@ class AliMCEvent;
 class AliPerformanceObject;
 class AliMagF;
 class TList;
+class TTree;
 
 #include "AliAnalysisTaskSE.h"
 
@@ -26,6 +27,7 @@ class AliPerformanceTask : public AliAnalysisTaskSE {
   virtual void   UserCreateOutputObjects();
   virtual void   UserExec(Option_t *option);
   virtual void   Terminate(Option_t *);
+  virtual void   FinishTaskOutput();
   virtual Bool_t Notify();
 
   // Add comparison objects
@@ -41,11 +43,12 @@ class AliPerformanceTask : public AliAnalysisTaskSE {
   void SetUseHLT(Bool_t useHLT = kFALSE) {fUseHLT = useHLT;}
 
  private:
-  AliESDEvent *fESD;   //! ESD event
-  AliESDfriend *fESDfriend; //! ESD friend event
-  AliMCEvent *fMC;    //! MC event
+  AliESDEvent *fESD;          //! ESD event
+  AliESDfriend *fESDfriend;   //! ESD friend event
+  AliMCEvent *fMC;            //! MC event
 
-  TList *fOutput;             //! list send on output slot 0
+  TList *fOutput;             //! list send on output container 1
+  TTree* fOutputSummary;       //! tree to dump summary values (output container 2)
   TIterator *fPitList;        //! iterator over the output objetcs  
   TList *fCompList;           // list of comparison objects
 
@@ -56,7 +59,7 @@ class AliPerformanceTask : public AliAnalysisTaskSE {
   AliPerformanceTask(const AliPerformanceTask&); // not implemented
   AliPerformanceTask& operator=(const AliPerformanceTask&); // not implemented
   
-  ClassDef(AliPerformanceTask, 2); // example of analysis
+  ClassDef(AliPerformanceTask, 3); // example of analysis
 };
 
 #endif
index a416333..833e284 100644 (file)
@@ -8,7 +8,7 @@
 // The function MakeReport needs a list of these rootfiles as input
 // and writes the output (tree and histograms) to another rootfile.
 //
-// Author: M.Knichel 2010-09-24
+// by M.Knichel 15/10/2010
 //------------------------------------------------------------------------------
 
 #include <fstream>
@@ -55,11 +55,20 @@ Int_t AliTPCPerformanceSummary::WriteToTTreeSRedirector(const AliPerformanceTPC*
     // The run number must be provided since it is not stored in 
     // AliPerformanceTPC or AliPerformanceDEdx.
     //
+    if (run <= 0 ) {
+        if (pTPCgain) {run = pTPCgain->GetRunNumber(); }
+        if (pTPC) { run = pTPC->GetRunNumber(); }
+    }
+    
     AliTPCcalibDB     *calibDB=0;
 //     AliTPCcalibDButil *dbutil =0;
     Int_t startTimeGRP=0;
     Int_t stopTimeGRP=0;   
     Int_t time=0;
+    Int_t duration=0;
+    Float_t currentL3 =0;
+    Int_t polarityL3 = 0;
+    Float_t bz = 0;
     calibDB = AliTPCcalibDB::Instance();
 //     dbutil= new AliTPCcalibDButil;   
            
@@ -72,10 +81,15 @@ Int_t AliTPCPerformanceSummary::WriteToTTreeSRedirector(const AliPerformanceTPC*
   if (calibDB->GetGRP(run)){
     startTimeGRP = AliTPCcalibDB::GetGRP(run)->GetTimeStart();
     stopTimeGRP  = AliTPCcalibDB::GetGRP(run)->GetTimeEnd();
+    currentL3 = AliTPCcalibDB::GetL3Current(run);
+    polarityL3 = AliTPCcalibDB::GetL3Polarity(run);
+    bz = AliTPCcalibDB::GetBz(run);
+    
   }    
   TObjString runType(AliTPCcalibDB::GetRunType(run).Data());  
   
   time = (startTimeGRP+stopTimeGRP)/2;
+  duration = (stopTimeGRP-startTimeGRP);
     
     if (!pcstream) return -1;
     (*pcstream)<<"tpcQA"<<      
@@ -83,25 +97,26 @@ Int_t AliTPCPerformanceSummary::WriteToTTreeSRedirector(const AliPerformanceTPC*
       "time="<<time<<
       "startTimeGRP="<<startTimeGRP<<
       "stopTimeGRP="<<stopTimeGRP<<
-      //run type      
+      "duration="<<
       "runType.="<<&runType;
     Int_t returncode = 0;
-
-    pTPC->GetTPCTrackHisto()->GetAxis(9)->SetRangeUser(0.5,1.5);
-    pTPC->GetTPCTrackHisto()->GetAxis(7)->SetRangeUser(0.25,10);
-    pTPC->GetTPCTrackHisto()->GetAxis(5)->SetRangeUser(-1,1);    
-    returncode += AnalyzeNCL(pTPC, pcstream);    
-    returncode += AnalyzeDrift(pTPC, pcstream);
-    returncode += AnalyzeDriftPos(pTPC, pcstream);
-    returncode += AnalyzeDriftNeg(pTPC, pcstream);
+    if (pTPC) {
+        pTPC->GetTPCTrackHisto()->GetAxis(9)->SetRangeUser(0.5,1.5);
+        pTPC->GetTPCTrackHisto()->GetAxis(7)->SetRangeUser(0.25,10);
+        pTPC->GetTPCTrackHisto()->GetAxis(5)->SetRangeUser(-1,1);    
+        returncode += AnalyzeNCL(pTPC, pcstream);    
+        returncode += AnalyzeDrift(pTPC, pcstream);
+        returncode += AnalyzeDriftPos(pTPC, pcstream);
+        returncode += AnalyzeDriftNeg(pTPC, pcstream);    
+        returncode += AnalyzeDCARPhi(pTPC, pcstream);
+        returncode += AnalyzeDCARPhiPos(pTPC, pcstream);
+        returncode += AnalyzeDCARPhiNeg(pTPC, pcstream);
+        returncode += AnalyzeEvent(pTPC, pcstream);         
+        pTPC->GetTPCTrackHisto()->GetAxis(9)->SetRangeUser(-10,10);
+        pTPC->GetTPCTrackHisto()->GetAxis(7)->SetRangeUser(0,100);
+        pTPC->GetTPCTrackHisto()->GetAxis(5)->SetRangeUser(-10,10);    
+    }
     returncode += AnalyzeGain(pTPCgain, pcstream);
-    returncode += AnalyzeDCARPhi(pTPC, pcstream);
-    returncode += AnalyzeDCARPhiPos(pTPC, pcstream);
-    returncode += AnalyzeDCARPhiNeg(pTPC, pcstream);
-    returncode += AnalyzeEvent(pTPC, pcstream);
-    pTPC->GetTPCTrackHisto()->GetAxis(9)->SetRangeUser(-10,10);
-    pTPC->GetTPCTrackHisto()->GetAxis(7)->SetRangeUser(0,100);
-    pTPC->GetTPCTrackHisto()->GetAxis(5)->SetRangeUser(-10,10);    
     (*pcstream)<<"tpcQA"<<"\n";
     return returncode;
 
@@ -729,9 +744,7 @@ Int_t AliTPCPerformanceSummary::AnalyzeNCL(const AliPerformanceTPC* pTPC, TTreeS
         pTPC->GetTPCTrackHisto()->GetAxis(2)->SetRangeUser(0.4,1.1);
         his1D = pTPC->GetTPCTrackHisto()->Projection(2);
     }    
-    
-    pTPC->GetTPCTrackHisto()->GetAxis(2)->SetRangeUser(0.4,1.1);
-    his1D = pTPC->GetTPCTrackHisto()->Projection(2);
+        
     meanTPCnclF= his1D->GetMean();
     rmsTPCnclF= his1D->GetRMS();
     delete his1D;
@@ -1070,6 +1083,9 @@ Int_t AliTPCPerformanceSummary::AnalyzeGain(const AliPerformanceDEdx* pTPCgain,
     static Float_t attachSlopeA = 0;
 
     TH1 * his1D = 0;
+    //TH1 * hisProj1D=0;
+    TH2* his2D=0;
+     
 
     meanMIPvsSector.Zero();
     //
@@ -1081,73 +1097,106 @@ Int_t AliTPCPerformanceSummary::AnalyzeGain(const AliPerformanceDEdx* pTPCgain,
     pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(-1,1);
     //
     // MIP position and resolution
-    //
+    //    
     TF1 gausFit("gausFit","gaus");
-    TH1 * hisProj1D = pTPCgain->GetDeDxHisto()->Projection(0);
-    hisProj1D->Fit(&gausFit,"QN","QN");
-    delete hisProj1D;
+   
+    if (pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_0") && !fgForceTHnSparse) {    
+        his1D = dynamic_cast<TH1*>(pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_0")->Clone());
+    } else {
+       his1D =  pTPCgain->GetDeDxHisto()->Projection(0);
+    }
+    his1D->Fit(&gausFit,"QN","QN");
+
     meanMIP = gausFit.GetParameter(1);
     resolutionMIP = 0;
     if (meanMIP!=0) resolutionMIP = gausFit.GetParameter(2)/meanMIP;
+    //removedtotest// delete his1D;
     //
     // MIP position vs. dip angle (attachment)
-    //
-    pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(-3,0);
-    TH2* his2D = pTPCgain->GetDeDxHisto()->Projection(0,5);
+    //    
+    pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(-3,0); // C side
+    if (pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_c_0_5") && !fgForceTHnSparse) {    
+        his2D = dynamic_cast<TH2*>(pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_c_0_5")->Clone());
+    } else {
+        his2D =  pTPCgain->GetDeDxHisto()->Projection(0,5);
+    }        
     TF1 * fpol = new TF1("fpol","pol1");
     TObjArray arrayFit;
-    his2D->FitSlicesY(0,0,-1,10,"QN",&arrayFit);
-    delete his2D;
+    his2D->FitSlicesY(0,0,-1,10,"QN",&arrayFit);    
     his1D = (TH1*) arrayFit.At(1);
     his1D->Fit(fpol,"QNROB=0.8","QNR",-1,0);
     attachSlopeC = fpol->GetParameter(1);
+     //removedtotest// delete his2D;
+     //removedtotest// delete his1D;
     //
-    pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(0,3);
-    TH2* his2DA = pTPCgain->GetDeDxHisto()->Projection(0,5);
+    pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(0,3); // A side
+    if (pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_a_0_5") && !fgForceTHnSparse) {    
+        his2D = dynamic_cast<TH2*>(pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_a_0_5")->Clone());
+    } else {
+        his2D =  pTPCgain->GetDeDxHisto()->Projection(0,5);
+    }         
     TF1 * fpolA = new TF1("fpolA","pol1");
     TObjArray arrayFitA;
-    his2DA->FitSlicesY(0,0,-1,10,"QN",&arrayFit);
-    delete his2DA;
-    TH1 * his1DA = (TH1*) arrayFit.At(1);
-    his1DA->Fit(fpolA,"QNROB=0.8","QN",0,1);
+    his2D->FitSlicesY(0,0,-1,10,"QN",&arrayFit);    
+    his1D = (TH1*) arrayFit.At(1);
+    his1D->Fit(fpolA,"QNROB=0.8","QN",0,1);
     attachSlopeA = fpolA->GetParameter(1);
+     //removedtotest// delete his2D;
+     //removedtotest// delete his1D;
     //
     // MIP position vs. sector
     //
     pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(-3,0); // C side
+    if (pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_c_0_1") && !fgForceTHnSparse) {    
+        his2D = dynamic_cast<TH2*>(pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_c_0_1")->Clone());
+    } else {
+        his2D =  pTPCgain->GetDeDxHisto()->Projection(0,1);
+    }
     for(Int_t i = 0; i < 18; i++) { // loop over sectors; correct mapping to be checked!
         //TH1* his1D=0;
         Float_t phiLow = -TMath::Pi() + i*(20./360.)*(2*TMath::Pi());
         Float_t phiUp    = -TMath::Pi() + (i+1)*(20./360.)*(2*TMath::Pi());
-        pTPCgain->GetDeDxHisto()->GetAxis(1)->SetRangeUser(phiLow,phiUp);
-        his1D = pTPCgain->GetDeDxHisto()->Projection(0);
+        //pTPCgain->GetDeDxHisto()->GetAxis(1)->SetRangeUser(phiLow,phiUp);
+        his2D->GetXaxis()->SetRangeUser(phiLow,phiUp);
+        //his1D = pTPCgain->GetDeDxHisto()->Projection(0); 
+        his1D = his2D->ProjectionY(); 
         TF1 gausFunc("gausFunc","gaus");
         his1D->Fit(&gausFunc, "QN");
         meanMIPvsSector(i) = gausFunc.GetParameter(1);
         sector(i)=i;
-        delete his1D;
+        //removedtotest// delete his1D;
     }
+     //removedtotest// delete his2D;
     //
     pTPCgain->GetDeDxHisto()->GetAxis(5)->SetRangeUser(0,3); // A side
+    if (pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_a_0_1") && !fgForceTHnSparse) {    
+        his2D = dynamic_cast<TH2*>(pTPCgain->GetHistos()->FindObject("h_tpc_dedx_mips_a_0_1")->Clone());
+    } else {
+        his2D =  pTPCgain->GetDeDxHisto()->Projection(0,1);
+    }    
     for(Int_t i = 0; i < 18; i++) { // loop over sectors; correct mapping to be checked!
         //TH1* his1D=0;
         Float_t phiLow = -TMath::Pi() + i*(20./360.)*(2*TMath::Pi());
         Float_t phiUp    = -TMath::Pi() + (i+1)*(20./360.)*(2*TMath::Pi());
-        pTPCgain->GetDeDxHisto()->GetAxis(1)->SetRangeUser(phiLow,phiUp);
-        his1D = pTPCgain->GetDeDxHisto()->Projection(0);
+        //pTPCgain->GetDeDxHisto()->GetAxis(1)->SetRangeUser(phiLow,phiUp);
+        his2D->GetXaxis()->SetRangeUser(phiLow,phiUp);
+        //his1D = pTPCgain->GetDeDxHisto()->Projection(0);
+        his1D = his2D->ProjectionY();
         TF1 gausFunc("gausFunc","gaus");
         his1D->Fit(&gausFunc, "QN");
         meanMIPvsSector(i+18) = gausFunc.GetParameter(1);
         sector(i+18)=i+18;
-        delete his1D;
+        //removedtotest// delete his1D;
     }
+     //removedtotest// delete his2D;
     //
     printf("Gain QA report\n");
     printf("MIP mean\t%f\n",meanMIP);
     printf("MIP resolution\t%f\n",resolutionMIP);
     printf("MIPslopeA\t%f\n",attachSlopeA);
     printf("MIPslopeC\t%f\n",attachSlopeC);
-    //
+    // 
+    
     (*pcstream)<<"tpcQA"<<
         "MIPattachSlopeC="<<attachSlopeC<<
         "MIPattachSlopeA="<<attachSlopeA<<
index cf431d9..8c24345 100644 (file)
@@ -5,7 +5,7 @@
 // Class to extract some TPC Performance parameters from AliPerformanceTPC and
 // AliPerformanceDEdx objects and produce trend graphs.  
 // 
-// Author: M.Knichel 2010-09-24
+// by M.Knichel 15/10/2010
 //------------------------------------------------------------------------------
 
 class TTree;
@@ -21,9 +21,9 @@ class AliTPCPerformanceSummary
     AliTPCPerformanceSummary() {} // default contructor 
     virtual ~AliTPCPerformanceSummary() {} // destructor
     
-    static Int_t WriteToTTreeSRedirector(const AliPerformanceTPC* pTPC, const AliPerformanceDEdx* pTPCgain, TTreeSRedirector* pcstream, Int_t run); // called by WriteToFile
+    static Int_t WriteToTTreeSRedirector(const AliPerformanceTPC* pTPC, const AliPerformanceDEdx* pTPCgain, TTreeSRedirector* pcstream, Int_t run = -1); // called by WriteToFile
     
-    static Int_t WriteToFile(const AliPerformanceTPC* pTPC, const AliPerformanceDEdx* pTPCgain, const Char_t* outfile, Int_t run); // calles by MakeReport
+    static Int_t WriteToFile(const AliPerformanceTPC* pTPC, const AliPerformanceDEdx* pTPCgain, const Char_t* outfile, Int_t run = -1); // calles by MakeReport
     
     // the two key functions
     static Int_t MakeReport(const Char_t* infile, const Char_t* outfile, Int_t run);
@@ -54,7 +54,7 @@ class AliTPCPerformanceSummary
     AliTPCPerformanceSummary(const AliTPCPerformanceSummary&); // copy contructor (not implemented)
     AliTPCPerformanceSummary& operator=(const AliTPCPerformanceSummary&); // assignment operator (not implemented)
       
-    ClassDef(AliTPCPerformanceSummary, 2);
+    ClassDef(AliTPCPerformanceSummary, 3);
 };
 
 #endif
index ee5803a..d758242 100644 (file)
@@ -120,7 +120,7 @@ AliPerformanceTask* AddTaskPerformanceTPCdEdxQA(Bool_t bUseMCInfo=kFALSE, Bool_t
   pCompTPC0->SetAliRecInfoCuts(pRecInfoCutsTPC);
   pCompTPC0->SetAliMCInfoCuts(pMCInfoCuts);
   pCompTPC0->SetUseTrackVertex(kFALSE);
-
+  pCompTPC0->SetUseHLT(kFALSE);
   //
   // dEdx
   //
@@ -152,7 +152,11 @@ AliPerformanceTask* AddTaskPerformanceTPCdEdxQA(Bool_t bUseMCInfo=kFALSE, Bool_t
   // Create containers for output
   //
   AliAnalysisDataContainer *coutput_tpc = mgr->CreateContainer("TPCQA", TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:TPC_%s", mgr->GetCommonFileName(), task->GetName()));
+
+  AliAnalysisDataContainer *coutput2_tpc = mgr->CreateContainer("TPCQASummary", TTree::Class(), AliAnalysisManager::kOutputContainer, "SummaryTPCQA.root"); 
+
   mgr->ConnectOutput(task, 1, coutput_tpc);
+  mgr->ConnectOutput(task, 2, coutput2_tpc);
 
 return task;  
 }