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