]>
Commit | Line | Data |
---|---|---|
1 | /************************************************************************** | |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | /* $Id$ */ | |
16 | ||
17 | ||
18 | //_________________________________________________________________________ | |
19 | // | |
20 | // Class for trigger analysis. | |
21 | // Digits are grouped in TRU's (16x28 crystals). The algorithm searches all | |
22 | // possible 4x4 crystal combinations and per each TRU, adding the digits | |
23 | // amplitude and finding the maximum. Maximums are compared to triggers threshold | |
24 | // and they are set. | |
25 | // FIRST ATTEMPT TO MAKE A TRIGGER CLASS. IT WILL CHANGE WHEN CENTRAL TRIGGER CLASS FIXES | |
26 | // THINGS | |
27 | // | |
28 | //*-- Author: Gustavo Conesa & Yves Schutz (IFIC, CERN) | |
29 | ////////////////////////////////////////////////////////////////////////////// | |
30 | ||
31 | ||
32 | // --- ROOT system --- | |
33 | #include "TMatrixD.h" | |
34 | ||
35 | // --- ALIROOT system --- | |
36 | #include "AliPHOSTrigger.h" | |
37 | #include "AliPHOSGeometry.h" | |
38 | #include "AliPHOSGetter.h" | |
39 | #include "AliTriggerInput.h" | |
40 | ||
41 | ||
42 | ClassImp(AliPHOSTrigger) | |
43 | ||
44 | //______________________________________________________________________ | |
45 | AliPHOSTrigger::AliPHOSTrigger() | |
46 | : AliTriggerDetector(), fL0Threshold(50), fL1LowThreshold(1200), | |
47 | fL1MediumThreshold(12000), fL1HighThreshold(30000) | |
48 | { | |
49 | //ctor | |
50 | ||
51 | SetName("PHOS"); | |
52 | CreateInputs(); | |
53 | ||
54 | Print("") ; | |
55 | } | |
56 | ||
57 | ||
58 | ||
59 | //____________________________________________________________________________ | |
60 | AliPHOSTrigger::AliPHOSTrigger(const AliPHOSTrigger & trig) | |
61 | : AliTriggerDetector(trig) | |
62 | { | |
63 | ||
64 | // cpy ctor | |
65 | ||
66 | fL0Threshold = trig.fL0Threshold ; | |
67 | fL1LowThreshold = trig.fL1LowThreshold ; | |
68 | fL1MediumThreshold = trig.fL1MediumThreshold ; | |
69 | fL1HighThreshold = trig.fL1HighThreshold ; | |
70 | ||
71 | } | |
72 | ||
73 | //---------------------------------------------------------------------- | |
74 | void AliPHOSTrigger::CreateInputs() | |
75 | { | |
76 | // inputs | |
77 | ||
78 | // Do not create inputs again!! | |
79 | if( fInputs.GetEntriesFast() > 0 ) return; | |
80 | ||
81 | fInputs.AddLast( new AliTriggerInput( "PHOS_MB_L0", "PHOS Minimum Bias L0", 0x01 ) ); | |
82 | ||
83 | fInputs.AddLast( new AliTriggerInput( "PHOS_HPt_L1", "PHOS High Pt L1", 0x02 ) ); | |
84 | fInputs.AddLast( new AliTriggerInput( "PHOS_MPt_L1", "PHOS Medium Pt L1", 0x04 ) ); | |
85 | fInputs.AddLast( new AliTriggerInput( "PHOS_LPt_L1", "PHOS Low Pt L1", 0x08 ) ); | |
86 | ||
87 | } | |
88 | ||
89 | //____________________________________________________________________________ | |
90 | TClonesArray * AliPHOSTrigger::FillTRU(const TClonesArray * digits){ | |
91 | ||
92 | //Orders digits ampitudes list in 8 TRUs (16x28 crystals) per module. | |
93 | //Each TRU is a TMatrixD, and they are kept in TClonesArrays. | |
94 | ||
95 | //Initilize variables | |
96 | ||
97 | const AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ; | |
98 | ||
99 | TClonesArray * matrix = new TClonesArray("TMatrixD",1000); | |
100 | for(Int_t k = 0; k < 40 ; k++){ | |
101 | TMatrixD * trus = new TMatrixD(16,28) ; | |
102 | for(Int_t i = 0; i < 16; i++) | |
103 | for(Int_t j = 0; j < 28; j++) | |
104 | (*trus)(i,j) = 0.0; | |
105 | new((*matrix)[k]) TMatrixD(*trus) ; | |
106 | } | |
107 | ||
108 | AliPHOSDigit * dig ; | |
109 | ||
110 | //Declare different variables | |
111 | Int_t relid[4] ; | |
112 | Float_t amp = 0; | |
113 | ||
114 | for(Int_t idig = 0 ; idig < digits->GetEntriesFast() ; idig++){ | |
115 | ||
116 | dig = static_cast<AliPHOSDigit *>(digits->At(idig)) ; | |
117 | amp = dig->GetAmp() ; //Energy of the digit (arbitrary units) | |
118 | geom->AbsToRelNumbering(dig->GetId(), relid) ;//Transform digit number into 4 numbers | |
119 | //relid[0] = module | |
120 | //relid[1] = EMC (0) or CPV (-1) | |
121 | //relid[2] = row <= 64 (fNPhi) | |
122 | //relid[3] = column <= 56 (fNZ) | |
123 | ||
124 | if(relid[1] == 0){ | |
125 | ||
126 | Int_t ntru = 1; | |
127 | Int_t row = 1; | |
128 | Int_t col = 1; | |
129 | //Check which TRU in the module. It is divided in a (4,2) matrix. | |
130 | //Fill the TRU matrix (16,28) | |
131 | if(relid[3] > 28) | |
132 | col = 2; | |
133 | ||
134 | if(relid[2] > 16 && relid[2] <= 32) | |
135 | row = 2; | |
136 | ||
137 | if(relid[2] > 32 && relid[2] <= 48) | |
138 | row = 3; | |
139 | ||
140 | if(relid[2] > 48) | |
141 | row = 4; | |
142 | ||
143 | ntru = col*row + (relid[0]-1)*8 - 1; | |
144 | TMatrixD * trus = dynamic_cast<TMatrixD *>(matrix->At(ntru)) ; | |
145 | ||
146 | Int_t nrow = (relid[2]-1) - (row-1) * 16 ; | |
147 | Int_t ncol = (relid[3]-1) - (col-1) * 28 ; | |
148 | ||
149 | (*trus)(nrow,ncol) = amp ; | |
150 | } | |
151 | } | |
152 | return matrix; | |
153 | } | |
154 | ||
155 | //____________________________________________________________________________ | |
156 | void AliPHOSTrigger::MakeSlidingCell(const TClonesArray * trus, const Int_t mod, | |
157 | Float_t *ampmax){ | |
158 | ||
159 | //Sums energy of all possible 4x4 crystals per each TRU. Fast signal | |
160 | //in the experiment is given by 2x2 crystals, for this reason we loop | |
161 | //inside the TRU crystals by 2. | |
162 | ||
163 | Float_t amp = 0 ; | |
164 | ||
165 | for(Int_t i = 0 ; i < 8 ; i++) | |
166 | ampmax[i] = 0 ; | |
167 | ||
168 | //Loop over all TRUS in a module | |
169 | for(Int_t itru = 0 + (mod - 1) * 8 ; itru < mod*8 ; itru++){ | |
170 | TMatrixD * tru = dynamic_cast<TMatrixD *>(trus->At(itru)) ; | |
171 | //Sliding 2x2 cell | |
172 | //ampmax[itru-(mod-1)*8]=0.0; | |
173 | for(Int_t irow = 0 ; irow < 16 ; irow += 2){ | |
174 | for(Int_t icol = 0 ; icol < 28 ; icol += 2){ | |
175 | amp = 0; | |
176 | if( (irow+4) < 16 && (icol+4) < 28){//Avoid exit the TRU | |
177 | for(Int_t i = irow; i < irow + 4 ; i++){ | |
178 | for(Int_t j = icol; j < icol + 4 ; j++){ | |
179 | amp += (*tru)(i,j) ; | |
180 | } | |
181 | } | |
182 | } | |
183 | if(amp > ampmax[itru-(mod-1)*8]) | |
184 | ampmax[itru-(mod-1)*8] = amp ; | |
185 | } | |
186 | } | |
187 | } | |
188 | } | |
189 | ||
190 | //____________________________________________________________________________ | |
191 | void AliPHOSTrigger::Trigger() | |
192 | { | |
193 | ||
194 | //Main Method to select triggers. | |
195 | ||
196 | //InitTriggers() ; //Initialize triggers to kFALSE | |
197 | ||
198 | AliPHOSGetter * gime = AliPHOSGetter::Instance() ; | |
199 | ||
200 | //Take the digits list and declare digits pointers | |
201 | TClonesArray * digits = gime->Digits() ; | |
202 | //Fill TRU Matrix | |
203 | TClonesArray * trus = FillTRU(digits); | |
204 | ||
205 | //Do Cell Sliding and select Trigger | |
206 | Float_t max [8] ; | |
207 | for(Int_t imod = 1 ; imod <= 5 ; imod++) { | |
208 | MakeSlidingCell(trus, imod, max); | |
209 | SetTriggers(max) ; | |
210 | } | |
211 | ||
212 | } | |
213 | ||
214 | //____________________________________________________________________________ | |
215 | void AliPHOSTrigger::Print(const Option_t * opt) const | |
216 | { | |
217 | ||
218 | //Prints main parameters | |
219 | ||
220 | if(! opt) | |
221 | return; | |
222 | AliTriggerInput* in = 0x0 ; | |
223 | ||
224 | AliInfo("PHOS trigger information:") ; | |
225 | printf( " Threshold for LO %d\n", fL0Threshold) ; | |
226 | in = (AliTriggerInput*)fInputs.FindObject( "PHOS_MB_L0" ); | |
227 | if(in->GetValue()) | |
228 | printf( " PHOS MB LO is set\n") ; | |
229 | ||
230 | printf( " Low Threshold for L1 %d\n", fL1LowThreshold) ; | |
231 | in = (AliTriggerInput*)fInputs.FindObject( "PHOS_LPt_L1" ); | |
232 | if(in->GetValue()) | |
233 | printf( " PHOS Low Pt L1 is set\n") ; | |
234 | ||
235 | printf( " Medium Threshold for L1 %d\n", fL1MediumThreshold) ; | |
236 | in = (AliTriggerInput*) fInputs.FindObject( "PHOS_MPt_L1" ); | |
237 | if(in->GetValue()) | |
238 | printf( " PHOS Medium Pt L1 is set\n") ; | |
239 | ||
240 | printf( " High Threshold for L1 %d\n", fL1HighThreshold) ; | |
241 | in = (AliTriggerInput*) fInputs.FindObject( "PHOS_HPt_L1" ); | |
242 | if(in->GetValue()) | |
243 | printf( " PHOS High Pt L1 is set\n") ; | |
244 | ||
245 | } | |
246 | ||
247 | //____________________________________________________________________________ | |
248 | void AliPHOSTrigger::SetTriggers(const Float_t * amp) | |
249 | { | |
250 | ||
251 | //Checks the maximum amplitude per each TRU and compares with the | |
252 | //different triggers thresholds | |
253 | ||
254 | Float_t max = 0; | |
255 | for(Int_t i = 0 ; i < 8 ; i++){ | |
256 | if(max < amp[i] ) | |
257 | max = amp[i] ; | |
258 | } | |
259 | if(max >= fL0Threshold){ | |
260 | SetInput("PHOS_MB_L0"); | |
261 | if(max >= fL1LowThreshold){ | |
262 | SetInput("PHOS_LPt_L1"); | |
263 | if(max >= fL1MediumThreshold){ | |
264 | SetInput("PHOS_MPt_L1"); | |
265 | if(max >= fL1HighThreshold){ | |
266 | SetInput("PHOS_HPt_L1"); | |
267 | } | |
268 | } | |
269 | } | |
270 | } | |
271 | } |