]>
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 | ||
52 | ClassImp(AliJetReader) | |
53 | ||
54 | //////////////////////////////////////////////////////////////////////// | |
55 | ||
56 | ||
57 | AliJetReader::AliJetReader(): | |
58 | fCalTrkEvent(0x0), | |
59 | fFillEvent(0x0), | |
60 | fReaderHeader(0), | |
61 | fFillEventwTrks(0x0), | |
62 | fDebug(0), | |
63 | fVEvent(0x0), | |
64 | fMCEvent(0x0), | |
65 | fOpt(0) | |
66 | { | |
67 | // Default constructor | |
68 | } | |
69 | ||
70 | //----------------------------------------------------------------------- | |
71 | AliJetReader::~AliJetReader() | |
72 | { | |
73 | // Destructor | |
74 | if (fCalTrkEvent) { | |
75 | fCalTrkEvent->Delete(); | |
76 | delete fCalTrkEvent; | |
77 | } | |
78 | ||
79 | if (fFillEventwTrks) { | |
80 | delete fFillEventwTrks; | |
81 | } | |
82 | ||
83 | } | |
84 | ||
85 | //----------------------------------------------------------------------- | |
86 | void AliJetReader::InitTasks() | |
87 | { | |
88 | // Initialization | |
89 | fOpt = GetReaderHeader()->GetDetector(); | |
90 | ||
91 | TString datatype = fReaderHeader->GetDataType(); | |
92 | datatype.ToUpper(); | |
93 | Bool_t kIsKine = kFALSE; | |
94 | if((!datatype.Contains("AOD") && datatype.Contains("MC")) || | |
95 | (!datatype.Contains("AOD") && datatype.Contains("MC2")) ){ | |
96 | kIsKine = kTRUE; | |
97 | } | |
98 | Bool_t kIsHighMult = GetReaderHeader()->GetIsHighMult(); | |
99 | fCalTrkEvent = new AliJetCalTrkEvent(fOpt,kIsKine,kIsHighMult); | |
100 | ||
101 | // Initialize jet analysis | |
102 | CreateTasks(); | |
103 | ||
104 | } | |
105 | ||
106 | //----------------------------------------------------------------------- | |
107 | Bool_t AliJetReader::ProcessEvent() | |
108 | { | |
109 | // Process one event | |
110 | // Charged only or charged+neutral jets | |
111 | ||
112 | Bool_t ok = ExecTasks(); | |
113 | ||
114 | if(!ok) {return kFALSE;} | |
115 | ||
116 | return kTRUE; | |
117 | ||
118 | } | |
119 | ||
120 | //----------------------------------------------------------------------- | |
121 | void AliJetReader::SetInputEvent(const TObject* esd, const TObject* aod, const AliMCEvent* mc) | |
122 | { | |
123 | // set input event pointers | |
124 | if( fReaderHeader->GetDataType().Contains("AOD") && aod) {fVEvent = (AliAODEvent*) aod;} | |
125 | else if( fReaderHeader->GetDataType().Contains("ESD") && esd) {fVEvent = (AliESDEvent*) esd;} | |
126 | else if ( fReaderHeader->GetDataType().Contains("MC") || fReaderHeader->GetDataType().Contains("MC2")) { fMCEvent = (AliMCEvent*) mc;} | |
127 | else {printf("No input event ! ");} | |
128 | ||
129 | } | |
130 | ||
131 | //----------------------------------------------------------------------- | |
132 | Bool_t AliJetReader::CreateTasks() | |
133 | { | |
134 | // For reader task initialization | |
135 | ||
136 | fDebug = fReaderHeader->GetDebug(); | |
137 | ||
138 | fFillEvent = new AliJetFillCalTrkEvent(); | |
139 | if (fOpt>0) { | |
140 | // Tracks | |
141 | if(fOpt%2==!0 && fOpt!=0){ | |
142 | fFillEventwTrks = new AliJetFillCalTrkTrack(); | |
143 | fFillEventwTrks->SetReaderHeader(fReaderHeader); | |
144 | } | |
145 | } | |
146 | else { // MC/Kine cases | |
147 | fFillEventwTrks = new AliJetFillCalTrkTrackMC(); | |
148 | fFillEventwTrks->SetReaderHeader(fReaderHeader); | |
149 | } | |
150 | ||
151 | if(fDebug>1) cout << "Tasks instantiated at that stage ! " << endl; | |
152 | ||
153 | return kTRUE; | |
154 | ||
155 | } | |
156 | ||
157 | //----------------------------------------------------------------------- | |
158 | Bool_t AliJetReader::ExecTasks() | |
159 | { | |
160 | // Main function | |
161 | // Fill the reader part | |
162 | ||
163 | fDebug = fReaderHeader->GetDebug(); | |
164 | ||
165 | if(!fVEvent && !fMCEvent) { | |
166 | return kFALSE; | |
167 | } | |
168 | ||
169 | // TPC only or Digits+TPC or Clusters+TPC | |
170 | if(fOpt%2==!0 || fOpt==0){ | |
171 | fFillEventwTrks->SetVEvent(fVEvent); | |
172 | fFillEventwTrks->SetMCEvent(fMCEvent); | |
173 | fFillEventwTrks->SetCalTrkEvent(fCalTrkEvent); | |
174 | fFillEventwTrks->Exec("tpc"); | |
175 | } | |
176 | ||
177 | return kTRUE; | |
178 | ||
179 | } | |
180 | ||
181 | //----------------------------------------------------------------------- | |
182 | void AliJetReader::WriteRHeaderToFile() const | |
183 | { | |
184 | // write reader header | |
185 | AliJetReaderHeader *rh = GetReaderHeader(); | |
186 | rh->Write(); | |
187 | ||
188 | } | |
189 | ||
190 | //----------------------------------------------------------------------- | |
191 | void AliJetReader::WriteReaderHeader() | |
192 | { | |
193 | // Write the Headers | |
194 | TFile* f = new TFile("jets_local.root", "recreate"); | |
195 | WriteRHeaderToFile(); | |
196 | f->Close(); | |
197 | ||
198 | } | |
199 |