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 **************************************************************************/
18 //_________________________________________________________________________
20 // Class for trigger analysis.
21 // Digits are grouped in TRU's (384 cells? ordered fNTRUPhi x fNTRUEta).
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 // Last 2 modules are half size but they are treated as fullsize, then their
26 // TRU should be smaller. When this is fixed, class will be updated.
29 // //Inside the event loop
30 // AliEMCALTrigger *tr = new AliEMCALTrigger();//Init Trigger
31 // tr->SetL0MBPbPbThreshold(500);
32 // tr->SetL0MBppThreshold(100);
33 // tr->SetL1JetLowPtThreshold(1000);
34 // tr->SetL1JetMediumPtThreshold(10000);
35 // tr->SetL1JetHighPtThreshold(20000);
36 // tr->Trigger(); //Execute Trigger
37 // tr->Print(""); //Print results
39 //*-- Author: Gustavo Conesa & Yves Schutz (IFIC, CERN)
40 //////////////////////////////////////////////////////////////////////////////
43 // --- ROOT system ---
46 // --- 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"
57 ClassImp(AliEMCALTrigger)
59 //______________________________________________________________________
60 AliEMCALTrigger::AliEMCALTrigger()
61 : AliTriggerDetector(),
62 fL0MBPbPbThreshold(500), fL0MBppThreshold(50),fL1JetLowPtThreshold(1000),
63 fL1JetMediumPtThreshold(10000), fL1JetHighPtThreshold(20000)
75 //____________________________________________________________________________
76 AliEMCALTrigger::AliEMCALTrigger(const AliEMCALTrigger & trig)
77 : AliTriggerDetector(trig)
82 fL0MBPbPbThreshold = trig.fL0MBPbPbThreshold ;
83 fL0MBppThreshold = trig.fL0MBppThreshold ;
84 fL1JetLowPtThreshold = trig.fL1JetLowPtThreshold ;
85 fL1JetMediumPtThreshold = trig.fL1JetMediumPtThreshold ;
86 fL1JetHighPtThreshold = trig.fL1JetHighPtThreshold ;
90 //----------------------------------------------------------------------
91 void AliEMCALTrigger::CreateInputs()
95 // Do not create inputs again!!
96 if( fInputs.GetEntriesFast() > 0 ) return;
98 fInputs.AddLast( new AliTriggerInput( "EMCAL_MB_PbPb_L0", "EMCAL PbPb Minimum Bias L0", 0x01 ) );
99 fInputs.AddLast( new AliTriggerInput( "EMCAL_MB_pp_L0", "EMCAL pp Minimum Bias L0", 0x02 ) );
100 fInputs.AddLast( new AliTriggerInput( "EMCAL_PbPb_JetHPt_L1", "EMCAL PbPb Jet High Pt L1", 0x04 ) );
101 fInputs.AddLast( new AliTriggerInput( "EMCAL_PbPb_JetMPt_L1", "EMCAL PbPb Jet Medium Pt L1", 0x08 ) );
102 fInputs.AddLast( new AliTriggerInput( "EMCAL_PbPb_JetLPt_L1", "EMCAL PbPb Jet Low Pt L1", 0x016 ) );
106 //____________________________________________________________________________
107 void AliEMCALTrigger::MakeSlidingCell(const TClonesArray * trus ,
108 const Int_t isupermod,
110 const Int_t nCellsPhi,
111 const Int_t nCellsEta,
114 //Sums energy of all possible 4x4 cells per each TRU. Fast signal
115 //in the experiment is given by 2x2 cells, for this reason we loop
116 //inside the TRU cells by 2.
120 for(Int_t i = 0 ; i < nTRU ; i++)
123 //Loop over all TRUS in the seleted supermodule
124 for(Int_t itru = 0 + (isupermod - 1) * nTRU ; itru < isupermod*nTRU ; itru++)
126 TMatrixD * tru = dynamic_cast<TMatrixD *>(trus->At(itru)) ;
129 for(Int_t irow = 0 ; irow < nCellsPhi; irow += 2){
130 for(Int_t icol = 0 ; icol < nCellsEta ; icol += 2){
132 if( (irow+3) < nCellsPhi && (icol+3) < nCellsEta){//Avoid exit the TRU
133 for(Int_t i = irow; i < irow + 4 ; i++){
134 for(Int_t j = icol; j < icol + 4 ; j++){
139 if(amp > ampmax[itru-(isupermod-1)*nTRU])
140 ampmax[itru-(isupermod-1)*nTRU] = amp ;
147 //____________________________________________________________________________
148 void AliEMCALTrigger::Trigger()
151 //Main Method to select triggers.
153 AliRunLoader *rl = AliRunLoader::GetRunLoader();
154 AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>
155 (rl->GetDetectorLoader("EMCAL"));
157 //Load EMCAL Geometry
159 AliRun * gAlice = rl->GetAliRun();
160 AliEMCAL * emcal = (AliEMCAL*)gAlice->GetDetector("EMCAL");
161 AliEMCALGeometry * geom = emcal->GetGeometry();
162 //AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance();
165 AliFatal("Did not get geometry from EMCALLoader");
167 //Define some useful parameters
169 Int_t nSuperModules = geom->GetNumberOfSuperModules() ; //12 SM in EMCAL
170 Int_t nTRU = geom->GetNTRU();//3 TRU per super module
171 Int_t nCellsPhi = geom->GetNPhi()*2/geom->GetNTRUPhi() ;
172 // 12(tow)*2(cell)/1 TRU, cells in Phi in one TRU
173 Int_t nCellsEta = geom->GetNEta()*2/geom->GetNTRUEta() ;
174 // 24(mod)*2(tower)/3 TRU, cells in Eta in one TRU
176 //Info("Trigger","nSuperModules %d, nCellsPhi %d, nCellsEta %d",
177 // nSuperModules, nCellsPhi,nCellsEta);
179 //Take the digits list and declare digits pointers
180 TClonesArray * digits = emcalLoader->Digits(); //gime->Digits() ;
182 TClonesArray * trus = geom->FillTRU(digits) ;
184 //Do Cell Sliding and select Trigger
186 for(Int_t iSM = 1 ; iSM <= nSuperModules ; iSM++) {
188 MakeSlidingCell(trus, iSM, nTRU, nCellsPhi, nCellsEta, max);
190 //cout<<"Max Amplitude in SuperMod "<<iSM<<" TRU1 "<<max[0]
191 //<<" TRU2 "<<max[1]<<" TRU3 "<<max[2]<<endl;
192 SetTriggers(max, nTRU) ;
197 //____________________________________________________________________________
198 void AliEMCALTrigger::Print(const Option_t * opt) const
201 //Prints main parameters
205 AliTriggerInput* in = 0x0 ;
208 AliInfo("EMCAL trigger information:") ;
209 printf( " Threshold for pp MB LO %d\n", fL0MBppThreshold) ;
210 in = (AliTriggerInput*)fInputs.FindObject( "EMCAL_MB_pp_L0" );
212 printf( " *** EMCAL MB pp LO is set ***\n") ;
214 printf( " Threshold for PbPb MB LO %d\n", fL0MBPbPbThreshold) ;
215 in = (AliTriggerInput*)fInputs.FindObject( "EMCAL_MB_PbPb_L0" );
217 printf( " *** EMCAL MB PbPb LO is set ***\n") ;
219 printf( " Jet Low Pt Threshold for PbPb L1 %d\n", fL1JetLowPtThreshold) ;
220 in = (AliTriggerInput*)fInputs.FindObject( "EMCAL_PbPb_JetLPt_L1" );
222 printf( " *** EMCAL Jet Low Pt for PbPb L1 is set ***\n") ;
224 printf( " Jet Medium Pt Threshold for L1 %d\n", fL1JetMediumPtThreshold) ;
225 in = (AliTriggerInput*) fInputs.FindObject( "EMCAL_PbPb_JetMPt_L1" );
227 printf( " *** EMCAL Jet Medium Pt for PbPb L1 is set ***\n") ;
229 printf( " Jet High Pt Threshold for L1 %d\n", fL1JetHighPtThreshold) ;
230 in = (AliTriggerInput*) fInputs.FindObject( "EMCAL_PbPb_JetHPt_L1" );
232 printf( " *** EMCAL Jet High Pt for PbPb L1 is set ***\n") ;
236 //____________________________________________________________________________
237 void AliEMCALTrigger::SetTriggers(const Float_t * amp, const Int_t nTRU)
240 //Checks the maximum amplitude per each TRU and compares with the
241 //different triggers thresholds
244 for(Int_t i = 0 ; i < nTRU ; i++){
249 if(max >= fL0MBppThreshold)
250 SetInput("EMCAL_MB_pp_L0");
251 if(max >= fL0MBPbPbThreshold)
252 SetInput("EMCAL_MB_PbPb_L0");
253 if(max >= fL1JetLowPtThreshold)
254 SetInput("EMCAL_PbPb_JetLPt_L1");
255 if(max >= fL1JetMediumPtThreshold)
256 SetInput("EMCAL_PbPb_JetMPt_L1");
257 if(max >= fL1JetHighPtThreshold)
258 SetInput("EMCAL_PbPb_JetHPt_L1");