#include "AliHLTOUTHandlerChain.h"
#include "AliRawReader.h"
#include "AliRunLoader.h"
+#include "AliRun.h"
+#include "AliMUON.h"
#include "TSystem.h"
+#include "TObjArray.h"
#include "TString.h"
// The single global instance of the dimuon HLT agent.
AliHLTOUTHandlerChain AliHLTMUONAgent::fgkESDMakerChain("libAliHLTMUON.so chains=dHLT-make-esd");
AliHLTOUTHandlerChain AliHLTMUONAgent::fgkRootifyDumpChain("libAliHLTMUON.so chains=dHLT-rootify-and-dump");
+Int_t AliHLTMUONAgent::fgMuonModuleLoaded = 0;
ClassImp(AliHLTMUONAgent);
+bool AliHLTMUONAgent::IsMuonModuleLoaded()
+{
+ // Checks to see if the MUON module is loaded or not.
+
+ // If the check was already done then use the cached value.
+ if (fgMuonModuleLoaded > 0) return true;
+ if (fgMuonModuleLoaded < 0) return false;
+
+ bool haveMuonModule = false;
+ if (gAlice != NULL)
+ {
+ // Search for a module in gAlice deriving from AliMUON.
+ TIter next(gAlice->Modules());
+ TObject* mod = NULL;
+ while ((mod = next()) != NULL)
+ {
+ if (mod->IsA() == AliMUON::Class())
+ {
+ fgMuonModuleLoaded = 1;
+ return true;
+ }
+ }
+ }
+ else
+ {
+ fgMuonModuleLoaded = -1;
+ return false;
+ }
+}
+
+
AliHLTMUONAgent::AliHLTMUONAgent() : AliHLTModuleAgent("MUON")
{
///
if (runloader != NULL)
{
- if (runloader->GetLoader("MUONLoader") != NULL)
+ // IsMuonModuleLoaded() is used to check if the muon module was loaded
+ // If there is no AliMUON module in the simulation then do not run the
+ // MUON HLT chain.
+ if (IsMuonModuleLoaded() and runloader->GetLoader("MUONLoader") != NULL)
return "dHLT-sim";
}
handler->CreateConfiguration("dHLT-sim-fromRaw-fullTracker", "BlockFilter", outputSrcsFull, "");
}
- if (runloader != NULL)
+ if (IsMuonModuleLoaded() and runloader != NULL)
{
// Implement the dHLT-sim dHLT simulation chain reading from
// simulated digits.
* @param pInstance pointer to handler
*/
virtual int DeleteOutputHandler(AliHLTOUTHandler* pInstance);
+
+ /**
+ * \returns true if a MUON module was added to gAlice.
+ */
+ static bool IsMuonModuleLoaded();
private:
// The following instance is used for automatic agent and component registration.
static AliHLTOUTHandlerChain fgkESDMakerChain; ///< Chain handler for converting dHLT raw data to ESD format.
static AliHLTOUTHandlerChain fgkRootifyDumpChain; ///< Chain handler for converting dHLT raw data to ROOT objects and dumping to file.
+ static Int_t fgMuonModuleLoaded; ///< Cached flag for indicating if the MUON module was loaded for a simulation.
+
ClassDef(AliHLTMUONAgent, 0); // Dimuon HLT module agent which handles processing configurations.
};