added AliTPCClusterHistograms
authorekman <ekman@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Nov 2006 14:49:37 +0000 (14:49 +0000)
committerekman <ekman@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Nov 2006 14:49:37 +0000 (14:49 +0000)
PWG0/PWG0baseLinkDef.h
PWG0/TPC/AliROCESDAnalysisSelector.cxx
PWG0/TPC/AliROCESDAnalysisSelector.h
PWG0/TPC/AliTPCClusterHistograms.cxx [new file with mode: 0644]
PWG0/TPC/AliTPCClusterHistograms.h [new file with mode: 0644]
PWG0/TPC/runROCESDAnalysis.C
PWG0/libPWG0base.pkg

index e557f7d..c11be2d 100644 (file)
@@ -11,6 +11,8 @@
 #pragma link C++ class dNdEtaAnalysis+;
 #pragma link C++ class AlidNdEtaCorrection+;
 
+#pragma link C++ class AliTPCClusterHistograms+;
+
 #pragma link C++ class AliESDtrackCuts+;
 
 #pragma link C++ class AliCorrectionMatrix+;
@@ -19,4 +21,6 @@
 
 #pragma link C++ class AliPWG0Helper+;
 
+
+
 #endif
index 31d608d..af3ffec 100644 (file)
 #include <../TPC/AliTPCclusterMI.h>
 #include <../TPC/AliTPCseed.h>
 
-#include <TH2F.h>
 #include <TFile.h>
 #include <TTree.h>
 #include <TCanvas.h>
-#include <TProfile.h>
+
+#include "TPC/AliTPCClusterHistograms.h"
 
 ClassImp(AliROCESDAnalysisSelector)
 
 AliROCESDAnalysisSelector::AliROCESDAnalysisSelector() :
   AliSelector(),
   fESDfriend(0),
-  fhQmaxVsRow(0)
+  fClusterHistograms(0)
 {
   //
   // Constructor. Initialization of pointers
@@ -67,6 +67,12 @@ AliROCESDAnalysisSelector::~AliROCESDAnalysisSelector()
   //
   // Destructor
   //
+
+  if (fClusterHistograms) {
+    delete fClusterHistograms;
+    fClusterHistograms = 0;    
+  }
+
 }
 
 void AliROCESDAnalysisSelector::SlaveBegin(TTree* tree)
@@ -74,8 +80,9 @@ void AliROCESDAnalysisSelector::SlaveBegin(TTree* tree)
   //
   
   AliSelector::SlaveBegin(tree);
-  
-  fhQmaxVsRow = new TH2F("QmaxVsRow", "Qmax vs. pad row;Pad row;Qmax", 91, -0.5, 90, 201, -0.5, 200.5);
+
+  fClusterHistograms = new AliTPCClusterHistograms("test","test");
+
 } 
 
 void AliROCESDAnalysisSelector::Init(TTree *tree)
@@ -163,7 +170,7 @@ Bool_t AliROCESDAnalysisSelector::Process(Long64_t entry)
       if (cluster->GetDetector() != 5)
         continue;
       
-      fhQmaxVsRow->Fill(cluster->GetRow(), cluster->GetMax());
+      fClusterHistograms->FillCluster(cluster);
     }
   }
    
@@ -174,26 +181,15 @@ void AliROCESDAnalysisSelector::SlaveTerminate()
 {
   //
   
-  fOutput->Add(fhQmaxVsRow);
+  fOutput->Add(fClusterHistograms);
 } 
 
 void AliROCESDAnalysisSelector::Terminate()
 {
   //
-  
-  fhQmaxVsRow = dynamic_cast<TH2F*> (fOutput->FindObject("QmaxVsRow"));
-  if (!fhQmaxVsRow)
-    return;
-
-  new TCanvas;
-  fhQmaxVsRow->DrawCopy("COLZ");
-    
-  new TCanvas;
-  TProfile* profile = fhQmaxVsRow->ProfileX("fhQmaxVsRowProfile");
-  profile->DrawCopy();
     
   TFile* file = TFile::Open("rocESD.root", "RECREATE");
-  fhQmaxVsRow->Write();
-  profile->Write();
+  
+  fClusterHistograms->SaveHistograms();
   file->Close();
 } 
index 9c59020..5d54996 100644 (file)
@@ -5,8 +5,10 @@
 
 #include "AliSelector.h"
 
+//#include "TPC/AliTPCClusterHistograms.h"
+
+class AliTPCClusterHistograms;
 class AliESDfriend;
-class TH2F;
 
 // this is an empty selector that can be used to create an analysis
 
@@ -23,8 +25,8 @@ class AliROCESDAnalysisSelector : public AliSelector {
 
  protected:
     AliESDfriend* fESDfriend;
-    
-    TH2F* fhQmaxVsRow;
+
+    AliTPCClusterHistograms* fClusterHistograms;
 
  private:
     AliROCESDAnalysisSelector(const AliROCESDAnalysisSelector&);
diff --git a/PWG0/TPC/AliTPCClusterHistograms.cxx b/PWG0/TPC/AliTPCClusterHistograms.cxx
new file mode 100644 (file)
index 0000000..2d35bdc
--- /dev/null
@@ -0,0 +1,242 @@
+/* $Id$ */
+
+
+#include <TFile.h>
+#include <TCanvas.h>
+#include <TH2F.h>
+#include <TProfile2D.h>
+
+#include <../TPC/AliTPCclusterMI.h>
+
+#include <AliLog.h>
+
+#include "AliTPCClusterHistograms.h"
+
+//____________________________________________________________________
+ClassImp(AliTPCClusterHistograms)
+
+//____________________________________________________________________
+AliTPCClusterHistograms::AliTPCClusterHistograms() 
+  : TNamed(),
+  fhQmaxVsRow(0),          
+  fhQtotVsRow(0),          
+  fhSigmaYVsRow(0),        
+  fhSigmaZVsRow(0),                            
+  fhQmaxProfileYVsRow(0), 
+  fhQtotProfileYVsRow(0),
+  fhSigmaYProfileYVsRow(0),
+  fhSigmaZProfileYVsRow(0)
+{
+  // default constructor
+}
+
+//____________________________________________________________________
+AliTPCClusterHistograms::AliTPCClusterHistograms(const Char_t* name, const Char_t* title) 
+  : TNamed(name, title),
+  fhQmaxVsRow(0),          
+  fhQtotVsRow(0),          
+  fhSigmaYVsRow(0),        
+  fhSigmaZVsRow(0),                            
+  fhQmaxProfileYVsRow(0), 
+  fhQtotProfileYVsRow(0),
+  fhSigmaYProfileYVsRow(0),
+  fhSigmaZProfileYVsRow(0)
+{
+  // constructor initializing tnamed
+
+  fhQmaxVsRow  = new TH2F("QmaxVsPadRow", "Qmax vs. pad row;Pad row;Qmax", 91, -0.5, 90.5, 301, -0.5, 300.5);
+  fhQtotVsRow  = new TH2F("QtotVsPadRow", "Qtot vs. pad row;Pad row;Qtot", 91, -0.5, 90.5, 100,  0,  1000);
+  
+  fhSigmaYVsRow = new TH2F("SigmaYVsPadRow", "Sigma Y vs. pad row;Pad row;#sigma_{Y}", 91, -0.5, 90.5, 100,  0,  0.5);
+  fhSigmaZVsRow = new TH2F("SigmaZVsPadRow", "Sigma Z vs. pad row;Pad row;#sigma_{Z}", 91, -0.5, 90.5, 100,  0,  0.5);
+  
+  fhQmaxProfileYVsRow = new TProfile2D("QmaxMeanYVsPadRow","Mean Qmax, y vs pad row;Pad row;y",91,-0.5,90.5,100,-30,30);
+  fhQtotProfileYVsRow = new TProfile2D("QtotMeanYVsPadRow","Mean Qtot, y vs pad row;Pad row;y",91,-0.5,90.5,100,-30,30);
+  fhSigmaYProfileYVsRow = new TProfile2D("SigmaYMeanYVsPadRow","Mean Sigma y, x vs pad row;Pad row;y",91,-0.5,90.5,100,-30,30);
+  fhSigmaZProfileYVsRow = new TProfile2D("SigmaZMeanYVsPadRow","Mean Sigma y, x vs pad row;Pad row;y",91,-0.5,90.5,100,-30,30);
+
+}
+
+//____________________________________________________________________
+AliTPCClusterHistograms::AliTPCClusterHistograms(const AliTPCClusterHistograms& c) : TNamed(c)
+{
+  // copy constructor
+  ((AliTPCClusterHistograms &)c).Copy(*this);
+}
+
+//____________________________________________________________________
+AliTPCClusterHistograms::~AliTPCClusterHistograms()
+{
+  //
+  // destructor
+  //
+
+  if (fhQmaxVsRow) {
+    delete fhQmaxVsRow;
+    fhQmaxVsRow = 0;
+  }
+  if (fhQtotVsRow) {
+    delete fhQtotVsRow;
+    fhQtotVsRow = 0; 
+  }
+  if (fhSigmaYVsRow) {
+    delete fhSigmaYVsRow;
+    fhSigmaYVsRow = 0;
+  } 
+  if (fhSigmaZVsRow) {
+    delete fhSigmaZVsRow;
+    fhSigmaZVsRow = 0; 
+  }
+  if (fhQmaxProfileYVsRow) {
+    delete fhQmaxProfileYVsRow;
+    fhQmaxProfileYVsRow = 0;
+  }
+  if (fhQtotProfileYVsRow) {
+    delete fhQtotProfileYVsRow;
+    fhQtotProfileYVsRow = 0;
+  }
+  if (fhSigmaYProfileYVsRow) {
+    delete fhSigmaYProfileYVsRow;
+    fhSigmaYProfileYVsRow = 0;
+  }
+  if (fhSigmaZProfileYVsRow) {
+    delete fhSigmaZProfileYVsRow;
+    fhSigmaZProfileYVsRow = 0;
+  }
+
+}
+
+//____________________________________________________________________
+AliTPCClusterHistograms &AliTPCClusterHistograms::operator=(const AliTPCClusterHistograms &c)
+{
+  // assigment operator
+
+  if (this != &c)
+    ((AliTPCClusterHistograms &) c).Copy(*this);
+
+  return *this;
+}
+
+
+//____________________________________________________________________
+Long64_t AliTPCClusterHistograms::Merge(TCollection* list)
+{
+  // Merge a list of AliTPCClusterHistograms objects with this (needed for
+  // PROOF). 
+  // Returns the number of merged objects (including this).
+
+  if (!list)
+    return 0;
+  
+  if (list->IsEmpty())
+    return 1;
+
+  TIterator* iter = list->MakeIterator();
+  TObject* obj;
+
+  // collections of measured and generated histograms
+  TList* collectionQmaxVsRow     = new TList;
+  TList* collectionQtotVsRow    = new TList;
+  TList* collectionSigmaYVsRow  = new TList;
+  TList* collectionSigmaZVsRow  = new TList;
+                                       
+  TList* collectionQmaxProfileYVsRow    = new TList;
+  TList* collectionQtotProfileYVsRow    = new TList;
+  TList* collectionSigmaYProfileYVsRow  = new TList;
+  TList* collectionSigmaZProfileYVsRow  = new TList;
+
+   Int_t count = 0;
+   while ((obj = iter->Next())) {
+    
+     AliTPCClusterHistograms* entry = dynamic_cast<AliTPCClusterHistograms*> (obj);
+     if (entry == 0) 
+       continue;
+
+
+     collectionQmaxVsRow          ->Add(entry->fhQmaxVsRow        );
+     collectionQtotVsRow         ->Add(entry->fhQtotVsRow         );
+     collectionSigmaYVsRow       ->Add(entry->fhSigmaYVsRow       );
+     collectionSigmaZVsRow       ->Add(entry->fhSigmaZVsRow       );
+                                                                          
+     collectionQmaxProfileYVsRow  ->Add(entry->fhQmaxProfileYVsRow );
+     collectionQtotProfileYVsRow  ->Add(entry->fhQtotProfileYVsRow );
+     collectionSigmaYProfileYVsRow->Add(entry->fhSigmaYProfileYVsRow);
+     collectionSigmaZProfileYVsRow->Add(entry->fhSigmaZProfileYVsRow);
+
+     count++;
+   }
+
+   fhQmaxVsRow          ->Merge(collectionQmaxVsRow       );      
+   fhQtotVsRow          ->Merge(collectionQtotVsRow      );       
+   fhSigmaYVsRow        ->Merge(collectionSigmaYVsRow    );       
+   fhSigmaZVsRow        ->Merge(collectionSigmaZVsRow    );       
+                                                                    
+   fhQmaxProfileYVsRow  ->Merge(collectionQmaxProfileYVsRow  ); 
+   fhQtotProfileYVsRow  ->Merge(collectionQtotProfileYVsRow  );
+   fhSigmaYProfileYVsRow->Merge(collectionSigmaYProfileYVsRow);
+   fhSigmaZProfileYVsRow->Merge(collectionSigmaZProfileYVsRow);
+
+   delete collectionQmaxVsRow;          
+   delete collectionQtotVsRow;  
+   delete collectionSigmaYVsRow;         
+   delete collectionSigmaZVsRow;         
+                                 
+   delete collectionQmaxProfileYVsRow;  
+   delete collectionQtotProfileYVsRow;  
+   delete collectionSigmaYProfileYVsRow;
+   delete collectionSigmaZProfileYVsRow;
+
+  return count+1;
+}
+
+//____________________________________________________________________
+void AliTPCClusterHistograms::FillCluster(AliTPCclusterMI* cluster) {
+  //
+  //
+  //
+
+  Int_t padRow =   cluster->GetRow(); 
+  Float_t qMax =   cluster->GetMax();
+  Float_t qTot =   cluster->GetQ();
+  Float_t sigmaY = cluster->GetSigmaY2();
+  Float_t sigmaZ = cluster->GetSigmaZ2();
+  Float_t y      = cluster->GetY();
+
+  fhQmaxVsRow           ->Fill(padRow, qMax);
+  fhQtotVsRow           ->Fill(padRow, qTot);
+                       
+  fhSigmaYVsRow         ->Fill(padRow, sigmaY);
+  fhSigmaZVsRow         ->Fill(padRow, sigmaZ);
+                       
+  fhQmaxProfileYVsRow   ->Fill(padRow, y, qMax);
+  fhQtotProfileYVsRow   ->Fill(padRow, y, qTot); 
+  fhSigmaYProfileYVsRow ->Fill(padRow, y, sigmaY);
+  fhSigmaZProfileYVsRow ->Fill(padRow, y, sigmaZ);
+}
+
+
+//____________________________________________________________________
+void AliTPCClusterHistograms::SaveHistograms()
+{
+  //
+  // saves the histograms
+  //
+
+  gDirectory->mkdir(fName.Data());
+  gDirectory->cd(fName.Data());
+
+  fhQmaxVsRow           ->Write();
+  fhQtotVsRow           ->Write();
+                       
+  fhSigmaYVsRow         ->Write();
+  fhSigmaZVsRow         ->Write();
+                       
+  fhQmaxProfileYVsRow   ->Write();
+  fhQtotProfileYVsRow   ->Write();
+  fhSigmaYProfileYVsRow ->Write();
+  fhSigmaZProfileYVsRow ->Write();
+
+  gDirectory->cd("../");
+
+}
+
diff --git a/PWG0/TPC/AliTPCClusterHistograms.h b/PWG0/TPC/AliTPCClusterHistograms.h
new file mode 100644 (file)
index 0000000..3c110cb
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef ALITPCClusterHistograms_H
+#define ALITPCClusterHistograms_H
+
+/* $Id$ */
+
+
+#include <TNamed.h>
+//#include <../TPC/AliTPCclusterMI.h>
+
+class TH3;
+class TH2F;
+class TProfile2D;
+class AliTPCclusterMI;
+
+class AliTPCClusterHistograms : public TNamed
+{
+public:
+
+  AliTPCClusterHistograms();
+  AliTPCClusterHistograms(const Char_t* name, const Char_t* title);
+  AliTPCClusterHistograms(const AliTPCClusterHistograms& c);
+  virtual ~AliTPCClusterHistograms();
+  AliTPCClusterHistograms& operator=(const AliTPCClusterHistograms& corrMatrix);
+
+  virtual Long64_t Merge(TCollection* list);
+
+  virtual void SaveHistograms();
+
+  void FillCluster(AliTPCclusterMI* clusterMI);
+
+protected:
+
+  TH2F*       fhQmaxVsRow;
+  TH2F*       fhQtotVsRow;
+  TH2F*       fhSigmaYVsRow;
+  TH2F*       fhSigmaZVsRow;
+
+  TProfile2D* fhQmaxProfileYVsRow;
+  TProfile2D* fhQtotProfileYVsRow;
+  TProfile2D* fhSigmaYProfileYVsRow;
+  TProfile2D* fhSigmaZProfileYVsRow;
+
+
+  ClassDef(AliTPCClusterHistograms,1)
+};
+
+#endif
+
index e02da46..f740b08 100644 (file)
@@ -13,7 +13,7 @@ void runROCESDAnalysis(Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aDeb
   if (aProof)
     connectProof(proofServer);
 
-  TString libraries("libEG;libGeom;libESD");
+  TString libraries("libEG;libGeom;libESD;libPWG0base");
   TString packages;
 
   if (!prepareQuery(libraries, packages, 2))
index 75458b8..7556112 100644 (file)
@@ -3,6 +3,7 @@
 HDRS = dNdEta/dNdEtaAnalysis.h \
       dNdEta/AlidNdEtaCorrection.h \
       esdTrackCuts/AliESDtrackCuts.h \
+      TPC/AliTPCClusterHistograms.h \
       AliCorrectionMatrix.h \
       AliCorrectionMatrix2D.h \
       AliCorrectionMatrix3D.h \