#ifndef ALIITSPLANEEFFSDD_H
#define ALIITSPLANEEFFSDD_H
#include <TH2I.h>
#include <TProfile.h>
#include "AliITSPlaneEff.h"
class AliCDBId;
class AliITSPlaneEffSDD : public AliITSPlaneEff {
public:
AliITSPlaneEffSDD();
virtual ~AliITSPlaneEffSDD();
AliITSPlaneEffSDD(const AliITSPlaneEffSDD &source);
AliITSPlaneEffSDD& operator=(const AliITSPlaneEffSDD &s);
AliITSPlaneEffSDD& operator +=( const AliITSPlaneEffSDD &add);
Double_t PlaneEff(const UInt_t mod, const UInt_t chip,
const UInt_t wing, const UInt_t subw=0) const;
Double_t ErrPlaneEff(const UInt_t mod, const UInt_t chip,
const UInt_t wing, const UInt_t subw=0) const;
Double_t PlaneEff(const UInt_t key) const
{return PlaneEff(GetModFromKey(key),GetChipFromKey(key),
GetWingFromKey(key),GetSubWingFromKey(key));};
Double_t ErrPlaneEff(const UInt_t key) const
{return ErrPlaneEff(GetModFromKey(key),GetChipFromKey(key),
GetWingFromKey(key),GetSubWingFromKey(key));};
Int_t GetFound(const UInt_t key) const;
Int_t GetTried(const UInt_t key) const;
Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t mod,
const UInt_t chip, const UInt_t wing, const UInt_t subw=0);
Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t key)
{return UpDatePlaneEff(Kfound,GetModFromKey(key),GetChipFromKey(key),
GetWingFromKey(key),GetSubWingFromKey(key));};
enum {kNModule = 260};
enum {kNChip = 4};
enum {kNWing = 2};
enum {kNSubWing = 1};
enum {kNAnode = 64};
virtual Double_t LivePlaneEff(UInt_t key) const;
Double_t LivePlaneEff(const UInt_t mod, const UInt_t chip,
const UInt_t wing, const UInt_t subw=0) const
{return LivePlaneEff(GetKey(mod,chip,wing,subw));};
virtual Double_t ErrLivePlaneEff(UInt_t key) const;
Double_t ErrLivePlaneEff(const UInt_t mod, const UInt_t chip,
const UInt_t wing, const UInt_t subw=0) const
{return ErrLivePlaneEff(GetKey(mod,chip,wing,subw));};
virtual Double_t GetFracLive(const UInt_t key) const;
virtual Double_t GetFracBad(const UInt_t key) const;
virtual Bool_t WriteIntoCDB() const;
virtual Bool_t ReadFromCDB();
Bool_t AddFromCDB(AliCDBId *cdbId);
virtual Bool_t AddFromCDB() {AliCDBId *cdbId=0; return AddFromCDB(cdbId);}
UInt_t GetKeyFromDetLocCoord(Int_t ilay,Int_t idet, Float_t locx, Float_t locz) const;
UInt_t Nblock() const;
Bool_t GetBlockBoundaries(const UInt_t key,Float_t& xmn,Float_t& xmx,Float_t& zmn,Float_t& zmx) const;
void SetCreateHistos(Bool_t his=kFALSE)
{fHis=his; if(fHis) {DeleteHistos(); InitHistos();} else DeleteHistos(); return; }
virtual Bool_t FillHistos(UInt_t key, Bool_t found, Float_t *track, Float_t *cluster, Int_t *ctype, Float_t *);
virtual Bool_t WriteHistosToFile(TString filename="PlaneEffSDDHistos.root",Option_t* option = "RECREATE");
virtual Bool_t ReadHistosFromFile(TString filename="PlaneEffSDDHistos.root");
UInt_t GetKey(const UInt_t mod, const UInt_t chip,
const UInt_t wing, const UInt_t subw=0) const;
void ChipAndWingFromChip07(const Int_t chip07, UInt_t& chip, UInt_t& wing) const;
protected:
virtual void Copy(TObject &obj) const;
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;
UInt_t ChipFromAnode(const UInt_t anode) const;
UInt_t WingFromAnode(const UInt_t anode) const;
void ChipAndWingFromAnode(const UInt_t anode,UInt_t& chip,UInt_t& wing) const;
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];
Int_t fTried[kNModule*kNChip*kNWing*kNSubWing];
private:
enum {kNHisto = kNModule};
enum {kNclu = 3};
virtual void InitHistos();
virtual void DeleteHistos();
virtual void CopyHistos(AliITSPlaneEffSDD& target) const;
TH1F **fHisResX;
TH1F **fHisResZ;
TH2F **fHisResXZ;
TH2I **fHisClusterSize;
TProfile **fProfResXvsCluSizeX;
TH1F ***fHisResZclu;
TProfile **fProfResXvsX;
TProfile **fProfResZvsX;
TProfile **fProfClustSizeXvsX;
TProfile **fProfClustSizeZvsX;
TH1F **fHisTrackErrX;
TH1F **fHisTrackErrZ;
TH1F **fHisClusErrX;
TH1F **fHisClusErrZ;
ClassDef(AliITSPlaneEffSDD,2)
};
inline UInt_t AliITSPlaneEffSDD::Nblock() const {return kNModule*kNChip*kNWing*kNSubWing;}
inline Int_t AliITSPlaneEffSDD::GetFound(const UInt_t key) const {
if(key>=kNModule*kNChip*kNWing*kNSubWing) {AliWarning("GetFound: you asked for a non existing key"); return -1;}
return fFound[key];
}
inline Int_t AliITSPlaneEffSDD::GetTried(const UInt_t key) const {
if(key>=kNModule*kNChip*kNWing*kNSubWing) {AliWarning("GetTried: you asked for a non existing key"); return -1;}
return fTried[key];
}
inline void AliITSPlaneEffSDD::ChipAndWingFromChip07(const Int_t chip07, UInt_t& chip,
UInt_t& wing) const {
if(chip07<0 || chip07>7)
{AliWarning("ChipAndWingFromChip07: you asked for a non existing chip"); return;}
else if(chip07<=3) { chip=chip07; wing=0;}
else {chip=chip07-kNChip; wing=1;}
return;
}
#endif