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 threshold
25 // FIRST ATTEMPT TO MAKE A TRIGGER CLASS. IT WILL CHANGE WHEN CENTRAL TRIGGER CLASS FIXES
28 //*-- Author: Gustavo Conesa & Yves Schutz (IFIC, CERN)
29 //////////////////////////////////////////////////////////////////////////////
32 // --- ROOT system ---
35 // --- ALIROOT system ---
36 #include "AliPHOSTrigger.h"
37 #include "AliPHOSGeometry.h"
38 #include "AliPHOSGetter.h"
41 ClassImp(AliPHOSTrigger)
43 //____________________________________________________________________________
44 AliPHOSTrigger::AliPHOSTrigger() : TObject(),
45 fL0(kFALSE), fL1Low(kFALSE), fL1Medium(kFALSE),
46 fL1High(kFALSE), fL0Threshold(50), fL1LowThreshold(1200),
47 fL1MediumThreshold(12000), fL1HighThreshold(30000)
53 //____________________________________________________________________________
54 AliPHOSTrigger::AliPHOSTrigger(const AliPHOSTrigger & trig) : TObject(trig)
60 fL1Low = trig.fL1Low ;
61 fL1Medium = trig.fL1Medium ;
62 fL1High = trig.fL1High ;
63 fL0Threshold = trig.fL0Threshold ;
64 fL1LowThreshold = trig.fL1LowThreshold ;
65 fL1MediumThreshold = trig.fL1MediumThreshold ;
66 fL1HighThreshold = trig.fL1HighThreshold ;
70 //____________________________________________________________________________
71 TClonesArray * AliPHOSTrigger::FillTRU(const TClonesArray * digits){
73 //Orders digits ampitudes list in 8 TRUs (16x28 crystals) per module.
74 //Each TRU is a TMatrixD, and they are kept in TClonesArrays.
78 const AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ;
80 TClonesArray * matrix = new TClonesArray("TMatrixD",1000);
81 for(Int_t k = 0; k < 40 ; k++){
82 TMatrixD * trus = new TMatrixD(16,28) ;
83 for(Int_t i = 0; i < 16; i++)
84 for(Int_t j = 0; j < 28; j++)
86 new((*matrix)[k]) TMatrixD(*trus) ;
91 //Declare different variables
95 for(Int_t idig = 0 ; idig < digits->GetEntriesFast() ; idig++){
97 dig = static_cast<AliPHOSDigit *>(digits->At(idig)) ;
98 amp = dig->GetAmp() ; //Energy of the digit (arbitrary units)
99 geom->AbsToRelNumbering(dig->GetId(), relid) ;//Transform digit number into 4 numbers
101 //relid[1] = EMC (0) or CPV (-1)
102 //relid[2] = row <= 64 (fNPhi)
103 //relid[3] = column <= 56 (fNZ)
110 //Check which TRU in the module. It is divided in a (4,2) matrix.
111 //Fill the TRU matrix (16,28)
115 if(relid[2] > 16 && relid[2] <= 32)
118 if(relid[2] > 32 && relid[2] <= 48)
124 ntru = col*row + (relid[0]-1)*8 - 1;
125 TMatrixD * trus = dynamic_cast<TMatrixD *>(matrix->At(ntru)) ;
127 Int_t nrow = (relid[2]-1) - (row-1) * 16 ;
128 Int_t ncol = (relid[3]-1) - (col-1) * 28 ;
130 (*trus)(nrow,ncol) = amp ;
136 //____________________________________________________________________________
137 void AliPHOSTrigger::InitTriggers()
139 //Initialize Boolean variables per each event
147 //____________________________________________________________________________
148 void AliPHOSTrigger::MakeSlidingCell(const TClonesArray * trus, const Int_t mod,
151 //Sums energy of all possible 4x4 crystals per each TRU. Fast signal
152 //in the experiment is given by 2x2 crystals, for this reason we loop
153 //inside the TRU crystals by 2.
157 for(Int_t i = 0 ; i < 8 ; i++)
160 //Loop over all TRUS in a module
161 for(Int_t itru = 0 + (mod - 1) * 8 ; itru < mod*8 ; itru++){
162 TMatrixD * tru = dynamic_cast<TMatrixD *>(trus->At(itru)) ;
164 //ampmax[itru-(mod-1)*8]=0.0;
165 for(Int_t irow = 0 ; irow < 16 ; irow += 2){
166 for(Int_t icol = 0 ; icol < 28 ; icol += 2){
168 if( (irow+4) < 16 && (icol+4) < 28){//Avoid exit the TRU
169 for(Int_t i = irow; i < irow + 4 ; i++){
170 for(Int_t j = icol; j < icol + 4 ; j++){
175 if(amp > ampmax[itru-(mod-1)*8])
176 ampmax[itru-(mod-1)*8] = amp ;
182 //____________________________________________________________________________
183 void AliPHOSTrigger::MakeTrigger()
186 //Main Method to select triggers.
188 InitTriggers() ; //Initialize triggers to kFALSE
190 AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
192 //Take the digits list and declare digits pointers
193 TClonesArray * digits = gime->Digits() ;
195 TClonesArray * trus = FillTRU(digits);
197 //Do Cell Sliding and select Trigger
199 for(Int_t imod = 1 ; imod <= 5 ; imod++) {
200 MakeSlidingCell(trus, imod, max);
206 //____________________________________________________________________________
207 void AliPHOSTrigger::Print(const Option_t * opt) const
210 //Prints main parameters
215 AliInfo("PHOS trigger information:") ;
216 printf( " Threshold for LO %d\n", fL0Threshold) ;
217 printf( " Low Threshold for L1 %d\n", fL1LowThreshold) ;
218 printf( " Medium Threshold for L1 %d\n", fL1MediumThreshold) ;
219 printf( " High Threshold for L1 %d\n", fL1HighThreshold) ;
221 printf(" LO is set\n") ;
223 printf(" LO is not set\n") ;
225 printf(" L1 Low is set\n") ;
227 printf(" L1 Low is not set\n") ;
228 if ( IsL1MediumSet() )
229 printf(" L1 Medium is set\n") ;
231 printf(" L1 Medium is not set\n") ;
233 printf(" L1 High is set\n") ;
235 printf(" L1 High is not set\n") ;
239 //____________________________________________________________________________
240 void AliPHOSTrigger::SetTriggers(const Float_t * amp)
243 //Checks the maximum amplitude per each TRU and compares with the
244 //different triggers thresholds
247 for(Int_t i = 0 ; i < 8 ; i++){
252 if(max >= fL0Threshold){
254 if(max >= fL1LowThreshold){
256 if(max >= fL1MediumThreshold){
258 if(max >= fL1HighThreshold){