]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSTrigger.h
added slewing correction by data
[u/mrichter/AliRoot.git] / PHOS / AliPHOSTrigger.h
1 #ifndef ALIPHOSTrigger_H
2 #define ALIPHOSTrigger_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 //____________________________________________________________
9 //  Class for trigger analysis.
10 //
11 //  -- Author: Gustavo Conesa & Yves Schutz (IFIC, SUBATECH, CERN)
12 //  Digits are grouped in TRU's (Trigger Units). A TRU consist of 16x28 
13 //  crystals ordered fNTRUPhi x fNTRUZ matrix. The algorithm searches all possible 
14 //  2x2 and nxn (n multiple of 4) crystal combinations per each TRU, adding the 
15 //  digits amplitude and  finding the maximum. Iti is found is maximum is isolated.
16 //  Maxima are transformed in ADC time samples. Each time bin is compared to the trigger 
17 //  threshold until it is larger and then, triggers are set. Thresholds need to be fixed. 
18 //  Usage:
19 //
20 //  //Inside the event loop
21 //  AliEMCALTrigger *tr = new AliEMCALTrigger();//Init Trigger
22 //  tr->SetL0Threshold(100);
23 //  tr->SetL1JetLowPtThreshold(1000);
24 //  tr->SetL1JetMediumPtThreshold(10000);
25 //  tr->SetL1JetHighPtThreshold(20000);
26 //  ....
27 //  tr->Trigger(); //Execute Trigger
28 //  tr->Print(""); //Print data members after calculation.
29 //     
30 // --- ROOT system ---
31
32 class TClonesArray ;
33 #include "TMatrixD.h"
34
35 // --- AliRoot header files ---
36 #include "AliTriggerDetector.h"
37
38 class AliPHOSGeometry ;
39
40 class AliPHOSTrigger : public AliTriggerDetector {
41   
42  public: 
43   
44   AliPHOSTrigger() ; //  ctor
45   AliPHOSTrigger(const AliPHOSTrigger & trig) ; // cpy ctor
46   virtual ~AliPHOSTrigger();
47
48   virtual void    CreateInputs(); //Define trigger inputs for Central Trigger Processor
49   void            Print(const Option_t * opt ="") const ;  
50   virtual void    Trigger() {}                   //Make PHOS trigger
51   void            Trigger(TClonesArray *digits); //Make PHOS trigger
52
53   //Getters
54   Float_t  Get2x2MaxAmplitude()  const {return f2x2MaxAmp ; }
55   Float_t  GetnxnMaxAmplitude()  const {return fnxnMaxAmp ; }
56   Int_t    Get2x2CrystalPhi()    const {return f2x2CrystalPhi ; }
57   Int_t    GetnxnCrystalPhi()    const {return fnxnCrystalPhi ; }
58   Int_t    Get2x2CrystalEta()    const {return f2x2CrystalEta ; }
59   Int_t    GetnxnCrystalEta()    const {return fnxnCrystalEta ; }
60   Int_t    Get2x2SuperModule()   const {return f2x2SM ; }
61   Int_t    GetnxnSuperModule()   const {return fnxnSM ; }
62
63   Int_t *  GetADCValuesLowGainMax2x2Sum()  {return fADCValuesLow2x2; }
64   Int_t *  GetADCValuesHighGainMax2x2Sum() {return fADCValuesHigh2x2; }
65   Int_t *  GetADCValuesLowGainMaxnxnSum()  {return fADCValuesLownxn; }
66   Int_t *  GetADCValuesHighGainMaxnxnSum() {return fADCValuesHighnxn; }
67
68   void     GetCrystalPhiEtaIndexInModuleFromTRUIndex(Int_t itru, Int_t iphitru, Int_t ietatru,Int_t &ietaMod,Int_t &iphiMod) const ;
69
70   Float_t  GetL0Threshold()            const {return fL0Threshold ; } 
71   Float_t  GetL1JetLowPtThreshold()    const {return fL1JetLowPtThreshold ; }
72   Float_t  GetL1JetMediumPtThreshold() const {return fL1JetMediumPtThreshold ; }
73   Float_t  GetL1JetHighPtThreshold()   const {return fL1JetHighPtThreshold ; }
74
75   Int_t    GetNTRU()                   const {return fNTRU ; }
76   Int_t    GetNTRUZ()                  const {return fNTRUZ ; }
77   Int_t    GetNTRUPhi()                const {return fNTRUPhi ; }
78   
79   Int_t    GetPatchSize()              const {return fPatchSize ; }
80   Int_t    GetIsolPatchSize()          const {return fIsolPatchSize ; }
81
82   Float_t  Get2x2AmpOutOfPatch()       const {return  f2x2AmpOutOfPatch; }
83   Float_t  GetnxnAmpOutOfPatch()       const {return  fnxnAmpOutOfPatch; }
84   Float_t  Get2x2AmpOutOfPatchThres()  const {return  f2x2AmpOutOfPatchThres; }
85   Float_t  GetnxnAmpOutOfPatchThres()  const {return  fnxnAmpOutOfPatchThres; }
86
87   Bool_t   Is2x2Isol()                 const {return  fIs2x2Isol; }
88   Bool_t   IsnxnIsol()                 const {return  fIsnxnIsol; }
89
90   Bool_t   IsSimulation()              const {return fSimulation ; }
91   Bool_t   IsIsolatedInModule()        const {return fIsolateInModule ; }
92
93   //Setters
94   void     SetDigitsList(TClonesArray * digits)          
95    {fDigitsList  = digits ; }
96
97   void     SetNTRU(Int_t ntru)             {fNTRU     = ntru ; }
98   void     SetNTRUZ(Int_t ntru)            {fNTRUZ    = ntru ; }
99   void     SetNTRUPhi(Int_t ntru)          {fNTRUPhi  = ntru ; } 
100
101   void     SetL0Threshold(Int_t amp)         
102     {fL0Threshold          = amp ; }
103   void     SetL1JetLowPtThreshold(Int_t amp) 
104     {fL1JetLowPtThreshold  = amp ; } 
105   void     SetL1JetMediumPtThreshold(Int_t amp) 
106     {fL1JetMediumPtThreshold = amp; } 
107   void     SetL1JetHighPtThreshold(Int_t amp)
108     {fL1JetHighPtThreshold = amp ; }
109
110   void SetPatchSize(Int_t ps)               { fPatchSize = ps ; }
111   void SetIsolPatchSize(Int_t ps)           { fIsolPatchSize = ps ; }
112   void Set2x2AmpOutOfPatchThres(Float_t th) { f2x2AmpOutOfPatchThres = th; }
113   void SetnxnAmpOutOfPatchThres(Float_t th) { fnxnAmpOutOfPatchThres = th; }
114   void SetSimulation(Bool_t sim )           { fSimulation = sim ; }
115   void SetIsolateInModule(Bool_t isol )     { fIsolateInModule = isol ; }
116
117  private:
118
119   AliPHOSTrigger & operator = (const AliPHOSTrigger & trig) ;//cpy assignment
120
121   void FillTRU(const TClonesArray * digits, const AliPHOSGeometry * geom) const ;
122
123   Bool_t IsPatchIsolated(Int_t iPatchType, const Int_t imod, const Int_t mtru, const Float_t maxamp, const Int_t maxphi, const Int_t maxeta) ;
124
125   void MakeSlidingCell(Int_t mod, TMatrixD &ampmax2, TMatrixD &ampmaxn) ;
126
127   void SetTriggers(Int_t iMod, const TMatrixD &ampmax2,const TMatrixD &ampmaxn) ;
128
129   void DoIt() ; 
130  
131  private: 
132
133   Float_t f2x2MaxAmp ;     //! Maximum 2x2 added amplitude (not overlapped) 
134   Int_t   f2x2CrystalPhi ; //! upper right cell, row(phi)   
135   Int_t   f2x2CrystalEta ; //! and column(eta) 
136   Int_t   f2x2SM ;         //! Module where maximum is found
137   Float_t fnxnMaxAmp ;     //! Maximum nxn added amplitude (overlapped)
138   Int_t   fnxnCrystalPhi ; //! upper right cell, row(phi)   
139   Int_t   fnxnCrystalEta ; //! and column(eta)
140   Int_t   fnxnSM ;         //! Module where maximum is found
141
142   Int_t*   fADCValuesHighnxn ; //! Sampled ADC high gain values for the nxn crystals amplitude sum
143   Int_t*   fADCValuesLownxn  ; //! " low gain  " 
144   Int_t*   fADCValuesHigh2x2 ; //! " high gain " 2x2 "
145   Int_t*   fADCValuesLow2x2  ; //! " low gaing " "
146
147   TClonesArray* fDigitsList ;  //  Array of digits 
148   TClonesArray* fAmptrus    ;  //! Array of matrices with amplitudes per TRU
149   TClonesArray* fAmpmods    ;  //! Array of matrices with amplitudes per module
150   TClonesArray* fTimeRtrus  ;  //! Array of matrices with time
151   
152  
153   Float_t fL0Threshold ;             //! L0 trigger energy threshold
154   Float_t fL1JetLowPtThreshold ;     //! L1 Low  pT trigger threshold
155   Float_t fL1JetMediumPtThreshold ;  //! L1 Medium  pT trigger threshold
156   Float_t fL1JetHighPtThreshold ;    //! L1 High pT trigger threshold
157
158   Int_t   fNTRU ;                //! Number of TRUs per module
159   Int_t   fNTRUZ ;               //! Number of crystal rows per Z in one TRU
160   Int_t   fNTRUPhi ;             //! Number of crystal rows per Phi in one TRU
161   Int_t   fNCrystalsPhi;         //! Number of rows in a TRU
162   Int_t   fNCrystalsZ;           //! Number of columns in a TRU
163   
164   Int_t fPatchSize;              //! Trigger patch factor, to be multiplied to 2x2 cells
165                                  //  0 means 2x2, 1 means 4x4, 2 means 6x6 ...
166   Int_t fIsolPatchSize ;         //  Isolation patch size, number of rows or columns to add to 
167                                  //  the 2x2 or nxn maximum amplitude patch. 
168                                  //  1 means a patch around max amplitude of 2x2 of 4x4 and around         
169                                  //  max ampl patch of 4x4 of 8x8 
170     
171   Float_t f2x2AmpOutOfPatch;      // Amplitude in isolation cone minus maximum amplitude of the reference patch
172   Float_t fnxnAmpOutOfPatch; 
173   Float_t f2x2AmpOutOfPatchThres; // Threshold to select a trigger as isolated on f2x2AmpOutOfPatch value
174   Float_t fnxnAmpOutOfPatchThres; 
175   Float_t fIs2x2Isol;             //Patch is isolated if f2x2AmpOutOfPatchThres threshold is passed
176   Float_t fIsnxnIsol ; 
177   
178   Bool_t  fSimulation ;           //! Flag to do the trigger during simulation or reconstruction
179   Bool_t  fIsolateInModule;       //! Flag to isolate trigger patch in Module or in TRU acceptance
180
181   ClassDef(AliPHOSTrigger,5)
182 } ;
183
184
185 #endif //ALIPHOSTrigger_H