]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSTrigger.cxx
Macro for checking the serial & bin number of the mounted manus
[u/mrichter/AliRoot.git] / PHOS / AliPHOSTrigger.cxx
index e289e69f1860da27a79352f540a76ee0ec762931..ba2bbc4fb58d66ce34c8e150a223105e8a8f2815 100644 (file)
 
 
 // --- 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"
 
@@ -121,6 +124,18 @@ AliPHOSTrigger::AliPHOSTrigger(const AliPHOSTrigger & trig) :
   // 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 &)
 {
@@ -134,11 +149,13 @@ void AliPHOSTrigger::CreateInputs()
    
    // 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 ) );
  
 }
 
@@ -555,8 +572,9 @@ void AliPHOSTrigger::SetTriggers(const TClonesArray * ampmatrix, const Int_t iMo
     //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);
@@ -595,8 +613,8 @@ void AliPHOSTrigger::SetTriggers(const TClonesArray * ampmatrix, const Int_t iMo
       fADCValuesLownxn  = new Int_t[nTimeBins];
     }
 
-    pulse.SetAmplitude(maxtimeRn);
-    pulse.SetTZero(fnxnMaxAmp);
+    pulse.SetAmplitude(fnxnMaxAmp);
+    pulse.SetTZero(maxtimeRn);
     pulse.MakeSamples();
     pulse.GetSamples(fADCValuesHighnxn, fADCValuesLownxn) ;
     
@@ -626,35 +644,26 @@ void AliPHOSTrigger::SetTriggers(const TClonesArray * ampmatrix, const Int_t iMo
 }
 
 //____________________________________________________________________________
-void AliPHOSTrigger::Trigger() 
+void AliPHOSTrigger::Trigger(TClonesArray *digits
 {
-
   //Main Method to select triggers.
 
-  AliRunLoader * rl = gAlice->GetRunLoader() ; 
-  TString fileName = rl->GetFileName() ; 
-  DoIt(fileName.Data()) ; 
+  fDigitsList = digits;
+  DoIt() ; 
 }
 
 //____________________________________________________________________________
-void AliPHOSTrigger::Trigger(const char * fileName) 
-{
-
-  //Main Method to select triggers.
-
-  
-  DoIt(fileName) ; 
-}
-
-//____________________________________________________________________________
-void AliPHOSTrigger::DoIt(const char * fileName) 
+void AliPHOSTrigger::DoIt()
 {
   // does the trigger job
 
-  AliPHOSGetter * gime = AliPHOSGetter::Instance( fileName ) ;
+  AliRunLoader* rl = AliRunLoader::GetRunLoader() ;
+  AliPHOSLoader * phosLoader = dynamic_cast<AliPHOSLoader*>(rl->GetLoader("PHOSLoader"));
   
-  //Get Geometry
-  const AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry() ;
+  // Get PHOS Geometry object
+  AliPHOSGeometry *geom;
+  if (!(geom = AliPHOSGeometry::GetInstance())) 
+        geom = AliPHOSGeometry::GetInstance("IHEP","");
    
   //Define parameters
   Int_t nModules     = geom->GetNModules();
@@ -667,7 +676,7 @@ void AliPHOSTrigger::DoIt(const char * fileName)
 
   //Take the digits list if simulation
   if(fSimulation)
-    fDigitsList = gime->Digits() ;
+    fDigitsList = phosLoader->Digits() ;
   
   if(!fDigitsList)
     AliFatal("Digits not found !") ;
@@ -691,7 +700,7 @@ void AliPHOSTrigger::DoIt(const char * fileName)
     //Set the trigger
     if(fIsolateInModule)
       SetTriggers(ampmods,imod,ampmax2,ampmaxn) ;
-    if(!fIsolateInModule)
+    else
       SetTriggers(amptrus,imod,ampmax2,ampmaxn) ;
   }