]> git.uio.no Git - u/mrichter/AliRoot.git/blame - JETAN/AliJetReader.cxx
Avoid use of fastjet typedef/enum for setter of algorithm
[u/mrichter/AliRoot.git] / JETAN / AliJetReader.cxx
CommitLineData
99e5fe42 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
83a444b1 16//------------------------------------------------------------------------
99e5fe42 17// Jet reader base class
18// manages the reading of input for jet algorithms
b45b0c92 19// Authors: jgcn@mda.cinvestav.mx
20// magali.estienne@IReS.in2p3.fr
f45e6f72 21//
22// **February 2011
f445ed00 23// implemented standard geometry (AliEMCALGeometry) (was AliJetDummyGeo implented separately in ESDReader and AODReader
f45e6f72 24// local2master matrices are now get from $ALICE_ROOT/OADB/PWG4/JetReconstruction/EMCALlocal2master.root
25// you can choose the geometry (EMCAL_COMPLETE, EMCAL_FIRSTYEARv1, etc) via SetEMCALgeo2bLoad('Name_of_Geometry') in the Readerheader
26// different options for survey(ed) matrice are provided too
9990e729 27// ** August 2011
28// OADB path changed from '../OADB/PWG4/JetReconstruction/' to '../OADB/EMCAL/'
f45e6f72 29// marco.bregant@subatech.in2p3.fr
30//-------------------------------------------------------------------------
99e5fe42 31
83a444b1 32// root
f45e6f72 33#include <TSystem.h>
34#include <TString.h>
99e5fe42 35#include <TClonesArray.h>
ee7de0dd 36#include <TRefArray.h>
37#include "TTask.h"
f45e6f72 38#include <TGeoManager.h>
83a444b1 39//AliRoot
f45e6f72 40#include "AliLog.h"
99e5fe42 41#include "AliJetReader.h"
42#include "AliJetReaderHeader.h"
ee7de0dd 43#include "AliESDEvent.h"
44#include "AliHeader.h"
f445ed00 45#include "AliEMCALGeometry.h"
f45e6f72 46#include "AliEMCALEMCGeometry.h"
be6e5811 47#include "AliJetESDFillUnitArrayTracks.h"
48#include "AliJetESDFillUnitArrayEMCalDigits.h"
7aec0427 49#include "AliJetUnitArray.h"
50#include "AliJetHadronCorrectionv1.h"
f45e6f72 51#include "AliOADBContainer.h"
99e5fe42 52
3a7af7bd 53using std::cout;
54using std::endl;
99e5fe42 55ClassImp(AliJetReader)
56
57////////////////////////////////////////////////////////////////////////
f445ed00 58AliEMCALGeometry *AliJetReader::fGeom=0;
8838ab7a 59
1b7d5d7e 60AliJetReader::AliJetReader():
ee7de0dd 61 // Constructor
f45e6f72 62 fJetanOADBpath(""),
ee7de0dd 63 fChain(0),
8838ab7a 64 fTree(0),
65 fMomentumArray(new TClonesArray("TLorentzVector",4000)),
1b7d5d7e 66 fArrayMC(0),
b45b0c92 67 fFillUnitArray(new TTask("fillUnitArray","Fill unit array jet finder")),
ee7de0dd 68 fESD(0),
1b7d5d7e 69 fReaderHeader(0),
8838ab7a 70 fAliHeader(0),
1b7d5d7e 71 fSignalFlag(0),
b45b0c92 72 fCutFlag(0),
ee7de0dd 73 fUnitArray(new TClonesArray("AliJetUnitArray",60000)),
ee7de0dd 74 fArrayInitialised(0),
be6e5811 75 fFillUAFromTracks(new AliJetESDFillUnitArrayTracks()),
76 fFillUAFromEMCalDigits(new AliJetESDFillUnitArrayEMCalDigits()),
9e4cc50d 77 fNumCandidate(0),
8838ab7a 78 fNumCandidateCut(0),
79 fHadronCorrector(0),
80 fHCorrection(0),
81 fECorrection(0),
f45e6f72 82 fEFlag(kFALSE),
83 fDebug(0)
99e5fe42 84{
1b7d5d7e 85 // Default constructor
8011d399 86 fSignalFlag = TArrayI();
b45b0c92 87 fCutFlag = TArrayI();
99e5fe42 88}
89
90////////////////////////////////////////////////////////////////////////
91
92AliJetReader::~AliJetReader()
93{
94 // Destructor
8838ab7a 95 if (fMomentumArray) {
96 fMomentumArray->Delete();
97 delete fMomentumArray;
98 }
99
100 if (fUnitArray) {
101 fUnitArray->Delete();
102 delete fUnitArray;
103 }
104
8838ab7a 105 if (fFillUnitArray) {
8838ab7a 106 delete fFillUnitArray;
107 }
026b032e 108 if (fArrayMC) {
109 fArrayMC->Delete();
110 delete fArrayMC;
111 }
8838ab7a 112
99e5fe42 113}
114
99e5fe42 115////////////////////////////////////////////////////////////////////////
116
117void AliJetReader::ClearArray()
99e5fe42 118{
119 if (fMomentumArray) fMomentumArray->Clear();
b45b0c92 120 if (fFillUnitArray) fFillUnitArray->Clear();
99e5fe42 121}
f45e6f72 122
123Bool_t AliJetReader::SetEMCALGeometry()
124{
125 //
126 // Set the EMCal Geometry
127 //
128
129 fDebug = fReaderHeader->GetDebug();
130
131 if(fGeom != 0){
132 Info(" SetEMCALGeometry:","was already done.. it's called just once !!");
133 return kTRUE;
134 }
135
136 if(fDebug>9) cout<<"JetReader: Setting EMCALGeometry"<<endl;
137
138//path to the OADB file
139
140
141 TString myPath= fReaderHeader ->GetMyOADBfile();
142 TString OADBfile;
143
144 Bool_t customFile=kFALSE;
145
146if(myPath.Length()) {
147 Info(" SetEMCALGeometry","custom version of OADB file: %s",myPath.Data());
148 customFile=kTRUE;
149 OADBfile=myPath;
9990e729 150 } else OADBfile.Form("%s/EMCAL/EMCALlocal2master.root",(const char*) fJetanOADBpath);
f45e6f72 151
152 AliOADBContainer EMCALgeoCont;
153 Info(" SetEMCALGeometry"," I'm going to read the matrices from %s",OADBfile.Data());
154 TObjArray *EmcalMatrArray;
155 if(fDebug>19) cout<<"array definito"<<endl;
156
157 EMCALgeoCont.InitFromFile((char*) OADBfile.Data(),"AliEMCALgeo");
158 EMCALgeoCont.GetDefaultList()->Print();
159
160 const char* geoType= fReaderHeader -> GetEMCALgeo2bLoad();
161 if(fDebug>19) cout<<"geometry: "<<geoType<<endl;
162
163 const char* loc2master = ((AliJetESDReaderHeader*) fReaderHeader)->GetEMCALmatrices2bLoad();
164 if(fDebug>19) cout<<"matrices: "<<loc2master<<endl;
165
166
167 if(fDebug>9) cout<<"geometry type is: "<<geoType<<endl;
168 if(fDebug>9) cout<<"survey matrices are: "<<loc2master<<endl;
169
170 // some crosschecks to avoid not existing cases
171 if(!(!strcmp(geoType, "EMCAL_COMPLETE") || !strcmp(geoType, "EMCAL_COMPLETEV1") || !strcmp(geoType, "EMCAL_FIRSTYEARV1")) )
172 Warning(" SetEMCALGeometry","%s is not a known good geometry! either your are using an old one or everything will crash right now!",geoType);
173
174 if(! (!strcmp(loc2master, "survey10") || !strcmp(loc2master, "survey11") || !strcmp(loc2master, "ideal") || !strcmp(loc2master, "test")) ) {
175 Warning(" SetEMCALGeometry"," %s is not one of the allowed cases (listed few lines above) !!----!!!", loc2master);
176 loc2master="survey11";
177 Warning(" SetEMCALGeometry"," to avoid crashes, your decision has been overrulled!, matrices '%s' will be used instead",loc2master);
178 if(fDebug>9) cout<<"survey matrices are (new, after overrulling): "<<loc2master<<endl;
179 }
180
181
182 // some warning for not so orthodox combination
183 if(!strcmp(geoType, "EMCAL_COMPLETE"))
184 Warning(" SetEMCALGeometry:", "!!----!! this geometry contains wrong tilt angles for stripmodules.. are you really sure? please consider using EMCAL_COMPLETEV1 !! ---!! ");
185 if( !strcmp(loc2master, "survey11") && strcmp(geoType, "EMCAL_COMPLETEV1") )
186 Warning(" SetEMCALGeometry:", "!!----!! survey11 matrices should be used with EMCAL_COMPLETEV1 geometry !!---!!");
187 if( !strcmp(loc2master, "survey10") && strcmp(geoType, "EMCAL_FIRSTYEARV1") )
188 Warning(" SetEMCALGeometry", "!!----!! survey10 matrices should be used ONLY with EMCAL_FIRSTYEARV1 geometry!!");
189 if(!strcmp(loc2master,"ideal"))
190 Warning(" SetEMCALGeometry","!!----!! ideal matrices are without any survey (misalignment correction)... is it really what you want?");
191 if(!strcmp(loc2master,"test") && !customFile)
192 Warning(" SetEMCALGeometry","!!----!! 'test' matrices will be used. but it seems you didn't provide a custom version of OADB file, the default 'test' is as 'ideal', no survey (misalignment correction) !!----!!");
193 if(!strcmp(loc2master,"test") && customFile)
194 Info(" SetEMCALGeometry"," !!----!! 'test' matrices read from the custom file you provided !!----!!");
195
196 EmcalMatrArray=(TObjArray*)EMCALgeoCont.GetObject(100,(char*) loc2master);
197
198
199 // Define EMCAL geometry
200
201 if(fDebug>10) cout<<"which EMCALgeometry is going to be uploaded?"<<geoType<<endl;
f445ed00 202 fGeom = AliEMCALGeometry::GetInstance(geoType);
f45e6f72 203
204
205 for (Int_t mod=0;mod<(fGeom->GetEMCGeometry())->GetNumberOfSuperModules();mod+=1)
206 {
207 fGeom->SetMisalMatrix(((TGeoHMatrix*) EmcalMatrArray->At(mod)),mod);
208 if(fDebug>9) cout<<"and the matrix is: SM "<<mod<<" (to print the matrix, fDebug>11!) "<<endl;
209 if(fDebug>11) {
210 cout<<"print the matrix, (will it work?)"<<endl;
211 ((TGeoHMatrix*) EmcalMatrArray->At(mod))->Print();
212 cout<<"if you read that, it did!"<<endl;
213 }
214}
215
216 Info("\n SetEMCALGeometry:"," EMCal Geometry set ! \n");
217
218 return kTRUE;
219}