2 // Class AliRsnReaderTaskSE
4 // An AnalysisTask object to convert any kind of source event type (ESD/AOD/MC)
5 // into the RSN internal format (AliRsnEvent).
6 // The output of this task is a TTree with converted events, which is saved in a file
7 // and can then be processed as many times as desired, to build invariant mass spectra.
9 // original author: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
10 // adapted for Analysis Framework by: R. Vernet (renaud.vernet@cern.ch)
15 #include "AliAnalysisManager.h"
17 #include "AliMCEvent.h"
18 #include "AliMCEventHandler.h"
20 #include "AliESDInputHandler.h"
21 #include "AliAODInputHandler.h"
22 #include "AliAODHandler.h"
24 #include "AliRsnPID.h"
25 #include "AliRsnEvent.h"
26 #include "AliRsnReader.h"
27 #include "AliRsnReaderTaskSE.h"
29 ClassImp(AliRsnReaderTaskSE)
31 //_____________________________________________________________________________
32 AliRsnReaderTaskSE::AliRsnReaderTaskSE() :
33 AliRsnAnalysisTaskSEBase(),
37 // Default constructor (not recommended)
41 //_____________________________________________________________________________
42 AliRsnReaderTaskSE::AliRsnReaderTaskSE(const char *name) :
43 AliRsnAnalysisTaskSEBase(name),
47 // Working constructor (recommended)
51 //_____________________________________________________________________________
52 void AliRsnReaderTaskSE::UserCreateOutputObjects()
55 // Instantiates the output object (AliRsnEvent) and adds a branch
56 // to the non-standard AOD output TTree to include it.
57 // Checks that the necessary data member objects for
58 // conversion and PID are allocated. If this is not the case,
59 // raises a fatal error which breaks the AliRoot session.
62 fRsnEvent = new AliRsnEvent();
63 fRsnEvent->SetName("rsnEvents");
65 AddAODBranch("AliRsnEvent", &fRsnEvent);
68 //_____________________________________________________________________________
69 void AliRsnReaderTaskSE::Init()
72 // Inherited function.
73 // Here it does not need to do anything, so it is left dummy.
77 //_____________________________________________________________________________
78 void AliRsnReaderTaskSE::UserExec(Option_t */*option*/)
81 // Execution core of the class.
82 // Uses the AliRsnReader and AliRsnPID methods to convert input data
83 // and store them in the output AOD event, with all required computations.
86 AliDebug(1,Form("Reading event %d", ++fEntry));
88 // before adding new data, the ones from previous event
89 // must be cleared explicitly
95 switch (fInputType[0])
98 AliDebug(5, "Reading AOD event...");
99 ok = fReader.FillFromAOD(fRsnEvent, (AliAODEvent*)fInputEvent, fMCEvent);
100 AliDebug(5, "...done");
103 AliDebug(5, "Reading ESD event...");
104 ok = fReader.FillFromESD(fRsnEvent, (AliESDEvent*)fInputEvent, fMCEvent);
105 AliDebug(5, "...done");
108 AliDebug(5, "Reading ESD event with MC...");
109 ok = fReader.FillFromESD(fRsnEvent, (AliESDEvent*)fInputEvent, fMCEvent);
110 AliDebug(5, "...done");
113 AliDebug(5, "Reading MC only event...");
114 ok = fReader.FillFromMC(fRsnEvent, fMCEvent);
115 AliDebug(5, "...done");
118 AliError("Type not supported ...");
121 if (!ok) AliWarning("Failed reading");
123 // step 2: PID probability computation
124 //if (!fPID.Process(fRsnEvent)) AliWarning("Failed PID");
126 AliDebug(1,Form("Collected %d tracks", fRsnEvent->GetMultiplicity()));
129 //_____________________________________________________________________________
130 void AliRsnReaderTaskSE::Terminate(Option_t */*option*/)
133 // Inherited function.
134 // Here it does not need to do anything, so it is left dummy.