1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 //______________________________________________________________________________
19 // An analysis task to check the T0 data in simulated data
22 //////////////////////////////////////////////////////////////////////////////
31 #include "AliT0QATask.h"
34 #include "AliESDVertex.h"
36 //______________________________________________________________________________
37 AliT0QATask::AliT0QATask(const char *name) :
38 AliAnalysisTask(name,""),
46 // Input slot #0 works with an Ntuple
47 DefineInput(0, TChain::Class());
48 // Output slot #0 writes into a TH1 container
49 DefineOutput(0, TObjArray::Class()) ;
52 //______________________________________________________________________________
53 AliT0QATask::~AliT0QATask()
56 fOutputContainer->Clear() ;
57 delete fOutputContainer ;
64 //______________________________________________________________________________
65 void AliT0QATask::ConnectInputData(const Option_t*)
67 // Initialisation of branch container and histograms
69 AliInfo(Form("*** Initialization of %s", GetName())) ;
72 fChain = dynamic_cast<TChain *>(GetInputData(0)) ;
74 AliError(Form("Input 0 for %s not found\n", GetName()));
78 // One should first check if the branch address was taken by some other task
79 char ** address = (char **)GetBranchAddress(0, "ESD");
81 fESD = (AliESD*)(*address);
84 SetBranchAddress(0, "ESD", &fESD);
88 //________________________________________________________________________
89 void AliT0QATask::CreateOutputObjects()
95 fhT01 = new TH1F("hRealVertex", "Primary vertex", 100, -20, 20);
96 fhT02 = new TH1F("hT0start", "T0 start time", 100, 12400, 12600);
97 fhT03 = new TH1F("hT0vertex", "T0vertex", 100, -20, 20);
100 // create output container
102 fOutputContainer = new TObjArray(3) ;
103 fOutputContainer->SetName(GetName()) ;
105 fOutputContainer->AddAt(fhT01, 0) ;
106 fOutputContainer->AddAt(fhT02, 1) ;
107 fOutputContainer->AddAt(fhT03, 2) ;
110 //______________________________________________________________________________
111 void AliT0QATask::Exec(Option_t *)
113 // Processing of one event
115 Long64_t entry = fChain->GetReadEntry() ;
118 AliError("fESD is not connected to the input!") ;
122 if ( !((entry-1)%100) )
123 AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ;
125 // ************************ T0 *************************************
127 const AliESDVertex * vertex = fESD->GetPrimaryVertex() ;
128 Double_t posZ = vertex->GetZv() ;
129 fhT01->Fill( posZ ) ;
131 fhT02->Fill( fESD->GetT0() ) ;
133 fhT03->Fill( fESD->GetT0zVertex() / 2. ) ;
135 PostData(0, fOutputContainer);
139 //______________________________________________________________________________
140 void AliT0QATask::Terminate(Option_t *)
142 // Processing when the event loop is ended
143 fOutputContainer = (TObjArray*)GetOutputData(0);
144 fhT01 = (TH1F*)fOutputContainer->At(0);
145 fhT02 = (TH1F*)fOutputContainer->At(1);
146 fhT03 = (TH1F*)fOutputContainer->At(2);
148 Bool_t problem = kFALSE ;
149 AliInfo(Form(" *** %s Report:", GetName())) ;
151 Float_t mean = fhT02->GetMean();
153 printf ("mean time T0 ps %f\n", mean) ;
155 if ( mean > 12600 || mean < 12400 ) {
156 AliWarning (" !!!!!!!!!!-----events sample is WRONG - T0 unreal -------");
159 TCanvas * cTO1 = new TCanvas("cT01", "T0 ESD Test", 400, 10, 600, 700) ;
172 cTO1->Print("T0.eps");
175 sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ;
176 gROOT->ProcessLine(line);
177 sprintf(line, ".!rm -fR *.eps");
178 gROOT->ProcessLine(line);
180 AliInfo(Form("!!! All the eps files are in %s.tar.gz !!!", GetName())) ;
184 report="Problems found, please check!!!";
188 AliInfo(Form("*** %s Summary Report: %s\n",GetName(), report)) ;