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