// Class for trigger analysis.
// Digits are grouped in TRU's (16x28 crystals). The algorithm searches all
// possible 4x4 crystal combinations and per each TRU, adding the digits
-// amplitude and finding the maximum. Maximums are compared to triggers threshold
-// and they are set.
-// FIRST ATTEMPT TO MAKE A TRIGGER CLASS. IT WILL CHANGE WHEN CENTRAL TRIGGER CLASS FIXES
-// THINGS
+// amplitude and finding the maximum. Maximums are compared to triggers
+// threshold and they are set.
//
//*-- Author: Gustavo Conesa & Yves Schutz (IFIC, CERN)
//////////////////////////////////////////////////////////////////////////////
//______________________________________________________________________
AliPHOSTrigger::AliPHOSTrigger()
- : AliTriggerDetector(), fL0Threshold(50), fL1LowThreshold(1200),
- fL1MediumThreshold(12000), fL1HighThreshold(30000)
+ : AliTriggerDetector(), fNTRU(8), fNTRUZ(2), fNTRUPhi(4), fL0Threshold(50),
+ fL1LowThreshold(1200), fL1MediumThreshold(12000), fL1HighThreshold(30000)
{
//ctor
SetName("PHOS");
CreateInputs();
- Print("") ;
+ //Print("all") ;
}
{
// cpy ctor
-
+ fNTRU = trig.fNTRU ;
+ fNTRUZ = trig.fNTRUZ ;
+ fNTRUPhi = trig.fNTRUPhi ;
fL0Threshold = trig.fL0Threshold ;
fL1LowThreshold = trig.fL1LowThreshold ;
fL1MediumThreshold = trig.fL1MediumThreshold ;
}
//____________________________________________________________________________
-TClonesArray * AliPHOSTrigger::FillTRU(const TClonesArray * digits){
+TClonesArray * AliPHOSTrigger::FillTRU(const TClonesArray * digits,
+ const AliPHOSGeometry * geom,
+ const Int_t nModules,
+ const Int_t nCrystalsPhi,
+ const Int_t nCrystalsZ) const {
//Orders digits ampitudes list in 8 TRUs (16x28 crystals) per module.
//Each TRU is a TMatrixD, and they are kept in TClonesArrays.
//Initilize variables
- const AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ;
+ //const AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ;
TClonesArray * matrix = new TClonesArray("TMatrixD",1000);
- for(Int_t k = 0; k < 40 ; k++){
- TMatrixD * trus = new TMatrixD(16,28) ;
- for(Int_t i = 0; i < 16; i++)
- for(Int_t j = 0; j < 28; j++)
+ for(Int_t k = 0; k < fNTRU*nModules ; k++){
+ TMatrixD * trus = new TMatrixD(nCrystalsPhi,nCrystalsZ) ;
+ for(Int_t i = 0; i < nCrystalsPhi; i++)
+ for(Int_t j = 0; j < nCrystalsZ; j++)
(*trus)(i,j) = 0.0;
new((*matrix)[k]) TMatrixD(*trus) ;
}
AliPHOSDigit * dig ;
- //Declare different variables
+ //Declare variables
Int_t relid[4] ;
Float_t amp = 0;
Int_t col = 1;
//Check which TRU in the module. It is divided in a (4,2) matrix.
//Fill the TRU matrix (16,28)
- if(relid[3] > 28)
- col = 2;
-
- if(relid[2] > 16 && relid[2] <= 32)
- row = 2;
- if(relid[2] > 32 && relid[2] <= 48)
- row = 3;
+ Int_t i = 0 ;
+ for(i = 1; i < fNTRUZ ; i++)
+ if(relid[3] > nCrystalsZ*i && relid[3] <= nCrystalsZ*(i+1))
+ col = i+1;
- if(relid[2] > 48)
- row = 4;
-
- ntru = col*row + (relid[0]-1)*8 - 1;
+ for(i = 1; i < fNTRUPhi ; i++)
+ if(relid[2] > nCrystalsPhi*i && relid[2] <= nCrystalsPhi*(i+1))
+ row = i+1;
+
+ ntru = col*row + (relid[0]-1)*fNTRU - 1;
TMatrixD * trus = dynamic_cast<TMatrixD *>(matrix->At(ntru)) ;
-
- Int_t nrow = (relid[2]-1) - (row-1) * 16 ;
- Int_t ncol = (relid[3]-1) - (col-1) * 28 ;
+
+ Int_t nrow = (relid[2]-1) - (row-1) * nCrystalsPhi;
+ Int_t ncol = (relid[3]-1) - (col-1) * nCrystalsZ;
(*trus)(nrow,ncol) = amp ;
}
}
//____________________________________________________________________________
-void AliPHOSTrigger::MakeSlidingCell(const TClonesArray * trus, const Int_t mod,
+void AliPHOSTrigger::MakeSlidingCell(const TClonesArray * trus,
+ const Int_t mod,
+ const Int_t nCrystalsPhi,
+ const Int_t nCrystalsZ,
Float_t *ampmax){
//Sums energy of all possible 4x4 crystals per each TRU. Fast signal
Float_t amp = 0 ;
- for(Int_t i = 0 ; i < 8 ; i++)
+ for(Int_t i = 0 ; i < fNTRU ; i++)
ampmax[i] = 0 ;
//Loop over all TRUS in a module
- for(Int_t itru = 0 + (mod - 1) * 8 ; itru < mod*8 ; itru++){
+ for(Int_t itru = 0 + (mod - 1) * fNTRU ; itru < mod*fNTRU ; itru++){
TMatrixD * tru = dynamic_cast<TMatrixD *>(trus->At(itru)) ;
//Sliding 2x2 cell
//ampmax[itru-(mod-1)*8]=0.0;
- for(Int_t irow = 0 ; irow < 16 ; irow += 2){
- for(Int_t icol = 0 ; icol < 28 ; icol += 2){
+ for(Int_t irow = 0 ; irow < nCrystalsPhi; irow += 2){
+ for(Int_t icol = 0 ; icol < nCrystalsZ ; icol += 2){
amp = 0;
- if( (irow+4) < 16 && (icol+4) < 28){//Avoid exit the TRU
+ if( (irow+3) < nCrystalsPhi && (icol+3) < nCrystalsZ){//Avoid exit the TRU
for(Int_t i = irow; i < irow + 4 ; i++){
for(Int_t j = icol; j < icol + 4 ; j++){
amp += (*tru)(i,j) ;
}
}
}
- if(amp > ampmax[itru-(mod-1)*8])
- ampmax[itru-(mod-1)*8] = amp ;
+ if(amp > ampmax[itru-(mod-1)*fNTRU])
+ ampmax[itru-(mod-1)*fNTRU] = amp ;
}
}
}
//Main Method to select triggers.
- //InitTriggers() ; //Initialize triggers to kFALSE
-
AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
-
+
+ //Define some useful parameters
+ const AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ;
+ Int_t nModules = geom->GetNModules();
+ Int_t nCrystalsPhi = geom->GetNPhi()/fNTRUPhi ;// 64/4=16
+ Int_t nCrystalsZ = geom->GetNZ()/fNTRUZ ;// 56/2=28
+
//Take the digits list and declare digits pointers
TClonesArray * digits = gime->Digits() ;
+
//Fill TRU Matrix
- TClonesArray * trus = FillTRU(digits);
+ TClonesArray * trus = FillTRU(digits,geom, nModules, nCrystalsPhi,
+ nCrystalsZ) ;
//Do Cell Sliding and select Trigger
Float_t max [8] ;
- for(Int_t imod = 1 ; imod <= 5 ; imod++) {
- MakeSlidingCell(trus, imod, max);
+ for(Int_t imod = 1 ; imod <= nModules ; imod++) {
+ MakeSlidingCell(trus, imod, nCrystalsPhi, nCrystalsZ, max);
+// cout<<" Max Amplitude: mod " << imod <<" TRU0 " << max[0]
+// <<" TRU1 " << max[1] <<" TRU2 " << max[2] <<" TRU3 " << max[3]
+// <<" TRU4 " << max[4] <<" TRU5 " << max[5] <<" TRU6 " << max[6]
+// <<" TRU7 " << max[7] <<endl;
+
SetTriggers(max) ;
}
in = (AliTriggerInput*) fInputs.FindObject( "PHOS_HPt_L1" );
if(in->GetValue())
printf( " PHOS High Pt L1 is set\n") ;
-
+
+ if(strstr(opt,"all")){
+ printf( " Number of TRUs %d\n", fNTRU) ;
+ printf( " Number of crystals in Z in TRUs %d\n",
+ fNTRUZ) ;
+ printf( " Number of crystals in Phi in TRUs %d\n",
+ fNTRUPhi) ;
+ }
}
//____________________________________________________________________________
if(max < amp[i] )
max = amp[i] ;
}
+
if(max >= fL0Threshold){
SetInput("PHOS_MB_L0");
if(max >= fL1LowThreshold){
virtual void CreateInputs();
virtual void Trigger(); //Make PHOS trigger
-
+ const Int_t GetNTRU() const {return fNTRU ; }
+ const Int_t GetNTRUZ() const {return fNTRUZ ; }
+ const Int_t GetNTRUPhi() const {return fNTRUPhi ; }
const Int_t GetL0Threshold() const {return fL0Threshold ; }
const Int_t GetL1LowThreshold() const {return fL1LowThreshold ; }
const Int_t GetL1MediumThreshold() const {return fL1MediumThreshold ; }
void Print(const Option_t * opt ="") const ;
+ void SetNTRU(Int_t ntru) {fNTRU = ntru; }
+ void SetNTRUZ(Int_t ntru) {fNTRUZ = ntru; }
+ void SetNTRUPhi(Int_t ntru) {fNTRUPhi = ntru; }
void SetL0Threshold(Int_t amp) {fL0Threshold = amp; }
void SetL1LowThreshold(Int_t amp) {fL1LowThreshold = amp; }
void SetL1MediumThreshold(Int_t amp){fL1MediumThreshold = amp; }
void SetL1HighThreshold(Int_t amp) {fL1HighThreshold = amp; }
private:
- TClonesArray * FillTRU(const TClonesArray * digits) ;
- void MakeSlidingCell(const TClonesArray * trus, const Int_t mod,
+ TClonesArray * FillTRU(const TClonesArray * digits,
+ const AliPHOSGeometry * geom, const Int_t nModules,
+ const Int_t nCrystalsPhi, const Int_t nCrystalsZ) const ;
+ void MakeSlidingCell(const TClonesArray * trus, const Int_t mod,
+ const Int_t nCrystalsPhi, const Int_t nCrystalsZ,
Float_t *ampmax) ;
void SetTriggers(const Float_t * ampmax) ;
private:
+ Int_t fNTRU ; //! Number of TRUs per module
+ Int_t fNTRUZ ; //! Number of crystal rows per Z in one TRU
+ Int_t fNTRUPhi ; //! Number of crystal rows per Phi in one TRU
Int_t fL0Threshold ; //! L0 trigger energy threshold
Int_t fL1LowThreshold ; //! High pT trigger energy threshold
Int_t fL1MediumThreshold ; //!
Int_t fL1HighThreshold ; //!
- ClassDef(AliPHOSTrigger,1)
+ ClassDef(AliPHOSTrigger,2)
} ;