]>
Commit | Line | Data |
---|---|---|
4060dd2d | 1 | |
2 | /************************************************************************** | |
3 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * * | |
5 | * Author: The ALICE Off-line Project. * | |
6 | * Contributors are mentioned in the code where appropriate. * | |
7 | * * | |
8 | * Permission to use, copy, modify and distribute this software and its * | |
9 | * documentation strictly for non-commercial purposes is hereby granted * | |
10 | * without fee, provided that the above copyright notice appears in all * | |
11 | * copies and that both the copyright notice and this permission notice * | |
12 | * appear in the supporting documentation. The authors make no claims * | |
13 | * about the suitability of this software for any purpose. It is * | |
14 | * provided "as is" without express or implied warranty. * | |
15 | **************************************************************************/ | |
16 | ||
ba06aaec | 17 | //------------------------------------------------------------------------------ |
18 | // Implementation of AliPerformancePtCalib class. It fills histograms with ESD or | |
4060dd2d | 19 | // TPC track information to study charge/pt spectra. |
ba06aaec | 20 | // To analyse the output of AliPerformancePtCalib use AliPerfAnalyzeInvPt class: |
4060dd2d | 21 | // Projection of charge/pt vs theta and vs phi resp. histoprams will be fitted |
22 | // with either polynomial or gaussian fit function to extract minimum position of | |
23 | // charge/pt. | |
ba06aaec | 24 | // Fit options and theta, phi bins can be set by user. |
4060dd2d | 25 | // Attention: use the Set functions of AliPerformancePtCalib when running |
ba06aaec | 26 | // AliPerformancePtCalib::Analyse() |
27 | // The result of the analysis (histograms/graphs) are stored in the folder which is | |
4060dd2d | 28 | // a data member of AliPerformancePtCalib. |
ba06aaec | 29 | // |
30 | // Author: S.Schuchmann 11/13/2009 | |
6bcacaf1 | 31 | // sschuchm@ikf.uni-frankfurt.de |
ba06aaec | 32 | //------------------------------------------------------------------------------ |
acb9d358 | 33 | |
ba06aaec | 34 | /* |
35 | ||
4060dd2d | 36 | // after running the performance task, read the file, and get component |
acb9d358 | 37 | |
ba06aaec | 38 | TFile f("Output.root"); |
39 | AliPerformancePtCalib * compObj = (AliPerformancePtCalib*)coutput->FindObject("AliPerformancePtCalib"); | |
40 | ||
4060dd2d | 41 | // set phi and theta bins for fitting and analyse comparison data |
42 | compObj->SetProjBinsTheta(thetaBins,nThetaBins,minPhi, maxPhi); | |
43 | compObj->SetProjBinsPhi(phiBins,nPhiBins,minTheta,maxTheta); | |
44 | compObj->SetMakeFitOption(kFALSE,exclRange,fitRange); | |
45 | compObj->SetDoRebin(rebin); | |
ba06aaec | 46 | compObj->Analyse(); |
4060dd2d | 47 | //details see functions of this class |
acb9d358 | 48 | |
ba06aaec | 49 | // the output histograms/graphs will be stored in the folder "folderRes" |
50 | compObj->GetAnalysisFolder()->ls("*"); | |
acb9d358 | 51 | |
ba06aaec | 52 | // user can save whole comparison object (or only folder with anlysed histograms) |
53 | // in the seperate output file (e.g.) | |
54 | TFile fout("Analysed_InvPt.root","recreate"); | |
55 | compObj->Write(); // compObj->GetAnalysisFolder()->Write(); | |
56 | fout.Close(); | |
acb9d358 | 57 | |
ba06aaec | 58 | */ |
59 | #include "TH1F.h" | |
60 | #include "TH2F.h" | |
4060dd2d | 61 | #include "THnSparse.h" |
ba06aaec | 62 | #include "TList.h" |
63 | #include "TMath.h" | |
64 | #include "TFolder.h" | |
4060dd2d | 65 | |
ba06aaec | 66 | #include "AliESDEvent.h" |
67 | #include "AliESDtrack.h" | |
68 | #include "AliESDfriendTrack.h" | |
69 | #include "AliESDfriend.h" | |
70 | #include "AliESDtrackCuts.h" | |
fbe2204e | 71 | #include "AliESDpid.h" |
acb9d358 | 72 | |
73 | #include "AliPerfAnalyzeInvPt.h" | |
acb9d358 | 74 | #include "AliPerformancePtCalib.h" |
75 | ||
76 | using namespace std; | |
77 | ||
78 | ClassImp(AliPerformancePtCalib) | |
79 | ||
80 | //________________________________________________________________________ | |
4823e4d4 | 81 | AliPerformancePtCalib::AliPerformancePtCalib(const Char_t* name, const Char_t* title): |
acb9d358 | 82 | AliPerformanceObject(name,title), |
83 | ||
ba06aaec | 84 | // option parameter for AliPerformancePtCalib::Analyse() |
acb9d358 | 85 | fNThetaBins(0), |
86 | fNPhiBins(0), | |
4060dd2d | 87 | fMaxPhi(0), |
88 | fMinPhi(0), | |
89 | fMaxTheta(0), | |
90 | fMinTheta(0), | |
acb9d358 | 91 | fRange(0), |
92 | fExclRange(0), | |
93 | fFitGaus(0) , | |
6bcacaf1 | 94 | fDoRebin(0), |
95 | fRebin(0), | |
4060dd2d | 96 | // option parameter for user defined charge/pt shift |
ba06aaec | 97 | fShift(0), |
98 | fDeltaInvP(0), | |
4060dd2d | 99 | //options for cuts |
acb9d358 | 100 | fOptTPC(0), |
ba06aaec | 101 | fESDcuts(0), |
fbe2204e | 102 | fPions(0), |
ba06aaec | 103 | fEtaAcceptance(0), |
ba06aaec | 104 | fCutsRC(0), |
105 | fCutsMC(0), | |
acb9d358 | 106 | fList(0), |
acb9d358 | 107 | // histograms |
4060dd2d | 108 | fHistInvPtPtThetaPhi(0), |
ba06aaec | 109 | fHistPtShift0(0), |
110 | fHistPrimaryVertexPosX(0), | |
111 | fHistPrimaryVertexPosY(0), | |
112 | fHistPrimaryVertexPosZ(0), | |
113 | fHistTrackMultiplicity(0), | |
114 | fHistTrackMultiplicityCuts(0), | |
115 | ||
116 | fHistTPCMomentaPosP(0), | |
117 | fHistTPCMomentaNegP(0), | |
118 | fHistTPCMomentaPosPt(0), | |
119 | fHistTPCMomentaNegPt(0), | |
acb9d358 | 120 | fHistUserPtShift(0), |
fbe2204e | 121 | fHistdedxPions(0), |
122 | //esd track cuts | |
ba06aaec | 123 | fESDTrackCuts(0), |
fbe2204e | 124 | //pid |
125 | fESDpid(0), | |
ba06aaec | 126 | // analysis folder |
127 | fAnalysisFolder(0) | |
4060dd2d | 128 | |
acb9d358 | 129 | |
130 | { | |
ba06aaec | 131 | // Constructor |
132 | fShift = kFALSE; | |
133 | fDeltaInvP = 0.00; | |
134 | //options for cuts | |
135 | fOptTPC = kTRUE; // read TPC tracks yes/no | |
4060dd2d | 136 | fESDcuts = kFALSE; |
fbe2204e | 137 | fPions = kFALSE; |
ba06aaec | 138 | fCutsRC = NULL; |
139 | fCutsMC = NULL; | |
140 | ||
141 | //esd track cut options | |
142 | fEtaAcceptance = 0.8; | |
ba06aaec | 143 | |
144 | // options for function AliPerformancePtCalibMC::Analyse() | |
145 | fFitGaus = kFALSE;// use gaussian function for fitting charge/pt yes/no | |
146 | fNThetaBins = 0; //number of theta bins | |
147 | fNPhiBins = 0; //number of phi bins | |
4060dd2d | 148 | fMaxPhi = 6.5;// max phi for 2D projection on theta and charge/pt axis |
149 | fMinPhi = 0.0;// min phi for 2D projection on theta and charge/pt axis | |
150 | fMaxTheta = 3.0;// max theta for 2D projection on phi and charge/pt axis | |
151 | fMinTheta = 0.0;// min theta for 2D projection on phi and charge/pt axis | |
ba06aaec | 152 | fRange = 0; //fit range around 0 |
153 | fExclRange =0; //range of rejection of points around 0 | |
6bcacaf1 | 154 | fDoRebin = kFALSE; |
155 | fRebin = 0; | |
acb9d358 | 156 | |
18e588e9 | 157 | for(Int_t i=0; i<100; i++) { |
158 | fThetaBins[i] = 0.0; | |
159 | fPhiBins[i] = 0.0; | |
160 | } | |
161 | ||
162 | ||
ba06aaec | 163 | Init(); |
acb9d358 | 164 | } |
4060dd2d | 165 | //________________________________________________________________________ |
acb9d358 | 166 | AliPerformancePtCalib::~AliPerformancePtCalib() { |
ba06aaec | 167 | // |
168 | // destructor | |
169 | // | |
4060dd2d | 170 | |
171 | if(fList) delete fList; | |
172 | // histograms | |
173 | if( fHistInvPtPtThetaPhi) delete fHistInvPtPtThetaPhi;fHistInvPtPtThetaPhi=0; | |
174 | if(fHistPtShift0) delete fHistPtShift0;fHistPtShift0=0; | |
175 | if(fHistPrimaryVertexPosX) delete fHistPrimaryVertexPosX;fHistPrimaryVertexPosX=0; | |
176 | if(fHistPrimaryVertexPosY) delete fHistPrimaryVertexPosY;fHistPrimaryVertexPosY=0; | |
177 | if(fHistPrimaryVertexPosZ) delete fHistPrimaryVertexPosZ;fHistPrimaryVertexPosZ=0; | |
178 | if(fHistTrackMultiplicity) delete fHistTrackMultiplicity;fHistTrackMultiplicity=0; | |
179 | if(fHistTrackMultiplicityCuts) delete fHistTrackMultiplicityCuts;fHistTrackMultiplicityCuts=0; | |
180 | ||
181 | if(fHistTPCMomentaPosP) delete fHistTPCMomentaPosP;fHistTPCMomentaPosP=0; | |
182 | if(fHistTPCMomentaNegP) delete fHistTPCMomentaNegP;fHistTPCMomentaNegP=0; | |
183 | if(fHistTPCMomentaPosPt) delete fHistTPCMomentaPosPt;fHistTPCMomentaPosPt=0; | |
184 | if(fHistTPCMomentaNegPt) delete fHistTPCMomentaNegPt ;fHistTPCMomentaNegPt=0; | |
185 | if(fHistUserPtShift) delete fHistUserPtShift;fHistUserPtShift=0; | |
c2b8d123 | 186 | if(fHistdedxPions) delete fHistdedxPions;fHistdedxPions=0; |
fbe2204e | 187 | //esd track cuts |
c2b8d123 | 188 | if(fESDTrackCuts) delete fESDTrackCuts;fESDTrackCuts=0; |
fbe2204e | 189 | //pid |
190 | if(fESDpid) delete fESDpid;fESDpid=0; | |
4060dd2d | 191 | //analysis folder |
ba06aaec | 192 | if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0; |
acb9d358 | 193 | } |
194 | ||
195 | //________________________________________________________________________ | |
196 | void AliPerformancePtCalib::Init() | |
197 | { | |
ba06aaec | 198 | // Create histograms |
199 | // Called once | |
acb9d358 | 200 | |
201 | fList = new TList(); | |
ba06aaec | 202 | // init folder |
203 | fAnalysisFolder = CreateFolder("folderPt_TPC","Analysis Pt Resolution Folder"); | |
aa4776c7 | 204 | |
ba06aaec | 205 | // Primary Vertex: |
206 | fHistPrimaryVertexPosX = new TH1F("fHistPrimaryVertexPosX", "Primary Vertex Position X;Primary Vertex Position X (cm);Events",100,-0.5,0.5); | |
207 | fList->Add(fHistPrimaryVertexPosX); | |
208 | fHistPrimaryVertexPosY = new TH1F("fHistPrimaryVertexPosY", "Primary Vertex Position Y;Primary Vertex Position Y (cm);Events",100,-0.5,0.5); | |
209 | fList->Add(fHistPrimaryVertexPosY); | |
210 | fHistPrimaryVertexPosZ = new TH1F("fHistPrimaryVertexPosZ", "Primary Vertex Position Z;Primary Vertex Position Z (cm);Events",200,-2.0,2.0); | |
211 | fList->Add(fHistPrimaryVertexPosZ); | |
212 | // Multiplicity: | |
213 | fHistTrackMultiplicity = new TH1F("fHistTrackMultiplicity", "Multiplicity distribution;Number of tracks;Events", 250, 0, 250); | |
214 | fList->Add(fHistTrackMultiplicity); | |
215 | fHistTrackMultiplicityCuts = new TH1F("fHistTrackMultiplicityCuts", "Multiplicity distribution;Number of tracks after cuts;Events", 250, 0, 250); | |
216 | fList->Add(fHistTrackMultiplicityCuts); | |
acb9d358 | 217 | |
ba06aaec | 218 | // momentum histos |
219 | //pt shift 0 only needed if shift in 1/pt is applied | |
aa4776c7 | 220 | fHistPtShift0 = new TH1F("fHistPtShift0","1/pt dN/pt vs. pt of ESD track ",800,-40.0,40.0); |
ba06aaec | 221 | fList->Add(fHistPtShift0); |
4060dd2d | 222 | |
223 | // THnSparse for 1/pt and pt spectra vs angles | |
224 | const Int_t invPtDims = 4; | |
aa4776c7 | 225 | fMaxPhi = 6.52; |
4060dd2d | 226 | fMinPhi = 0.0; |
227 | fMaxTheta = 3.0; | |
228 | fMinTheta = 0.0; | |
229 | ||
aa4776c7 | 230 | Double_t xminInvPt[invPtDims] = {-4.5,-40.0,fMinTheta,fMinPhi}; |
231 | Double_t xmaxInvPt[invPtDims] = {4.5,40.0,fMaxTheta,fMaxPhi}; | |
232 | Int_t binsInvPt[invPtDims] = {450,400,150,163}; | |
4060dd2d | 233 | |
234 | ||
235 | fHistInvPtPtThetaPhi = new THnSparseF("fHistInvPtPtThetaPhi","1/pt vs pt vs #theta vs #phi ",invPtDims,binsInvPt,xminInvPt,xmaxInvPt); | |
236 | fList->Add(fHistInvPtPtThetaPhi); | |
237 | ||
238 | // momentum test histos | |
ba06aaec | 239 | fHistTPCMomentaPosP = new TH2F("fHistTPCMomentaPosP","TPC p vs global esd track p pos",300,0.0,15.0,300,0.0,15.0); |
240 | fList->Add(fHistTPCMomentaPosP); | |
241 | fHistTPCMomentaNegP = new TH2F("fHistTPCMomentaNegP","TPC p vs global esd track p neg",300,0.0,15.0,300,0.0,15.0); | |
242 | fList->Add(fHistTPCMomentaNegP); | |
243 | fHistTPCMomentaPosPt = new TH2F("fHistTPCMomentaPosPt","TPC pt vs global esd track pt pos",300,0.0,15.0,300,0.0,15.0); | |
244 | fList->Add(fHistTPCMomentaPosPt); | |
245 | fHistTPCMomentaNegPt = new TH2F("fHistTPCMomentaNegPt","TPC pt vs global esd track pt neg",300,0.0,15.0,300,0.0,15.0); | |
246 | fList->Add(fHistTPCMomentaNegPt); | |
247 | ||
248 | //user pt shift check | |
acb9d358 | 249 | fHistUserPtShift = new TH1F("fHistUserPtShift","user defined shift in 1/pt",100,-0.5,1.5); |
250 | fList->Add(fHistUserPtShift); | |
fbe2204e | 251 | //pid by dedx |
252 | fHistdedxPions = new TH2F ("fHistdedxPions","dEdx of pions ident. via kPID vs signed Pt",300,-15.05,15.05,200,0.0,400.0); | |
253 | fList->Add(fHistdedxPions); | |
254 | //pid | |
c2b8d123 | 255 | fESDpid = new AliESDpid(); |
acb9d358 | 256 | |
ba06aaec | 257 | // esd track cuts |
aa4776c7 | 258 | fESDTrackCuts =NULL; |
acb9d358 | 259 | } |
260 | ||
261 | //________________________________________________________________________ | |
ba06aaec | 262 | void AliPerformancePtCalib::SetPtShift(const Double_t shiftVal ) { |
263 | //set user defined shift in charge/pt | |
264 | ||
265 | if(shiftVal) { fShift=kTRUE; fDeltaInvP = shiftVal; } | |
acb9d358 | 266 | } |
267 | ||
268 | //________________________________________________________________________ | |
4060dd2d | 269 | void AliPerformancePtCalib::Exec(AliMCEvent* const /*mcEvent*/, AliESDEvent *const esdEvent, AliESDfriend * const /*esdFriend*/, const Bool_t /*bUseMC*/, const Bool_t /*bUseESDfriend*/) |
acb9d358 | 270 | { |
aa4776c7 | 271 | //exec: read esd or tpc |
acb9d358 | 272 | |
18e588e9 | 273 | if(!fESDTrackCuts) { |
274 | Printf("no esd track cut"); | |
275 | return; | |
276 | } | |
ba06aaec | 277 | |
278 | if (!esdEvent) { | |
279 | Printf("ERROR: Event not available"); | |
280 | return; | |
281 | } | |
acb9d358 | 282 | |
4060dd2d | 283 | if (!(esdEvent->GetNumberOfTracks())) return; |
acb9d358 | 284 | |
4060dd2d | 285 | |
41fefc69 | 286 | //vertex info for cut |
287 | const AliESDVertex *vtx = esdEvent->GetPrimaryVertex(); | |
288 | if (!vtx->GetStatus()) return ; | |
4060dd2d | 289 | |
290 | //histo fo user defined shift in charge/pt | |
ba06aaec | 291 | if(fShift) fHistUserPtShift->Fill(fDeltaInvP); |
4060dd2d | 292 | |
293 | //trakc multiplicity | |
ba06aaec | 294 | fHistTrackMultiplicity->Fill(esdEvent->GetNumberOfTracks()); |
acb9d358 | 295 | |
296 | ||
ba06aaec | 297 | // read primary vertex info |
298 | Double_t tPrimaryVtxPosition[3]; | |
ba06aaec | 299 | const AliESDVertex *primaryVtx = esdEvent->GetPrimaryVertexTPC(); |
acb9d358 | 300 | |
e690d4d0 | 301 | tPrimaryVtxPosition[0] = primaryVtx->GetX(); |
302 | tPrimaryVtxPosition[1] = primaryVtx->GetY(); | |
303 | tPrimaryVtxPosition[2] = primaryVtx->GetZ(); | |
acb9d358 | 304 | |
ba06aaec | 305 | fHistPrimaryVertexPosX->Fill(tPrimaryVtxPosition[0]); |
306 | fHistPrimaryVertexPosY->Fill(tPrimaryVtxPosition[1]); | |
307 | fHistPrimaryVertexPosZ->Fill(tPrimaryVtxPosition[2]); | |
acb9d358 | 308 | |
309 | ||
ba06aaec | 310 | //_fill histos for pt spectra and shift of transverse momentum |
311 | Int_t count=0; | |
acb9d358 | 312 | |
ba06aaec | 313 | for(Int_t j = 0;j<esdEvent->GetNumberOfTracks();j++){// track loop |
314 | AliESDtrack *esdTrack = esdEvent->GetTrack(j); | |
315 | if(!esdTrack) continue; | |
acb9d358 | 316 | |
317 | ||
ba06aaec | 318 | if(fESDcuts){ |
319 | if(!fESDTrackCuts->AcceptTrack(esdTrack))continue; | |
320 | } | |
acb9d358 | 321 | |
acb9d358 | 322 | |
ba06aaec | 323 | // fill histos |
324 | if(fOptTPC){ //TPC tracks | |
325 | const AliExternalTrackParam *tpcTrack = esdTrack->GetTPCInnerParam(); | |
326 | if(!tpcTrack) continue; | |
aa4776c7 | 327 | if(fabs(tpcTrack->Eta())>= fEtaAcceptance) continue; |
acb9d358 | 328 | |
ba06aaec | 329 | Double_t signedPt = tpcTrack->GetSignedPt(); |
fbe2204e | 330 | |
331 | // pid | |
332 | if(fPions){ | |
c2b8d123 | 333 | |
fbe2204e | 334 | fESDpid->GetTPCResponse().SetBetheBlochParameters(0.0283086,2.63394e+01,5.04114e-11, 2.12543e+00,4.88663e+00); |
335 | ||
336 | if( TMath::Abs(fESDpid->NumberOfSigmasTPC(esdTrack,AliPID::kPion)) >1) continue; | |
337 | fHistdedxPions->Fill(signedPt,esdTrack->GetTPCsignal()); | |
338 | } | |
339 | ||
ba06aaec | 340 | Double_t invPt = 0.0; |
341 | if(signedPt) { | |
342 | invPt = 1.0/signedPt; | |
acb9d358 | 343 | |
4060dd2d | 344 | fHistPtShift0->Fill(signedPt); |
acb9d358 | 345 | |
4060dd2d | 346 | if(fShift){Printf("user shift of momentum SET to non zero value!"); |
ba06aaec | 347 | invPt += fDeltaInvP; //shift momentum for tests |
348 | if(invPt) signedPt = 1.0/invPt; | |
349 | else continue; | |
350 | } | |
4060dd2d | 351 | Double_t theta = tpcTrack->Theta(); |
352 | Double_t phi = tpcTrack->Phi(); | |
353 | ||
354 | Double_t momAng[4] = {invPt,signedPt,theta,phi}; | |
355 | fHistInvPtPtThetaPhi->Fill(momAng); | |
acb9d358 | 356 | |
ba06aaec | 357 | Double_t pTPC = tpcTrack->GetP(); |
358 | Double_t pESD = esdTrack->GetP(); | |
359 | Double_t ptESD = esdTrack->GetSignedPt(); | |
acb9d358 | 360 | |
ba06aaec | 361 | if(esdTrack->GetSign()>0){ |
362 | //compare momenta ESD track and TPC track | |
363 | fHistTPCMomentaPosP->Fill(fabs(pESD),fabs(pTPC)); | |
364 | fHistTPCMomentaPosPt->Fill(fabs(ptESD),fabs(signedPt)); | |
365 | } | |
366 | else{ | |
367 | fHistTPCMomentaNegP->Fill(fabs(pESD),fabs(pTPC)); | |
368 | fHistTPCMomentaNegPt->Fill(fabs(ptESD),fabs(signedPt)); | |
369 | } | |
370 | count++; | |
371 | } | |
372 | else continue; | |
acb9d358 | 373 | } |
acb9d358 | 374 | |
ba06aaec | 375 | else{// ESD tracks |
4060dd2d | 376 | if(fabs(esdTrack->Eta())> fEtaAcceptance) continue; |
ba06aaec | 377 | Double_t invPt = 0.0; |
378 | Double_t signedPt = esdTrack->GetSignedPt(); | |
379 | if(signedPt){ | |
380 | invPt = 1.0/signedPt; | |
acb9d358 | 381 | |
4060dd2d | 382 | fHistPtShift0->Fill(signedPt); |
acb9d358 | 383 | |
4060dd2d | 384 | if(fShift){Printf("user shift of momentum SET to non zero value!"); |
ba06aaec | 385 | invPt += fDeltaInvP;//shift momentum for tests |
386 | if(invPt) signedPt = 1.0/invPt; | |
387 | else continue; | |
388 | } | |
4060dd2d | 389 | Double_t theta = esdTrack->Theta(); |
390 | Double_t phi = esdTrack->Phi(); | |
391 | Double_t momAng[4] = {invPt,signedPt,theta,phi}; | |
392 | fHistInvPtPtThetaPhi->Fill(momAng); | |
ba06aaec | 393 | count++; |
394 | } | |
acb9d358 | 395 | } |
ba06aaec | 396 | } |
acb9d358 | 397 | |
ba06aaec | 398 | fHistTrackMultiplicityCuts->Fill(count); |
acb9d358 | 399 | } |
acb9d358 | 400 | //______________________________________________________________________________________________________________________ |
401 | ||
402 | void AliPerformancePtCalib::Analyse() | |
403 | { | |
ba06aaec | 404 | // analyse charge/pt spectra in bins of theta and phi. Bins can be set by user |
405 | ||
4060dd2d | 406 | THnSparseF *copyTHnSparseTheta = (THnSparseF*)fHistInvPtPtThetaPhi->Clone("copyTHnSparseTheta"); |
18e588e9 | 407 | if(!copyTHnSparseTheta) return; |
4060dd2d | 408 | copyTHnSparseTheta->GetAxis(3)->SetRangeUser(fMinPhi,fMaxPhi); |
409 | TH2F *histInvPtTheta = (TH2F*)copyTHnSparseTheta->Projection(2,0); | |
410 | ||
411 | THnSparseF *copyTHnSparsePhi = (THnSparseF*)fHistInvPtPtThetaPhi->Clone("copyTHnSparsePhi"); | |
18e588e9 | 412 | if(!copyTHnSparsePhi) return; |
4060dd2d | 413 | copyTHnSparsePhi->GetAxis(2)->SetRangeUser(fMinTheta,fMaxTheta); |
414 | TH2F *histInvPtPhi = (TH2F*)copyTHnSparsePhi->Projection(3,0); | |
415 | ||
ba06aaec | 416 | AliPerfAnalyzeInvPt *ana = new AliPerfAnalyzeInvPt("AliPerfAnalyzeInvPt","AliPerfAnalyzeInvPt"); |
18e588e9 | 417 | if(!ana) return; |
acb9d358 | 418 | |
419 | ||
ba06aaec | 420 | TH1::AddDirectory(kFALSE); |
acb9d358 | 421 | |
ba06aaec | 422 | ana->SetProjBinsTheta(fThetaBins,fNThetaBins); |
423 | ana->SetProjBinsPhi(fPhiBins,fNPhiBins); | |
424 | ana->SetMakeFitOption(fFitGaus,fExclRange,fRange); | |
4060dd2d | 425 | if(fDoRebin) ana->SetDoRebin(fRebin); |
ba06aaec | 426 | TObjArray *aFolderObj = new TObjArray; |
18e588e9 | 427 | if(!aFolderObj) return; |
4060dd2d | 428 | |
429 | ana->StartAnalysis(histInvPtTheta,histInvPtPhi,aFolderObj); | |
acb9d358 | 430 | |
ba06aaec | 431 | // export objects to analysis folder |
432 | fAnalysisFolder = ExportToFolder(aFolderObj); | |
acb9d358 | 433 | |
ba06aaec | 434 | // delete only TObjArray |
435 | if(aFolderObj) delete aFolderObj; | |
436 | if(ana) delete ana; | |
4060dd2d | 437 | |
acb9d358 | 438 | } |
439 | ||
440 | //______________________________________________________________________________________________________________________ | |
441 | TFolder* AliPerformancePtCalib::ExportToFolder(TObjArray * array) | |
442 | { | |
ba06aaec | 443 | // recreate folder every time and export objects to new one |
444 | // | |
445 | AliPerformancePtCalib * comp=this; | |
446 | TFolder *folder = comp->GetAnalysisFolder(); | |
447 | ||
448 | TString name, title; | |
449 | TFolder *newFolder = 0; | |
450 | Int_t i = 0; | |
451 | Int_t size = array->GetSize(); | |
452 | ||
453 | if(folder) { | |
454 | // get name and title from old folder | |
455 | name = folder->GetName(); | |
456 | title = folder->GetTitle(); | |
457 | ||
458 | // delete old one | |
459 | delete folder; | |
460 | ||
461 | // create new one | |
462 | newFolder = CreateFolder(name.Data(),title.Data()); | |
463 | newFolder->SetOwner(); | |
464 | ||
465 | // add objects to folder | |
466 | while(i < size) { | |
467 | newFolder->Add(array->At(i)); | |
468 | i++; | |
469 | } | |
470 | } | |
471 | ||
472 | return newFolder; | |
acb9d358 | 473 | } |
474 | ||
475 | //______________________________________________________________________________________________________________________ | |
476 | Long64_t AliPerformancePtCalib::Merge(TCollection* const list) | |
477 | { | |
ba06aaec | 478 | // Merge list of objects (needed by PROOF) |
479 | ||
480 | if (!list) | |
481 | return 0; | |
482 | ||
483 | if (list->IsEmpty()) | |
484 | return 1; | |
485 | ||
486 | TIterator* iter = list->MakeIterator(); | |
487 | TObject* obj = 0; | |
488 | ||
489 | // collection of generated histograms | |
490 | Int_t count=0; | |
491 | while((obj = iter->Next()) != 0) | |
492 | { | |
493 | AliPerformancePtCalib* entry = dynamic_cast<AliPerformancePtCalib*>(obj); | |
494 | if (entry == 0) continue; | |
4060dd2d | 495 | fHistInvPtPtThetaPhi->Add(entry->fHistInvPtPtThetaPhi); |
ba06aaec | 496 | |
497 | fHistPtShift0->Add(entry->fHistPtShift0); | |
498 | fHistPrimaryVertexPosX->Add(entry->fHistPrimaryVertexPosX); | |
499 | fHistPrimaryVertexPosY->Add(entry->fHistPrimaryVertexPosY); | |
500 | fHistPrimaryVertexPosZ->Add(entry->fHistPrimaryVertexPosZ); | |
501 | fHistTrackMultiplicity->Add(entry->fHistTrackMultiplicity); | |
502 | fHistTrackMultiplicityCuts->Add(entry->fHistTrackMultiplicityCuts); | |
503 | ||
504 | fHistTPCMomentaPosP->Add(entry->fHistTPCMomentaPosP); | |
505 | fHistTPCMomentaNegP->Add(entry->fHistTPCMomentaNegP); | |
506 | fHistTPCMomentaPosPt->Add(entry->fHistTPCMomentaPosPt); | |
507 | fHistTPCMomentaNegPt->Add(entry->fHistTPCMomentaNegPt); | |
fbe2204e | 508 | fHistdedxPions->Add(entry->fHistdedxPions); |
ba06aaec | 509 | count++; |
510 | } | |
acb9d358 | 511 | |
ba06aaec | 512 | return count; |
acb9d358 | 513 | } |
514 | ||
515 | //______________________________________________________________________________________________________________________ | |
516 | TFolder* AliPerformancePtCalib::CreateFolder(TString name,TString title) { | |
ba06aaec | 517 | // create folder for analysed histograms |
518 | // | |
519 | TFolder *folder = 0; | |
520 | folder = new TFolder(name.Data(),title.Data()); | |
acb9d358 | 521 | |
ba06aaec | 522 | return folder; |
acb9d358 | 523 | } |
524 | //______________________________________________________________________________________________________________________ | |
4060dd2d | 525 | void AliPerformancePtCalib::SetProjBinsPhi(const Double_t *phiBinArray,const Int_t nphBins, const Double_t minTheta, const Double_t maxTheta){ |
ba06aaec | 526 | // set phi bins for Analyse() |
527 | //set phi bins as array and set number of this array which is equal to number of bins analysed | |
528 | //the last analysed bin will always be the projection from first to last bin in the array | |
529 | if(nphBins){ | |
530 | fNPhiBins = nphBins; | |
531 | ||
532 | for(Int_t k = 0;k<fNPhiBins;k++){ | |
533 | fPhiBins[k] = phiBinArray[k]; | |
534 | } | |
535 | Printf("AliPerformancePtCalib::SetProjBinsPhi: number of bins in phi set to %i",fNPhiBins); | |
acb9d358 | 536 | } |
4060dd2d | 537 | else Printf("Warning AliPerformancePtCalib::SetProjBinsPhi: number of bins in phi NOT set!!! Default values are taken."); |
538 | ||
539 | if(fabs(minTheta-maxTheta)<0.001){ | |
540 | Printf("AliPerformancePtCalib::SetProjBinsPhi: theta range for projection on phi and charge/pt is too small. whole range of theta selected."); | |
541 | } | |
542 | else{ | |
543 | Printf("AliPerformancePtCalib::SetProjBinsPhi: theta range for projection on phi and charge/pt is selected by user: %1.3f - %1.3f rad",minTheta,maxTheta); | |
544 | fMinTheta = minTheta; | |
545 | fMaxTheta = maxTheta; | |
546 | } | |
acb9d358 | 547 | } |
4060dd2d | 548 | |
acb9d358 | 549 | //____________________________________________________________________________________________________________________________________________ |
4060dd2d | 550 | void AliPerformancePtCalib::SetProjBinsTheta(const Double_t *thetaBinArray, const Int_t nthBins, const Double_t minPhi, const Double_t maxPhi){ |
ba06aaec | 551 | // set theta bins for Analyse() |
552 | //set theta bins as array and set number of this array which is equal to number of bins analysed | |
553 | //the last analysed bin will always be the projection from first to last bin in the array | |
554 | if(nthBins){ | |
555 | fNThetaBins = nthBins; | |
556 | for(Int_t k = 0;k<fNThetaBins;k++){ | |
557 | fThetaBins[k] = thetaBinArray[k]; | |
558 | } | |
4060dd2d | 559 | Printf("AliPerformancePtCalib::SetProjBinsTheta: number of bins in theta set to %i",fNThetaBins); |
560 | } | |
561 | else Printf("Warning AliPerformancePtCalib::SetProjBinsTheta: number of bins in theta NOT set!!! Default values are taken."); | |
562 | ||
563 | if(fabs(minPhi-maxPhi)<0.001){ | |
564 | Printf("AliPerformancePtCalib::SetProjBinsTheta: phi range for projection on theta and charge/pt is too small. whole range of phi selected."); | |
565 | } | |
566 | else{ | |
567 | Printf("AliPerformancePtCalib::SetProjBinsTheta: phi range for projection on theta and charge/pt is selected by user: %1.3f - %1.3f rad",minPhi,maxPhi); | |
568 | fMinPhi = minPhi; | |
569 | fMaxPhi = maxPhi; | |
acb9d358 | 570 | } |
acb9d358 | 571 | } |
572 | //____________________________________________________________________________________________________________________________________________ | |
573 | void AliPerformancePtCalib::SetMakeFitOption(const Bool_t setGausFit, const Double_t exclusionR,const Double_t fitR ){ | |
ba06aaec | 574 | //set the fit options: |
575 | //for usage of gaussian function instead of polynomial (default) set setGausFit=kTRUE | |
576 | //set the range of rejection of points around 0 via exclusionR | |
577 | //set the fit range around 0 with fitR | |
acb9d358 | 578 | |
579 | fRange = fitR; | |
580 | fFitGaus = setGausFit; | |
581 | fExclRange = exclusionR; | |
582 | ||
4060dd2d | 583 | if(fFitGaus) Printf("AliPerformancePtCalib::SetMakeFitOption: set MakeGausFit with fit range %2.3f and exclusion range in fabs(1/pt): %2.3f",fRange,fExclRange); |
584 | else Printf("AliPerformancePtCalib::SetMakeFitOption: set standard polynomial fit with fit range %2.3f and exclusion range in fabs(1/pt): %2.3f",fRange,fExclRange); | |
acb9d358 | 585 | |
586 | } |