X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSPlaneEffSPD.cxx;h=30f6b3a0af4b589e8489bb80fdd9e97c722c5b92;hb=52a03fbef06b8f02ad17dd66b5185213a1cc99ed;hp=45b2408ac4c35ffcc82ddf3c781796e1e9efc92e;hpb=4a66240a5bc4866c9b2bed4742dee48389149b0e;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSPlaneEffSPD.cxx b/ITS/AliITSPlaneEffSPD.cxx index 45b2408ac4c..30f6b3a0af4 100644 --- a/ITS/AliITSPlaneEffSPD.cxx +++ b/ITS/AliITSPlaneEffSPD.cxx @@ -24,24 +24,47 @@ /* $Id$ */ +#include +#include +#include +#include +#include #include "AliITSPlaneEffSPD.h" #include "AliLog.h" #include "AliCDBStorage.h" #include "AliCDBEntry.h" #include "AliCDBManager.h" //#include "AliCDBRunRange.h" +#include "AliITSsegmentationSPD.h" #include "AliITSCalibrationSPD.h" ClassImp(AliITSPlaneEffSPD) //______________________________________________________________________ AliITSPlaneEffSPD::AliITSPlaneEffSPD(): - AliITSPlaneEff(){ -// for (UInt_t im=0; imCopy(*fHisResX[i]); + s.fHisResZ[i]->Copy(*fHisResZ[i]); + s.fHisResXZ[i]->Copy(*fHisResXZ[i]); + s.fHisClusterSize[i]->Copy(*fHisClusterSize[i]); + for(Int_t clu=0; clu cluster size 1 + s.fHisResXclu[i][clu]->Copy(*fHisResXclu[i][clu]); + s.fHisResZclu[i][clu]->Copy(*fHisResZclu[i][clu]); + s.fProfResXvsPhiclu[i][clu]->Copy(*fProfResXvsPhiclu[i][clu]); + s.fProfResZvsDipclu[i][clu]->Copy(*fProfResZvsDipclu[i][clu]); + } + for(Int_t chip=0; chipCopy(*fHisResXchip[i][chip]); + s.fHisResZchip[i][chip]->Copy(*fHisResZchip[i][chip]); + } + s.fProfResXvsPhi[i]->Copy(*fProfResXvsPhi[i]); + s.fProfResZvsDip[i]->Copy(*fProfResZvsDip[i]); + s.fHisTrackErrX[i]->Copy(*fHisTrackErrX[i]); + s.fHisTrackErrZ[i]->Copy(*fHisTrackErrZ[i]); + s.fHisClusErrX[i]->Copy(*fHisClusErrX[i]); + s.fHisClusErrZ[i]->Copy(*fHisClusErrZ[i]); + for(Int_t phas=0; phasCopy(*fHisTrackXFOtrue[i][phas]); + s.fHisTrackZFOtrue[i][phas]->Copy(*fHisTrackXFOtrue[i][phas]); + s.fHisTrackXFOfalse[i][phas]->Copy(*fHisTrackXFOtrue[i][phas]); + s.fHisTrackZFOfalse[i][phas]->Copy(*fHisTrackXFOtrue[i][phas]); + s.fHisTrackXZFOtrue[i][phas]->Copy(*fHisTrackXFOtrue[i][phas]); + s.fHisTrackXZFOfalse[i][phas]->Copy(*fHisTrackXFOtrue[i][phas]); + } + } + } } //_________________________________________________________________________ AliITSPlaneEffSPD& AliITSPlaneEffSPD::operator+=(const AliITSPlaneEffSPD &add){ @@ -80,10 +163,42 @@ AliITSPlaneEffSPD& AliITSPlaneEffSPD::operator+=(const AliITSPlaneEffSPD &add){ // none. // Return: // none - for (UInt_t i=0; iAdd(add.fHisResX[i]); + fHisResZ[i]->Add(add.fHisResZ[i]); + fHisResXZ[i]->Add(add.fHisResXZ[i]); + fHisClusterSize[i]->Add(add.fHisClusterSize[i]); + for(Int_t clu=0; clu cluster size 1 + fHisResXclu[i][clu]->Add(add.fHisResXclu[i][clu]); + fHisResZclu[i][clu]->Add(add.fHisResZclu[i][clu]); + fProfResXvsPhiclu[i][clu]->Add(add.fProfResXvsPhiclu[i][clu]); + fProfResZvsDipclu[i][clu]->Add(add.fProfResZvsDipclu[i][clu]); + } + for(Int_t chip=0; chipAdd(add.fHisResXchip[i][chip]); + fHisResZchip[i][chip]->Add(add.fHisResZchip[i][chip]); + } + fProfResXvsPhi[i]->Add(add.fProfResXvsPhi[i]); + fProfResZvsDip[i]->Add(add.fProfResZvsDip[i]); + fHisTrackErrX[i]->Add(add.fHisTrackErrX[i]); + fHisTrackErrZ[i]->Add(add.fHisTrackErrZ[i]); + fHisClusErrX[i]->Add(add.fHisClusErrX[i]); + fHisClusErrZ[i]->Add(add.fHisClusErrZ[i]); + for(Int_t phas=0; phasAdd(add.fHisTrackXFOtrue[i][phas]); + fHisTrackZFOtrue[i][phas]->Add(add.fHisTrackXFOtrue[i][phas]); + fHisTrackXFOfalse[i][phas]->Add(add.fHisTrackXFOtrue[i][phas]); + fHisTrackZFOfalse[i][phas]->Add(add.fHisTrackXFOtrue[i][phas]); + fHisTrackXZFOtrue[i][phas]->Add(add.fHisTrackXFOtrue[i][phas]); + fHisTrackXZFOfalse[i][phas]->Add(add.fHisTrackXFOtrue[i][phas]); + } + } + } return *this; } //______________________________________________________________________ @@ -98,41 +213,97 @@ AliITSPlaneEffSPD& AliITSPlaneEffSPD::operator=(const // Return: if(this==&s) return *this; + this->~AliITSPlaneEffSPD(); + new(this) AliITSPlaneEffSPD(); s.Copy(*this); -// if(&s == this) return *this; -// for (UInt_t i=0; ifFound[i] = s.fFound[i]; -// this->fTried[i] = s.fTried[i]; -// } return *this; } //______________________________________________________________________ void AliITSPlaneEffSPD::Copy(TObject &obj) const { // protected method. copy this to obj AliITSPlaneEff::Copy(obj); - //((AliITSPlaneEffSPD& ) obj).fNpx = fNpx; - for(Int_t i=0;i cluster size 1 + target.fHisResXclu[i][clu] = new TH1F(*fHisResXclu[i][clu]); + target.fHisResZclu[i][clu] = new TH1F(*fHisResZclu[i][clu]); + target.fProfResXvsPhiclu[i][clu] = new TProfile(*fProfResXvsPhiclu[i][clu]); + target.fProfResZvsDipclu[i][clu] = new TProfile(*fProfResZvsDipclu[i][clu]); + } + target.fHisResXchip[i]=new TH1F*[kNChip]; + target.fHisResZchip[i]=new TH1F*[kNChip]; + for(Int_t chip=0; chip Expected efficiency (e.g. those from actual estimate) // RelErr -> tollerance [0,1] - // im -> module number [0,249] - // ic -> chip number [0,5] + // im -> module number [0,239] + // ic -> chip number [0,4] // Outputs: none // Return: the estimated n. of tracks // if (im>=kNModule || ic>=kNChip) - {Error("AliITSPlaneEffSPD","you asked for a non existing chip"); + {AliError("GetMissingTracksForGivenEff: you asked for a non existing chip"); return -1;} -else return GetNTracksForGivenEff(eff,RelErr)-fTried[GetKey(im,ic)]; +else { + UInt_t key=GetKey(im,ic); + if(key module number [0,239] +// ic -> chip number [0,4] +// fo -> boolean, true in case of Fast Or studies +// bcm4 -> for Fast Or: bunch crossing % 4 if (im>=kNModule || ic>=kNChip) - {Error("AliITSPlaneEffSPD","you asked for a non existing chip"); return -1.;} - Int_t nf=fFound[GetKey(im,ic)]; - Int_t nt=fTried[GetKey(im,ic)]; + {AliError("PlaneEff(Uint_t,Uint_t): you asked for a non existing chip"); return -1.;} +if(fo && bcm4>=kNClockPhase) + {AliError("PlaneEff(Uint_t,Uint_t): you asked for Fast Or in a wrong phase"); return -1.;} +Int_t nf=-1; +Int_t nt=-1; +if(fo) { + AliWarning("PlaneEff: you asked for FO efficiency"); + UInt_t key=GetKey(im,ic,fo,bcm4); + if(key module number [0,239] + // ic -> chip number [0,4] +// fo -> boolean, true in case of Fast Or studies +// bcm4 -> for Fast Or: bunch crossing % 4 if (im>=kNModule || ic>=kNChip) - {Error("AliITSPlaneEffSPD","you asked for a non existing chip"); return -1.;} -Int_t nf=fFound[GetKey(im,ic)]; -Int_t nt=fTried[GetKey(im,ic)]; + {AliError("ErrPlaneEff(Uint_t,Uint_t): you asked for a non existing chip"); return -1.;} +if(fo && bcm4>=kNClockPhase) + {AliError("PlaneEff(Uint_t,Uint_t): you asked for Fast Or in a wrong phase"); return -1.;} +Int_t nf=-1; +Int_t nt=-1; +if(fo) { + AliWarning("ErrPlaneEff: you asked for FO efficiency"); + UInt_t key=GetKey(im,ic,fo,bcm4); + if(key=kNModule || ic>=kNChip) - {Error("AliITSPlaneEffSPD","you asked for a non existing chip"); return kFALSE;} - fTried[GetKey(im,ic)]++; - if(Kfound) fFound[GetKey(im,ic)]++; - return kTRUE; + {AliError("UpDatePlaneEff: you asked for a non existing chip"); return kFALSE;} +if(fo && bcm4>=kNClockPhase) + {AliError("UpDatePlaneEff: you asked for Fast Or in a wrong phase"); return kFALSE;} +if (!fo) { + UInt_t key=GetKey(im,ic); + if(key=kNCol*kNChip) - {Error("AliITSPlaneEffSPD","you asked for a non existing column"); return 10;} + {AliDebug(1,Form("GetChipFromCol: you asked for a non existing column %d",col)); return 10;} return col/kNCol; } //__________________________________________________________________________ -UInt_t AliITSPlaneEffSPD::GetKey(const UInt_t mod, const UInt_t chip) const { +UInt_t AliITSPlaneEffSPD::GetKey(const UInt_t mod, const UInt_t chip, const Bool_t FO, const UInt_t BCm4) const { // get key given a basic block +UInt_t key=99999; if(mod>=kNModule || chip>=kNChip) - {Error("AliITSPlaneEffSPD::GetKey","you asked for a non existing block"); return 99999;} -return mod*kNChip+chip; + {AliDebug(1,"GetKey: you asked for a non existing block"); return 99999;} +key = mod*kNChip+chip; +if(FO) { + if(BCm4>= kNClockPhase) {AliDebug(1,"GetKey: you have asked Fast OR and a non exisiting BC modulo 4"); return 99999;} + key += kNModule*kNChip*(BCm4+1); +} +return key; +} +//__________________________________________________________________________ +UInt_t AliITSPlaneEffSPD::SwitchChipKeyNumbering(UInt_t key) const { + +// methods to switch from offline chip key numbering +// to online Raw Stream chip numbering and viceversa. +// Used for Fast-Or studies. +// Implemented by valerio.altini@ba.infn.it + +if(key>=kNModule*kNChip*(kNClockPhase+1)) + {AliDebug(1,"SwitchChipKeyNumbering: you asked for a non existing key"); return 99999;} +UInt_t mod=9999,chip=9999,phase=9999; +GetModAndChipFromKey(key,mod,chip); +if(mod=kNModule*kNChip) - {Error("AliITSPlaneEffSPD::GetModFromKey","you asked for a non existing key"); return 9999;} -return key/kNChip; +if(key>=kNModule*kNChip*(kNClockPhase+1)) + {AliError("GetModFromKey: you asked for a non existing key"); return 9999;} +return (key%(kNModule*kNChip))/kNChip; } //__________________________________________________________________________ UInt_t AliITSPlaneEffSPD::GetChipFromKey(const UInt_t key) const { // retrieves chip from key -if(key>=kNModule*kNChip) - {Error("AliITSPlaneEffSPD::GetChipFromKey","you asked for a non existing key"); return 999;} -return (key%(kNModule*kNChip))%kNChip; +if(key>=kNModule*kNChip*(kNClockPhase+1)) + {AliError("GetChipFromKey: you asked for a non existing key"); return 999;} +return ((key%(kNModule*kNChip))%(kNModule*kNChip))%kNChip; +} +//__________________________________________________________________________ +UInt_t AliITSPlaneEffSPD::GetBCm4FromKey(const UInt_t key) const { + // retrieves the "Bunch Crossing modulo 4" (for Fast Or studies) +if(key>=kNModule*kNChip*(kNClockPhase+1)) + {AliError("GetBCm4FromKey: you asked for a non existing key"); return 999;} +if(key=kNModule*kNChip) return kTRUE; +else return kFALSE; } //__________________________________________________________________________ void AliITSPlaneEffSPD::GetModAndChipFromKey(const UInt_t key,UInt_t& mod,UInt_t& chip) const { // get module and chip from a key -if(key>=kNModule*kNChip) - {Error("AliITSPlaneEffSPD::GetModAndChipFromKey","you asked for a non existing key"); +if(key>=kNModule*kNChip*(kNClockPhase+1)) + {AliError("GetModAndChipFromKey: you asked for a non existing key"); mod=9999; chip=999; return;} -mod=key/kNChip; -chip=(key%(kNModule*kNChip))%kNChip; +mod=GetModFromKey(key); +chip=GetChipFromKey(key); return; } //____________________________________________________________________________ Double_t AliITSPlaneEffSPD::LivePlaneEff(UInt_t key) const { - // returns plane efficieny multiplied by the fraction of sensor which is OK + // returns plane efficieny after adding the fraction of sensor which is bad if(key>=kNModule*kNChip) - {Error("AliITSPlaneEffSPD::LivePlaneEff","you asked for a non existing key"); + {AliError("LivePlaneEff: you asked for a non existing key"); return -1.;} -return PlaneEff(key)*GetFracLive(key); +Double_t leff=AliITSPlaneEff::LivePlaneEff(0); // this just for the Warning +leff=PlaneEff(key)+GetFracBad(key); +return leff>1?1:leff; } //____________________________________________________________________________ Double_t AliITSPlaneEffSPD::ErrLivePlaneEff(UInt_t key) const { // returns error on live plane efficiency if(key>=kNModule*kNChip) - {Error("AliITSPlaneEffSPD::LivePlaneEff","you asked for a non existing key"); + {AliError("ErrLivePlaneEff: you asked for a non existing key"); return -1.;} -return ErrPlaneEff(key); // for the time being: to be checked +Int_t nf=fFound[key]; +Double_t triedInLive=GetFracLive(key)*fTried[key]; +Int_t nt=TMath::Max(nf,TMath::Nint(triedInLive)); +return AliITSPlaneEff::ErrPlaneEff(nf,nt); // for the time being: to be checked } //_____________________________________________________________________________ Double_t AliITSPlaneEffSPD::GetFracLive(const UInt_t key) const { // returns the fraction of the sensor which is OK if(key>=kNModule*kNChip) - {Error("AliITSPlaneEffSPD::GetRelLiveDetector","you asked for a non existing key"); + {AliError("GetFracLive: you asked for a non existing key"); return -1.;} // Compute the fraction of bad (dead+noisy) detector UInt_t dead=0,noisy=0; @@ -263,12 +534,12 @@ void AliITSPlaneEffSPD::GetDeadAndNoisyInChip(const UInt_t key, nrDeadInChip=0; nrNoisyInChip=0; if(key>=kNModule*kNChip) - {Error("AliITSPlaneEffSPD::GetRelLiveDetector","you asked for a non existing key"); + {AliError("GetDeadAndNoisyInChip: you asked for a non existing key"); return;} // Compute the number of bad (dead+noisy) pixel in a chip // if(!fInitCDBCalled) - {Error("AliITSPlaneEffSPD::GetRelLiveDetector","CDB not inizialized: call InitCDB first"); + {AliError("GetDeadAndNoisyInChip: CDB not inizialized: call InitCDB first"); return;}; AliCDBManager* man = AliCDBManager::Instance(); // retrieve map of dead Pixel @@ -277,22 +548,35 @@ TObjArray* spdDead; if(cdbSPDDead) { spdDead = (TObjArray*)cdbSPDDead->GetObject(); if(!spdDead) - {Error("AliITSPlaneEffSPD::GetRelLiveDetector"," SPDDead not found in CDB"); + {AliError("GetDeadAndNoisyInChip: SPDDead not found in CDB"); return;} } else { - Error("AliITSPlaneEffSPD::GetRelLiveDetector","Did not find Calib/SPDDead."); + AliError("GetDeadAndNoisyInChip: did not find Calib/SPDDead."); return; } +// retrieve map of sparse dead Pixel +AliCDBEntry *cdbSPDSparseDead = man->Get("ITS/Calib/SPDSparseDead", fRunNumber); +TObjArray* spdSparseDead; +if(cdbSPDSparseDead) { + spdSparseDead = (TObjArray*)cdbSPDSparseDead->GetObject(); + if(!spdSparseDead) + {AliError("GetDeadAndNoisyInChip: SPDSparseDead not found in CDB"); + return;} +} else { + AliError("GetDeadAndNoisyInChip: did not find Calib/SPDSparseDead."); + return; +} + // retrieve map of noisy Pixel AliCDBEntry *cdbSPDNoisy = man->Get("ITS/Calib/SPDNoisy", fRunNumber); TObjArray* spdNoisy; if(cdbSPDNoisy) { spdNoisy = (TObjArray*)cdbSPDNoisy->GetObject(); if(!spdNoisy) - {Error("AliITSPlaneEffSPD::GetRelLiveDetector"," SPDNoisy not found in CDB"); + {AliError("GetDeadAndNoisyInChip: SPDNoisy not found in CDB"); return;} } else { - Error("AliITSPlaneEffSPD::GetRelLiveDetector","Did not find Calib/SPDNoisy."); + AliError("GetDeadAndNoisyInChip: did not find Calib/SPDNoisy."); return; } // @@ -302,12 +586,18 @@ UInt_t chip=GetChipFromKey(key); AliITSCalibrationSPD* calibSPD=(AliITSCalibrationSPD*) spdDead->At(mod); UInt_t nrDead = calibSPD->GetNrBad(); for (UInt_t index=0; indexGetBadColAt(index))==chip) nrDeadInChip++; + if(GetChipFromCol(calibSPD->GetBadColAt(index))==chip) nrDeadInChip++; +} +// add the number of sparse dead to the previous dead +calibSPD=(AliITSCalibrationSPD*) spdSparseDead->At(mod); +UInt_t nrSparseDead = calibSPD->GetNrBad(); +for (UInt_t index=0; indexGetBadColAt(index))==chip) nrDeadInChip++; } calibSPD=(AliITSCalibrationSPD*) spdNoisy->At(mod); UInt_t nrNoisy = calibSPD->GetNrBad(); for (UInt_t index=0; indexGetBadColAt(index))==chip) nrNoisyInChip++; + if(GetChipFromCol(calibSPD->GetBadColAt(index))==chip) nrNoisyInChip++; } return; } @@ -315,7 +605,7 @@ return; Double_t AliITSPlaneEffSPD::GetFracBad(const UInt_t key) const { // returns 1-fractional live if(key>=kNModule*kNChip) - {Error("AliITSPlaneEffSPD::GetRelDeadDetector","you asked for a non existing key"); + {AliError("GetFracBad: you asked for a non existing key"); return -1.;} return 1.-GetFracLive(key); } @@ -323,11 +613,11 @@ return 1.-GetFracLive(key); Bool_t AliITSPlaneEffSPD::WriteIntoCDB() const { // write onto CDB if(!fInitCDBCalled) - {Error("AliITSPlaneEffSPD::WriteIntoCDB","CDB not inizialized: call InitCDB first"); + {AliError("WriteIntoCDB: CDB not inizialized. Call InitCDB first"); return kFALSE;} // to be written properly: now only for debugging AliCDBMetaData *md= new AliCDBMetaData(); // metaData describing the object - md->SetObjectClassName("AliITSPlaneEff"); + //md->SetObjectClassName("AliITSPlaneEff"); md->SetResponsible("Giuseppe Eugenio Bruno"); md->SetBeamPeriod(0); md->SetAliRootVersion("head 19/11/07"); //root version @@ -342,14 +632,1061 @@ if(!fInitCDBCalled) Bool_t AliITSPlaneEffSPD::ReadFromCDB() { // read from CDB if(!fInitCDBCalled) - {Error("AliITSPlaneEffSPD::ReadFromCDB","CDB not inizialized: call InitCDB first"); + {AliError("ReadFromCDB: CDB not inizialized. Call InitCDB first"); return kFALSE;} -//if(!AliCDBManager::Instance()->IsDefaultStorageSet()) { -// AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT"); -// } AliCDBEntry *cdbEntry = AliCDBManager::Instance()->Get("ITS/PlaneEff/PlaneEffSPD",fRunNumber); +if(!cdbEntry) return kFALSE; AliITSPlaneEffSPD* eff= (AliITSPlaneEffSPD*)cdbEntry->GetObject(); if(this==eff) return kFALSE; -eff->Copy(*this); +if(fHis) CopyHistos(*eff); // If histos already exist then copy them to eff +eff->Copy(*this); // copy everything (statistics and histos) from eff to this +return kTRUE; +} +//_____________________________________________________________________________ +Bool_t AliITSPlaneEffSPD::AddFromCDB(AliCDBId *cdbId) { +AliCDBEntry *cdbEntry=0; +if (!cdbId) { + if(!fInitCDBCalled) + {AliError("ReadFromCDB: CDB not inizialized. Call InitCDB first"); return kFALSE;} + cdbEntry = AliCDBManager::Instance()->Get("ITS/PlaneEff/PlaneEffSPD",fRunNumber); +} else { + cdbEntry = AliCDBManager::Instance()->Get(*cdbId); +} +if(!cdbEntry) return kFALSE; +AliITSPlaneEffSPD* eff= (AliITSPlaneEffSPD*)cdbEntry->GetObject(); +*this+=*eff; +return kTRUE; +} +//_____________________________________________________________________________ +UInt_t AliITSPlaneEffSPD::GetKeyFromDetLocCoord(Int_t ilay, Int_t idet, + Float_t, Float_t locz) const { +// method to locate a basic block from Detector Local coordinate (to be used in tracking) +UInt_t key=999999; +if(ilay<0 || ilay>1) + {AliError("GetKeyFromDetLocCoord: you asked for a non existing layer"); + return key;} +if(ilay==0 && (idet<0 || idet>79)) + {AliError("GetKeyFromDetLocCoord: you asked for a non existing detector"); + return key;} +if(ilay==1 && (idet<0 || idet>159)) + {AliError("GetKeyFromDetLocCoord: you asked for a non existing detector"); + return key;} + +UInt_t mod=idet; +if(ilay==1) mod+=80; +key=GetKey(mod,GetChipFromCol(GetColFromLocZ(locz))); +return key; +} +//_____________________________________________________________________________ +UInt_t AliITSPlaneEffSPD::GetColFromLocZ(Float_t zloc) const { +// method to retrieve column number from the local z coordinate + UInt_t col=0; + AliITSsegmentationSPD spd; + Int_t ix,iz; + if(spd.LocalToDet(0,zloc,ix,iz)) col+=iz; + else { + AliDebug(1,Form("cannot compute column number from local z=%f",zloc)); + col=99999;} + return col; +/* +const Float_t kconv = 1.0E-04; // converts microns to cm. +Float_t bz[160]; +for(Int_t i=000;i<160;i++) bz[i] = 425.0; // most are 425 microns except below +bz[ 31] = bz[ 32] = 625.0; // first chip boundry +bz[ 63] = bz[ 64] = 625.0; // first chip boundry +bz[ 95] = bz[ 96] = 625.0; // first chip boundry +bz[127] = bz[128] = 625.0; // first chip boundry +// +Int_t j=-1; +Float_t dz=0; +for(Int_t i=000;i<160;i++) dz+=bz[i]; +dz = -0.5*kconv*dz; +if(zloc-1*dz) { // outside z range + AliDebug(1,Form("GetColFromLocZ: cannot compute column number from local z=%f",zloc)); + return 99999;} +for(j=0;j<160;j++){ + dz += kconv*bz[j]; + if(zloc=kNModule*kNChip) + {AliDebug(1,"GetBlockBoundaries: you asked for a non existing key"); return kFALSE;} +UInt_t chip=GetChipFromKey(key); +zmn=GetLocZFromCol(chip*kNCol); +zmx=GetLocZFromCol((chip+1)*kNCol); +xmn=GetLocXFromRow(0); +xmx=GetLocXFromRow(kNRow); +// +Float_t tmp=zmn; +if(zmxkNRow) // not >= ! allow also computation of upper limit of the last row. + {AliError("LocYFromRow: you asked for a non existing row"); return 9999999.;} +// Use only AliITSsegmentationSPD +AliITSsegmentationSPD spd; +Double_t dummy,x; +if(row==kNRow) spd.CellBoundries((Int_t)row-1,0,dummy,x,dummy,dummy); +else spd.CellBoundries((Int_t)row,0,x,dummy,dummy,dummy); +return (Float_t)x; + +} +//________________________________________________________ +Float_t AliITSPlaneEffSPD::GetLocZFromCol(const UInt_t col) const { +// +// This method return the local (i.e. detector reference system) lower Z coordinate +// of the column. To get the central value of a given column, you can do +// 1/2*[LocZFromCol(col)+LocZFromCol(col+1)]. +// +// Input: col number in the range [0,kNChip*kNCol] +// Output: lower local Y coordinate of this row. +// +if(col>kNChip*kNCol) // not >= ! allow also computation of upper limit of the last column + {AliError("LocZFromCol: you asked for a non existing column"); return 9999999.;} +// Use only AliITSsegmentationSPD +AliITSsegmentationSPD spd; +Double_t dummy,y; +if(col==kNChip*kNCol) spd.CellBoundries(0,(Int_t)col-1,dummy,dummy,dummy,y); +else spd.CellBoundries(0,(Int_t)col,dummy,dummy,y,dummy); +return (Float_t)y; + +} +//__________________________________________________________ +void AliITSPlaneEffSPD::InitHistos() { + // for the moment let's create the histograms + // module by module + TString histnameResX="HistResX_mod_",aux; + TString histnameResZ="HistResZ_mod_"; + TString histnameResXZ="HistResXZ_mod_"; + TString histnameClusterType="HistClusterType_mod_"; + TString histnameResXclu="HistResX_mod_"; + TString histnameResZclu="HistResZ_mod_"; + TString histnameResXchip="HistResX_mod_"; + TString histnameResZchip="HistResZ_mod_"; + TString profnameResXvsPhi="ProfResXvsPhi_mod_"; + TString profnameResZvsDip="ProfResZvsDip_mod_"; + TString profnameResXvsPhiclu="ProfResXvsPhi_mod_"; + TString profnameResZvsDipclu="ProfResZvsDip_mod_"; + TString histnameTrackErrX="HistTrackErrX_mod_"; + TString histnameTrackErrZ="HistTrackErrZ_mod_"; + TString histnameClusErrX="HistClusErrX_mod_"; + TString histnameClusErrZ="HistClusErrZ_mod_"; + TString histnameTrackXFOtrue="HistTrackXFOok_mod_"; + TString histnameTrackZFOtrue="HistTrackZFOok_mod_"; + TString histnameTrackXFOfalse="HistTrackXFOko_mod_"; + TString histnameTrackZFOfalse="HistTrackZFOko_mod_"; + TString histnameTrackXZFOtrue="HistTrackZvsXFOok_mod_"; + TString histnameTrackXZFOfalse="HistTrackZvsXFOko_mod_"; +// + + TH1::AddDirectory(kFALSE); + + fHisResX=new TH1F*[kNHisto]; + fHisResZ=new TH1F*[kNHisto]; + fHisResXZ=new TH2F*[kNHisto]; + fHisClusterSize=new TH2I*[kNHisto]; + fHisResXclu=new TH1F**[kNHisto]; + fHisResZclu=new TH1F**[kNHisto]; + fHisResXchip=new TH1F**[kNHisto]; + fHisResZchip=new TH1F**[kNHisto]; + fProfResXvsPhi=new TProfile*[kNHisto]; + fProfResZvsDip=new TProfile*[kNHisto]; + fProfResXvsPhiclu=new TProfile**[kNHisto]; + fProfResZvsDipclu=new TProfile**[kNHisto]; + fHisTrackErrX=new TH1F*[kNHisto]; + fHisTrackErrZ=new TH1F*[kNHisto]; + fHisClusErrX=new TH1F*[kNHisto]; + fHisClusErrZ=new TH1F*[kNHisto]; + fHisTrackXFOtrue=new TH1F**[kNHisto]; + fHisTrackZFOtrue=new TH1F**[kNHisto]; + fHisTrackXFOfalse=new TH1F**[kNHisto]; + fHisTrackZFOfalse=new TH1F**[kNHisto]; + fHisTrackXZFOtrue=new TH2F**[kNHisto]; + fHisTrackXZFOfalse=new TH2F**[kNHisto]; + + for (Int_t nhist=0;nhistSetName(aux.Data()); + fHisResX[nhist]->SetTitle(aux.Data()); + + aux=histnameResZ; + aux+=nhist; + fHisResZ[nhist]=new TH1F("histname","histname",1200,-0.48,0.48); // +-4800 micron; 1 bin=8 micron + fHisResZ[nhist]->SetName(aux.Data()); + fHisResZ[nhist]->SetTitle(aux.Data()); + + aux=histnameResXZ; + aux+=nhist; + fHisResXZ[nhist]=new TH2F("histname","histname",80,-0.16,0.16,80,-0.32,0.32); // binning: + fHisResXZ[nhist]->SetName(aux.Data()); // 40 micron in x; + fHisResXZ[nhist]->SetTitle(aux.Data()); // 80 micron in z; + + aux=histnameClusterType; + aux+=nhist; + fHisClusterSize[nhist]=new TH2I("histname","histname",10,0.5,10.5,10,0.5,10.5); + fHisClusterSize[nhist]->SetName(aux.Data()); + fHisClusterSize[nhist]->SetTitle(aux.Data()); + + fHisResXclu[nhist]=new TH1F*[kNclu]; + fHisResZclu[nhist]=new TH1F*[kNclu]; + fHisTrackXFOtrue[nhist]=new TH1F*[kNClockPhase]; + fHisTrackZFOtrue[nhist]=new TH1F*[kNClockPhase]; + fHisTrackXFOfalse[nhist]=new TH1F*[kNClockPhase]; + fHisTrackZFOfalse[nhist]=new TH1F*[kNClockPhase]; + fHisTrackXZFOtrue[nhist]=new TH2F*[kNClockPhase]; + fHisTrackXZFOfalse[nhist]=new TH2F*[kNClockPhase]; + + for(Int_t clu=0; clu cluster size 1 + aux=histnameResXclu; + aux+=nhist; + aux+="_clu_"; + aux+=clu+1; // clu=0 --> cluster size 1 + fHisResXclu[nhist][clu]=new TH1F("histname","histname",1600,-0.32,0.32); // +- 3200 micron; 1 bin=4 micron + fHisResXclu[nhist][clu]->SetName(aux.Data()); + fHisResXclu[nhist][clu]->SetTitle(aux.Data()); + + aux=histnameResZclu; + aux+=nhist; + aux+="_clu_"; + aux+=clu+1; // clu=0 --> cluster size 1 + fHisResZclu[nhist][clu]=new TH1F("histname","histname",1200,-0.48,0.48); // +-4800 micron; 1 bin=8 micron + fHisResZclu[nhist][clu]->SetName(aux.Data()); + fHisResZclu[nhist][clu]->SetTitle(aux.Data()); + } + + fHisResXchip[nhist]=new TH1F*[kNChip]; + fHisResZchip[nhist]=new TH1F*[kNChip]; + for(Int_t chip=0; chipSetName(aux.Data()); + fHisResXchip[nhist][chip]->SetTitle(aux.Data()); + + aux=histnameResZchip; + aux+=nhist; + aux+="_chip_"; + aux+=chip; + fHisResZchip[nhist][chip]=new TH1F("histname","histname",300,-0.48,0.48); // +-4800 micron; 1 bin=32 micron + fHisResZchip[nhist][chip]->SetName(aux.Data()); + fHisResZchip[nhist][chip]->SetTitle(aux.Data()); + } + + aux=histnameTrackErrX; + aux+=nhist; + fHisTrackErrX[nhist]=new TH1F("histname","histname",400,0.,0.32); // 0-3200 micron; 1 bin=8 micron + fHisTrackErrX[nhist]->SetName(aux.Data()); + fHisTrackErrX[nhist]->SetTitle(aux.Data()); + + aux=histnameTrackErrZ; + aux+=nhist; + fHisTrackErrZ[nhist]=new TH1F("histname","histname",200,0.,0.32); // 0-3200 micron; 1 bin=16 micron + fHisTrackErrZ[nhist]->SetName(aux.Data()); + fHisTrackErrZ[nhist]->SetTitle(aux.Data()); + + aux=histnameClusErrX; + aux+=nhist; + fHisClusErrX[nhist]=new TH1F("histname","histname",400,0.,0.08); // 0-800 micron; 1 bin=2 micron + fHisClusErrX[nhist]->SetName(aux.Data()); + fHisClusErrX[nhist]->SetTitle(aux.Data()); + + aux=histnameClusErrZ; + aux+=nhist; + fHisClusErrZ[nhist]=new TH1F("histname","histname",400,0.,0.32); // 0-3200 micron; 1 bin=8 micron + fHisClusErrZ[nhist]->SetName(aux.Data()); + fHisClusErrZ[nhist]->SetTitle(aux.Data()); + + aux=profnameResXvsPhi; + aux+=nhist; + fProfResXvsPhi[nhist]=new TProfile("histname","histname",40,-40.,40.0); // binning: range: -40°- 40° + fProfResXvsPhi[nhist]->SetName(aux.Data()); // bin width: 2° + fProfResXvsPhi[nhist]->SetTitle(aux.Data()); + + aux=profnameResZvsDip; + aux+=nhist; + fProfResZvsDip[nhist]=new TProfile("histname","histname",48,-72.,72.0); // binning: range: -70°-4° + fProfResZvsDip[nhist]->SetName(aux.Data()); // bin width: 3° + fProfResZvsDip[nhist]->SetTitle(aux.Data()); + + fProfResXvsPhiclu[nhist]=new TProfile*[kNclu]; + fProfResZvsDipclu[nhist]=new TProfile*[kNclu]; + for(Int_t clu=0; clu cluster size 1 + aux=profnameResXvsPhiclu; + aux+=nhist; + aux+="_clu_"; + aux+=clu+1; // clu=0 --> cluster size 1 + fProfResXvsPhiclu[nhist][clu]=new TProfile("histname","histname",40,-40.,40.0); // binning: range: -40°- 40 + fProfResXvsPhiclu[nhist][clu]->SetName(aux.Data()); // bin width: 2° + fProfResXvsPhiclu[nhist][clu]->SetTitle(aux.Data()); + + aux=profnameResZvsDipclu; + aux+=nhist; + aux+="_clu_"; + aux+=clu+1; // clu=0 --> cluster size 1 + fProfResZvsDipclu[nhist][clu]= new TProfile("histname","histname",48,-72.,72.0); // binning: range: -70°-7° + fProfResZvsDipclu[nhist][clu]->SetName(aux.Data()); // bin width: 3° + fProfResZvsDipclu[nhist][clu]->SetTitle(aux.Data()); + } + + fHisTrackXFOtrue[nhist]=new TH1F*[kNClockPhase]; + fHisTrackZFOtrue[nhist]=new TH1F*[kNClockPhase]; + fHisTrackXFOfalse[nhist]=new TH1F*[kNClockPhase]; + fHisTrackZFOfalse[nhist]=new TH1F*[kNClockPhase]; + fHisTrackXZFOtrue[nhist]=new TH2F*[kNClockPhase]; + fHisTrackXZFOfalse[nhist]=new TH2F*[kNClockPhase]; + for(Int_t phas=0; phasSetName(aux.Data()); + fHisTrackXFOtrue[nhist][phas]->SetTitle(aux.Data()); + + aux=histnameTrackZFOtrue; + aux+=nhist; + aux+="_BCmod4_"; + aux+=phas; + fHisTrackZFOtrue[nhist][phas]=new TH1F("histname","histname",350,-3.5,3.5); // +- 35. mm; 1 bin=0.2 mm + fHisTrackZFOtrue[nhist][phas]->SetName(aux.Data()); + fHisTrackZFOtrue[nhist][phas]->SetTitle(aux.Data()); + + aux=histnameTrackXFOfalse; + aux+=nhist; + aux+="_BCmod4_"; + aux+=phas; + fHisTrackXFOfalse[nhist][phas]=new TH1F("histname","histname",128,-0.64,0.64); // +- 6.4 mm; 1 bin=0.1 mm + fHisTrackXFOfalse[nhist][phas]->SetName(aux.Data()); + fHisTrackXFOfalse[nhist][phas]->SetTitle(aux.Data()); + + aux=histnameTrackZFOfalse; + aux+=nhist; + aux+="_BCmod4_"; + aux+=phas; + fHisTrackZFOfalse[nhist][phas]=new TH1F("histname","histname",350,-3.5,3.5); // +- 35. mm; 1 bin=0.2 mm + fHisTrackZFOfalse[nhist][phas]->SetName(aux.Data()); + fHisTrackZFOfalse[nhist][phas]->SetTitle(aux.Data()); + + aux=histnameTrackXZFOtrue; + aux+=nhist; + aux+="_BCmod4_"; + aux+=phas; + fHisTrackXZFOtrue[nhist][phas]=new TH2F("histname","histname",22,-3.5,3.5,32,-0.64,0.64); // localZ +- 35. mm; 1 bin=3.2 mm + fHisTrackXZFOtrue[nhist][phas]->SetName(aux.Data()); // localX +- 6.4 mm; 1 bin=0.4 mm + fHisTrackXZFOtrue[nhist][phas]->SetTitle(aux.Data()); + + aux=histnameTrackXZFOfalse; + aux+=nhist; + aux+="_BCmod4_"; + aux+=phas; + fHisTrackXZFOfalse[nhist][phas]=new TH2F("histname","histname",22,-3.5,3.5,32,-0.64,0.64); // localZ +- 35. mm; 1 bin=3.2 mm + fHisTrackXZFOfalse[nhist][phas]->SetName(aux.Data()); // localX +- 6.4 mm; 1 bin=0.4 mm + fHisTrackXZFOfalse[nhist][phas]->SetTitle(aux.Data()); + } + } // end loop on module + + TH1::AddDirectory(kTRUE); + +return; +} +//__________________________________________________________ +void AliITSPlaneEffSPD::DeleteHistos() { + if(fHisResX) { + for (Int_t i=0; i call FillHistosST +// if key >= 1200 --> call FillHistosFO +if(key>=kNModule*kNChip*(kNClockPhase+1)) + {AliError("GetChipFromKey: you asked for a non existing key"); return kFALSE;} +if(key=kNModule*kNChip*(kNClockPhase+1)) + {AliWarning("FillHistos: you asked for a non existing key"); return kFALSE;} + if(key=kNHisto) + {AliWarning("FillHistos: you want to fill a non-existing histos"); return kFALSE;} + if(found) { + fHisTrackXFOtrue[id][BCm4]->Fill(tr[0]); + fHisTrackZFOtrue[id][BCm4]->Fill(tr[1]); + fHisTrackXZFOtrue[id][BCm4]->Fill(tr[1],tr[0]); + } + else { + fHisTrackXFOfalse[id][BCm4]->Fill(tr[0]); + fHisTrackZFOfalse[id][BCm4]->Fill(tr[1]); + fHisTrackXZFOfalse[id][BCm4]->Fill(tr[1],tr[0]); + } +return kTRUE; +} +//__________________________________________________________ +Bool_t AliITSPlaneEffSPD::FillHistosStd(UInt_t key, Bool_t found, + Float_t *tr, Float_t *clu, Int_t *csize, Float_t *angtrkmod) { +// this method fill the histograms +// input: - key: unique key of the basic block +// - found: Boolean to asses whether a cluster has been associated to the track or not +// - tr[0],tr[1] local X and Z coordinates of the track prediction, respectively +// - tr[2],tr[3] error on local X and Z coordinates of the track prediction, respectively +// - clu[0],clu[1] local X and Z coordinates of the cluster associated to the track, respectively +// - clu[2],clu[3] error on local X and Z coordinates of the cluster associated to the track, respectively +// - csize[0][1] cluster size in X and Z, respectively +// - angtrkmod[0],angtrkmod[1] +// output: kTRUE if filling was succesfull kFALSE otherwise +// side effects: updating of the histograms. +// + if (!fHis) { + AliWarning("FillHistos: histograms do not exist! Call SetCreateHistos(kTRUE) first"); + return kFALSE; + } + if(key>=kNModule*kNChip) + {AliWarning("FillHistos: you asked for a non existing key"); return kFALSE;} + Int_t id=GetModFromKey(key); + Int_t chip=GetChipFromKey(key); + if(id>=kNHisto) + {AliWarning("FillHistos: you want to fill a non-existing histos"); return kFALSE;} + if(found) { + Float_t resx=tr[0]-clu[0]; + Float_t resz=tr[1]-clu[1]; + fHisResX[id]->Fill(resx); + fHisResZ[id]->Fill(resz); + fHisResXZ[id]->Fill(resx,resz); + fHisClusterSize[id]->Fill((Double_t)csize[0],(Double_t)csize[1]); + if(csize[0]>0 && csize[0]<=kNclu) fHisResXclu[id][csize[0]-1]->Fill(resx); + if(csize[1]>0 && csize[1]<=kNclu) fHisResZclu[id][csize[1]-1]->Fill(resz); + fHisResXchip[id][chip]->Fill(resx); + fHisResZchip[id][chip]->Fill(resz); + fProfResXvsPhi[id]->Fill(angtrkmod[0],resx); + fProfResZvsDip[id]->Fill(angtrkmod[1],resz); + if(csize[0]>0 && csize[0]<=kNclu) fProfResXvsPhiclu[id][csize[0]-1]->Fill(angtrkmod[0],resx); + if(csize[1]>0 && csize[1]<=kNclu) fProfResZvsDipclu[id][csize[1]-1]->Fill(angtrkmod[1],resz); + } + fHisTrackErrX[id]->Fill(tr[2]); + fHisTrackErrZ[id]->Fill(tr[3]); + fHisClusErrX[id]->Fill(clu[2]); + fHisClusErrZ[id]->Fill(clu[3]); + return kTRUE; +} +//__________________________________________________________ +Bool_t AliITSPlaneEffSPD::WriteHistosToFile(TString filename, Option_t* option) { + // + // Saves the histograms into a tree and saves the trees into a file + // + if (!fHis) return kFALSE; + if (filename.IsNull() || filename.IsWhitespace()) { + AliWarning("WriteHistosToFile: null output filename!"); + return kFALSE; + } + char branchname[51]; + TFile *hFile=new TFile(filename.Data(),option, + "The File containing the TREEs with ITS PlaneEff Histos"); + TTree *SPDTree=new TTree("SPDTree","Tree whith Residuals and Cluster Type distributions for SPD"); + TH1F *histZ,*histX; + TH2F *histXZ; + TH2I *histClusterType; + TH1F *histXclu[kNclu]; + TH1F *histZclu[kNclu]; + TH1F *histXchip[kNChip]; + TH1F *histZchip[kNChip]; + TH1F *histTrErrZ,*histTrErrX; + TH1F *histClErrZ,*histClErrX; + TProfile *profXvsPhi,*profZvsDip; + TProfile *profXvsPhiclu[kNclu],*profZvsDipclu[kNclu]; + TH1F *histXtrkFOtrue[kNClockPhase]; + TH1F *histZtrkFOtrue[kNClockPhase]; + TH1F *histXtrkFOfalse[kNClockPhase]; + TH1F *histZtrkFOfalse[kNClockPhase]; + TH2F *histXZtrkFOtrue[kNClockPhase]; + TH2F *histXZtrkFOfalse[kNClockPhase]; + + histZ=new TH1F(); + histX=new TH1F(); + histXZ=new TH2F(); + histClusterType=new TH2I(); + for(Int_t clu=0;cluBranch("histX","TH1F",&histX,128000,0); + SPDTree->Branch("histZ","TH1F",&histZ,128000,0); + SPDTree->Branch("histXZ","TH2F",&histXZ,128000,0); + SPDTree->Branch("histClusterType","TH2I",&histClusterType,128000,0); + for(Int_t clu=0;cluBranch(branchname,"TH1F",&histXclu[clu],128000,0); + snprintf(branchname,50,"histZclu_%d",clu+1); + SPDTree->Branch(branchname,"TH1F",&histZclu[clu],128000,0); + } + for(Int_t chip=0;chipBranch(branchname,"TH1F",&histXchip[chip],128000,0); + snprintf(branchname,50,"histZchip_%d",chip); + SPDTree->Branch(branchname,"TH1F",&histZchip[chip],128000,0); + } + SPDTree->Branch("histTrErrX","TH1F",&histTrErrX,128000,0); + SPDTree->Branch("histTrErrZ","TH1F",&histTrErrZ,128000,0); + SPDTree->Branch("histClErrX","TH1F",&histClErrX,128000,0); + SPDTree->Branch("histClErrZ","TH1F",&histClErrZ,128000,0); + SPDTree->Branch("profXvsPhi","TProfile",&profXvsPhi,128000,0); + SPDTree->Branch("profZvsDip","TProfile",&profZvsDip,128000,0); + for(Int_t clu=0;cluBranch(branchname,"TProfile",&profXvsPhiclu[clu],128000,0); + snprintf(branchname,50,"profZvsDipclu_%d",clu+1); + SPDTree->Branch(branchname,"TProfile",&profZvsDipclu[clu],128000,0); + } + for(Int_t phas=0; phasBranch(branchname,"TH1F",&histXtrkFOtrue[phas],128000,0); + snprintf(branchname,50,"histTrZFOokBCmod4_%d",phas); + SPDTree->Branch(branchname,"TH1F",&histZtrkFOtrue[phas],128000,0); + snprintf(branchname,50,"histTrXFOkoBCmod4_%d",phas); + SPDTree->Branch(branchname,"TH1F",&histXtrkFOfalse[phas],128000,0); + snprintf(branchname,50,"histTrZFOkoBCmod4_%d",phas); + SPDTree->Branch(branchname,"TH1F",&histZtrkFOfalse[phas],128000,0); + snprintf(branchname,50,"histTrXZFOokBCmod4_%d",phas); + SPDTree->Branch(branchname,"TH2F",&histXZtrkFOtrue[phas],128000,0); + snprintf(branchname,50,"histTrXZFOkoBCmod4_%d",phas); + SPDTree->Branch(branchname,"TH2F",&histXZtrkFOfalse[phas],128000,0); + } + + for(Int_t j=0;jFill(); + } + hFile->Write(); + hFile->Close(); +return kTRUE; +} +//__________________________________________________________ +Bool_t AliITSPlaneEffSPD::ReadHistosFromFile(TString filename) { + // + // Read histograms from an already existing file + // + if (!fHis) return kFALSE; + if (filename.IsNull() || filename.IsWhitespace()) { + AliWarning("ReadHistosFromFile: incorrect output filename!"); + return kFALSE; + } + char branchname[51]; + + TH1F *h = 0; + TH2F *h2 = 0; + TH2I *h2i= 0; + TProfile *p = 0; + + TFile *file=TFile::Open(filename.Data(),"READONLY"); + + if (!file || file->IsZombie()) { + AliWarning(Form("Can't open %s !",filename.Data())); + delete file; + return kFALSE; + } + TTree *tree = (TTree*) file->Get("SPDTree"); + + TBranch *histX = (TBranch*) tree->GetBranch("histX"); + TBranch *histZ = (TBranch*) tree->GetBranch("histZ"); + TBranch *histXZ = (TBranch*) tree->GetBranch("histXZ"); + TBranch *histClusterType = (TBranch*) tree->GetBranch("histClusterType"); + + TBranch *histXclu[kNclu], *histZclu[kNclu]; + for(Int_t clu=0; cluGetBranch(branchname); + snprintf(branchname,50,"histZclu_%d",clu+1); + histZclu[clu]= (TBranch*) tree->GetBranch(branchname); + } + + TBranch *histXchip[kNChip], *histZchip[kNChip]; + for(Int_t chip=0; chipGetBranch(branchname); + snprintf(branchname,50,"histZchip_%d",chip); + histZchip[chip]= (TBranch*) tree->GetBranch(branchname); + } + + TBranch *histTrErrX = (TBranch*) tree->GetBranch("histTrErrX"); + TBranch *histTrErrZ = (TBranch*) tree->GetBranch("histTrErrZ"); + TBranch *histClErrX = (TBranch*) tree->GetBranch("histClErrX"); + TBranch *histClErrZ = (TBranch*) tree->GetBranch("histClErrZ"); + TBranch *profXvsPhi = (TBranch*) tree->GetBranch("profXvsPhi"); + TBranch *profZvsDip = (TBranch*) tree->GetBranch("profZvsDip"); + + TBranch *profXvsPhiclu[kNclu], *profZvsDipclu[kNclu]; + for(Int_t clu=0; cluGetBranch(branchname); + snprintf(branchname,50,"profZvsDipclu_%d",clu+1); + profZvsDipclu[clu]= (TBranch*) tree->GetBranch(branchname); + } + + TBranch *histXtrkFOtrue[kNClockPhase], *histZtrkFOtrue[kNClockPhase], + *histXtrkFOfalse[kNClockPhase], *histZtrkFOfalse[kNClockPhase], + *histXZtrkFOtrue[kNClockPhase], *histXZtrkFOfalse[kNClockPhase]; + for(Int_t phas=0; phasGetBranch(branchname); + snprintf(branchname,50,"histTrZFOokBCmod4_%d",phas); + histZtrkFOtrue[phas] = (TBranch*) tree->GetBranch(branchname); + snprintf(branchname,50,"histTrXFOkoBCmod4_%d",phas); + histXtrkFOfalse[phas] = (TBranch*) tree->GetBranch(branchname); + snprintf(branchname,50,"histTrZFOkoBCmod4_%d",phas); + histZtrkFOfalse[phas] = (TBranch*) tree->GetBranch(branchname); + snprintf(branchname,50,"histTrXZFOokBCmod4_%d",phas); + histXZtrkFOtrue[phas] = (TBranch*) tree->GetBranch(branchname); + snprintf(branchname,50,"histTrXZFOkoBCmod4_%d",phas); + histXZtrkFOfalse[phas] = (TBranch*) tree->GetBranch(branchname); + } + + gROOT->cd(); + + Int_t nevent = (Int_t)histX->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histX->SetAddress(&h); + for(Int_t j=0;jGetEntry(j); + fHisResX[j]->Add(h); + } + + nevent = (Int_t)histZ->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histZ->SetAddress(&h); + for(Int_t j=0;jGetEntry(j); + fHisResZ[j]->Add(h); + } + + nevent = (Int_t)histXZ->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histXZ->SetAddress(&h2); + for(Int_t j=0;jGetEntry(j); + fHisResXZ[j]->Add(h2); + } + + nevent = (Int_t)histClusterType->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histClusterType->SetAddress(&h2i); + for(Int_t j=0;jGetEntry(j); + fHisClusterSize[j]->Add(h2i); + } + + for(Int_t clu=0; cluGetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histXclu[clu]->SetAddress(&h); + for(Int_t j=0;jGetEntry(j); + fHisResXclu[j][clu]->Add(h); + } + + nevent = (Int_t)histZclu[clu]->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histZclu[clu]->SetAddress(&h); + for(Int_t j=0;jGetEntry(j); + fHisResZclu[j][clu]->Add(h); + } + } + + + for(Int_t chip=0; chipGetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histXchip[chip]->SetAddress(&h); + for(Int_t j=0;jGetEntry(j); + fHisResXchip[j][chip]->Add(h); + } + + nevent = (Int_t)histZchip[chip]->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histZchip[chip]->SetAddress(&h); + for(Int_t j=0;jGetEntry(j); + fHisResZchip[j][chip]->Add(h); + } + } + + nevent = (Int_t)histTrErrX->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histTrErrX->SetAddress(&h); + for(Int_t j=0;jGetEntry(j); + fHisTrackErrX[j]->Add(h); + } + + nevent = (Int_t)histTrErrZ->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histTrErrZ->SetAddress(&h); + for(Int_t j=0;jGetEntry(j); + fHisTrackErrZ[j]->Add(h); + } + + nevent = (Int_t)histClErrX->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histClErrX->SetAddress(&h); + for(Int_t j=0;jGetEntry(j); + fHisClusErrX[j]->Add(h); + } + + nevent = (Int_t)histClErrZ->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histClErrZ->SetAddress(&h); + for(Int_t j=0;jGetEntry(j); + fHisClusErrZ[j]->Add(h); + } + nevent = (Int_t)profXvsPhi->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + profXvsPhi->SetAddress(&p); + for(Int_t j=0;jGetEntry(j); + fProfResXvsPhi[j]->Add(p); + } + + nevent = (Int_t)profZvsDip->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + profZvsDip->SetAddress(&p); + for(Int_t j=0;jGetEntry(j); + fProfResZvsDip[j]->Add(p); + } + + for(Int_t clu=0; cluGetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + profXvsPhiclu[clu]->SetAddress(&p); + for(Int_t j=0;jGetEntry(j); + fProfResXvsPhiclu[j][clu]->Add(p); + } + + nevent = (Int_t)profZvsDipclu[clu]->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + profZvsDipclu[clu]->SetAddress(&p); + for(Int_t j=0;jGetEntry(j); + fProfResZvsDipclu[j][clu]->Add(p); + } + } + + for(Int_t phas=0; phasGetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histXtrkFOtrue[phas]->SetAddress(&h); + for(Int_t j=0;jGetEntry(j); + fHisTrackXFOtrue[j][phas]->Add(h); + } + + nevent = (Int_t)histZtrkFOtrue[phas]->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histZtrkFOtrue[phas]->SetAddress(&h); + for(Int_t j=0;jGetEntry(j); + fHisTrackZFOtrue[j][phas]->Add(h); + } + + nevent = (Int_t)histXtrkFOfalse[phas]->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histXtrkFOfalse[phas]->SetAddress(&h); + for(Int_t j=0;jGetEntry(j); + fHisTrackXFOfalse[j][phas]->Add(h); + } + + nevent = (Int_t)histZtrkFOfalse[phas]->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histZtrkFOfalse[phas]->SetAddress(&h); + for(Int_t j=0;jGetEntry(j); + fHisTrackZFOfalse[j][phas]->Add(h); + } + + nevent = (Int_t)histXZtrkFOtrue[phas]->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histXZtrkFOtrue[phas]->SetAddress(&h2); + for(Int_t j=0;jGetEntry(j); + fHisTrackXZFOtrue[j][phas]->Add(h2); + } + + nevent = (Int_t)histXZtrkFOfalse[phas]->GetEntries(); + if(nevent!=kNHisto) + {AliWarning("ReadHistosFromFile: trying to read too many or too few histos!"); return kFALSE;} + histXZtrkFOfalse[phas]->SetAddress(&h2); + for(Int_t j=0;jGetEntry(j); + fHisTrackXZFOfalse[j][phas]->Add(h2); + } + + } + + delete h; + delete h2; + delete h2i; + delete p; + + if (file) { + file->Close(); + delete file; + } +return kTRUE; +} +