From 1cc5cedc1d32900dbe53770c33f0f1ccd2dea4f5 Mon Sep 17 00:00:00 2001 From: masera Date: Tue, 19 Feb 2008 14:25:56 +0000 Subject: [PATCH] better organization of private and protected methods. Bug fix in AliITSPlaneEff::ErrPlaneEff --- ITS/AliITSPlaneEff.cxx | 4 +- ITS/AliITSPlaneEffSDD.cxx | 48 ++++-- ITS/AliITSPlaneEffSDD.h | 73 ++++----- ITS/AliITSPlaneEffSPD.cxx | 304 +++++++++++++++++++++++++++++++++++--- ITS/AliITSPlaneEffSPD.h | 97 +++++++----- ITS/AliITSPlaneEffSSD.cxx | 38 +++-- ITS/AliITSPlaneEffSSD.h | 42 +++--- ITS/AliITStrackerMI.cxx | 55 ++++++- 8 files changed, 511 insertions(+), 150 deletions(-) diff --git a/ITS/AliITSPlaneEff.cxx b/ITS/AliITSPlaneEff.cxx index d47e8a2627c..88dd48e4da0 100644 --- a/ITS/AliITSPlaneEff.cxx +++ b/ITS/AliITSPlaneEff.cxx @@ -148,8 +148,8 @@ Double_t AliITSPlaneEff::ErrPlaneEff(Int_t nf,Int_t nt) const{ if(nf<0 || nt<=0 || ntIsDefaultStorageSet()) { -// AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT"); -// } AliCDBEntry *cdbEntry = AliCDBManager::Instance()->Get("ITS/PlaneEff/PlaneEffSDD",fRunNumber); +if(!cdbEntry) return kFALSE; AliITSPlaneEffSDD* eff= (AliITSPlaneEffSDD*)cdbEntry->GetObject(); if(this==eff) return kFALSE; if(fHis) CopyHistos(*eff); // If histos already exist then copy them to eff @@ -494,6 +492,21 @@ eff->Copy(*this); // copy everything (statistics and histos) from eff t return kTRUE; } //_____________________________________________________________________________ +Bool_t AliITSPlaneEffSDD::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/PlaneEffSDD",fRunNumber); +} else { + cdbEntry = AliCDBManager::Instance()->Get(*cdbId); +} +if(!cdbEntry) return kFALSE; +AliITSPlaneEffSDD* eff= (AliITSPlaneEffSDD*)cdbEntry->GetObject(); +*this+=*eff; +return kTRUE; +} +//_____________________________________________________________________________ UInt_t AliITSPlaneEffSDD::GetKeyFromDetLocCoord(Int_t ilay, Int_t idet, Float_t locx, Float_t locz) const { // method to locate a basic block from Detector Local coordinate (to be used in tracking) @@ -833,13 +846,16 @@ return; } //__________________________________________________________ Bool_t AliITSPlaneEffSDD::FillHistos(UInt_t key, Bool_t found, - Float_t tXZ[2], Float_t cXZ[2], Int_t ctXZ[2]) { + // Float_t tXZ[2], Float_t cXZ[2], Int_t ctXZ[2]) { + Float_t *tr, Float_t *clu, Int_t *csize) { // 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 -// - tXZ[2] local X and Z coordinates of the track prediction -// - cXZ[2] local X and Z coordinates of the cluster associated to the track -// - ctXZ[2] cluster size in X and Z (min =1 for real cluster) +// - 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 // output: kTRUE if filling was succesfull kFALSE otherwise // side effects: updating of the histograms. // @@ -853,18 +869,18 @@ Bool_t AliITSPlaneEffSDD::FillHistos(UInt_t key, Bool_t found, if(id>=kNHisto) {AliWarning("FillHistos: you want to fill a non-existing histos"); return kFALSE;} if(found) { - Float_t resx=tXZ[0]-cXZ[0]; - Float_t resz=tXZ[1]-cXZ[1]; + 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)ctXZ[0],(Double_t)ctXZ[1]); - if(ctXZ[0]>0 && ctXZ[0]<=kNclu) fHisResXclu[id][ctXZ[0]-1]->Fill(resx); - if(ctXZ[1]>0 && ctXZ[1]<=kNclu) fHisResZclu[id][ctXZ[1]-1]->Fill(resx); - fProfResXvsX[id]->Fill(cXZ[0],resx); - fProfResZvsX[id]->Fill(cXZ[0],resz); - fProfClustSizeXvsX[id]->Fill(cXZ[0],(Double_t)ctXZ[0]); - fProfClustSizeZvsX[id]->Fill(cXZ[0],(Double_t)ctXZ[1]); + 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); + fProfResXvsX[id]->Fill(clu[0],resx); + fProfResZvsX[id]->Fill(clu[0],resz); + fProfClustSizeXvsX[id]->Fill(clu[0],(Double_t)csize[0]); + fProfClustSizeZvsX[id]->Fill(clu[0],(Double_t)csize[1]); } return kTRUE; } diff --git a/ITS/AliITSPlaneEffSDD.h b/ITS/AliITSPlaneEffSDD.h index 7f40df8214a..c51db7ccb8b 100644 --- a/ITS/AliITSPlaneEffSDD.h +++ b/ITS/AliITSPlaneEffSDD.h @@ -6,6 +6,7 @@ #include #include #include "AliITSPlaneEff.h" +#include "AliCDBId.h" /////////////////////////////////////////// // // @@ -41,7 +42,7 @@ class AliITSPlaneEffSDD : public AliITSPlaneEff { // Methods to update the Plane efficiency (specific of the SDD segmentation) Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t mod, const UInt_t chip, const UInt_t wing, const UInt_t subw=0); - virtual Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t key) + Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t key) {return UpDatePlaneEff(Kfound,GetModFromKey(key),GetChipFromKey(key), GetWingFromKey(key),GetSubWingFromKey(key));}; // @@ -53,10 +54,6 @@ class AliITSPlaneEffSDD : public AliITSPlaneEff { enum {kNAnode = 64}; // Number of channels/chip (i.e. anodes per chip) //enum {kNTimeBin = 174}; // granularity along drift direction (i.e. segmentation in r-phi) - enum {kNHisto = kNModule}; // The number of histograms: module by module. - enum {kNclu = 3}; // Build specific histos of residuals up to cluster size kNclu. - // If you change them, then you must change implementation of - // the method FillHistos. // // Plane efficiency for active detector (excluding dead/noisy channels) // access to DB is needed @@ -74,8 +71,8 @@ class AliITSPlaneEffSDD : public AliITSPlaneEff { virtual Double_t GetFracBad(const UInt_t key) const; virtual Bool_t WriteIntoCDB() const; virtual Bool_t ReadFromCDB(); // this method reads Data Members (statistics) from DataBase - virtual Bool_t AddFromCDB() // this method updates Data Members (statistics) from DataBase - {AliError("AddFromCDB: Still To be implemented"); return kFALSE;} + Bool_t AddFromCDB(AliCDBId *cdbId); // this method updates Data Members (statistics) from DataBase + virtual Bool_t AddFromCDB() {AliCDBId *cdbId=0; return AddFromCDB(cdbId);} // method to locate a basic block from Detector Local coordinate (to be used in tracking) // see file cxx for numbering convention. // here idet runs from 0 to 83 for layer 2 and from 0 to 175 for layer 3 @@ -87,20 +84,51 @@ class AliITSPlaneEffSDD : public AliITSPlaneEff { // method to set on/off the creation/updates of histograms (Histos are created/destroyed) void SetCreateHistos(Bool_t his=kFALSE) {fHis=his; if(fHis) {DeleteHistos(); InitHistos();} else DeleteHistos(); return; } - Bool_t FillHistos(UInt_t key, Bool_t found, Float_t trackXZ[2], Float_t clusterXZ[2], Int_t ctXZ[2]); - Bool_t WriteHistosToFile(TString filename="PlaneEffSDDHistos.root",Option_t* option = "RECREATE"); - Bool_t ReadHistosFromFile(TString filename="PlaneEffSDDHistos.root"); // histos must exist already ! + //Bool_t FillHistos(UInt_t key, Bool_t found, Float_t trackXZ[2], Float_t clusterXZ[2], Int_t ctXZ[2]); + virtual Bool_t FillHistos(UInt_t key, Bool_t found, Float_t *track, Float_t *cluster, Int_t *ctype); + virtual Bool_t WriteHistosToFile(TString filename="PlaneEffSDDHistos.root",Option_t* option = "RECREATE"); + virtual Bool_t ReadHistosFromFile(TString filename="PlaneEffSDDHistos.root"); // histos must exist already ! // This method increases the // statistics of histos by adding // those of the input file. + UInt_t GetKey(const UInt_t mod, const UInt_t chip, // unique key to locate the + const UInt_t wing, const UInt_t subw=0) const; // basic block of the SDD protected: virtual void Copy(TObject &obj) const; - void CopyHistos(AliITSPlaneEffSDD& target) const; // copy only histograms to target Int_t GetMissingTracksForGivenEff(Double_t eff, Double_t RelErr, UInt_t im, UInt_t ic, UInt_t iw, UInt_t isw=0) const; + UInt_t GetModFromKey(const UInt_t key) const; + UInt_t GetChipFromKey(const UInt_t key) const; + UInt_t GetWingFromKey(const UInt_t key) const; + UInt_t GetSubWingFromKey(const UInt_t key) const; + // getters for chip and wing numbers, given the anode number [0,511] + UInt_t ChipFromAnode(const UInt_t anode) const; // return the chip number (from 0 to kNChip-1) + UInt_t WingFromAnode(const UInt_t anode) const; // return the wing number (from 0 to kNWing-1) + void ChipAndWingFromAnode(const UInt_t anode,UInt_t& chip,UInt_t& wing) const; + // return the Subwing (from 0 to kNSubWing-1) from the cell time bin in the range + // [0,ntb] and from the number of time bins + UInt_t SubWingFromTimeBin(const Int_t tb, const Int_t ntb) const; + + void ChipAndWingAndSubWingFromLocCoor(Float_t locx, Float_t locz, + UInt_t& chip, UInt_t& wing, UInt_t& subw) const; + // + void GetAllFromKey(const UInt_t key, UInt_t& mod, UInt_t& chip, + UInt_t& wing, UInt_t& subw) const; + void GetBadInBlock(const UInt_t key, UInt_t& bad) const; // Int_t fFound[kNModule*kNChip*kNWing*kNSubWing]; // number of associated clusters in a given block Int_t fTried[kNModule*kNChip*kNWing*kNSubWing]; // number of tracks used for efficiency evaluation + + private: + enum {kNHisto = kNModule}; // The number of histograms: module by module. + enum {kNclu = 3}; // Build specific histos of residuals up to cluster size kNclu. + // If you change them, then you must change implementation of + // the method FillHistos. + + virtual void InitHistos(); // create histos by allocating memory for them + virtual void DeleteHistos(); // deletete histos (memory is freed) + virtual void CopyHistos(AliITSPlaneEffSDD& target) const; // copy only histograms to target + TH1F **fHisResX; //! histos with residual distribution (track-cluster) along local X (r-phi) TH1F **fHisResZ; //! histos with residual distribution (track-cluster) along local Z TH2F **fHisResXZ; //! 2-d histos with residual distribution (track-cluster) along local X and Z @@ -111,29 +139,6 @@ class AliITSPlaneEffSDD : public AliITSPlaneEff { TProfile **fProfResZvsX; //! TProfile of Z Residuals vs. X (of the cluster) TProfile **fProfClustSizeXvsX; //! TProfile of cluster_size_X vs. X (of the cluster) TProfile **fProfClustSizeZvsX; //! TProfile of cluster_size_X vs. X (of the cluster) - private: - UInt_t GetKey(const UInt_t mod, const UInt_t chip, // unique key to locate the - const UInt_t wing, const UInt_t subw=0) const; // basic block of the SDD - UInt_t GetModFromKey(const UInt_t key) const; - UInt_t GetChipFromKey(const UInt_t key) const; - UInt_t GetWingFromKey(const UInt_t key) const; - UInt_t GetSubWingFromKey(const UInt_t key) const; - // getters for chip and wing numbers, given the anode number [0,511] - UInt_t ChipFromAnode(const UInt_t anode) const; // return the chip number (from 0 to kNChip-1) - UInt_t WingFromAnode(const UInt_t anode) const; // return the wing number (from 0 to kNWing-1) - void ChipAndWingFromAnode(const UInt_t anode,UInt_t& chip,UInt_t& wing) const; - // return the Subwing (from 0 to kNSubWing-1) from the cell time bin in the range - // [0,ntb] and from the number of time bins - UInt_t SubWingFromTimeBin(const Int_t tb, const Int_t ntb) const; - - void ChipAndWingAndSubWingFromLocCoor(Float_t locx, Float_t locz, - UInt_t& chip, UInt_t& wing, UInt_t& subw) const; - // - void GetAllFromKey(const UInt_t key, UInt_t& mod, UInt_t& chip, - UInt_t& wing, UInt_t& subw) const; - void GetBadInBlock(const UInt_t key, UInt_t& bad) const; - void InitHistos(); - void DeleteHistos(); ClassDef(AliITSPlaneEffSDD,2) // SDD Plane Efficiency class }; diff --git a/ITS/AliITSPlaneEffSPD.cxx b/ITS/AliITSPlaneEffSPD.cxx index 5bc0cc147f2..425e207a033 100644 --- a/ITS/AliITSPlaneEffSPD.cxx +++ b/ITS/AliITSPlaneEffSPD.cxx @@ -42,13 +42,18 @@ ClassImp(AliITSPlaneEffSPD) //______________________________________________________________________ AliITSPlaneEffSPD::AliITSPlaneEffSPD(): AliITSPlaneEff(), - //fHis(kFALSE), fHisResX(0), fHisResZ(0), fHisResXZ(0), fHisClusterSize(0), fHisResXclu(0), - fHisResZclu(0){ + fHisResZclu(0), + fHisResXchip(0), + fHisResZchip(0), + fHisTrackErrX(0), + fHisTrackErrZ(0), + fHisClusErrX(0), + fHisClusErrZ(0){ for (UInt_t i=0; iCopy(*fHisResXclu[i][clu]); s.fHisResZclu[i][clu]->Copy(*fHisResZclu[i][clu]); } + for(Int_t chip=0; chipCopy(*fHisResXchip[i][chip]); + s.fHisResZchip[i][chip]->Copy(*fHisResZchip[i][chip]); + } + s.fHisTrackErrX[i]->Copy(*fHisTrackErrX[i]); + s.fHisTrackErrZ[i]->Copy(*fHisTrackErrZ[i]); + s.fHisClusErrX[i]->Copy(*fHisClusErrX[i]); + s.fHisClusErrZ[i]->Copy(*fHisClusErrZ[i]); } } } @@ -126,6 +145,14 @@ AliITSPlaneEffSPD& AliITSPlaneEffSPD::operator+=(const AliITSPlaneEffSPD &add){ fHisResXclu[i][clu]->Add(add.fHisResXclu[i][clu]); fHisResZclu[i][clu]->Add(add.fHisResZclu[i][clu]); } + for(Int_t chip=0; chipAdd(add.fHisResXchip[i][chip]); + fHisResZchip[i][chip]->Add(add.fHisResZchip[i][chip]); + } + fHisTrackErrX[i]->Add(add.fHisTrackErrX[i]); + fHisTrackErrZ[i]->Add(add.fHisTrackErrZ[i]); + fHisClusErrX[i]->Add(add.fHisClusErrX[i]); + fHisClusErrZ[i]->Add(add.fHisClusErrZ[i]); } } return *this; @@ -168,6 +195,12 @@ void AliITSPlaneEffSPD::CopyHistos(AliITSPlaneEffSPD &target) const { target.fHisClusterSize=new TH2I*[kNHisto]; target.fHisResXclu=new TH1F**[kNHisto]; target.fHisResZclu=new TH1F**[kNHisto]; + target.fHisResXchip=new TH1F**[kNHisto]; + target.fHisResZchip=new TH1F**[kNHisto]; + target.fHisTrackErrX=new TH1F*[kNHisto]; + target.fHisTrackErrZ=new TH1F*[kNHisto]; + target.fHisClusErrX=new TH1F*[kNHisto]; + target.fHisClusErrZ=new TH1F*[kNHisto]; for(Int_t i=0; iSetObjectClassName("AliITSPlaneEff"); + //md->SetObjectClassName("AliITSPlaneEff"); md->SetResponsible("Giuseppe Eugenio Bruno"); md->SetBeamPeriod(0); md->SetAliRootVersion("head 19/11/07"); //root version @@ -414,10 +457,8 @@ Bool_t AliITSPlaneEffSPD::ReadFromCDB() { if(!fInitCDBCalled) {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; if(fHis) CopyHistos(*eff); // If histos already exist then copy them to eff @@ -425,6 +466,21 @@ eff->Copy(*this); // copy everything (statistics and histos) from eff t 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) @@ -566,6 +622,12 @@ void AliITSPlaneEffSPD::InitHistos() { TString histnameClusterType="HistClusterType_mod_"; TString histnameResXclu="HistResX_mod_"; TString histnameResZclu="HistResZ_mod_"; + TString histnameResXchip="HistResX_mod_"; + TString histnameResZchip="HistResZ_mod_"; + TString histnameTrackErrX="HistTrackErrX_mod_"; + TString histnameTrackErrZ="HistTrackErrZ_mod_"; + TString histnameClusErrX="HistClusErrX_mod_"; + TString histnameClusErrZ="HistClusErrZ_mod_"; // fHisResX=new TH1F*[kNHisto]; fHisResZ=new TH1F*[kNHisto]; @@ -573,11 +635,17 @@ void AliITSPlaneEffSPD::InitHistos() { fHisClusterSize=new TH2I*[kNHisto]; fHisResXclu=new TH1F**[kNHisto]; fHisResZclu=new TH1F**[kNHisto]; + fHisResXchip=new TH1F**[kNHisto]; + fHisResZchip=new TH1F**[kNHisto]; + fHisTrackErrX=new TH1F*[kNHisto]; + fHisTrackErrZ=new TH1F*[kNHisto]; + fHisClusErrX=new TH1F*[kNHisto]; + fHisClusErrZ=new TH1F*[kNHisto]; for (Int_t nhist=0;nhistSetName(aux.Data()); fHisResX[nhist]->SetTitle(aux.Data()); @@ -589,11 +657,9 @@ void AliITSPlaneEffSPD::InitHistos() { aux=histnameResXZ; aux+=nhist; - fHisResXZ[nhist]=new TH2F("histname","histname",40,-0.02,0.02,40,-0.16,0.16); // binning: - // 10 micron in x; - // 80 micron in z; - fHisResXZ[nhist]->SetName(aux.Data()); - fHisResXZ[nhist]->SetTitle(aux.Data()); + fHisResXZ[nhist]=new TH2F("histname","histname",40,-0.08,0.08,40,-0.16,0.16); // binning: + fHisResXZ[nhist]->SetName(aux.Data()); // 40 micron in x; + fHisResXZ[nhist]->SetTitle(aux.Data()); // 80 micron in z; aux=histnameClusterType; aux+=nhist; @@ -608,7 +674,7 @@ void AliITSPlaneEffSPD::InitHistos() { aux+=nhist; aux+="_clu_"; aux+=clu+1; // clu=0 --> cluster size 1 - fHisResXclu[nhist][clu]=new TH1F("histname","histname",800,-0.04,0.04); // +- 400 micron; 1 bin=1 micron + fHisResXclu[nhist][clu]=new TH1F("histname","histname",800,-0.16,0.16); // +- 1600 micron; 1 bin=4 micron fHisResXclu[nhist][clu]->SetName(aux.Data()); fHisResXclu[nhist][clu]->SetTitle(aux.Data()); @@ -621,6 +687,50 @@ void AliITSPlaneEffSPD::InitHistos() { 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",200,-0.32,0.32); // +-3200 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",200,0.,0.16); // 0-1600 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",200,0.,0.04); // 0-400 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",200,0.,0.16); // 0-1600 micron; 1 bin=8 micron + fHisClusErrZ[nhist]->SetName(aux.Data()); + fHisClusErrZ[nhist]->SetTitle(aux.Data()); + } return; } @@ -658,17 +768,53 @@ void AliITSPlaneEffSPD::DeleteHistos() { delete [] fHisResZclu; fHisResZclu = 0; } + if(fHisResXchip) { + for (Int_t i=0; i=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=tXZ[0]-cXZ[0]; - Float_t resz=tXZ[1]-cXZ[1]; + 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)ctXZ[0],(Double_t)ctXZ[1]); - if(ctXZ[0]>0 && ctXZ[0]<=kNclu) fHisResXclu[id][ctXZ[0]-1]->Fill(resx); - if(ctXZ[1]>0 && ctXZ[1]<=kNclu) fHisResZclu[id][ctXZ[1]-1]->Fill(resx); + 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); } + fHisTrackErrX[id]->Fill(tr[2]); + fHisTrackErrZ[id]->Fill(tr[3]); + fHisClusErrX[id]->Fill(clu[2]); + fHisClusErrZ[id]->Fill(clu[3]); return kTRUE; } //__________________________________________________________ @@ -712,6 +865,10 @@ Bool_t AliITSPlaneEffSPD::WriteHistosToFile(TString filename, Option_t* option) TH2I *histClusterType; TH1F *histXclu[kNclu]; TH1F *histZclu[kNclu]; + TH1F *histXchip[kNChip]; + TH1F *histZchip[kNChip]; + TH1F *histTrErrZ,*histTrErrX; + TH1F *histClErrZ,*histClErrX; histZ=new TH1F(); histX=new TH1F(); @@ -721,6 +878,14 @@ Bool_t AliITSPlaneEffSPD::WriteHistosToFile(TString filename, Option_t* option) histXclu[clu]=new TH1F(); histZclu[clu]=new TH1F(); } + for(Int_t chip=0;chipBranch("histX","TH1F",&histX,128000,0); SPDTree->Branch("histZ","TH1F",&histZ,128000,0); @@ -732,6 +897,16 @@ Bool_t AliITSPlaneEffSPD::WriteHistosToFile(TString filename, Option_t* option) sprintf(branchname,"histZclu_%d",clu+1); SPDTree->Branch(branchname,"TH1F",&histZclu[clu],128000,0); } + for(Int_t chip=0;chipBranch(branchname,"TH1F",&histXchip[chip],128000,0); + sprintf(branchname,"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); for(Int_t j=0;jFill(); } hFile->Write(); @@ -786,6 +969,19 @@ Bool_t AliITSPlaneEffSPD::ReadHistosFromFile(TString filename) { histZclu[clu]= (TBranch*) tree->GetBranch(branchname); } + TBranch *histXchip[kNChip], *histZchip[kNChip]; + for(Int_t chip=0; chipGetBranch(branchname); + sprintf(branchname,"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"); + gROOT->cd(); Int_t nevent = (Int_t)histX->GetEntries(); @@ -851,6 +1047,70 @@ Bool_t AliITSPlaneEffSPD::ReadHistosFromFile(TString filename) { } } + + 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); + } + delete h; h=0; delete h2; h2=0; delete h2i; h2i=0; diff --git a/ITS/AliITSPlaneEffSPD.h b/ITS/AliITSPlaneEffSPD.h index b0e37be52b9..748adad50ad 100644 --- a/ITS/AliITSPlaneEffSPD.h +++ b/ITS/AliITSPlaneEffSPD.h @@ -6,6 +6,7 @@ #include #include #include "AliITSPlaneEff.h" +#include "AliCDBId.h" /////////////////////////////////////////// // // @@ -25,19 +26,21 @@ class AliITSPlaneEffSPD : public AliITSPlaneEff { // ass. operator AliITSPlaneEffSPD& operator=(const AliITSPlaneEffSPD &s); AliITSPlaneEff& operator=(const AliITSPlaneEff &source); - //AliPlaneEff& operator=(const AliPlaneEff &source); // Simple way to add another class (i.e. statistics). AliITSPlaneEffSPD& operator +=( const AliITSPlaneEffSPD &add); - // Getters for average Plane efficiency (icluding dead/noisy) + // Getters for average Plane efficiency (including dead/noisy) Double_t PlaneEff(const UInt_t mod, const UInt_t chip) const; Double_t ErrPlaneEff(const UInt_t mod, const UInt_t chip) const; Double_t PlaneEff(const UInt_t key) const {return PlaneEff(GetModFromKey(key),GetChipFromKey(key));}; Double_t ErrPlaneEff(const UInt_t key) const {return ErrPlaneEff(GetModFromKey(key),GetChipFromKey(key));}; + // Getters for fFound[] and fTried[] + Int_t GetFound(const UInt_t key) const; + Int_t GetTried(const UInt_t key) const; // Methods to update the Plane efficiency (specific of the SPD segmentation) Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t mod, const UInt_t chip); - virtual Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t key) + Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t key) {return UpDatePlaneEff(Kfound,GetModFromKey(key),GetChipFromKey(key));}; // enum {kNModule = 240}; // The number of modules @@ -45,14 +48,6 @@ class AliITSPlaneEffSPD : public AliITSPlaneEff { enum {kNCol = 32}; // The number of columns per chip enum {kNRow = 256}; // The number of rows per chip (and per module) - enum {kNHisto = kNModule}; // The number of histograms: module by module. - enum {kNclu = 3}; // Build specific histos of residuals up to cluster size kNclu. - // If you change them, then you must change implementation of - // the method FillHistos. -// -// UInt_t GetChip(const UInt_t col) const; // get the chip number (from 0 to kNChip) -// Plane efficiency for active detector (excluding dead/noisy channels) -// access to DB is needed virtual Double_t LivePlaneEff(UInt_t key) const; Double_t LivePlaneEff(const UInt_t mod, const UInt_t chip) const {return LivePlaneEff(GetKey(mod,chip));}; @@ -65,8 +60,8 @@ class AliITSPlaneEffSPD : public AliITSPlaneEff { virtual Double_t GetFracBad(const UInt_t key) const; virtual Bool_t WriteIntoCDB() const; virtual Bool_t ReadFromCDB(); // this method reads Data Members (statistics) from DataBase - virtual Bool_t AddFromCDB() // this method updates Data Members (statistics) from DataBase - {AliError("AddFromCDB: Still To be implemented"); return kFALSE;} + Bool_t AddFromCDB(AliCDBId *cdbId); // this method updates Data Members (statistics) from DataBase + virtual Bool_t AddFromCDB() {AliCDBId *cdbId=0; return AddFromCDB(cdbId);} // method to locate a basic block from Detector Local coordinate (to be used in tracking) // see file cxx for numbering convention. // here idet runs from 0 to 79 for layer 0 and from 0 to 159 for layer 1 @@ -78,50 +73,74 @@ class AliITSPlaneEffSPD : public AliITSPlaneEff { Bool_t GetBlockBoundaries(const UInt_t key,Float_t& xmn,Float_t& xmx,Float_t& zmn,Float_t& zmx) const; // Methods for dealing with auxiliary histograms // method to set on/off the creation/updates of histograms (Histos are created/destroyed) - void SetCreateHistos(Bool_t his=kFALSE) + virtual void SetCreateHistos(Bool_t his=kFALSE) //{fHis=his; if(fHis) InitHistos(); else DeleteHistos(); return; } {fHis=his; if(fHis) {DeleteHistos(); InitHistos();} else DeleteHistos(); return; } - Bool_t FillHistos(UInt_t key, Bool_t found, Float_t trackXZ[2], Float_t clusterXZ[2], Int_t ctXZ[2]); - Bool_t WriteHistosToFile(TString filename="PlaneEffSPDHistos.root",Option_t* option = "RECREATE"); - Bool_t ReadHistosFromFile(TString filename="PlaneEffSPDHistos.root"); // histos must exist already ! - // This method increases the - // statistics of histos by adding - // those of the input file. + //Bool_t FillHistos(UInt_t key, Bool_t found, Float_t trackXZ[2], Float_t clusterXZ[2], Int_t ctXZ[2]); + virtual Bool_t FillHistos(UInt_t key, Bool_t found, Float_t *track, Float_t *cluster, Int_t *ctype); + virtual Bool_t WriteHistosToFile(TString filename="PlaneEffSPDHistos.root",Option_t* option = "RECREATE"); + virtual Bool_t ReadHistosFromFile(TString filename="PlaneEffSPDHistos.root"); // histos must exist already ! + // This method increases the + // statistics of histos by adding + // those of the input file. protected: virtual void Copy(TObject &obj) const; // copy ALL data members to obj - // iboth statistics ad histograms) - void CopyHistos(AliITSPlaneEffSPD& target) const; // copy only histograms to target + // both statistics ad histograms) Int_t GetMissingTracksForGivenEff(Double_t eff, Double_t RelErr, UInt_t im, UInt_t ic) const; - -// - Int_t fFound[kNModule*kNChip]; // number of associated clusters in a given chip - Int_t fTried[kNModule*kNChip]; // number of tracks used for chip efficiency evaluation - TH1F **fHisResX; //! histos with residual distribution (track-cluster) along local X (r-phi) - TH1F **fHisResZ; //! histos with residual distribution (track-cluster) along local Z - TH2F **fHisResXZ; //! 2-d histos with residual distribution (track-cluster) along local X and Z - TH2I **fHisClusterSize; //! histos with cluster-size distribution - TH1F ***fHisResXclu; //! histos with residual distribution along local X (r-phi) for cluster type - TH1F ***fHisResZclu; //! histos with residual distribution along local Z for cluster type - private: - //UInt_t GetKey(const UInt_t mod, const UInt_t chip) const; // unique key to locate the basic - // block of the SPD UInt_t GetModFromKey(const UInt_t key) const; UInt_t GetChipFromKey(const UInt_t key) const; UInt_t GetChipFromCol(const UInt_t col) const; // get the chip number (from 0 to kNChip) UInt_t GetColFromLocZ(Float_t zloc) const; // get the Column from the local z - Float_t GetLocZFromCol(const UInt_t col) const; // get the local Z from the column number, + Float_t GetLocZFromCol(const UInt_t col) const; // get the local Z from the column number, // the latter in the range [0,kNChip*kNCol] - Float_t GetLocXFromRow(const UInt_t row) const; // get the local X from the row number + Float_t GetLocXFromRow(const UInt_t row) const; // get the local X from the row number // the latter in the range [0,kNRow] void GetModAndChipFromKey(const UInt_t key, UInt_t& mod, UInt_t& chip) const; void GetDeadAndNoisyInChip(const UInt_t key, UInt_t& dead, UInt_t& noisy) const; - void InitHistos(); - void DeleteHistos(); +// + Int_t fFound[kNModule*kNChip]; // number of associated clusters in a given chip + Int_t fTried[kNModule*kNChip]; // number of tracks used for chip efficiency evaluation + + private: + enum {kNHisto = kNModule}; // The number of histograms: module by module. + enum {kNclu = 3}; // Build specific histos of residuals up to cluster size kNclu. + // If you change them, then you must change implementation of + // the method FillHistos. + + virtual void InitHistos(); // create histos by allocating memory for them + virtual void DeleteHistos(); // deletete histos (memory is freed) + virtual void CopyHistos(AliITSPlaneEffSPD& target) const; // copy only histograms to target + + TH1F **fHisResX; //! histos with residual distribution (track-cluster) along local X (r-phi) + TH1F **fHisResZ; //! histos with residual distribution (track-cluster) along local Z + TH2F **fHisResXZ; //! 2-d histos with residual distribution (track-cluster) along local X and Z + TH2I **fHisClusterSize; //! histos with cluster-size distribution + TH1F ***fHisResXclu; //! histos with residual distribution along local X (r-phi) for cluster type + TH1F ***fHisResZclu; //! histos with residual distribution along local Z for cluster type + TH1F ***fHisResXchip; //! histos with residual distribution along local X (r-phi) chip by chip + TH1F ***fHisResZchip; //! histos with residual distribution along local Z chip by chip + //TProfile **fProfResXvsLPhi; //! TProfile of X Residuals vs. impact Angle phi (of the track w.r.t. module) + //TProfile **fProfResZvsLPhi; //! TProfile of Z Residuals vs. impact Angle phi (of the track w.r.t. module) + //TProfile **fProfResXvsLDip; //! TProfile of X Residuals vs. impact dip Angle (of the track w.r.t. module) + //TProfile **fProfResZvsLDip; //! TProfile of Z Residuals vs. impact dip Angle (of the track w.r.t. module) + TH1F **fHisTrackErrX; //! histos with track prediction error on Local X + TH1F **fHisTrackErrZ; //! histos with track prediction error on Local Z + TH1F **fHisClusErrX; //! histos with Local_X cluster error + TH1F **fHisClusErrZ; //! histos with Local_Z cluster error ClassDef(AliITSPlaneEffSPD,2) // SPD Plane Efficiency class }; // inline UInt_t AliITSPlaneEffSPD::Nblock() const {return kNModule*kNChip;} + +inline Int_t AliITSPlaneEffSPD::GetFound(const UInt_t key) const { + if(key>=kNModule*kNChip) {AliWarning("GetFound: you asked for a non existing key"); return -1;} + return fFound[key]; +} +inline Int_t AliITSPlaneEffSPD::GetTried(const UInt_t key) const { + if(key>=kNModule*kNChip) {AliWarning("GetTried: you asked for a non existing key"); return -1;} + return fTried[key]; +} // #endif diff --git a/ITS/AliITSPlaneEffSSD.cxx b/ITS/AliITSPlaneEffSSD.cxx index 5c9aa2ef7b5..878270b0f45 100644 --- a/ITS/AliITSPlaneEffSSD.cxx +++ b/ITS/AliITSPlaneEffSSD.cxx @@ -1,4 +1,4 @@ - /************************************************************************** +/************************************************************************** * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * @@ -346,10 +346,8 @@ Bool_t AliITSPlaneEffSSD::ReadFromCDB() { if(!fInitCDBCalled) {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/PlaneEffSSD",fRunNumber); +if(!cdbEntry) return kFALSE; AliITSPlaneEffSSD* eff= (AliITSPlaneEffSSD*)cdbEntry->GetObject(); if(this==eff) return kFALSE; if(fHis) CopyHistos(*eff); // If histos already exist then copy them to eff @@ -357,6 +355,21 @@ eff->Copy(*this); // copy everything (statistics and histos) from eff t return kTRUE; } //_____________________________________________________________________________ +Bool_t AliITSPlaneEffSSD::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/PlaneEffSSD",fRunNumber); +} else { + cdbEntry = AliCDBManager::Instance()->Get(*cdbId); +} +if(!cdbEntry) return kFALSE; +AliITSPlaneEffSSD* eff= (AliITSPlaneEffSSD*)cdbEntry->GetObject(); +*this+=*eff; +return kTRUE; +} +//_____________________________________________________________________________ UInt_t AliITSPlaneEffSSD::GetKeyFromDetLocCoord(Int_t ilay, Int_t idet, Float_t, Float_t) const { // method to locate a basic block from Detector Local coordinate (to be used in tracking) @@ -444,12 +457,16 @@ return; } //__________________________________________________________ Bool_t AliITSPlaneEffSSD::FillHistos(UInt_t key, Bool_t found, - Float_t tXZ[2], Float_t cXZ[2], Int_t ctXZ[2]) { + // Float_t tXZ[2], Float_t cXZ[2], Int_t ctXZ[2]) { + Float_t *tr, Float_t *clu, Int_t *csize) { // 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 -// - tXZ[2] local X and Z coordinates of the track prediction -// - cXZ[2] local X and Z coordinates of the cluster associated to the track +// - 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 // output: kTRUE if filling was succesfull kFALSE otherwise // side effects: updating of the histograms. // @@ -463,12 +480,12 @@ Bool_t AliITSPlaneEffSSD::FillHistos(UInt_t key, Bool_t found, if(id>=kNHisto) {AliWarning("FillHistos: you want to fill a non-existing histos"); return kFALSE;} if(found) { - Float_t resx=tXZ[0]-cXZ[0]; - Float_t resz=tXZ[1]-cXZ[1]; + 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)ctXZ[0],(Double_t)ctXZ[1]); + fHisClusterSize[id]->Fill((Double_t)csize[0],(Double_t)csize[1]); } return kTRUE; } @@ -522,6 +539,7 @@ Bool_t AliITSPlaneEffSSD::ReadHistosFromFile(TString filename) { AliWarning("ReadHistosFromFile: incorrect output filename!"); return kFALSE; } + //char branchname[30]; TH1F *h = 0; TH2F *h2 = 0; diff --git a/ITS/AliITSPlaneEffSSD.h b/ITS/AliITSPlaneEffSSD.h index 493bfbcdc37..a12764d09b7 100644 --- a/ITS/AliITSPlaneEffSSD.h +++ b/ITS/AliITSPlaneEffSSD.h @@ -6,6 +6,7 @@ #include #include #include "AliITSPlaneEff.h" +#include "AliCDBId.h" /////////////////////////////////////////// // // @@ -37,11 +38,6 @@ class AliITSPlaneEffSSD : public AliITSPlaneEff { enum {kNChip = 6}; // The number of chips per side of a module (2 sides: 12 chips) enum {kNSide = 2}; // The number of sides of a module (p and n side) enum {kNStrip = 128}; // The number of strips per chip (in a module 2*768 strips) - // - enum {kNHisto = kNModule}; // The number of histograms: module by module. - //enum {kNclu = 3}; // Build specific histos of residuals up to cluster size kNclu. - // If you change them, then you must change implementation of - // the method FillHistos. // // Plane efficiency for active detector (excluding dead/noisy channels) // access to DB is needed @@ -53,8 +49,8 @@ class AliITSPlaneEffSSD : public AliITSPlaneEff { virtual Double_t GetFracBad(const UInt_t mod) const; virtual Bool_t WriteIntoCDB() const; virtual Bool_t ReadFromCDB(); // this method reads Data Members (statistics) from DataBase - virtual Bool_t AddFromCDB() // this method updates Data Members (statistics) from DataBase - {AliError("AddFromCDB: Still To be implemented"); return kFALSE;} + Bool_t AddFromCDB(AliCDBId *cdbId); // this method updates Data Members (statistics) from DataBase + virtual Bool_t AddFromCDB() {AliCDBId *cdbId=0; return AddFromCDB(cdbId);} // method to locate a basic block from Detector Local coordinate (to be used in tracking) // see file cxx for numbering convention. // here idet runs from 0 to 747 for layer 4 and from 0 to 949 for layer 5 @@ -64,35 +60,41 @@ class AliITSPlaneEffSSD : public AliITSPlaneEff { Bool_t GetBlockBoundaries(const UInt_t key,Float_t& xmn,Float_t& xmx,Float_t& zmn,Float_t& zmx) const; // Methods for dealing with auxiliary histograms // method to set on/off the creation/updates of histograms (Histos are created/destroyed) - void SetCreateHistos(Bool_t his=kFALSE) + virtual void SetCreateHistos(Bool_t his=kFALSE) {fHis=his; if(fHis) {DeleteHistos(); InitHistos();} else DeleteHistos(); return; } - Bool_t FillHistos(UInt_t key, Bool_t found, Float_t trackXZ[2], Float_t clusterXZ[2], Int_t ctXZ[2]); - Bool_t WriteHistosToFile(TString filename="PlaneEffSSDHistos.root",Option_t* option = "RECREATE"); - Bool_t ReadHistosFromFile(TString filename="PlaneEffSSDHistos.root"); // histos must exist already ! + //Bool_t FillHistos(UInt_t key, Bool_t found, Float_t trackXZ[2], Float_t clusterXZ[2], Int_t ctXZ[2]); + virtual Bool_t FillHistos(UInt_t key, Bool_t found, Float_t *track, Float_t *cluster, Int_t *ctype); + virtual Bool_t WriteHistosToFile(TString filename="PlaneEffSSDHistos.root",Option_t* option = "RECREATE"); + virtual Bool_t ReadHistosFromFile(TString filename="PlaneEffSSDHistos.root"); // histos must exist already ! // This method increases the // statistics of histos by adding // those of the input file. + UInt_t GetKey(const UInt_t mod) const; // unique key to locate the basic + // block of the SSD (the module itself) protected: virtual void Copy(TObject &obj) const; - void CopyHistos(AliITSPlaneEffSSD& target) const; // copy only histograms to target Int_t GetMissingTracksForGivenEff(Double_t eff, Double_t RelErr, UInt_t im) const; + UInt_t GetModFromKey(const UInt_t key) const; + void GetBadInModule(const UInt_t mod, UInt_t& bad) const; // Int_t fFound[kNModule]; // number of associated clusters in a given module Int_t fTried[kNModule]; // number of tracks used for module efficiency evaluation +// + private: + enum {kNHisto = kNModule}; // The number of histograms: module by module. + //enum {kNclu = 3}; // Build specific histos of residuals up to cluster size kNclu. + // If you change them, then you must change implementation of + // the method FillHistos. + virtual void InitHistos(); // create histos by allocating memory for them + virtual void DeleteHistos(); // deletete histos (memory is freed) + void CopyHistos(AliITSPlaneEffSSD& target) const; // copy only histograms to target // TH1F **fHisResX; //! histos with residual distribution (track-cluster) along local X (r-phi) TH1F **fHisResZ; //! histos with residual distribution (track-cluster) along local Z TH2F **fHisResXZ; //! 2-d histos with residual distribution (track-cluster) along local X and Z TH2I **fHisClusterSize; //! histos with cluster-size distribution - private: - UInt_t GetKey(const UInt_t mod) const; // unique key to locate the basic - // block of the SSD (the module itself) - UInt_t GetModFromKey(const UInt_t key) const; - void GetBadInModule(const UInt_t mod, UInt_t& bad) const; - void InitHistos(); - void DeleteHistos(); - +// ClassDef(AliITSPlaneEffSSD,2) // SSD Plane Efficiency class }; // diff --git a/ITS/AliITStrackerMI.cxx b/ITS/AliITStrackerMI.cxx index 086aa1d83ed..d7612b7fcfd 100644 --- a/ITS/AliITStrackerMI.cxx +++ b/ITS/AliITStrackerMI.cxx @@ -5123,6 +5123,7 @@ void AliITStrackerMI::UseTrackForPlaneEff(AliITStrackMI* track, Int_t ilayer) { if(key>fPlaneEff->Nblock()) return; Bool_t found=kFALSE; //if (ci>=0) { + Double_t chi2; while ((cl=layer.GetNextCluster(clidx))!=0) { idetc = cl->GetDetectorIndex(); if(idet!=idetc) continue; @@ -5131,7 +5132,8 @@ void AliITStrackerMI::UseTrackForPlaneEff(AliITStrackMI* track, Int_t ilayer) { if ( (tmp.GetZ()-cl->GetZ())*(tmp.GetZ()-cl->GetZ())*msz + (tmp.GetY()-cl->GetY())*(tmp.GetY()-cl->GetY())*msy > 1. ) continue; // calculate track-clusters chi2 - Double_t chi2 = GetPredictedChi2MI(&tmp,cl,ilayer); // note that this method change track tmp + chi2 = GetPredictedChi2MI(&tmp,cl,ilayer); // note that this method change track tmp + // in particular, the error associated to the cluster //Double_t chi2 = tmp.GetPredictedChi(cl); // this method does not change track tmp // chi2 cut if (chi2 > AliITSReconstructor::GetRecoParam()->GetMaxChi2s(ilayer)) continue; @@ -5143,20 +5145,59 @@ void AliITStrackerMI::UseTrackForPlaneEff(AliITStrackMI* track, Int_t ilayer) { if(!fPlaneEff->UpDatePlaneEff(found,key)) AliWarning(Form("UseTrackForPlaneEff: cannot UpDate PlaneEff for key=%d",key)); if(fPlaneEff->GetCreateHistos()&& AliITSReconstructor::GetRecoParam()->GetHistoPlaneEff()) { + Float_t tr[4]={99999.,99999.,9999.,9999.}; // initialize to high values + Float_t clu[4]={-99999.,-99999.,9999.,9999.}; // (in some cases GetCov fails) + Int_t cltype[2]={-999,-999}; Int_t ndet=AliITSgeomTGeo::GetNDetectors(ilayer+1); // layers from 1 to 6 Int_t lad = Int_t(idet/ndet) + 1; Int_t hdet = idet - (lad-1)*ndet + 1; - Double_t xyzGlob[3],xyzLoc[3]; - tmp.GetXYZ(xyzGlob); - AliITSgeomTGeo::GlobalToLocal(ilayer+1,lad,hdet,xyzGlob,xyzLoc); - Float_t tr[2]={xyzLoc[0],xyzLoc[2]}; - Float_t clu[2]={-99999.,-99999.}; - Int_t cltype[2]={-999,-999}; + Double_t xyzGlob[3],xyzLoc[3],cv[21],exyzLoc[3],exyzGlob[3]; + if(tmp.GetXYZ(xyzGlob)) { + if (AliITSgeomTGeo::GlobalToLocal(ilayer+1,lad,hdet,xyzGlob,xyzLoc)) { + tr[0]=xyzLoc[0]; + tr[1]=xyzLoc[2]; + } + } + if(tmp.GetCovarianceXYZPxPyPz(cv)) { + exyzGlob[0]=TMath::Sqrt(cv[0]); + exyzGlob[1]=TMath::Sqrt(cv[2]); + exyzGlob[2]=TMath::Sqrt(cv[5]); + if (AliITSgeomTGeo::GlobalToLocalVect(AliITSgeomTGeo::GetModuleIndex(ilayer+1,lad,hdet),exyzGlob,exyzLoc)) { + tr[2]=TMath::Abs(exyzLoc[0]); + tr[3]=TMath::Abs(exyzLoc[2]); + } + } if (found){ clu[0]=layer.GetCluster(ci)->GetDetLocalX(); clu[1]=layer.GetCluster(ci)->GetDetLocalZ(); cltype[0]=layer.GetCluster(ci)->GetNy(); cltype[1]=layer.GetCluster(ci)->GetNz(); + + // Without the following 6 lines you would retrieve the nominal error of a cluster (e.g. for the SPD: + // X->50/sqrt(12)=14 micron Z->450/sqrt(12)= 120 micron) + // Within AliTrackerMI/AliTrackMI the error on the cluster is associated to the AliITStrackMI (fSigmaY,Z) + // It is computed properly by calling the method + // AliITStrackerMI::GetPredictedChi2MI(AliITStrackMI* track, const AliITSRecPoint *cluster,Int_t layer) + // T + //Double_t x=0.5*(tmp.GetX()+layer.GetCluster(ci)->GetX()); // Take into account the mis-alignment + //if (tmp.PropagateTo(x,0.,0.)) { + chi2=GetPredictedChi2MI(&tmp,layer.GetCluster(ci),ilayer); + AliCluster c(*layer.GetCluster(ci)); + c.SetSigmaY2(tmp.GetSigmaY(ilayer)*tmp.GetSigmaY(ilayer)); + c.SetSigmaZ2(tmp.GetSigmaZ(ilayer)*tmp.GetSigmaZ(ilayer)); + Float_t cov[6]; + //if (layer.GetCluster(ci)->GetGlobalCov(cov)) // by using this, instead, you got nominal cluster errors + if (c.GetGlobalCov(cov)) + { + exyzGlob[0]=TMath::Sqrt(cov[0]); + exyzGlob[1]=TMath::Sqrt(cov[3]); + exyzGlob[2]=TMath::Sqrt(cov[5]); + if (AliITSgeomTGeo::GlobalToLocalVect(AliITSgeomTGeo::GetModuleIndex(ilayer+1,lad,hdet),exyzGlob,exyzLoc)) { + clu[2]=TMath::Abs(exyzLoc[0]); + clu[3]=TMath::Abs(exyzLoc[2]); + } + } + //} } fPlaneEff->FillHistos(key,found,tr,clu,cltype); } -- 2.39.3