]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSPlaneEffSDD.cxx
Changes to remove compilation warnings
[u/mrichter/AliRoot.git] / ITS / AliITSPlaneEffSDD.cxx
CommitLineData
6344adcc 1/**************************************************************************
2 * Copyright(c) 2007-2009, 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// Plane Efficiency class for ITS
7167ae53 17// It is used for chip by chip efficiency (eventually with sui-bwing division
18// along the drift direction) of the SDD,
6344adcc 19// evaluated by tracks
20// (Inherits from AliITSPlaneEff)
21// Author: G.E. Bruno
22// giuseppe.bruno@ba.infn.it
23//
24///////////////////////////////////////////////////////////////////////////
25
26/* $Id$ */
27
28#include <TMath.h>
3ebe30ad 29#include <TH1F.h>
30#include <TFile.h>
31#include <TTree.h>
32#include <TROOT.h>
6344adcc 33#include "AliITSPlaneEffSDD.h"
34#include "AliLog.h"
35#include "AliCDBStorage.h"
36#include "AliCDBEntry.h"
37#include "AliCDBManager.h"
38//#include "AliCDBRunRange.h"
7167ae53 39#include "AliITSgeom.h"
6344adcc 40#include "AliITSCalibrationSDD.h"
7167ae53 41#include "AliITSsegmentationSDD.h"
6344adcc 42
43ClassImp(AliITSPlaneEffSDD)
44//______________________________________________________________________
45AliITSPlaneEffSDD::AliITSPlaneEffSDD():
3ebe30ad 46 AliITSPlaneEff(),
47 fHisResX(0),
48 fHisResZ(0),
49 fHisResXZ(0),
50 fHisClusterSize(0),
51 fHisResXclu(0),
52 fHisResZclu(0),
53 fProfResXvsX(0),
54 fProfResZvsX(0),
55 fProfClustSizeXvsX(0),
56 fProfClustSizeZvsX(0){
6344adcc 57 for (UInt_t i=0; i<kNModule*kNChip*kNWing*kNSubWing; i++){
58 fFound[i]=0;
59 fTried[i]=0;
60 }
61 // default constructor
62 AliDebug(1,Form("Calling default constructor"));
63}
64//______________________________________________________________________
65AliITSPlaneEffSDD::~AliITSPlaneEffSDD(){
66 // destructor
67 // Inputs:
68 // none.
69 // Outputs:
70 // none.
71 // Return:
72 // none.
3ebe30ad 73 DeleteHistos();
6344adcc 74}
75//______________________________________________________________________
3ebe30ad 76AliITSPlaneEffSDD::AliITSPlaneEffSDD(const AliITSPlaneEffSDD &s) : AliITSPlaneEff(s),
6344adcc 77//fHis(s.fHis),
3ebe30ad 78fHisResX(0),
79fHisResZ(0),
80fHisResXZ(0),
81fHisClusterSize(0),
82fHisResXclu(0),
83fHisResZclu(0),
84fProfResXvsX(0),
85fProfResZvsX(0),
86fProfClustSizeXvsX(0),
87fProfClustSizeZvsX(0)
6344adcc 88{
89 // Copy Constructor
90 // Inputs:
91 // AliITSPlaneEffSDD &s The original class for which
92 // this class is a copy of
93 // Outputs:
94 // none.
95 // Return:
96
3ebe30ad 97 for (UInt_t i=0; i<kNModule*kNChip*kNWing*kNSubWing; i++){
98 fFound[i]=s.fFound[i];
99 fTried[i]=s.fTried[i];
100 }
101 if(fHis) {
102 InitHistos();
103 for(Int_t i=0; i<kNHisto; i++) {
104 s.fHisResX[i]->Copy(*fHisResX[i]);
105 s.fHisResZ[i]->Copy(*fHisResZ[i]);
106 s.fHisResXZ[i]->Copy(*fHisResXZ[i]);
107 s.fHisClusterSize[i]->Copy(*fHisClusterSize[i]);
108 for(Int_t clu=0; clu<kNclu; clu++) { // clu=0 --> cluster size 1
109 s.fHisResXclu[i][clu]->Copy(*fHisResXclu[i][clu]);
110 s.fHisResZclu[i][clu]->Copy(*fHisResZclu[i][clu]);
111 }
112 s.fProfResXvsX[i]->Copy(*fProfResXvsX[i]);
113 s.fProfResZvsX[i]->Copy(*fProfResZvsX[i]);
114 s.fProfClustSizeXvsX[i]->Copy(*fProfClustSizeXvsX[i]);
115 s.fProfClustSizeZvsX[i]->Copy(*fProfClustSizeZvsX[i]);
116 }
117 }
6344adcc 118}
119//_________________________________________________________________________
120AliITSPlaneEffSDD& AliITSPlaneEffSDD::operator+=(const AliITSPlaneEffSDD &add){
121 // Add-to-me operator
122 // Inputs:
123 // const AliITSPlaneEffSDD &add simulation class to be added
124 // Outputs:
125 // none.
126 // Return:
127 // none
128 for (UInt_t i=0; i<kNModule*kNChip*kNWing*kNSubWing; i++){
129 fFound[i] += add.fFound[i];
130 fTried[i] += add.fTried[i];
131 }
3ebe30ad 132 if(fHis && add.fHis) {
133 for(Int_t i=0; i<kNHisto; i++) {
134 fHisResX[i]->Add(add.fHisResX[i]);
135 fHisResZ[i]->Add(add.fHisResZ[i]);
136 fHisResXZ[i]->Add(add.fHisResXZ[i]);
137 fHisClusterSize[i]->Add(add.fHisClusterSize[i]);
138 for(Int_t clu=0; clu<kNclu; clu++) { // clu=0 --> cluster size 1
139 fHisResXclu[i][clu]->Add(add.fHisResXclu[i][clu]);
140 fHisResZclu[i][clu]->Add(add.fHisResZclu[i][clu]);
141 }
142 fProfResXvsX[i]->Add(add.fProfResXvsX[i]);
143 fProfResZvsX[i]->Add(add.fProfResZvsX[i]);
144 fProfClustSizeXvsX[i]->Add(add.fProfClustSizeXvsX[i]);
145 fProfClustSizeZvsX[i]->Add(add.fProfClustSizeZvsX[i]);
146 }
147 }
6344adcc 148 return *this;
149}
150//______________________________________________________________________
151AliITSPlaneEffSDD& AliITSPlaneEffSDD::operator=(const
152 AliITSPlaneEffSDD &s){
153 // Assignment operator
154 // Inputs:
155 // AliITSPlaneEffSDD &s The original class for which
156 // this class is a copy of
157 // Outputs:
158 // none.
159 // Return:
160
161 if(this==&s) return *this;
162 s.Copy(*this);
6344adcc 163 return *this;
164}
165//______________________________________________________________________
166void AliITSPlaneEffSDD::Copy(TObject &obj) const {
167 // protected method. copy this to obj
168 AliITSPlaneEff::Copy(obj);
3ebe30ad 169 AliITSPlaneEffSDD& target = (AliITSPlaneEffSDD &) obj;
6344adcc 170 for(Int_t i=0;i<kNModule*kNChip*kNWing*kNSubWing;i++) {
3ebe30ad 171 target.fFound[i] = fFound[i];
172 target.fTried[i] = fTried[i];
173 }
174 CopyHistos(target);
175 return;
176}
177//_______________________________________________________________________
178void AliITSPlaneEffSDD::CopyHistos(AliITSPlaneEffSDD &target) const {
179 // protected method: copy histos from this to target
180 target.fHis = fHis; // this is redundant only in some cases. Leave as it is.
181 if(fHis) {
182 target.fHisResX=new TH1F*[kNHisto];
183 target.fHisResZ=new TH1F*[kNHisto];
184 target.fHisResXZ=new TH2F*[kNHisto];
185 target.fHisClusterSize=new TH2I*[kNHisto];
186 target.fHisResXclu=new TH1F**[kNHisto];
187 target.fHisResZclu=new TH1F**[kNHisto];
188 target.fProfResXvsX=new TProfile*[kNHisto];
189 target.fProfResZvsX=new TProfile*[kNHisto];
190 target.fProfClustSizeXvsX=new TProfile*[kNHisto];
191 target.fProfClustSizeZvsX=new TProfile*[kNHisto];
192
193 for(Int_t i=0; i<kNHisto; i++) {
194 target.fHisResX[i] = new TH1F(*fHisResX[i]);
195 target.fHisResZ[i] = new TH1F(*fHisResZ[i]);
196 target.fHisResXZ[i] = new TH2F(*fHisResXZ[i]);
197 target.fHisClusterSize[i] = new TH2I(*fHisClusterSize[i]);
198 target.fHisResXclu[i]=new TH1F*[kNclu];
199 target.fHisResZclu[i]=new TH1F*[kNclu];
200 for(Int_t clu=0; clu<kNclu; clu++) { // clu=0 --> cluster size 1
201 target.fHisResXclu[i][clu] = new TH1F(*fHisResXclu[i][clu]);
202 target.fHisResZclu[i][clu] = new TH1F(*fHisResZclu[i][clu]);
203 }
204 target.fProfResXvsX[i]=new TProfile(*fProfResXvsX[i]);
205 target.fProfResZvsX[i]=new TProfile(*fProfResZvsX[i]);
206 target.fProfClustSizeXvsX[i]=new TProfile(*fProfClustSizeXvsX[i]);
207 target.fProfClustSizeZvsX[i]=new TProfile(*fProfClustSizeZvsX[i]);
208 }
6344adcc 209 }
3ebe30ad 210return;
6344adcc 211}
85f5e9c2 212/* Commented out by M.Masera 8/3/08
6344adcc 213//______________________________________________________________________
214AliITSPlaneEff& AliITSPlaneEffSDD::operator=(const
215 AliITSPlaneEff &s){
216 // Assignment operator
217 // Inputs:
218 // AliITSPlaneEffSDD &s The original class for which
219 // this class is a copy of
220 // Outputs:
221 // none.
222 // Return:
223
224 if(&s == this) return *this;
7167ae53 225 AliError("operator=: Not allowed to make a =, use default creater instead");
6344adcc 226 return *this;
227}
85f5e9c2 228*/
6344adcc 229//_______________________________________________________________________
230Int_t AliITSPlaneEffSDD::GetMissingTracksForGivenEff(Double_t eff, Double_t RelErr,
231 UInt_t im, UInt_t ic, UInt_t iw, UInt_t is) const {
232
233 // Estimate the number of tracks still to be collected to attain a
234 // given efficiency eff, with relative error RelErr
235 // Inputs:
236 // eff -> Expected efficiency (e.g. those from actual estimate)
237 // RelErr -> tollerance [0,1]
238 // im -> module number [0,259]
239 // ic -> chip number [0,3]
240 // iw -> wing number [0,1]
241 // is -> chip number [0,kNSubWing-1]
242 // Outputs: none
243 // Return: the estimated n. of tracks
244 //
245if (im>=kNModule || ic>=kNChip || iw>=kNWing || is>=kNSubWing)
7167ae53 246 {AliError("GetMissingTracksForGivenEff: you asked for a non existing block");
6344adcc 247 return -1;}
248else return GetNTracksForGivenEff(eff,RelErr)-fTried[GetKey(im,ic,iw,is)];
249}
250//_________________________________________________________________________
251Double_t AliITSPlaneEffSDD::PlaneEff(const UInt_t im,const UInt_t ic,
252 const UInt_t iw,const UInt_t is) const {
253// Compute the efficiency for a basic block,
254// Inputs:
255// im -> module number [0,259]
256// ic -> chip number [0,3]
257// iw -> wing number [0,1]
258// is -> chip number [0,kNSubWing-1]
259if (im>=kNModule || ic>=kNChip || iw>=kNWing || is>=kNSubWing)
7167ae53 260 {AliError("PlaneEff(UInt_t,UInt_t,UInt_t,UInt_t): you asked for a non existing block"); return -1.;}
6344adcc 261 Int_t nf=fFound[GetKey(im,ic,iw,is)];
262 Int_t nt=fTried[GetKey(im,ic,iw,is)];
263return AliITSPlaneEff::PlaneEff(nf,nt);
264}
265//_________________________________________________________________________
266Double_t AliITSPlaneEffSDD::ErrPlaneEff(const UInt_t im,const UInt_t ic,
267 const UInt_t iw,const UInt_t is) const {
268 // Compute the statistical error on efficiency for a basic block,
269 // using binomial statistics
270 // Inputs:
271 // im -> module number [0,259]
272 // ic -> chip number [0,3]
273 // iw -> wing number [0,1]
274 // is -> chip number [0,kNSubWing-1]
275if (im>=kNModule || ic>=kNChip || iw>=kNWing || is>=kNSubWing)
7167ae53 276 {AliError("ErrPlaneEff(UInt_t,UInt_t,UInt_t,UInt_t): you asked for a non existing block"); return -1.;}
6344adcc 277Int_t nf=fFound[GetKey(im,ic,iw,is)];
278Int_t nt=fTried[GetKey(im,ic,iw,is)];
279return AliITSPlaneEff::ErrPlaneEff(nf,nt);
280}
281//_________________________________________________________________________
282Bool_t AliITSPlaneEffSDD::UpDatePlaneEff(const Bool_t Kfound,
283 const UInt_t im, const UInt_t ic,
284 const UInt_t iw, const UInt_t is) {
285 // Update efficiency for a basic block
286if (im>=kNModule || ic>=kNChip || iw>=kNWing || is>=kNSubWing)
7167ae53 287 {AliError("UpDatePlaneEff: you asked for a non existing block"); return kFALSE;}
6344adcc 288 fTried[GetKey(im,ic,iw,is)]++;
289 if(Kfound) fFound[GetKey(im,ic,iw,is)]++;
290 return kTRUE;
291}
292//_________________________________________________________________________
293void AliITSPlaneEffSDD::ChipAndWingFromAnode(const UInt_t anode, UInt_t& chip,
294 UInt_t& wing) const {
295 // Retun the chip number [0,3] and the wing number [0,1] given the anode number
296 // input: anode number [0,511]
297if(anode>=kNAnode*kNChip*kNWing)
7167ae53 298 {AliError("ChipAndWingFromAnode: you asked for a non existing anode");
6344adcc 299 chip=999;
300 wing=99;
301 return;}
302wing=0;
303chip=anode/kNAnode;
304if(anode>=kNChip*kNAnode) wing=1;
305if(wing==1) chip-=kNChip;
306return;
307}
308//_________________________________________________________________________
309UInt_t AliITSPlaneEffSDD::ChipFromAnode(const UInt_t anode) const {
310 // Retun the chip number [0,3] given the anode number
311 // input: anode number [0,511]
312if(anode>=kNAnode*kNChip*kNWing)
7167ae53 313 {AliError("ChipFromAnode: you asked for a non existing anode"); return 999;}
6344adcc 314Int_t wing=0;
315Int_t chip=anode/kNAnode;
316if(anode>=kNChip*kNAnode) wing=1;
317if(wing==1)chip-=kNChip;
318return chip;
319}
320//_________________________________________________________________________
321UInt_t AliITSPlaneEffSDD::WingFromAnode(const UInt_t anode) const {
322 // return the wing number [0,1] given the anode number
323 // input: anode number [0,511]
324if(anode>=kNAnode*kNChip*kNWing)
7167ae53 325 {AliError("WingFromAnode: you asked for a non existing anode"); return 99;}
6344adcc 326Int_t wing=0;
327if(anode>=kNChip*kNAnode) wing=1;
328return wing;
329}
330//__________________________________________________________________________
331UInt_t AliITSPlaneEffSDD::GetKey(const UInt_t mod, const UInt_t chip,
332 const UInt_t wing, const UInt_t subw) const {
333 // get key given a basic block
334if(mod>=kNModule || chip>=kNChip || wing>= kNWing || subw>=kNSubWing)
7167ae53 335 {AliError("GetKey: you asked for a non existing block"); return 99999;}
6344adcc 336return mod*kNChip*kNWing*kNSubWing+chip*kNWing*kNSubWing+wing*kNSubWing+subw;
337}
338//__________________________________________________________________________
339UInt_t AliITSPlaneEffSDD::GetModFromKey(const UInt_t key) const {
340 // get mod. from key
341if(key>=kNModule*kNChip*kNWing*kNSubWing)
7167ae53 342 {AliError("GetModFromKey: you asked for a non existing key"); return 9999;}
6344adcc 343return key/(kNChip*kNWing*kNSubWing);
344}
345//__________________________________________________________________________
346UInt_t AliITSPlaneEffSDD::GetChipFromKey(const UInt_t key) const {
347 // retrieves chip from key
348if(key>=kNModule*kNChip*kNWing*kNSubWing)
7167ae53 349 {AliError("GetChipFromKey: you asked for a non existing key"); return 999;}
6344adcc 350return (key%(kNChip*kNWing*kNSubWing))/(kNWing*kNSubWing);
351}
352//__________________________________________________________________________
353UInt_t AliITSPlaneEffSDD::GetWingFromKey(const UInt_t key) const {
354 // retrieves wing from key
355if(key>=kNModule*kNChip*kNWing*kNSubWing)
7167ae53 356 {AliError("GetWingFromKey: you asked for a non existing key"); return 99;}
6344adcc 357return ((key%(kNChip*kNWing*kNSubWing))%(kNWing*kNSubWing))/(kNSubWing);
358}
359//__________________________________________________________________________
360UInt_t AliITSPlaneEffSDD::GetSubWingFromKey(const UInt_t key) const {
361 // retrieves sub-wing from key
362if(key>=kNModule*kNChip*kNWing*kNSubWing)
7167ae53 363 {AliError("GetSubWingFromKey: you asked for a non existing key"); return 9;}
6344adcc 364return ((key%(kNChip*kNWing*kNSubWing))%(kNWing*kNSubWing))%(kNSubWing);
365}
366//__________________________________________________________________________
367void AliITSPlaneEffSDD::GetAllFromKey(const UInt_t key,UInt_t& mod,UInt_t& chip,
368 UInt_t& wing,UInt_t& subw) const {
369 // get module, chip, wing and subwing from a key
370if(key>=kNModule*kNChip*kNWing*kNSubWing)
7167ae53 371 {AliError("GetAllFromKey: you asked for a non existing key");
6344adcc 372 mod=9999;
373 chip=999;
374 wing=99;
375 subw=9;
376 return;}
377mod=GetModFromKey(key);
378chip=GetChipFromKey(key);
379wing=GetWingFromKey(key);
380subw=GetSubWingFromKey(key);
381return;
382}
383//____________________________________________________________________________
384Double_t AliITSPlaneEffSDD::LivePlaneEff(UInt_t key) const {
385 // returns plane efficieny after adding the fraction of sensor which is bad
386if(key>=kNModule*kNChip*kNWing*kNSubWing)
7167ae53 387 {AliError("LivePlaneEff: you asked for a non existing key");
6344adcc 388 return -1.;}
389Double_t leff=AliITSPlaneEff::LivePlaneEff(0); // this just for the Warning
390leff=PlaneEff(key)+GetFracBad(key);
391return leff>1?1:leff;
392}
393//____________________________________________________________________________
394Double_t AliITSPlaneEffSDD::ErrLivePlaneEff(UInt_t key) const {
395 // returns error on live plane efficiency
396if(key>=kNModule*kNChip*kNWing*kNSubWing)
7167ae53 397 {AliError("ErrLivePlaneEff: you asked for a non existing key");
6344adcc 398 return -1.;}
399Int_t nf=fFound[key];
400Double_t triedInLive=GetFracLive(key)*fTried[key];
401Int_t nt=TMath::Max(nf,TMath::Nint(triedInLive));
402return AliITSPlaneEff::ErrPlaneEff(nf,nt); // for the time being: to be checked
403}
404//_____________________________________________________________________________
405Double_t AliITSPlaneEffSDD::GetFracLive(const UInt_t key) const {
406 // returns the fraction of the sensor which is OK
407if(key>=kNModule*kNChip*kNWing*kNSubWing)
7167ae53 408 {AliError("GetFracLive: you asked for a non existing key");
6344adcc 409 return -1.;}
410 // Compute the fraction of bad (dead+noisy) detector
411UInt_t bad=0;
412GetBadInBlock(key,bad);
413Double_t live=bad;
414live/=(kNAnode);
415return 1.-live;
416}
417//_____________________________________________________________________________
418void AliITSPlaneEffSDD::GetBadInBlock(const UInt_t key, UInt_t& nrBadInBlock) const {
419 // Compute the number of bad (dead+noisy) anodes inside a block
420 // (it depends on the chip, not on the sub-wing)
421nrBadInBlock=0;
422if(key>=kNModule*kNChip*kNWing*kNSubWing)
7167ae53 423 {AliError("GetBadInBlock: you asked for a non existing key");
6344adcc 424 return;}
425//
426if(!fInitCDBCalled)
7167ae53 427 {AliError("GetBadInBlock: CDB not inizialized: call InitCDB first");
6344adcc 428 return;};
429AliCDBManager* man = AliCDBManager::Instance();
430// retrieve map of dead Pixel
431AliCDBEntry *cdbSDD = man->Get("ITS/Calib/CalibSDD", fRunNumber);
432TObjArray* sddEntry;
433if(cdbSDD) {
434 sddEntry = (TObjArray*)cdbSDD->GetObject();
435 if(!sddEntry)
7167ae53 436 {AliError("GetBadInBlock: SDDEntry not found in CDB");
6344adcc 437 return;}
438} else {
7167ae53 439 AliError("GetBadInBlock: Did not find Calib/CalibSDD");
6344adcc 440 return;
441}
442//
443UInt_t mod=GetModFromKey(key);
444UInt_t chip=GetChipFromKey(key);
445UInt_t wing=GetWingFromKey(key);
446// count number of dead
447AliITSCalibrationSDD* calibSDD=(AliITSCalibrationSDD*) sddEntry->At(mod);
448UInt_t nrBad = calibSDD-> GetDeadChannels();
449for (UInt_t index=0; index<nrBad; index++) {
450 if(ChipFromAnode(calibSDD->GetBadChannel(index))==chip &&
451 WingFromAnode(calibSDD->GetBadChannel(index))==wing ) nrBadInBlock++;
452}
453return;
454}
455//_____________________________________________________________________________
456Double_t AliITSPlaneEffSDD::GetFracBad(const UInt_t key) const {
457 // returns 1-fractional live
458if(key>=kNModule*kNChip*kNWing*kNSubWing)
7167ae53 459 {AliError("GetFracBad: you asked for a non existing key");
6344adcc 460 return -1.;}
461return 1.-GetFracLive(key);
462}
463//_____________________________________________________________________________
464Bool_t AliITSPlaneEffSDD::WriteIntoCDB() const {
465// write onto CDB
466if(!fInitCDBCalled)
7167ae53 467 {AliError("WriteIntoCDB: CDB not inizialized: call InitCDB first");
6344adcc 468 return kFALSE;}
469// to be written properly: now only for debugging
470 AliCDBMetaData *md= new AliCDBMetaData(); // metaData describing the object
471 md->SetObjectClassName("AliITSPlaneEff");
472 md->SetResponsible("Giuseppe Eugenio Bruno");
473 md->SetBeamPeriod(0);
474 md->SetAliRootVersion("head 02/01/08"); //root version
475 AliCDBId id("ITS/PlaneEff/PlaneEffSDD",0,AliCDBRunRange::Infinity());
476 AliITSPlaneEffSDD eff;
477 eff=*this;
478 Bool_t r=AliCDBManager::Instance()->GetDefaultStorage()->Put(&eff,id,md);
479 delete md;
480 return r;
481}
482//_____________________________________________________________________________
483Bool_t AliITSPlaneEffSDD::ReadFromCDB() {
484// read from CDB
485if(!fInitCDBCalled)
7167ae53 486 {AliError("ReadFromCDB: CDB not inizialized: call InitCDB first");
6344adcc 487 return kFALSE;}
6344adcc 488AliCDBEntry *cdbEntry = AliCDBManager::Instance()->Get("ITS/PlaneEff/PlaneEffSDD",fRunNumber);
1cc5cedc 489if(!cdbEntry) return kFALSE;
6344adcc 490AliITSPlaneEffSDD* eff= (AliITSPlaneEffSDD*)cdbEntry->GetObject();
491if(this==eff) return kFALSE;
3ebe30ad 492if(fHis) CopyHistos(*eff); // If histos already exist then copy them to eff
493eff->Copy(*this); // copy everything (statistics and histos) from eff to this
6344adcc 494return kTRUE;
495}
7167ae53 496//_____________________________________________________________________________
1cc5cedc 497Bool_t AliITSPlaneEffSDD::AddFromCDB(AliCDBId *cdbId) {
498AliCDBEntry *cdbEntry=0;
499if (!cdbId) {
500 if(!fInitCDBCalled)
501 {AliError("ReadFromCDB: CDB not inizialized. Call InitCDB first"); return kFALSE;}
502 cdbEntry = AliCDBManager::Instance()->Get("ITS/PlaneEff/PlaneEffSDD",fRunNumber);
503} else {
504 cdbEntry = AliCDBManager::Instance()->Get(*cdbId);
505}
506if(!cdbEntry) return kFALSE;
507AliITSPlaneEffSDD* eff= (AliITSPlaneEffSDD*)cdbEntry->GetObject();
508*this+=*eff;
509return kTRUE;
510}
511//_____________________________________________________________________________
7167ae53 512UInt_t AliITSPlaneEffSDD::GetKeyFromDetLocCoord(Int_t ilay, Int_t idet,
513 Float_t locx, Float_t locz) const {
514// method to locate a basic block from Detector Local coordinate (to be used in tracking)
515//
516// If kNSubWing = 1, i.e. no sub-wing subdivision, then the numbering scheme of the
517// unique key is the following, e.g. for the first detector (idet=0, ilayer=2)
518//
519// ^x_loc (cm)
520// |
521// _________________________|__________________________ 3.5085
522// | | | | |
523// | | | | |
524// | | | | |
525// | key=1 | key=3 | key=5 | key=7 |
526// | | | | |
527// |____________|____________|____________|____________|_0_____\ local z (cm)
528// | | | | | /
529// | | | | |
530// | key=0 | key=2 | key=4 | key=6 |
531// | | | | |
532// | | | | |
533// |____________|____________|____________|____________| -3.5085
534//-3.7632 -1.8816 0 1.1186 3.7632
535//
536// for the second detector (idet=2, ilay=2), first key is 8 (bottom-left),
537// last one is 15 (upper-right), and so on.
538//
539// If subwing division has been applied, then you count in each wing, starting from
540// the one with negative local , from the anode side (outer part) towards the
541// cathod strip (center).
542// first column:
543// bottom wing (from below): 0,1,..,kNSubWing-1,
544// upper wing (from up): kNSubWing, ... , 2*kNSubWing-1
545// 2nd column
546// bottom wing (from below): 2*kNSubWing, .. , 3*kNSubWing-1
547// upper wing (from up): 3*kNSubWing, ... ,4*kNSubWing-1
548// ...
549// 4nd (last) column :
550// bottom wing (from below): 6*kNSubWing, .. , 7*kNSubWing-1
551// upper wing (from up): 7*kNSubWing, ... ,8*kNSubWing-1
552//
553// E.g. kNSubWing=2.
554//
555// ^x_loc (cm)
556// |
557// _________________________|__________________________ 3.5085
558// | | | | |
559// | key=2 | key=6 | key=10 | key=14 |
560// |____________|____________|____________|____________|
561// | | | | |
562// | key=3 | key=7 | key=11 | key=15 |
563// |____________|____________|____________|____________|_0_____\ local z (cm)
564// | | | | | /
565// | key=1 | key=5 | key=9 | key=13 |
566// |____________|____________|____________|____________|
567// | | | | |
568// | key=0 | key=4 | key=8 | key=12 |
569// |____________|____________|____________|____________| -3.5085
570//-3.7632 -1.8816 0 1.1186 3.7632
571//
572//___________________________________________________________________________
573//
574UInt_t key=999999;
575if(ilay<2 || ilay>3)
576 {AliError("GetKeyFromDetLocCoord: you asked for a non existing layer");
577 return key;}
578if(ilay==2 && (idet<0 || idet>83))
579 {AliError("GetKeyFromDetLocCoord: you asked for a non existing detector");
580 return key;}
581if(ilay==3 && (idet<0 || idet>175))
582 {AliError("GetKeyFromDetLocCoord: you asked for a non existing detector");
583 return key;}
584UInt_t mod=idet;
585if(ilay==3) mod+=84;
586UInt_t chip=0,wing=0,subw=0;
587ChipAndWingAndSubWingFromLocCoor(locx,locz,chip,wing,subw);
588key=GetKey(mod,chip,wing,subw);
589return key;
590}
591//_____________________________________________________________________________
592void AliITSPlaneEffSDD::ChipAndWingAndSubWingFromLocCoor(Float_t xloc, Float_t zloc,
593 UInt_t& chip, UInt_t& wing, UInt_t& subw) const {
594AliITSgeom* geom=NULL;
595//AliITSsegmentationSDD* sdd=new AliITSsegmentationSDD(geom);
596AliITSsegmentationSDD sdd=AliITSsegmentationSDD(geom);
597sdd.SetDriftSpeed(sdd.GetDriftSpeed()); // this only for setting fSetDriftSpeed=kTRUE !!!
598Int_t ix,iz;
599Int_t ntb;
600UInt_t anode=0;
601if(sdd.LocalToDet(xloc,zloc,ix,iz)) {
602 anode+=iz;
603 ChipAndWingFromAnode(anode,chip,wing);
604 if(sdd.LocalToDet(0.,0.,ntb,iz)) { // in this way the sub-division along time coordinate
605 subw=SubWingFromTimeBin(ix,ntb); } // is purely geometrical one and it does not
606 else { // depen on the drift-velocity.
607 AliError("ChipAndWingAndSubWingFromLocCoor: cannot calculate n. of time bins for SubWing.");
608 subw=9;
609 }
610} else {
611 AliError("ChipAndWingAndSubWingFromLocCoor: cannot calculate anode number and time bin.");
612 chip=999;
613 wing=99;
614 subw=9;
615}
616delete geom;
617}
618//__________________________________________________________________________________
619UInt_t AliITSPlaneEffSDD::SubWingFromTimeBin(const Int_t tb, const Int_t ntb) const {
620if(tb<0 || tb>ntb || ntb<0) {
621 AliError(Form("SubWingFromTimeBin: you asked time bin = %d with %d n. of bins",tb,ntb));
622 return 9;
623}
624//AliDebug(Form("tb = %d, ntb= %d , NSubWing = %d",tb,ntb,kNSubWing));
625Float_t h=tb;
626 h/=ntb;
627 h*=(kNSubWing-1);
628return TMath::Nint(h);
629}
aa0de373 630//________________________________________________________
631Bool_t AliITSPlaneEffSDD::GetBlockBoundaries(const UInt_t key, Float_t& xmn,Float_t& xmx,
632 Float_t& zmn,Float_t& zmx) const {
633//
634// This method return the geometrical boundaries of the active volume of a given
635// basic block, in the detector reference system.
636// Input: unique key to locate a basic block.
637//
638// Output: Ymin, Ymax, Zmin, Zmax of a basic block (chip for SPD)
639// Return: kTRUE if computation was succesfully, kFALSE otherwise
640//
641// the following scheemes will help in following the method implementation
642// E.g. kNSubWing=1
643// ^x_loc (cm)
644// for all: subw=0 |
645// _________________________|__________________________ 3.5085
646// | wing=1 | wing=1 | wing=1 | wing=1 |
647// | chip=0 | chip=1 | chip=2 | chip=3 |
648// | key=1 | key=3 | key=5 | key=7 |
649// |____________|____________|____________|____________|_0_____\ local z (cm)
650// | wing=0 | wing=0 | wing=0 | wing=0 | /
651// | chip=0 | chip=1 | chip=2 | chip=3 |
652// | key=0 | key=2 | key=4 | key=6 |
653// |____________|____________|____________|____________| -3.5085
654//-3.7632 -1.8816 0 1.1186 3.7632
655//
656// E.g. kNSubWing=2
657// ^x_loc (cm)
658// |
659// _________________________|__________________________ 3.5085
660// | chip=0 | chip=1 | chip=2 | chip=3 |
661// | key=2 | key=6 | key=10 | key=14 | subw=0
662// |____________|____________|____________|____________| wing=1
663// | chip=0 | chip=1 | chip=2 | chip=3 | subw=1
664// | key=3 | key=7 | key=11 | key=15 |
665// |____________|____________|____________|____________|_0________\ local z (cm)
666// | chip=0 | chip=1 | chip=2 | chip=3 | /
667// | key=1 | key=5 | key=9 | key=13 | subw=1
668// |____________|____________|____________|____________| wing=0
669// | chip=0 | chip=1 | chip=2 | chip=3 | subw=0
670// | key=0 | key=4 | key=8 | key=12 |
671// |____________|____________|____________|____________| -3.5085
672//-3.7632 -1.8816 0 1.1186 3.7632
673//
674if(key>=kNModule*kNChip*kNWing*kNSubWing)
675 {AliWarning("GetBlockBoundaries: you asked for a non existing key"); return kFALSE;}
676//
677const Float_t kDxDefault = 35085.; // For Plane Eff. purpouses, default values
678const Float_t kDzDefault = 75264.; // are precise enough !!!
679const Float_t kconv = 1.0E-04; //converts microns to cm.
680UInt_t chip=GetChipFromKey(key);
681UInt_t wing=GetWingFromKey(key);
682UInt_t subw=GetSubWingFromKey(key);
683zmn=kconv*(kDzDefault/kNChip*chip-0.5*kDzDefault);
684zmx=kconv*(kDzDefault/kNChip*(chip+1)-0.5*kDzDefault);
685if(wing==0) { // count from below
686xmn=kconv*(kDxDefault/kNSubWing*subw-kDxDefault);
687xmx=kconv*(kDxDefault/kNSubWing*(subw+1)-kDxDefault);
688}
689else if(wing==1) { // count from top
690xmx=kconv*(kDxDefault-kDxDefault/kNSubWing*subw);
691xmn=kconv*(kDxDefault-kDxDefault/kNSubWing*(subw+1));
692}
693else {AliError("GetBlockBoundaries: you got wrong n. of wing"); return kFALSE;}
694return kTRUE;
695}
3ebe30ad 696//__________________________________________________________
697void AliITSPlaneEffSDD::InitHistos() {
698 // for the moment let's create the histograms
699 // module by module
700 TString histnameResX="HistResX_mod_",aux;
701 TString histnameResZ="HistResZ_mod_";
702 TString histnameResXZ="HistResXZ_mod_";
703 TString histnameClusterType="HistClusterType_mod_";
704 TString histnameResXclu="HistResX_mod_";
705 TString histnameResZclu="HistResZ_mod_";
706 TString profnameResXvsX="ProfResXvsX_mod_";
707 TString profnameResZvsX="ProfResZvsX_mod_";
708 TString profnameClustSizeXvsX="ProfClustSizeXvsX_mod_";
709 TString profnameClustSizeZvsX="ProfClustSizeZvsX_mod_";
710//
711 fHisResX=new TH1F*[kNHisto];
712 fHisResZ=new TH1F*[kNHisto];
713 fHisResXZ=new TH2F*[kNHisto];
714 fHisClusterSize=new TH2I*[kNHisto];
715 fHisResXclu=new TH1F**[kNHisto];
716 fHisResZclu=new TH1F**[kNHisto];
717 fProfResXvsX=new TProfile*[kNHisto];
718 fProfResZvsX=new TProfile*[kNHisto];
719 fProfClustSizeXvsX=new TProfile*[kNHisto];
720 fProfClustSizeZvsX=new TProfile*[kNHisto];
721
722 for (Int_t nhist=0;nhist<kNHisto;nhist++){
723 aux=histnameResX;
724 aux+=nhist;
725 fHisResX[nhist]=new TH1F("histname","histname",1500,-0.15,0.15); // +- 1500 micron; 1 bin=2 micron
726 fHisResX[nhist]->SetName(aux.Data());
727 fHisResX[nhist]->SetTitle(aux.Data());
728
729 aux=histnameResZ;
730 aux+=nhist;
731 fHisResZ[nhist]=new TH1F("histname","histname",500,-0.05,0.05); // +-500 micron; 1 bin=2 micron
732 fHisResZ[nhist]->SetName(aux.Data());
733 fHisResZ[nhist]->SetTitle(aux.Data());
734
735 aux=histnameResXZ;
736 aux+=nhist;
737 fHisResXZ[nhist]=new TH2F("histname","histname",50,-0.1,0.1,30,-0.03,0.03); // binning:
738 // 40 micron in x;
739 // 20 micron in z;
740 fHisResXZ[nhist]->SetName(aux.Data());
741 fHisResXZ[nhist]->SetTitle(aux.Data());
742
743 aux=histnameClusterType;
744 aux+=nhist;
745 fHisClusterSize[nhist]=new TH2I("histname","histname",10,0.5,10.5,10,0.5,10.5);
746 fHisClusterSize[nhist]->SetName(aux.Data());
747 fHisClusterSize[nhist]->SetTitle(aux.Data());
748
749 fHisResXclu[nhist]=new TH1F*[kNclu];
750 fHisResZclu[nhist]=new TH1F*[kNclu];
751 for(Int_t clu=0; clu<kNclu; clu++) { // clu=0 --> cluster size 1
752 aux=histnameResXclu;
753 aux+=nhist;
754 aux+="_clu_";
755 aux+=clu+1; // clu=0 --> cluster size 1
756 fHisResXclu[nhist][clu]=new TH1F("histname","histname",1500,-0.15,0.15);// +- 1500 micron; 1 bin=2 micron
757 fHisResXclu[nhist][clu]->SetName(aux.Data());
758 fHisResXclu[nhist][clu]->SetTitle(aux.Data());
759
760 aux=histnameResZclu;
761 aux+=nhist;
762 aux+="_clu_";
763 aux+=clu+1; // clu=0 --> cluster size 1
764 fHisResZclu[nhist][clu]=new TH1F("histname","histname",500,-0.05,0.05); // +-500 micron; 1 bin=2 micron
765 fHisResZclu[nhist][clu]->SetName(aux.Data());
766 fHisResZclu[nhist][clu]->SetTitle(aux.Data());
767 }
768
769 aux=profnameResXvsX;
770 aux+=nhist;
771 fProfResXvsX[nhist]=new TProfile("histname","histname",140,-3.5,-3.5);
772 fProfResXvsX[nhist]->SetName(aux.Data());
773 fProfResXvsX[nhist]->SetTitle(aux.Data());
774
775 aux=profnameResZvsX;
776 aux+=nhist;
777 fProfResZvsX[nhist]=new TProfile("histname","histname",140,-3.5,-3.5);
778 fProfResZvsX[nhist]->SetName(aux.Data());
779 fProfResZvsX[nhist]->SetTitle(aux.Data());
780
781 aux=profnameClustSizeXvsX;
782 aux+=nhist;
783 fProfClustSizeXvsX[nhist]=new TProfile("histname","histname",140,-3.5,-3.5);
784 fProfClustSizeXvsX[nhist]->SetName(aux.Data());
785 fProfClustSizeXvsX[nhist]->SetTitle(aux.Data());
786
787 aux=profnameClustSizeZvsX;
788 aux+=nhist;
789 fProfClustSizeZvsX[nhist]=new TProfile("histname","histname",140,-3.5,-3.5);
790 fProfClustSizeZvsX[nhist]->SetName(aux.Data());
791 fProfClustSizeZvsX[nhist]->SetTitle(aux.Data());
792
793 }
794return;
795}
796//__________________________________________________________
797void AliITSPlaneEffSDD::DeleteHistos() {
798 if(fHisResX) {
799 for (Int_t i=0; i<kNHisto; i++ ) delete fHisResX[i];
800 delete [] fHisResX; fHisResX=0;
801 }
802 if(fHisResZ) {
803 for (Int_t i=0; i<kNHisto; i++ ) delete fHisResZ[i];
804 delete [] fHisResZ; fHisResZ=0;
805 }
806 if(fHisResXZ) {
807 for (Int_t i=0; i<kNHisto; i++ ) delete fHisResXZ[i];
808 delete [] fHisResXZ; fHisResXZ=0;
809 }
810 if(fHisClusterSize) {
811 for (Int_t i=0; i<kNHisto; i++ ) delete fHisClusterSize[i];
812 delete [] fHisClusterSize; fHisClusterSize=0;
813 }
814 if(fHisResXclu) {
815 for (Int_t i=0; i<kNHisto; i++ ) {
816 for (Int_t clu=0; clu<kNclu; clu++) if (fHisResXclu[i][clu]) delete fHisResXclu[i][clu];
817 delete [] fHisResXclu[i];
818 }
819 delete [] fHisResXclu;
820 fHisResXclu = 0;
821 }
822 if(fHisResZclu) {
823 for (Int_t i=0; i<kNHisto; i++ ) {
824 for (Int_t clu=0; clu<kNclu; clu++) if (fHisResZclu[i][clu]) delete fHisResZclu[i][clu];
825 delete [] fHisResZclu[i];
826 }
827 delete [] fHisResZclu;
828 fHisResZclu = 0;
829 }
830 if(fProfResXvsX) {
831 for (Int_t i=0; i<kNHisto; i++ ) delete fProfResXvsX[i];
832 delete [] fProfResXvsX; fProfResXvsX=0;
833 }
834 if(fProfResZvsX) {
835 for (Int_t i=0; i<kNHisto; i++ ) delete fProfResZvsX[i];
836 delete [] fProfResZvsX; fProfResZvsX=0;
837 }
838 if(fProfClustSizeXvsX) {
839 for (Int_t i=0; i<kNHisto; i++ ) delete fProfClustSizeXvsX[i];
840 delete [] fProfClustSizeXvsX; fProfClustSizeXvsX=0;
841 }
842 if(fProfClustSizeZvsX) {
843 for (Int_t i=0; i<kNHisto; i++ ) delete fProfClustSizeZvsX[i];
844 delete [] fProfClustSizeZvsX; fProfClustSizeZvsX=0;
845 }
846
847return;
848}
849//__________________________________________________________
850Bool_t AliITSPlaneEffSDD::FillHistos(UInt_t key, Bool_t found,
1cc5cedc 851 // Float_t tXZ[2], Float_t cXZ[2], Int_t ctXZ[2]) {
852 Float_t *tr, Float_t *clu, Int_t *csize) {
3ebe30ad 853// this method fill the histograms
854// input: - key: unique key of the basic block
855// - found: Boolean to asses whether a cluster has been associated to the track or not
1cc5cedc 856// - tr[0],tr[1] local X and Z coordinates of the track prediction, respectively
857// - tr[2],tr[3] error on local X and Z coordinates of the track prediction, respectively
858// - clu[0],clu[1] local X and Z coordinates of the cluster associated to the track, respectively
859// - clu[2],clu[3] error on local X and Z coordinates of the cluster associated to the track, respectively
860// - csize[0][1] cluster size in X and Z, respectively
3ebe30ad 861// output: kTRUE if filling was succesfull kFALSE otherwise
862// side effects: updating of the histograms.
863//
864 if (!fHis) {
865 AliWarning("FillHistos: histograms do not exist! Call SetCreateHistos(kTRUE) first");
866 return kFALSE;
867 }
868 if(key>=kNModule*kNChip*kNWing*kNSubWing)
869 {AliWarning("FillHistos: you asked for a non existing key"); return kFALSE;}
870 Int_t id=GetModFromKey(key);
871 if(id>=kNHisto)
872 {AliWarning("FillHistos: you want to fill a non-existing histos"); return kFALSE;}
873 if(found) {
1cc5cedc 874 Float_t resx=tr[0]-clu[0];
875 Float_t resz=tr[1]-clu[1];
3ebe30ad 876 fHisResX[id]->Fill(resx);
877 fHisResZ[id]->Fill(resz);
878 fHisResXZ[id]->Fill(resx,resz);
1cc5cedc 879 fHisClusterSize[id]->Fill((Double_t)csize[0],(Double_t)csize[1]);
880 if(csize[0]>0 && csize[0]<=kNclu) fHisResXclu[id][csize[0]-1]->Fill(resx);
881 if(csize[1]>0 && csize[1]<=kNclu) fHisResZclu[id][csize[1]-1]->Fill(resz);
882 fProfResXvsX[id]->Fill(clu[0],resx);
883 fProfResZvsX[id]->Fill(clu[0],resz);
884 fProfClustSizeXvsX[id]->Fill(clu[0],(Double_t)csize[0]);
885 fProfClustSizeZvsX[id]->Fill(clu[0],(Double_t)csize[1]);
3ebe30ad 886 }
887 return kTRUE;
888}
889//__________________________________________________________
890Bool_t AliITSPlaneEffSDD::WriteHistosToFile(TString filename, Option_t* option) {
891 //
892 // Saves the histograms into a tree and saves the trees into a file
893 //
894 if (!fHis) return kFALSE;
895 if (filename.Data()=="") {
896 AliWarning("WriteHistosToFile: null output filename!");
897 return kFALSE;
898 }
899 char branchname[30];
900 TFile *hFile=new TFile(filename.Data(),option,
901 "The File containing the TREEs with ITS PlaneEff Histos");
902 TTree *SDDTree=new TTree("SDDTree","Tree whith Residuals and Cluster Type distributions for SDD");
903 TH1F *histZ,*histX;
904 TH2F *histXZ;
905 TH2I *histClusterType;
906 TH1F *histXclu[kNclu];
907 TH1F *histZclu[kNclu];
908 TProfile *profileResXvsX, *profileResZvsX, *profileClSizXvsX, *profileClSizZvsX;
909
910 histZ=new TH1F();
911 histX=new TH1F();
912 histXZ=new TH2F();
913 histClusterType=new TH2I();
914 for(Int_t clu=0;clu<kNclu;clu++) {
915 histXclu[clu]=new TH1F();
916 histZclu[clu]=new TH1F();
917 }
918 profileResXvsX=new TProfile();
919 profileResZvsX=new TProfile();
920 profileClSizXvsX=new TProfile();
921 profileClSizZvsX=new TProfile();
922
923 SDDTree->Branch("histX","TH1F",&histX,128000,0);
924 SDDTree->Branch("histZ","TH1F",&histZ,128000,0);
925 SDDTree->Branch("histXZ","TH2F",&histXZ,128000,0);
926 SDDTree->Branch("histClusterType","TH2I",&histClusterType,128000,0);
927 for(Int_t clu=0;clu<kNclu;clu++) {
928 sprintf(branchname,"histXclu_%d",clu+1);
929 SDDTree->Branch(branchname,"TH1F",&histXclu[clu],128000,0);
930 sprintf(branchname,"histZclu_%d",clu+1);
931 SDDTree->Branch(branchname,"TH1F",&histZclu[clu],128000,0);
932 }
933 SDDTree->Branch("profileResXvsX","TProfile",&profileResXvsX,128000,0);
934 SDDTree->Branch("profileResZvsX","TProfile",&profileResZvsX,128000,0);
935 SDDTree->Branch("profileClSizXvsX","TProfile",&profileClSizXvsX,128000,0);
936 SDDTree->Branch("profileClSizZvsX","TProfile",&profileClSizZvsX,128000,0);
937
938 for(Int_t j=0;j<kNHisto;j++){
939 histX=fHisResX[j];
940 histZ=fHisResZ[j];
941 histXZ=fHisResXZ[j];
942 histClusterType=fHisClusterSize[j];
943 for(Int_t clu=0;clu<kNclu;clu++) {
944 histXclu[clu]=fHisResXclu[j][clu];
945 histZclu[clu]=fHisResZclu[j][clu];
946 }
947 profileResXvsX=fProfResXvsX[j];
948 profileResZvsX=fProfResZvsX[j];
949 profileClSizXvsX=fProfClustSizeXvsX[j];
950 profileClSizZvsX=fProfClustSizeZvsX[j];
951
952 SDDTree->Fill();
953 }
954 hFile->Write();
955 hFile->Close();
956return kTRUE;
957}
958//__________________________________________________________
959Bool_t AliITSPlaneEffSDD::ReadHistosFromFile(TString filename) {
960 //
961 // Read histograms from an already existing file
962 //
963 if (!fHis) return kFALSE;
964 if (filename.Data()=="") {
965 AliWarning("ReadHistosFromFile: incorrect output filename!");
966 return kFALSE;
967 }
968 char branchname[30];
969
970 TH1F *h = 0;
971 TH2F *h2 = 0;
972 TH2I *h2i= 0;
973 TProfile *p = 0;
974
975 TFile *file=TFile::Open(filename.Data(),"READONLY");
976
977 if (!file || file->IsZombie()) {
978 AliWarning(Form("Can't open %s !",filename.Data()));
979 delete file;
980 return kFALSE;
981 }
982 TTree *tree = (TTree*) file->Get("SDDTree");
983
984 TBranch *histX = (TBranch*) tree->GetBranch("histX");
985 TBranch *histZ = (TBranch*) tree->GetBranch("histZ");
986 TBranch *histXZ = (TBranch*) tree->GetBranch("histXZ");
987 TBranch *histClusterType = (TBranch*) tree->GetBranch("histClusterType");
988
989 TBranch *histXclu[kNclu], *histZclu[kNclu];
990 for(Int_t clu=0; clu<kNclu; clu++) {
991 sprintf(branchname,"histXclu_%d",clu+1);
992 histXclu[clu]= (TBranch*) tree->GetBranch(branchname);
993 sprintf(branchname,"histZclu_%d",clu+1);
994 histZclu[clu]= (TBranch*) tree->GetBranch(branchname);
995 }
996 TBranch *profileResXvsX = (TBranch*) tree->GetBranch("profileResXvsX");
997 TBranch *profileResZvsX = (TBranch*) tree->GetBranch("profileResZvsX");
998 TBranch *profileClSizXvsX = (TBranch*) tree->GetBranch("profileClSizXvsX");
999 TBranch *profileClSizZvsX = (TBranch*) tree->GetBranch("profileClSizZvsX");
1000
1001 gROOT->cd();
1002
1003 Int_t nevent = (Int_t)histX->GetEntries();
1004 if(nevent!=kNHisto)
1005 {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
1006 histX->SetAddress(&h);
1007 for(Int_t j=0;j<kNHisto;j++){
1008 delete h; h=0;
1009 histX->GetEntry(j);
1010 fHisResX[j]->Add(h);
1011 }
1012
1013 nevent = (Int_t)histZ->GetEntries();
1014 if(nevent!=kNHisto)
1015 {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
1016 histZ->SetAddress(&h);
1017 for(Int_t j=0;j<kNHisto;j++){
1018 delete h; h=0;
1019 histZ->GetEntry(j);
1020 fHisResZ[j]->Add(h);
1021 }
1022
1023 nevent = (Int_t)histXZ->GetEntries();
1024 if(nevent!=kNHisto)
1025 {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
1026 histXZ->SetAddress(&h2);
1027 for(Int_t j=0;j<kNHisto;j++){
1028 delete h2; h2=0;
1029 histXZ->GetEntry(j);
1030 fHisResXZ[j]->Add(h2);
1031 }
1032
1033 nevent = (Int_t)histClusterType->GetEntries();
1034 if(nevent!=kNHisto)
1035 {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
1036 histClusterType->SetAddress(&h2i);
1037 for(Int_t j=0;j<kNHisto;j++){
1038 delete h2i; h2i=0;
1039 histClusterType->GetEntry(j);
1040 fHisClusterSize[j]->Add(h2i);
1041 }
1042
1043 for(Int_t clu=0; clu<kNclu; clu++) {
1044
1045 nevent = (Int_t)histXclu[clu]->GetEntries();
1046 if(nevent!=kNHisto)
1047 {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
1048 histXclu[clu]->SetAddress(&h);
1049 for(Int_t j=0;j<kNHisto;j++){
1050 delete h; h=0;
1051 histXclu[clu]->GetEntry(j);
1052 fHisResXclu[j][clu]->Add(h);
1053 }
1054
1055 nevent = (Int_t)histZclu[clu]->GetEntries();
1056 if(nevent!=kNHisto)
1057 {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
1058 histZclu[clu]->SetAddress(&h);
1059 for(Int_t j=0;j<kNHisto;j++){
1060 delete h; h=0;
1061 histZclu[clu]->GetEntry(j);
1062 fHisResZclu[j][clu]->Add(h);
1063 }
1064 }
1065
1066 nevent = (Int_t)profileResXvsX->GetEntries();
1067 if(nevent!=kNHisto)
1068 {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
1069 profileResXvsX->SetAddress(&p);
1070 for(Int_t j=0;j<kNHisto;j++){
1071 delete p; p=0;
1072 profileResXvsX->GetEntry(j);
1073 fProfResXvsX[j]->Add(p);
1074 }
1075
1076 nevent = (Int_t)profileResZvsX->GetEntries();
1077 if(nevent!=kNHisto)
1078 {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
1079 profileResZvsX->SetAddress(&p);
1080 for(Int_t j=0;j<kNHisto;j++){
1081 delete p; p=0;
1082 profileResZvsX->GetEntry(j);
1083 fProfResZvsX[j]->Add(p);
1084 }
1085
1086 nevent = (Int_t)profileClSizXvsX->GetEntries();
1087 if(nevent!=kNHisto)
1088 {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
1089 profileClSizXvsX->SetAddress(&p);
1090 for(Int_t j=0;j<kNHisto;j++){
1091 delete p; p=0;
1092 profileClSizXvsX->GetEntry(j);
1093 fProfClustSizeXvsX[j]->Add(p);
1094 }
1095
1096 nevent = (Int_t)profileClSizZvsX->GetEntries();
1097 if(nevent!=kNHisto)
1098 {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;}
1099 profileClSizZvsX->SetAddress(&p);
1100 for(Int_t j=0;j<kNHisto;j++){
1101 delete p; p=0;
1102 profileClSizZvsX->GetEntry(j);
1103 fProfClustSizeZvsX[j]->Add(p);
1104 }
1105
1106 delete h; h=0;
1107 delete h2; h2=0;
1108 delete h2i; h2i=0;
1109 delete p; p=0;
1110
1111 if (file) {
1112 file->Close();
1113 }
1114return kTRUE;
1115}
1116