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