1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 //_________________________________________________________________________
19 // Class for trigger analysis.
20 // Digits are grouped in TRU's (Trigger Units). A TRU consists of 384
21 // cells ordered fNTRUPhi x fNTRUEta. The algorithm searches all possible 2x2
22 // and nxn (n is a multiple of 2) cell combinations per each TRU, adding the
23 // digits amplitude and finding the maximum. If found, look if it is isolated.
24 // Maxima are transformed in ADC time samples. Each time bin is compared to the trigger
25 // threshold until it is larger and then, triggers are set. Thresholds need to be fixed.
26 // Thresholds need to be fixed. Last 2 modules are half size in Phi, I considered
27 // that the number of TRU is maintained for the last modules but decision not taken.
28 // If different, then this must be changed.
31 // //Inside the event loop
32 // AliEMCALTrigger *tr = new AliEMCALTrigger();//Init Trigger
33 // tr->SetL0Threshold(100); //Arbitrary threshold values
34 // tr->SetL1JetLowPtThreshold(1000);
35 // tr->SetL1JetMediumPtThreshold(10000);
36 // tr->SetL1JetHighPtThreshold(20000);
38 // tr->Trigger(); //Execute Trigger
39 // tr->Print(""); //Print results
41 //*-- Author: Gustavo Conesa & Yves Schutz (IFIC, CERN)
42 //////////////////////////////////////////////////////////////////////////////
45 // --- ROOT system ---
47 // --- ALIROOT system ---
49 #include "AliRunLoader.h"
50 #include "AliTriggerInput.h"
52 #include "AliEMCALLoader.h"
53 #include "AliEMCALDigit.h"
54 #include "AliEMCALTrigger.h"
55 #include "AliEMCALGeometry.h"
56 #include "AliEMCALRawUtils.h"
58 ClassImp(AliEMCALTrigger)
60 //______________________________________________________________________
61 AliEMCALTrigger::AliEMCALTrigger()
62 : AliTriggerDetector(),
63 f2x2MaxAmp(-1), f2x2CellPhi(-1), f2x2CellEta(-1),
65 fnxnMaxAmp(-1), fnxnCellPhi(-1), fnxnCellEta(-1),
67 fADCValuesHighnxn(0),fADCValuesLownxn(0),
68 fADCValuesHigh2x2(0),fADCValuesLow2x2(0),
70 fL0Threshold(100),fL1JetLowPtThreshold(200),
71 fL1JetMediumPtThreshold(500), fL1JetHighPtThreshold(1000),
72 fNTRU(3), fNTRUEta(3), fNTRUPhi(1),
73 fNCellsPhi(24), fNCellsEta(16),
74 fPatchSize(1), fIsolPatchSize(1),
75 f2x2AmpOutOfPatch(-1), fnxnAmpOutOfPatch(-1),
76 f2x2AmpOutOfPatchThres(100000), fnxnAmpOutOfPatchThres(100000),
77 fIs2x2Isol(kFALSE), fIsnxnIsol(kFALSE),
78 fSimulation(kTRUE), fIsolateInSuperModule(kTRUE)
81 fADCValuesHighnxn = 0x0; //new Int_t[fTimeBins];
82 fADCValuesLownxn = 0x0; //new Int_t[fTimeBins];
83 fADCValuesHigh2x2 = 0x0; //new Int_t[fTimeBins];
84 fADCValuesLow2x2 = 0x0; //new Int_t[fTimeBins];
94 //____________________________________________________________________________
95 AliEMCALTrigger::AliEMCALTrigger(const AliEMCALTrigger & trig)
96 : AliTriggerDetector(trig),
97 f2x2MaxAmp(trig.f2x2MaxAmp),
98 f2x2CellPhi(trig.f2x2CellPhi),
99 f2x2CellEta(trig.f2x2CellEta),
101 fnxnMaxAmp(trig.fnxnMaxAmp),
102 fnxnCellPhi(trig.fnxnCellPhi),
103 fnxnCellEta(trig.fnxnCellEta),
105 fADCValuesHighnxn(trig.fADCValuesHighnxn),
106 fADCValuesLownxn(trig.fADCValuesLownxn),
107 fADCValuesHigh2x2(trig.fADCValuesHigh2x2),
108 fADCValuesLow2x2(trig.fADCValuesLow2x2),
109 fDigitsList(trig.fDigitsList),
110 fL0Threshold(trig.fL0Threshold),
111 fL1JetLowPtThreshold(trig.fL1JetLowPtThreshold),
112 fL1JetMediumPtThreshold(trig.fL1JetMediumPtThreshold),
113 fL1JetHighPtThreshold(trig.fL1JetHighPtThreshold),
114 fNTRU(trig.fNTRU), fNTRUEta(trig.fNTRUEta), fNTRUPhi(trig.fNTRUPhi),
115 fNCellsPhi(trig.fNCellsPhi), fNCellsEta(trig.fNCellsEta),
116 fPatchSize(trig.fPatchSize),
117 fIsolPatchSize(trig.fIsolPatchSize),
118 f2x2AmpOutOfPatch(trig.f2x2AmpOutOfPatch),
119 fnxnAmpOutOfPatch(trig.fnxnAmpOutOfPatch),
120 f2x2AmpOutOfPatchThres(trig.f2x2AmpOutOfPatchThres),
121 fnxnAmpOutOfPatchThres(trig.fnxnAmpOutOfPatchThres),
122 fIs2x2Isol(trig.fIs2x2Isol),
123 fIsnxnIsol(trig.fIsnxnIsol),
124 fSimulation(trig.fSimulation),
125 fIsolateInSuperModule(trig.fIsolateInSuperModule)
130 //----------------------------------------------------------------------
131 void AliEMCALTrigger::CreateInputs()
135 // Do not create inputs again!!
136 if( fInputs.GetEntriesFast() > 0 ) return;
138 fInputs.AddLast( new AliTriggerInput( "EMCAL_L0", "EMCAL L0", 0x02 ) );
139 fInputs.AddLast( new AliTriggerInput( "EMCAL_JetHPt_L1","EMCAL Jet High Pt L1", 0x04 ) );
140 fInputs.AddLast( new AliTriggerInput( "EMCAL_JetMPt_L1","EMCAL Jet Medium Pt L1", 0x08 ) );
141 fInputs.AddLast( new AliTriggerInput( "EMCAL_JetLPt_L1","EMCAL Jet Low Pt L1", 0x016 ) );
145 //____________________________________________________________________________
146 Bool_t AliEMCALTrigger::IsPatchIsolated(Int_t iPatchType, const TClonesArray * ampmatrixes, const Int_t iSM, const Int_t mtru, const Float_t maxamp, const Int_t maxphi, const Int_t maxeta) {
148 //Calculate if the maximum patch found is isolated, find amplitude around maximum (2x2 or nxn) patch,
149 //inside isolation patch . iPatchType = 0 means calculation for 2x2 patch,
150 //iPatchType = 1 means calculation for nxn patch.
151 //In the next table there is an example of the different options of patch size and isolation patch size:
152 // Patch Size (fPatchSize)
154 // fIsolPatchSize 2x2 (not overlap) 4x4 (overlapped) 6x6(overlapped) ...
162 //Get matrix of TRU or Module with maximum amplitude patch.
163 Int_t itru = mtru+iSM*fNTRU ; //number of tru, min 0 max 8*5.
164 TMatrixD * ampmatrix = 0x0;
168 if(fIsolateInSuperModule){
169 ampmatrix = dynamic_cast<TMatrixD *>(ampmatrixes->At(iSM)) ;
170 rowborder = fNCellsPhi*fNTRUPhi;
171 colborder = fNCellsEta*fNTRUEta;
172 AliDebug(2,"Isolate trigger in Module");
175 ampmatrix = dynamic_cast<TMatrixD *>(ampmatrixes->At(itru)) ;
176 rowborder = fNCellsPhi;
177 colborder = fNCellsEta;
178 AliDebug(2,"Isolate trigger in TRU");
182 Int_t isolcells = fIsolPatchSize*(1+iPatchType);
183 Int_t ipatchcells = 2*(1+fPatchSize*iPatchType);
184 Int_t minrow = maxphi - isolcells;
185 Int_t mincol = maxeta - isolcells;
186 Int_t maxrow = maxphi + isolcells + ipatchcells;
187 Int_t maxcol = maxeta + isolcells + ipatchcells;
189 AliDebug(2,Form("Number of added Isol Cells %d, Patch Size %d",isolcells, ipatchcells));
190 AliDebug(2,Form("Patch: minrow %d, maxrow %d, mincol %d, maxcol %d",minrow,maxrow,mincol,maxcol));
192 if(minrow < 0 || mincol < 0 || maxrow > rowborder || maxcol > colborder){
193 AliDebug(1,Form("Out of Module/TRU range, cannot isolate patch"));
197 //Add amplitudes in all isolation patch
198 for(Int_t irow = minrow ; irow < maxrow; irow ++)
199 for(Int_t icol = mincol ; icol < maxcol ; icol ++)
200 amp += (*ampmatrix)(irow,icol);
202 AliDebug(2,Form("Type %d, Maximum amplitude %f, patch+isol square %f",iPatchType, maxamp, amp));
205 AliError(Form("Bad sum: Type %d, Maximum amplitude %f, patch+isol square %f",iPatchType, maxamp, amp));
209 amp-=maxamp; //Calculate energy in isolation patch that do not comes from maximum patch.
211 AliDebug(2, Form("Maximum amplitude %f, Out of patch %f",maxamp, amp));
213 //Fill isolation amplitude data member and say if patch is isolated.
214 if(iPatchType == 0){ //2x2 case
215 f2x2AmpOutOfPatch = amp;
216 if(amp < f2x2AmpOutOfPatchThres)
219 else if(iPatchType == 1){ //nxn case
220 fnxnAmpOutOfPatch = amp;
221 if(amp < fnxnAmpOutOfPatchThres)
229 //____________________________________________________________________________
230 void AliEMCALTrigger::MakeSlidingCell(const TClonesArray * amptrus, const TClonesArray * timeRtrus, const Int_t isupermod,TMatrixD *ampmax2, TMatrixD *ampmaxn){
232 //Sums energy of all possible 2x2 (L0) and nxn (L1) cells per each TRU.
233 //Fast signal in the experiment is given by 2x2 cells,
234 //for this reason we loop inside the TRU cells by 2.
236 //Declare and initialize variables
237 Int_t nCellsPhi = fNCellsPhi;//geom->GetNPhi()*2/geom->GetNTRUPhi() ;
239 nCellsPhi = nCellsPhi / 2 ; //Half size SM. Not Final.
240 // 12(tow)*2(cell)/1 TRU, cells in Phi in one TRU
241 Int_t nCellsEta = fNCellsEta ;//geom->GetNEta()*2/geom->GetNTRUEta() ;
242 // 24(mod)*2(tower)/3 TRU, cells in Eta in one TRU
243 //Int_t nTRU = geom->GeNTRU();//3 TRU per super module
247 for(Int_t i = 0; i < 4; i++){
248 for(Int_t j = 0; j < fNTRU; j++){
249 (*ampmax2)(i,j) = -1;
250 (*ampmaxn)(i,j) = -1;
254 //Create matrix that will contain 2x2 amplitude sums
255 //used to calculate the nxn sums
256 TMatrixD * tru2x2 = new TMatrixD(nCellsPhi/2,nCellsEta/2) ;
257 for(Int_t i = 0; i < nCellsPhi/2; i++)
258 for(Int_t j = 0; j < nCellsEta/2; j++)
261 //Loop over all TRUS in a supermodule
262 for(Int_t itru = 0 + isupermod * fNTRU ; itru < (isupermod+1)*fNTRU ; itru++) {
263 TMatrixD * amptru = dynamic_cast<TMatrixD *>(amptrus->At(itru)) ;
264 TMatrixD * timeRtru = dynamic_cast<TMatrixD *>(timeRtrus->At(itru)) ;
265 Int_t mtru = itru-isupermod*fNTRU ; //Number of TRU in Supermodule
267 //Sliding 2x2, add 2x2 amplitudes (NOT OVERLAP)
268 for(Int_t irow = 0 ; irow < nCellsPhi; irow += 2){
269 for(Int_t icol = 0 ; icol < nCellsEta ; icol += 2){
270 amp2 = (*amptru)(irow,icol)+(*amptru)(irow+1,icol)+
271 (*amptru)(irow,icol+1)+(*amptru)(irow+1,icol+1);
273 //Fill matrix with added 2x2 cells for use in nxn sums
274 (*tru2x2)(irow/2,icol/2) = amp2 ;
275 //Select 2x2 maximum sums to select L0
276 if(amp2 > (*ampmax2)(0,mtru)){
277 (*ampmax2)(0,mtru) = amp2 ;
278 (*ampmax2)(1,mtru) = irow;
279 (*ampmax2)(2,mtru) = icol;
284 //Find most recent time in the selected 2x2 cell
285 (*ampmax2)(3,mtru) = 1 ;
286 Int_t row2 = static_cast <Int_t> ((*ampmax2)(1,mtru));
287 Int_t col2 = static_cast <Int_t> ((*ampmax2)(2,mtru));
288 for(Int_t i = 0; i<2; i++){
289 for(Int_t j = 0; j<2; j++){
290 if((*amptru)(row2+i,col2+j) > 0 && (*timeRtru)(row2+i,col2+j)> 0){
291 if((*timeRtru)(row2+i,col2+j) < (*ampmax2)(3,mtru) )
292 (*ampmax2)(3,mtru) = (*timeRtru)(row2+i,col2+j);
297 //Sliding nxn, add nxn amplitudes (OVERLAP)
299 for(Int_t irow = 0 ; irow < nCellsPhi/2; irow++){
300 for(Int_t icol = 0 ; icol < nCellsEta/2 ; icol++){
302 if( (irow+fPatchSize) < nCellsPhi/2 && (icol+fPatchSize) < nCellsEta/2){//Avoid exit the TRU
303 for(Int_t i = 0 ; i <= fPatchSize ; i++)
304 for(Int_t j = 0 ; j <= fPatchSize ; j++)
305 ampn += (*tru2x2)(irow+i,icol+j);
306 //Select nxn maximum sums to select L1
307 if(ampn > (*ampmaxn)(0,mtru)){
308 (*ampmaxn)(0,mtru) = ampn ;
309 (*ampmaxn)(1,mtru) = irow*2;
310 (*ampmaxn)(2,mtru) = icol*2;
316 //Find most recent time in selected nxn cell
317 (*ampmaxn)(3,mtru) = 1 ;
318 Int_t rown = static_cast <Int_t> ((*ampmaxn)(1,mtru));
319 Int_t coln = static_cast <Int_t> ((*ampmaxn)(2,mtru));
320 for(Int_t i = 0; i<4*fPatchSize; i++){
321 for(Int_t j = 0; j<4*fPatchSize; j++){
322 if( (rown+i) < nCellsPhi && (coln+j) < nCellsEta/2){//Avoid exit the TRU
323 if((*amptru)(rown+i,coln+j) > 0 && (*timeRtru)(rown+i,coln+j)> 0){
324 if((*timeRtru)(rown+i,coln+j) < (*ampmaxn)(3,mtru) )
325 (*ampmaxn)(3,mtru) = (*timeRtru)(rown+i,coln+j);
332 (*ampmaxn)(0,mtru) = (*ampmax2)(0,mtru);
333 (*ampmaxn)(1,mtru) = (*ampmax2)(1,mtru);
334 (*ampmaxn)(2,mtru) = (*ampmax2)(2,mtru);
335 (*ampmaxn)(3,mtru) = (*ampmax2)(3,mtru);
340 //____________________________________________________________________________
341 void AliEMCALTrigger::Print(const Option_t * opt) const
344 //Prints main parameters
348 AliTriggerInput* in = 0x0 ;
350 printf( " Maximum Amplitude after Sliding Cell, \n") ;
351 printf( " -2x2 cells sum (not overlapped): %10.2f, in Super Module %d\n",
353 printf( " -2x2 from row %d to row %d and from column %d to column %d\n", f2x2CellPhi, f2x2CellPhi+2, f2x2CellEta, f2x2CellEta+2) ;
354 printf( " -2x2 Isolation Patch %d x %d, Amplitude out of 2x2 patch is %f, threshold %f, Isolated? %d \n",
355 2*fIsolPatchSize+2, 2*fIsolPatchSize+2, f2x2AmpOutOfPatch, f2x2AmpOutOfPatchThres,static_cast<Int_t> (fIs2x2Isol)) ;
357 printf( " Patch Size, n x n: %d x %d cells\n",2*(fPatchSize+1), 2*(fPatchSize+1));
358 printf( " -nxn cells sum (overlapped) : %10.2f, in Super Module %d\n",
360 printf( " -nxn from row %d to row %d and from column %d to column %d\n", fnxnCellPhi, fnxnCellPhi+4*fPatchSize, fnxnCellEta, fnxnCellEta+4*fPatchSize) ;
361 printf( " -nxn Isolation Patch %d x %d, Amplitude out of nxn patch is %f, threshold %f, Isolated? %d \n",
362 4*fIsolPatchSize+2*(fPatchSize+1),4*fIsolPatchSize+2*(fPatchSize+1) , fnxnAmpOutOfPatch, fnxnAmpOutOfPatchThres,static_cast<Int_t> (fIsnxnIsol) ) ;
365 printf( " Isolate in SuperModule? %d\n",
366 fIsolateInSuperModule) ;
368 printf( " Threshold for LO %10.2f\n",
370 in = (AliTriggerInput*)fInputs.FindObject( "EMCAL_L0" );
372 printf( " *** EMCAL LO is set ***\n") ;
374 printf( " Jet Low Pt Threshold for L1 %10.2f\n",
375 fL1JetLowPtThreshold) ;
376 in = (AliTriggerInput*)fInputs.FindObject( "EMCAL_JetLPt_L1" );
378 printf( " *** EMCAL Jet Low Pt for L1 is set ***\n") ;
380 printf( " Jet Medium Pt Threshold for L1 %10.2f\n",
381 fL1JetMediumPtThreshold) ;
382 in = (AliTriggerInput*) fInputs.FindObject( "EMCAL_JetMPt_L1" );
384 printf( " *** EMCAL Jet Medium Pt for L1 is set ***\n") ;
386 printf( " Jet High Pt Threshold for L1 %10.2f\n",
387 fL1JetHighPtThreshold) ;
388 in = (AliTriggerInput*) fInputs.FindObject( "EMCAL_JetHPt_L1" );
390 printf( " *** EMCAL Jet High Pt for L1 is set ***\n") ;
394 //____________________________________________________________________________
395 void AliEMCALTrigger::SetTriggers(const TClonesArray * ampmatrix,const Int_t iSM,
396 const TMatrixD *ampmax2,
397 const TMatrixD *ampmaxn, const AliEMCALGeometry *geom)
400 //Checks the 2x2 and nxn maximum amplitude per each TRU and
401 //compares with the different L0 and L1 triggers thresholds
402 Float_t max2[] = {-1,-1,-1,-1} ;
403 Float_t maxn[] = {-1,-1,-1,-1} ;
407 //Find maximum summed amplitude of all the TRU
409 for(Int_t i = 0 ; i < fNTRU ; i++){
410 if(max2[0] < (*ampmax2)(0,i) ){
411 max2[0] = (*ampmax2)(0,i) ; // 2x2 summed max amplitude
412 max2[1] = (*ampmax2)(1,i) ; // corresponding phi position in TRU
413 max2[2] = (*ampmax2)(2,i) ; // corresponding eta position in TRU
414 max2[3] = (*ampmax2)(3,i) ; // corresponding most recent time
417 if(maxn[0] < (*ampmaxn)(0,i) ){
418 maxn[0] = (*ampmaxn)(0,i) ; // nxn summed max amplitude
419 maxn[1] = (*ampmaxn)(1,i) ; // corresponding phi position in TRU
420 maxn[2] = (*ampmaxn)(2,i) ; // corresponding eta position in TRU
421 maxn[3] = (*ampmaxn)(3,i) ; // corresponding most recent time
426 //--------Set max amplitude if larger than in other Super Modules------------
427 Float_t maxtimeR2 = -1 ;
428 Float_t maxtimeRn = -1 ;
429 static AliEMCALRawUtils rawUtil;
430 Int_t nTimeBins = rawUtil.GetRawFormatTimeBins() ;
432 //Set max of 2x2 amplitudes and select L0 trigger
433 if(max2[0] > f2x2MaxAmp ){
434 f2x2MaxAmp = max2[0] ;
436 maxtimeR2 = max2[3] ;
437 geom->GetCellPhiEtaIndexInSModuleFromTRUIndex(mtru2,
438 static_cast<Int_t>(max2[1]),
439 static_cast<Int_t>(max2[2]),
440 f2x2CellPhi,f2x2CellEta) ;
443 if(fIsolateInSuperModule)
444 fIs2x2Isol = IsPatchIsolated(0, ampmatrix, iSM, mtru2, f2x2MaxAmp, f2x2CellPhi,f2x2CellEta) ;
446 fIs2x2Isol = IsPatchIsolated(0, ampmatrix, iSM, mtru2, f2x2MaxAmp, static_cast<Int_t>(max2[1]), static_cast<Int_t>(max2[2])) ;
448 //Transform digit amplitude in Raw Samples
449 fADCValuesLow2x2 = new Int_t[nTimeBins];
450 fADCValuesHigh2x2 = new Int_t[nTimeBins];
451 rawUtil.RawSampledResponse(maxtimeR2, f2x2MaxAmp, fADCValuesHigh2x2, fADCValuesLow2x2) ;
453 //Set Trigger Inputs, compare ADC time bins until threshold is attained
455 for(Int_t i = 0 ; i < nTimeBins ; i++){
456 if(fADCValuesHigh2x2[i] >= fL0Threshold || fADCValuesLow2x2[i] >= fL0Threshold){
457 SetInput("EMCAL_L0") ;
463 //------------Set max of nxn amplitudes and select L1 trigger---------
464 if(maxn[0] > fnxnMaxAmp ){
465 fnxnMaxAmp = maxn[0] ;
467 maxtimeRn = maxn[3] ;
468 geom->GetCellPhiEtaIndexInSModuleFromTRUIndex(mtrun,
469 static_cast<Int_t>(maxn[1]),
470 static_cast<Int_t>(maxn[2]),
471 fnxnCellPhi,fnxnCellEta) ;
474 if(fIsolateInSuperModule)
475 fIsnxnIsol = IsPatchIsolated(1, ampmatrix, iSM, mtrun, fnxnMaxAmp, fnxnCellPhi, fnxnCellEta) ;
477 fIsnxnIsol = IsPatchIsolated(1, ampmatrix, iSM, mtrun, fnxnMaxAmp, static_cast<Int_t>(maxn[1]), static_cast<Int_t>(maxn[2])) ;
479 //Transform digit amplitude in Raw Samples
480 fADCValuesHighnxn = new Int_t[nTimeBins];
481 fADCValuesLownxn = new Int_t[nTimeBins];
482 rawUtil.RawSampledResponse(maxtimeRn, fnxnMaxAmp, fADCValuesHighnxn, fADCValuesLownxn) ;
484 //Set Trigger Inputs, compare ADC time bins until threshold is attained
486 for(Int_t i = 0 ; i < nTimeBins ; i++){
487 if(fADCValuesHighnxn[i] >= fL1JetLowPtThreshold || fADCValuesLownxn[i] >= fL1JetLowPtThreshold){
488 SetInput("EMCAL_JetLPt_L1") ;
494 for(Int_t i = 0 ; i < nTimeBins ; i++){
495 if(fADCValuesHighnxn[i] >= fL1JetMediumPtThreshold || fADCValuesLownxn[i] >= fL1JetMediumPtThreshold){
496 SetInput("EMCAL_JetMPt_L1") ;
502 for(Int_t i = 0 ; i < nTimeBins ; i++){
503 if(fADCValuesHighnxn[i] >= fL1JetHighPtThreshold || fADCValuesLownxn[i] >= fL1JetHighPtThreshold){
504 SetInput("EMCAL_JetHPt_L1") ;
511 //____________________________________________________________________________
512 void AliEMCALTrigger::Trigger()
514 //Main Method to select triggers.
515 AliRunLoader *runLoader = AliRunLoader::GetRunLoader();
516 AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>
517 (runLoader->GetDetectorLoader("EMCAL"));
519 //Load EMCAL Geometry
520 AliEMCALGeometry * geom = 0;
521 if (runLoader->GetAliRun() && runLoader->GetAliRun()->GetDetector("EMCAL"))
522 geom = dynamic_cast<AliEMCAL*>(runLoader->GetAliRun()->GetDetector("EMCAL"))->GetGeometry();
524 geom = AliEMCALGeometry::GetInstance(AliEMCALGeometry::GetDefaulGeometryName());
527 AliFatal("Did not get geometry from EMCALLoader");
530 Int_t nSuperModules = geom->GetNumberOfSuperModules() ; //12 SM in EMCAL
531 fNTRU = geom->GetNTRU(); //3 TRU per super module
532 fNTRUEta = geom->GetNTRUEta(); //3 TRU in eta per super module
533 fNTRUPhi = geom->GetNTRUPhi(); //1 TRU in phi per super module
534 fNCellsPhi = geom->GetNPhi()*2/geom->GetNTRUPhi() ;
535 fNCellsEta = geom->GetNEta()*2/geom->GetNTRUEta() ;
537 //Intialize data members each time the trigger is called in event loop
538 f2x2MaxAmp = -1; f2x2CellPhi = -1; f2x2CellEta = -1;
539 fnxnMaxAmp = -1; fnxnCellPhi = -1; fnxnCellEta = -1;
541 //Take the digits list if simulation
543 runLoader->LoadDigits("EMCAL");
544 fDigitsList = emcalLoader->Digits() ;
547 AliFatal("Digits not found !") ;
549 //Take the digits list
552 TClonesArray * amptrus = new TClonesArray("TMatrixD",1000);
553 TClonesArray * ampsmods = new TClonesArray("TMatrixD",1000);
554 TClonesArray * timeRtrus = new TClonesArray("TMatrixD",1000);
556 geom->FillTRU(fDigitsList, amptrus, ampsmods, timeRtrus) ;
558 //Do Cell Sliding and select Trigger
559 //Initialize varible that will contain maximum amplitudes and
560 //its corresponding cell position in eta and phi, and time.
561 TMatrixD * ampmax2 = new TMatrixD(4,fNTRU) ;
562 TMatrixD * ampmaxn = new TMatrixD(4,fNTRU) ;
564 for(Int_t iSM = 0 ; iSM < nSuperModules ; iSM++) {
565 //Do 2x2 and nxn sums, select maximums.
566 MakeSlidingCell(amptrus, timeRtrus, iSM, ampmax2, ampmaxn);
569 if(fIsolateInSuperModule)
570 SetTriggers(ampsmods,iSM,ampmax2,ampmaxn,geom) ;
571 if(!fIsolateInSuperModule)
572 SetTriggers(amptrus,iSM,ampmax2,ampmaxn,geom) ;