]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALTrigger.h
Add protection in method AliEMCALGeometry::GetAbsCellIdFromCellIndexes in case eta...
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALTrigger.h
CommitLineData
581ee158 1#ifndef ALIEMCALTRIGGER_H
2#define ALIEMCALTRIGGER_H
59264fa6 3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
f0377b23 5
0964c2e9 6/* $Id$ */
0964c2e9 7
f0377b23 8//___________________________________________________________
9// Class for trigger analysis.
0964c2e9 10//
11// -- Author: Gustavo Conesa & Yves Schutz (IFIC, SUBATECH, CERN)
59264fa6 12// Digits are grouped in TRU's (Trigger Units). A TRU consist of 384 cells
0964c2e9 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.
59264fa6 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.
f0377b23 22// Usage:
23//
24// //Inside the event loop
25// AliEMCALTrigger *tr = new AliEMCALTrigger();//Init Trigger
59264fa6 26// tr->SetL0Threshold(100);
85c25c2e 27// tr->SetL1GammaLowPtThreshold(1000);
28// tr->SetL1GammaMediumPtThreshold(10000);
29// tr->SetL1GammaHighPtThreshold(20000);
0964c2e9 30// ....
85c25c2e 31// tr->Trigger(); //Execute Trigger
0964c2e9 32// tr->Print(""); //Print data members after calculation.
f0377b23 33//
34//*-- Author: Gustavo Conesa & Yves Schutz (IFIC, SUBATECH, CERN)
85c25c2e 35//* -- Author: Aleksei Pavlinov, WSU, Detroit, USA
36// Nov 2, 2007
37// One TRU card receives 96 analogue sums from 12 FEE cards.
38// One sum is correcponding output from on module.
39// This patch has size 12x8 modules (24x16 modules).
40// Each SM has 3 TRU cards.
41
f0377b23 42// --- ROOT system ---
43
44class TClonesArray ;
85c25c2e 45class TTree;
46
47#include <TMatrixD.h>
48#include <TArrayF.h>
f0377b23 49
50// --- AliRoot header files ---
51#include "AliTriggerDetector.h"
52
85c25c2e 53class TBrowser;
f0377b23 54class AliEMCALGeometry ;
85c25c2e 55class TH2F;
f0377b23 56
57class AliEMCALTrigger : public AliTriggerDetector {
58
59 public:
59264fa6 60
f0377b23 61 AliEMCALTrigger() ; // ctor
c35bbfd4 62 virtual ~AliEMCALTrigger(); //virtual dtor
0964c2e9 63
64
59264fa6 65 virtual void CreateInputs(); //Define trigger inputs for Central Trigger Processor
66 void Print(const Option_t * opt ="") const ;
f0377b23 67 virtual void Trigger(); //Make EMCAL trigger
14ce0a6e 68
59264fa6 69 //Getters
0964c2e9 70 Float_t Get2x2MaxAmplitude() const { return f2x2MaxAmp ; }
71 Float_t GetnxnMaxAmplitude() const { return fnxnMaxAmp ; }
85c25c2e 72 Int_t Get2x2ModulePhi() const { return f2x2ModulePhi ; }
73 Int_t GetnxnModulePhi() const { return fnxnModulePhi ; }
74 Int_t Get2x2ModuleEta() const { return f2x2ModuleEta ; }
75 Int_t GetnxnModuleEta() const { return fnxnModuleEta ; }
0964c2e9 76 Int_t Get2x2SuperModule() const { return f2x2SM ; }
77 Int_t GetnxnSuperModule() const { return fnxnSM ; }
78
581ee158 79 Int_t * GetADCValuesLowGainMax2x2Sum() const { return fADCValuesLow2x2; }
80 Int_t * GetADCValuesHighGainMax2x2Sum() const { return fADCValuesHigh2x2; }
81 Int_t * GetADCValuesLowGainMaxnxnSum() const { return fADCValuesLownxn; }
82 Int_t * GetADCValuesHighGainMaxnxnSum() const { return fADCValuesHighnxn; }
0964c2e9 83
581ee158 84 Float_t GetL0Threshold() const { return fL0Threshold ; }
85c25c2e 85 Float_t GetL1GammaLowPtThreshold() const { return fL1GammaLowPtThreshold ; }
86 Float_t GetL1GammaMediumPtThreshold() const { return fL1GammaMediumPtThreshold ; }
87 Float_t GetL1GammaHighPtThreshold() const { return fL1GammaHighPtThreshold ; }
0964c2e9 88
89 Int_t GetPatchSize() const { return fPatchSize ; }
90 Int_t GetIsolPatchSize() const { return fIsolPatchSize ; }
91
92 Float_t Get2x2AmpOutOfPatch() const { return f2x2AmpOutOfPatch ; }
93 Float_t GetnxnAmpOutOfPatch() const { return fnxnAmpOutOfPatch ; }
94 Float_t Get2x2AmpOutOfPatchThres() const { return f2x2AmpOutOfPatchThres ; }
95 Float_t GetnxnAmpOutOfPatchThres() const { return fnxnAmpOutOfPatchThres ; }
96
97 Bool_t Is2x2Isol() const { return fIs2x2Isol ; }
98 Bool_t IsnxnIsol() const { return fIsnxnIsol ; }
99
85c25c2e 100 Bool_t IsSimulation() const { return fSimulation ; }
101 Bool_t IsIsolatedInSuperModule() const { return fIsolateInSuperModule ; }
102 Bool_t GetTimeKey() const { return fTimeKey;}
103 TH2F* GetJetMatrixE() const { return fJetMatrixE;}
104 Double_t GetEmcalSumAmp() const;
105
581ee158 106 Int_t GetNJetThreshold() const {return fNJetThreshold;}
107 Double_t* GetL1JetThresholds() const {return fL1JetThreshold;}
108 TMatrixD GetAmpJetMax() const {return fAmpJetMax;}
85c25c2e 109
110 void PrintJetMatrix() const; // *MENU*
111 void PrintAmpTruMatrix(Int_t ind) const; // *MENU*
112 void PrintAmpSmMatrix(Int_t ind) const; // *MENU*
113 void PrintMatrix(const TMatrixD &mat) const; // *MENU*
114 Bool_t CheckConsistentOfMatrixes(const Int_t pri=0); // *MENU*
115
0964c2e9 116
59264fa6 117 //Setters
118 void SetDigitsList(TClonesArray * digits)
119 {fDigitsList = digits ; }
120
121 void SetL0Threshold(Int_t amp)
122 {fL0Threshold = amp; }
85c25c2e 123 void SetL1GammaLowPtThreshold(Int_t amp)
124 {fL1GammaLowPtThreshold = amp; }
125 void SetL1GammaMediumPtThreshold(Int_t amp)
126 {fL1GammaMediumPtThreshold = amp; }
127 void SetL1GammaHighPtThreshold(Int_t amp)
128 {fL1GammaHighPtThreshold = amp; }
59264fa6 129
0b2ec9f7 130 void SetPatchSize(Int_t ps) {fPatchSize = ps ; }
0964c2e9 131 void SetIsolPatchSize(Int_t ps) {fIsolPatchSize = ps ; }
132 void Set2x2AmpOutOfPatchThres(Float_t th) { f2x2AmpOutOfPatchThres = th; }
133 void SetnxnAmpOutOfPatchThres(Float_t th) { fnxnAmpOutOfPatchThres = th; }
59264fa6 134 void SetSimulation(Bool_t sim ) {fSimulation = sim ; }
0964c2e9 135 void SetIsolateInSuperModule(Bool_t isol ) {fIsolateInSuperModule = isol ; }
85c25c2e 136 void SetTimeKey(Bool_t timeKey) {fTimeKey = timeKey;}
137 void SetJetPatchSize(const Int_t patchSize) {fNJetPatchPhi = fNJetPatchEta = patchSize;}
138 void SetJetParameters(const Int_t patchSize, Double_t* jetThreshold)
139 { // unused now
140 fNJetPatchPhi = fNJetPatchEta = patchSize;
141 fL1JetThreshold = jetThreshold;
142 }
143 void SetVZER0Multiplicity(Double_t mult) {fVZER0Mult = mult;}
144
145 //
146 virtual void Browse(TBrowser* b);
147 virtual Bool_t IsFolder() const {return kTRUE;}
148
149 // Name of Jet trigger(s)
7e42cd80 150 Char_t* GetNameOfJetTrigger(const Int_t i) {return Form("%s_Th_%2.2i",fgNameOfJetTriggers.Data(),i);}
85c25c2e 151 static TString GetNameOfJetTriggers() {return fgNameOfJetTriggers;}
581ee158 152 static TString fgNameOfJetTriggers; //Name of jet triggers
85c25c2e 153 // Estimation on EMCal energy from VZERO multiplicity
154 // 0.0153 is coefficient from adc to energy
155 // Dec 4, 2007
156 // 1 p0 2.52248e-02 3.24364e-05 9.29319e-01 -2.34036e-06
157 static Double_t GetMeanEmcalEnergy(const Int_t mult) {return 2.52248e-02*Double_t(mult);}
158 static Double_t GetMeanEmcalPatchEnergy(const Int_t mult, Int_t patchSize)
159 {return GetMeanEmcalEnergy(mult)*Double_t(patchSize)*Double_t(patchSize)/208.;}
f0377b23 160 private:
0964c2e9 161
9946f2fe 162 void FillTRU(const TClonesArray * digits, TClonesArray * ampmatrix, TClonesArray * ampmatrixsmod, TClonesArray * timeRmatrix);
c35bbfd4 163
0964c2e9 164 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) ;
165
85c25c2e 166 void MakeSlidingTowers(const TClonesArray * amptrus, const TClonesArray * timeRtrus,
167 const Int_t supermod, TMatrixD &ampmax2, TMatrixD &ampmaxn) ;
0964c2e9 168
9946f2fe 169 void SetTriggers(const TClonesArray * amptrus,const Int_t iSM, const TMatrixD &ampmax2, const TMatrixD &ampmaxn) ;
581ee158 170 void GetTriggerInfo(TArrayF &triggerPosition, TArrayF &triggerAmplitudes) const;
85c25c2e 171 // Jet staff
581ee158 172 void FillJetMatrixFromSMs(TClonesArray *ampmatrixsmod, TMatrixD * const jetMat, AliEMCALGeometry * const g);
85c25c2e 173 // no timing information here
174 void MakeSlidingPatch(const TMatrixD &jm, const Int_t nPatchSize, TMatrixD &ampJetMax);
f0377b23 175
f0377b23 176 private:
85c25c2e 177 AliEMCALGeometry *fGeom; //!
f0377b23 178
0964c2e9 179 Float_t f2x2MaxAmp ; //! Maximum 2x2 added amplitude (not overlapped)
85c25c2e 180 Int_t f2x2ModulePhi ; //! upper right cell, row(phi)
181 Int_t f2x2ModuleEta ; //! and column(eta)
0964c2e9 182 Int_t f2x2SM ; //! Super Module where maximum is found
183 Float_t fnxnMaxAmp ; //! Maximum nxn added amplitude (overlapped)
85c25c2e 184 Int_t fnxnModulePhi ; //! upper right cell, row(phi)
185 Int_t fnxnModuleEta ; //! and column(eta)
0964c2e9 186 Int_t fnxnSM ; //! Super Module where maximum is found
f0377b23 187
0b2ec9f7 188 Int_t* fADCValuesHighnxn ; //! Sampled ADC high gain values for the nxn crystals amplitude sum
189 Int_t* fADCValuesLownxn ; //! " low gain "
59264fa6 190 Int_t* fADCValuesHigh2x2 ; //! " high gain " 2x2 "
191 Int_t* fADCValuesLow2x2 ; //! " low gaing " "
f0377b23 192
85c25c2e 193 TClonesArray* fDigitsList; //! Array of digits
59264fa6 194
85c25c2e 195 Float_t fL0Threshold ; // L0 trigger energy threshold
196 Float_t fL1GammaLowPtThreshold ; // L1 gamma Low pT trigger energy threshold
197 Float_t fL1GammaMediumPtThreshold ; // L1 gamma Medium pT trigger energy threshold
198 Float_t fL1GammaHighPtThreshold ; // L1 gamma High pT trigger energy threshold
59264fa6 199
85c25c2e 200 Int_t fPatchSize; // Trigger patch factor, to be multiplied to 2x2 cells
201 // 0 means 2x2, 1 means 4x4 (max size 4x4 now)
0964c2e9 202 Int_t fIsolPatchSize ; // Isolation patch size, number of rows or columns to add to
203 // the 2x2 or nxn maximum amplitude patch.
204 // 1 means a patch around max amplitude of 2x2 of 4x4 and around
205 // max ampl patch of 4x4 of 8x8
206
581ee158 207 Float_t f2x2AmpOutOfPatch; // Amplitude in isolation cone minus maximum amplitude of the reference 2x2 patch
208 Float_t fnxnAmpOutOfPatch; // Amplitude in isolation cone minus maximum amplitude of the reference nxn patch
0964c2e9 209 Float_t f2x2AmpOutOfPatchThres; // Threshold to select a trigger as isolated on f2x2AmpOutOfPatch value
581ee158 210 Float_t fnxnAmpOutOfPatchThres; // Threshold to select a trigger as isolated on fnxnAmpOutOfPatch value
211 Float_t fIs2x2Isol; // 2x2 Patch is isolated if f2x2AmpOutOfPatchThres threshold is passed
212 Float_t fIsnxnIsol ; // nxn Patch is isolated if fnxnAmpOutOfPatchThres threshold is passed
213
0964c2e9 214
85c25c2e 215 Bool_t fSimulation ; // Flag to do the trigger during simulation or reconstruction
216 Bool_t fIsolateInSuperModule; // Flag to isolate trigger patch in SuperModule or in TRU acceptance
217 Bool_t fTimeKey; // Flag to take into account the digits time information
218 //
219 TClonesArray *fAmpTrus; //! Array of amplides of TRU matrixes
220 TClonesArray *fTimeRtrus; //! Array of recent times (unused now)
221 TClonesArray *fAmpSMods; //! Array of amplides of SM matrixes
222 // Information for EMCAL ESD
581ee158 223 TArrayF fTriggerPosition; // Triggered patch position
224 TArrayF fTriggerAmplitudes; // Triggered patch amplitude
85c25c2e 225 // Jet staf
226 Int_t fNJetPatchPhi; // size of jet pathch in phi(row) direction (nJetPatchPhi*4 module)
227 Int_t fNJetPatchEta; // size of jet pathch in eta(column) direction (nJetPatchEta*4 module)
228 Int_t fNJetThreshold; // number of jet threshold
229 Double_t *fL1JetThreshold; //[fNJetThreshold] array of L1 jet energy threshold (this is not Et)
230 Double_t fJetMaxAmp; // Max amp from patch (fNJetPatchPhi*fNJetPatchEta)
231 TMatrixD* fAmpJetMatrix; //-> Jet trigger matrix : (nphi(17), neta(12))
232 TH2F* fJetMatrixE; //-> temporary solution for getting coordinate informatin
233 TMatrixD fAmpJetMax; // 6 elements
234 // VZER0
235 Double_t fVZER0Mult; // multiplicity (V0A+V0c)
236
0bd264d5 237 const AliEMCALTrigger & operator = (const AliEMCALTrigger & ) ;
238 AliEMCALTrigger(const AliEMCALTrigger & trig) ; // cpy ctor
239
85c25c2e 240 ClassDef(AliEMCALTrigger, 2)
59264fa6 241} ;
242
243
581ee158 244#endif //ALIEMCALTRIGGER_H
59264fa6 245