]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ESDCheck/AliT0QATask.cxx
char * to TString
[u/mrichter/AliRoot.git] / ESDCheck / AliT0QATask.cxx
index 972d6988def5f9cb6196a8a04fa6b778b15b7a9f..28c977dbb1ecc6feae3265db2a0ce3719dbe05f2 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
+
+/* $Id$ */
+
 //______________________________________________________________________________
 // An analysis task to check the T0 data in simulated data
 //
 //*-- Alla Maevskaya
 //////////////////////////////////////////////////////////////////////////////
 
+#include <TCanvas.h>
 #include <TChain.h>
+#include <TFile.h> 
 #include <TH1F.h>
-#include <TCanvas.h>
 #include <TLegend.h> 
-#include <TFile.h> 
+#include <TROOT.h>
+#include <TString.h> 
 
 #include "AliT0QATask.h" 
 #include "AliESD.h" 
@@ -58,7 +63,7 @@ AliT0QATask::~AliT0QATask()
 }
 
 //______________________________________________________________________________
-void AliT0QATask::Init(const Option_t*)
+void AliT0QATask::ConnectInputData(const Option_t*)
 {
   // Initialisation of branch container and histograms 
     
@@ -71,25 +76,23 @@ void AliT0QATask::Init(const Option_t*)
     return ;
   }
   
-  if (!fESD) {
-    // One should first check if the branch address was taken by some other task
-    char ** address = (char **)GetBranchAddress(0, "ESD") ;
-    if (address) 
-      fESD = (AliESD *)(*address) ; 
-    if (!fESD) 
-      fChain->SetBranchAddress("ESD", &fESD) ;  
+  // One should first check if the branch address was taken by some other task
+  char ** address = (char **)GetBranchAddress(0, "ESD");
+  if (address) {
+    fESD = (AliESD*)(*address);
+  } else {
+    fESD = new AliESD();
+    SetBranchAddress(0, "ESD", &fESD);
   }
-  // The output objects will be written to 
-  TDirectory * cdir = gDirectory ; 
-  // Open a file for output #0
-  char outputName[1024] ; 
-  sprintf(outputName, "%s.root", GetName() ) ; 
-  OpenFile(0, outputName , "RECREATE") ; 
-  if (cdir) 
-    cdir->cd() ; 
-  
-  // create histograms 
+}
   
+//________________________________________________________________________
+void AliT0QATask::CreateOutputObjects()
+{
+  // create histograms   
+
+  OpenFile(0) ; 
+
   fhT01 = new TH1F("hRealVertex", "Primary vertex", 100,   -20,    20);
   fhT02 = new TH1F("hT0start",    "T0 start time",  100, 12400, 12600);
   fhT03 = new TH1F("hT0vertex",   "T0vertex",       100,   -20,    20);
@@ -138,14 +141,22 @@ void AliT0QATask::Exec(Option_t *)
 void AliT0QATask::Terminate(Option_t *)
 {
   // Processing when the event loop is ended
-  
+  fOutputContainer = (TObjArray*)GetOutputData(0);
+  fhT01 = (TH1F*)fOutputContainer->At(0);
+  fhT02 = (TH1F*)fOutputContainer->At(1);
+  fhT03 = (TH1F*)fOutputContainer->At(2);
+
+  Bool_t problem = kFALSE ; 
+  AliInfo(Form(" *** %s Report:", GetName())) ; 
+
   Float_t mean = fhT02->GetMean();
 
   printf ("mean time T0 ps %f\n", mean) ;
 
-  if ( mean > 12600 || mean < 12400 ) 
+  if ( mean > 12600 || mean < 12400 ) {
    AliWarning (" !!!!!!!!!!-----events sample is WRONG - T0 unreal -------");  
-
+   problem = kTRUE ;
+  }
   TCanvas  * cTO1 = new TCanvas("cT01", "T0 ESD Test", 400, 10, 600, 700) ;
   cTO1->Divide(2, 2) ;
 
@@ -162,10 +173,18 @@ void AliT0QATask::Terminate(Option_t *)
   cTO1->Print("T0.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())) ; 
 }