// --- ROOT system ---
+#include "TMath.h"
// --- ALIROOT system ---
+#include "AliConfig.h"
#include "AliPHOS.h"
#include "AliPHOSTrigger.h"
#include "AliPHOSGeometry.h"
-#include "AliPHOSGetter.h"
+#include "AliPHOSDigit.h"
+#include "AliPHOSLoader.h"
#include "AliPHOSPulseGenerator.h"
#include "AliTriggerInput.h"
// cpy ctor
}
+//_________________________________________________________________________
+AliPHOSTrigger::~AliPHOSTrigger()
+{
+ // dtor
+
+ if(fADCValuesHighnxn)delete [] fADCValuesHighnxn;
+ if(fADCValuesLownxn)delete [] fADCValuesLownxn;
+ if(fADCValuesHigh2x2)delete [] fADCValuesHigh2x2;
+ if(fADCValuesLow2x2)delete [] fADCValuesLow2x2;
+ // fDigitsList is now ours...
+}
+
//_________________________________________________________________________
AliPHOSTrigger & AliPHOSTrigger::operator = (const AliPHOSTrigger &)
{
// Do not create inputs again!!
if( fInputs.GetEntriesFast() > 0 ) return;
+
+ TString name = GetName();
- 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_JetMPt_L1","PHOS Jet Medium Pt L1", 0x08 ) );
- fInputs.AddLast( new AliTriggerInput( "PHOS_JetLPt_L1","PHOS Jet Low Pt L1", 0x016 ) );
+ fInputs.AddLast( new AliTriggerInput( "PHOS_L0", 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 ) );
}
AliDebug(2,Form("Type %d, Maximum amplitude %f, patch+isol square %f",iPatchType, maxamp, amp));
- if(amp < maxamp){
+ if(TMath::Nint(amp*1E5) < TMath::Nint(maxamp*1E5)){
AliError(Form("Bad sum: Type %d, Maximum amplitude %f, patch+isol square %f",iPatchType, maxamp, amp));
return kFALSE;
}
Float_t maxtimeR2 = -1 ;
Float_t maxtimeRn = -1 ;
// Create a shaper pulse object
- AliPHOSPulseGenerator *pulse = new AliPHOSPulseGenerator();
- Int_t nTimeBins = pulse->GetRawFormatTimeBins() ;
+ AliPHOSPulseGenerator pulse ;
+ Int_t nTimeBins = pulse.GetRawFormatTimeBins() ;
//Set max 2x2 amplitude and select L0 trigger
if(max2[0] > f2x2MaxAmp ){
//Transform digit amplitude in Raw Samples
if (fADCValuesLow2x2 == 0) {
fADCValuesLow2x2 = new Int_t[nTimeBins];
- fADCValuesHigh2x2 = new Int_t[nTimeBins];
}
+ if(!fADCValuesHigh2x2) fADCValuesHigh2x2 = new Int_t[nTimeBins];
+
- pulse->SetAmplitude(f2x2MaxAmp);
- pulse->SetTZero(maxtimeR2);
- pulse->MakeSamples();
- pulse->GetSamples(fADCValuesHigh2x2, fADCValuesLow2x2) ;
+ pulse.SetAmplitude(f2x2MaxAmp);
+ pulse.SetTZero(maxtimeR2);
+ pulse.MakeSamples();
+ pulse.GetSamples(fADCValuesHigh2x2, fADCValuesLow2x2) ;
//Set Trigger Inputs, compare ADC time bins until threshold is attained
//Set L0
fADCValuesLownxn = new Int_t[nTimeBins];
}
- pulse->SetAmplitude(maxtimeRn);
- pulse->SetTZero(fnxnMaxAmp);
- pulse->MakeSamples();
- pulse->GetSamples(fADCValuesHighnxn, fADCValuesLownxn) ;
+ pulse.SetAmplitude(fnxnMaxAmp);
+ pulse.SetTZero(maxtimeRn);
+ pulse.MakeSamples();
+ pulse.GetSamples(fADCValuesHighnxn, fADCValuesLownxn) ;
//Set Trigger Inputs, compare ADC time bins until threshold is attained
//SetL1 Low
}
//____________________________________________________________________________
-void AliPHOSTrigger::Trigger()
+void AliPHOSTrigger::Trigger(TClonesArray *digits)
{
-
//Main Method to select triggers.
- AliRunLoader *rl = gAlice->GetRunLoader();
- //Getter
- AliPHOSGetter * gime = AliPHOSGetter::Instance( rl->GetFileName() ) ;
- //AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
- //Get Geometry
- const AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ;
+ fDigitsList = digits;
+ DoIt() ;
+}
+
+//____________________________________________________________________________
+void AliPHOSTrigger::DoIt()
+{
+ // does the trigger job
+
+ AliRunLoader* rl = AliRunLoader::GetRunLoader() ;
+ AliPHOSLoader * phosLoader = dynamic_cast<AliPHOSLoader*>(rl->GetLoader("PHOSLoader"));
+
+ // Get PHOS Geometry object
+ AliPHOSGeometry *geom;
+ if (!(geom = AliPHOSGeometry::GetInstance()))
+ geom = AliPHOSGeometry::GetInstance("IHEP","");
//Define parameters
Int_t nModules = geom->GetNModules();
//Take the digits list if simulation
if(fSimulation)
- fDigitsList = gime->Digits() ;
+ fDigitsList = phosLoader->Digits() ;
if(!fDigitsList)
AliFatal("Digits not found !") ;
//Set the trigger
if(fIsolateInModule)
SetTriggers(ampmods,imod,ampmax2,ampmaxn) ;
- if(!fIsolateInModule)
+ else
SetTriggers(amptrus,imod,ampmax2,ampmaxn) ;
}