#ifndef ALITRDTRACKLETMCM_H
#define ALITRDTRACKLETMCM_H
#include "AliTRDtrackletBase.h"
#include "AliTRDgeometry.h"
#include "AliTRDpadPlane.h"
class AliTRDtrackletMCM : public AliTRDtrackletBase {
public:
AliTRDtrackletMCM(UInt_t trackletWord = 0);
AliTRDtrackletMCM(UInt_t trackletWword, Int_t hcid);
AliTRDtrackletMCM(UInt_t trackletWword, Int_t hcid, Int_t rob, Int_t mcm);
AliTRDtrackletMCM(const AliTRDtrackletMCM &rhs);
~AliTRDtrackletMCM();
Int_t GetYbin() const;
Int_t GetdY() const;
Int_t GetZbin() const { return ((fTrackletWord >> 20) & 0xf); }
Int_t GetPID() const { return ((fTrackletWord >> 24) & 0xff); }
Int_t GetMCM() const { return fMCM; }
Int_t GetROB() const { return fROB; }
Int_t GetLabel() const { return fLabel[0]; }
Int_t GetLabel(const Int_t i) const { return fLabel[i]; }
Bool_t HasLabel(const Int_t label) const { return (fLabel[0] == label || fLabel[1] == label || fLabel[2] == label); }
Bool_t CookPID() { return kFALSE; }
Double_t GetPID(Int_t ) const { return GetPID()/256.; }
Int_t GetDetector() const { return fHCId / 2; }
Int_t GetHCId() const { return fHCId; }
Float_t GetdYdX() const { return (GetdY() * 140e-4 / 3.); }
Float_t GetX() const { return fGeo->GetTime0((fHCId % 12) / 2); }
Float_t GetY() const { return (GetYbin() * 160e-4); }
Float_t GetZ() const { return fGeo->GetPadPlane((fHCId % 12) / 2, (fHCId / 12) % 5)->GetRowPos( 4 * (fROB / 2) + fMCM / 4) -
fGeo->GetPadPlane((fHCId % 12) / 2, (fHCId /12) % 5)->GetRowSize(4 * (fROB / 2) + fMCM / 4) * .5; }
Float_t GetLocalZ() const { return GetZ() -
(fGeo->GetPadPlane((fHCId % 12) / 2, (fHCId / 12) % 5)->GetRow0()+fGeo->GetPadPlane((fHCId % 12) / 2, (fHCId / 12) % 5)->GetRowEnd())/2.; }
Int_t GetQ0() const { return fQ0; }
Int_t GetQ1() const { return fQ1; }
Int_t GetNHits() const { return fNHits; }
Int_t GetNHits0() const { return fNHits0; }
Int_t GetNHits1() const { return fNHits1; }
UInt_t GetTrackletWord() const { return fTrackletWord; }
void SetTrackletWord(UInt_t trackletWord) { fTrackletWord = trackletWord; }
void SetDetector(Int_t id) { fHCId = 2 * id + (GetYbin() < 0 ? 0 : 1); }
void SetHCId(Int_t id) { fHCId = id; }
void SetMCM(Int_t mcm) { fMCM = mcm; }
void SetROB(Int_t rob) { fROB = rob; }
void SetLabel(Int_t label[]);
void SetQ0(Int_t charge) { fQ0 = charge; }
void SetQ1(Int_t charge) { fQ1 = charge; }
void SetNHits(Int_t nhits) { fNHits = nhits; }
void SetNHits0(Int_t nhits) { fNHits0 = nhits; }
void SetNHits1(Int_t nhits) { fNHits1 = nhits; }
void SetSlope(Float_t slope) { fSlope = slope; }
void SetOffset(Float_t offset) { fOffset = offset; }
void SetError(Float_t error) { fError = error; }
void SetClusters(Float_t *res, Float_t *q, Int_t n);
Float_t GetSlope() const { return fSlope; }
Float_t GetOffset() const { return fOffset; }
Float_t GetError() const { return fError; }
Int_t GetNClusters() const { return fNClusters; }
Float_t *GetResiduals() const { return fResiduals; }
Float_t *GetClsCharges() const { return fClsCharges; }
protected:
AliTRDgeometry *fGeo;
Int_t fHCId;
UInt_t fTrackletWord;
Int_t fMCM;
Int_t fROB;
Int_t fQ0;
Int_t fQ1;
Int_t fNHits;
Int_t fNHits0;
Int_t fNHits1;
Int_t fLabel[3];
Float_t fSlope;
Float_t fOffset;
Float_t fError;
Int_t fNClusters;
Float_t *fResiduals;
Float_t *fClsCharges;
private:
AliTRDtrackletMCM& operator=(const AliTRDtrackletMCM &rhs);
ClassDef(AliTRDtrackletMCM, 2);
};
#endif