* provided "as is" without express or implied warranty. *
**************************************************************************/
/* $Id$ */
-
+/* $Log $ */
//_________________________________________________________________________
//
// 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.
-// Last 2 modules are half size but they are treated as fullsize, then their
-// TRU should be smaller. When this is fixed, class will be updated.
+// Last 2 modules are half size in Phi, I considered that the number of TRU
+// is maintained for the last modules but decision not taken. If different,
+// then this must be changed.
// Usage:
//
// //Inside the event loop
// AliEMCALTrigger *tr = new AliEMCALTrigger();//Init Trigger
-// tr->SetL0MBPbPbThreshold(500);
-// tr->SetL0MBppThreshold(100);
+// tr->SetL0Threshold(100);
// tr->SetL1JetLowPtThreshold(1000);
// tr->SetL1JetMediumPtThreshold(10000);
// tr->SetL1JetHighPtThreshold(20000);
// --- ROOT system ---
-#include "TMatrixD.h"
+//#include "TMatrixD.h"
// --- ALIROOT system ---
//______________________________________________________________________
AliEMCALTrigger::AliEMCALTrigger()
: AliTriggerDetector(),
- fL0MBPbPbThreshold(500), fL0MBppThreshold(50),fL1JetLowPtThreshold(1000),
- fL1JetMediumPtThreshold(10000), fL1JetHighPtThreshold(20000)
+ f2x2MaxAmp(-1), f2x2CellPhi(-1), f2x2CellEta(-1),
+ f4x4MaxAmp(-1), f4x4CellPhi(-1), f4x4CellEta(-1),
+ fL0Threshold(100),fL1JetLowPtThreshold(200),
+ fL1JetMediumPtThreshold(500), fL1JetHighPtThreshold(1000),
+ fSimulation(kTRUE)
+
{
- //ctor
+ //ctor
+
+ fADCValuesHigh4x4 = 0x0; //new Int_t[fTimeBins];
+ fADCValuesLow4x4 = 0x0; //new Int_t[fTimeBins];
+ fADCValuesHigh2x2 = 0x0; //new Int_t[fTimeBins];
+ fADCValuesLow2x2 = 0x0; //new Int_t[fTimeBins];
+
+ fDigitsList = 0x0 ;
- SetName("EMCAL");
- CreateInputs();
+
+ SetName("EMCAL");
+ CreateInputs();
- //Print("all") ;
+ //Print("") ;
}
{
// cpy ctor
-
- fL0MBPbPbThreshold = trig.fL0MBPbPbThreshold ;
- fL0MBppThreshold = trig.fL0MBppThreshold ;
+
+ f2x2MaxAmp = trig.f2x2MaxAmp ;
+ f4x4MaxAmp = trig.f4x4MaxAmp ;
+ f2x2CellPhi = trig.f2x2CellPhi ;
+ f4x4CellPhi = trig.f4x4CellPhi ;
+ f2x2CellEta = trig.f2x2CellEta ;
+ f4x4CellEta = trig.f4x4CellEta ;
+ fADCValuesHigh4x4 = trig.fADCValuesHigh4x4 ;
+ fADCValuesLow4x4 = trig.fADCValuesLow4x4 ;
+ fADCValuesHigh2x2 = trig.fADCValuesHigh2x2 ;
+ fADCValuesLow2x2 = trig.fADCValuesLow2x2 ;
+ fDigitsList = trig.fDigitsList ;
+ fL0Threshold = trig.fL0Threshold ;
fL1JetLowPtThreshold = trig.fL1JetLowPtThreshold ;
fL1JetMediumPtThreshold = trig.fL1JetMediumPtThreshold ;
fL1JetHighPtThreshold = trig.fL1JetHighPtThreshold ;
+ fSimulation = trig.fSimulation ;
+
+
}
// Do not create inputs again!!
if( fInputs.GetEntriesFast() > 0 ) return;
- fInputs.AddLast( new AliTriggerInput( "EMCAL_MB_PbPb_L0", "EMCAL PbPb Minimum Bias L0", 0x01 ) );
- fInputs.AddLast( new AliTriggerInput( "EMCAL_MB_pp_L0", "EMCAL pp Minimum Bias L0", 0x02 ) );
- fInputs.AddLast( new AliTriggerInput( "EMCAL_PbPb_JetHPt_L1", "EMCAL PbPb Jet High Pt L1", 0x04 ) );
- fInputs.AddLast( new AliTriggerInput( "EMCAL_PbPb_JetMPt_L1", "EMCAL PbPb Jet Medium Pt L1", 0x08 ) );
- fInputs.AddLast( new AliTriggerInput( "EMCAL_PbPb_JetLPt_L1", "EMCAL PbPb Jet Low Pt L1", 0x016 ) );
+ fInputs.AddLast( new AliTriggerInput( "EMCAL_L0", "EMCAL L0", 0x02 ) );
+ fInputs.AddLast( new AliTriggerInput( "EMCAL_JetHPt_L1","EMCAL Jet High Pt L1", 0x04 ) );
+ fInputs.AddLast( new AliTriggerInput( "EMCAL_JetMPt_L1","EMCAL Jet Medium Pt L1", 0x08 ) );
+ fInputs.AddLast( new AliTriggerInput( "EMCAL_JetLPt_L1","EMCAL Jet Low Pt L1", 0x016 ) );
}
//____________________________________________________________________________
-void AliEMCALTrigger::MakeSlidingCell(const TClonesArray * trus ,
- const Int_t isupermod,
- const Int_t nTRU,
- const Int_t nCellsPhi,
- const Int_t nCellsEta,
- Float_t *ampmax){
-
- //Sums energy of all possible 4x4 cells per each TRU. Fast signal
- //in the experiment is given by 2x2 cells, for this reason we loop
- //inside the TRU cells by 2.
+void AliEMCALTrigger::MakeSlidingCell(const TClonesArray * amptrus, const TClonesArray * timeRtrus, const Int_t isupermod,TMatrixD *ampmax2, TMatrixD *ampmax4, AliEMCALGeometry *geom){
- Float_t amp = 0 ;
+ //Sums energy of all possible 2x2 (L0) and 4x4 (L1) cells per each TRU.
+ //Fast signal in the experiment is given by 2x2 cells,
+ //for this reason we loop inside the TRU cells by 2.
- for(Int_t i = 0 ; i < nTRU ; i++)
- ampmax[i] = 0 ;
-
- //Loop over all TRUS in the seleted supermodule
- for(Int_t itru = 0 + (isupermod - 1) * nTRU ; itru < isupermod*nTRU ; itru++)
- {
- TMatrixD * tru = dynamic_cast<TMatrixD *>(trus->At(itru)) ;
-
- //Sliding 2x2 cell
- for(Int_t irow = 0 ; irow < nCellsPhi; irow += 2){
- for(Int_t icol = 0 ; icol < nCellsEta ; icol += 2){
- amp = 0;
- if( (irow+3) < nCellsPhi && (icol+3) < nCellsEta){//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-(isupermod-1)*nTRU])
- ampmax[itru-(isupermod-1)*nTRU] = amp ;
-
- }
- }
- }
-}
-
-//____________________________________________________________________________
-void AliEMCALTrigger::Trigger()
-{
-
- //Main Method to select triggers.
- //Loader
- AliRunLoader *rl = AliRunLoader::GetRunLoader();
- AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>
- (rl->GetDetectorLoader("EMCAL"));
-
- //Load EMCAL Geometry
- rl->LoadgAlice();
- AliRun * gAlice = rl->GetAliRun();
- AliEMCAL * emcal = (AliEMCAL*)gAlice->GetDetector("EMCAL");
- AliEMCALGeometry * geom = emcal->GetGeometry();
- //AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance();
-
- if (geom==0)
- AliFatal("Did not get geometry from EMCALLoader");
-
- //Define some useful parameters
-
- Int_t nSuperModules = geom->GetNumberOfSuperModules() ; //12 SM in EMCAL
- Int_t nTRU = geom->GetNTRU();//3 TRU per super module
+ //Declare and initialize variables
Int_t nCellsPhi = geom->GetNPhi()*2/geom->GetNTRUPhi() ;
+ if(isupermod > 10)
+ nCellsPhi = nCellsPhi / 2 ; //Half size SM. Not Final.
// 12(tow)*2(cell)/1 TRU, cells in Phi in one TRU
Int_t nCellsEta = geom->GetNEta()*2/geom->GetNTRUEta() ;
// 24(mod)*2(tower)/3 TRU, cells in Eta in one TRU
+ Int_t nTRU = geom->GetNTRU();//3 TRU per super module
- //Info("Trigger","nSuperModules %d, nCellsPhi %d, nCellsEta %d",
- // nSuperModules, nCellsPhi,nCellsEta);
-
- //Take the digits list and declare digits pointers
- TClonesArray * digits = emcalLoader->Digits(); //gime->Digits() ;
-
- TClonesArray * trus = geom->FillTRU(digits) ;
+ Float_t amp2 = 0 ;
+ Float_t amp4 = 0 ;
+ for(Int_t i = 0; i < 3; i++){
+ for(Int_t j = 0; j < nTRU; j++){
+ (*ampmax2)(i,j) = -1;
+ (*ampmax4)(i,j) = -1;
+ }
+ }
- //Do Cell Sliding and select Trigger
- Float_t max [10] ;
- for(Int_t iSM = 1 ; iSM <= nSuperModules ; iSM++) {
+ //Create matrix that will contain 2x2 amplitude sums
+ //used to calculate the 4x4 sums
+ TMatrixD * tru2x2 = new TMatrixD(nCellsPhi/2,nCellsEta/2) ;
+ for(Int_t i = 0; i < nCellsPhi/2; i++)
+ for(Int_t j = 0; j < nCellsEta/2; j++)
+ (*tru2x2)(i,j) = -1;
+
+ //Loop over all TRUS in a supermodule
+ for(Int_t itru = 0 + (isupermod - 1) * nTRU ; itru < isupermod*nTRU ; itru++) {
+ TMatrixD * amptru = dynamic_cast<TMatrixD *>(amptrus->At(itru)) ;
+ TMatrixD * timeRtru = dynamic_cast<TMatrixD *>(timeRtrus->At(itru)) ;
+ Int_t mtru = itru-(isupermod-1)*nTRU ; //Number of TRU in Supermodule
- MakeSlidingCell(trus, iSM, nTRU, nCellsPhi, nCellsEta, max);
-
- //cout<<"Max Amplitude in SuperMod "<<iSM<<" TRU1 "<<max[0]
- //<<" TRU2 "<<max[1]<<" TRU3 "<<max[2]<<endl;
- SetTriggers(max, nTRU) ;
+ //Sliding 2x2, add 2x2 amplitudes (NOT OVERLAP)
+ for(Int_t irow = 0 ; irow < nCellsPhi; irow += 2){
+ for(Int_t icol = 0 ; icol < nCellsEta ; icol += 2){
+ amp2 = (*amptru)(irow,icol)+(*amptru)(irow+1,icol)+
+ (*amptru)(irow,icol+1)+(*amptru)(irow+1,icol+1);
+ //Fill matrix with added 2x2 crystals for use in 4x4 sums
+ (*tru2x2)(irow/2,icol/2) = amp2 ;
+ //Select 2x2 maximum sums to select L0
+ if(amp2 > (*ampmax2)(0,mtru)){
+ (*ampmax2)(0,mtru) = amp2 ;
+ (*ampmax2)(1,mtru) = irow;
+ (*ampmax2)(2,mtru) = icol;
+ }
+ }
+ }
+
+ //Find most recent time in the selected 2x2 cell
+ (*ampmax2)(3,mtru) = 1 ;
+ Int_t row2 = static_cast <Int_t> ((*ampmax2)(1,mtru));
+ Int_t col2 = static_cast <Int_t> ((*ampmax2)(2,mtru));
+ for(Int_t i = 0; i<2; i++){
+ for(Int_t j = 0; j<2; j++){
+ if((*amptru)(row2+i,col2+j) > 0 && (*timeRtru)(row2+i,col2+j)> 0){
+ if((*timeRtru)(row2+i,col2+j) < (*ampmax2)(3,mtru) )
+ (*ampmax2)(3,mtru) = (*timeRtru)(row2+i,col2+j);
+ }
+ }
+ }
+
+ //Sliding 4x4, add 4x4 amplitudes (OVERLAP)
+ for(Int_t irow = 0 ; irow < nCellsPhi/2; irow++){
+ for(Int_t icol = 0 ; icol < nCellsEta/2 ; icol++){
+ if( (irow+1) < nCellsPhi/2 && (icol+1) < nCellsEta/2){//Avoid exit the TRU
+ amp4 = (*tru2x2)(irow,icol)+(*tru2x2)(irow+1,icol)+
+ (*tru2x2)(irow,icol+1)+(*tru2x2)(irow+1,icol+1);
+ //Select 4x4 maximum sums to select L1
+ if(amp4 > (*ampmax4)(0,mtru)){
+ (*ampmax4)(0,mtru) = amp4 ;
+ (*ampmax4)(1,mtru) = irow*2;
+ (*ampmax4)(2,mtru) = icol*2;
+ }
+ }
+ }
+ }
+
+ //Find most recent time in selected 4x4 cell
+ (*ampmax4)(3,mtru) = 1 ;
+ Int_t row4 = static_cast <Int_t> ((*ampmax4)(1,mtru));
+ Int_t col4 = static_cast <Int_t> ((*ampmax4)(2,mtru));
+ for(Int_t i = 0; i<4; i++){
+ for(Int_t j = 0; j<4; j++){
+ if((*amptru)(row4+i,col4+j) > 0 && (*timeRtru)(row4+i,col4+j)> 0){
+ if((*timeRtru)(row4+i,col4+j) < (*ampmax4)(3,mtru) )
+ (*ampmax4)(3,mtru) = (*timeRtru)(row4+i,col4+j);
+ }
+ }
+ }
}
-
}
//____________________________________________________________________________
if(! opt)
return;
AliTriggerInput* in = 0x0 ;
-
-
- AliInfo("EMCAL trigger information:") ;
- printf( " Threshold for pp MB LO %d\n", fL0MBppThreshold) ;
- in = (AliTriggerInput*)fInputs.FindObject( "EMCAL_MB_pp_L0" );
- if(in->GetValue())
- printf( " *** EMCAL MB pp LO is set ***\n") ;
-
- printf( " Threshold for PbPb MB LO %d\n", fL0MBPbPbThreshold) ;
- in = (AliTriggerInput*)fInputs.FindObject( "EMCAL_MB_PbPb_L0" );
+
+ printf( " Maximum Amplitude after Sliding Cell, \n") ;
+ printf( " -2x2 cells sum (not overlapped): %10.2f, in Super Module %d\n",
+ f2x2MaxAmp,f2x2SM) ;
+ printf( " -2x2 from row %d to row %d and from column %d to column %d\n", f2x2CellPhi, f2x2CellPhi+2, f2x2CellEta, f2x2CellEta+2) ;
+ printf( " -4x4 cells sum (overlapped) : %10.2f, in Super Module %d\n",
+ f4x4MaxAmp,f4x4SM) ;
+ printf( " -4x4 from row %d to row %d and from column %d to column %d\n", f4x4CellPhi, f4x4CellPhi+4, f4x4CellEta, f4x4CellEta+4) ;
+ printf( " Threshold for LO %10.2f\n",
+ fL0Threshold) ;
+ in = (AliTriggerInput*)fInputs.FindObject( "EMCAL_L0" );
if(in->GetValue())
- printf( " *** EMCAL MB PbPb LO is set ***\n") ;
+ printf( " *** EMCAL LO is set ***\n") ;
- printf( " Jet Low Pt Threshold for PbPb L1 %d\n", fL1JetLowPtThreshold) ;
- in = (AliTriggerInput*)fInputs.FindObject( "EMCAL_PbPb_JetLPt_L1" );
+ printf( " Jet Low Pt Threshold for L1 %10.2f\n",
+ fL1JetLowPtThreshold) ;
+ in = (AliTriggerInput*)fInputs.FindObject( "EMCAL_JetLPt_L1" );
if(in->GetValue())
- printf( " *** EMCAL Jet Low Pt for PbPb L1 is set ***\n") ;
+ printf( " *** EMCAL Jet Low Pt for L1 is set ***\n") ;
- printf( " Jet Medium Pt Threshold for L1 %d\n", fL1JetMediumPtThreshold) ;
- in = (AliTriggerInput*) fInputs.FindObject( "EMCAL_PbPb_JetMPt_L1" );
+ printf( " Jet Medium Pt Threshold for L1 %10.2f\n",
+ fL1JetMediumPtThreshold) ;
+ in = (AliTriggerInput*) fInputs.FindObject( "EMCAL_JetMPt_L1" );
if(in->GetValue())
- printf( " *** EMCAL Jet Medium Pt for PbPb L1 is set ***\n") ;
+ printf( " *** EMCAL Jet Medium Pt for L1 is set ***\n") ;
- printf( " Jet High Pt Threshold for L1 %d\n", fL1JetHighPtThreshold) ;
- in = (AliTriggerInput*) fInputs.FindObject( "EMCAL_PbPb_JetHPt_L1" );
+ printf( " Jet High Pt Threshold for L1 %10.2f\n",
+ fL1JetHighPtThreshold) ;
+ in = (AliTriggerInput*) fInputs.FindObject( "EMCAL_JetHPt_L1" );
if(in->GetValue())
- printf( " *** EMCAL Jet High Pt for PbPb L1 is set ***\n") ;
+ printf( " *** EMCAL Jet High Pt for L1 is set ***\n") ;
}
//____________________________________________________________________________
-void AliEMCALTrigger::SetTriggers(const Float_t * amp, const Int_t nTRU)
+void AliEMCALTrigger::SetTriggers(const Int_t iSM, const TMatrixD *ampmax2,
+ const TMatrixD *ampmax4, AliEMCALGeometry *geom)
{
- //Checks the maximum amplitude per each TRU and compares with the
- //different triggers thresholds
+ //Checks the 2x2 and 4x4 maximum amplitude per each TRU and
+ //compares with the different L0 and L1 triggers thresholds
+ Float_t max2[] = {-1,-1,-1,-1} ;
+ Float_t max4[] = {-1,-1,-1,-1} ;
+ Int_t itru2 = -1 ;
+ Int_t itru4 = -1 ;
- Float_t max = 0;
- for(Int_t i = 0 ; i < nTRU ; i++){
- if(max < amp[i] )
- max = amp[i] ;
+ //Find maximum summed amplitude of all the TRU
+ //in a Super Module
+ for(Int_t i = 0 ; i < geom->GetNTRU() ; i++){
+ if(max2[0] < (*ampmax2)(0,i) ){
+ max2[0] = (*ampmax2)(0,i) ; // 2x2 summed max amplitude
+ max2[1] = (*ampmax2)(1,i) ; // corresponding phi position in TRU
+ max2[2] = (*ampmax2)(2,i) ; // corresponding eta position in TRU
+ max2[3] = (*ampmax2)(3,i) ; // corresponding most recent time
+ itru2 = i ;
+ }
+ if(max4[4] < (*ampmax4)(0,i) ){
+ max4[0] = (*ampmax4)(0,i) ; // 4x4 summed max amplitude
+ max4[1] = (*ampmax4)(1,i) ; // corresponding phi position in TRU
+ max4[2] = (*ampmax4)(2,i) ; // corresponding eta position in TRU
+ max4[3] = (*ampmax4)(3,i) ; // corresponding most recent time
+ itru4 = i ;
+ }
+ }
+
+ //--------Set max amplitude if larger than in other Super Modules------------
+ Float_t maxtimeR2 = -1 ;
+ Float_t maxtimeR4 = -1 ;
+ AliRunLoader *rl = AliRunLoader::GetRunLoader();
+ AliRun * gAlice = rl->GetAliRun();
+ AliEMCAL * emcal = (AliEMCAL*)gAlice->GetDetector("EMCAL");
+ Int_t nTimeBins = emcal->GetRawFormatTimeBins() ;
+
+ //Set max of 2x2 amplitudes and select L0 trigger
+ if(max2[0] > f2x2MaxAmp ){
+ f2x2MaxAmp = max2[0] ;
+ f2x2SM = iSM ;
+ maxtimeR2 = max2[3] ;
+ geom->GetCellPhiEtaIndexInSModuleFromTRUIndex(itru2,
+ static_cast<Int_t>(max2[1]),
+ static_cast<Int_t>(max2[2]),
+ f2x2CellPhi,f2x2CellEta) ;
+
+ //Transform digit amplitude in Raw Samples
+ fADCValuesLow2x2 = new Int_t[nTimeBins];
+ fADCValuesHigh2x2 = new Int_t[nTimeBins];
+ emcal->RawSampledResponse(maxtimeR2, f2x2MaxAmp, fADCValuesHigh2x2, fADCValuesLow2x2) ;
+
+ //Set Trigger Inputs, compare ADC time bins until threshold is attained
+ //Set L0
+ for(Int_t i = 0 ; i < nTimeBins ; i++){
+ if(fADCValuesHigh2x2[i] >= fL0Threshold || fADCValuesLow2x2[i] >= fL0Threshold){
+ SetInput("EMCAL_L0") ;
+ break;
+ }
+ }
+ // for(Int_t i = 0 ; i < nTimeBins ; i++)
+ // if(fADCValuesLow2x2[i]!=0||fADCValuesHigh2x2[i]!=0)
+ // cout<< "2x2 Time Bin "<<i
+ // <<"; 2x2 Low Gain "<<fADCValuesLow2x2[i]
+ // <<"; 2x2 High Gain "<<fADCValuesHigh2x2[i]<<endl;
}
-
- if(max >= fL0MBppThreshold)
- SetInput("EMCAL_MB_pp_L0");
- if(max >= fL0MBPbPbThreshold)
- SetInput("EMCAL_MB_PbPb_L0");
- if(max >= fL1JetLowPtThreshold)
- SetInput("EMCAL_PbPb_JetLPt_L1");
- if(max >= fL1JetMediumPtThreshold)
- SetInput("EMCAL_PbPb_JetMPt_L1");
- if(max >= fL1JetHighPtThreshold)
- SetInput("EMCAL_PbPb_JetHPt_L1");
+
+ //------------Set max of 4x4 amplitudes and select L1 trigger---------
+ if(max4[0] > f4x4MaxAmp ){
+ f4x4MaxAmp = max4[0] ;
+ f4x4SM = iSM ;
+ maxtimeR4 = max4[3] ;
+ geom->GetCellPhiEtaIndexInSModuleFromTRUIndex(itru4,
+ static_cast<Int_t>(max4[1]),
+ static_cast<Int_t>(max4[2]),
+ f4x4CellPhi,f4x4CellEta) ;
+ //Transform digit amplitude in Raw Samples
+ fADCValuesHigh4x4 = new Int_t[nTimeBins];
+ fADCValuesLow4x4 = new Int_t[nTimeBins];
+ emcal->RawSampledResponse(maxtimeR4, f4x4MaxAmp, fADCValuesHigh4x4, fADCValuesLow4x4) ;
+
+ //Set Trigger Inputs, compare ADC time bins until threshold is attained
+ //SetL1 Low
+ for(Int_t i = 0 ; i < nTimeBins ; i++){
+ if(fADCValuesHigh4x4[i] >= fL1JetLowPtThreshold || fADCValuesLow4x4[i] >= fL1JetLowPtThreshold){
+ SetInput("EMCAL_JetLPt_L1") ;
+ break;
+ }
+ }
+
+ //SetL1 Medium
+ for(Int_t i = 0 ; i < nTimeBins ; i++){
+ if(fADCValuesHigh4x4[i] >= fL1JetMediumPtThreshold || fADCValuesLow4x4[i] >= fL1JetMediumPtThreshold){
+ SetInput("EMCAL_JetMPt_L1") ;
+ break;
+ }
+ }
+
+ //SetL1 High
+ for(Int_t i = 0 ; i < nTimeBins ; i++){
+ if(fADCValuesHigh4x4[i] >= fL1JetHighPtThreshold || fADCValuesLow4x4[i] >= fL1JetHighPtThreshold){
+ SetInput("EMCAL_JetHPt_L1") ;
+ break;
+ }
+ }
+ // for(Int_t i = 0 ; i < nTimeBins ; i++)
+// if(fADCValuesLow4x4[i]!= 100||fADCValuesHigh4x4[i] != 100)
+// cout<< "4x4 Time Bin "<<i
+// <<"; 4x4 Low Gain "<<fADCValuesLow4x4[i]
+// <<"; 4x4 High Gain "<<fADCValuesHigh4x4[i]<<endl;
+ }
+}
+//____________________________________________________________________________
+void AliEMCALTrigger::Trigger()
+{
+ //Main Method to select triggers.
+ AliRunLoader *rl = AliRunLoader::GetRunLoader();
+ AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>
+ (rl->GetDetectorLoader("EMCAL"));
+
+ //Load EMCAL Geometry
+ rl->LoadgAlice();
+ AliRun * gAlice = rl->GetAliRun();
+ AliEMCAL * emcal = (AliEMCAL*)gAlice->GetDetector("EMCAL");
+ AliEMCALGeometry * geom = emcal->GetGeometry();
+
+ if (geom==0)
+ AliFatal("Did not get geometry from EMCALLoader");
+
+
+ //Define parameters
+ Int_t nSuperModules = geom->GetNumberOfSuperModules() ; //12 SM in EMCAL
+ Int_t nTRU = geom->GetNTRU();//3 TRU per super module
+
+ //Intialize data members each time the trigger is called in event loop
+ f2x2MaxAmp = -1; f2x2CellPhi = -1; f2x2CellEta = -1;
+ f4x4MaxAmp = -1; f4x4CellPhi = -1; f4x4CellEta = -1;
+
+ //Take the digits list if simulation
+ if(fSimulation){
+ rl->LoadDigits("EMCAL");
+ fDigitsList = emcalLoader->Digits() ;
+ }
+ cout<<"Simulation "<<fSimulation<<endl;
+ if(!fDigitsList)
+ AliFatal("Digits not found !") ;
+
+ //Take the digits list
+
+ //Fill TRU Matrix
+ TClonesArray * amptrus = new TClonesArray("TMatrixD",1000);
+ TClonesArray * timeRtrus = new TClonesArray("TMatrixD",1000);
+ geom->FillTRU(fDigitsList, amptrus, timeRtrus) ;
+
+ //Do Cell Sliding and select Trigger
+ //Initialize varible that will contain maximum amplitudes and
+ //its corresponding cell position in eta and phi, and time.
+ TMatrixD * ampmax2 = new TMatrixD(4,nTRU) ;
+ TMatrixD * ampmax4 = new TMatrixD(4,nTRU) ;
+
+ for(Int_t iSM = 1 ; iSM <= nSuperModules ; iSM++) {
+ //Do 2x2 and 4x4 sums, select maximums.
+ MakeSlidingCell(amptrus, timeRtrus, iSM, ampmax2, ampmax4, geom);
+ //Set the trigger
+ SetTriggers(iSM, ampmax2, ampmax4, geom) ;
+ }
}
#ifndef ALIEMCALTrigger_H
#define ALIEMCALTrigger_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+/* $Id $ */
+/* $Log $ */
//___________________________________________________________
// Class for trigger analysis.
-// Digits are grouped in TRU's (384 cells? 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.
-// Last 2 modules are half size but they are treated as fullsize, then their
-// TRU should be smaller. When this is fixed, class will be updated.
+// Digits are grouped in TRU's (Trigger Units). A TRU consist of 384 cells
+// ordered fNTRUPhi x fNTRUZ. The algorithm searches all possible
+// 4x4 crystal combinations per each TRU, adding the digits amplitude and
+// finding the maximum. Maximums are transformed in adc time samples.
+// Each time bin is compared to the trigger threshold until it is larger
+// and then, triggers are set. Thresholds need to be fixed.
+// Last 2 modules are half size in Phi, I considered that the number
+// of TRU is maintained for the last modules but final decision has not
+// been taken. If different, then this must to be changed.
// Usage:
//
// //Inside the event loop
// AliEMCALTrigger *tr = new AliEMCALTrigger();//Init Trigger
-// tr->SetL0MBPbPbThreshold(500);
-// tr->SetL0MBppThreshold(100);
+// tr->SetL0Threshold(100);
// tr->SetL1JetLowPtThreshold(1000);
// tr->SetL1JetMediumPtThreshold(10000);
// tr->SetL1JetHighPtThreshold(20000);
// tr->Trigger(); //Execute Trigger
// tr->Print(""); //Print results
-// //are printed
//
//*-- Author: Gustavo Conesa & Yves Schutz (IFIC, SUBATECH, CERN)
// --- ROOT system ---
class TClonesArray ;
-
+#include "TMatrixD.h"
// --- AliRoot header files ---
#include "AliTriggerDetector.h"
class AliEMCALTrigger : public AliTriggerDetector {
public:
+
AliEMCALTrigger() ; // ctor
AliEMCALTrigger(const AliEMCALTrigger & trig) ; // cpy ctor
virtual ~AliEMCALTrigger() {}; //virtual dtor
- virtual void CreateInputs();
+ virtual void CreateInputs(); //Define trigger inputs for Central Trigger Processor
+ void Print(const Option_t * opt ="") const ;
virtual void Trigger(); //Make EMCAL trigger
+
+ //Getters
+ Float_t Get2x2MaxAmplitude() const {return f2x2MaxAmp ; }
+ Float_t Get4x4MaxAmplitude() const {return f4x4MaxAmp ; }
+ Int_t Get2x2CellPhi() const {return f2x2CellPhi ; }
+ Int_t Get4x4CellPhi() const {return f4x4CellPhi ; }
+ Int_t Get2x2CellEta() const {return f2x2CellEta ; }
+ Int_t Get4x4CellEta() const {return f4x4CellEta ; }
+ Int_t Get2x2SuperModule() const {return f2x2SM ; }
+ Int_t Get4x4SuperModule() const {return f4x4SM ; }
+
+ Int_t * GetADCValuesLowGainMax2x2Sum() {return fADCValuesLow2x2; }
+ Int_t * GetADCValuesHighGainMax2x2Sum() {return fADCValuesHigh2x2; }
+ Int_t * GetADCValuesLowGainMax4x4Sum() {return fADCValuesLow4x4; }
+ Int_t * GetADCValuesHighGainMax4x4Sum() {return fADCValuesHigh4x4; }
+
+ Float_t GetL0Threshold() const {return fL0Threshold ; }
+ Float_t GetL1JetLowPtThreshold() const {return fL1JetLowPtThreshold ; }
+ Float_t GetL1JetMediumPtThreshold()const {return fL1JetMediumPtThreshold ; }
+ Float_t GetL1JetHighPtThreshold() const {return fL1JetHighPtThreshold ; }
- Int_t GetL0MBPbPbThreshold() const {return fL0MBPbPbThreshold ; }
- Int_t GetL0MBppThreshold() const {return fL0MBppThreshold ; }
- Int_t GetL1JetLowPtThreshold() const {return fL1JetLowPtThreshold ; }
- Int_t GetL1JetMediumPtThreshold() const {return fL1JetMediumPtThreshold ; }
- Int_t GetL1JetHighPtThreshold() const {return fL1JetHighPtThreshold ; }
-
- void Print(const Option_t * opt ="") const ;
-
- void SetL0MBPbPbThreshold(Int_t amp)
- {fL0MBPbPbThreshold = amp; }
- void SetL0MBppThreshold(Int_t amp)
- {fL0MBppThreshold = amp; }
- void SetL1JetLowPtThreshold(Int_t amp)
- {fL1JetLowPtThreshold = amp; }
- void SetL1JetMediumPtThreshold(Int_t amp)
- {fL1JetMediumPtThreshold = amp; }
- void SetL1JetHighPtThreshold(Int_t amp)
- {fL1JetHighPtThreshold = amp; }
+ Bool_t IsSimulation() const {return fSimulation ; }
+
+ //Setters
+ void SetDigitsList(TClonesArray * digits)
+ {fDigitsList = digits ; }
+
+ void SetL0Threshold(Int_t amp)
+ {fL0Threshold = amp; }
+ void SetL1JetLowPtThreshold(Int_t amp)
+ {fL1JetLowPtThreshold = amp; }
+ void SetL1JetMediumPtThreshold(Int_t amp)
+ {fL1JetMediumPtThreshold = amp; }
+ void SetL1JetHighPtThreshold(Int_t amp)
+ {fL1JetHighPtThreshold = amp; }
+
+ void SetSimulation(Bool_t sim ) {fSimulation = sim ; }
+
private:
- void MakeSlidingCell(const TClonesArray * trus, const Int_t nTRU,
- const Int_t supermod, const Int_t nCellsPhi,
- const Int_t nCellsEta, Float_t *ampmax) ;
+ void MakeSlidingCell(const TClonesArray * amptrus, const TClonesArray * timeRtrus,const Int_t supermod, TMatrixD *ampmax2, TMatrixD *ampmax4, AliEMCALGeometry * geom) ;
- void SetTriggers(const Float_t * ampmax, const Int_t nTRU) ;
-
-
+ void SetTriggers(const Int_t iSM, const TMatrixD *ampmax2, const TMatrixD *ampmax4, AliEMCALGeometry *geom) ;
+
private:
-
- Int_t fL0MBPbPbThreshold ; //! L0 PbPb trigger energy threshold
- Int_t fL0MBppThreshold ; //! L0 pp trigger energy threshold
- Int_t fL1JetLowPtThreshold ; //! Low pT trigger energy threshold
- Int_t fL1JetMediumPtThreshold ; //! Medium pT trigger energy threshold
- Int_t fL1JetHighPtThreshold ; //! High pT trigger energy threshold
- ClassDef(AliEMCALTrigger,0)
-} ;
+ Float_t f2x2MaxAmp ; //! Maximum 2x2 added amplitude (not overlapped)
+ Int_t f2x2CellPhi ; //! upper right cell, row(phi)
+ Int_t f2x2CellEta ; //! and column(eta)
+ Int_t f2x2SM ; //! Super Module where maximum is found
+ Float_t f4x4MaxAmp ; //! Maximum 4x4 added amplitude (overlapped)
+ Int_t f4x4CellPhi ; //! upper right cell, row(phi)
+ Int_t f4x4CellEta ; //! and column(eta)
+ Int_t f4x4SM ; //! Super Module where maximum is found
+ Int_t* fADCValuesHigh4x4 ; //! Sampled ADC high gain values for the 4x4 crystals amplitude sum
+ Int_t* fADCValuesLow4x4 ; //! " low gain "
+ Int_t* fADCValuesHigh2x2 ; //! " high gain " 2x2 "
+ Int_t* fADCValuesLow2x2 ; //! " low gaing " "
+ TClonesArray* fDigitsList ; //Array of digits
+
+ Float_t fL0Threshold ; //! L0 trigger energy threshold
+ Float_t fL1JetLowPtThreshold ; //! L1 Low pT trigger energy threshold
+ Float_t fL1JetMediumPtThreshold ; //! L1 Medium pT trigger energy threshold
+ Float_t fL1JetHighPtThreshold ; //! L1 High pT trigger energy threshold
+
+ Bool_t fSimulation ; //! Flag to do the trigger during simulation or reconstruction
+
+ ClassDef(AliEMCALTrigger,1)
+} ;
+
+
#endif //ALIEMCALTrigger_H
+
* provided "as is" without express or implied warranty. *
**************************************************************************/
/* $Id$ */
-
+/* $Log $ */
//_________________________________________________________________________
-//
// Class for trigger analysis.
-// 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.
+// Digits are grouped in TRU's (Trigger Units). A TRU consist of 16x28
+// crystals ordered fNTRUPhi x fNTRUZ. The algorithm searches all possible
+// 4x4 crystal combinations per each TRU, adding the digits amplitude and
+// finding the maximum. Maximums are transformed in ADC time samples.
+// Each time bin is compared to the trigger threshold until it is larger
+// and then, triggers 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->SetL0Threshold(100);
// tr->SetL1JetLowPtThreshold(1000);
-// tr->SetL1JetMediumPtThreshold(10000);
// tr->SetL1JetHighPtThreshold(20000);
// tr->Trigger(); //Execute Trigger
// tr->Print(""); //Print result, with "deb" option all data members
// --- ROOT system ---
-#include "TMatrixD.h"
+//#include "TMatrixD.h"
// --- ALIROOT system ---
+#include "AliPHOS.h"
#include "AliPHOSTrigger.h"
#include "AliPHOSGeometry.h"
#include "AliPHOSGetter.h"
#include "AliTriggerInput.h"
-
+//#include "AliLog.h"
ClassImp(AliPHOSTrigger)
//______________________________________________________________________
AliPHOSTrigger::AliPHOSTrigger()
- : AliTriggerDetector(), fNTRU(8), fNTRUZ(2), fNTRUPhi(4),
- fL0MBPbPbThreshold(500), fL0MBppThreshold(50),
- fL1JetLowPtThreshold(1200), fL1JetHighPtThreshold(30000)
+ : AliTriggerDetector(),
+ f2x2MaxAmp(-1), f2x2CrystalPhi(-1), f2x2CrystalEta(-1),
+ f4x4MaxAmp(-1), f4x4CrystalPhi(-1), f4x4CrystalEta(-1),
+ fL0Threshold(50), fL1JetLowPtThreshold(200), fL1JetHighPtThreshold(500),
+ fNTRU(8), fNTRUZ(2), fNTRUPhi(4), fSimulation(kTRUE)
{
//ctor
- SetName("PHOS");
- CreateInputs();
-
- //Print("all") ;
+ fADCValuesHigh4x4 = 0x0; //new Int_t[fTimeBins];
+ fADCValuesLow4x4 = 0x0; //new Int_t[fTimeBins];
+ fADCValuesHigh2x2 = 0x0; //new Int_t[fTimeBins];
+ fADCValuesLow2x2 = 0x0; //new Int_t[fTimeBins];
+
+ fDigitsList = 0x0 ;
+
+ SetName("PHOS");
+ CreateInputs();
+
+ //Print("") ;
}
{
// cpy ctor
+
+ f2x2MaxAmp = trig.f2x2MaxAmp ;
+ f4x4MaxAmp = trig.f4x4MaxAmp ;
+ f2x2CrystalPhi = trig.f2x2CrystalPhi ;
+ f4x4CrystalPhi = trig.f4x4CrystalPhi ;
+ f2x2CrystalEta = trig.f2x2CrystalEta ;
+ f4x4CrystalEta = trig.f4x4CrystalEta ;
+ fADCValuesHigh4x4 = trig.fADCValuesHigh4x4 ;
+ fADCValuesLow4x4 = trig.fADCValuesLow4x4 ;
+ fADCValuesHigh2x2 = trig.fADCValuesHigh2x2 ;
+ fADCValuesLow2x2 = trig.fADCValuesLow2x2 ;
+ fDigitsList = trig.fDigitsList ;
+ fL0Threshold = trig.fL0Threshold ;
+ fL1JetLowPtThreshold = trig.fL1JetLowPtThreshold ;
+ fL1JetHighPtThreshold = trig.fL1JetHighPtThreshold ;
fNTRU = trig.fNTRU ;
fNTRUZ = trig.fNTRUZ ;
fNTRUPhi = trig.fNTRUPhi ;
- fL0MBPbPbThreshold = trig.fL0MBPbPbThreshold ;
- fL0MBppThreshold = trig.fL0MBppThreshold ;
- fL1JetLowPtThreshold = trig.fL1JetLowPtThreshold ;
- fL1JetHighPtThreshold = trig.fL1JetHighPtThreshold ;
+ fSimulation = trig.fSimulation ;
}
-//----------------------------------------------------------------------
+//_________________________________________________________________________
void AliPHOSTrigger::CreateInputs()
{
// inputs
// Do not create inputs again!!
if( fInputs.GetEntriesFast() > 0 ) return;
- fInputs.AddLast( new AliTriggerInput( "PHOS_MB_PbPb_L0", "PHOS PbPb Minimum Bias L0", 0x01 ) );
- fInputs.AddLast( new AliTriggerInput( "PHOS_MB_pp_L0", "PHOS pp Minimum Bias L0", 0x02 ) );
- fInputs.AddLast( new AliTriggerInput( "PHOS_PbPb_JetHPt_L1", "PHOS PbPb Jet High Pt L1", 0x04 ) );
- fInputs.AddLast( new AliTriggerInput( "PHOS_PbPb_JetLPt_L1", "PHOS PbPb Jet Low Pt L1", 0x08 ) );
+ fInputs.AddLast( new AliTriggerInput( "PHOS_L0", "PHOS L0", 0x02 ) );
+ fInputs.AddLast( new AliTriggerInput( "PHOS_JetHPt_L1","PHOS Jet High Pt L1", 0x04 ) );
+ fInputs.AddLast( new AliTriggerInput( "PHOS_JetLPt_L1","PHOS Jet Low Pt L1", 0x08 ) );
}
//____________________________________________________________________________
-TClonesArray * AliPHOSTrigger::FillTRU(const TClonesArray * digits,
- const AliPHOSGeometry * geom,
- const Int_t nModules,
- const Int_t nCrystalsPhi,
- const Int_t nCrystalsZ) const {
+void AliPHOSTrigger::FillTRU(const TClonesArray * digits, const AliPHOSGeometry * geom, TClonesArray * ampmatrix, TClonesArray * timeRmatrix) const {
- //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.
+ //Orders digits ampitudes list and times in fNTRU TRUs (28x16 crystals)
+ //per module. Each TRU is a TMatrixD, and they are kept in TClonesArrays.
+ //In a module, the number of TRU in phi is fNTRUPhi, and the number of
+ //TRU in eta is fNTRUZ.
//Check data members
if(fNTRUZ*fNTRUPhi != fNTRU)
Error("FillTRU"," Wrong number of TRUS per Z or Phi");
- //Initilize variables
- //List of TRU matrices initialized to 0.
+ //Initilize and declare variables
+ Int_t nModules = geom->GetNModules();
+ Int_t nCrystalsPhi = geom->GetNPhi()/fNTRUPhi ;// 64/4=16
+ Int_t nCrystalsZ = geom->GetNZ()/fNTRUZ ;// 56/2=28
+ Int_t relid[4] ;
+ Float_t amp = -1;
+ Float_t timeR = -1;
+ Int_t id = -1;
- TClonesArray * matrix = new TClonesArray("TMatrixD",1000);
+ //List of TRU matrices initialized to 0.
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) ;
+ TMatrixD * amptrus = new TMatrixD(nCrystalsPhi,nCrystalsZ) ;
+ TMatrixD * timeRtrus = new TMatrixD(nCrystalsPhi,nCrystalsZ) ;
+ for(Int_t i = 0; i < nCrystalsPhi; i++){
+ for(Int_t j = 0; j < nCrystalsZ; j++){
+ (*amptrus)(i,j) = 0.0;
+ (*timeRtrus)(i,j) = 0.0;
+ }
+ }
+ new((*ampmatrix)[k]) TMatrixD(*amptrus) ;
+ new((*timeRmatrix)[k]) TMatrixD(*timeRtrus) ;
}
AliPHOSDigit * dig ;
-
- //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<AliPHOSDigit *>(digits->At(idig)) ;
- amp = dig->GetAmp() ; //Energy of the digit (arbitrary units)
- geom->AbsToRelNumbering(dig->GetId(), relid) ;
+ dig = static_cast<AliPHOSDigit *>(digits->At(idig)) ;
+ amp = dig->GetAmp() ; // Energy of the digit (arbitrary units)
+ id = dig->GetId() ; // Id label of the cell
+ timeR = dig->GetTimeR() ; // Earliest time of the digit
+ geom->AbsToRelNumbering(id, relid) ;
//Transform digit number into 4 numbers
//relid[0] = module
//relid[1] = EMC (0) or CPV (-1)
if(relid[1] == 0){//Not CPV, Only EMC digits
- //Check to which TRU in the supermodule belongs the cell.
+ //Check to which TRU in the supermodule belongs the crystal.
//Supermodules are divided in a TRU matrix of dimension
//(fNTRUPhi,fNTRUZ).
- //Each TRU is a cell matrix of dimension (nCrystalsPhi,nCrystalsZ)
+ //Each TRU is a crystal matrix of dimension (nCrystalsPhi,nCrystalsZ)
//First calculate the row and column in the supermodule
- //of the TRU to which the cell belongs.
-
+ //of the TRU to which the crystal 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<TMatrixD *>(matrix->At(itru)) ;
+ Int_t row = (relid[2]-1)/nCrystalsPhi+1;
+
+ //Calculate label number of the TRU
+ Int_t itru = (row-1) + (col-1)*fNTRUPhi + (relid[0]-1)*fNTRU ;
- //Calculate row and column of the cell inside the TRU with number itru
+ //Fill TRU matrix with crystal values
+ TMatrixD * amptrus = dynamic_cast<TMatrixD *>(ampmatrix->At(itru)) ;
+ TMatrixD * timeRtrus = dynamic_cast<TMatrixD *>(timeRmatrix->At(itru)) ;
- Int_t nrow = (relid[2]-1) - (row-1) * nCrystalsPhi;
- Int_t ncol = (relid[3]-1) - (col-1) * nCrystalsZ;
-
- (*trus)(nrow,ncol) = amp ;
+ //Calculate row and column of the crystal inside the TRU with number itru
+ Int_t irow = (relid[2]-1) - (row-1) * nCrystalsPhi;
+ Int_t icol = (relid[3]-1) - (col-1) * nCrystalsZ;
+
+ (*amptrus)(irow,icol) = amp ;
+ (*timeRtrus)(irow,icol) = timeR ;
}
}
- return matrix;
}
+//______________________________________________________________________
+void AliPHOSTrigger::GetCrystalPhiEtaIndexInModuleFromTRUIndex(const Int_t itru,const Int_t iphitru,const Int_t ietatru,Int_t &iphiMod,Int_t &ietaMod,const AliPHOSGeometry* geom) const
+{
+ // This method transforms the (eta,phi) index of a crystals in a
+ // TRU matrix into Super Module (eta,phi) index.
+
+ // Calculate in which row and column in which the TRU are
+ // ordered in the SM
+ Int_t col = itru/ fNTRUPhi + 1;
+ Int_t row = itru - (col-1)*fNTRUPhi + 1;
+
+ //Calculate the (eta,phi) index in SM
+ Int_t nCrystalsPhi = geom->GetNPhi()/fNTRUPhi;
+ Int_t nCrystalsZ = geom->GetNZ()/fNTRUZ;
+
+ iphiMod = nCrystalsPhi*(row-1) + iphitru + 1 ;
+ ietaMod = nCrystalsZ*(col-1) + ietatru + 1 ;
+
+}
//____________________________________________________________________________
-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
- //in the experiment is given by 2x2 crystals, for this reason we loop
- //inside the TRU crystals by 2.
+void AliPHOSTrigger::MakeSlidingCell(const TClonesArray * amptrus, const TClonesArray * timeRtrus, const Int_t imod, TMatrixD *ampmax2, TMatrixD *ampmax4, const AliPHOSGeometry *geom){
+ //Sums energy of all possible 2x2 (L0) and 4x4 (L1) crystals per each TRU.
+ //Fast signal in the experiment is given by 2x2 crystals,
+ //for this reason we loop inside the TRU crystals by 2.
- Float_t amp = 0 ;
+ //Declare and initialize varibles
+ Int_t nCrystalsPhi = geom->GetNPhi()/fNTRUPhi ;// 64/4=16
+ Int_t nCrystalsZ = geom->GetNZ()/fNTRUZ ;// 56/2=28
+ Float_t amp2 = 0 ;
+ Float_t amp4 = 0 ;
+ for(Int_t i = 0; i < 3; i++){
+ for(Int_t j = 0; j < fNTRU; j++){
+ (*ampmax2)(i,j) = -1;
+ (*ampmax4)(i,j) = -1;
+ }
+ }
- for(Int_t i = 0 ; i < fNTRU ; i++)
- ampmax[i] = 0 ;
+ //Create matrix that will contain 2x2 amplitude sums
+ //used to calculate the 4x4 sums
+ TMatrixD * tru2x2 = new TMatrixD(nCrystalsPhi/2,nCrystalsZ/2) ;
+ for(Int_t i = 0; i < nCrystalsPhi/2; i++)
+ for(Int_t j = 0; j < nCrystalsZ/2; j++)
+ (*tru2x2)(i,j) = 0.0;
+
//Loop over all TRUS in a module
- 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 itru = 0 + (imod - 1) * fNTRU ; itru < imod*fNTRU ; itru++){
+ TMatrixD * amptru = dynamic_cast<TMatrixD *>(amptrus->At(itru)) ;
+ TMatrixD * timeRtru = dynamic_cast<TMatrixD *>(timeRtrus->At(itru)) ;
+ Int_t mtru = itru-(imod-1)*fNTRU ; //Number of TRU in Module
+
+ //Sliding 2x2, add 2x2 amplitudes (NOT OVERLAP)
for(Int_t irow = 0 ; irow < nCrystalsPhi; irow += 2){
for(Int_t icol = 0 ; icol < nCrystalsZ ; icol += 2){
- amp = 0;
- 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) ;
- }
- }
+ amp2 = (*amptru)(irow,icol)+(*amptru)(irow+1,icol)+
+ (*amptru)(irow,icol+1)+(*amptru)(irow+1,icol+1);
+ //Fill new matrix with added 2x2 crystals for use in 4x4 sums
+ (*tru2x2)(irow/2,icol/2) = amp2 ;
+ //Select 2x2 maximum sums to select L0
+ if(amp2 > (*ampmax2)(0,mtru)){
+ (*ampmax2)(0,mtru) = amp2 ;
+ (*ampmax2)(1,mtru) = irow;
+ (*ampmax2)(2,mtru) = icol;
}
- if(amp > ampmax[itru-(mod-1)*fNTRU])
- ampmax[itru-(mod-1)*fNTRU] = amp ;
}
}
- }
-}
-
-//____________________________________________________________________________
-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
- 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() ;
+ //Find most recent time in the selected 2x2 cell
+ (*ampmax2)(3,mtru) = 1 ;
+ Int_t row2 = static_cast <Int_t> ((*ampmax2)(1,mtru));
+ Int_t col2 = static_cast <Int_t> ((*ampmax2)(2,mtru));
+ for(Int_t i = 0; i<2; i++){
+ for(Int_t j = 0; j<2; j++){
+ if((*amptru)(row2+i,col2+j) > 0 && (*timeRtru)(row2+i,col2+j)> 0){
+ if((*timeRtru)(row2+i,col2+j) < (*ampmax2)(3,mtru) )
+ (*ampmax2)(3,mtru) = (*timeRtru)(row2+i,col2+j);
+ }
+ }
+ }
- //Fill TRU Matrix
- TClonesArray * trus = FillTRU(digits,geom, nModules, nCrystalsPhi,
- nCrystalsZ) ;
+ //Sliding 4x4, add 4x4 amplitudes (OVERLAP)
+ for(Int_t irow = 0 ; irow < nCrystalsPhi/2; irow++){
+ for(Int_t icol = 0 ; icol < nCrystalsZ/2 ; icol++){
+ if( (irow+1) < nCrystalsPhi/2 && (icol+1) < nCrystalsZ/2){//Avoid exit the TRU
+ amp4 = (*tru2x2)(irow,icol)+(*tru2x2)(irow+1,icol)+
+ (*tru2x2)(irow,icol+1)+(*tru2x2)(irow+1,icol+1);
+ //Select 4x4 maximum sums to select L1
+ if(amp4 > (*ampmax4)(0,mtru)){
+ (*ampmax4)(0,mtru) = amp4 ;
+ (*ampmax4)(1,mtru) = irow*2;
+ (*ampmax4)(2,mtru) = icol*2;
+ }
+ }
+ }
+ }
- //Do Cell Sliding and select Trigger
- Float_t max [8] ;
- 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) ;
+ //Find most recent time in selected 4x4 cell
+ (*ampmax4)(3,mtru) = 1 ;
+ Int_t row4 = static_cast <Int_t> ((*ampmax4)(1,mtru));
+ Int_t col4 = static_cast <Int_t> ((*ampmax4)(2,mtru));
+ for(Int_t i = 0; i<4; i++){
+ for(Int_t j = 0; j<4; j++){
+ if((*amptru)(row4+i,col4+j) > 0 && (*timeRtru)(row4+i,col4+j)> 0){
+ if((*timeRtru)(row4+i,col4+j) < (*ampmax4)(3,mtru) )
+ (*ampmax4)(3,mtru) = (*timeRtru)(row4+i,col4+j);
+ }
+ }
+ }
}
-
}
//____________________________________________________________________________
return;
AliTriggerInput* in = 0x0 ;
- AliInfo("PHOS trigger information:") ;
- printf( " Threshold for pp MB LO %d\n", fL0MBppThreshold) ;
- in = (AliTriggerInput*)fInputs.FindObject( "PHOS_MB_pp_L0" );
+ printf( " Maximum Amplitude after Sliding Crystal, \n") ;
+ printf( " -2x2 crystals sum (not overlapped): %10.2f, in Super Module %d\n",
+ f2x2MaxAmp,f2x2SM) ;
+ printf( " -2x2 from row %d to row %d and from column %d to column %d\n", f2x2CrystalPhi, f2x2CrystalPhi+2, f2x2CrystalEta, f2x2CrystalEta+2) ;
+ printf( " -4x4 crystals sum (overlapped) : %10.2f, in Super Module %d\n",
+ f4x4MaxAmp,f4x4SM) ;
+ printf( " -4x4 from row %d to row %d and from column %d to column %d\n", f4x4CrystalPhi, f4x4CrystalPhi+4, f4x4CrystalEta, f4x4CrystalEta+4) ;
+ printf( " Threshold for LO %10.1f\n",
+ fL0Threshold) ;
+
+ printf( " Threshold for LO %10.2f\n", fL0Threshold) ;
+ in = (AliTriggerInput*)fInputs.FindObject( "PHOS_L0" );
if(in->GetValue())
- printf( " *** PHOS MB pp LO is set ***\n") ;
-
- printf( " Threshold for PbPb MB LO %d\n", fL0MBPbPbThreshold) ;
- in = (AliTriggerInput*)fInputs.FindObject( "PHOS_MB_PbPb_L0" );
+ printf( " *** PHOS LO is set ***\n") ;
+
+ printf( " Jet Low Pt Threshold for L1 %10.2f\n", fL1JetLowPtThreshold) ;
+ in = (AliTriggerInput*)fInputs.FindObject( "PHOS_JetLPt_L1" );
if(in->GetValue())
- printf( " *** PHOS MB PbPb LO is set ***\n") ;
+ printf( " *** PHOS Jet Low Pt for L1 is set ***\n") ;
- printf( " Jet Low Pt Threshold for PbPb L1 %d\n", fL1JetLowPtThreshold) ;
- in = (AliTriggerInput*)fInputs.FindObject( "PHOS_PbPb_JetLPt_L1" );
+ printf( " Jet High Pt Threshold for L1 %10.2f\n", fL1JetHighPtThreshold) ;
+ in = (AliTriggerInput*) fInputs.FindObject( "PHOS_JetHPt_L1" );
if(in->GetValue())
- printf( " *** PHOS Jet Low Pt for PbPb L1 is set ***\n") ;
+ printf( " *** PHOS Jet High Pt for L1 is set ***\n") ;
+
+}
- printf( " Jet High Pt Threshold for L1 %d\n", fL1JetHighPtThreshold) ;
- in = (AliTriggerInput*) fInputs.FindObject( "PHOS_PbPb_JetHPt_L1" );
- if(in->GetValue())
- printf( " *** PHOS Jet High Pt for PbPb 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) ;
- }
+//____________________________________________________________________________
+void AliPHOSTrigger::SetTriggers(const Int_t iMod, const TMatrixD * ampmax2, const TMatrixD * ampmax4, const AliPHOSGeometry *geom)
+{
+ //Checks the 2x2 and 4x4 maximum amplitude per each TRU and compares
+ //with the different L0 and L1 triggers thresholds
+
+ //Initialize variables
+ Float_t max2[] = {-1,-1,-1,-1} ;
+ Float_t max4[] = {-1,-1,-1,-1} ;
+ Int_t itru2 = -1 ;
+ Int_t itru4 = -1 ;
+
+
+ //Find maximum summed amplitude of all the TRU
+ //in a Module
+ for(Int_t i = 0 ; i < fNTRU ; i++){
+ if(max2[0] < (*ampmax2)(0,i) ){
+ max2[0] = (*ampmax2)(0,i) ; // 2x2 summed max amplitude
+ max2[1] = (*ampmax2)(1,i) ; // corresponding phi position in TRU
+ max2[2] = (*ampmax2)(2,i) ; // corresponding eta position in TRU
+ max2[3] = (*ampmax2)(3,i) ; // corresponding most recent time
+ itru2 = i ; // TRU number
+ }
+ if(max4[4] < (*ampmax4)(0,i) ){
+ max4[0] = (*ampmax4)(0,i) ; // 4x4 summed max amplitude
+ max4[1] = (*ampmax4)(1,i) ; // corresponding phi position in TRU
+ max4[2] = (*ampmax4)(2,i) ; // corresponding eta position in TRU
+ max4[3] = (*ampmax4)(3,i) ; // corresponding most recent time
+ itru4 = i ; // TRU number
+ }
+ }
+
+ //Set max amplitude if larger than in other Modules
+ Float_t maxtimeR2 = -1 ;
+ Float_t maxtimeR4 = -1 ;
+ AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
+ AliPHOS * phos = gime->PHOS();
+ Int_t nTimeBins = phos->GetRawFormatTimeBins() ;
+
+ //Set max 2x2 amplitude and select L0 trigger
+ if(max2[0] > f2x2MaxAmp ){
+ f2x2MaxAmp = max2[0] ;
+ f2x2SM = iMod ;
+ maxtimeR2 = max2[3] ;
+ GetCrystalPhiEtaIndexInModuleFromTRUIndex(itru2,static_cast<Int_t>(max2[1]),static_cast<Int_t>(max2[2]),f2x2CrystalPhi,f2x2CrystalEta,geom) ;
+
+ //Transform digit amplitude in Raw Samples
+ fADCValuesLow2x2 = new Int_t[nTimeBins];
+ fADCValuesHigh2x2 = new Int_t[nTimeBins];
+
+ phos->RawSampledResponse(maxtimeR2, f2x2MaxAmp, fADCValuesHigh2x2, fADCValuesLow2x2) ;
+
+ //Set Trigger Inputs, compare ADC time bins until threshold is attained
+ //Set L0
+ for(Int_t i = 0 ; i < nTimeBins ; i++){
+ if(fADCValuesHigh2x2[i] >= fL0Threshold || fADCValuesLow2x2[i] >= fL0Threshold){
+ SetInput("PHOS_L0") ;
+ break;
+ }
+ }
+// for(Int_t i = 0 ; i < 256 ; i++)
+// if(fADCValuesLow2x2[i]!=0||fADCValuesHigh2x2[i]!=0)
+// cout<< "2x2 Time Bin "<<i
+// <<"; 2x2 Low Gain "<<fADCValuesLow2x2[i]
+// <<"; 2x2 High Gain "<<fADCValuesHigh2x2[i]<<endl;
+ }
+
+ //Set max 4x4 amplitude and select L1 triggers
+ if(max4[0] > f4x4MaxAmp ){
+ f4x4MaxAmp = max4[0] ;
+ f4x4SM = iMod ;
+ maxtimeR4 = max4[3] ;
+ GetCrystalPhiEtaIndexInModuleFromTRUIndex(itru4,static_cast<Int_t>(max4[1]),static_cast<Int_t>(max4[2]),f4x4CrystalPhi,f4x4CrystalEta,geom) ;
+
+ //Transform digit amplitude in Raw Samples
+ fADCValuesHigh4x4 = new Int_t[nTimeBins];
+ fADCValuesLow4x4 = new Int_t[nTimeBins];
+ phos->RawSampledResponse(maxtimeR4, f4x4MaxAmp, fADCValuesHigh4x4, fADCValuesLow4x4) ;
+
+ //Set Trigger Inputs, compare ADC time bins until threshold is attained
+ //SetL1 Low
+ for(Int_t i = 0 ; i < nTimeBins ; i++){
+ if(fADCValuesHigh4x4[i] >= fL1JetLowPtThreshold || fADCValuesLow4x4[i] >= fL1JetLowPtThreshold){
+ SetInput("PHOS_JetLPt_L1") ;
+ break;
+ }
+ }
+ //SetL1 High
+ for(Int_t i = 0 ; i < nTimeBins ; i++){
+ if(fADCValuesHigh4x4[i] >= fL1JetHighPtThreshold || fADCValuesLow4x4[i] >= fL1JetHighPtThreshold){
+ SetInput("PHOS_JetHPt_L1") ;
+ break;
+ }
+ }
+// for(Int_t i = 0 ; i < 256 ; i++)
+// if(fADCValuesLow4x4[i]!=0||fADCValuesHigh4x4[i]!=0)
+// cout<< "4x4 Time Bin "<<i
+// <<"; 4x4 Low Gain "<<fADCValuesLow4x4[i]
+// <<"; 4x4 High Gain "<<fADCValuesHigh4x4[i]<<endl;
+ }
}
//____________________________________________________________________________
-void AliPHOSTrigger::SetTriggers(const Float_t * amp)
+void AliPHOSTrigger::Trigger()
{
- //Checks the maximum amplitude per each TRU and compares with the
- //different triggers thresholds
+ //Main Method to select triggers.
+ AliRunLoader *rl = gAlice->GetRunLoader();
+ //Getter
+ AliPHOSGetter * gime = AliPHOSGetter::Instance( rl->GetFileName() ) ;
+ //AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
- Float_t max = 0;
- for(Int_t i = 0 ; i < 8 ; i++){
- if(max < amp[i] )
- max = amp[i] ;
- }
-
- if(max >= fL0MBppThreshold)
- SetInput("PHOS_MB_pp_L0");
- if(max >= fL0MBPbPbThreshold)
- SetInput("PHOS_MB_PbPb_L0");
- if(max >= fL1JetLowPtThreshold)
- SetInput("PHOS_PbPb_JetLPt_L1");
- if(max >= fL1JetHighPtThreshold)
- SetInput("PHOS_PbPb_JetHPt_L1");
+ //Get Geometry
+ const AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ;
+
+ //Define parameters
+ Int_t nModules = geom->GetNModules();
+
+ //Intialize data members each time the trigger is called in event loop
+ f2x2MaxAmp = -1; f2x2CrystalPhi = -1; f2x2CrystalEta = -1;
+ f4x4MaxAmp = -1; f4x4CrystalPhi = -1; f4x4CrystalEta = -1;
+
+ //Take the digits list if simulation
+ if(fSimulation)
+ fDigitsList = gime->Digits() ;
+
+ if(!fDigitsList)
+ AliFatal("Digits not found !") ;
+ //Fill TRU Matrix
+ TClonesArray * amptrus = new TClonesArray("TMatrixD",1000);
+ TClonesArray * timeRtrus = new TClonesArray("TMatrixD",1000);
+ FillTRU(fDigitsList,geom,amptrus, timeRtrus) ;
+
+ //Do Crystal Sliding and select Trigger
+ //Initialize varible that will contain maximum amplitudes and
+ //its corresponding cell position in eta and phi, and time.
+ TMatrixD * ampmax2 = new TMatrixD(4,fNTRU) ;
+ TMatrixD * ampmax4 = new TMatrixD(4,fNTRU) ;
+
+ for(Int_t imod = 1 ; imod <= nModules ; imod++) {
+ //Do 2x2 and 4x4 sums, select maximums.
+ MakeSlidingCell(amptrus, timeRtrus, imod, ampmax2, ampmax4, geom);
+ //Set the trigger
+ SetTriggers(imod,ampmax2,ampmax4, geom) ;
+ }
}
#ifndef ALIPHOSTrigger_H
#define ALIPHOSTrigger_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id $ */
+/* $Log $ */
//____________________________________________________________
// Class for trigger analysis.
-// 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.
+// Digits are grouped in TRU's (Trigger Units). A TRU consist of 16x28
+// crystals ordered fNTRUPhi x fNTRUZ. The algorithm searches all possible
+// 4x4 crystal combinations per each TRU, adding the digits amplitude and
+// finding the maximum. Maximums are transformed in ADC time samples.
+// Each time bin is compared to the trigger threshold until it is larger
+// and then, triggers are set. Thresholds need to be fixed.
// Usage:
//
// //Inside the event loop
-// AliEMCALTrigger *tr = new AliEMCALTrigger();//Init Trigger
-// tr->SetL0MBPbPbThreshold(500);
-// tr->SetL0MBppThreshold(100);
+// AliPHOSTrigger *tr = new AliPHOSTrigger();//Init Trigger
+// tr->SetL0Threshold(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
+// tr->Print(""); //Print results
//
//*-- Author: Gustavo Conesa & Yves Schutz (IFIC, SUBATECH, CERN)
// --- ROOT system ---
class TClonesArray ;
+#include "TMatrixD.h"
// --- AliRoot header files ---
#include "AliTriggerDetector.h"
class AliPHOSTrigger : public AliTriggerDetector {
- public:
+ public:
+
AliPHOSTrigger() ; // ctor
AliPHOSTrigger(const AliPHOSTrigger & trig) ; // cpy ctor
virtual ~AliPHOSTrigger() {}; //virtual dtor
- virtual void CreateInputs();
+ virtual void CreateInputs(); //Define trigger inputs for Central Trigger Processor
+ void Print(const Option_t * opt ="") const ;
virtual void Trigger(); //Make PHOS trigger
-
- Int_t GetNTRU() const {return fNTRU ; }
- Int_t GetNTRUZ() const {return fNTRUZ ; }
- Int_t GetNTRUPhi() const {return fNTRUPhi ; }
- Int_t GetL0MBPbPbThreshold() const {return fL0MBPbPbThreshold ; }
- Int_t GetL0MBppThreshold() const {return fL0MBppThreshold ; }
- Int_t GetL1JetLowPtThreshold() const {return fL1JetLowPtThreshold ; }
- Int_t GetL1JetHighPtThreshold() const {return fL1JetHighPtThreshold ; }
-
- 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 SetL0MBPbPbThreshold(Int_t amp) {fL0MBPbPbThreshold = amp; }
- void SetL0MBppThreshold(Int_t amp) {fL0MBppThreshold = amp; }
- void SetL1JetLowPtThreshold(Int_t amp)
- {fL1JetLowPtThreshold = amp; }
- void SetL1JetHighPtThreshold(Int_t amp)
- {fL1JetHighPtThreshold = amp; }
+
+ //Getters
+ Float_t Get2x2MaxAmplitude() const {return f4x4MaxAmp ; }
+ Float_t Get4x4MaxAmplitude() const {return f4x4MaxAmp ; }
+ Int_t Get2x2CrystalPhi() const {return f2x2CrystalPhi ; }
+ Int_t Get4x4CrystalPhi() const {return f4x4CrystalPhi ; }
+ Int_t Get2x2CrystalEta() const {return f2x2CrystalEta ; }
+ Int_t Get4x4CrystalEta() const {return f4x4CrystalEta ; }
+ Int_t Get2x2SuperModule() const {return f2x2SM ; }
+ Int_t Get4x4SuperModule() const {return f4x4SM ; }
+
+ Int_t * GetADCValuesLowGainMax2x2Sum() {return fADCValuesLow2x2; }
+ Int_t * GetADCValuesHighGainMax2x2Sum() {return fADCValuesHigh2x2; }
+ Int_t * GetADCValuesLowGainMax4x4Sum() {return fADCValuesLow4x4; }
+ Int_t * GetADCValuesHighGainMax4x4Sum() {return fADCValuesHigh4x4; }
+
+ void GetCrystalPhiEtaIndexInModuleFromTRUIndex(const Int_t itru,const Int_t iphitru,const Int_t ietatru,Int_t &ietaMod,Int_t &iphiMod, const AliPHOSGeometry *geom) const ;
+
+ Float_t GetL0Threshold() const {return fL0Threshold ; }
+ Float_t GetL1JetLowPtThreshold() const {return fL1JetLowPtThreshold ; }
+ Float_t GetL1JetHighPtThreshold() const {return fL1JetHighPtThreshold ; }
+
+ Int_t GetNTRU() const {return fNTRU ; }
+ Int_t GetNTRUZ() const {return fNTRUZ ; }
+ Int_t GetNTRUPhi() const {return fNTRUPhi ; }
+
+ Bool_t IsSimulation() const {return fSimulation ; }
+
+ //Setters
+
+ void SetDigitsList(TClonesArray * digits)
+ {fDigitsList = digits ; }
+
+
+ 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 SetL1JetLowPtThreshold(Int_t amp)
+ {fL1JetLowPtThreshold = amp ; }
+ void SetL1JetHighPtThreshold(Int_t amp)
+ {fL1JetHighPtThreshold = amp ; }
+
+ void SetSimulation(Bool_t sim ) {fSimulation = sim ; }
private:
- 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) ;
+ void FillTRU(const TClonesArray * digits, const AliPHOSGeometry * geom, TClonesArray * amptru, TClonesArray * timeRtru) const ;
+
+ void MakeSlidingCell(const TClonesArray * amptrus, const TClonesArray * timeRtrus, const Int_t mod, TMatrixD *ampmax2, TMatrixD *ampmax4, const AliPHOSGeometry *geom) ;
+
+ void SetTriggers(const Int_t iMod, const TMatrixD *ampmax2,const TMatrixD *ampmax4, const AliPHOSGeometry *geom) ;
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 fL0MBPbPbThreshold ; //! L0 PbPb trigger energy threshold
- Int_t fL0MBppThreshold ; //! L0 pp trigger energy threshold
- Int_t fL1JetLowPtThreshold ; //! Low and High pT trigger energy threshold
- Int_t fL1JetHighPtThreshold ; //!
+ Float_t f2x2MaxAmp ; //! Maximum 2x2 added amplitude (not overlapped)
+ Int_t f2x2CrystalPhi ; //! upper right cell, row(phi)
+ Int_t f2x2CrystalEta ; //! and column(eta)
+ Int_t f2x2SM ; //! Module where maximum is found
+ Float_t f4x4MaxAmp ; //! Maximum 4x4 added amplitude (overlapped)
+ Int_t f4x4CrystalPhi ; //! upper right cell, row(phi)
+ Int_t f4x4CrystalEta ; //! and column(eta)
+ Int_t f4x4SM ; //! Module where maximum is found
+
+ Int_t* fADCValuesHigh4x4 ; // Sampled ADC high gain values for the 4x4 crystals amplitude sum
+ Int_t* fADCValuesLow4x4 ; //! " low gain "
+ Int_t* fADCValuesHigh2x2 ; //! " high gain " 2x2 "
+ Int_t* fADCValuesLow2x2 ; //! " low gaing " "
+
+ TClonesArray* fDigitsList ; //Array of digits
+
+ Float_t fL0Threshold ; //! L0 trigger energy threshold
+ Float_t fL1JetLowPtThreshold ; //! L1 Low pT trigger threshold
+ Float_t fL1JetHighPtThreshold ; //! L1 High pT trigger threshold
+
+ 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
- ClassDef(AliPHOSTrigger,3)
+ Bool_t fSimulation ; //! Flag to do the trigger during simulation or reconstruction
+ ClassDef(AliPHOSTrigger,4)
} ;