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 **************************************************************************/
16 //----------------------------------------------------------------------------------
17 // Class AliRsnReaderTaskSE
18 // ------------------------
19 // Reader for conversion of ESD output into the internal format
20 // used for resonance study.
22 // original author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
24 // adapted for Analysis Framework
25 // by : R. Vernet (email: renaud.vernet@cern.ch)
26 //----------------------------------------------------------------------------------
28 #include <Riostream.h>
32 #include "AliAnalysisManager.h"
33 #include "AliMCEventHandler.h"
34 #include "AliMCEvent.h"
35 #include "AliESDInputHandler.h"
36 #include "AliAODInputHandler.h"
37 #include "AliAODHandler.h"
39 #include "AliRsnEvent.h"
40 #include "AliRsnReader.h"
41 #include "AliRsnPID.h"
42 #include "AliRsnReaderTaskSE.h"
44 ClassImp(AliRsnReaderTaskSE)
46 //_____________________________________________________________________________
47 AliRsnReaderTaskSE::AliRsnReaderTaskSE() :
53 //=========================================================
54 // Default constructor (not recommended)
55 //=========================================================
58 //_____________________________________________________________________________
59 AliRsnReaderTaskSE::AliRsnReaderTaskSE(const char *name) :
60 AliAnalysisTaskSE(name),
65 //=========================================================
66 // Working constructor (recommended)
67 // Initializes the reader and PID objects.
68 //=========================================================
70 fReader = new AliRsnReader;
74 //_____________________________________________________________________________
75 AliRsnReaderTaskSE::AliRsnReaderTaskSE(const AliRsnReaderTaskSE& obj) :
76 AliAnalysisTaskSE(obj),
81 //=========================================================
82 // Copy constructor (not recommended)
83 //=========================================================
86 //_____________________________________________________________________________
87 AliRsnReaderTaskSE& AliRsnReaderTaskSE::operator=(const AliRsnReaderTaskSE& /*obj*/)
89 //=========================================================
90 // Assignment operator (not recommended)
91 //=========================================================
93 AliInfo("Not implemented. Avoid using the assignment operator");
97 //_____________________________________________________________________________
98 void AliRsnReaderTaskSE::UserCreateOutputObjects()
100 //=========================================================
101 // Create the output container
102 //=========================================================
104 AliDebug(1, "Creating USER output objects");
106 // check for existence of reader, otherwise abort
108 AliFatal("Event reader not initialized. Impossible to continue");
112 AliFatal("PID manager not initialized. Impossible to continue");
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);
121 fRsnEvent = new AliRsnEvent();
122 fRsnEvent->SetName("rsnEvents");
124 AddAODBranch("AliRsnEvent", &fRsnEvent);
127 //_____________________________________________________________________________
128 void AliRsnReaderTaskSE::Init()
130 //=========================================================
132 //=========================================================
134 AliDebug(1, "Initializing");
137 //_____________________________________________________________________________
138 void AliRsnReaderTaskSE::UserExec(Option_t */*option*/)
140 //=========================================================
141 // Loops on input container to store data of all tracks.
142 // Uses the AliRsnReader methods to save them in the output.
143 //=========================================================
146 AliInfo(Form("Reading event %d", ++fEntry));
148 // clear previous sample
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()));
157 //_____________________________________________________________________________
158 void AliRsnReaderTaskSE::Terminate(Option_t */*option*/)
160 //=========================================================
161 // Terminate analysis
162 //=========================================================
164 AliDebug(1, "Terminating");