#ifndef ALITRDTENDERSUPPLY_H
#define ALITRDTENDERSUPPLY_H
#include <AliTenderSupply.h>
class AliTRDCalDet;
class AliESDEvent;
class AliOADBContainer;
class AliTRDonlineTrackMatching;
class AliTRDTenderSupply: public AliTenderSupply {
public:
enum{
kNNpid = 0,
k1DLQpid = 1,
k2DLQpid = 2
};
AliTRDTenderSupply();
AliTRDTenderSupply(const char *name, const AliTender *tender=NULL);
virtual ~AliTRDTenderSupply();
void SetRunByRunCorrection(const char *filename) { fNameRunByRunCorrection = filename; }
void SetLoadDeadChambersFromCDB(){ fLoadDeadChambers = kTRUE;} ;
void SetPIDmethod(Int_t pidMethod) { fPIDmethod = pidMethod; }
void SetNormalizationFactor(Double_t norm, Int_t runMin, Int_t runMax);
void SetNormalizationFactor(Double_t norm) { fNormalizationFactor = norm; }
void SetCalibLowpThreshold(Double_t pmin) { fPthreshold = pmin; };
void SetGeoFile(const char *filename) { fGeoFile = filename; }
void SetDebugMode() { fDebugMode = kTRUE; }
void SetRedoTRDMatching(Bool_t redo = kTRUE) {fRedoTrdMatching = redo;}
virtual void Init();
virtual void ProcessEvent();
void SwitchOnGainCorrection() { fGainCorrection = kTRUE; }
void SwitchOffGainCorrection() { fGainCorrection = kFALSE; }
void SetSlicesForPID(UInt_t min, UInt_t max) { fSlicesForPID[0] = min; fSlicesForPID[1] = max;}
void AddBadChamber(Int_t chamberID){fBadChamberID[fNBadChambers++] = chamberID;};
private:
enum{
kNPlanes = 6,
kNStacks = 5,
kNChambers = 540
};
Bool_t GetTRDchamberID(AliESDtrack * const track, Int_t *detectors);
void SetChamberGain();
void ApplyGainCorrection(AliESDtrack *track, const Int_t * const detectors);
void ApplyRunByRunCorrection(AliESDtrack *const track);
void MaskChambers(AliESDtrack * const track, const Int_t * const detectors);
void LoadReferences();
void LoadDeadChambersFromCDB();
void LoadRunByRunCorrection(const char *filename);
Bool_t IsBadChamber(Int_t chamberID);
Double_t GetNormalizationFactor(Int_t runnumber);
AliESDEvent *fESD;
AliESDpid *fESDpid;
AliTRDonlineTrackMatching *fTrdOnlineTrackMatcher;
AliTRDCalDet *fChamberGainOld;
AliTRDCalDet *fChamberGainNew;
AliTRDCalDet *fChamberVdriftOld;
AliTRDCalDet *fChamberVdriftNew;
AliOADBContainer *fRunByRunCorrection;
Int_t fPIDmethod;
Double_t fNormalizationFactor;
Double_t fPthreshold;
Int_t fBadChamberID[kNChambers];
UInt_t fSlicesForPID[2];
UInt_t fNBadChambers;
const char *fGeoFile;
Bool_t fGainCorrection;
Bool_t fLoadDeadChambers;
Bool_t fHasReferences;
Bool_t fHasNewCalibration;
Bool_t fDebugMode;
Bool_t fRedoTrdMatching;
TString fNameRunByRunCorrection;
TObjArray *fNormalizationFactorArray;
AliTRDTenderSupply(const AliTRDTenderSupply&c);
AliTRDTenderSupply& operator= (const AliTRDTenderSupply&c);
ClassDef(AliTRDTenderSupply, 1);
};
#endif