]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ESDCheck/AliPHOSQATask.cxx
Update to more closely ressemble the rec.C used during official pass1
[u/mrichter/AliRoot.git] / ESDCheck / AliPHOSQATask.cxx
index 94e3382007ab3d638d31743132a85a6dc379daff..591769f86c817fc9cea288a025e2e783e47e1264 100644 (file)
 
 //_________________________________________________________________________
 // An analysis task to check the PHOS photon data in simulated data
+// An analysis task to check the PHOS photon data in simulated data
+// An analysis task to check the PHOS photon data in simulated data
+// An analysis task to check the PHOS photon data in simulated data
+// An analysis task to check the PHOS photon data in simulated data
+// An analysis task to check the PHOS photon data in simulated data
 //
 //*-- Yves Schutz 
 //////////////////////////////////////////////////////////////////////////////
 #include <TChain.h>
 #include <TFile.h> 
 #include <TH1.h>
-#include <TH1F.h>
-#include <TH1I.h>
-#include <TLegend.h> 
 #include <TNtuple.h>
 #include <TROOT.h> 
 #include <TVector3.h> 
+#include <TString.h> 
 
 #include "AliPHOSQATask.h" 
 #include "AliESD.h" 
@@ -41,6 +44,8 @@ AliPHOSQATask::AliPHOSQATask(const char *name) :
   AliAnalysisTask(name,""),  
   fChain(0),
   fESD(0), 
+  fOutputContainer(0),
+  fhPHOSPos(0),
   fhPHOS(0),
   fhPHOSEnergy(0),
   fhPHOSDigits(0),
@@ -56,6 +61,34 @@ AliPHOSQATask::AliPHOSQATask(const char *name) :
   DefineOutput(0,  TObjArray::Class()) ; 
 }
 
+//____________________________________________________________________________
+AliPHOSQATask::AliPHOSQATask(const AliPHOSQATask& ta) :
+  AliAnalysisTask(ta.GetName(),""),  
+  fChain(ta.fChain),
+  fESD(ta.fESD), 
+  fOutputContainer(ta.fOutputContainer), 
+  fhPHOSPos(ta.fhPHOSPos),
+  fhPHOS(ta.fhPHOS),
+  fhPHOSEnergy(ta.fhPHOSEnergy),
+  fhPHOSDigits(ta.fhPHOSDigits),
+  fhPHOSRecParticles(ta.fhPHOSRecParticles),
+  fhPHOSPhotons(ta.fhPHOSPhotons),
+  fhPHOSInvariantMass(ta.fhPHOSInvariantMass),
+  fhPHOSDigitsEvent(ta.fhPHOSDigitsEvent)
+{ 
+  // cpy ctor
+}
+
+//_____________________________________________________________________________
+AliPHOSQATask& AliPHOSQATask::operator = (const AliPHOSQATask& ap)
+{
+// assignment operator
+
+  this->~AliPHOSQATask();
+  new(this) AliPHOSQATask(ap);
+  return *this;
+}
+
 //______________________________________________________________________________
 AliPHOSQATask::~AliPHOSQATask()
 {
@@ -103,6 +136,8 @@ void AliPHOSQATask::CreateOutputObjects()
 {  
   // create histograms 
   
+  OpenFile(0) ; 
+
   fhPHOSPos            = new TNtuple("PHOSPos"         , "Position in PHOS"  , "x:y:z");
   fhPHOS               = new TNtuple("PHOS"            , "PHOS"  , "event:digits:clusters:photons");
   fhPHOSEnergy         = new TH1D("PHOSEnergy"         , "PHOSEnergy"        , 1000, 0., 10. ) ;
@@ -145,37 +180,37 @@ void AliPHOSQATask::Exec(Option_t *)
   //************************  PHOS *************************************
       
   Int_t       firstPhosCluster       = fESD->GetFirstPHOSCluster() ;
-  const Int_t numberOfPhosClusters   = fESD->GetNumberOfPHOSClusters() ;
+  const Int_t kNumberOfPhosClusters   = fESD->GetNumberOfPHOSClusters() ;
   
-  TVector3 ** phosVector       = new TVector3*[numberOfPhosClusters] ;
-  Float_t  * phosPhotonsEnergy = new Float_t[numberOfPhosClusters] ;
+  TVector3 ** phosVector       = new TVector3*[kNumberOfPhosClusters] ;
+  Float_t  * phosPhotonsEnergy = new Float_t[kNumberOfPhosClusters] ;
   Int_t      phosCluster ; 
   Int_t      numberOfPhotonsInPhos  = 0 ;
   Int_t      numberOfDigitsInPhos   = 0 ;
   
   // loop over the PHOS Cluster
-  for(phosCluster = firstPhosCluster ; phosCluster < firstPhosCluster + numberOfPhosClusters ; phosCluster++) {
+  for(phosCluster = firstPhosCluster ; phosCluster < firstPhosCluster + kNumberOfPhosClusters ; phosCluster++) {
     AliESDCaloCluster * caloCluster = fESD->GetCaloCluster(phosCluster) ;
     if (caloCluster) {
       Float_t pos[3] ;
-      caloCluster->GetGlobalPosition( pos ) ;
-      fhPHOSEnergy->Fill( caloCluster->GetClusterEnergy() ) ;
+      caloCluster->GetPosition( pos ) ;
+      fhPHOSEnergy->Fill( caloCluster->E() ) ;
       fhPHOSPos->Fill( pos[0], pos[1], pos[2] ) ;
-      fhPHOSDigits->Fill(entry, caloCluster->GetNumberOfDigits() ) ;
-      numberOfDigitsInPhos += caloCluster->GetNumberOfDigits() ;
-      Float_t * pid = caloCluster->GetPid() ;
+      fhPHOSDigits->Fill(entry, caloCluster->GetNCells() ) ;
+      numberOfDigitsInPhos += caloCluster->GetNCells() ;
+      Double_t * pid = caloCluster->GetPid() ;
       if(pid[AliPID::kPhoton] > 0.9) {
        phosVector[numberOfPhotonsInPhos] = new TVector3(pos[0],pos[1],pos[2]) ;
-       phosPhotonsEnergy[numberOfPhotonsInPhos]=caloCluster->GetClusterEnergy() ;
+       phosPhotonsEnergy[numberOfPhotonsInPhos]=caloCluster->E() ;
        numberOfPhotonsInPhos++;
       }
     }
   } //PHOS clusters
     
-  fhPHOSRecParticles->Fill(numberOfPhosClusters);
+  fhPHOSRecParticles->Fill(kNumberOfPhosClusters);
   fhPHOSPhotons->Fill(numberOfPhotonsInPhos);
   fhPHOSDigitsEvent->Fill(numberOfDigitsInPhos);
-  fhPHOS->Fill(entry, numberOfDigitsInPhos, numberOfPhosClusters, numberOfPhotonsInPhos) ; 
+  fhPHOS->Fill(entry, numberOfDigitsInPhos, kNumberOfPhosClusters, numberOfPhotonsInPhos) ; 
 
   // invariant Mass
   if (numberOfPhotonsInPhos > 1 ) {
@@ -212,18 +247,21 @@ void AliPHOSQATask::Terminate(Option_t *)
   fhPHOSInvariantMass  = (TH1D*)fOutputContainer->At(6);
   fhPHOSDigitsEvent    = (TH1I*)fOutputContainer->At(7);
 
-  printf("PHOSEnergy Mean         : %5.3f , RMS : %5.3f \n", fhPHOSEnergy->GetMean(),         fhPHOSEnergy->GetRMS()         ) ;
-  printf("PHOSDigits Mean         : %5.3f , RMS : %5.3f \n", fhPHOSDigits->GetMean(),         fhPHOSDigits->GetRMS()         ) ;
-  printf("PHOSRecParticles Mean   : %5.3f , RMS : %5.3f \n", fhPHOSRecParticles->GetMean(),   fhPHOSRecParticles->GetRMS()   ) ;
-  printf("PHOSPhotons Mean        : %5.3f , RMS : %5.3f \n", fhPHOSPhotons->GetMean(),        fhPHOSPhotons->GetRMS()        ) ;
-  printf("PHOSInvariantMass Mean  : %5.3f , RMS : %5.3f \n", fhPHOSInvariantMass->GetMean(),  fhPHOSInvariantMass->GetRMS()  ) ;
-  printf("PHOSDigitsEvent Mean    : %5.3f , RMS : %5.3f \n", fhPHOSDigitsEvent->GetMean(),    fhPHOSDigitsEvent->GetRMS()    ) ;
+  Bool_t problem = kFALSE ; 
+  AliInfo(Form(" *** %s Report:", GetName())) ; 
+  printf("        PHOSEnergy Mean         : %5.3f , RMS : %5.3f \n", fhPHOSEnergy->GetMean(),         fhPHOSEnergy->GetRMS()         ) ;
+  printf("        PHOSDigits Mean         : %5.3f , RMS : %5.3f \n", fhPHOSDigits->GetMean(),         fhPHOSDigits->GetRMS()         ) ;
+  printf("        PHOSRecParticles Mean   : %5.3f , RMS : %5.3f \n", fhPHOSRecParticles->GetMean(),   fhPHOSRecParticles->GetRMS()   ) ;
+  printf("        PHOSPhotons Mean        : %5.3f , RMS : %5.3f \n", fhPHOSPhotons->GetMean(),        fhPHOSPhotons->GetRMS()        ) ;
+  printf("        PHOSInvariantMass Mean  : %5.3f , RMS : %5.3f \n", fhPHOSInvariantMass->GetMean(),  fhPHOSInvariantMass->GetRMS()  ) ;
+  printf("        PHOSDigitsEvent Mean    : %5.3f , RMS : %5.3f \n", fhPHOSDigitsEvent->GetMean(),    fhPHOSDigitsEvent->GetRMS()    ) ;
 
   TCanvas  * cPHOS = new TCanvas("cPHOS", "PHOS ESD Test", 400, 10, 600, 700) ;
   cPHOS->Divide(3, 2);
 
   cPHOS->cd(1) ; 
-  gPad->SetLogy();
+  if ( fhPHOSEnergy->GetMaximum() > 0. ) 
+    gPad->SetLogy();
   fhPHOSEnergy->SetAxisRange(0, 25.);
   fhPHOSEnergy->SetLineColor(2);
   fhPHOSEnergy->Draw();
@@ -234,13 +272,15 @@ void AliPHOSQATask::Terminate(Option_t *)
   fhPHOSDigits->Draw();
 
   cPHOS->cd(3) ; 
-  gPad->SetLogy();
+  if ( fhPHOSRecParticles->GetMaximum() > 0. ) 
+    gPad->SetLogy();
   fhPHOSRecParticles->SetAxisRange(0, 25.);
   fhPHOSRecParticles->SetLineColor(2);
   fhPHOSRecParticles->Draw();
 
   cPHOS->cd(4) ; 
-  gPad->SetLogy();
+  if ( fhPHOSPhotons->GetMaximum() > 0. ) 
+    gPad->SetLogy();
   fhPHOSPhotons->SetAxisRange(0,25.);
   fhPHOSPhotons->SetLineColor(2);
   fhPHOSPhotons->Draw();
@@ -250,7 +290,8 @@ void AliPHOSQATask::Terminate(Option_t *)
   fhPHOSInvariantMass->Draw();
  
   cPHOS->cd(6) ; 
-  gPad->SetLogy();
+  if ( fhPHOSDigitsEvent->GetMaximum() > 0. ) 
+    gPad->SetLogy();
   fhPHOSDigitsEvent->SetAxisRange(0,40.);
   fhPHOSDigitsEvent->SetLineColor(2);
   fhPHOSDigitsEvent->Draw();
@@ -258,10 +299,18 @@ void AliPHOSQATask::Terminate(Option_t *)
   cPHOS->Print("PHOS.eps");
  
   char line[1024] ; 
-  sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ; 
+  sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ; 
   gROOT->ProcessLine(line);
   sprintf(line, ".!rm -fR *.eps"); 
   gROOT->ProcessLine(line);
  
-  AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ;
+  AliInfo(Form("!!! All the eps files are in %s.tar.gz !!!", GetName())) ;
+
+  TString report ; 
+  if(problem)
+    report="Problems found, please check!!!";  
+  else 
+    report="OK";
+
+  AliInfo(Form("*** %s Summary Report: %s \n",GetName(), report.Data())) ; 
 }