]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALTrigger.h
c7b1d71eb1be11f4c21b9a70f3a12248407d5c2b
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALTrigger.h
1 #ifndef ALIEMCALTrigger_H
2 #define ALIEMCALTrigger_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 //  -- Author: Gustavo Conesa & Yves Schutz (IFIC, SUBATECH, CERN)
13 //  Digits are grouped in TRU's (Trigger Units). A TRU consist of 384 cells 
14 //  ordered fNTRUPhi x fNTRUEta matrix. The algorithm searches all possible 
15 //  2x2 and nxn (n multiple of 4) crystal combinations per each TRU, adding the 
16 //  digits amplitude and finding the maximum.  It is found is maximum is isolated. 
17 //  Maxima are transformed in adc time samples. Each time bin is compared to the 
18 //  trigger threshold until it is larger and then, triggers are set. 
19 //  Thresholds need to be fixed. 
20 //  Last 2 modules are half size in Phi, I considered that the number 
21 //  of TRU is maintained for the last modules but final decision has not 
22 //  been taken. If different, then this must to be changed. 
23 //  Usage:
24 //
25 //  //Inside the event loop
26 //  AliEMCALTrigger *tr = new AliEMCALTrigger();//Init Trigger
27 //  tr->SetL0Threshold(100);
28 //  tr->SetL1JetLowPtThreshold(1000);
29 //  tr->SetL1JetMediumPtThreshold(10000);
30 //  tr->SetL1JetHighPtThreshold(20000);
31 //  ....
32 //  tr->Trigger(); //Execute Trigger
33 //  tr->Print("");  //Print data members after calculation.
34 //
35 //*-- Author: Gustavo Conesa & Yves Schutz (IFIC, SUBATECH, CERN)
36      
37 // --- ROOT system ---
38
39 class TClonesArray ;
40 #include "TMatrixD.h"
41
42 // --- AliRoot header files ---
43 #include "AliTriggerDetector.h"
44
45 class AliEMCALGeometry ;
46
47 class AliEMCALTrigger : public AliTriggerDetector {
48   
49  public:   
50
51   AliEMCALTrigger() ; //  ctor
52   AliEMCALTrigger(const AliEMCALTrigger & trig) ; // cpy ctor
53   virtual ~AliEMCALTrigger() {}; //virtual dtor
54
55
56   virtual void    CreateInputs(); //Define trigger inputs for Central Trigger Processor
57   void            Print(const Option_t * opt ="") const ;  
58   virtual void    Trigger();  //Make EMCAL trigger
59
60   //assignment operator for coding convention
61   const AliEMCALTrigger & operator = (const AliEMCALTrigger & ) {return *this;}
62
63   //Getters
64   Float_t  Get2x2MaxAmplitude()  const { return f2x2MaxAmp ; }
65   Float_t  GetnxnMaxAmplitude()  const { return fnxnMaxAmp ; }
66   Int_t    Get2x2CellPhi()       const { return f2x2CellPhi ; }
67   Int_t    GetnxnCellPhi()       const { return fnxnCellPhi ; }
68   Int_t    Get2x2CellEta()       const { return f2x2CellEta ; }
69   Int_t    GetnxnCellEta()       const { return fnxnCellEta ; }
70   Int_t    Get2x2SuperModule()   const { return f2x2SM ; }
71   Int_t    GetnxnSuperModule()   const { return fnxnSM ; }
72
73   Int_t *  GetADCValuesLowGainMax2x2Sum()  { return fADCValuesLow2x2; }
74   Int_t *  GetADCValuesHighGainMax2x2Sum() { return fADCValuesHigh2x2; }
75   Int_t *  GetADCValuesLowGainMaxnxnSum()  { return fADCValuesLownxn; }
76   Int_t *  GetADCValuesHighGainMaxnxnSum() { return fADCValuesHighnxn; }
77
78   Float_t  GetL0Threshold() const            { return fL0Threshold ; } 
79   Float_t  GetL1JetLowPtThreshold()    const { return fL1JetLowPtThreshold ; }
80   Float_t  GetL1JetMediumPtThreshold() const { return fL1JetMediumPtThreshold ; }
81   Float_t  GetL1JetHighPtThreshold()   const { return fL1JetHighPtThreshold ; }
82
83   Int_t    GetPatchSize()              const { return fPatchSize ; }
84   Int_t    GetIsolPatchSize()          const { return fIsolPatchSize ; }
85
86   Float_t  Get2x2AmpOutOfPatch()       const { return  f2x2AmpOutOfPatch ; }
87   Float_t  GetnxnAmpOutOfPatch()       const { return  fnxnAmpOutOfPatch ; }
88   Float_t  Get2x2AmpOutOfPatchThres()  const { return  f2x2AmpOutOfPatchThres ; }
89   Float_t  GetnxnAmpOutOfPatchThres()  const { return  fnxnAmpOutOfPatchThres ; } 
90
91   Bool_t   Is2x2Isol()                 const { return  fIs2x2Isol ; }
92   Bool_t   IsnxnIsol()                 const { return  fIsnxnIsol ; }
93
94   Bool_t   IsSimulation()              const { return fSimulation ; }
95   Bool_t   IsIsolatedInSuperModule()   const { return fIsolateInSuperModule ; }
96
97   //Setters
98   void     SetDigitsList(TClonesArray * digits)          
99    {fDigitsList  = digits ; }
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 SetIsolateInSuperModule(Bool_t isol )          {fIsolateInSuperModule = isol ; }
116
117  private:
118
119   Bool_t IsPatchIsolated(Int_t iPatchType, const TClonesArray * ampmods, const Int_t imod, const Int_t mtru, const Float_t maxamp, const Int_t maxphi, const Int_t maxeta) ;
120   
121   void MakeSlidingCell(const TClonesArray * amptrus, const TClonesArray * timeRtrus,const Int_t supermod, TMatrixD *ampmax2, TMatrixD *ampmaxn) ; 
122   
123   void SetTriggers(const TClonesArray * amptrus,const Int_t iSM, const TMatrixD *ampmax2, const TMatrixD *ampmaxn, const AliEMCALGeometry * geom) ;
124   
125
126  private: 
127
128   Float_t f2x2MaxAmp ;         //! Maximum 2x2 added amplitude (not overlapped) 
129   Int_t   f2x2CellPhi ;        //! upper right cell, row(phi)   
130   Int_t   f2x2CellEta ;        //! and column(eta)  
131   Int_t   f2x2SM ;             //! Super Module where maximum is found
132   Float_t fnxnMaxAmp ;         //! Maximum nxn added amplitude (overlapped)
133   Int_t   fnxnCellPhi ;        //! upper right cell, row(phi)   
134   Int_t   fnxnCellEta ;        //! and column(eta)
135   Int_t   fnxnSM ;             //! Super 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 energy threshold
146   Float_t fL1JetMediumPtThreshold ; //! L1 Medium pT trigger energy threshold
147   Float_t fL1JetHighPtThreshold ;   //! L1 High pT trigger energy threshold
148
149   Int_t   fNTRU;             //! Number of TRU per SuperModule (3)
150   Int_t   fNTRUEta ;         //! Number of crystal rows per Eta in one TRU (3)
151   Int_t   fNTRUPhi ;         //! Number of crystal rows per Phi in one TRU (1)
152   Int_t   fNCellsPhi;        //! Number of rows in a TRU (24)
153   Int_t   fNCellsEta;        //! Number of columns in a TRU (16)
154
155   Int_t fPatchSize;          //! Trigger patch factor, to be multiplied to 2x2 cells
156                              //  0 means 2x2, 1 means 4x4, 2 means 6x6 ...
157   Int_t fIsolPatchSize ;     //  Isolation patch size, number of rows or columns to add to 
158                              //  the 2x2 or nxn maximum amplitude patch. 
159                              //  1 means a patch around max amplitude of 2x2 of 4x4 and around         
160                              //  max ampl patch of 4x4 of 8x8 
161     
162   Float_t f2x2AmpOutOfPatch;      //  Amplitude in isolation cone minus maximum amplitude of the reference patch
163   Float_t fnxnAmpOutOfPatch; 
164   Float_t f2x2AmpOutOfPatchThres; //  Threshold to select a trigger as isolated on f2x2AmpOutOfPatch value
165   Float_t fnxnAmpOutOfPatchThres; 
166   Float_t fIs2x2Isol;             //  Patch is isolated if f2x2AmpOutOfPatchThres threshold is passed
167   Float_t fIsnxnIsol ; 
168
169   Bool_t  fSimulation ;           //! Flag to do the trigger during simulation or reconstruction
170   Bool_t  fIsolateInSuperModule;  //! Flag to isolate trigger patch in SuperModule or in TRU acceptance
171
172   ClassDef(AliEMCALTrigger,1)
173 } ;
174     
175     
176 #endif //ALIEMCALTrigger_H
177