]>
Commit | Line | Data |
---|---|---|
d89b8229 | 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 | /* $Id$ */ | |
17 | ||
18 | //------------------------------------------------------------------------ | |
19 | // Jet reader base class | |
20 | // manages the reading of input for jet algorithms | |
21 | // Authors: jgcn@mda.cinvestav.mx | |
22 | // magali.estienne@subatech.in2p3.fr | |
23 | // alexandre.shabetai@cern.ch | |
24 | // | |
25 | // **February 2011 | |
26 | // implemented standard geometry (AliEMCALGeometry) (was AliJetDummyGeo implented separately in ESDReader and AODReader | |
27 | // local2master matrices are now get from $ALICE_ROOT/OADB/PWG4/JetReconstruction/EMCALlocal2master.root | |
28 | // you can choose the geometry (EMCAL_COMPLETE, EMCAL_FIRSTYEARv1, etc) via SetEMCALgeo2bLoad('Name_of_Geometry') in the Readerheader | |
29 | // different options for survey(ed) matrice are provided too | |
30 | // ** August 2011 | |
31 | // OADB path changed from '../OADB/PWG4/JetReconstruction/' to '../OADB/EMCAL/' | |
32 | // marco.bregant@subatech.in2p3.fr | |
33 | // ** 2011 | |
34 | // - AliJetESD/AODReader classes removed from JETAN. Reader now ESD/AOD independent. It uses VEvent in the AliJetFill* classes. | |
35 | // - EMCal utilities added for bad cells id, calibration, etc. | |
36 | //------------------------------------------------------------------------ | |
37 | ||
38 | // root | |
39 | #include <TFile.h> | |
40 | ||
41 | //AliRoot | |
42 | #include "AliVEvent.h" | |
43 | #include "AliAODEvent.h" | |
44 | #include "AliESDEvent.h" | |
45 | #include "AliJetReader.h" | |
46 | #include "AliJetReaderHeader.h" | |
47 | #include "AliAnalysisManager.h" | |
48 | #include "AliJetFillCalTrkTrack.h" | |
49 | #include "AliJetFillCalTrkTrackMC.h" | |
50 | #include "AliJetCalTrk.h" | |
51 | ||
3a7af7bd | 52 | using std::cout; |
53 | using std::endl; | |
d89b8229 | 54 | ClassImp(AliJetReader) |
55 | ||
56 | //////////////////////////////////////////////////////////////////////// | |
57 | ||
58 | ||
59 | AliJetReader::AliJetReader(): | |
60 | fCalTrkEvent(0x0), | |
61 | fFillEvent(0x0), | |
62 | fReaderHeader(0), | |
63 | fFillEventwTrks(0x0), | |
64 | fDebug(0), | |
65 | fVEvent(0x0), | |
66 | fMCEvent(0x0), | |
67 | fOpt(0) | |
68 | { | |
69 | // Default constructor | |
70 | } | |
71 | ||
72 | //----------------------------------------------------------------------- | |
73 | AliJetReader::~AliJetReader() | |
74 | { | |
75 | // Destructor | |
76 | if (fCalTrkEvent) { | |
77 | fCalTrkEvent->Delete(); | |
78 | delete fCalTrkEvent; | |
79 | } | |
80 | ||
81 | if (fFillEventwTrks) { | |
82 | delete fFillEventwTrks; | |
83 | } | |
84 | ||
85 | } | |
86 | ||
87 | //----------------------------------------------------------------------- | |
88 | void AliJetReader::InitTasks() | |
89 | { | |
90 | // Initialization | |
91 | fOpt = GetReaderHeader()->GetDetector(); | |
92 | ||
93 | TString datatype = fReaderHeader->GetDataType(); | |
94 | datatype.ToUpper(); | |
95 | Bool_t kIsKine = kFALSE; | |
96 | if((!datatype.Contains("AOD") && datatype.Contains("MC")) || | |
97 | (!datatype.Contains("AOD") && datatype.Contains("MC2")) ){ | |
98 | kIsKine = kTRUE; | |
99 | } | |
100 | Bool_t kIsHighMult = GetReaderHeader()->GetIsHighMult(); | |
101 | fCalTrkEvent = new AliJetCalTrkEvent(fOpt,kIsKine,kIsHighMult); | |
102 | ||
103 | // Initialize jet analysis | |
104 | CreateTasks(); | |
105 | ||
106 | } | |
107 | ||
108 | //----------------------------------------------------------------------- | |
109 | Bool_t AliJetReader::ProcessEvent() | |
110 | { | |
111 | // Process one event | |
112 | // Charged only or charged+neutral jets | |
113 | ||
114 | Bool_t ok = ExecTasks(); | |
115 | ||
116 | if(!ok) {return kFALSE;} | |
117 | ||
118 | return kTRUE; | |
119 | ||
120 | } | |
121 | ||
122 | //----------------------------------------------------------------------- | |
123 | void AliJetReader::SetInputEvent(const TObject* esd, const TObject* aod, const AliMCEvent* mc) | |
124 | { | |
125 | // set input event pointers | |
126 | if( fReaderHeader->GetDataType().Contains("AOD") && aod) {fVEvent = (AliAODEvent*) aod;} | |
127 | else if( fReaderHeader->GetDataType().Contains("ESD") && esd) {fVEvent = (AliESDEvent*) esd;} | |
128 | else if ( fReaderHeader->GetDataType().Contains("MC") || fReaderHeader->GetDataType().Contains("MC2")) { fMCEvent = (AliMCEvent*) mc;} | |
129 | else {printf("No input event ! ");} | |
130 | ||
131 | } | |
132 | ||
133 | //----------------------------------------------------------------------- | |
134 | Bool_t AliJetReader::CreateTasks() | |
135 | { | |
136 | // For reader task initialization | |
137 | ||
138 | fDebug = fReaderHeader->GetDebug(); | |
139 | ||
140 | fFillEvent = new AliJetFillCalTrkEvent(); | |
141 | if (fOpt>0) { | |
142 | // Tracks | |
143 | if(fOpt%2==!0 && fOpt!=0){ | |
144 | fFillEventwTrks = new AliJetFillCalTrkTrack(); | |
145 | fFillEventwTrks->SetReaderHeader(fReaderHeader); | |
146 | } | |
147 | } | |
148 | else { // MC/Kine cases | |
149 | fFillEventwTrks = new AliJetFillCalTrkTrackMC(); | |
150 | fFillEventwTrks->SetReaderHeader(fReaderHeader); | |
151 | } | |
152 | ||
153 | if(fDebug>1) cout << "Tasks instantiated at that stage ! " << endl; | |
154 | ||
155 | return kTRUE; | |
156 | ||
157 | } | |
158 | ||
159 | //----------------------------------------------------------------------- | |
160 | Bool_t AliJetReader::ExecTasks() | |
161 | { | |
162 | // Main function | |
163 | // Fill the reader part | |
164 | ||
165 | fDebug = fReaderHeader->GetDebug(); | |
166 | ||
167 | if(!fVEvent && !fMCEvent) { | |
168 | return kFALSE; | |
169 | } | |
170 | ||
171 | // TPC only or Digits+TPC or Clusters+TPC | |
172 | if(fOpt%2==!0 || fOpt==0){ | |
173 | fFillEventwTrks->SetVEvent(fVEvent); | |
174 | fFillEventwTrks->SetMCEvent(fMCEvent); | |
175 | fFillEventwTrks->SetCalTrkEvent(fCalTrkEvent); | |
176 | fFillEventwTrks->Exec("tpc"); | |
177 | } | |
178 | ||
179 | return kTRUE; | |
180 | ||
181 | } | |
182 | ||
183 | //----------------------------------------------------------------------- | |
184 | void AliJetReader::WriteRHeaderToFile() const | |
185 | { | |
186 | // write reader header | |
187 | AliJetReaderHeader *rh = GetReaderHeader(); | |
188 | rh->Write(); | |
189 | ||
190 | } | |
191 | ||
192 | //----------------------------------------------------------------------- | |
193 | void AliJetReader::WriteReaderHeader() | |
194 | { | |
195 | // Write the Headers | |
196 | TFile* f = new TFile("jets_local.root", "recreate"); | |
197 | WriteRHeaderToFile(); | |
198 | f->Close(); | |
199 | ||
200 | } | |
201 |