#include "TMath.h"
#include "AliConfig.h"
#include "AliPHOS.h"
#include "AliPHOSTrigger.h"
#include "AliPHOSGeometry.h"
#include "AliPHOSDigit.h"
#include "AliPHOSLoader.h"
#include "AliPHOSPulseGenerator.h"
#include "AliTriggerInput.h"
ClassImp(AliPHOSTrigger)
AliPHOSTrigger::AliPHOSTrigger()
: AliTriggerDetector(),
f2x2MaxAmp(-1), f2x2CrystalPhi(-1), f2x2CrystalEta(-1), f2x2SM(0),
fnxnMaxAmp(-1), fnxnCrystalPhi(-1), fnxnCrystalEta(-1), fnxnSM(0),
fADCValuesHighnxn(0), fADCValuesLownxn(0),
fADCValuesHigh2x2(0), fADCValuesLow2x2(0), fDigitsList(0),
fAmptrus(0), fAmpmods(0), fTimeRtrus(0),
fL0Threshold(50), fL1JetLowPtThreshold(200), fL1JetMediumPtThreshold(500),
fL1JetHighPtThreshold(1000),
fNTRU(8), fNTRUZ(2), fNTRUPhi(4),
fNCrystalsPhi(16),
fNCrystalsZ(28),
fPatchSize(1), fIsolPatchSize(1),
f2x2AmpOutOfPatch(-1), fnxnAmpOutOfPatch(-1),
f2x2AmpOutOfPatchThres(2), fnxnAmpOutOfPatchThres(2),
fIs2x2Isol(kFALSE), fIsnxnIsol(kFALSE),
fSimulation(kTRUE), fIsolateInModule(kTRUE)
{
fADCValuesHighnxn = 0x0;
fADCValuesLownxn = 0x0;
fADCValuesHigh2x2 = 0x0;
fADCValuesLow2x2 = 0x0;
SetName("PHOS");
CreateInputs();
fAmptrus = new TClonesArray("TMatrixD",1000);
fAmpmods = new TClonesArray("TMatrixD",1000);
fTimeRtrus = new TClonesArray("TMatrixD",1000);
}
AliPHOSTrigger::AliPHOSTrigger(const AliPHOSTrigger & trig) :
AliTriggerDetector(trig),
f2x2MaxAmp(trig.f2x2MaxAmp),
f2x2CrystalPhi(trig.f2x2CrystalPhi),
f2x2CrystalEta(trig.f2x2CrystalEta),
f2x2SM(trig.f2x2SM),
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),
fAmptrus(trig.fAmptrus), fAmpmods(trig.fAmpmods), fTimeRtrus(trig.fTimeRtrus),
fL0Threshold(trig.fL0Threshold),
fL1JetLowPtThreshold(trig.fL1JetLowPtThreshold),
fL1JetMediumPtThreshold(trig.fL1JetMediumPtThreshold),
fL1JetHighPtThreshold(trig.fL1JetHighPtThreshold),
fNTRU(trig.fNTRU),
fNTRUZ(trig.fNTRUZ),
fNTRUPhi(trig.fNTRUPhi),
fNCrystalsPhi(trig.fNCrystalsPhi),
fNCrystalsZ(trig. fNCrystalsZ),
fPatchSize(trig.fPatchSize),
fIsolPatchSize(trig.fIsolPatchSize),
f2x2AmpOutOfPatch(trig.f2x2AmpOutOfPatch),
fnxnAmpOutOfPatch(trig.fnxnAmpOutOfPatch),
f2x2AmpOutOfPatchThres(trig.f2x2AmpOutOfPatchThres),
fnxnAmpOutOfPatchThres(trig.fnxnAmpOutOfPatchThres),
fIs2x2Isol(trig.fIs2x2Isol),
fIsnxnIsol(trig.fIsnxnIsol),
fSimulation(trig.fSimulation),
fIsolateInModule(trig.fIsolateInModule)
{
}
AliPHOSTrigger::~AliPHOSTrigger()
{
if(fADCValuesHighnxn)delete [] fADCValuesHighnxn;
if(fADCValuesLownxn)delete [] fADCValuesLownxn;
if(fADCValuesHigh2x2)delete [] fADCValuesHigh2x2;
if(fADCValuesLow2x2)delete [] fADCValuesLow2x2;
if(fAmptrus) { fAmptrus->Delete() ; delete fAmptrus ; }
if(fAmpmods) { fAmpmods->Delete() ; delete fAmpmods ; }
if(fTimeRtrus) { fTimeRtrus->Delete(); delete fTimeRtrus; }
}
AliPHOSTrigger & AliPHOSTrigger::operator = (const AliPHOSTrigger &)
{
Fatal("operator =", "no implemented");
return *this;
}
void AliPHOSTrigger::CreateInputs()
{
if( fInputs.GetEntriesFast() > 0 ) return;
TString name = GetName();
fInputs.AddLast( new AliTriggerInput( "0PH0", name, 0 ) );
fInputs.AddLast( new AliTriggerInput( "PHOS_JetHPt_L1",name, 1 ) );
fInputs.AddLast( new AliTriggerInput( "PHOS_JetMPt_L1",name, 1 ) );
fInputs.AddLast( new AliTriggerInput( "PHOS_JetLPt_L1",name, 1 ) );
}
void AliPHOSTrigger::FillTRU(const TClonesArray * digits, const AliPHOSGeometry * geom) const {
if(fNTRUZ*fNTRUPhi != fNTRU)
Error("FillTRU"," Wrong number of TRUS per Z or Phi");
Int_t nModules = geom->GetNModules();
Int_t relid[4] ;
Float_t amp = -1;
Float_t timeR = -1;
Int_t id = -1;
for(Int_t k = 0; k < fNTRU*nModules ; k++){
TMatrixD amptrus(fNCrystalsPhi,fNCrystalsZ) ;
TMatrixD timeRtrus(fNCrystalsPhi,fNCrystalsZ) ;
for(Int_t i = 0; i < fNCrystalsPhi; i++){
for(Int_t j = 0; j < fNCrystalsZ; j++){
amptrus(i,j) = 0.0;
timeRtrus(i,j) = 0.0;
}
}
new((*fAmptrus)[k]) TMatrixD(amptrus) ;
new((*fTimeRtrus)[k]) TMatrixD(timeRtrus) ;
}
Int_t nmodphi = geom->GetNPhi();
Int_t nmodz = geom->GetNZ();
for(Int_t k = 0; k < nModules ; k++){
TMatrixD ampmods(nmodphi,nmodz) ;
for(Int_t i = 0; i < nmodphi; i++){
for(Int_t j = 0; j < nmodz; j++){
ampmods(i,j) = 0.0;
}
}
new((*fAmpmods)[k]) TMatrixD(ampmods) ;
}
AliPHOSDigit * dig ;
for(Int_t idig = 0 ; idig < digits->GetEntriesFast() ; idig++){
dig = static_cast<AliPHOSDigit *>(digits->At(idig)) ;
amp = dig->GetEnergy() ;
id = dig->GetId() ;
timeR = dig->GetTimeR() ;
geom->AbsToRelNumbering(id, relid) ;
if(relid[1] == 0){
Int_t col = (relid[3]-1)/fNCrystalsZ+1;
Int_t row = (relid[2]-1)/fNCrystalsPhi+1;
Int_t itru = (row-1) + (col-1)*fNTRUPhi + (relid[0]-1)*fNTRU ;
TMatrixD * amptrus = static_cast<TMatrixD *>(fAmptrus ->At(itru)) ;
TMatrixD * timeRtrus = static_cast<TMatrixD *>(fTimeRtrus->At(itru)) ;
Int_t irow = (relid[2]-1) - (row-1) * fNCrystalsPhi;
Int_t icol = (relid[3]-1) - (col-1) * fNCrystalsZ;
(*amptrus)(irow,icol) = amp ;
(*timeRtrus)(irow,icol) = timeR ;
TMatrixD * ampmods = static_cast<TMatrixD *>(fAmpmods->At(relid[0]-1)) ;
(*ampmods)(relid[2]-1,relid[3]-1) = amp ;
}
}
}
void AliPHOSTrigger::GetCrystalPhiEtaIndexInModuleFromTRUIndex(Int_t itru, Int_t iphitru, Int_t ietatru,Int_t &iphiMod,Int_t &ietaMod) const
{
Int_t col = itru/ fNTRUPhi + 1;
Int_t row = itru - (col-1)*fNTRUPhi + 1;
iphiMod = fNCrystalsPhi*(row-1) + iphitru + 1 ;
ietaMod = fNCrystalsZ*(col-1) + ietatru + 1 ;
}
Bool_t AliPHOSTrigger::IsPatchIsolated(Int_t iPatchType, const Int_t imod, const Int_t mtru, const Float_t maxamp, const Int_t maxphi, const Int_t maxeta) {
Bool_t b = kFALSE;
Float_t amp = 0;
Int_t itru = mtru+imod*fNTRU ;
TMatrixD * ampmatrix = 0x0;
Int_t colborder = 0;
Int_t rowborder = 0;
if(fIsolateInModule){
ampmatrix = static_cast<TMatrixD *>(fAmpmods->At(imod)) ;
rowborder = fNCrystalsPhi*fNTRUPhi;
colborder = fNCrystalsZ*fNTRUZ;
AliDebug(2,"Isolate trigger in Module");
}
else{
ampmatrix = static_cast<TMatrixD *>(fAmptrus->At(itru)) ;
rowborder = fNCrystalsPhi;
colborder = fNCrystalsZ;
AliDebug(2,"Isolate trigger in TRU");
}
Int_t isolcells = fIsolPatchSize*(1+iPatchType);
Int_t ipatchcells = 2*(1+fPatchSize*iPatchType);
Int_t minrow = maxphi - isolcells;
Int_t mincol = maxeta - isolcells;
Int_t maxrow = maxphi + isolcells + ipatchcells;
Int_t maxcol = maxeta + isolcells + ipatchcells;
AliDebug(2,Form("Number of added Isol Cells %d, Patch Size %d",isolcells, ipatchcells));
AliDebug(2,Form("Patch: minrow %d, maxrow %d, mincol %d, maxcol %d",minrow,maxrow,mincol,maxcol));
if(minrow < 0 || mincol < 0 || maxrow > rowborder || maxcol > colborder){
AliDebug(1,Form("Out of Module/TRU range, cannot isolate patch"));
return kFALSE;
}
for(Int_t irow = minrow ; irow < maxrow; irow ++)
for(Int_t icol = mincol ; icol < maxcol ; icol ++)
amp += (*ampmatrix)(irow,icol);
AliDebug(2,Form("Type %d, Maximum amplitude %f, patch+isol square %f",iPatchType, maxamp, amp));
if(amp < maxamp){
AliError(Form("Bad sum: Type %d, Maximum amplitude %f, patch+isol square %f",iPatchType, maxamp, amp));
return kFALSE;
}
else
amp-=maxamp;
AliDebug(2, Form("Maximum amplitude %f, Out of patch %f",maxamp, amp));
if(iPatchType == 0){
f2x2AmpOutOfPatch = amp;
if(amp < f2x2AmpOutOfPatchThres)
b=kTRUE;
}
else if(iPatchType == 1){
fnxnAmpOutOfPatch = amp;
if(amp < fnxnAmpOutOfPatchThres)
b=kTRUE;
}
return b;
}
void AliPHOSTrigger::MakeSlidingCell(const Int_t imod, TMatrixD &max2, TMatrixD &maxn)
{
Float_t amp2 = 0 ;
Float_t ampn = 0 ;
for(Int_t i = 0; i < 4; i++){
for(Int_t j = 0; j < fNTRU; j++){
ampmax2(i,j) = -1;
ampmaxn(i,j) = -1;
}
}
TMatrixD tru2x2(fNCrystalsPhi/2,fNCrystalsZ/2) ;
for(Int_t i = 0; i < fNCrystalsPhi/2; i++)
for(Int_t j = 0; j < fNCrystalsZ/2; j++)
tru2x2(i,j) = -1.;
for(Int_t itru = 0 + imod * fNTRU ; itru < (imod+1)*fNTRU ; itru++){
TMatrixD * amptru = static_cast<TMatrixD *>(fAmptrus ->At(itru)) ;
TMatrixD * timeRtru = static_cast<TMatrixD *>(fTimeRtrus->At(itru)) ;
Int_t mtru = itru-imod*fNTRU ;
for(Int_t irow = 0 ; irow < fNCrystalsPhi; irow += 2){
for(Int_t icol = 0 ; icol < fNCrystalsZ ; icol += 2){
amp2 = (*amptru)(irow,icol)+(*amptru)(irow+1,icol)+
(*amptru)(irow,icol+1)+(*amptru)(irow+1,icol+1);
tru2x2(irow/2,icol/2) = amp2 ;
if(amp2 > ampmax2(0,mtru)){
ampmax2(0,mtru) = amp2 ;
ampmax2(1,mtru) = irow;
ampmax2(2,mtru) = icol;
}
}
}
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);
}
}
}
if(fPatchSize > 0){
for(Int_t irow = 0 ; irow < fNCrystalsPhi/2; irow++){
for(Int_t icol = 0 ; icol < fNCrystalsZ/2 ; icol++){
ampn = 0;
if( (irow+fPatchSize) < fNCrystalsPhi/2 && (icol+fPatchSize) < fNCrystalsZ/2){
for(Int_t i = 0 ; i <= fPatchSize ; i++)
for(Int_t j = 0 ; j <= fPatchSize ; j++)
ampn += tru2x2(irow+i,icol+j);
if(ampn > ampmaxn(0,mtru)){
ampmaxn(0,mtru) = ampn ;
ampmaxn(1,mtru) = irow*2;
ampmaxn(2,mtru) = icol*2;
}
}
}
}
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) < fNCrystalsPhi && (coln+j) < fNCrystalsZ/2){
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
{
if(! opt)
return;
AliTriggerInput* in = 0x0 ;
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( " -2x2 Isolation Patch %d x %d, Amplitude out of 2x2 patch is %f, threshold %f, Isolated? %d \n",
2*fIsolPatchSize+2, 2*fIsolPatchSize+2, f2x2AmpOutOfPatch, f2x2AmpOutOfPatchThres,static_cast<Int_t> (fIs2x2Isol)) ;
if(fPatchSize > 0){
printf( " Patch Size, n x n: %d x %d cells\n",2*(fPatchSize+1), 2*(fPatchSize+1));
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*fPatchSize, fnxnCrystalEta, fnxnCrystalEta+4*fPatchSize) ;
printf( " -nxn Isolation Patch %d x %d, Amplitude out of nxn patch is %f, threshold %f, Isolated? %d \n",
4*fIsolPatchSize+2*(fPatchSize+1),4*fIsolPatchSize+2*(fPatchSize+1) , fnxnAmpOutOfPatch, fnxnAmpOutOfPatchThres,static_cast<Int_t> (fIsnxnIsol) ) ;
}
printf( " Isolate in Module? %d\n",
fIsolateInModule) ;
printf( " Threshold for LO %10.1f\n",
fL0Threshold) ;
printf( " Threshold for LO %10.2f\n", fL0Threshold) ;
in = (AliTriggerInput*)fInputs.FindObject( "0PH0" );
if(in->GetValue())
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 Jet Low Pt for L1 is set ***\n") ;
printf( " Jet Medium Pt Threshold for L1 %10.2f\n", fL1JetMediumPtThreshold) ;
in = (AliTriggerInput*)fInputs.FindObject( "PHOS_JetMPt_L1" );
if(in->GetValue())
printf( " *** PHOS Jet Medium Pt for L1 is set ***\n") ;
printf( " Jet High Pt Threshold for L1 %10.2f\n", fL1JetHighPtThreshold) ;
in = (AliTriggerInput*) fInputs.FindObject( "PHOS_JetHPt_L1" );
if(in->GetValue())
printf( " *** PHOS Jet High Pt for L1 is set ***\n") ;
}
void AliPHOSTrigger::SetTriggers(const Int_t iMod, const TMatrixD & ampmax2, const TMatrixD & ampmaxn)
{
Float_t max2[] = {-1,-1,-1,-1} ;
Float_t maxn[] = {-1,-1,-1,-1} ;
Int_t mtru2 = -1 ;
Int_t mtrun = -1 ;
for(Int_t i = 0 ; i < fNTRU ; i++){
if(max2[0] < ampmax2(0,i) ){
max2[0] = ampmax2(0,i) ;
max2[1] = ampmax2(1,i) ;
max2[2] = ampmax2(2,i) ;
max2[3] = ampmax2(3,i) ;
mtru2 = i ;
}
if(maxn[0] < ampmaxn(0,i) ){
maxn[0] = ampmaxn(0,i) ;
maxn[1] = ampmaxn(1,i) ;
maxn[2] = ampmaxn(2,i) ;
maxn[3] = ampmaxn(3,i) ;
mtrun = i ;
}
}
Float_t maxtimeR2 = -1 ;
Float_t maxtimeRn = -1 ;
AliPHOSPulseGenerator pulse ;
Int_t nTimeBins = pulse.GetRawFormatTimeBins() ;
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) ;
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])) ;
if (fADCValuesLow2x2 == 0) {
fADCValuesLow2x2 = new Int_t[nTimeBins];
}
if(!fADCValuesHigh2x2) fADCValuesHigh2x2 = new Int_t[nTimeBins];
pulse.SetAmplitude(f2x2MaxAmp);
pulse.SetTZero(maxtimeR2);
pulse.MakeSamples();
pulse.GetSamples(fADCValuesHigh2x2, fADCValuesLow2x2) ;
for(Int_t i = 0 ; i < nTimeBins ; i++){
if(fADCValuesHigh2x2[i] >= fL0Threshold || fADCValuesLow2x2[i] >= fL0Threshold) {
SetInput("0PH0") ;
break;
}
}
}
if(maxn[0] > fnxnMaxAmp && fPatchSize > 0){
fnxnMaxAmp = maxn[0] ;
fnxnSM = iMod ;
maxtimeRn = maxn[3] ;
GetCrystalPhiEtaIndexInModuleFromTRUIndex(mtrun,
static_cast<Int_t>(maxn[1]),
static_cast<Int_t>(maxn[2]),
fnxnCrystalPhi,fnxnCrystalEta) ;
if(fIsolateInModule)
fIsnxnIsol = IsPatchIsolated(1, iMod, mtrun, fnxnMaxAmp, fnxnCrystalPhi, fnxnCrystalEta) ;
else
fIsnxnIsol = IsPatchIsolated(1, iMod, mtrun, fnxnMaxAmp, static_cast<Int_t>(maxn[1]), static_cast<Int_t>(maxn[2])) ;
if (fADCValuesHighnxn == 0) {
fADCValuesHighnxn = new Int_t[nTimeBins];
fADCValuesLownxn = new Int_t[nTimeBins];
}
pulse.SetAmplitude(fnxnMaxAmp);
pulse.SetTZero(maxtimeRn);
pulse.MakeSamples();
pulse.GetSamples(fADCValuesHighnxn, fADCValuesLownxn) ;
for(Int_t i = 0 ; i < nTimeBins ; i++){
if(fADCValuesHighnxn[i] >= fL1JetLowPtThreshold || fADCValuesLownxn[i] >= fL1JetLowPtThreshold){
SetInput("PHOS_JetLPt_L1") ;
break;
}
}
for(Int_t i = 0 ; i < nTimeBins ; i++){
if(fADCValuesHighnxn[i] >= fL1JetMediumPtThreshold || fADCValuesLownxn[i] >= fL1JetMediumPtThreshold){
SetInput("PHOS_JetMPt_L1") ;
break;
}
}
for(Int_t i = 0 ; i < nTimeBins ; i++){
if(fADCValuesHighnxn[i] >= fL1JetHighPtThreshold || fADCValuesLownxn[i] >= fL1JetHighPtThreshold){
SetInput("PHOS_JetHPt_L1") ;
break;
}
}
}
}
void AliPHOSTrigger::Trigger(TClonesArray *digits)
{
fDigitsList = digits;
DoIt() ;
}
void AliPHOSTrigger::DoIt()
{
AliRunLoader* rl = AliRunLoader::Instance() ;
AliPHOSLoader * phosLoader = static_cast<AliPHOSLoader*>(rl->GetLoader("PHOSLoader"));
AliPHOSGeometry *geom;
if (!(geom = AliPHOSGeometry::GetInstance()))
geom = AliPHOSGeometry::GetInstance("IHEP","");
Int_t nModules = geom->GetNModules();
fNCrystalsPhi = geom->GetNPhi()/fNTRUPhi ;
fNCrystalsZ = geom->GetNZ()/fNTRUZ ;
f2x2MaxAmp = -1; f2x2CrystalPhi = -1; f2x2CrystalEta = -1;
fnxnMaxAmp = -1; fnxnCrystalPhi = -1; fnxnCrystalEta = -1;
if(fSimulation)
fDigitsList = phosLoader->Digits() ;
if(!fDigitsList)
AliFatal("Digits not found !") ;
FillTRU(fDigitsList,geom) ;
TMatrixD ampmax2(4,fNTRU) ;
TMatrixD ampmaxn(4,fNTRU) ;
for(Int_t imod = 0 ; imod < nModules ; imod++) {
MakeSlidingCell(imod, ampmax2, ampmaxn);
SetTriggers(imod,ampmax2,ampmaxn) ;
}
fAmptrus->Delete();
fAmpmods->Delete();
fTimeRtrus->Delete();
}