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