]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnReaderTaskSE.cxx
Introduce the case when no files are to be processed and sent to the OCDB
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnReaderTaskSE.cxx
1 //
2 // Class AliRsnReaderTaskSE
3 //
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.
8 // ---
9 // original author: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
10 // adapted for Analysis Framework by: R. Vernet (renaud.vernet@cern.ch)
11 //
12
13 #include "AliLog.h"
14
15 #include "AliAnalysisManager.h"
16
17 #include "AliMCEvent.h"
18 #include "AliMCEventHandler.h"
19
20 #include "AliESDInputHandler.h"
21 #include "AliAODInputHandler.h"
22 #include "AliAODHandler.h"
23
24 #include "AliRsnPID.h"
25 #include "AliRsnEvent.h"
26 #include "AliRsnReader.h"
27 #include "AliRsnReaderTaskSE.h"
28
29 ClassImp(AliRsnReaderTaskSE)
30
31 //_____________________________________________________________________________
32 AliRsnReaderTaskSE::AliRsnReaderTaskSE() :
33     AliRsnAnalysisTaskSEBase(),
34     fRsnEvent(0x0)
35 {
36 //
37 // Default constructor (not recommended)
38 //
39 }
40
41 //_____________________________________________________________________________
42 AliRsnReaderTaskSE::AliRsnReaderTaskSE(const char *name) :
43     AliRsnAnalysisTaskSEBase(name),
44     fRsnEvent(0x0)
45 {
46 //
47 // Working constructor (recommended)
48 //
49 }
50
51 //_____________________________________________________________________________
52 void AliRsnReaderTaskSE::UserCreateOutputObjects()
53 {
54 //
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.
60 //
61
62   fRsnEvent = new AliRsnEvent();
63   fRsnEvent->SetName("rsnEvents");
64   fRsnEvent->Init();
65   AddAODBranch("AliRsnEvent", &fRsnEvent);
66 }
67
68 //_____________________________________________________________________________
69 void AliRsnReaderTaskSE::Init()
70 {
71 //
72 // Inherited function.
73 // Here it does not need to do anything, so it is left dummy.
74 //
75 }
76
77 //_____________________________________________________________________________
78 void AliRsnReaderTaskSE::UserExec(Option_t */*option*/)
79 {
80 //
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.
84 //
85
86   AliDebug(1,Form("Reading event %d", ++fEntry));
87
88   // before adding new data, the ones from previous event
89   // must be cleared explicitly
90   fRsnEvent->Clear();
91
92
93   // step 1: conversion
94   Bool_t ok = kFALSE;
95   switch (fInputType[0])
96   {
97     case kAOD:
98       AliDebug(5, "Reading AOD event...");
99       ok = fReader.FillFromAOD(fRsnEvent, (AliAODEvent*)fInputEvent, fMCEvent);
100       AliDebug(5, "...done");
101       break;
102     case kESD:
103       AliDebug(5, "Reading ESD event...");
104       ok = fReader.FillFromESD(fRsnEvent, (AliESDEvent*)fInputEvent, fMCEvent);
105       AliDebug(5, "...done");
106       break;
107     case kESDMC:
108       AliDebug(5, "Reading ESD event with MC...");
109       ok = fReader.FillFromESD(fRsnEvent, (AliESDEvent*)fInputEvent, fMCEvent);
110       AliDebug(5, "...done");
111       break;
112     case kMC:
113       AliDebug(5, "Reading MC only event...");
114       ok = fReader.FillFromMC(fRsnEvent, fMCEvent);
115       AliDebug(5, "...done");
116       break;
117     default:
118       AliError("Type not supported ...");
119       return;
120   }
121   if (!ok) AliWarning("Failed reading");
122
123   // step 2: PID probability computation
124   //if (!fPID.Process(fRsnEvent)) AliWarning("Failed PID");
125
126   AliDebug(1,Form("Collected %d tracks", fRsnEvent->GetMultiplicity()));
127 }
128
129 //_____________________________________________________________________________
130 void AliRsnReaderTaskSE::Terminate(Option_t */*option*/)
131 {
132 //
133 // Inherited function.
134 // Here it does not need to do anything, so it is left dummy.
135 //
136 }