]>
Commit | Line | Data |
---|---|---|
25354ff4 | 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 | |
2ff6837e | 23 | // amplitude and finding the maximum. Maximums are compared to triggers |
24 | // threshold and they are set. | |
25354ff4 | 25 | // |
26 | //*-- Author: Gustavo Conesa & Yves Schutz (IFIC, CERN) | |
27 | ////////////////////////////////////////////////////////////////////////////// | |
28 | ||
29 | ||
30 | // --- ROOT system --- | |
b165f59d | 31 | #include "TMatrixD.h" |
25354ff4 | 32 | |
33 | // --- ALIROOT system --- | |
34 | #include "AliPHOSTrigger.h" | |
35 | #include "AliPHOSGeometry.h" | |
36 | #include "AliPHOSGetter.h" | |
b165f59d | 37 | #include "AliTriggerInput.h" |
25354ff4 | 38 | |
39 | ||
40 | ClassImp(AliPHOSTrigger) | |
41 | ||
b165f59d | 42 | //______________________________________________________________________ |
43 | AliPHOSTrigger::AliPHOSTrigger() | |
66f9b73c | 44 | : AliTriggerDetector(), fNTRU(8), fNTRUZ(2), fNTRUPhi(4), |
45 | fL0MBPbPbThreshold(500), fL0MBppThreshold(50), | |
46 | fL1JetLowPtThreshold(1200), fL1JetHighPtThreshold(30000) | |
25354ff4 | 47 | { |
b165f59d | 48 | //ctor |
49 | ||
50 | SetName("PHOS"); | |
51 | CreateInputs(); | |
52 | ||
2ff6837e | 53 | //Print("all") ; |
25354ff4 | 54 | } |
55 | ||
b165f59d | 56 | |
57 | ||
25354ff4 | 58 | //____________________________________________________________________________ |
b165f59d | 59 | AliPHOSTrigger::AliPHOSTrigger(const AliPHOSTrigger & trig) |
60 | : AliTriggerDetector(trig) | |
25354ff4 | 61 | { |
62 | ||
63 | // cpy ctor | |
66f9b73c | 64 | fNTRU = trig.fNTRU ; |
65 | fNTRUZ = trig.fNTRUZ ; | |
66 | fNTRUPhi = trig.fNTRUPhi ; | |
67 | fL0MBPbPbThreshold = trig.fL0MBPbPbThreshold ; | |
68 | fL0MBppThreshold = trig.fL0MBppThreshold ; | |
69 | fL1JetLowPtThreshold = trig.fL1JetLowPtThreshold ; | |
70 | fL1JetHighPtThreshold = trig.fL1JetHighPtThreshold ; | |
25354ff4 | 71 | |
72 | } | |
73 | ||
b165f59d | 74 | //---------------------------------------------------------------------- |
75 | void AliPHOSTrigger::CreateInputs() | |
76 | { | |
77 | // inputs | |
78 | ||
79 | // Do not create inputs again!! | |
80 | if( fInputs.GetEntriesFast() > 0 ) return; | |
81 | ||
66f9b73c | 82 | fInputs.AddLast( new AliTriggerInput( "PHOS_MB_PbPb_L0", "PHOS PbPb Minimum Bias L0", 0x01 ) ); |
83 | fInputs.AddLast( new AliTriggerInput( "PHOS_MB_pp_L0", "PHOS pp Minimum Bias L0", 0x02 ) ); | |
84 | fInputs.AddLast( new AliTriggerInput( "PHOS_PbPb_JetHPt_L1", "PHOS PbPb Jet High Pt L1", 0x04 ) ); | |
85 | fInputs.AddLast( new AliTriggerInput( "PHOS_PbPb_JetLPt_L1", "PHOS PbPb Jet Low Pt L1", 0x08 ) ); | |
b165f59d | 86 | |
87 | } | |
88 | ||
25354ff4 | 89 | //____________________________________________________________________________ |
2ff6837e | 90 | TClonesArray * AliPHOSTrigger::FillTRU(const TClonesArray * digits, |
91 | const AliPHOSGeometry * geom, | |
92 | const Int_t nModules, | |
93 | const Int_t nCrystalsPhi, | |
94 | const Int_t nCrystalsZ) const { | |
25354ff4 | 95 | |
96 | //Orders digits ampitudes list in 8 TRUs (16x28 crystals) per module. | |
97 | //Each TRU is a TMatrixD, and they are kept in TClonesArrays. | |
98 | ||
99 | //Initilize variables | |
100 | ||
2ff6837e | 101 | //const AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ; |
25354ff4 | 102 | |
103 | TClonesArray * matrix = new TClonesArray("TMatrixD",1000); | |
2ff6837e | 104 | for(Int_t k = 0; k < fNTRU*nModules ; k++){ |
105 | TMatrixD * trus = new TMatrixD(nCrystalsPhi,nCrystalsZ) ; | |
106 | for(Int_t i = 0; i < nCrystalsPhi; i++) | |
107 | for(Int_t j = 0; j < nCrystalsZ; j++) | |
25354ff4 | 108 | (*trus)(i,j) = 0.0; |
109 | new((*matrix)[k]) TMatrixD(*trus) ; | |
110 | } | |
111 | ||
112 | AliPHOSDigit * dig ; | |
113 | ||
2ff6837e | 114 | //Declare variables |
25354ff4 | 115 | Int_t relid[4] ; |
116 | Float_t amp = 0; | |
117 | ||
118 | for(Int_t idig = 0 ; idig < digits->GetEntriesFast() ; idig++){ | |
119 | ||
120 | dig = static_cast<AliPHOSDigit *>(digits->At(idig)) ; | |
121 | amp = dig->GetAmp() ; //Energy of the digit (arbitrary units) | |
122 | geom->AbsToRelNumbering(dig->GetId(), relid) ;//Transform digit number into 4 numbers | |
123 | //relid[0] = module | |
124 | //relid[1] = EMC (0) or CPV (-1) | |
125 | //relid[2] = row <= 64 (fNPhi) | |
126 | //relid[3] = column <= 56 (fNZ) | |
127 | ||
128 | if(relid[1] == 0){ | |
129 | ||
130 | Int_t ntru = 1; | |
131 | Int_t row = 1; | |
132 | Int_t col = 1; | |
133 | //Check which TRU in the module. It is divided in a (4,2) matrix. | |
134 | //Fill the TRU matrix (16,28) | |
25354ff4 | 135 | |
2ff6837e | 136 | Int_t i = 0 ; |
137 | for(i = 1; i < fNTRUZ ; i++) | |
138 | if(relid[3] > nCrystalsZ*i && relid[3] <= nCrystalsZ*(i+1)) | |
139 | col = i+1; | |
25354ff4 | 140 | |
2ff6837e | 141 | for(i = 1; i < fNTRUPhi ; i++) |
142 | if(relid[2] > nCrystalsPhi*i && relid[2] <= nCrystalsPhi*(i+1)) | |
143 | row = i+1; | |
144 | ||
145 | ntru = col*row + (relid[0]-1)*fNTRU - 1; | |
25354ff4 | 146 | TMatrixD * trus = dynamic_cast<TMatrixD *>(matrix->At(ntru)) ; |
2ff6837e | 147 | |
148 | Int_t nrow = (relid[2]-1) - (row-1) * nCrystalsPhi; | |
149 | Int_t ncol = (relid[3]-1) - (col-1) * nCrystalsZ; | |
25354ff4 | 150 | |
151 | (*trus)(nrow,ncol) = amp ; | |
152 | } | |
153 | } | |
154 | return matrix; | |
155 | } | |
156 | ||
25354ff4 | 157 | //____________________________________________________________________________ |
2ff6837e | 158 | void AliPHOSTrigger::MakeSlidingCell(const TClonesArray * trus, |
159 | const Int_t mod, | |
160 | const Int_t nCrystalsPhi, | |
161 | const Int_t nCrystalsZ, | |
25354ff4 | 162 | Float_t *ampmax){ |
163 | ||
164 | //Sums energy of all possible 4x4 crystals per each TRU. Fast signal | |
165 | //in the experiment is given by 2x2 crystals, for this reason we loop | |
166 | //inside the TRU crystals by 2. | |
167 | ||
168 | Float_t amp = 0 ; | |
169 | ||
2ff6837e | 170 | for(Int_t i = 0 ; i < fNTRU ; i++) |
25354ff4 | 171 | ampmax[i] = 0 ; |
172 | ||
173 | //Loop over all TRUS in a module | |
2ff6837e | 174 | for(Int_t itru = 0 + (mod - 1) * fNTRU ; itru < mod*fNTRU ; itru++){ |
25354ff4 | 175 | TMatrixD * tru = dynamic_cast<TMatrixD *>(trus->At(itru)) ; |
176 | //Sliding 2x2 cell | |
177 | //ampmax[itru-(mod-1)*8]=0.0; | |
2ff6837e | 178 | for(Int_t irow = 0 ; irow < nCrystalsPhi; irow += 2){ |
179 | for(Int_t icol = 0 ; icol < nCrystalsZ ; icol += 2){ | |
25354ff4 | 180 | amp = 0; |
2ff6837e | 181 | if( (irow+3) < nCrystalsPhi && (icol+3) < nCrystalsZ){//Avoid exit the TRU |
25354ff4 | 182 | for(Int_t i = irow; i < irow + 4 ; i++){ |
183 | for(Int_t j = icol; j < icol + 4 ; j++){ | |
184 | amp += (*tru)(i,j) ; | |
185 | } | |
186 | } | |
187 | } | |
2ff6837e | 188 | if(amp > ampmax[itru-(mod-1)*fNTRU]) |
189 | ampmax[itru-(mod-1)*fNTRU] = amp ; | |
25354ff4 | 190 | } |
191 | } | |
192 | } | |
193 | } | |
194 | ||
195 | //____________________________________________________________________________ | |
b165f59d | 196 | void AliPHOSTrigger::Trigger() |
25354ff4 | 197 | { |
198 | ||
199 | //Main Method to select triggers. | |
200 | ||
25354ff4 | 201 | AliPHOSGetter * gime = AliPHOSGetter::Instance() ; |
2ff6837e | 202 | |
203 | //Define some useful parameters | |
204 | const AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ; | |
205 | Int_t nModules = geom->GetNModules(); | |
206 | Int_t nCrystalsPhi = geom->GetNPhi()/fNTRUPhi ;// 64/4=16 | |
207 | Int_t nCrystalsZ = geom->GetNZ()/fNTRUZ ;// 56/2=28 | |
208 | ||
25354ff4 | 209 | //Take the digits list and declare digits pointers |
210 | TClonesArray * digits = gime->Digits() ; | |
2ff6837e | 211 | |
25354ff4 | 212 | //Fill TRU Matrix |
2ff6837e | 213 | TClonesArray * trus = FillTRU(digits,geom, nModules, nCrystalsPhi, |
214 | nCrystalsZ) ; | |
25354ff4 | 215 | |
216 | //Do Cell Sliding and select Trigger | |
217 | Float_t max [8] ; | |
2ff6837e | 218 | for(Int_t imod = 1 ; imod <= nModules ; imod++) { |
219 | MakeSlidingCell(trus, imod, nCrystalsPhi, nCrystalsZ, max); | |
220 | // cout<<" Max Amplitude: mod " << imod <<" TRU0 " << max[0] | |
221 | // <<" TRU1 " << max[1] <<" TRU2 " << max[2] <<" TRU3 " << max[3] | |
222 | // <<" TRU4 " << max[4] <<" TRU5 " << max[5] <<" TRU6 " << max[6] | |
223 | // <<" TRU7 " << max[7] <<endl; | |
224 | ||
25354ff4 | 225 | SetTriggers(max) ; |
226 | } | |
227 | ||
228 | } | |
229 | ||
230 | //____________________________________________________________________________ | |
231 | void AliPHOSTrigger::Print(const Option_t * opt) const | |
232 | { | |
233 | ||
234 | //Prints main parameters | |
235 | ||
236 | if(! opt) | |
237 | return; | |
b165f59d | 238 | AliTriggerInput* in = 0x0 ; |
25354ff4 | 239 | |
b165f59d | 240 | AliInfo("PHOS trigger information:") ; |
66f9b73c | 241 | printf( " Threshold for pp MB LO %d\n", fL0MBppThreshold) ; |
242 | in = (AliTriggerInput*)fInputs.FindObject( "PHOS_MB_pp_L0" ); | |
b165f59d | 243 | if(in->GetValue()) |
66f9b73c | 244 | printf( " *** PHOS MB pp LO is set ***\n") ; |
b165f59d | 245 | |
66f9b73c | 246 | printf( " Threshold for PbPb MB LO %d\n", fL0MBPbPbThreshold) ; |
247 | in = (AliTriggerInput*)fInputs.FindObject( "PHOS_MB_PbPb_L0" ); | |
248 | if(in->GetValue()) | |
249 | printf( " *** PHOS MB PbPb LO is set ***\n") ; | |
250 | ||
251 | printf( " Jet Low Pt Threshold for PbPb L1 %d\n", fL1JetLowPtThreshold) ; | |
252 | in = (AliTriggerInput*)fInputs.FindObject( "PHOS_PbPb_JetLPt_L1" ); | |
b165f59d | 253 | if(in->GetValue()) |
66f9b73c | 254 | printf( " *** PHOS Jet Low Pt for PbPb L1 is set ***\n") ; |
b165f59d | 255 | |
66f9b73c | 256 | printf( " Jet High Pt Threshold for L1 %d\n", fL1JetHighPtThreshold) ; |
257 | in = (AliTriggerInput*) fInputs.FindObject( "PHOS_PbPb_JetHPt_L1" ); | |
b165f59d | 258 | if(in->GetValue()) |
66f9b73c | 259 | printf( " *** PHOS Jet High Pt for PbPb L1 is set ***\n") ; |
2ff6837e | 260 | |
261 | if(strstr(opt,"all")){ | |
262 | printf( " Number of TRUs %d\n", fNTRU) ; | |
263 | printf( " Number of crystals in Z in TRUs %d\n", | |
264 | fNTRUZ) ; | |
265 | printf( " Number of crystals in Phi in TRUs %d\n", | |
266 | fNTRUPhi) ; | |
267 | } | |
25354ff4 | 268 | } |
269 | ||
270 | //____________________________________________________________________________ | |
271 | void AliPHOSTrigger::SetTriggers(const Float_t * amp) | |
272 | { | |
273 | ||
274 | //Checks the maximum amplitude per each TRU and compares with the | |
275 | //different triggers thresholds | |
276 | ||
277 | Float_t max = 0; | |
278 | for(Int_t i = 0 ; i < 8 ; i++){ | |
279 | if(max < amp[i] ) | |
280 | max = amp[i] ; | |
281 | } | |
2ff6837e | 282 | |
66f9b73c | 283 | if(max >= fL0MBppThreshold) |
284 | SetInput("PHOS_MB_pp_L0"); | |
285 | if(max >= fL0MBPbPbThreshold) | |
286 | SetInput("PHOS_MB_PbPb_L0"); | |
287 | if(max >= fL1JetLowPtThreshold) | |
288 | SetInput("PHOS_PbPb_JetLPt_L1"); | |
289 | if(max >= fL1JetHighPtThreshold) | |
290 | SetInput("PHOS_PbPb_JetHPt_L1"); | |
291 | ||
25354ff4 | 292 | } |