/// @file AliHLTTriggerBarrelGeomMultiplicity.cxx
/// @author Oystein Djuvsland
/// @date 2009-10-08
-/// @brief HLT trigger component for charged particle multiplicity in
-/// the central barrel.
+/// @brief HLT trigger component for charged particle multiplicity
+/// within a geometrical acceptance in the central barrel.
// see header file for class documentation
// or
// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
#include "AliHLTTriggerBarrelGeomMultiplicity.h"
+#include "AliHLTTriggerDetectorGeom.h"
#include "AliESDEvent.h"
#include "AliHLTTriggerDecision.h"
#include "AliHLTDomainEntry.h"
#include "AliHLTGlobalBarrelTrack.h"
#include "TObjArray.h"
#include "TObjString.h"
+#include "TObjArray.h"
+#include "TVector3.h"
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
+#include "TFile.h"
+#include "AliHLTTrigger.h"
/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTTriggerBarrelGeomMultiplicity)
AliHLTTriggerBarrelGeomMultiplicity::AliHLTTriggerBarrelGeomMultiplicity()
: AliHLTTrigger()
- , fMinTracks(1)
- , fSolenoidBz(0.0)
+ , fSolenoidBz(0)
+ , fMinTracks(0)
+ , fDetectorArray(0)
{
// see header file for class documentation
// or
}
-const char* AliHLTTriggerBarrelGeomMultiplicity::fgkOCDBEntry="HLT/ConfigHLT/BarrelGeomMultiplicityTrigger";
-
AliHLTTriggerBarrelGeomMultiplicity::~AliHLTTriggerBarrelGeomMultiplicity()
{
// see header file for class documentation
}
-const char* AliHLTTriggerBarrelGeomMultiplicity::GetTriggerName() const
+const char* AliHLTTriggerBarrelGeomMultiplicity::GetTriggerName() const
{
// see header file for class documentation
+ const char* name = fTriggerName;
+ if(name) return name;
return "BarrelGeomMultiplicityTrigger";
}
return new AliHLTTriggerBarrelGeomMultiplicity;
}
+int AliHLTTriggerBarrelGeomMultiplicity::Reconfigure(const char *cdbEntry, const char *chainId)
+{
+ // see header file for class documentation
+
+ // configure from the specified entry or the default
+ const char* entry=cdbEntry;
+
+ if (!entry)
+ {
+ HLTDebug("No CDB path specified");
+ entry = fOCDBEntry;
+ }
+
+ return GetDetectorGeomsFromCDBObject(entry, chainId);
+}
+
int AliHLTTriggerBarrelGeomMultiplicity::DoTrigger()
{
// see header file for class documentation
const TObject* obj = GetFirstInputObject(kAliHLTAllDataTypes, "AliESDEvent");
AliESDEvent* esd = dynamic_cast<AliESDEvent*>(const_cast<TObject*>(obj));
TString description;
- TString ptcut,tdca,ldca,dcaref,op1st,op2nd;
- if (esd != NULL) {
- numberOfTracks=0;
- esd->GetStdContent();
+ if (esd != NULL)
+ {
+ numberOfTracks=0;
+ esd->GetStdContent();
- for (Int_t i = 0; i < esd->GetNumberOfTracks(); i++) {
- if (CheckCondition(esd->GetTrack(i), esd->GetMagneticField())) numberOfTracks++;
+ for (Int_t i = 0; i < esd->GetNumberOfTracks(); i++)
+ {
+ if (CheckCondition(esd->GetTrack(i), esd->GetMagneticField())) numberOfTracks++;
+ }
}
- }
// try the AliHLTExternal track data as input
- if (iResult>=0 && numberOfTracks<0) {
- for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTrack);
- pBlock!=NULL; pBlock=GetNextInputBlock()) {
- if (numberOfTracks<0) numberOfTracks=0;
- 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), fSolenoidBz)) numberOfTracks++;
+ if (iResult>=0 && numberOfTracks<0)
+ {
+ for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTrack);
+ pBlock!=NULL; pBlock=GetNextInputBlock())
+ {
+ if (numberOfTracks<0) numberOfTracks=0;
+ 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), fSolenoidBz)) 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);
+ }
}
- } 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 (numberOfTracks>=fMinTracks) {
-
- ApplyTrigger();
-
- description.Form("Event contains %d track(s) with ", numberOfTracks);
- SetDescription(description.Data());
- // Enable the central detectors for readout.
- GetReadoutList().Enable(
- AliHLTReadoutList::kITSSPD |
- AliHLTReadoutList::kITSSDD |
- AliHLTReadoutList::kITSSSD |
- AliHLTReadoutList::kTPC |
- AliHLTReadoutList::kTRD |
- AliHLTReadoutList::kTOF |
- AliHLTReadoutList::kHMPID |
- AliHLTReadoutList::kPHOS
- );
- // Add the available HLT information for readout too.
- GetTriggerDomain().Add("CLUSTERS", "TPC ");
- TriggerEvent(true);
- return 0;
+ if (numberOfTracks>=fMinTracks)
+ {
+ description.Form("Event contains %d track(s) satisfying geometrical cut", numberOfTracks);
+ SetDescription(description);
+
+ TriggerEvent(fTriggerDecision);
}
- description.Form("No tracks matching the tresholds found in the central barrel (min tracks %d, ", fMinTracks);
- description+=ptcut;
- description+=op1st;
- description+=ldca;
- description+=op2nd;
- description+=tdca;
- description+=dcaref;
- description+=")";
- } else {
- description.Form("No input blocks found");
- }
- SetDescription(description.Data());
- TriggerEvent(false);
+
return iResult;
+
}
template<class T>
bool AliHLTTriggerBarrelGeomMultiplicity::CheckCondition(T* track, float b)
{
+ bool ret = false;
+
// see header file for class documentation
if (!track) return false;
}
template<class T>
-bool AliHLTTriggerBarrelGeomMultiplicity::IsInDetector(T* track, b)
+bool AliHLTTriggerBarrelGeomMultiplicity::IsInDetectors(T* track, float b)
{
-
- for(Int_t i = 0; i < fDetectorList->GetEntries(); i++)
+ // See header file for class documentation
+ for(Int_t i = 0; i < fDetectorArray->GetEntries(); i++)
{
- AliHLTTriggerDetectorGeom *det = static_cast<AliHLTTriggerDetectorGeom*>(fDetectorList.At(i))
+ AliHLTTriggerDetectorGeom *det = static_cast<AliHLTTriggerDetectorGeom*>(fDetectorArray->At(i));
Double_t trackPoint[3];
-
+
det->GetInitialPoint(trackPoint);
-
+
bool ret = track->Intersect(trackPoint, det->NormVector(), b);
- if(track->Eta() >= det->EtaMin() &&
- track->Eta() <= det->EtaMax() &&
- track->Phi() >= det->PhiMin() &&
- track->Phi() <= det->PhiMax())
+ TVector3 trackPos(trackPoint);
+
+ if(trackPos.Eta() >= det->EtaMin() &&
+ trackPos.Eta() <= det->EtaMax() &&
+ trackPos.Phi() >= det->PhiMin() &&
+ trackPos.Phi() <= det->PhiMax())
{
return true;
}
// first configure the default
int iResult=0;
- iResult=ConfigureFromCDBTObjString(kAliHLTCDBSolenoidBz);
- if (iResult>=0) iResult=ConfigureFromCDBTObjString(fgkOCDBEntry);
- // configure from the command line parameters if specified
if (iResult>=0 && argc>0)
iResult=ConfigureFromArgumentString(argc, argv);
+
+
return iResult;
}
int AliHLTTriggerBarrelGeomMultiplicity::DoDeinit()
-{
+ {
// see header file for class documentation
return 0;
}
-int AliHLTTriggerBarrelGeomMultiplicity::Reconfigure(const char* cdbEntry, const char* /*chainId*/)
+int AliHLTTriggerBarrelGeomMultiplicity::ReadPreprocessorValues(const char* /*modules*/)
{
// see header file for class documentation
- // configure from the specified antry or the default one
- const char* entry=cdbEntry;
- if (!entry || entry[0]==0) {
- ConfigureFromCDBTObjString(kAliHLTCDBSolenoidBz);
- entry=fgkOCDBEntry;
- }
+ // TODO 2009-10-10: implementation
+ // for the moment very quick, just reload the magnetic field
+ return ConfigureFromCDBTObjString(kAliHLTCDBSolenoidBz);
+}
+
+int AliHLTTriggerBarrelGeomMultiplicity::GetDetectorGeomsFromCDBObject(const char *cdbEntry, const char* chainId)
+{
+ // see header file for function documentation
+ int nDetectorGeoms=0;
+ const char *path = cdbEntry;
+ if(!path) path = fOCDBEntry;
- return ConfigureFromCDBTObjString(entry);
+ if(path)
+ {
+ // const char* chainId=GetChainId();
+ HLTInfo("configure from entry %s, chain id %s", path, (chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
+ AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
+ if (pEntry)
+ {
+ TObjArray* pArr=dynamic_cast<TObjArray*>(pEntry->GetObject());
+ if (pArr)
+ {
+
+ for(int i = 0; i < pArr->GetEntries(); i++)
+ {
+ if(!strcmp(pArr->At(i)->ClassName(), "AliHLTTriggerDecision"))
+ {
+ fTriggerDecision = dynamic_cast<AliHLTTriggerDecision*>(pArr->At(i));
+ }
+ else if(!strcmp(pArr->At(i)->ClassName(), "AliHLTTriggerDetectorGeom"))
+ {
+ fDetectorArray->AddLast(dynamic_cast<AliHLTTriggerDetectorGeom*>(pArr->At(i)));
+ nDetectorGeoms++;
+ HLTInfo("received TObjArray of %d detector geometries", nDetectorGeoms);
+ }
+ else
+ {
+ HLTWarning("Unknown object in configuration object");
+ }
+ }
+ }
+ else
+ {
+ HLTError("configuration object \"%s\" has wrong type, required TObjArray", path);
+ nDetectorGeoms=-EINVAL;
+ }
+ }
+ else
+ {
+ HLTError("can not fetch object \"%s\" from OCDB", path);
+ nDetectorGeoms=-ENOENT;
+ }
+ }
+ return nDetectorGeoms;
}
-int AliHLTTriggerBarrelGeomMultiplicity::ReadPreprocessorValues(const char* /*modules*/)
+int AliHLTTriggerBarrelGeomMultiplicity::GetDetectorGeomsFromFile(const char *filename)
{
- // see header file for class documentation
+ // see header file for function documentation
+ int nDetectorGeoms=0;
- // TODO 2009-09-10: implementation
- // for the moment very quick, just reload the magnetic field
- return ConfigureFromCDBTObjString(kAliHLTCDBSolenoidBz);
+ if (filename)
+ {
+ TFile *geomfile = TFile::Open(filename, "READ");
+
+ if(geomfile)
+ {
+
+ HLTInfo("configure from file \"%s\"", filename);
+ TObjArray* pArr=dynamic_cast<TObjArray*>(geomfile->Get("GeomConfig"));
+ if (pArr)
+ {
+
+ for(int i = 0; i < pArr->GetEntries(); i++)
+ {
+ if(!strcmp(pArr->At(i)->ClassName(), "AliHLTTriggerDecision"))
+ {
+ fTriggerDecision = dynamic_cast<AliHLTTriggerDecision*>(pArr->At(i));
+ }
+ else if(!strcmp(pArr->At(i)->ClassName(), "AliHLTTriggerDetectorGeom"))
+ {
+ fDetectorArray->AddLast(dynamic_cast<AliHLTTriggerDetectorGeom*>(pArr->At(i)));
+ nDetectorGeoms++;
+ HLTInfo("received TObjArray of %d detector geometries", nDetectorGeoms);
+ }
+ else
+ {
+ HLTWarning("Unknown object in configuration object");
+ }
+ }
+ }
+ else
+ {
+ HLTError("configuration object has wrong type, required TObjArray");
+ nDetectorGeoms=-EINVAL;
+ }
+ }
+ else
+ {
+ HLTError("can not open file \"%s\"", filename);
+ nDetectorGeoms=-ENOENT;
+ }
+ }
+ return nDetectorGeoms;
}
int AliHLTTriggerBarrelGeomMultiplicity::ScanConfigurationArgument(int argc, const char** argv)
{
- // see header file for class documentation
+ // 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;
- }
+ if (argument.CompareTo("-geomfile")==0)
+ {
+ if (++i>=argc) return -EPROTO;
+
+ GetDetectorGeomsFromFile(argv[i]);
+
+ return 2;
+ }
- // -mintracks
- if (argument.CompareTo("-mintracks")==0) {
- if (++i>=argc) return -EPROTO;
- argument=argv[i];
- fMinTracks=argument.Atoi();
- return 2;
+ if (argument.CompareTo("-triggername")==0)
+ {
+ if (++i>=argc) return -EPROTO;
+
+ fTriggerName = new char[128];
+ sprintf(fTriggerName, argv[i]);
+
+ fOCDBEntry = fTriggerName;
+
+ return 2;
}
-
- // -dca-reference
- // reference point for the transverse and longitudinal dca cut
- if (argument.CompareTo("-dca-reference")==0) {
- if (++i>=argc) return -EPROTO;
- argument=argv[i];
- // scan x,y,z
- TObjArray* pTokens=argument.Tokenize("'");
- if (pTokens) {
- for (int c=0; c<pTokens->GetEntriesFast() && c<fgkDCAReferenceSize; c++) {
- argument=((TObjString*)pTokens->At(c))->GetString();
- fDCAReference[i]=argument.Atof();
- }
- delete pTokens;
- }
- return 2;
- }
-
- // -min-ldca
- // minimum longitudinal dca to reference point
- if (argument.CompareTo("-min-ldca")==0) {
- if (++i>=argc) return -EPROTO;
- argument=argv[i];
- fMinLDca=argument.Atof();
- return 2;
- }
-
- // -max-ldca
- // maximum longitudinal dca to reference point
- if (argument.CompareTo("-max-ldca")==0) {
- if (++i>=argc) return -EPROTO;
- argument=argv[i];
- fMaxLDca=argument.Atof();
- return 2;
- }
-
- // -min-tdca
- // minimum transverse dca to reference point
- if (argument.CompareTo("-min-tdca")==0) {
- if (++i>=argc) return -EPROTO;
- argument=argv[i];
- fMinTDca=argument.Atof();
- return 2;
- }
-
- // -max-tdca
- // maximum transverse dca to reference point
- if (argument.CompareTo("-max-tdca")==0) {
- if (++i>=argc) return -EPROTO;
- argument=argv[i];
- fMaxTDca=argument.Atof();
- return 2;
- }
-
- // -solenoidBz
- if (argument.CompareTo("-solenoidBz")==0) {
- if (++i>=argc) return -EPROTO;
- argument=argv[i];
- fSolenoidBz=argument.Atof();
- return 2;
- }
-
- // unknown argument
- return -EINVAL;
}
/// a geometrical selection of the central barrel.
#include "AliHLTTrigger.h"
-
+#include "TList.h"
/**
* @class AliHLTTriggerBarrelGeomMultiplicity
* HLT trigger component for charged particle multiplicity in the
* <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
* \li -mintracks <i> n </i> <br>
* required number of tracks for a trigger
- * \li -minpt <i> pt </i> <br>
- * required minimum pt for a trigger
- * \li -maxpt <i> pt </i> <br>
- * required maximum pt for a trigger
- * \li -dca-reference <i> x,y,z </i> <br>
- * reference point for the transverse and longitudinal dca cut
- * \li -min-ldca <i> dca </i> <br>
- * minimum longitudinal dca to reference point
- * \li -max-ldca <i> dca </i> <br>
- * maximum longitudinal dca to reference point
- * \li -min-tdca <i> dca </i> <br>
- * minimum transverse dca to reference point
- * \li -max-tdca <i> dca </i> <br>
- * maximum transverse dca to reference point
* \li -solenoidBz <i> field </i> <br>
* magnetic field needed if the input is not an ESD object
*
* component arguments.
*
* <h2>Default CDB entries:</h2>
- * HLT/ConfigHLT/BarrelGeomMultiplicityTrigger: TObjString storing the arguments
+ * HLT/ConfigHLT/BarrelGeomMultiplicityTrigger: TList storing the detector geometries
* HLT/ConfigHLT/Solenoidbz: TObjString -solenoidBz field
*
* <h2>Performance:</h2>
class AliHLTTriggerBarrelGeomMultiplicity : public AliHLTTrigger
{
public:
+
AliHLTTriggerBarrelGeomMultiplicity();
~AliHLTTriggerBarrelGeomMultiplicity();
- /// inherited from AliHLTTrigger: name of this trigger
- virtual const char* GetTriggerName() const;
/// inherited from AliHLTComponent: create an instance
virtual AliHLTComponent* Spawn();
+ /// inherited from AliHLTTrigger: name of this trigger
+ virtual const char* GetTriggerName() const;
+
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: handle dcs update event
int ReadPreprocessorValues(const char* modules);
/// inherited from AliHLTComponent, scan one argument and
/// its parameters
- int ScanConfigurationArgument(int argc, const char** argv);
+ virtual int ScanConfigurationArgument(int argc, const char** argv);
+
+ // Get the detector geometries from CDB entry
+ virtual int GetDetectorGeomsFromCDBObject(const char *cdbEntry, const char *chainId);
+
+ // Get the detector geometries from a root file
+ virtual int GetDetectorGeomsFromFile(const char *filename);
+
+ /// inherited from AliHLTComponent: handle re-configuration event
+ int Reconfigure(const char* cdbEntry = 0, const char* chainId = 0);
private:
/// inherited from AliHLTTrigger: calculate the trigger
- virtual int DoTrigger
+ virtual int DoTrigger();
/// check whether a track meets the criteria
template<class T>
bool CheckCondition(T* track, float b);
// check whether a track is in the desired detectors
- Template<Class T>
- bool IsInDetector(T* track, float b);
+ template<class T>
+ bool IsInDetectors(T* track, float b);
+
+ // magnetic field (dca estimation for)
+ Float_t fSolenoidBz;
+
+ // minimum number of tracks satisfying the cut
+ Int_t fMinTracks;
+
+ // array of (sub-)detectors to trigger on
+ TObjArray *fDetectorArray; // !transient
+
+ // Trigger decision
+ AliHLTTriggerDecision *fTriggerDecision; //!transient
+
+ // The trigger name
+ char *fTriggerName; //!transient
+
+ /// the default configuration entry for this component
+ char* fOCDBEntry; //!transient
- // abstract method for setting the correct trigger parameters
- void ApplyTrigger() = 0;
- ClassDef(AliHLTTriggerBarrelMultiplicity, 0);
+ ClassDef(AliHLTTriggerBarrelGeomMultiplicity, 0);
};
-#endif ALIHLTTRIGGERBARRELGEOMMULTIPLICITY_H
+#endif