From bb38a8fc4bda90479b2293ad6ce24e24aebee92b Mon Sep 17 00:00:00 2001 From: schutz Date: Mon, 27 Feb 2006 17:54:02 +0000 Subject: [PATCH] New comments added to clarify the code --- PHOS/AliPHOSTrigger.cxx | 82 ++++++++++++++++++++++++++--------------- PHOS/AliPHOSTrigger.h | 24 +++++++++--- 2 files changed, 70 insertions(+), 36 deletions(-) diff --git a/PHOS/AliPHOSTrigger.cxx b/PHOS/AliPHOSTrigger.cxx index 60816870b9b..db8884ab2f3 100644 --- a/PHOS/AliPHOSTrigger.cxx +++ b/PHOS/AliPHOSTrigger.cxx @@ -18,11 +18,23 @@ //_________________________________________________________________________ // // 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. -// +// Digits are grouped in TRU's (16x28 crystals ordered fNTRUPhi x fNTRUZ). +// The algorithm searches all possible 4x4 cell combinations per each TRU, +// adding the digits amplitude and finding the maximum. Maximums are compared +// to triggers threshold and they are set. Thresholds need to be fixed. +// Usage: +// +// //Inside the event loop +// AliEMCALTrigger *tr = new AliEMCALTrigger();//Init Trigger +// tr->SetL0MBPbPbThreshold(500); +// tr->SetL0MBppThreshold(100); +// tr->SetL1JetLowPtThreshold(1000); +// tr->SetL1JetMediumPtThreshold(10000); +// tr->SetL1JetHighPtThreshold(20000); +// tr->Trigger(); //Execute Trigger +// tr->Print(""); //Print result, with "deb" option all data members +// //are printed +// //*-- Author: Gustavo Conesa & Yves Schutz (IFIC, CERN) ////////////////////////////////////////////////////////////////////////////// @@ -93,12 +105,17 @@ TClonesArray * AliPHOSTrigger::FillTRU(const TClonesArray * digits, 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. + //Orders digits ampitudes list in fNTRU TRUs (28x16 crystals) per module. + //Each TRU is a TMatrixD, and they are kept in TClonesArrays. The number of + //TRU in phi is fNTRUPhi, and the number of TRU in eta is fNTRUZ. - //Initilize variables + //Check data members + + if(fNTRUZ*fNTRUPhi != fNTRU) + Error("FillTRU"," Wrong number of TRUS per Z or Phi"); - //const AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ; + //Initilize variables + //List of TRU matrices initialized to 0. TClonesArray * matrix = new TClonesArray("TMatrixD",1000); for(Int_t k = 0; k < fNTRU*nModules ; k++){ @@ -114,36 +131,39 @@ TClonesArray * AliPHOSTrigger::FillTRU(const TClonesArray * digits, //Declare variables Int_t relid[4] ; Float_t amp = 0; - + + //Digits loop to fill TRU matrices with amplitudes. + for(Int_t idig = 0 ; idig < digits->GetEntriesFast() ; idig++){ dig = static_cast(digits->At(idig)) ; amp = dig->GetAmp() ; //Energy of the digit (arbitrary units) - geom->AbsToRelNumbering(dig->GetId(), relid) ;//Transform digit number into 4 numbers + geom->AbsToRelNumbering(dig->GetId(), relid) ; + //Transform digit number into 4 numbers //relid[0] = module //relid[1] = EMC (0) or CPV (-1) //relid[2] = row <= 64 (fNPhi) //relid[3] = column <= 56 (fNZ) - if(relid[1] == 0){ - - Int_t ntru = 1; - Int_t row = 1; - Int_t col = 1; - //Check which TRU in the module. It is divided in a (4,2) matrix. - //Fill the TRU matrix (16,28) - - 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[1] == 0){//Not CPV, Only EMC digits + + //Check to which TRU in the supermodule belongs the cell. + //Supermodules are divided in a TRU matrix of dimension + //(fNTRUPhi,fNTRUZ). + //Each TRU is a cell matrix of dimension (nCrystalsPhi,nCrystalsZ) - for(i = 1; i < fNTRUPhi ; i++) - if(relid[2] > nCrystalsPhi*i && relid[2] <= nCrystalsPhi*(i+1)) - row = i+1; + //First calculate the row and column in the supermodule + //of the TRU to which the cell belongs. + + Int_t col = (relid[3]-1)/nCrystalsZ+1; + Int_t row = (relid[2]-1)/nCrystalsPhi+1; + Int_t itru = col*row + (relid[0]-1)*fNTRU - 1; + + //Fill TRU matrix with cell values + + TMatrixD * trus = dynamic_cast(matrix->At(itru)) ; - ntru = col*row + (relid[0]-1)*fNTRU - 1; - TMatrixD * trus = dynamic_cast(matrix->At(ntru)) ; + //Calculate row and column of the cell inside the TRU with number itru Int_t nrow = (relid[2]-1) - (row-1) * nCrystalsPhi; Int_t ncol = (relid[3]-1) - (col-1) * nCrystalsZ; @@ -197,11 +217,13 @@ void AliPHOSTrigger::Trigger() { //Main Method to select triggers. - + //Getter AliPHOSGetter * gime = AliPHOSGetter::Instance() ; + + //Get Geometry + const AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ; //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 diff --git a/PHOS/AliPHOSTrigger.h b/PHOS/AliPHOSTrigger.h index ec37f0699f3..75bb5ca0481 100644 --- a/PHOS/AliPHOSTrigger.h +++ b/PHOS/AliPHOSTrigger.h @@ -3,18 +3,30 @@ //____________________________________________________________ // 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. - +// Class for trigger analysis. +// Digits are grouped in TRU's (16x28 ordered fNTRUPhi x fNTRUEta). +// The algorithm searches all possible 4x4 cell combinations per each TRU, +// adding the digits amplitude and finding the maximum. Maximums are compared +// to triggers threshold and they are set. Thresholds need to be fixed. +// Usage: +// +// //Inside the event loop +// AliEMCALTrigger *tr = new AliEMCALTrigger();//Init Trigger +// tr->SetL0MBPbPbThreshold(500); +// tr->SetL0MBppThreshold(100); +// tr->SetL1JetLowPtThreshold(1000); +// tr->SetL1JetMediumPtThreshold(10000); +// tr->SetL1JetHighPtThreshold(20000); +// tr->Trigger(); //Execute Trigger +// tr->Print(""); //Print result, with "deb" option all data members +// //are printed +// //*-- Author: Gustavo Conesa & Yves Schutz (IFIC, SUBATECH, CERN) // --- ROOT system --- class TClonesArray ; - // --- AliRoot header files --- #include "AliTriggerDetector.h" -- 2.39.3