]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnReaderTaskSE.cxx
temporary place holder
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnReaderTaskSE.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15
16 //----------------------------------------------------------------------------------
17 //  Class AliRsnReaderTaskSE
18 // ------------------------
19 // Reader for conversion of ESD output into the internal format
20 // used for resonance study.
21 // ---
22 // original author: A. Pulvirenti             (email: alberto.pulvirenti@ct.infn.it)
23 // ---
24 // adapted for Analysis Framework
25 // by    : R. Vernet                          (email: renaud.vernet@cern.ch)
26 //----------------------------------------------------------------------------------
27
28 #include <Riostream.h>
29
30 #include "AliLog.h"
31
32 #include "AliAnalysisManager.h"
33 #include "AliMCEventHandler.h"
34 #include "AliMCEvent.h"
35 #include "AliESDInputHandler.h"
36 #include "AliAODInputHandler.h"
37 #include "AliAODHandler.h"
38
39 #include "AliRsnEvent.h"
40 #include "AliRsnReader.h"
41 #include "AliRsnPID.h"
42 #include "AliRsnReaderTaskSE.h"
43
44 ClassImp(AliRsnReaderTaskSE)
45
46 //_____________________________________________________________________________
47 AliRsnReaderTaskSE::AliRsnReaderTaskSE() :
48   AliAnalysisTaskSE(),
49   fReader(0x0),
50   fPID(0x0),
51   fRsnEvent(0x0)
52 {
53 //=========================================================
54 // Default constructor (not recommended)
55 //=========================================================
56 }
57
58 //_____________________________________________________________________________
59 AliRsnReaderTaskSE::AliRsnReaderTaskSE(const char *name) :
60   AliAnalysisTaskSE(name),
61   fReader(0x0),
62   fPID(0x0),
63   fRsnEvent(0x0)
64 {
65 //=========================================================
66 // Working constructor (recommended)
67 // Initializes the reader and PID objects.
68 //=========================================================
69
70     fReader = new AliRsnReader;
71     fPID = new AliRsnPID;
72 }
73
74 //_____________________________________________________________________________
75 AliRsnReaderTaskSE::AliRsnReaderTaskSE(const AliRsnReaderTaskSE& obj) :
76   AliAnalysisTaskSE(obj),
77   fReader(obj.fReader),
78   fPID(obj.fPID),
79   fRsnEvent(0x0)
80 {
81 //=========================================================
82 // Copy constructor (not recommended)
83 //=========================================================
84 }
85
86 //_____________________________________________________________________________
87 AliRsnReaderTaskSE& AliRsnReaderTaskSE::operator=(const AliRsnReaderTaskSE& /*obj*/)
88 {
89 //=========================================================
90 // Assignment operator (not recommended)
91 //=========================================================
92
93     AliInfo("Not implemented. Avoid using the assignment operator");
94         return *this;
95 }
96
97 //_____________________________________________________________________________
98 void AliRsnReaderTaskSE::UserCreateOutputObjects()
99 {
100 //=========================================================
101 // Create the output container
102 //=========================================================
103
104     AliDebug(1, "Creating USER output objects");
105
106     // check for existence of reader, otherwise abort
107     if (!fReader) {
108         AliFatal("Event reader not initialized. Impossible to continue");
109         return;
110     }
111     if (!fPID) {
112         AliFatal("PID manager not initialized. Impossible to continue");
113         return;
114     }
115     else {
116         // the PID object is always used in realistic mode here
117         // to fill the "realistic" index array in AliRsnEvent
118         fPID->SetMethod(AliRsnPID::kRealistic);
119     }
120
121     fRsnEvent = new AliRsnEvent();
122     fRsnEvent->SetName("rsnEvents");
123     fRsnEvent->Init();
124     AddAODBranch("AliRsnEvent", &fRsnEvent);
125 }
126
127 //_____________________________________________________________________________
128 void AliRsnReaderTaskSE::Init()
129 {
130 //=========================================================
131 // Initialization
132 //=========================================================
133
134     AliDebug(1, "Initializing");
135 }
136
137 //_____________________________________________________________________________
138 void AliRsnReaderTaskSE::UserExec(Option_t */*option*/)
139 {
140 //=========================================================
141 // Loops on input container to store data of all tracks.
142 // Uses the AliRsnReader methods to save them in the output.
143 //=========================================================
144
145     // static counter
146     AliInfo(Form("Reading event %d", ++fEntry));
147
148     // clear previous sample
149     fRsnEvent->Clear();
150
151     // read event, identify
152     if (!fReader->Fill(fRsnEvent, fInputEvent, fMCEvent)) AliWarning("Failed reading");
153     if (!fPID->Identify(fRsnEvent)) AliWarning("Failed PID");
154     AliInfo(Form("Collected %d tracks", fRsnEvent->GetMultiplicity()));
155 }
156
157 //_____________________________________________________________________________
158 void AliRsnReaderTaskSE::Terminate(Option_t */*option*/)
159 {
160 //=========================================================
161 // Terminate analysis
162 //=========================================================
163
164     AliDebug(1, "Terminating");
165 }