--- /dev/null
+// $Id$
+//-*- Mode: C++ -*-
+//**************************************************************************
+//* 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@fys.uio.no> *
+//* 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 AliHLTTriggerPhosMip.cxx
+/// @author Svein Lindal
+/// @date 2009-08-19
+/// @brief HLT Minimum Ionizing Particle (MIP) trigger for PHOS
+
+// 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 "AliHLTTriggerPhosMip.h"
+#include "AliESDEvent.h"
+#include "AliESDCaloCluster.h"
+#include "AliHLTTriggerDecision.h"
+#include "AliHLTDomainEntry.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTTriggerPhosMip)
+
+AliHLTTriggerPhosMip::AliHLTTriggerPhosMip()
+ : AliHLTTrigger()
+ , fEMin(0.0)
+ , fEMax(0.0)
+ , fNCellsMax(0)
+{
+ // 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* AliHLTTriggerPhosMip::fgkOCDBEntry="HLT/ConfigHLT/PhosMipTrigger";
+
+AliHLTTriggerPhosMip::~AliHLTTriggerPhosMip()
+{
+ // see header file for class documentation
+}
+
+const char* AliHLTTriggerPhosMip::GetTriggerName() const
+{
+ // see header file for class documentation
+ return "PhosMipTrigger";
+}
+
+AliHLTComponent* AliHLTTriggerPhosMip::Spawn()
+{
+ // see header file for class documentation
+ return new AliHLTTriggerPhosMip;
+}
+
+int AliHLTTriggerPhosMip::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 within energy range, cells < fNCellsMax
+ if ( cluster->IsPHOS() &&
+ cluster->E() > fEMin &&
+ cluster->E() < fEMax &&
+ cluster->GetNCells() <= fNCellsMax ) {
+
+ description.Form("Event contains at least one PHOS cluster satisfying MIP criteria");
+ 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 trigger criteria
+ } /// cluster loop
+ }
+
+ // If we got to this point then we did not find any good MIP candidates
+ // generate negative trigger decision
+ description.Form("No PHOS clusters satisfying MIP criteria found");
+ SetDescription(description.Data());
+ TriggerEvent(false);
+ return 0;
+}
+
+int AliHLTTriggerPhosMip::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) {
+ HLTInfo("Trigger configuration from OCDB database entry: emin %.03f GeV \n emax %.03f, \n ncells: %i", fEMin, fEMax, fNCellsMax );
+ iResult=ConfigureFromArgumentString(argc, argv);
+ HLTInfo("Trigger configuration overwritten from command line: emin %.03f GeV \n emax %.03f, \n ncells: %i", fEMin, fEMax, fNCellsMax );
+ } else if ( iResult >=0 ) {
+ HLTInfo("Trigger configuration from OCDB database entry: emin %.03f GeV \n emax %.03f, \n ncells: %i", fEMin, fEMax, fNCellsMax );
+ }
+ return iResult;
+}
+
+int AliHLTTriggerPhosMip::DoDeinit()
+{
+ // see header file for class documentation
+ return 0;
+}
+
+int AliHLTTriggerPhosMip::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 AliHLTTriggerPhosMip::ScanConfigurationArgument(int argc, const char** argv)
+{
+ // see header file for class documentation
+ if (argc<=0) return 0;
+ int i=0;
+ TString argument=argv[i];
+
+ // -mine
+ if (argument.CompareTo("-emin")==0) {
+ if (++i>=argc) return -EPROTO;
+ argument=argv[i];
+ fEMin=argument.Atof();
+ return 2;
+ }
+
+ ///-maxe
+ else if (argument.CompareTo("-emax")==0) {
+ if (++i>=argc) return -EPROTO;
+ argument=argv[i];
+ fEMax=argument.Atof();
+ return 2;
+ }
+
+ ///-ncells
+ else if (argument.CompareTo("-ncells")==0) {
+ if (++i>=argc) return -EPROTO;
+ argument=argv[i];
+ fNCellsMax=argument.Atof();
+ return 2;
+ }
+
+ // unknown argument
+ return -EINVAL;
+}
+
+void AliHLTTriggerPhosMip::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
+{
+ // see header file for class documentation
+ constBase = sizeof(AliHLTTriggerDecision) + sizeof(AliHLTDomainEntry)*14;
+ inputMultiplier = 1;
+}
--- /dev/null
+// $Id$
+//-*- Mode: C++ -*-
+#ifndef ALIHLTTRIGGERPHOSMIP_H
+#define ALIHLTTRIGGERPHOSMIP_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 AliHLTTriggerPhosMip.h
+/// @author Svein Lindal
+/// @date 2009-08-17
+/// @brief HLT Minimum Ionizing Particle (MIP) trigger for PHOS
+
+#include "AliHLTTrigger.h"
+
+
+class AliESDtrack;
+
+/**
+ * @class AliHLTTriggerPhosMip
+ * HLT trigger component for Minimum Ionizing Particles (MIPs) in PHOS.
+ *
+ * Triggers on PHOS clusters containing total energy in the range
+ * fEMin < energy < fEMax spread out between fewer than fNCellsMax cells.
+ *
+ * <h2>General properties:</h2>
+ *
+ * Component ID: \b PhosMipTrigger <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 -emin <i> e </i> <br>
+ * minimum required energy of the cluster
+ *
+* \li -emax <i> e </i> <br>
+ * maximum energy of the cluster
+ *
+ * \li -ncells <i> e </i> <br>
+ * Maximum number of cells in cluster
+ *
+ *
+ * By default, configuration is loaded from OCDB, can be overridden by
+ * component arguments.
+ *
+ * <h2>Default CDB entries:</h2>
+ * HLT/ConfigHLT/PhosMipTrigger: TObjString storing the arguments
+ *
+ * <h2>Performance:</h2>
+ *
+ *
+ * <h2>Memory consumption:</h2>
+ *
+ *
+ * <h2>Output size:</h2>
+ *
+ *
+ * \ingroup alihlt_trigger_components
+ */
+
+class AliHLTTriggerPhosMip : public AliHLTTrigger
+{
+public:
+ AliHLTTriggerPhosMip();
+ ~AliHLTTriggerPhosMip();
+
+
+ /// inherited from AliHLTTrigger: name of this trigger
+ virtual 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();
+
+ /// 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();
+
+ /// Variables for triggger configuration
+ float fEMin;
+ float fEMax;
+ int fNCellsMax;
+
+ /// the default configuration entry for this component
+ static const char* fgkOCDBEntry; //!transient
+
+ ClassDef(AliHLTTriggerPhosMip, 0)
+};
+
+#endif //ALIHLTTRIGGERPHOSMIP_H