+ //Checks the 2x2 and nxn maximum amplitude per each TRU and compares
+ //with the different L0 and L1 triggers thresholds. It finds if maximum amplitudes are isolated.
+
+ //Initialize variables
+ Float_t max2[] = {-1,-1,-1,-1} ;
+ Float_t maxn[] = {-1,-1,-1,-1} ;
+ Int_t mtru2 = -1 ;
+ Int_t mtrun = -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
+ mtru2 = i ; // TRU number in module
+ }
+ 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
+ mtrun = i ; // TRU number in module
+ }
+ }
+
+ //Set max amplitude if larger than in other Modules
+ Float_t maxtimeR2 = -1 ;
+ Float_t maxtimeRn = -1 ;
+ // Create a shaper pulse object
+ AliPHOSPulseGenerator pulse ;
+ Int_t nTimeBins = pulse.GetRawFormatTimeBins() ;
+
+ //Set max 2x2 amplitude and select L0 trigger
+ if(max2[0] > f2x2MaxAmp ){
+ f2x2MaxAmp = max2[0] ;
+ f2x2SM = iMod ;
+ maxtimeR2 = max2[3] ;
+ GetCrystalPhiEtaIndexInModuleFromTRUIndex(mtru2,
+ static_cast<Int_t>(max2[1]),
+ static_cast<Int_t>(max2[2]),
+ f2x2CrystalPhi,f2x2CrystalEta) ;
+
+ //Isolated patch?
+ if(fIsolateInModule)
+ fIs2x2Isol = IsPatchIsolated(0, iMod, mtru2, f2x2MaxAmp, f2x2CrystalPhi,f2x2CrystalEta) ;
+ else
+ fIs2x2Isol = IsPatchIsolated(0, iMod, mtru2, f2x2MaxAmp, static_cast<Int_t>(max2[1]), static_cast<Int_t>(max2[2])) ;
+
+ //Transform digit amplitude in Raw Samples
+ if (fADCValuesLow2x2 == 0) {
+ fADCValuesLow2x2 = new Int_t[nTimeBins];
+ }
+ if(!fADCValuesHigh2x2) fADCValuesHigh2x2 = new Int_t[nTimeBins];