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 (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
24 // threshold and they are set.
26 //*-- Author: Gustavo Conesa & Yves Schutz (IFIC, CERN)
27 //////////////////////////////////////////////////////////////////////////////
30 // --- ROOT system ---
33 // --- ALIROOT system ---
34 #include "AliPHOSTrigger.h"
35 #include "AliPHOSGeometry.h"
36 #include "AliPHOSGetter.h"
37 #include "AliTriggerInput.h"
40 ClassImp(AliPHOSTrigger)
42 //______________________________________________________________________
43 AliPHOSTrigger::AliPHOSTrigger()
44 : AliTriggerDetector(), fNTRU(8), fNTRUZ(2), fNTRUPhi(4),
45 fL0MBPbPbThreshold(500), fL0MBppThreshold(50),
46 fL1JetLowPtThreshold(1200), fL1JetHighPtThreshold(30000)
58 //____________________________________________________________________________
59 AliPHOSTrigger::AliPHOSTrigger(const AliPHOSTrigger & trig)
60 : AliTriggerDetector(trig)
65 fNTRUZ = trig.fNTRUZ ;
66 fNTRUPhi = trig.fNTRUPhi ;
67 fL0MBPbPbThreshold = trig.fL0MBPbPbThreshold ;
68 fL0MBppThreshold = trig.fL0MBppThreshold ;
69 fL1JetLowPtThreshold = trig.fL1JetLowPtThreshold ;
70 fL1JetHighPtThreshold = trig.fL1JetHighPtThreshold ;
74 //----------------------------------------------------------------------
75 void AliPHOSTrigger::CreateInputs()
79 // Do not create inputs again!!
80 if( fInputs.GetEntriesFast() > 0 ) return;
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 ) );
89 //____________________________________________________________________________
90 TClonesArray * AliPHOSTrigger::FillTRU(const TClonesArray * digits,
91 const AliPHOSGeometry * geom,
93 const Int_t nCrystalsPhi,
94 const Int_t nCrystalsZ) const {
96 //Orders digits ampitudes list in 8 TRUs (16x28 crystals) per module.
97 //Each TRU is a TMatrixD, and they are kept in TClonesArrays.
101 //const AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ;
103 TClonesArray * matrix = new TClonesArray("TMatrixD",1000);
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++)
109 new((*matrix)[k]) TMatrixD(*trus) ;
118 for(Int_t idig = 0 ; idig < digits->GetEntriesFast() ; idig++){
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
124 //relid[1] = EMC (0) or CPV (-1)
125 //relid[2] = row <= 64 (fNPhi)
126 //relid[3] = column <= 56 (fNZ)
133 //Check which TRU in the module. It is divided in a (4,2) matrix.
134 //Fill the TRU matrix (16,28)
137 for(i = 1; i < fNTRUZ ; i++)
138 if(relid[3] > nCrystalsZ*i && relid[3] <= nCrystalsZ*(i+1))
141 for(i = 1; i < fNTRUPhi ; i++)
142 if(relid[2] > nCrystalsPhi*i && relid[2] <= nCrystalsPhi*(i+1))
145 ntru = col*row + (relid[0]-1)*fNTRU - 1;
146 TMatrixD * trus = dynamic_cast<TMatrixD *>(matrix->At(ntru)) ;
148 Int_t nrow = (relid[2]-1) - (row-1) * nCrystalsPhi;
149 Int_t ncol = (relid[3]-1) - (col-1) * nCrystalsZ;
151 (*trus)(nrow,ncol) = amp ;
157 //____________________________________________________________________________
158 void AliPHOSTrigger::MakeSlidingCell(const TClonesArray * trus,
160 const Int_t nCrystalsPhi,
161 const Int_t nCrystalsZ,
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.
170 for(Int_t i = 0 ; i < fNTRU ; i++)
173 //Loop over all TRUS in a module
174 for(Int_t itru = 0 + (mod - 1) * fNTRU ; itru < mod*fNTRU ; itru++){
175 TMatrixD * tru = dynamic_cast<TMatrixD *>(trus->At(itru)) ;
177 //ampmax[itru-(mod-1)*8]=0.0;
178 for(Int_t irow = 0 ; irow < nCrystalsPhi; irow += 2){
179 for(Int_t icol = 0 ; icol < nCrystalsZ ; icol += 2){
181 if( (irow+3) < nCrystalsPhi && (icol+3) < nCrystalsZ){//Avoid exit the TRU
182 for(Int_t i = irow; i < irow + 4 ; i++){
183 for(Int_t j = icol; j < icol + 4 ; j++){
188 if(amp > ampmax[itru-(mod-1)*fNTRU])
189 ampmax[itru-(mod-1)*fNTRU] = amp ;
195 //____________________________________________________________________________
196 void AliPHOSTrigger::Trigger()
199 //Main Method to select triggers.
201 AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
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
209 //Take the digits list and declare digits pointers
210 TClonesArray * digits = gime->Digits() ;
213 TClonesArray * trus = FillTRU(digits,geom, nModules, nCrystalsPhi,
216 //Do Cell Sliding and select Trigger
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;
230 //____________________________________________________________________________
231 void AliPHOSTrigger::Print(const Option_t * opt) const
234 //Prints main parameters
238 AliTriggerInput* in = 0x0 ;
240 AliInfo("PHOS trigger information:") ;
241 printf( " Threshold for pp MB LO %d\n", fL0MBppThreshold) ;
242 in = (AliTriggerInput*)fInputs.FindObject( "PHOS_MB_pp_L0" );
244 printf( " *** PHOS MB pp LO is set ***\n") ;
246 printf( " Threshold for PbPb MB LO %d\n", fL0MBPbPbThreshold) ;
247 in = (AliTriggerInput*)fInputs.FindObject( "PHOS_MB_PbPb_L0" );
249 printf( " *** PHOS MB PbPb LO is set ***\n") ;
251 printf( " Jet Low Pt Threshold for PbPb L1 %d\n", fL1JetLowPtThreshold) ;
252 in = (AliTriggerInput*)fInputs.FindObject( "PHOS_PbPb_JetLPt_L1" );
254 printf( " *** PHOS Jet Low Pt for PbPb L1 is set ***\n") ;
256 printf( " Jet High Pt Threshold for L1 %d\n", fL1JetHighPtThreshold) ;
257 in = (AliTriggerInput*) fInputs.FindObject( "PHOS_PbPb_JetHPt_L1" );
259 printf( " *** PHOS Jet High Pt for PbPb L1 is set ***\n") ;
261 if(strstr(opt,"all")){
262 printf( " Number of TRUs %d\n", fNTRU) ;
263 printf( " Number of crystals in Z in TRUs %d\n",
265 printf( " Number of crystals in Phi in TRUs %d\n",
270 //____________________________________________________________________________
271 void AliPHOSTrigger::SetTriggers(const Float_t * amp)
274 //Checks the maximum amplitude per each TRU and compares with the
275 //different triggers thresholds
278 for(Int_t i = 0 ; i < 8 ; i++){
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");