]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Merge branch 'trigger'
authorslindal <slindal@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 31 Mar 2010 17:52:32 +0000 (17:52 +0000)
committerslindal <slindal@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 31 Mar 2010 17:52:32 +0000 (17:52 +0000)
* trigger:
  Tested new CALO cluster Energy trigger class with 2 child instances, PHOS & EMCal
  Changed PHOS threshold trigger to CALO threshold trigger and made PHOS a child. Emcal not yet added

HLT/libAliHLTTrigger.pkg
HLT/trigger/AliHLTTriggerAgent.cxx
HLT/trigger/AliHLTTriggerCaloClusterEnergy.cxx [new file with mode: 0644]
HLT/trigger/AliHLTTriggerCaloClusterEnergy.h [new file with mode: 0644]
HLT/trigger/AliHLTTriggerEmcalClusterEnergy.cxx [new file with mode: 0644]
HLT/trigger/AliHLTTriggerEmcalClusterEnergy.h [new file with mode: 0644]
HLT/trigger/AliHLTTriggerLinkDef.h
HLT/trigger/AliHLTTriggerPhosClusterEnergy.cxx
HLT/trigger/AliHLTTriggerPhosClusterEnergy.h
HLT/trigger/test/testPhosClusterEnergyTrigger.C

index c01f789547f6b6fe3af7bb0935eacf219f27ee1f..64d8261034d379e725c42b07b4ed4b244e59d4e5 100644 (file)
@@ -26,7 +26,9 @@ CLASS_HDRS:= \
                 AliHLTRunSummaryProducerComponent.h         \
                 AliHLTTriggerSelectiveReadoutComponent.h    \
                 AliHLTTriggerMonitoringComponent.h          \
+               AliHLTTriggerCaloClusterEnergy.h            \
                AliHLTTriggerPhosClusterEnergy.h            \
+               AliHLTTriggerEmcalClusterEnergy.h           \
                AliHLTTriggerPhosMip.h                      \
                AliHLTTriggerTrdClusterMultiplicity.h       \
                AliHLTTriggerBarrelGeomMultiplicity.h       \
index 704913ec17e865b64ed7032ef84a571c8a391c32..56507fbbf9260835763ad5eb5c572701f9dc406e 100644 (file)
@@ -45,6 +45,7 @@
 #include "AliHLTTriggerBarrelCosmic.h"
 #include "AliHLTGlobalTriggerComponent.h"
 #include "AliHLTTriggerPhosClusterEnergy.h"
+#include "AliHLTTriggerEmcalClusterEnergy.h"
 #include "AliHLTTriggerPhosMip.h"
 #include "AliHLTTriggerTrdClusterMultiplicity.h"
 #include "AliHLTTriggerGammaConversion.h"
@@ -84,6 +85,7 @@ int AliHLTTriggerAgent::RegisterComponents(AliHLTComponentHandler* pHandler) con
   pHandler->AddComponent(new AliHLTTriggerBarrelGeomMultiplicity);
   pHandler->AddComponent(new AliHLTTriggerBarrelCosmic);
   pHandler->AddComponent(new AliHLTTriggerPhosClusterEnergy); 
+  pHandler->AddComponent(new AliHLTTriggerEmcalClusterEnergy); 
   pHandler->AddComponent(new AliHLTTriggerPhosMip); 
   pHandler->AddComponent(new AliHLTTriggerTrdClusterMultiplicity);
   pHandler->AddComponent(new AliHLTTriggerGammaConversion);
diff --git a/HLT/trigger/AliHLTTriggerCaloClusterEnergy.cxx b/HLT/trigger/AliHLTTriggerCaloClusterEnergy.cxx
new file mode 100644 (file)
index 0000000..ab6eb00
--- /dev/null
@@ -0,0 +1,206 @@
+// $Id$
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//*                                                                        *
+//* Primary Authors: Svein Lindal <svein.lindal@gmail.com>                 *
+//*                  for The ALICE HLT Project.                            *
+//*                                                                        *
+//* Permission to use, copy, modify and distribute this software and its   *
+//* documentation strictly for non-commercial purposes is hereby granted   *
+//* without fee, provided that the above copyright notice appears in all   *
+//* copies and that both the copyright notice and this permission notice   *
+//* appear in the supporting documentation. The authors make no claims     *
+//* about the suitability of this software for any purpose. It is          *
+//* provided "as is" without express or implied warranty.                  *
+//**************************************************************************
+
+/// @file   AliHLTTriggerCaloClusterEnergy.cxx
+/// @author Svein Lindal <slindal@fys.uio.no>
+/// @date   2009-08-17
+/// @brief  BASE class for energy threshold trigger for Calorimeters
+///      
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+
+#include "AliHLTTriggerCaloClusterEnergy.h"
+#include "AliESDEvent.h"
+#include "AliESDCaloCluster.h"
+#include "AliHLTTriggerDecision.h"
+#include "AliHLTDomainEntry.h"
+#include "AliHLTCaloClusterReader.h"
+#include "AliHLTCaloClusterDataStruct.h"
+#include "TRefArray.h"
+#include "TString.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTTriggerCaloClusterEnergy)
+
+AliHLTTriggerCaloClusterEnergy::AliHLTTriggerCaloClusterEnergy(TString detector) : 
+  AliHLTTrigger(),
+  fEThreshold(0.0),
+  fClustersRefs(NULL),
+  fDetector(detector),
+  fClusterReader(NULL),
+  fgkOCDBEntry(""), 
+  fgkInputDataType()
+{
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlts
+
+  fClusterReader = new AliHLTCaloClusterReader();
+  fClustersRefs = new TRefArray();
+
+}
+
+//const char* AliHLTTriggerCaloClusterEnergy::fgkOCDBEntry="HLT/ConfigHLT/CaloClusterEnergyTrigger";
+
+AliHLTTriggerCaloClusterEnergy::~AliHLTTriggerCaloClusterEnergy() {
+  // see header file for class documentation
+}
+
+Int_t AliHLTTriggerCaloClusterEnergy::DoTrigger() {
+  // see header file for class documentation
+  
+  Int_t iResult = 0;
+
+
+  if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) )
+    return 0;
+
+  //Try the caloclusterstruct input
+
+  
+  for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(fgkInputDataType); pBlock!=NULL; pBlock=GetNextInputBlock()) {
+    AliHLTCaloClusterHeaderStruct *caloClusterHeader = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(pBlock->fPtr);
+    fClusterReader->SetMemory(caloClusterHeader);
+    
+    AliHLTCaloClusterDataStruct * caloClusterStruct;
+    while( (caloClusterStruct = fClusterReader->NextCluster()) != 0) {
+      if (TriggerOnCluster(caloClusterStruct)) {
+       return iResult;
+      }
+    }
+  }
+
+  //Try the ESD input
+  const TObject* obj = GetFirstInputObject(kAliHLTAllDataTypes, "AliESDEvent");
+  AliESDEvent* esd = dynamic_cast<AliESDEvent*>(const_cast<TObject*>(obj));
+  
+  if (esd != NULL) {
+    esd->GetStdContent();
+
+    Int_t ncc = GetClustersFromEsd(esd, fClustersRefs); 
+    
+    for (Int_t i = 0; i < ncc ; i++) {
+      
+      AliESDCaloCluster * cluster = static_cast<AliESDCaloCluster*>(fClustersRefs->At(i));
+      if(TriggerOnCluster(cluster)) {
+       return iResult;
+      }
+    }
+  }
+
+  // If we got to this point then we did not find any clusters with E > fEThreshold
+  // generate negative trigger decision
+  TString description;
+  description.Form("No %s clusters containing energy > %.02f GeV found.", fDetector.Data(), fEThreshold);
+  SetDescription(description.Data());
+  TriggerEvent(false);
+  return iResult;
+
+}
+
+
+template <class T>
+Bool_t AliHLTTriggerCaloClusterEnergy::TriggerOnCluster(T* cluster) {
+  
+  if (cluster->E() > fEThreshold) {
+
+    //We have a cluster satisfying trigger criteria
+    TString description;
+    description.Form("Event contains at least one %s cluster with energy > %.02f GeV.", fDetector.Data(), fEThreshold);
+    SetDescription(description.Data());
+    
+    // Enable the detectors for readout.
+    GetReadoutList().Enable( AliHLTReadoutList::kPHOS );
+    
+    // Add the available HLT information for readout too.
+    GetTriggerDomain().Add(kAliHLTAnyDataTypeID, fDetector.Data());
+    
+    //Set trigger decision
+    TriggerEvent(kTRUE);
+    
+    return kTRUE;
+  } 
+
+
+  return kFALSE;
+
+}
+
+
+
+
+int AliHLTTriggerCaloClusterEnergy::DoInit(int argc, const char** argv) {
+  // see header file for class documentation
+
+  // first configure the default
+  int iResult=ConfigureFromCDBTObjString(fgkOCDBEntry);
+
+  // configure from the command line parameters if specified
+  if (iResult>=0 && argc>0) {
+    iResult=ConfigureFromArgumentString(argc, argv);
+    HLTImportant("Trigger threshold set from argument string:  %.02f GeV:", fEThreshold ); 
+  } else if ( iResult >=0 ) {
+    HLTImportant("Trigger threshold set from OCDB database entry:  %.02f GeV:", fEThreshold ); 
+  }
+  return iResult;
+}
+
+int AliHLTTriggerCaloClusterEnergy::DoDeinit() {
+  // see header file for class documentation
+  return 0;
+}
+
+int AliHLTTriggerCaloClusterEnergy::Reconfigure(const char* cdbEntry, const char* /*chainId*/) {
+  // see header file for class documentation
+
+  // configure from the specified antry or the default one
+  const char* entry=cdbEntry;
+  if (!entry || entry[0]==0) entry=fgkOCDBEntry;
+
+  return ConfigureFromCDBTObjString(entry);
+}
+
+int AliHLTTriggerCaloClusterEnergy::ScanConfigurationArgument(int argc, const char** argv) {
+  // see header file for class documentation
+  if (argc<=0) return 0;
+  int i=0;
+  TString argument=argv[i];
+
+  // -maxpt
+  if (argument.CompareTo("-energy")==0) {
+    if (++i>=argc) return -EPROTO;
+    argument=argv[i];
+    fEThreshold=argument.Atof();
+    return 2;
+  }    
+  
+  // unknown argument
+  return -EINVAL;
+}
+
+void AliHLTTriggerCaloClusterEnergy::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier) {
+  // see header file for class documentation
+  constBase = sizeof(AliHLTTriggerDecision) + sizeof(AliHLTDomainEntry)*14;
+  inputMultiplier = 1;
+}
diff --git a/HLT/trigger/AliHLTTriggerCaloClusterEnergy.h b/HLT/trigger/AliHLTTriggerCaloClusterEnergy.h
new file mode 100644 (file)
index 0000000..90ca5da
--- /dev/null
@@ -0,0 +1,141 @@
+//-*- Mode: C++ -*-
+// $Id$
+#ifndef ALIHLTTRIGGERCALOCLUSTERENERGY_H
+#define ALIHLTTRIGGERCALOCLUSTERENERGY_H
+
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//* See cxx source for full Copyright notice                               *
+
+/// @file   AliHLTTriggerCaloClusterEnergy.h
+/// @author Svein Lindal
+/// @date   2009-08-17
+/// @brief  HLT energy threshold trigger for PHOS
+
+/**
+ * @class  AliHLTTriggerCaloClusterEnergy
+ * HLT trigger component for high energy clusters in PHOS
+ * 
+ * Triggers on PHOS clusters containing energy > threshold value. 
+ * Configurable through database entry or from command line using "-energy" option
+ *
+ * <h2>General properties:</h2>
+ *
+ * Component ID: \b CaloClusterEnergyTrigger                             <br>
+ * Library: \b libAliHLTTrigger.so                                        <br>
+ * Input Data Types:  kAliHLTDataTypeESDObject, kAliHLTDataTypeESDTree    <br>
+ * Output Data Types: ::kAliHLTAnyDataType                                <br>
+ *
+ * <h2>Mandatory arguments:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ *
+ * <h2>Optional arguments:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ *
+ * <h2>Configuration:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ * \li -energy     <i> e   </i> <br>
+ *      required energy of the cluster
+ *
+ * By default, configuration is loaded from OCDB, can be overridden by
+ * component arguments.
+ *
+ * <h2>Default CDB entries:</h2>
+ * HLT/ConfigHLT/CaloClusterEnergyTrigger: TObjString storing the arguments
+ *
+ * <h2>Performance:</h2>
+ * 
+ *
+ * <h2>Memory consumption:</h2>
+ * 
+ *
+ * <h2>Output size:</h2>
+ * 
+ *
+ * \ingroup alihlt_trigger_components
+ */
+
+
+#include "AliHLTTrigger.h"
+class AliHLTCaloClusterReader;
+class TRefArray;
+class AliESDEvent;
+
+class AliHLTTriggerCaloClusterEnergy : public AliHLTTrigger
+{
+
+public:
+  AliHLTTriggerCaloClusterEnergy(TString detector);
+  ~AliHLTTriggerCaloClusterEnergy();
+
+  /// inherited from AliHLTTrigger: name of this trigger
+  virtual const char* GetTriggerName() const = 0;
+  /// inherited from AliHLTComponent: create an instance
+  virtual AliHLTComponent* Spawn() = 0;
+
+ protected:
+  /// inherited from AliHLTComponent: handle the initialization
+  int DoInit(int argc, const char** argv);
+
+  /// inherited from AliHLTComponent: handle cleanup
+  int DoDeinit();
+
+  /// inherited from AliHLTComponent: handle re-configuration event
+  int Reconfigure(const char* cdbEntry, const char* chainId);
+
+  /// inherited from AliHLTComponent, scan one argument and
+  /// its parameters
+  int ScanConfigurationArgument(int argc, const char** argv);
+
+  /// inherited from AliHLTComponent
+  //  Get a ratio by how much the data volume is shrunken or enhanced.
+  virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
+
+protected :
+
+  ///Get the clusters from the esd
+  virtual Int_t GetClustersFromEsd( const AliESDEvent * esd, TRefArray * clustersRefs ) = 0;
+
+  /// inherited from AliHLTTrigger: calculate the trigger
+  Int_t DoTrigger();
+
+  ///Default constructor prohibited
+  AliHLTTriggerCaloClusterEnergy();
+
+  /// Copy constructor prohibited
+  AliHLTTriggerCaloClusterEnergy(const AliHLTTriggerCaloClusterEnergy & );
+
+  /// Assignment operator prohibited
+  AliHLTTriggerCaloClusterEnergy& operator=(const AliHLTTriggerCaloClusterEnergy &);
+  /// Check if cluster fullfills criteria and if so trigger
+  template <class T> 
+  Bool_t TriggerOnCluster(T* cluster);
+
+  /// Threshold cluster energy to trigger on
+  Float_t fEThreshold;
+
+  ///array to hold esd clusters
+  TRefArray * fClustersRefs;  //!transient
+
+  //The detector string (PHOS or EMCAL)
+  const TString fDetector;
+
+  ///Cluster data struct reader
+  AliHLTCaloClusterReader * fClusterReader; //!transient
+
+  /// the default configuration entry for this component
+  const char* fgkOCDBEntry; //!transient
+
+  
+  AliHLTComponentDataType fgkInputDataType;
+  
+
+  ClassDef(AliHLTTriggerCaloClusterEnergy, 0)
+};
+
+
+
+
+
+#endif //ALIHLTTRIGGERCALOCLUSTERENERGY_H
diff --git a/HLT/trigger/AliHLTTriggerEmcalClusterEnergy.cxx b/HLT/trigger/AliHLTTriggerEmcalClusterEnergy.cxx
new file mode 100644 (file)
index 0000000..596c51e
--- /dev/null
@@ -0,0 +1,73 @@
+// $Id$
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//*                                                                        *
+//* Primary Authors: Svein Lindal <svein.lindal@gmail.com>                 *
+//*                  for The ALICE HLT Project.                            *
+//*                                                                        *
+//* Permission to use, copy, modify and distribute this software and its   *
+//* documentation strictly for non-commercial purposes is hereby granted   *
+//* without fee, provided that the above copyright notice appears in all   *
+//* copies and that both the copyright notice and this permission notice   *
+//* appear in the supporting documentation. The authors make no claims     *
+//* about the suitability of this software for any purpose. It is          *
+//* provided "as is" without express or implied warranty.                  *
+//**************************************************************************
+
+/// @file   AliHLTTriggerEmcalClusterEnergy.cxx
+/// @author Svein Lindal <slindal@fys.uio.no>
+/// @date   2009-08-17
+/// @brief  HLT energy threshold trigger for EMCAL
+///      
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+
+#include "AliHLTTriggerEmcalClusterEnergy.h"
+#include "AliESDEvent.h"
+#include "AliESDCaloCluster.h"
+#include "AliHLTTriggerDecision.h"
+#include "AliHLTDomainEntry.h"
+
+
+AliHLTTriggerEmcalClusterEnergy gEmcalClusterEnergyTrigger;
+
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTTriggerEmcalClusterEnergy)
+
+AliHLTTriggerEmcalClusterEnergy::AliHLTTriggerEmcalClusterEnergy()  : 
+AliHLTTriggerCaloClusterEnergy("EMCAL")
+{
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlts
+
+  fgkOCDBEntry = "HLT/ConfigHLT/EmcalClusterEnergyTrigger";
+  fgkInputDataType = kAliHLTDataTypeCaloCluster | kAliHLTDataOriginEMCAL;
+}
+
+AliHLTTriggerEmcalClusterEnergy::~AliHLTTriggerEmcalClusterEnergy() {
+  // see header file for class documentation
+}
+
+const char* AliHLTTriggerEmcalClusterEnergy::GetTriggerName() const {
+  // see header file for class documentation
+  return "EmcalClusterEnergyTrigger";
+}
+
+AliHLTComponent* AliHLTTriggerEmcalClusterEnergy::Spawn() {
+  // see header file for class documentation
+  return new AliHLTTriggerEmcalClusterEnergy;
+}
+
+Int_t AliHLTTriggerEmcalClusterEnergy::GetClustersFromEsd( const AliESDEvent * esd, TRefArray * clustersRefs ){
+  return esd->GetEMCALClusters(clustersRefs);
+}
diff --git a/HLT/trigger/AliHLTTriggerEmcalClusterEnergy.h b/HLT/trigger/AliHLTTriggerEmcalClusterEnergy.h
new file mode 100644 (file)
index 0000000..a4c69c1
--- /dev/null
@@ -0,0 +1,80 @@
+//-*- Mode: C++ -*-
+// $Id$
+#ifndef ALIHLTTRIGGEREMCALCLUSTERENERGY_H
+#define ALIHLTTRIGGEREMCALCLUSTERENERGY_H
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//* See cxx source for full Copyright notice                               *
+
+/// @file   AliHLTTriggerEmcalClusterEnergy.h
+/// @author Svein Lindal
+/// @date   2009-08-17
+/// @brief  HLT energy threshold trigger for EMCAL
+
+#include "AliHLTTriggerCaloClusterEnergy.h"
+
+/**
+ * @class  AliHLTTriggerEmcalClusterEnergy
+ * HLT trigger component for high energy clusters in EMCAL
+ * 
+ * Triggers on EMCAL clusters containing energy > threshold value. 
+ * Configurable through database entry or from command line using "-energy" option
+ *
+ * <h2>General properties:</h2>
+ *
+ * Component ID: \b EmcalClusterEnergyTrigger                             <br>
+ * Library: \b libAliHLTTrigger.so                                        <br>
+ * Input Data Types:  kAliHLTDataTypeESDObject, kAliHLTDataTypeESDTree    <br>
+ * Output Data Types: ::kAliHLTAnyDataType                                <br>
+ *
+ * <h2>Mandatory arguments:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ *
+ * <h2>Optional arguments:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ *
+ * <h2>Configuration:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ * \li -energy     <i> e   </i> <br>
+ *      required energy of the cluster
+ *
+ * By default, configuration is loaded from OCDB, can be overridden by
+ * component arguments.
+ *
+ * <h2>Default CDB entries:</h2>
+ * HLT/ConfigHLT/EmcalClusterEnergyTrigger: TObjString storing the arguments
+ *
+ * <h2>Performance:</h2>
+ * 
+ *
+ * <h2>Memory consumption:</h2>
+ * 
+ *
+ * <h2>Output size:</h2>
+ * 
+ *
+ * \ingroup alihlt_trigger_components
+ */
+
+class AliHLTTriggerEmcalClusterEnergy : public AliHLTTriggerCaloClusterEnergy {
+
+public:
+  AliHLTTriggerEmcalClusterEnergy();
+  ~AliHLTTriggerEmcalClusterEnergy();
+
+
+  /// inherited from AliHLTTrigger: name of this trigger
+  const char* GetTriggerName() const;
+  /// inherited from AliHLTComponent: create an instance
+  AliHLTComponent* Spawn();
+
+
+private:
+
+  ///Inherited from AliHLTTriggerCaloClusterEnergy, get the correct set of ESD calo clusters
+  Int_t GetClustersFromEsd( const AliESDEvent * esd, TRefArray * clustersRefs );
+
+  ClassDef(AliHLTTriggerEmcalClusterEnergy, 0)
+};
+
+#endif
index 5ff8de492bc826786795067fa9259ff8fcb272b6..8f7d228352b349ab9e0d29dc6b5a1542bf40a56b 100644 (file)
@@ -21,7 +21,9 @@
 #pragma link C++ class AliHLTRunSummaryProducerComponent+;
 #pragma link C++ class AliHLTTriggerSelectiveReadoutComponent+;
 #pragma link C++ class AliHLTTriggerMonitoringComponent+;
+#pragma link C++ class AliHLTTriggerCaloClusterEnergy+;
 #pragma link C++ class AliHLTTriggerPhosClusterEnergy+;
+#pragma link C++ class AliHLTTriggerEmcalClusterEnergy+;
 #pragma link C++ class AliHLTTriggerPhosMip+;
 #pragma link C++ class AliHLTTriggerTrdClusterMultiplicity+;
 #pragma link C++ class AliHLTTriggerDetectorGeom+;
index 856df682a91d4ad3d235594d827812fdd94b80c9..591823b3896c90515a970eeb7e1750a52679227a 100644 (file)
 #include "AliHLTTriggerDecision.h"
 #include "AliHLTDomainEntry.h"
 
+
+AliHLTTriggerPhosClusterEnergy gPhosClusterEnergyTrigger;
+
+
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTTriggerPhosClusterEnergy)
 
-AliHLTTriggerPhosClusterEnergy::AliHLTTriggerPhosClusterEnergy() 
-  : AliHLTTrigger()
-  , fEThreshold(0.0)
+AliHLTTriggerPhosClusterEnergy::AliHLTTriggerPhosClusterEnergy()  : 
+AliHLTTriggerCaloClusterEnergy("PHOS")
 {
   // see header file for class documentation
   // or
   // refer to README to build package
   // or
   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlts
-}
 
-const char* AliHLTTriggerPhosClusterEnergy::fgkOCDBEntry="HLT/ConfigHLT/PhosClusterEnergyTrigger";
+  fgkOCDBEntry = "HLT/ConfigHLT/PhosClusterEnergyTrigger";
+  fgkInputDataType = kAliHLTDataTypeCaloCluster | kAliHLTDataOriginPHOS;
+}
 
-AliHLTTriggerPhosClusterEnergy::~AliHLTTriggerPhosClusterEnergy()
-{
+AliHLTTriggerPhosClusterEnergy::~AliHLTTriggerPhosClusterEnergy() {
   // see header file for class documentation
 }
 
-const char* AliHLTTriggerPhosClusterEnergy::GetTriggerName() const
-{
+const char* AliHLTTriggerPhosClusterEnergy::GetTriggerName() const {
   // see header file for class documentation
   return "PhosClusterEnergyTrigger";
 }
 
-AliHLTComponent* AliHLTTriggerPhosClusterEnergy::Spawn()
-{
+AliHLTComponent* AliHLTTriggerPhosClusterEnergy::Spawn() {
   // see header file for class documentation
   return new AliHLTTriggerPhosClusterEnergy;
 }
 
-int AliHLTTriggerPhosClusterEnergy::DoTrigger()
-{
-  // see header file for class documentation
-
-  TString description;
-
-  const TObject* obj = GetFirstInputObject(kAliHLTAllDataTypes, "AliESDEvent");
-  AliESDEvent* esd = dynamic_cast<AliESDEvent*>(const_cast<TObject*>(obj));
-  
-  if (esd != NULL) {
-    esd->GetStdContent();
-    
-    //Loop over Calorimeter clusters
-    Int_t ncc = esd->GetNumberOfCaloClusters();
-    for (Int_t i = 0; i < ncc ; i++) {
-      AliESDCaloCluster * cluster = esd->GetCaloCluster(i);
-      
-      // Trigger condition: PHOS clusters with energy > fEThreshold
-      if (cluster->IsPHOS() && cluster->E() > fEThreshold) {
-       description.Form("Event contains at least one PHOS cluster with energy > %.02f GeV.", fEThreshold);
-       SetDescription(description.Data());
-
-       // Enable the detectors for readout.
-       GetReadoutList().Enable( AliHLTReadoutList::kPHOS );
-       
-       // Add the available HLT information for readout too.
-       GetTriggerDomain().Add(kAliHLTAnyDataTypeID, "PHOS");
-       
-       //Set trigger decision
-       TriggerEvent(true);
-       
-       return 0;
-      }
-    }
-  }
-  
-  // If we got to this point then we did not find any tracks with E > fEThreshold
-  // generate negative trigger decision
-  description.Form("No PHOS clusters containing energy > %.02f GeV found.", fEThreshold);
-  SetDescription(description.Data());
-  TriggerEvent(false);
-  return 0;
-}
-
-int AliHLTTriggerPhosClusterEnergy::DoInit(int argc, const char** argv) {
-  // see header file for class documentation
-
-  // first configure the default
-  int iResult=ConfigureFromCDBTObjString(fgkOCDBEntry);
-
-  // configure from the command line parameters if specified
-  if (iResult>=0 && argc>0) {
-    iResult=ConfigureFromArgumentString(argc, argv);
-    HLTImportant("Trigger threshold set from argument string:  %.02f GeV:", fEThreshold ); 
-  } else if ( iResult >=0 ) {
-    HLTImportant("Trigger threshold set from OCDB database entry:  %.02f GeV:", fEThreshold ); 
-  }
-  return iResult;
-}
-
-int AliHLTTriggerPhosClusterEnergy::DoDeinit()
-{
-  // see header file for class documentation
-  return 0;
-}
-
-int AliHLTTriggerPhosClusterEnergy::Reconfigure(const char* cdbEntry, const char* /*chainId*/)
-{
-  // see header file for class documentation
-
-  // configure from the specified antry or the default one
-  const char* entry=cdbEntry;
-  if (!entry || entry[0]==0) entry=fgkOCDBEntry;
-
-  return ConfigureFromCDBTObjString(entry);
-}
-
-int AliHLTTriggerPhosClusterEnergy::ScanConfigurationArgument(int argc, const char** argv)
-{
-  // see header file for class documentation
-  if (argc<=0) return 0;
-  int i=0;
-  TString argument=argv[i];
-
-  // -maxpt
-  if (argument.CompareTo("-energy")==0) {
-    if (++i>=argc) return -EPROTO;
-    argument=argv[i];
-    fEThreshold=argument.Atof();
-    return 2;
-  }    
-  
-  // unknown argument
-  return -EINVAL;
-}
-
-void AliHLTTriggerPhosClusterEnergy::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
-{
-  // see header file for class documentation
-  constBase = sizeof(AliHLTTriggerDecision) + sizeof(AliHLTDomainEntry)*14;
-  inputMultiplier = 1;
+Int_t AliHLTTriggerPhosClusterEnergy::GetClustersFromEsd( const AliESDEvent * esd, TRefArray * clustersRefs ){
+  return esd->GetPHOSClusters(clustersRefs);
 }
index 0237d3760a92328041e0f26264d227e3e998ce85..03aa63a1fde9096df464c6ed3b9239a5434b9ab7 100644 (file)
 /// @date   2009-08-17
 /// @brief  HLT energy threshold trigger for PHOS
 
-#include "AliHLTTrigger.h"
-
-
-class AliESDtrack;
+#include "AliHLTTriggerCaloClusterEnergy.h"
 
 /**
  * @class  AliHLTTriggerPhosClusterEnergy
@@ -59,46 +56,23 @@ class AliESDtrack;
  * \ingroup alihlt_trigger_components
  */
 
-class AliHLTTriggerPhosClusterEnergy : public AliHLTTrigger
-{
+class AliHLTTriggerPhosClusterEnergy : public AliHLTTriggerCaloClusterEnergy {
+
 public:
   AliHLTTriggerPhosClusterEnergy();
   ~AliHLTTriggerPhosClusterEnergy();
 
 
   /// inherited from AliHLTTrigger: name of this trigger
-  virtual const char* GetTriggerName() const;
+  const char* GetTriggerName() const;
   /// inherited from AliHLTComponent: create an instance
-  virtual AliHLTComponent* Spawn();
-
- protected:
-  /// inherited from AliHLTComponent: handle the initialization
-  int DoInit(int argc, const char** argv);
-
-  /// inherited from AliHLTComponent: handle cleanup
-  int DoDeinit();
+  AliHLTComponent* Spawn();
 
-  /// inherited from AliHLTComponent: handle re-configuration event
-  int Reconfigure(const char* cdbEntry, const char* chainId);
-
-  /// inherited from AliHLTComponent, scan one argument and
-  /// its parameters
-  int ScanConfigurationArgument(int argc, const char** argv);
-
-  /// inherited from AliHLTComponent
-  //  Get a ratio by how much the data volume is shrunken or enhanced.
-  virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
 
 private:
 
-  /// inherited from AliHLTTrigger: calculate the trigger
-  virtual int DoTrigger();
-
-  /// Threshold cluster energy to trigger on
-  float fEThreshold;
-
-  /// the default configuration entry for this component
-  static const char* fgkOCDBEntry; //!transient
+  ///Inherited from AliHLTTriggerCaloClusterEnergy, get the correct set of ESD calo clusters
+  Int_t GetClustersFromEsd( const AliESDEvent * esd, TRefArray * clustersRefs );
 
   ClassDef(AliHLTTriggerPhosClusterEnergy, 0)
 };
index 37e6510f9be4333faa021d0126ef9564cb812622..b447f68cc9fdf71a142c065fa91e6f461f993c61 100644 (file)
@@ -26,6 +26,8 @@ void CreateInput(const char* filename, Int_t numOfTracks, Double_t minPt, Double
   
   Double_t et = gRandom->Rndm() * (maxPt - minPt) + minPt;
   
+  cout << et << endl;
+  
   cluster.SetE(et);
   cluster.SetClusterType(AliESDCaloCluster::kPHOSCluster);
   //cluster.SetClusterType(nuOfmTracks);
@@ -41,8 +43,8 @@ bool CheckIfOutputIsOk()
 {
   const char* filename = "PhosClusterEnergyTriggerTestOutput.root";
   TFile file(filename, "READ");
-  AliHLTTriggerDecision* decision1 = dynamic_cast<AliHLTTriggerDecision*>(file.Get("PhosClusterEnergyTrigger;1"));
-  AliHLTTriggerDecision* decision2 = dynamic_cast<AliHLTTriggerDecision*>(file.Get("PhosClusterEnergyTrigger;2"));
+  AliHLTTriggerDecision* decision1 = dynamic_cast<AliHLTTriggerDecision*>(file.Get("PhosClusterEnergyTrigger;2"));
+  AliHLTTriggerDecision* decision2 = dynamic_cast<AliHLTTriggerDecision*>(file.Get("PhosClusterEnergyTrigger;3"));
   if (decision1 == NULL)
   {
     cerr << "ERROR: 'PhosClusterEnergyTrigger;1' AliHLTTriggerDecision object not found in file " << filename << endl;
@@ -76,6 +78,9 @@ bool testPhosClusterEnergyTrigger()
   AliCDBManager * man = AliCDBManager::Instance();
   man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
   man->SetRun(0);
+  gSystem->Load("libAliHLTUtil.so");
+  gSystem->Load("libAliHLTMUON.so");
+  gSystem->Load("libAliHLTTRD.so");
   gSystem->Load("libAliHLTTrigger.so");
   CreateInput("PhosClusterEnergyTriggerTestInput1.root", -2, 0.1, 1.99);
   CreateInput("PhosClusterEnergyTriggerTestInput2.root", 0, 2.1, 4.0);