]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSTrigger.h
Included new data member to change patch size in calorimeters trigger (Gustavo)
[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 //  Digits are grouped in TRU's (Trigger Units). A TRU consist of 16x28 
12 //  crystals ordered fNTRUPhi x fNTRUZ. The algorithm searches all possible 
13 //  2x2 and nxn  (n multiple of 4) crystal combinations per each TRU, adding the 
14 //  digits amplitude and finding the maximum. Maxima are transformed in ADC 
15 //  time samples.  Each time bin is compared to the trigger threshold until it is larger 
16 //  and then, triggers are set. Thresholds need to be fixed. 
17 //  Usage:
18 //
19 //  //Inside the event loop
20 //  AliPHOSTrigger *tr = new AliPHOSTrigger();//Init Trigger
21 //  tr->SetL0Threshold(100);
22 //  tr->SetL1JetLowPtThreshold(1000);
23 //  tr->SetL1JetHighPtThreshold(20000);
24 //  tr->Trigger(); //Execute Trigger
25 //  tr->Print("");  //Print results
26 //
27 //*-- Author: Gustavo Conesa & Yves Schutz (IFIC, SUBATECH, CERN)
28      
29 // --- ROOT system ---
30
31 class TClonesArray ;
32 #include "TMatrixD.h"
33
34 // --- AliRoot header files ---
35 #include "AliTriggerDetector.h"
36
37 class AliPHOSGeometry ;
38
39 class AliPHOSTrigger : public AliTriggerDetector {
40   
41  public: 
42   
43   AliPHOSTrigger() ; //  ctor
44   AliPHOSTrigger(const AliPHOSTrigger & trig) ; // cpy ctor
45   virtual ~AliPHOSTrigger() {}; //virtual dtor
46
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
52   //Getters
53   Float_t  Get2x2MaxAmplitude()  const {return f2x2MaxAmp ; }
54   Float_t  GetnxnMaxAmplitude()  const {return fnxnMaxAmp ; }
55   Int_t    Get2x2CrystalPhi()    const {return f2x2CrystalPhi ; }
56   Int_t    GetnxnCrystalPhi()    const {return fnxnCrystalPhi ; }
57   Int_t    Get2x2CrystalEta()    const {return f2x2CrystalEta ; }
58   Int_t    GetnxnCrystalEta()    const {return fnxnCrystalEta ; }
59   Int_t    Get2x2SuperModule()   const {return f2x2SM ; }
60   Int_t    GetnxnSuperModule()   const {return fnxnSM ; }
61
62   Int_t *  GetADCValuesLowGainMax2x2Sum()  {return fADCValuesLow2x2; }
63   Int_t *  GetADCValuesHighGainMax2x2Sum() {return fADCValuesHigh2x2; }
64   Int_t *  GetADCValuesLowGainMaxnxnSum()  {return fADCValuesLownxn; }
65   Int_t *  GetADCValuesHighGainMaxnxnSum() {return fADCValuesHighnxn; }
66
67   void GetCrystalPhiEtaIndexInModuleFromTRUIndex(Int_t itru, Int_t iphitru, Int_t ietatru,Int_t &ietaMod,Int_t &iphiMod, const AliPHOSGeometry *geom) const ;
68
69   Float_t  GetL0Threshold()          const {return fL0Threshold ; } 
70   Float_t  GetL1JetLowPtThreshold()  const {return fL1JetLowPtThreshold ; }
71   Float_t  GetL1JetHighPtThreshold() const {return fL1JetHighPtThreshold ; }
72
73   Int_t    GetNTRU()    const  {return fNTRU ; }
74   Int_t    GetNTRUZ()   const  {return fNTRUZ ; }
75   Int_t    GetNTRUPhi() const  {return fNTRUPhi ; }
76   
77   Float_t  GetPatchSize() const  {return fPatchSize ; }
78   Bool_t   IsSimulation() const {return fSimulation ; }
79
80   //Setters
81
82   void     SetDigitsList(TClonesArray * digits)          
83    {fDigitsList  = digits ; }
84
85
86   void     SetNTRU(Int_t ntru)             {fNTRU     = ntru ; }
87   void     SetNTRUZ(Int_t ntru)            {fNTRUZ    = ntru ; }
88   void     SetNTRUPhi(Int_t ntru)          {fNTRUPhi  = ntru ; } 
89
90   void     SetL0Threshold(Int_t amp)         
91     {fL0Threshold          = amp ; }
92   void     SetL1JetLowPtThreshold(Int_t amp) 
93     {fL1JetLowPtThreshold  = amp ; } 
94   void     SetL1JetHighPtThreshold(Int_t amp)
95     {fL1JetHighPtThreshold = amp ; }
96
97   void SetPatchSize(Int_t ps)                {fPatchSize = ps ; }
98   void SetSimulation(Bool_t sim )          {fSimulation = sim ; }
99
100  private:
101
102   AliPHOSTrigger & operator = (const AliPHOSTrigger & trig) ;//cpy assignment
103
104   void FillTRU(const TClonesArray * digits, const AliPHOSGeometry * geom, TClonesArray * amptru, TClonesArray * timeRtru) const ;
105
106   void MakeSlidingCell(const TClonesArray * amptrus, const TClonesArray * timeRtrus, Int_t mod, TMatrixD *ampmax2, TMatrixD *ampmaxn, const AliPHOSGeometry *geom) ;
107
108   void SetTriggers(Int_t iMod, const TMatrixD *ampmax2,const TMatrixD *ampmaxn, const AliPHOSGeometry *geom) ;
109
110  private: 
111
112   Float_t f2x2MaxAmp ;     //! Maximum 2x2 added amplitude (not overlapped) 
113   Int_t   f2x2CrystalPhi ; //! upper right cell, row(phi)   
114   Int_t   f2x2CrystalEta ; //! and column(eta) 
115   Int_t   f2x2SM ;         //! Module where maximum is found
116   Float_t fnxnMaxAmp ;     //! Maximum nxn added amplitude (overlapped)
117   Int_t   fnxnCrystalPhi ; //! upper right cell, row(phi)   
118   Int_t   fnxnCrystalEta ; //! and column(eta)
119   Int_t   fnxnSM ;         //! Module where maximum is found
120
121   Int_t*   fADCValuesHighnxn ; //! Sampled ADC high gain values for the nxn crystals amplitude sum
122   Int_t*   fADCValuesLownxn  ; //! " low gain  " 
123   Int_t*   fADCValuesHigh2x2 ; //! " high gain " 2x2 "
124   Int_t*   fADCValuesLow2x2  ; //! " low gaing " "
125
126   TClonesArray* fDigitsList ;  //Array of digits 
127  
128   Float_t fL0Threshold ;          //! L0 trigger energy threshold
129   Float_t fL1JetLowPtThreshold ;  //! L1 Low  pT trigger threshold
130   Float_t fL1JetHighPtThreshold ; //! L1 High pT trigger threshold
131
132   Int_t   fNTRU ;                 //! Number of TRUs per module
133   Int_t   fNTRUZ ;                //! Number of crystal rows per Z in one TRU
134   Int_t   fNTRUPhi ;              //! Number of crystal rows per Phi in one TRU
135   Int_t fPatchSize;               //! Trigger patch factor, to be multiplied to 2x2 cells
136                                           // 0 means 2x2, 1 means nxn, 2 means 8x8 ...
137   Bool_t  fSimulation ;           //! Flag to do the trigger during simulation or reconstruction
138   ClassDef(AliPHOSTrigger,4)
139 } ;
140
141
142 #endif //ALIPHOSTrigger_H