//_________________________________________________________________________
//
// 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 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.
+// Digits are grouped in TRU's (384 cells ordered fNTRUPhi x fNTRUEta).
+// The algorithm searches all possible 2x2 and nxn (n is a multiple of 4) cell
+// combinations per each TRU, adding the digits amplitude and finding the
+// maximum. Maxima are compared to triggers threshold and they 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 decision not taken.
+// If different, then this must be changed.
// Usage:
//
// //Inside the event loop
// AliEMCALTrigger *tr = new AliEMCALTrigger();//Init Trigger
-// tr->SetL0Threshold(100);
+// tr->SetL0Threshold(100); //Arbitrary threshold values
// tr->SetL1JetLowPtThreshold(1000);
// tr->SetL1JetMediumPtThreshold(10000);
// tr->SetL1JetHighPtThreshold(20000);
: AliTriggerDetector(),
f2x2MaxAmp(-1), f2x2CellPhi(-1), f2x2CellEta(-1),
f2x2SM(0),
- f4x4MaxAmp(-1), f4x4CellPhi(-1), f4x4CellEta(-1),
- f4x4SM(0),
- fADCValuesHigh4x4(0x0),fADCValuesLow4x4(0x0),
+ fnxnMaxAmp(-1), fnxnCellPhi(-1), fnxnCellEta(-1),
+ fnxnSM(0),
+ fADCValuesHighnxn(0x0),fADCValuesLownxn(0x0),
fADCValuesHigh2x2(0x0),fADCValuesLow2x2(0x0),
fDigitsList(0x0),
fL0Threshold(100),fL1JetLowPtThreshold(200),
fL1JetMediumPtThreshold(500), fL1JetHighPtThreshold(1000),
- fSimulation(kTRUE)
+ fPatchSize(1), fSimulation(kTRUE)
{
//ctor
f2x2CellPhi(trig.f2x2CellPhi),
f2x2CellEta(trig.f2x2CellEta),
f2x2SM(trig.f2x2SM),
- f4x4MaxAmp(trig.f4x4MaxAmp),
- f4x4CellPhi(trig.f4x4CellPhi),
- f4x4CellEta(trig.f4x4CellEta),
- f4x4SM(trig.f4x4SM),
- fADCValuesHigh4x4(trig.fADCValuesHigh4x4),
- fADCValuesLow4x4(trig.fADCValuesLow4x4),
+ fnxnMaxAmp(trig.fnxnMaxAmp),
+ fnxnCellPhi(trig.fnxnCellPhi),
+ fnxnCellEta(trig.fnxnCellEta),
+ fnxnSM(trig.fnxnSM),
+ fADCValuesHighnxn(trig.fADCValuesHighnxn),
+ fADCValuesLownxn(trig.fADCValuesLownxn),
fADCValuesHigh2x2(trig.fADCValuesHigh2x2),
fADCValuesLow2x2(trig.fADCValuesLow2x2),
fDigitsList(trig.fDigitsList),
fL1JetLowPtThreshold(trig.fL1JetLowPtThreshold),
fL1JetMediumPtThreshold(trig.fL1JetMediumPtThreshold),
fL1JetHighPtThreshold(trig.fL1JetHighPtThreshold),
- fSimulation(trig.fSimulation)
+ fPatchSize(trig.fPatchSize), fSimulation(trig.fSimulation)
{
// cpy ctor
}
}
//____________________________________________________________________________
-void AliEMCALTrigger::MakeSlidingCell(const TClonesArray * amptrus, const TClonesArray * timeRtrus, const Int_t isupermod,TMatrixD *ampmax2, TMatrixD *ampmax4, AliEMCALGeometry *geom){
+void AliEMCALTrigger::MakeSlidingCell(const TClonesArray * amptrus, const TClonesArray * timeRtrus, const Int_t isupermod,TMatrixD *ampmax2, TMatrixD *ampmaxn, AliEMCALGeometry *geom){
- //Sums energy of all possible 2x2 (L0) and 4x4 (L1) cells per each TRU.
+ //Sums energy of all possible 2x2 (L0) and nxn (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.
Int_t nTRU = geom->GetNTRU();//3 TRU per super module
Float_t amp2 = 0 ;
- Float_t amp4 = 0 ;
+ Float_t ampn = 0 ;
for(Int_t i = 0; i < 4; i++){
for(Int_t j = 0; j < nTRU; j++){
(*ampmax2)(i,j) = -1;
- (*ampmax4)(i,j) = -1;
+ (*ampmaxn)(i,j) = -1;
}
}
//Create matrix that will contain 2x2 amplitude sums
- //used to calculate the 4x4 sums
+ //used to calculate the nxn 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++)
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
+ //Fill matrix with added 2x2 crystals for use in nxn sums
(*tru2x2)(irow/2,icol/2) = amp2 ;
//Select 2x2 maximum sums to select L0
if(amp2 > (*ampmax2)(0,mtru)){
}
}
}
-
- //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;
+
+ //Sliding nxn, add nxn amplitudes (OVERLAP)
+ if(fPatchSize > 0){
+ for(Int_t irow = 0 ; irow < nCellsPhi/2; irow++){
+ for(Int_t icol = 0 ; icol < nCellsEta/2 ; icol++){
+ ampn = 0;
+ if( (irow+fPatchSize) < nCellsPhi/2 && (icol+fPatchSize) < nCellsEta/2){//Avoid exit the TRU
+ for(Int_t i = 0 ; i <= fPatchSize ; i++)
+ for(Int_t j = 0 ; j <= fPatchSize ; j++)
+ ampn += (*tru2x2)(irow+i,icol+j);
+ //Select nxn maximum sums to select L1
+ if(ampn > (*ampmaxn)(0,mtru)){
+ (*ampmaxn)(0,mtru) = ampn ;
+ (*ampmaxn)(1,mtru) = irow*2;
+ (*ampmaxn)(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);
+
+ //Find most recent time in selected nxn cell
+ (*ampmaxn)(3,mtru) = 1 ;
+ Int_t rown = static_cast <Int_t> ((*ampmaxn)(1,mtru));
+ Int_t coln = static_cast <Int_t> ((*ampmaxn)(2,mtru));
+ for(Int_t i = 0; i<4*fPatchSize; i++){
+ for(Int_t j = 0; j<4*fPatchSize; j++){
+ if( (rown+i) < nCellsPhi && (coln+j) < nCellsEta/2){//Avoid exit the TRU
+ if((*amptru)(rown+i,coln+j) > 0 && (*timeRtru)(rown+i,coln+j)> 0){
+ if((*timeRtru)(rown+i,coln+j) < (*ampmaxn)(3,mtru) )
+ (*ampmaxn)(3,mtru) = (*timeRtru)(rown+i,coln+j);
+ }
+ }
}
}
}
+ else {
+ (*ampmaxn)(0,mtru) = (*ampmax2)(0,mtru);
+ (*ampmaxn)(1,mtru) = (*ampmax2)(1,mtru);
+ (*ampmaxn)(2,mtru) = (*ampmax2)(2,mtru);
+ (*ampmaxn)(3,mtru) = (*ampmax2)(3,mtru);
+ }
}
}
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( " -2x2 from row %d to row %d and from column %d to column %d\n", f2x2CellPhi, f2x2CellPhi+2, f2x2CellEta, f2x2CellEta+2) ;
+
+ if(fPatchSize > 0){
+ printf( " Patch Size, n x n: %d x %d cells\n",4*fPatchSize, 4*fPatchSize);
+ printf( " -nxn cells sum (overlapped) : %10.2f, in Super Module %d\n",
+ fnxnMaxAmp,fnxnSM) ;
+ printf( " -nxn from row %d to row %d and from column %d to column %d\n", fnxnCellPhi, fnxnCellPhi+4*fPatchSize, fnxnCellEta, fnxnCellEta+4*fPatchSize) ;
+ }
+
printf( " Threshold for LO %10.2f\n",
fL0Threshold) ;
in = (AliTriggerInput*)fInputs.FindObject( "EMCAL_L0" );
//____________________________________________________________________________
void AliEMCALTrigger::SetTriggers(const Int_t iSM, const TMatrixD *ampmax2,
- const TMatrixD *ampmax4, AliEMCALGeometry *geom)
+ const TMatrixD *ampmaxn, AliEMCALGeometry *geom)
{
- //Checks the 2x2 and 4x4 maximum amplitude per each TRU and
+ //Checks the 2x2 and nxn 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} ;
+ Float_t maxn[] = {-1,-1,-1,-1} ;
Int_t itru2 = -1 ;
- Int_t itru4 = -1 ;
+ Int_t itrun = -1 ;
//Find maximum summed amplitude of all the TRU
//in a Super Module
max2[3] = (*ampmax2)(3,i) ; // corresponding most recent time
itru2 = i ;
}
- if(max4[0] < (*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 ;
+ if(maxn[0] < (*ampmaxn)(0,i) ){
+ maxn[0] = (*ampmaxn)(0,i) ; // nxn summed max amplitude
+ maxn[1] = (*ampmaxn)(1,i) ; // corresponding phi position in TRU
+ maxn[2] = (*ampmaxn)(2,i) ; // corresponding eta position in TRU
+ maxn[3] = (*ampmaxn)(3,i) ; // corresponding most recent time
+ itrun = i ;
}
}
//--------Set max amplitude if larger than in other Super Modules------------
Float_t maxtimeR2 = -1 ;
- Float_t maxtimeR4 = -1 ;
+ Float_t maxtimeRn = -1 ;
AliRunLoader *rl = AliRunLoader::GetRunLoader();
AliRun * gAlice = rl->GetAliRun();
AliEMCAL * emcal = (AliEMCAL*)gAlice->GetDetector("EMCAL");
}
}
- //------------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) ;
+ //------------Set max of nxn amplitudes and select L1 trigger---------
+ if(maxn[0] > fnxnMaxAmp ){
+ fnxnMaxAmp = maxn[0] ;
+ fnxnSM = iSM ;
+ maxtimeRn = maxn[3] ;
+ geom->GetCellPhiEtaIndexInSModuleFromTRUIndex(itrun,
+ static_cast<Int_t>(maxn[1]),
+ static_cast<Int_t>(maxn[2]),
+ fnxnCellPhi,fnxnCellEta) ;
//Transform digit amplitude in Raw Samples
- fADCValuesHigh4x4 = new Int_t[nTimeBins];
- fADCValuesLow4x4 = new Int_t[nTimeBins];
- emcal->RawSampledResponse(maxtimeR4, f4x4MaxAmp, fADCValuesHigh4x4, fADCValuesLow4x4) ;
+ fADCValuesHighnxn = new Int_t[nTimeBins];
+ fADCValuesLownxn = new Int_t[nTimeBins];
+ emcal->RawSampledResponse(maxtimeRn, fnxnMaxAmp, fADCValuesHighnxn, fADCValuesLownxn) ;
//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){
+ if(fADCValuesHighnxn[i] >= fL1JetLowPtThreshold || fADCValuesLownxn[i] >= fL1JetLowPtThreshold){
SetInput("EMCAL_JetLPt_L1") ;
break;
}
//SetL1 Medium
for(Int_t i = 0 ; i < nTimeBins ; i++){
- if(fADCValuesHigh4x4[i] >= fL1JetMediumPtThreshold || fADCValuesLow4x4[i] >= fL1JetMediumPtThreshold){
+ if(fADCValuesHighnxn[i] >= fL1JetMediumPtThreshold || fADCValuesLownxn[i] >= fL1JetMediumPtThreshold){
SetInput("EMCAL_JetMPt_L1") ;
break;
}
//SetL1 High
for(Int_t i = 0 ; i < nTimeBins ; i++){
- if(fADCValuesHigh4x4[i] >= fL1JetHighPtThreshold || fADCValuesLow4x4[i] >= fL1JetHighPtThreshold){
+ if(fADCValuesHighnxn[i] >= fL1JetHighPtThreshold || fADCValuesLownxn[i] >= fL1JetHighPtThreshold){
SetInput("EMCAL_JetHPt_L1") ;
break;
}
//Intialize data members each time the trigger is called in event loop
f2x2MaxAmp = -1; f2x2CellPhi = -1; f2x2CellEta = -1;
- f4x4MaxAmp = -1; f4x4CellPhi = -1; f4x4CellEta = -1;
+ fnxnMaxAmp = -1; fnxnCellPhi = -1; fnxnCellEta = -1;
//Take the digits list if simulation
if(fSimulation){
//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) ;
+ TMatrixD * ampmaxn = new TMatrixD(4,nTRU) ;
for(Int_t iSM = 0 ; iSM < nSuperModules ; iSM++) {
- //Do 2x2 and 4x4 sums, select maximums.
- MakeSlidingCell(amptrus, timeRtrus, iSM, ampmax2, ampmax4, geom);
+ //Do 2x2 and nxn sums, select maximums.
+ MakeSlidingCell(amptrus, timeRtrus, iSM, ampmax2, ampmaxn, geom);
//Set the trigger
- SetTriggers(iSM, ampmax2, ampmax4, geom) ;
+ SetTriggers(iSM, ampmax2, ampmaxn, geom) ;
}
}
//___________________________________________________________
// Class for trigger analysis.
// 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
+// ordered fNTRUPhi x fNTRUZ. The algorithm searches all possible 2x2 and
+// nxn (n multiple of 4) 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
//Getters
Float_t Get2x2MaxAmplitude() const {return f2x2MaxAmp ; }
- Float_t Get4x4MaxAmplitude() const {return f4x4MaxAmp ; }
+ Float_t GetnxnMaxAmplitude() const {return fnxnMaxAmp ; }
Int_t Get2x2CellPhi() const {return f2x2CellPhi ; }
- Int_t Get4x4CellPhi() const {return f4x4CellPhi ; }
+ Int_t GetnxnCellPhi() const {return fnxnCellPhi ; }
Int_t Get2x2CellEta() const {return f2x2CellEta ; }
- Int_t Get4x4CellEta() const {return f4x4CellEta ; }
+ Int_t GetnxnCellEta() const {return fnxnCellEta ; }
Int_t Get2x2SuperModule() const {return f2x2SM ; }
- Int_t Get4x4SuperModule() const {return f4x4SM ; }
+ Int_t GetnxnSuperModule() const {return fnxnSM ; }
Int_t * GetADCValuesLowGainMax2x2Sum() {return fADCValuesLow2x2; }
Int_t * GetADCValuesHighGainMax2x2Sum() {return fADCValuesHigh2x2; }
- Int_t * GetADCValuesLowGainMax4x4Sum() {return fADCValuesLow4x4; }
- Int_t * GetADCValuesHighGainMax4x4Sum() {return fADCValuesHigh4x4; }
+ Int_t * GetADCValuesLowGainMaxnxnSum() {return fADCValuesLownxn; }
+ Int_t * GetADCValuesHighGainMaxnxnSum() {return fADCValuesHighnxn; }
Float_t GetL0Threshold() const {return fL0Threshold ; }
Float_t GetL1JetLowPtThreshold() const {return fL1JetLowPtThreshold ; }
Float_t GetL1JetMediumPtThreshold()const {return fL1JetMediumPtThreshold ; }
Float_t GetL1JetHighPtThreshold() const {return fL1JetHighPtThreshold ; }
-
+
+ Float_t GetPatchSize() const {return fPatchSize ; }
Bool_t IsSimulation() const {return fSimulation ; }
//Setters
void SetL1JetHighPtThreshold(Int_t amp)
{fL1JetHighPtThreshold = amp; }
+ void SetPatchSize(Int_t ps) {fPatchSize = ps ; }
void SetSimulation(Bool_t sim ) {fSimulation = sim ; }
private:
- void MakeSlidingCell(const TClonesArray * amptrus, const TClonesArray * timeRtrus,const Int_t supermod, TMatrixD *ampmax2, TMatrixD *ampmax4, AliEMCALGeometry * geom) ;
+ void MakeSlidingCell(const TClonesArray * amptrus, const TClonesArray * timeRtrus,const Int_t supermod, TMatrixD *ampmax2, TMatrixD *ampmaxn, AliEMCALGeometry * geom) ;
- void SetTriggers(const Int_t iSM, const TMatrixD *ampmax2, const TMatrixD *ampmax4, AliEMCALGeometry *geom) ;
+ void SetTriggers(const Int_t iSM, const TMatrixD *ampmax2, const TMatrixD *ampmaxn, AliEMCALGeometry *geom) ;
private:
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
+ Float_t fnxnMaxAmp ; //! Maximum nxn added amplitude (overlapped)
+ Int_t fnxnCellPhi ; //! upper right cell, row(phi)
+ Int_t fnxnCellEta ; //! and column(eta)
+ Int_t fnxnSM ; //! 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* fADCValuesHighnxn ; //! Sampled ADC high gain values for the nxn crystals amplitude sum
+ Int_t* fADCValuesLownxn ; //! " low gain "
Int_t* fADCValuesHigh2x2 ; //! " high gain " 2x2 "
Int_t* fADCValuesLow2x2 ; //! " low gaing " "
Float_t fL1JetMediumPtThreshold ; //! L1 Medium pT trigger energy threshold
Float_t fL1JetHighPtThreshold ; //! L1 High pT trigger energy threshold
+ Int_t fPatchSize; //! Trigger patch factor, to be multiplied to 2x2 cells
+ // 0 means 2x2, 1 means nxn, 2 means 8x8 ...
Bool_t fSimulation ; //! Flag to do the trigger during simulation or reconstruction
ClassDef(AliEMCALTrigger,1)
Int_t maxevent = rl->GetNumberOfEvents();
cout<<"n events "<<maxevent<<endl;
-
+// maxevent=5;
//Load Digits
rl->LoadDigits("EMCAL");
-
- //Create trigger pointer and set thresholds if you want
- //Defautl threshold values need to be fixed
- AliEMCALTrigger *tr = new AliEMCALTrigger();
- tr->SetL0MBPbPbThreshold(500);
- tr->SetL0MBppThreshold(100);
- tr->SetL1JetLowPtThreshold(2000);
- tr->SetL1JetMediumPtThreshold(10000);
- tr->SetL1JetHighPtThreshold(20000);
//event loop
for(Int_t iEvent = 0; iEvent < maxevent ; iEvent++){
rl->GetEvent(iEvent);
cout<<">>>>>>>>>>> Event >>> "<<iEvent<<endl;
-
+ AliEMCALTrigger *tr = new AliEMCALTrigger();
+ //Create trigger pointer and set thresholds if you want
+ //Default threshold values need to be fixed
+ // tr->SetL0Threshold(10000);
+ // tr->SetL1JetLowPtThreshold(10000);
+ // tr->SetL1JetMediumPtThreshold(10000);
+ // tr->SetL1JetHighPtThreshold(10000);
+ tr->SetPatchSize(4);//0 means 2x2, 1->4x4, 2->8x8, 3->16x16 ...
//Select trigger for each event
tr->Trigger();//Do the trigger algorithm
-
+ // cout<<"Patch "<<tr->GetPatchSize()<<endl;
+ // cout<<"Trigger patch "<< tr->GetPatchSize()
+ // <<" 2x2 maximum amplitude sum "<<tr->Get2x2MaxAmplitude()
+ // <<" nxn max amp sum "<<tr->GetnxnMaxAmplitude()<<endl;
tr->Print("");//Print results.
}
// Class for trigger analysis.
// 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
+// 2x2 and nxn (n multiple of 4) crystal combinations per each TRU, adding the
+// digits amplitude and finding the maximum. Maxima 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:
//
AliPHOSTrigger::AliPHOSTrigger()
: AliTriggerDetector(),
f2x2MaxAmp(-1), f2x2CrystalPhi(-1), f2x2CrystalEta(-1), f2x2SM(0),
- f4x4MaxAmp(-1), f4x4CrystalPhi(-1), f4x4CrystalEta(-1), f4x4SM(0),
- fADCValuesHigh4x4(0), fADCValuesLow4x4(0),
+ fnxnMaxAmp(-1), fnxnCrystalPhi(-1), fnxnCrystalEta(-1), fnxnSM(0),
+ fADCValuesHighnxn(0), fADCValuesLownxn(0),
fADCValuesHigh2x2(0), fADCValuesLow2x2(0), fDigitsList(0),
fL0Threshold(50), fL1JetLowPtThreshold(200), fL1JetHighPtThreshold(500),
- fNTRU(8), fNTRUZ(2), fNTRUPhi(4), fSimulation(kTRUE)
+ fNTRU(8), fNTRUZ(2), fNTRUPhi(4), fPatchSize(1), fSimulation(kTRUE)
{
//ctor
- fADCValuesHigh4x4 = 0x0; //new Int_t[fTimeBins];
- fADCValuesLow4x4 = 0x0; //new Int_t[fTimeBins];
+ fADCValuesHighnxn = 0x0; //new Int_t[fTimeBins];
+ fADCValuesLownxn = 0x0; //new Int_t[fTimeBins];
fADCValuesHigh2x2 = 0x0; //new Int_t[fTimeBins];
fADCValuesLow2x2 = 0x0; //new Int_t[fTimeBins];
f2x2CrystalPhi(trig.f2x2CrystalPhi),
f2x2CrystalEta(trig.f2x2CrystalEta),
f2x2SM(trig.f2x2SM),
- f4x4MaxAmp(trig.f4x4MaxAmp),
- f4x4CrystalPhi(trig.f4x4CrystalPhi),
- f4x4CrystalEta(trig.f4x4CrystalEta),
- f4x4SM(trig.f4x4SM),
- fADCValuesHigh4x4(trig.fADCValuesHigh4x4),
- fADCValuesLow4x4(trig.fADCValuesLow4x4),
+ fnxnMaxAmp(trig.fnxnMaxAmp),
+ fnxnCrystalPhi(trig.fnxnCrystalPhi),
+ fnxnCrystalEta(trig.fnxnCrystalEta),
+ fnxnSM(trig.fnxnSM),
+ fADCValuesHighnxn(trig.fADCValuesHighnxn),
+ fADCValuesLownxn(trig.fADCValuesLownxn),
fADCValuesHigh2x2(trig.fADCValuesHigh2x2),
fADCValuesLow2x2(trig.fADCValuesLow2x2),
fDigitsList(trig.fDigitsList),
fNTRU(trig.fNTRU),
fNTRUZ(trig.fNTRUZ),
fNTRUPhi(trig.fNTRUPhi),
- fSimulation(trig.fSimulation)
+ fPatchSize(trig.fPatchSize), fSimulation(trig.fSimulation)
{
// cpy ctor
}
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)
+ amp = dig->GetEnergy() ; // Energy of the digit
id = dig->GetId() ; // Id label of the cell
timeR = dig->GetTimeR() ; // Earliest time of the digit
geom->AbsToRelNumbering(id, relid) ;
}
//____________________________________________________________________________
-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.
+void AliPHOSTrigger::MakeSlidingCell(const TClonesArray * amptrus, const TClonesArray * timeRtrus, const Int_t imod, TMatrixD *ampmax2, TMatrixD *ampmaxn, const AliPHOSGeometry *geom){
+ //Sums energy of all possible 2x2 (L0) and nxn (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.
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++){
+ Float_t ampn = 0 ;
+ for(Int_t i = 0; i < 4; i++){
for(Int_t j = 0; j < fNTRU; j++){
(*ampmax2)(i,j) = -1;
- (*ampmax4)(i,j) = -1;
+ (*ampmaxn)(i,j) = -1;
}
}
//Create matrix that will contain 2x2 amplitude sums
- //used to calculate the 4x4 sums
+ //used to calculate the nxn 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;
for(Int_t icol = 0 ; icol < nCrystalsZ ; icol += 2){
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
+
+ //Fill new matrix with added 2x2 crystals for use in nxn sums
(*tru2x2)(irow/2,icol/2) = amp2 ;
//Select 2x2 maximum sums to select L0
if(amp2 > (*ampmax2)(0,mtru)){
}
}
- //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;
+ //Sliding nxn, add nxn amplitudes (OVERLAP)
+ if(fPatchSize > 0){
+ for(Int_t irow = 0 ; irow < nCrystalsPhi/2; irow++){
+ for(Int_t icol = 0 ; icol < nCrystalsZ/2 ; icol++){
+ ampn = 0;
+ if( (irow+fPatchSize) < nCrystalsPhi/2 && (icol+fPatchSize) < nCrystalsZ/2){//Avoid exit the TRU
+ for(Int_t i = 0 ; i <= fPatchSize ; i++)
+ for(Int_t j = 0 ; j <= fPatchSize ; j++)
+ ampn += (*tru2x2)(irow+i,icol+j);
+ //Select nxn maximum sums to select L1
+ if(ampn > (*ampmaxn)(0,mtru)){
+ (*ampmaxn)(0,mtru) = ampn ;
+ (*ampmaxn)(1,mtru) = irow*2;
+ (*ampmaxn)(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);
+
+ //Find most recent time in selected nxn cell
+ (*ampmaxn)(3,mtru) = 1 ;
+ Int_t rown = static_cast <Int_t> ((*ampmaxn)(1,mtru));
+ Int_t coln = static_cast <Int_t> ((*ampmaxn)(2,mtru));
+ for(Int_t i = 0; i<4*fPatchSize; i++){
+ for(Int_t j = 0; j<4*fPatchSize; j++){
+ if( (rown+i) < nCrystalsPhi && (coln+j) < nCrystalsZ/2){//Avoid exit the TRU
+ if((*amptru)(rown+i,coln+j) > 0 && (*timeRtru)(rown+i,coln+j)> 0){
+ if((*timeRtru)(rown+i,coln+j) < (*ampmaxn)(3,mtru) )
+ (*ampmaxn)(3,mtru) = (*timeRtru)(rown+i,coln+j);
+ }
+ }
}
}
}
+ else {
+ (*ampmaxn)(0,mtru) = (*ampmax2)(0,mtru);
+ (*ampmaxn)(1,mtru) = (*ampmax2)(1,mtru);
+ (*ampmaxn)(2,mtru) = (*ampmax2)(2,mtru);
+ (*ampmaxn)(3,mtru) = (*ampmax2)(3,mtru);
+ }
}
}
-
//____________________________________________________________________________
void AliPHOSTrigger::Print(const Option_t * opt) const
{
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) ;
+
+ if(fPatchSize > 0){
+ printf( " Patch Size, n x n: %d x %d cells\n",4*fPatchSize, 4*fPatchSize);
+ printf( " -nxn crystals sum (overlapped) : %10.2f, in Super Module %d\n",
+ fnxnMaxAmp,fnxnSM) ;
+ printf( " -nxn from row %d to row %d and from column %d to column %d\n", fnxnCrystalPhi, fnxnCrystalPhi+4, fnxnCrystalEta, fnxnCrystalEta+4) ;
+ }
printf( " Threshold for LO %10.1f\n",
fL0Threshold) ;
}
//____________________________________________________________________________
-void AliPHOSTrigger::SetTriggers(const Int_t iMod, const TMatrixD * ampmax2, const TMatrixD * ampmax4, const AliPHOSGeometry *geom)
+void AliPHOSTrigger::SetTriggers(const Int_t iMod, const TMatrixD * ampmax2, const TMatrixD * ampmaxn, const AliPHOSGeometry *geom)
{
- //Checks the 2x2 and 4x4 maximum amplitude per each TRU and compares
+ //Checks the 2x2 and nxn 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} ;
+ Float_t maxn[] = {-1,-1,-1,-1} ;
Int_t itru2 = -1 ;
- Int_t itru4 = -1 ;
+ Int_t itrun = -1 ;
//Find maximum summed amplitude of all the TRU
max2[3] = (*ampmax2)(3,i) ; // corresponding most recent time
itru2 = i ; // TRU number
}
- if(max4[0] < (*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
+ if(maxn[0] < (*ampmaxn)(0,i) ){
+ maxn[0] = (*ampmaxn)(0,i) ; // nxn summed max amplitude
+ maxn[1] = (*ampmaxn)(1,i) ; // corresponding phi position in TRU
+ maxn[2] = (*ampmaxn)(2,i) ; // corresponding eta position in TRU
+ maxn[3] = (*ampmaxn)(3,i) ; // corresponding most recent time
+ itrun = i ; // TRU number
}
}
//Set max amplitude if larger than in other Modules
Float_t maxtimeR2 = -1 ;
- Float_t maxtimeR4 = -1 ;
+ Float_t maxtimeRn = -1 ;
AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
AliPHOS * phos = gime->PHOS();
Int_t nTimeBins = phos->GetRawFormatTimeBins() ;
// <<"; 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) ;
+ //Set max nxn amplitude and select L1 triggers
+ if(maxn[0] > fnxnMaxAmp ){
+ fnxnMaxAmp = maxn[0] ;
+ fnxnSM = iMod ;
+ maxtimeRn = maxn[3] ;
+ GetCrystalPhiEtaIndexInModuleFromTRUIndex(itrun,static_cast<Int_t>(maxn[1]),static_cast<Int_t>(maxn[2]),fnxnCrystalPhi,fnxnCrystalEta,geom) ;
//Transform digit amplitude in Raw Samples
- fADCValuesHigh4x4 = new Int_t[nTimeBins];
- fADCValuesLow4x4 = new Int_t[nTimeBins];
- phos->RawSampledResponse(maxtimeR4, f4x4MaxAmp, fADCValuesHigh4x4, fADCValuesLow4x4) ;
+ fADCValuesHighnxn = new Int_t[nTimeBins];
+ fADCValuesLownxn = new Int_t[nTimeBins];
+ phos->RawSampledResponse(maxtimeRn, fnxnMaxAmp, fADCValuesHighnxn, fADCValuesLownxn) ;
//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){
+ if(fADCValuesHighnxn[i] >= fL1JetLowPtThreshold || fADCValuesLownxn[i] >= fL1JetLowPtThreshold){
SetInput("PHOS_JetLPt_L1") ;
break;
}
}
//SetL1 High
for(Int_t i = 0 ; i < nTimeBins ; i++){
- if(fADCValuesHigh4x4[i] >= fL1JetHighPtThreshold || fADCValuesLow4x4[i] >= fL1JetHighPtThreshold){
+ if(fADCValuesHighnxn[i] >= fL1JetHighPtThreshold || fADCValuesLownxn[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;
+// if(fADCValuesLownxn[i]!=0||fADCValuesHighnxn[i]!=0)
+// cout<< "nxn Time Bin "<<i
+// <<"; nxn Low Gain "<<fADCValuesLownxn[i]
+// <<"; nxn High Gain "<<fADCValuesHighnxn[i]<<endl;
}
}
//Intialize data members each time the trigger is called in event loop
f2x2MaxAmp = -1; f2x2CrystalPhi = -1; f2x2CrystalEta = -1;
- f4x4MaxAmp = -1; f4x4CrystalPhi = -1; f4x4CrystalEta = -1;
+ fnxnMaxAmp = -1; fnxnCrystalPhi = -1; fnxnCrystalEta = -1;
//Take the digits list if simulation
if(fSimulation)
//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) ;
+ TMatrixD * ampmaxn = 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);
+ //Do 2x2 and nxn sums, select maximums.
+ MakeSlidingCell(amptrus, timeRtrus, imod, ampmax2, ampmaxn, geom);
//Set the trigger
- SetTriggers(imod,ampmax2,ampmax4, geom) ;
+ SetTriggers(imod,ampmax2,ampmaxn, geom) ;
}
}
// Class for trigger analysis.
// 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
+// 2x2 and nxn (n multiple of 4) crystal combinations per each TRU, adding the
+// digits amplitude and finding the maximum. Maxima 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:
//
virtual void Trigger(); //Make PHOS trigger
//Getters
- Float_t Get2x2MaxAmplitude() const {return f4x4MaxAmp ; }
- Float_t Get4x4MaxAmplitude() const {return f4x4MaxAmp ; }
+ Float_t Get2x2MaxAmplitude() const {return f2x2MaxAmp ; }
+ Float_t GetnxnMaxAmplitude() const {return fnxnMaxAmp ; }
Int_t Get2x2CrystalPhi() const {return f2x2CrystalPhi ; }
- Int_t Get4x4CrystalPhi() const {return f4x4CrystalPhi ; }
+ Int_t GetnxnCrystalPhi() const {return fnxnCrystalPhi ; }
Int_t Get2x2CrystalEta() const {return f2x2CrystalEta ; }
- Int_t Get4x4CrystalEta() const {return f4x4CrystalEta ; }
+ Int_t GetnxnCrystalEta() const {return fnxnCrystalEta ; }
Int_t Get2x2SuperModule() const {return f2x2SM ; }
- Int_t Get4x4SuperModule() const {return f4x4SM ; }
+ Int_t GetnxnSuperModule() const {return fnxnSM ; }
Int_t * GetADCValuesLowGainMax2x2Sum() {return fADCValuesLow2x2; }
Int_t * GetADCValuesHighGainMax2x2Sum() {return fADCValuesHigh2x2; }
- Int_t * GetADCValuesLowGainMax4x4Sum() {return fADCValuesLow4x4; }
- Int_t * GetADCValuesHighGainMax4x4Sum() {return fADCValuesHigh4x4; }
+ Int_t * GetADCValuesLowGainMaxnxnSum() {return fADCValuesLownxn; }
+ Int_t * GetADCValuesHighGainMaxnxnSum() {return fADCValuesHighnxn; }
void GetCrystalPhiEtaIndexInModuleFromTRUIndex(Int_t itru, Int_t iphitru, Int_t ietatru,Int_t &ietaMod,Int_t &iphiMod, const AliPHOSGeometry *geom) const ;
Int_t GetNTRU() const {return fNTRU ; }
Int_t GetNTRUZ() const {return fNTRUZ ; }
Int_t GetNTRUPhi() const {return fNTRUPhi ; }
-
+
+ Float_t GetPatchSize() const {return fPatchSize ; }
Bool_t IsSimulation() const {return fSimulation ; }
//Setters
void SetL1JetHighPtThreshold(Int_t amp)
{fL1JetHighPtThreshold = amp ; }
+ void SetPatchSize(Int_t ps) {fPatchSize = ps ; }
void SetSimulation(Bool_t sim ) {fSimulation = sim ; }
private:
void FillTRU(const TClonesArray * digits, const AliPHOSGeometry * geom, TClonesArray * amptru, TClonesArray * timeRtru) const ;
- void MakeSlidingCell(const TClonesArray * amptrus, const TClonesArray * timeRtrus, Int_t mod, TMatrixD *ampmax2, TMatrixD *ampmax4, const AliPHOSGeometry *geom) ;
+ void MakeSlidingCell(const TClonesArray * amptrus, const TClonesArray * timeRtrus, Int_t mod, TMatrixD *ampmax2, TMatrixD *ampmaxn, const AliPHOSGeometry *geom) ;
- void SetTriggers(Int_t iMod, const TMatrixD *ampmax2,const TMatrixD *ampmax4, const AliPHOSGeometry *geom) ;
+ void SetTriggers(Int_t iMod, const TMatrixD *ampmax2,const TMatrixD *ampmaxn, const AliPHOSGeometry *geom) ;
private:
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
+ Float_t fnxnMaxAmp ; //! Maximum nxn added amplitude (overlapped)
+ Int_t fnxnCrystalPhi ; //! upper right cell, row(phi)
+ Int_t fnxnCrystalEta ; //! and column(eta)
+ Int_t fnxnSM ; //! 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* fADCValuesHighnxn ; //! Sampled ADC high gain values for the nxn crystals amplitude sum
+ Int_t* fADCValuesLownxn ; //! " low gain "
Int_t* fADCValuesHigh2x2 ; //! " high gain " 2x2 "
Int_t* fADCValuesLow2x2 ; //! " low gaing " "
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 fPatchSize; //! Trigger patch factor, to be multiplied to 2x2 cells
+ // 0 means 2x2, 1 means nxn, 2 means 8x8 ...
Bool_t fSimulation ; //! Flag to do the trigger during simulation or reconstruction
ClassDef(AliPHOSTrigger,4)
} ;
--- /dev/null
+
+// Test Macro, shows how to execute the Trigger, and prints the results.
+// Author: Gustavo Conesa
+
+void TestPHOSTrigger(){
+
+ //Loader
+ AliRunLoader* rl=0x0;
+
+// cout<<"TestPHOSTrigger: Creating Run Loader ..."<<endl;
+// rl = AliRunLoader::Open("galice.root",
+// AliConfig::GetDefaultEventFolderName(),
+// "read");
+// if (rl == 0x0)
+// {
+// gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
+// return;
+// }
+
+// AliPHOSLoader *emcalLoader = dynamic_cast<AliPHOSLoader*>
+// (rl->GetDetectorLoader("PHOS"));
+
+// //Load Digits
+// rl->LoadDigits("PHOS");
+
+ AliPHOSGetter * gime = AliPHOSGetter::Instance("./galice.root");
+ //Get Maximum number of events
+ Int_t maxevent = gime->MaxEvent();
+ //Int_t maxevent = rl->GetNumberOfEvents();
+ cout<<"n events "<<maxevent<<endl;
+// maxevent=5;
+
+
+ //event loop
+ for(Int_t iEvent = 0; iEvent < maxevent ; iEvent++){
+ // rl->GetEvent(iEvent);
+ gime->Event(iEvent,"D"); //Only Digits
+ cout<<">>>>>>>>>>> Event >>> "<<iEvent<<endl;
+ AliPHOSTrigger *tr = new AliPHOSTrigger();
+ //Create trigger pointer and set thresholds if you want
+ //Default threshold values need to be fixed
+ // tr->SetL0Threshold(10000);
+ // tr->SetL1JetLowPtThreshold(10000);
+ // tr->SetL1JetHighPtThreshold(10000);
+ tr->SetPatchSize(1);//0 means 2x2, 1->4x4, 2->8x8, 3->16x16 ...
+ //Select trigger for each event
+ tr->Trigger();//Do the trigger algorithm
+ //cout<<"Patch "<<tr->GetPatchSize()<<endl;
+ cout<<"Trigger patch "<< tr->GetPatchSize()
+ <<" 2x2 maximum amplitude sum "<<tr->Get2x2MaxAmplitude()
+ <<" nxn max amp sum "<<tr->GetnxnMaxAmplitude()<<endl;
+ //tr->Print("");//Print results.
+
+ }
+}