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