]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFTrigger.h
Adding set of AliESDEvent in the track for TOF matching
[u/mrichter/AliRoot.git] / TOF / AliTOFTrigger.h
1 #ifndef ALITOFTRIGGER_H
2 #define ALITOFTRIGGER_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 /* $Id$ */
8
9 /////////////////////////////////////////////////
10 //                                             //
11 //      TOF Trigger Detector Class             //
12 //                                             //
13 /////////////////////////////////////////////////
14
15 #include "AliTriggerDetector.h"
16 #include "AliLog.h"
17 #include "TTree.h"
18
19 class AliTOFrawData;
20 class AliTOFTriggerMask;
21
22 class AliTOFTrigger : public AliTriggerDetector
23 {
24  public:
25   AliTOFTrigger();  // constructor
26   AliTOFTrigger(Int_t HighMultTh, Int_t ppMBTh, Int_t MultiMuonTh, Int_t UPTh, Float_t deltaminpsi, Float_t deltamaxpsi, Float_t deltaminro, Float_t deltamaxro, Int_t stripWindow,Float_t startTimeWindow=0.0,Float_t widthTimeWindow=25.); //constructor with parameters
27   virtual ~AliTOFTrigger();  // destructor
28   virtual void    CreateInputs();
29   virtual void    Trigger();
30   Int_t   GetHighMultTh() const {return fHighMultTh;}
31   Int_t   GetppMBTh() const {return fppMBTh;}
32   Int_t   GetMultiMuonTh() const {return fMultiMuonTh;}
33   Int_t   GetUPTh() const {return fUPTh;}
34   Float_t Getdeltaminpsi() const {return fdeltaminpsi;}
35   Float_t Getdeltamaxpsi() const {return fdeltamaxpsi;}
36   Float_t Getdeltaminro() const {return fdeltaminro;}
37   Float_t Getdeltamaxro() const {return fdeltamaxro;}
38   Int_t  GetstripWindow() const {return fstripWindow;}
39
40   static void LoadActiveMask(); // Load active channel trigger mask
41   void GetMapMatrix(Bool_t map[][24]) const;
42   void GetMap(Bool_t **map) const;
43   //void PrintMap(); // to be checked because of warning problems
44   void GetTRDmapMatrix(Bool_t map[][8]) const;
45   void GetTRDmap(Bool_t **map) const;
46   Bool_t GetBit(Int_t nDDL, Int_t nTRM, Int_t iChain,Int_t iTDC, Int_t iCH);
47   Bool_t GetBit(Int_t *detind);
48   void SetBit(Int_t nDDL, Int_t nTRM, Int_t iChain,Int_t iTDC, Int_t iCH);
49   void SetBit(Int_t *detind);
50   void ResetBit(Int_t nDDL, Int_t nTRM, Int_t iChain,Int_t iTDC, Int_t iCH);
51   void ResetBit(Int_t *detind);
52
53
54   void   SetHighMultTh(Int_t HighMultTh){fHighMultTh = HighMultTh;}
55   void   SetppMBTh(Int_t ppMBTh){fppMBTh = ppMBTh;}
56   void   SetMultiMuonTh(Int_t MultiMuonTh){fMultiMuonTh = MultiMuonTh;}
57   void   SetUPTh(Int_t UPTh){fUPTh = UPTh;}
58   void   Setdeltaminpsi(Float_t deltaminpsi){fdeltaminpsi = deltaminpsi;}
59   void   Setdeltamaxpsi(Float_t deltamaxpsi){fdeltamaxpsi = deltamaxpsi;}
60   void   Setdeltaminro(Float_t deltaminro){fdeltaminro = deltaminro;}
61   void   Setdeltamaxro(Float_t deltamaxro){fdeltamaxro = deltamaxro;}
62   void   SetstripWindow(Int_t stripWindow){fstripWindow = stripWindow;}
63
64   Bool_t Return(Int_t i){if(i==0) return fSel1;
65                          else if(i==1) return fSel2;
66                          else if(i==2) return fSel3;
67                          else if(i==3) return fSel4;
68                          else { AliWarning(Form(" Index out of range: %d not in [0,3]",i)); return kFALSE; }
69                         };
70
71   Float_t GetStartTimeWindow() const {return fStartTimeHit;}; // in ns
72   Float_t GetTimeWidthWindow() const {return fTimeWidthTrigger;}; // in ns
73   void    SetStartTimeWindow(Float_t val) {fStartTimeHit = val;}; // in ns
74   void    SetTimeWidthWindow(Float_t val) {fTimeWidthTrigger = val;}; // in ns
75   
76   Int_t GetNumberOfCrateOn(){return fNCrateOn;}; 
77   Int_t GetNumberOfMaxipadOn(){return fNMaxipadOn;}; 
78   Int_t GetNumberOfMaxipadOnAll(){return fNMaxipadOnAll;}; 
79   Bool_t *GetLTMarray(){return fLTMarray;};
80   void   CreateCTTMMatrix();
81   void   CreateLTMMatrix();
82   void   CreateLTMMatrixFromDigits();
83   void   CreateLTMMatrixFromRaw(AliRawReader *fRawReader);
84
85   static AliTOFTriggerMask *GetTOFTriggerMap() {return fTOFTrigMap;}
86   static void PrepareTOFMapFromRaw(AliRawReader *fRawReader,Int_t deltaBC=13600);
87   static void PrepareTOFMapFromDigit(TTree *treeD);
88  private:
89
90   enum{
91     kNLTM = 72,          //Number of LTM
92     kNLTMchannels = 48,  //Number of channels in a LTM
93     kNCTTM = 36,         //Number of CTTM per TOF side
94     kNCTTMchannels = 24,  //Number of channels in a CTTM
95     kNLTMtoTRDchannels = 8  //Number of channels in a CTTM
96   };
97
98   static AliTOFTriggerMask *fTOFTrigMap; // class with the TOF trigger map
99   static AliTOFTriggerMask *fTOFTrigMask; // class with the TOF trigger mask
100
101   AliTOFTrigger& operator=(const AliTOFTrigger &/*source*/); // ass. op.
102   AliTOFTrigger(const AliTOFTrigger & tr);
103
104   void    GetCTTMIndex(Int_t *detind, Int_t *indexCTTM);
105   static void    GetLTMIndex(const Int_t * const detind, Int_t *LTMIndex);
106   Bool_t  fLTMmatrix[kNLTM][kNLTMchannels];         //LTM matrix 
107   Bool_t  fLTMarray[kNCTTM];        //LTM array for UPpurposes
108   Bool_t  fCTTMmatrixFront[kNCTTM][kNCTTMchannels];//CTTM matrix for TOP FPGA 
109   Bool_t  fCTTMmatrixBack[kNCTTM][kNCTTMchannels]; //CTTM matrix for BOTTOM FPGA
110   Int_t   fHighMultTh;             //threshold for High Multiplicity trigger
111   Int_t   fppMBTh;                 //threshold for pp Minimum Bias trigger
112   Int_t   fMultiMuonTh;            //threshold for Multi Muon trigger 
113   Int_t   fUPTh;                   //threshold for Ultra-Per coll trigger 
114   Float_t fdeltaminpsi;            //min delta phi for J/psi decay (UP trigger)
115   Float_t fdeltamaxpsi;            //max delta phi for J/psi decay (UP trigger)
116   Float_t fdeltaminro;             //min delta phi for ro decay (UP trigger)
117   Float_t fdeltamaxro;             //max delta phi for ro decay (UP trigger)
118   Int_t   fstripWindow;            //strip window for triggering
119
120   Bool_t fSel1,fSel2,fSel3,fSel4; // ppMB, PbPbMB2, PbPbMB3, PbPbUP
121
122   UInt_t fPowerMask[kNCTTMchannels+1];  // mask for 24 TDC channels
123
124   Int_t fNCrateOn; // number of crate fired
125   Int_t fNMaxipadOn; // number of Maxipad fired
126   Int_t fNMaxipadOnAll; // number of Maxipad fired w/o TDC dead mask
127
128   // aggiungere larghezza finestra temporale e tempo0 in ns
129   Float_t fStartTimeHit;      // time window start after channel equalization (subtraction of the minimal time per channel default 0 ns)
130   Float_t fTimeWidthTrigger;  // time window width (default 25 ns)
131    
132   ClassDef(AliTOFTrigger,3)  // TOF Trigger Detector class
133 };
134 #endif
135