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