1 /**************************************************************************
\r
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
\r
4 * Author: The ALICE Off-line Project. *
\r
5 * Contributors are mentioned in the code where appropriate. *
\r
7 * Permission to use, copy, modify and distribute this software and its *
\r
8 * documentation strictly for non-commercial purposes is hereby granted *
\r
9 * without fee, provided that the above copyright notice appears in all *
\r
10 * copies and that both the copyright notice and this permission notice *
\r
11 * appear in the supporting documentation. The authors make no claims *
\r
12 * about the suitability of this software for any purpose. It is *
\r
13 * provided "as is" without express or implied warranty. *
\r
14 **************************************************************************/
\r
16 //------------------------------------------------------------------------------
\r
17 // Implementation of the AliPerformanceTask class. It checks reconstruction performance
\r
18 // for the reconstructed vs MC particle tracks under several conditions. For real data
\r
19 // the control QA histograms are filled.
\r
21 // The comparison output objects deriving from AliPerformanceObject
\r
22 // (e.g. AliPerformanceRes, AliPerformanceEff, AliPerformanceDEdx, AliPerformanceDCA ...)
\r
23 // are stored in the output file (details in description of these classes).
\r
25 // Author: J.Otwinowski 01/04/2009
\r
26 //------------------------------------------------------------------------------
\r
33 #include "TCanvas.h"
\r
37 #include "AliAnalysisTask.h"
\r
38 #include "AliAnalysisManager.h"
\r
39 #include "AliESDEvent.h"
\r
40 #include "AliESDfriend.h"
\r
41 #include "AliMCEvent.h"
\r
42 #include "AliESDInputHandler.h"
\r
43 #include "AliMCEventHandler.h"
\r
44 #include "AliESDVertex.h"
\r
45 #include "AliMagF.h"
\r
46 #include "AliTracker.h"
\r
47 #include "AliGeomManager.h"
\r
49 #include "AliMCInfo.h"
\r
50 #include "AliESDRecInfo.h"
\r
51 #include "AliMCInfoCuts.h"
\r
52 #include "AliRecInfoCuts.h"
\r
53 #include "AliComparisonObject.h"
\r
54 #include "AliPerformanceObject.h"
\r
55 #include "AliPerformanceTask.h"
\r
57 using namespace std;
\r
59 ClassImp(AliPerformanceTask)
\r
61 //_____________________________________________________________________________
\r
62 AliPerformanceTask::AliPerformanceTask()
\r
63 : AliAnalysisTaskSE("Performance")
\r
70 , fUseMCInfo(kFALSE)
\r
71 , fUseESDfriend(kFALSE)
\r
73 // Dummy Constructor
\r
74 // should not be used
\r
77 //_____________________________________________________________________________
\r
78 AliPerformanceTask::AliPerformanceTask(const char *name, const char */*title*/)
\r
79 : AliAnalysisTaskSE(name)
\r
86 , fUseMCInfo(kFALSE)
\r
87 , fUseESDfriend(kFALSE)
\r
91 // Define input and output slots here
\r
92 DefineOutput(1, TList::Class());
\r
94 // create the list for comparison objects
\r
95 fCompList = new TList;
\r
98 //_____________________________________________________________________________
\r
99 AliPerformanceTask::~AliPerformanceTask()
\r
101 if(fOutput) delete fOutput; fOutput = 0;
\r
102 if(fCompList) delete fCompList; fCompList = 0;
\r
105 //_____________________________________________________________________________
\r
106 Bool_t AliPerformanceTask::AddPerformanceObject(AliPerformanceObject *pObj)
\r
108 // add comparison object to the list
\r
110 Printf("ERROR: Could not add comparison object");
\r
114 // add object to the list
\r
115 fCompList->AddLast(pObj);
\r
120 //_____________________________________________________________________________
\r
121 void AliPerformanceTask::UserCreateOutputObjects()
\r
123 // Create histograms
\r
126 // create output list
\r
127 fOutput = new TList;
\r
128 fOutput->SetOwner();
\r
129 fPitList = fOutput->MakeIterator();
\r
131 // add comparison objects to the output
\r
132 AliPerformanceObject *pObj=0;
\r
134 TIterator *pitCompList = fCompList->MakeIterator();
\r
135 pitCompList->Reset();
\r
136 while(( pObj = (AliPerformanceObject *)pitCompList->Next()) != NULL) {
\r
137 fOutput->Add(pObj);
\r
140 Printf("CreateOutputObjects(): Number of output comparison objects: %d \n", count);
\r
143 //_____________________________________________________________________________
\r
144 void AliPerformanceTask::UserExec(Option_t *)
\r
147 // Called for each event
\r
148 fESD = (AliESDEvent*) (InputEvent());
\r
151 fESDfriend = static_cast<AliESDfriend*>(fESD->FindListObject("AliESDfriend"));
\r
153 Printf("ERROR: ESD friends not available");
\r
162 AliPerformanceObject *pObj=0;
\r
165 Printf("ERROR: ESD event not available");
\r
169 if (fUseMCInfo && !fMC) {
\r
170 Printf("ERROR: MC event not available");
\r
177 Printf("ERROR: ESD friends not available");
\r
181 // Process comparison
\r
183 while(( pObj = (AliPerformanceObject *)fPitList->Next()) != NULL) {
\r
184 pObj->Exec(fMC,fESD,fESDfriend,fUseMCInfo,fUseESDfriend);
\r
187 // Post output data.
\r
188 PostData(1, fOutput);
\r
191 //_____________________________________________________________________________
\r
192 void AliPerformanceTask::Terminate(Option_t *)
\r
194 // Called once at the end
\r
196 // check output data
\r
197 fOutput = dynamic_cast<TList*> (GetOutputData(1));
\r
199 Printf("ERROR: AliPerformanceTask::Terminate(): fOutput data not avaiable ..." );
\r
204 //_____________________________________________________________________________
\r
205 Bool_t AliPerformanceTask::Notify()
\r
207 static Int_t count = 0;
\r
209 Printf("Processing %d. file", count);
\r