#include "AliESDEvent.h"
#include "AliHLTTriggerDecision.h"
#include "AliHLTDomainEntry.h"
+#include "AliHLTGlobalBarrelTrack.h"
/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTTriggerBarrelMultiplicity)
// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
}
+const char* AliHLTTriggerBarrelMultiplicity::fgkOCDBEntry="HLT/ConfigHLT/BarrelMultiplicityTrigger";
+
AliHLTTriggerBarrelMultiplicity::~AliHLTTriggerBarrelMultiplicity()
{
// see header file for class documentation
int AliHLTTriggerBarrelMultiplicity::DoTrigger()
{
// see header file for class documentation
+ int iResult=0;
+ int numberOfTracks=-1;
+
+ // try the ESD as input
const TObject* obj = GetFirstInputObject(kAliHLTAllDataTypes, "AliESDEvent");
AliESDEvent* esd = dynamic_cast<AliESDEvent*>(const_cast<TObject*>(obj));
TString description;
TString ptcut;
if (esd != NULL) {
+ numberOfTracks=0;
esd->GetStdContent();
- unsigned int numberOfTracks=0;
for (Int_t i = 0; i < esd->GetNumberOfTracks(); i++) {
- AliESDtrack* track = esd->GetTrack(i);
- if (track && track->Pt() >= fPtMin &&
- (fPtMax<=fPtMin || track->Pt() < fPtMax)) {
- numberOfTracks++;
+ if (CheckCondition(esd->GetTrack(i))) numberOfTracks++;
+ }
+ }
+
+ // try the AliHLTExternal track data as input
+ if (iResult>=0 && numberOfTracks<0) {
+ for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTrack);
+ pBlock!=NULL; pBlock=GetNextInputBlock()) {
+ vector<AliHLTGlobalBarrelTrack> tracks;
+ if ((iResult=AliHLTGlobalBarrelTrack::ConvertTrackDataArray(reinterpret_cast<const AliHLTTracksData*>(pBlock->fPtr), pBlock->fSize, tracks))>0) {
+ for (vector<AliHLTGlobalBarrelTrack>::iterator element=tracks.begin();
+ element!=tracks.end(); element++) {
+ if (CheckCondition(&(*element))) numberOfTracks++;
+ }
+ } else if (iResult<0) {
+ HLTError("can not extract tracks from data block of type %s (specification %08x) of size %d: error %d",
+ DataType2Text(pBlock->fDataType).c_str(), pBlock->fSpecification, pBlock->fSize, iResult);
}
}
+ }
+ if (iResult>=0 && numberOfTracks>=0) {
if (fPtMax>fPtMin) {
ptcut.Form(" %.02f GeV/c <= pt < %.02f GeV/c", fPtMin, fPtMax);
} else {
TriggerEvent(true);
return 0;
}
+ description.Form("No tracks matching the tresholds found in the central barrel (min tracks %d, %s)",
+ fMinTracks, ptcut.Data());
+ } else {
+ description.Form("No input blocks found");
}
- description.Form("No tracks matching the tresholds found in the central barrel (min tracks %d, %s)",
- fMinTracks, ptcut.Data());
SetDescription(description.Data());
TriggerEvent(false);
+ return iResult;
+}
+
+template<class T>
+bool AliHLTTriggerBarrelMultiplicity::CheckCondition(T* track)
+{
+ // see header file for class documentation
+ if (track && track->Pt() >= fPtMin &&
+ (fPtMax<=fPtMin || track->Pt() < fPtMax)) {
+ return true;
+ }
+ return false;
+}
+
+int AliHLTTriggerBarrelMultiplicity::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);
+ return iResult;
+}
+
+int AliHLTTriggerBarrelMultiplicity::DoDeinit()
+{
+ // see header file for class documentation
return 0;
}
+
+int AliHLTTriggerBarrelMultiplicity::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 AliHLTTriggerBarrelMultiplicity::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("-maxpt")==0) {
+ if (++i>=argc) return -EPROTO;
+ argument=argv[i];
+ fPtMax=argument.Atof();
+ return 2;
+ }
+
+ // -minpt
+ if (argument.CompareTo("-minpt")==0) {
+ if (++i>=argc) return -EPROTO;
+ argument=argv[i];
+ fPtMin=argument.Atof();
+ return 2;
+ }
+
+ // -mintracks
+ if (argument.CompareTo("-mintracks")==0) {
+ if (++i>=argc) return -EPROTO;
+ argument=argv[i];
+ fMinTracks=argument.Atoi();
+ return 2;
+ }
+
+ // unknown argument
+ return -EINVAL;
+}
#include "AliHLTTrigger.h"
+class AliESDtrack;
+
/**
* @class AliHLTTriggerBarrelMultiplicity
* HLT trigger component for charged particle multiplicity in the
/// 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);
+
private:
/// inherited from AliHLTTrigger: calculate the trigger
virtual int DoTrigger();
+ /// check whether a track meets the criteria
+ template<class T>
+ bool CheckCondition(T* track);
+
/// pt cut, minimum
float fPtMin; //! transient
/// pt cut, maximum
float fPtMax; //! transient
/// required number of tracks
- unsigned int fMinTracks; //!tracks
+ int fMinTracks; //!transient
+
+ /// the default configuration entry for this component
+ static const char* fgkOCDBEntry; //!transient
ClassDef(AliHLTTriggerBarrelMultiplicity, 0)
};