#include <cassert>
#include "AliHLTTriggerAgent.h"
#include "AliHLTTriggerDecision.h"
+#include "AliHLTGlobalTriggerDecision.h"
#include "AliHLTOUT.h"
#include "AliHLTMessage.h"
#include "AliESDEvent.h"
#include "TObjString.h"
#include "TObjArray.h"
#include "TArrayC.h"
+#include "TFile.h"
+#include "TTree.h"
// header files of library components
-#include "AliHLTEventSummaryProducerComponent.h"
-#include "AliHLTRunSummaryProducerComponent.h"
#include "AliHLTTriggerBarrelMultiplicity.h"
-#include "AliHLTTriggerBarrelCosmic.h"
+#include "AliHLTD0Trigger.h"
+#include "AliHLTTriggerITSMultiplicity.h"
+#include "AliHLTTriggerBarrelGeomMultiplicity.h"
#include "AliHLTGlobalTriggerComponent.h"
#include "AliHLTTriggerPhosClusterEnergy.h"
+#include "AliHLTTriggerEmcalClusterEnergy.h"
+#include "AliHLTTriggerPhosMip.h"
+#include "AliHLTTriggerTrdClusterMultiplicity.h"
+#include "AliHLTTriggerGammaConversion.h"
+#include "AliHLTMuonSpectroTriggerComponent.h"
+#include "AliHLTUpcTriggerComponent.h"
+#include "AliHLTTriggerCosmics.h"
+#include "AliHLTTriggerCounterComponent.h"
+
/** global instance for agent registration */
AliHLTTriggerAgent gAliHLTTriggerAgent;
if (!pHandler) return -EINVAL;
pHandler->AddComponent(new AliHLTGlobalTriggerComponent);
pHandler->AddComponent(new AliHLTTriggerBarrelMultiplicity);
- pHandler->AddComponent(new AliHLTTriggerBarrelCosmic);
+ pHandler->AddComponent(new AliHLTTriggerITSMultiplicity);
+ pHandler->AddComponent(new AliHLTD0Trigger);
+ pHandler->AddComponent(new AliHLTTriggerBarrelGeomMultiplicity);
pHandler->AddComponent(new AliHLTTriggerPhosClusterEnergy);
+ pHandler->AddComponent(new AliHLTTriggerEmcalClusterEnergy);
+ pHandler->AddComponent(new AliHLTTriggerPhosMip);
+ pHandler->AddComponent(new AliHLTTriggerTrdClusterMultiplicity);
+ pHandler->AddComponent(new AliHLTTriggerGammaConversion);
+ pHandler->AddComponent(new AliHLTMuonSpectroTriggerComponent);
+ pHandler->AddComponent(new AliHLTUpcTriggerComponent);
+ pHandler->AddComponent(new AliHLTTriggerCosmics);
+ pHandler->AddComponent(new AliHLTTriggerCounterComponent);
return 0;
}
int AliHLTTriggerAgent::CreateConfigurations(AliHLTConfigurationHandler* pHandler,
- AliRawReader* /*rawReader*/,
- AliRunLoader* /*runloader*/) const
+ AliRawReader* rawReader,
+ AliRunLoader* runloader) const
{
// see header file for class documentation
if (!pHandler) return -EINVAL;
// a central barrel charged particle multiplicity trigger
configurationId="TRIGGER-Barrel-Multiplicity";
- // define the inputsfor the BarrelMultiplicityTrigger
+ // define the inputs for the BarrelMultiplicityTrigger
triggerInputs="GLOBAL-esd-converter";
// check for the availibility
delete pTokens;
}
+ TString arg;
if (triggerInputs.Length()>0) {
+ // define multiple instances of the BarrelMultiplicityTrigger with different settings
HLTInfo("Configuring inputs for %s: %s", configurationId.Data(), triggerInputs.Data());
pHandler->CreateConfiguration(configurationId.Data(), "BarrelMultiplicityTrigger", triggerInputs.Data(), "");
if (triggerOutputs.Length()>0) triggerOutputs+=" ";
triggerOutputs+=configurationId;
+
+ configurationId="TRIGGER-Barrel-HighMultiplicity";
+ arg="-triggername BarrelHighMultiplicity";
+ pHandler->CreateConfiguration(configurationId.Data(), "BarrelMultiplicityTrigger", triggerInputs.Data(), arg.Data());
+ if (triggerOutputs.Length()>0) triggerOutputs+=" ";
+ triggerOutputs+=configurationId;
+
+ configurationId="TRIGGER-Barrel-Pt_v01";
+ arg="-triggername BarrelPt_v01";
+ pHandler->CreateConfiguration(configurationId.Data(), "BarrelMultiplicityTrigger", triggerInputs.Data(), arg.Data());
+ if (triggerOutputs.Length()>0) triggerOutputs+=" ";
+ triggerOutputs+=configurationId;
+
+ configurationId="TRIGGER-Barrel-Pt_v02";
+ arg="-triggername BarrelPt_v02";
+ pHandler->CreateConfiguration(configurationId.Data(), "BarrelMultiplicityTrigger", triggerInputs.Data(), arg.Data());
+ if (triggerOutputs.Length()>0) triggerOutputs+=" ";
+ triggerOutputs+=configurationId;
+
+ configurationId="TRIGGER-Barrel-Pt_v03";
+ arg="-triggername BarrelPt_v03";
+ pHandler->CreateConfiguration(configurationId.Data(), "BarrelMultiplicityTrigger", triggerInputs.Data(), arg.Data());
+ if (triggerOutputs.Length()>0) triggerOutputs+=" ";
+ triggerOutputs+=configurationId;
+ } else {
+ HLTWarning("No inputs for %s found, skipping component", configurationId.Data());
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ // The muon spectrometer trigger
+ configurationId = "TRIGGER-Muon-Spectrometer";
+
+ // define the inputsfor the muon spectrometer trigger.
+ if (pHandler->FindConfiguration("dHLT-sim-fromRaw")) {
+ triggerInputs = "dHLT-sim-fromRaw";
+ }
+ else if (pHandler->FindConfiguration("dHLT-sim")) {
+ triggerInputs = "dHLT-sim";
+ }
+ else if (pHandler->FindConfiguration("dHLT-sim-fromMC")) {
+ triggerInputs = "dHLT-sim-fromMC";
+ }
+
+ if (triggerInputs.Length() > 0) {
+ HLTInfo("Configuring inputs for %s: %s", configurationId.Data(), triggerInputs.Data());
+ pHandler->CreateConfiguration(configurationId.Data(), "MuonSpectroTrigger", triggerInputs.Data(), "-makestats");
+ if (triggerOutputs.Length() > 0) triggerOutputs += " ";
+ triggerOutputs += configurationId;
+ } else {
+ HLTWarning("No inputs for %s found, skipping component.", configurationId.Data());
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ // D0 trigger
+ configurationId = "TRIGGER-D0";
+ if(runloader && !rawReader){
+ // simulation without simulated raw data
+ // use ESD as input
+ triggerInputs="GLOBAL-esd-converter ";
+ }
+ else{
+ // simulation with simulated raw data, or raw data reconstruction
+ // use input from ITS tracker and vertexer directly
+ triggerInputs="ITS-tracker GLOBAL-vertexer";
+ }
+
+ // check for the availibility of inputs
+ pTokens=triggerInputs.Tokenize(" ");
+ triggerInputs="";
+ if (pTokens) {
+ for (int n=0; n<pTokens->GetEntriesFast(); n++) {
+ TString module=((TObjString*)pTokens->At(n))->GetString();
+ if (pHandler->FindConfiguration(module.Data())) {
+ triggerInputs+=module;
+ triggerInputs+=" ";
+ }
+ }
+ delete pTokens;
+ }
+
+ TString argD0 = "";
+ if (triggerInputs.Length()>0) {
+ HLTInfo("Configuring inputs for %s: %s", configurationId.Data(), triggerInputs.Data());
+ pHandler->CreateConfiguration(configurationId.Data(), "D0Trigger", triggerInputs.Data(), argD0.Data());
+ // FIXME: due to a rare segfault for reconstruction of PbPb data the
+ // component is temporarily excluded
+ // https://savannah.cern.ch/bugs/?72590
+ //if (triggerOutputs.Length()>0) triggerOutputs+=" ";
+ //triggerOutputs+=configurationId;
} else {
HLTWarning("No inputs for %s found, skipping component", configurationId.Data());
}
{
// see header file for class documentation
- return "libAliHLTUtil.so libAliHLTRCU.so libAliHLTTPC.so libAliHLTITS.so libAliHLTGlobal.so";
+ return "";
}
int AliHLTTriggerAgent::GetHandlerDescription(AliHLTComponentDataType dt,
// avoid interference with other handlers
// the handler produces an ESD object in order to be merged to the
// hltEsd afterwards
- if (dt==(kAliHLTDataTypeTObject|kAliHLTDataOriginOut)) {
+ // 2009-11-17 adding the data tyepes for (global) trigger decisions
+ // the TObject data types stays for a while in order to preserve
+ // backward compatibility
+ if (dt==(kAliHLTDataTypeTObject|kAliHLTDataOriginOut) ||
+ dt==kAliHLTDataTypeTriggerDecision ||
+ dt==kAliHLTDataTypeGlobalTrigger) {
desc=AliHLTOUTHandlerDesc(AliHLTModuleAgent::kEsd, dt, GetModuleId());
return 1;
}
// see header file for class documentation
// raw data blocks to be fed into offline reconstruction
- if (dt==(kAliHLTDataTypeTObject|kAliHLTDataOriginOut)) {
+ if ((dt==(kAliHLTDataTypeTObject|kAliHLTDataOriginOut) ||
+ (dt==kAliHLTDataTypeTriggerDecision) ||
+ (dt==kAliHLTDataTypeGlobalTrigger))) {
if (!fTriggerDecisionHandler) {
fTriggerDecisionHandler=new AliHLTTriggerAgent::AliHLTTriggerDecisionHandler;
}
, fESD(NULL)
, fpData(NULL)
, fSize(0)
+ , fpESDfile(NULL)
+ , fpESDtree(NULL)
{
// see header file for class documentation
}
AliHLTTriggerAgent::AliHLTTriggerDecisionHandler::~AliHLTTriggerDecisionHandler()
{
// see header file for class documentation
+ if (fpESDtree) {
+ fpESDtree->GetUserInfo()->Clear();
+ delete fpESDtree;
+ }
+ fpESDtree=NULL;
+
+ if (fpESDfile) {
+ fpESDfile->Close();
+ delete fpESDfile;
+ }
+ fpESDfile=NULL;
+
if (fESD) delete fESD;
fESD=NULL;
{
// see header file for class documentation
if (!pData) return -EINVAL;
- pData->SelectFirstDataBlock();
- AliHLTComponentDataType dt=kAliHLTVoidDataType;
- AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
- int iResult=pData->GetDataBlockDescription(dt, spec);
- if (iResult>=0) {
+ int iResult=0;
+ AliHLTGlobalTriggerDecision* pGlobalDecision=NULL;
+ TObjArray triggerDecisions;
+ triggerDecisions.SetOwner(kTRUE);
+ for (iResult=pData->SelectFirstDataBlock(); iResult>=0; iResult=pData->SelectNextDataBlock()) {
+ AliHLTComponentDataType dt=kAliHLTVoidDataType;
+ AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
+ if ((iResult=pData->GetDataBlockDescription(dt, spec))<0) break;
TObject* pObject=pData->GetDataObject();
if (pObject) {
- AliHLTTriggerDecision* pDecision=dynamic_cast<AliHLTTriggerDecision*>(pObject);
+ if(dt==kAliHLTDataTypeGlobalTrigger) {
+ if (!pGlobalDecision) {
+ if ((pGlobalDecision=dynamic_cast<AliHLTGlobalTriggerDecision*>(pObject))==NULL ||
+ (pGlobalDecision=dynamic_cast<AliHLTGlobalTriggerDecision*>(pGlobalDecision->Clone()))==NULL) {
+ HLTFatal("can not convert object of name %s (%s) to HLTGlobalTriggerDecsion according to data type", pObject->GetName(), pObject->Class()->GetName());
+ }
+ } else {
+ HLTWarning("multiple HLT GlobalTrigger decision objects, ignoring all but the first one");
+ }
+ } else if (dt==kAliHLTDataTypeTriggerDecision) {
+ if (pObject->IsA() == AliHLTTriggerDecision::Class() &&
+ !(pObject->IsA() == AliHLTGlobalTriggerDecision::Class())) {
+ AliHLTTriggerDecision* pDecision=dynamic_cast<AliHLTTriggerDecision*>(pObject);
+ if (pDecision) {
+ if (pGlobalDecision) {
+ // add directly
+ pGlobalDecision->AddTriggerInput(*pDecision);
+ } else {
+ // schedule
+ triggerDecisions.Add(pDecision->Clone());
+ }
+ } else {
+ HLTFatal("can not convert object of name %s (%s) to HLT TriggerDecsion according to data type", pObject->GetName(), pObject->Class()->GetName());
+ }
+ }
+ } else if (dt==(kAliHLTDataTypeTObject|kAliHLTDataOriginOut)){
+ // this is the branch for keeping compatibility
+ // the first version of the trigger framework was using the kAliHLTDataTypeTObject
+ // data type instead of the specific data types for HLT triggers
+ // this effects the cosmic data taken Sep to Oct 2009
+ if (pObject->IsA() == AliHLTGlobalTriggerDecision::Class()) {
+ if (!pGlobalDecision) {
+ if ((pGlobalDecision=dynamic_cast<AliHLTGlobalTriggerDecision*>(pObject))==NULL ||
+ (pGlobalDecision=dynamic_cast<AliHLTGlobalTriggerDecision*>(pGlobalDecision->Clone()))==NULL) {
+ HLTFatal("can not convert object of name %s (%s) to HLTGlobalTriggerDecsion according to data type", pObject->GetName(), pObject->Class()->GetName());
+ }
+ } else {
+ HLTWarning("multiple HLT GlobalTrigger decision objects, ignoring all but the first one");
+ }
+ } else if (pObject->IsA() == AliHLTTriggerDecision::Class()) {
+ AliHLTTriggerDecision* pDecision=dynamic_cast<AliHLTTriggerDecision*>(pObject);
+ if (pDecision) {
+ if (pGlobalDecision) {
+ // add directly
+ pGlobalDecision->AddTriggerInput(*pDecision);
+ } else {
+ // schedule
+ triggerDecisions.Add(pDecision->Clone());
+ }
+ } else {
+ HLTFatal("can not convert object of name %s (%s) to HLT TriggerDecsion according to data type", pObject->GetName(), pObject->Class()->GetName());
+ }
+ }
+ }
+ pData->ReleaseDataObject(pObject);
+ pObject=NULL;
+ } else {
+ HLTError("can not get TObject from HLTOUT buffer");
+ iResult=-ENODATA;
+ }
+ }
+ // -ENOENT just signals that there are no more entries
+ if (iResult==-ENOENT) iResult=0;
+
+ if (pGlobalDecision) {
+ for (int i=0; i<triggerDecisions.GetEntriesFast(); i++) {
+ if (triggerDecisions[i]) {
+ pGlobalDecision->AddTriggerInput(*((AliHLTTriggerDecision*)triggerDecisions[i]));
+ }
+ }
+ triggerDecisions.Delete();
+ AliHLTTriggerDecision* pDecision=pGlobalDecision;
+ {
if (pDecision) {
//pDecision->Print();
HLTDebug("extracted %s", pDecision->GetName());
TObject* pESDObject=fESD->FindListObject("HLTGlobalTrigger");
if (pESDObject) {
// copy the content to the already existing object
- pObject->Copy(*pESDObject);
+ pDecision->Copy(*pESDObject);
} else {
// add a new object
- fESD->AddObject(pObject->Clone());
+ fESD->AddObject(pDecision->Clone());
}
+ WriteESD();
AliHLTMessage* pMsg=AliHLTMessage::Stream(fESD);
if (pMsg) {
if (!pMsg->CompBuffer()) {
fSize=pMsg->CompLength();
fpData->Set(fSize, pMsg->CompBuffer());
}
+ delete pMsg;
+ pMsg=NULL;
} else {
HLTError("streaming of objects failed");
}
HLTError("memory allocation failed");
iResult=-ENOMEM;
}
- } else {
- HLTError("object %s is not an AliHLTTriggerDecision", pObject->GetName());
- iResult=-ENODATA;
}
- pData->ReleaseDataObject(pObject);
- pObject=NULL;
- } else {
- HLTError("can not get TObject from HLTOUT buffer");
- iResult=-ENODATA;
}
+ delete pGlobalDecision;
+ pGlobalDecision=NULL;
+ } else {
+ HLTError("no global trigger found in data collection");
}
+
if (iResult>=0) {
- if (pData->SelectNextDataBlock()>=0) {
- HLTWarning("current implementation of trigger decision handler can only handle one block");
- }
return fSize;
}
fSize=0;
fSize=0;
return iResult;
}
+
+int AliHLTTriggerAgent::AliHLTTriggerDecisionHandler::WriteESD()
+{
+ // see header file for class documentation
+ int iResult=0;
+ if (!fESD) return 0;
+ if (!fpESDfile) {
+ fpESDfile=new TFile("HLTdecision.root", "RECREATE");
+ }
+ if (!fpESDtree) {
+ fpESDtree=new TTree("HLTesdTree", "Tree with HLT ESD containing HLT decision");
+ if (fpESDtree) {
+ fESD->WriteToTree(fpESDtree);
+ fpESDtree->GetUserInfo()->Add(fESD);
+ }
+ }
+ if (!fpESDfile || !fpESDtree) return -ENOMEM;
+
+ fpESDtree->Fill();
+ fpESDfile->cd();
+ fpESDtree->Write(fpESDtree->GetName(),TObject::kOverwrite);
+
+ return iResult;
+}