From 5f4502ccd66a6b391d65c6f5e4e39cc15b531dda Mon Sep 17 00:00:00 2001 From: richterm Date: Mon, 2 Nov 2009 22:03:10 +0000 Subject: [PATCH] adding ITS cluster multiplicity and D0 trigger components (Gaute) --- HLT/libAliHLTTrigger.pkg | 5 +- HLT/trigger/AliHLTD0Trigger.cxx | 284 +++++++++++++++++++ HLT/trigger/AliHLTD0Trigger.h | 119 ++++++++ HLT/trigger/AliHLTD0toKpi.cxx | 74 +++++ HLT/trigger/AliHLTD0toKpi.h | 29 ++ HLT/trigger/AliHLTTriggerAgent.cxx | 4 + HLT/trigger/AliHLTTriggerITSMultiplicity.cxx | 176 ++++++++++++ HLT/trigger/AliHLTTriggerITSMultiplicity.h | 96 +++++++ HLT/trigger/AliHLTTriggerLinkDef.h | 3 + 9 files changed, 789 insertions(+), 1 deletion(-) create mode 100644 HLT/trigger/AliHLTD0Trigger.cxx create mode 100644 HLT/trigger/AliHLTD0Trigger.h create mode 100644 HLT/trigger/AliHLTD0toKpi.cxx create mode 100644 HLT/trigger/AliHLTD0toKpi.h create mode 100644 HLT/trigger/AliHLTTriggerITSMultiplicity.cxx create mode 100644 HLT/trigger/AliHLTTriggerITSMultiplicity.h diff --git a/HLT/libAliHLTTrigger.pkg b/HLT/libAliHLTTrigger.pkg index fe8d6bee66e..5e26cc32c5c 100644 --- a/HLT/libAliHLTTrigger.pkg +++ b/HLT/libAliHLTTrigger.pkg @@ -15,6 +15,9 @@ CLASS_HDRS:= \ AliHLTGlobalTriggerConfig.h \ AliHLTGlobalTriggerComponent.h \ AliHLTTriggerBarrelMultiplicity.h \ + AliHLTD0Trigger.h \ + AliHLTD0toKpi.h \ + AliHLTTriggerITSMultiplicity.h \ AliHLTTriggerBarrelCosmic.h \ AliHLTTriggerAgent.h \ AliHLTEventSummary.h \ @@ -52,7 +55,7 @@ MODULE_HDRS:= $(CLASS_HDRS) # enable automatic generation. MODULE_DHDR:= AliHLTTriggerLinkDef.h -EINCLUDE := HLT/BASE HLT/BASE/util HLT/trigger HLT/TPCLib HLT/TRD TRD +EINCLUDE := HLT/BASE HLT/BASE/util HLT/trigger HLT/TPCLib HLT/TRD TRD HLT/ITS LIBRARY_DEP := -lHLTbase diff --git a/HLT/trigger/AliHLTD0Trigger.cxx b/HLT/trigger/AliHLTD0Trigger.cxx new file mode 100644 index 00000000000..dee05d6c448 --- /dev/null +++ b/HLT/trigger/AliHLTD0Trigger.cxx @@ -0,0 +1,284 @@ +// $Id: AliHLTD0Trigger.cxx +//************************************************************************** +//* This file is property of and copyright by the ALICE HLT Project * +//* ALICE Experiment at CERN, All rights reserved. * +//* * +//* Primary Authors: Gaute Ovrebekk * +//* 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 AliHLTD0Trigger.cxx +/// @author Gaute Ovrebekk +/// @date 2009-10-28 +/// @brief HLT trigger component for D0->Kpi + +// 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 "AliHLTD0Trigger.h" +#include "AliESDEvent.h" +#include "AliESDtrack.h" +#include "AliESDv0.h" +#include "AliHLTTriggerDecision.h" +#include "AliHLTDomainEntry.h" +#include "AliHLTGlobalBarrelTrack.h" +#include "TObjArray.h" +#include "TObjString.h" +#include "TDatabasePDG.h" +#include "AliESDVertex.h" +#include "TH1F.h" +#include "AliHLTD0toKpi.h" + +/** ROOT macro for the implementation of ROOT specific class methods */ +ClassImp(AliHLTD0Trigger) + +AliHLTD0Trigger::AliHLTD0Trigger() + : AliHLTTrigger() + , fPtMin(0.0) + , fdca(0.0) + , finvMass(0.0) + , fcosThetaStar(0.0) + , fd0(0.0) + , fd0d0(0.0) + , fcosPoint(0.0) + ,fplothisto(false) + , fD0mass(NULL) +{ + // see header file for class documentation + // or + // refer to README to build package + // or + // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt + +} + +const char* AliHLTD0Trigger::fgkOCDBEntry="HLT/ConfigHLT/D0Trigger"; + +AliHLTD0Trigger::~AliHLTD0Trigger() +{ + // see header file for class documentation + //delete fD0mass; +} + +const char* AliHLTD0Trigger::GetTriggerName() const +{ + // see header file for class documentation + return "D0Trigger"; +} + +AliHLTComponent* AliHLTD0Trigger::Spawn() +{ + // see header file for class documentation + return new AliHLTD0Trigger; +} + +int AliHLTD0Trigger::DoTrigger() +{ + // see header file for class documentation + int iResult=0; + int nD0=0; + Double_t D0,D0bar; + Double_t d0[2]; + Double_t svpos[3]; + Double_t pvpos[3]; + TString description; + AliHLTD0toKpi *d0calc = new AliHLTD0toKpi(); + + for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDObject); iter != NULL; iter = GetNextInputObject() ) { + + AliESDEvent *event = dynamic_cast(const_cast( iter ) ); + event->GetStdContent(); + Int_t nV0 = event->GetNumberOfV0s(); + + Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass(); + + for (Int_t iv=0; ivGetTrack( event->GetV0(iv)->GetNindex()); + AliESDtrack *tP=event->GetTrack( event->GetV0(iv)->GetPindex()); + + if(tN->Pt()Pt()GetPrimaryVertexTracks(); + Double_t field = event->GetMagneticField(); + + pv->GetXYZ(pvpos); + + d0[0] = 10000.*tP->GetD(pvpos[0],pvpos[1],field); + d0[1] = -10000.*tN->GetD(pvpos[0],pvpos[1],field); + + if(d0[0] + + event->GetV0(iv)->GetXYZ(svpos[0],svpos[1],svpos[2]); + + if(!tN->PropagateTo(svpos[0],field) && !tP->PropagateTo(svpos[0],field)){ + HLTInfo("Tracks could not be propagated to secondary vertex"); + continue; + } + + Double_t tmp1, tmp2; + if(tN->GetDCA(tP,field,tmp1,tmp2) > fdca){continue;} + + if((d0calc->InvMass(tN,tP) - mD0PDG) > finvMass && (d0calc->InvMass(tP,tN) - mD0PDG) > finvMass){continue;} + d0calc->cosThetaStar(tN,tP,D0,D0bar); + if(D0 > fcosThetaStar && D0bar > fcosThetaStar){continue;} + if((d0[0]*d0[1]) > fd0d0){continue;} + if(d0calc->pointingAngle(tN,tP,pvpos,svpos) < fcosPoint){continue;} + + nD0++; + if((d0calc->InvMass(tN,tP) - mD0PDG) > finvMass){ + fD0mass->Fill(d0calc->InvMass(tN,tP)); + } + else{ + fD0mass->Fill(d0calc->InvMass(tP,tN)); + } + } + + } + + HLTWarning("Number of D0 found: %d",nD0); + + if(fplothisto){PushBack( (TObject*) fD0mass, kAliHLTDataTypeHistogram,0);} + + if (iResult>=0) { + + if (nD0>=1) { + description.Form("Event contains %d D0(s)", nD0); + 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; + } + description.Form("No D0"); + } else { + description.Form("No input blocks found"); + } + SetDescription(description.Data()); + TriggerEvent(false); + return iResult; +} + +int AliHLTD0Trigger::DoInit(int argc, const char** argv) +{ + fplothisto=false; + // see header file for class documentation + fD0mass = new TH1F("hD0mass","HLT: D0 inv mass",500,0,50); + // first configure the default + int iResult=0; + 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 AliHLTD0Trigger::DoDeinit() +{ + // see header file for class documentation + delete fD0mass; + return 0; +} + +int AliHLTD0Trigger::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 AliHLTD0Trigger::ScanConfigurationArgument(int argc, const char** argv) +{ + // see header file for class documentation + if (argc<=0) return 0; + int i=0; + TString argument=argv[i]; + // -minpt for decay + if (argument.CompareTo("-pt")==0) { + if (++i>=argc) return -EPROTO; + argument=argv[i]; + fPtMin=argument.Atof(); + return 2; + } + // minimum dca for decay tracks + if (argument.CompareTo("-dca")==0) { + if (++i>=argc) return -EPROTO; + argument=argv[i]; + fdca=argument.Atof(); + return 2; + } + // inv. mass half width. + if (argument.CompareTo("-invmass")==0) { + if (++i>=argc) return -EPROTO; + argument=argv[i]; + finvMass=argument.Atof(); + return 2; + } + +// cos theta for decay angle + if (argument.CompareTo("-costhetastar")==0) { + if (++i>=argc) return -EPROTO; + argument=argv[i]; + fcosThetaStar=argument.Atof(); + return 2; + } + + // impact parameter for decay + if (argument.CompareTo("-d0")==0) { + if (++i>=argc) return -EPROTO; + argument=argv[i]; + fd0=argument.Atof(); + return 2; + } + // product of impact parameter + if (argument.CompareTo("-d0d0")==0) { + if (++i>=argc) return -EPROTO; + argument=argv[i]; + fd0d0=argument.Atof(); + return 2; + } + // product of impact parameter + if (argument.CompareTo("-cospoint")==0) { + if (++i>=argc) return -EPROTO; + argument=argv[i]; + fcosPoint=argument.Atof(); + return 2; + } + if (argument.CompareTo("-plothistogram")==0) { + if (++i>=argc) return -EPROTO; + argument=argv[i]; + fplothisto=true; + return 2; + } + // unknown argument + return -EINVAL; +} diff --git a/HLT/trigger/AliHLTD0Trigger.h b/HLT/trigger/AliHLTD0Trigger.h new file mode 100644 index 00000000000..c8dc13de3bb --- /dev/null +++ b/HLT/trigger/AliHLTD0Trigger.h @@ -0,0 +1,119 @@ +//-*- Mode: C++ -*- +// $Id: AliHLTD0Trigger.h +#ifndef ALIHLTD0TRIGGER_H +#define ALIHLTD0TRIGGER_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 AliHLTD0Trigger.h +/// @author Gaute Ovrebekk +/// @date 2009-10-28 +/// @brief HLT trigger component for D0->Kpi + +#include "AliHLTTrigger.h" +class TH1F; + +/** + * @class AliHLTD0Trigger + * + * HLT trigger component for D0->Kpi + * + *

General properties:

+ * + * Component ID: \b D0Trigger
+ * Library: \b libAliHLTTrigger.so
+ * Input Data Types: kAliHLTDataTypeESDObject, kAliHLTDataTypeESDTree + * kAliHLTDataTypeTrack
+ * Output Data Types: ::kAliHLTAnyDataType
+ * + *

Mandatory arguments:

+ * + * + *

Optional arguments:

+ * + * + *

Configuration:

+ * + * \li -pt pt cut for decay products
+ * \li -dca dca cut for distance between decay tracks
+ * \li -invmass inv. mass half width of D0
+ * \li -costhetastar cos of decay angle
+ * \li -d0 Impact parameter for decay products
+ * \li -d0d0 Product of impact parameter for decay products
+ * \li -cospoint pointing angle
+ * \li -plothistogram ploting the inv. mass histogram
+ * + * By default, configuration is loaded from OCDB, can be overridden by + * component arguments. + * + *

Default CDB entries:

+ * HLT/ConfigHLT/D0Trigger: TObjString storing the arguments + * + *

Performance:

+ * + * + *

Memory consumption:

+ * + * + *

Output size:

+ * + * + * \ingroup alihlt_trigger_components + */ +class AliHLTD0Trigger : public AliHLTTrigger +{ + public: + AliHLTD0Trigger(); + ~AliHLTD0Trigger(); + + /// 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); + + private: + + /// inherited from AliHLTTrigger: calculate the trigger + virtual int DoTrigger(); + + /// pt cut for decay, minimum [GeV/c] + float fPtMin; //! transient + /// Distance between decay tracks [cm] ?? + float fdca; //! transient + /// Inv. mass half width [GeV] + float finvMass; //! transient + /// Decay angle + float fcosThetaStar; //! transient + /// Distance from primary vertex for decay tracks [cm] + float fd0; //! transient + /// Product of d0 for the two decay tracks [cm^2] + float fd0d0; //! transient + /// Pionting angle + float fcosPoint; //! transient + + bool fplothisto; //! transient + + /// D0 inv. mass plot + TH1F *fD0mass; //! transient + + /// the default configuration entry for this component + static const char* fgkOCDBEntry; //!transient + + ClassDef(AliHLTD0Trigger, 0) +}; +#endif //ALIHLTD0TRIGGER_H diff --git a/HLT/trigger/AliHLTD0toKpi.cxx b/HLT/trigger/AliHLTD0toKpi.cxx new file mode 100644 index 00000000000..971c188ce1e --- /dev/null +++ b/HLT/trigger/AliHLTD0toKpi.cxx @@ -0,0 +1,74 @@ +// $Id$ +#include "AliHLTD0toKpi.h" +#include "TDatabasePDG.h" +#include "TMath.h" +#include "AliESDtrack.h" +#include "TVector3.h" + +ClassImp(AliHLTD0toKpi) + +AliHLTD0toKpi::AliHLTD0toKpi() +{ +} + +Double_t AliHLTD0toKpi::InvMass(AliESDtrack* d1, AliESDtrack* d2) +{ + Double_t mpi=TDatabasePDG::Instance()->GetParticle(211)->Mass(); + Double_t mK=TDatabasePDG::Instance()->GetParticle(321)->Mass(); + + Double_t energy[2]; + energy[1] = TMath::Sqrt(mK*mK+d1->GetP()*d1->GetP()); + energy[0] = TMath::Sqrt(mpi*mpi+d2->GetP()*d2->GetP()); + + Double_t p1[3],p2[3]; + d1->GetPxPyPz(p1); + d2->GetPxPyPz(p2); + + Double_t momTot2 = (p1[0]+p2[0])*(p1[0]+p2[0])+ + (p1[1]+p2[1])*(p1[1]+p2[1])+ + (p1[2]+p2[2])*(p1[2]+p2[2]); + + return TMath::Sqrt((energy[0]+energy[1])*(energy[0]+energy[1])-momTot2); + +} +void AliHLTD0toKpi::cosThetaStar(AliESDtrack* d1, AliESDtrack* d2,Double_t &D0,Double_t &D0bar) +{ + Double_t mD0 = TDatabasePDG::Instance()->GetParticle(421)->Mass(); + Double_t mpi=TDatabasePDG::Instance()->GetParticle(211)->Mass(); + Double_t mK=TDatabasePDG::Instance()->GetParticle(321)->Mass(); + + Double_t pStar = TMath::Sqrt(TMath::Power(mD0*mD0-mK*mK-mpi*mpi,2.)-4.*mK*mK*mpi*mpi)/(2.*mD0); + + Double_t px = d1->Px()+d2->Px(); + Double_t py = d1->Py()+d2->Py(); + Double_t pz = d1->Pz()+d2->Pz(); + Double_t p = TMath::Sqrt(px*px+py*py+pz*pz); + Double_t energy = TMath::Sqrt(p*p+mD0*mD0); + + Double_t beta = p/energy; + Double_t gamma = energy/mD0; + + Double_t qL; + TVector3 mom(d1->Px(),d1->Py(),d1->Pz()); + TVector3 momD(px,py,pz); + qL = mom.Dot(momD)/momD.Mag(); + + D0 = (qL/gamma-beta*TMath::Sqrt(pStar*pStar+mK*mK))/pStar; + + TVector3 mom2(d2->Px(),d2->Py(),d2->Pz()); + TVector3 momD2(px,py,pz); + qL = mom2.Dot(momD2)/momD2.Mag(); + + D0bar = (qL/gamma-beta*TMath::Sqrt(pStar*pStar+mK*mK))/pStar; + +} +Double_t AliHLTD0toKpi::pointingAngle(AliESDtrack* n, AliESDtrack* p, Double_t *pv, Double_t *sv) +{ + + TVector3 mom(n->Px()+p->Px(),n->Py()+p->Py(),n->Pz()+p->Pz()); + TVector3 flight(sv[0]-pv[0],sv[1]-pv[1],sv[2]-pv[2]); + + double pta = mom.Angle(flight); + + return TMath::Cos(pta); +} diff --git a/HLT/trigger/AliHLTD0toKpi.h b/HLT/trigger/AliHLTD0toKpi.h new file mode 100644 index 00000000000..536f118082d --- /dev/null +++ b/HLT/trigger/AliHLTD0toKpi.h @@ -0,0 +1,29 @@ +//-*- Mode: C++ -*- +// $Id$ +#ifndef ALIHLTD0TOKPI_H +#define ALIHLTD0TOKPI_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 AliHLTD0toKpi.h +/// @author Gaute Ovrebekk +/// @date 2009-10-28 +/// @brief Class for calculating D0->Kpi + +#include "TObject.h" + +class AliESDtrack; + +class AliHLTD0toKpi : public TObject +{ +public: + AliHLTD0toKpi(); + Double_t InvMass(AliESDtrack* d1, AliESDtrack* d2); + void cosThetaStar(AliESDtrack* n, AliESDtrack* p,Double_t &D0,Double_t &D0bar); + Double_t pointingAngle(AliESDtrack* n, AliESDtrack* p, Double_t *pv, Double_t *sv); +private: + + ClassDef(AliHLTD0toKpi, 1) +}; +#endif //ALIHLTD0TOKPI_H diff --git a/HLT/trigger/AliHLTTriggerAgent.cxx b/HLT/trigger/AliHLTTriggerAgent.cxx index 78eb48ef7fc..b2abff1a031 100644 --- a/HLT/trigger/AliHLTTriggerAgent.cxx +++ b/HLT/trigger/AliHLTTriggerAgent.cxx @@ -36,6 +36,8 @@ #include "AliHLTEventSummaryProducerComponent.h" #include "AliHLTRunSummaryProducerComponent.h" #include "AliHLTTriggerBarrelMultiplicity.h" +#include "AliHLTD0Trigger.h" +#include "AliHLTTriggerITSMultiplicity.h" #include "AliHLTTriggerBarrelGeomMultiplicity.h" #include "AliHLTTriggerBarrelCosmic.h" #include "AliHLTGlobalTriggerComponent.h" @@ -73,6 +75,8 @@ int AliHLTTriggerAgent::RegisterComponents(AliHLTComponentHandler* pHandler) con if (!pHandler) return -EINVAL; pHandler->AddComponent(new AliHLTGlobalTriggerComponent); pHandler->AddComponent(new AliHLTTriggerBarrelMultiplicity); + pHandler->AddComponent(new AliHLTTriggerITSMultiplicity); + pHandler->AddComponent(new AliHLTD0Trigger); pHandler->AddComponent(new AliHLTTriggerBarrelGeomMultiplicity); pHandler->AddComponent(new AliHLTTriggerBarrelCosmic); pHandler->AddComponent(new AliHLTTriggerPhosClusterEnergy); diff --git a/HLT/trigger/AliHLTTriggerITSMultiplicity.cxx b/HLT/trigger/AliHLTTriggerITSMultiplicity.cxx new file mode 100644 index 00000000000..ca9941731e2 --- /dev/null +++ b/HLT/trigger/AliHLTTriggerITSMultiplicity.cxx @@ -0,0 +1,176 @@ +// $Id$ +//************************************************************************** +//* This file is property of and copyright by the ALICE HLT Project * +//* ALICE Experiment at CERN, All rights reserved. * +//* * +//* Primary Authors: Gaute Ovrebekk * +//* 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 AliHLTTriggerITSMultiplicity.cxx +/// @author Gaute Ovrebekk +/// @date 2009-10-22 +/// @brief HLT trigger component for cluster multiplicity +/// in ITS. + + +// 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 "AliHLTTriggerITSMultiplicity.h" +#include "AliHLTTriggerDecision.h" +#include "AliHLTDomainEntry.h" +#include "TObjString.h" +#include "AliHLTITSClusterDataFormat.h" +#include "AliHLTITSSpacePointData.h" + +/** ROOT macro for the implementation of ROOT specific class methods */ +ClassImp(AliHLTTriggerITSMultiplicity) + +AliHLTTriggerITSMultiplicity::AliHLTTriggerITSMultiplicity() + : AliHLTTrigger() + , fnClusters(0) +{ + // see header file for class documentation + // or + // refer to README to build package + // or + // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt + +} + +const char* AliHLTTriggerITSMultiplicity::fgkOCDBEntry="HLT/ConfigHLT/ITSMultiplicityTrigger"; + +AliHLTTriggerITSMultiplicity::~AliHLTTriggerITSMultiplicity() +{ + // see header file for class documentation +} + +const char* AliHLTTriggerITSMultiplicity::GetTriggerName() const +{ + // see header file for class documentation + return "ITSMultiplicityTrigger"; +} + +AliHLTComponent* AliHLTTriggerITSMultiplicity::Spawn() +{ + // see header file for class documentation + return new AliHLTTriggerITSMultiplicity; +} + +int AliHLTTriggerITSMultiplicity::DoTrigger() +{ + // see header file for class documentation + int iResult=0; + int numberOfClusters=-1; + TString description; + + const AliHLTComponentBlockData* iter = NULL; + + if(!IsDataEvent()) return 0; + + for(iter = GetFirstInputBlock(kAliHLTDataTypeClusters); iter != NULL; iter = GetNextInputBlock()){ + + if(iter->fDataType!=(kAliHLTAnyDataType|kAliHLTDataOriginITSSPD) && + iter->fDataType!=(kAliHLTAnyDataType|kAliHLTDataOriginITSSDD) && + iter->fDataType!=(kAliHLTAnyDataType|kAliHLTDataOriginITSSSD)) + continue; + + const AliHLTITSClusterData* clusterData = (const AliHLTITSClusterData*) iter->fPtr; + Int_t nSpacepoint = (Int_t) clusterData->fSpacePointCnt; + numberOfClusters += nSpacepoint; + + } + + if (iResult>=0 && numberOfClusters>=0) { + + if (numberOfClusters>=fnClusters) { + description.Form("Event contains %d cluster(s)", numberOfClusters); + 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", "ITS "); + TriggerEvent(true); + return 0; + } + description.Form("No clusters matching the tresholds found (min clusters %d ", fnClusters); + } else { + description.Form("No input blocks found"); + } + SetDescription(description.Data()); + TriggerEvent(false); + return iResult; +} + +int AliHLTTriggerITSMultiplicity::DoInit(int argc, const char** argv) +{ + // see header file for class documentation + + // first configure the default + int iResult=0; + 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 AliHLTTriggerITSMultiplicity::DoDeinit() +{ + // see header file for class documentation + return 0; +} + +int AliHLTTriggerITSMultiplicity::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 AliHLTTriggerITSMultiplicity::ScanConfigurationArgument(int argc, const char** argv) +{ + // see header file for class documentation + if (argc<=0) return 0; + int i=0; + TString argument=argv[i]; + + // -nclusters + if (argument.CompareTo("-nclusters")==0) { + if (++i>=argc) return -EPROTO; + argument=argv[i]; + fnClusters=argument.Atof(); + return 2; + } + + // unknown argument + return -EINVAL; +} diff --git a/HLT/trigger/AliHLTTriggerITSMultiplicity.h b/HLT/trigger/AliHLTTriggerITSMultiplicity.h new file mode 100644 index 00000000000..25c1913d191 --- /dev/null +++ b/HLT/trigger/AliHLTTriggerITSMultiplicity.h @@ -0,0 +1,96 @@ +//-*- Mode: C++ -*- +// $Id: AliHLTTriggerITSMultiplicity.h +#ifndef ALIHLTTRIGGERITSMULTIPLICITY_H +#define ALIHLTTRIGGERITSMULTIPLICITY_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 AliHLTTriggerITSMultiplicity.h +/// @author Gaute Ovrebekk +/// @date 2009-10-22 +/// @brief HLT trigger component for cluster multiplicity +/// in ITS. + +#include "AliHLTTrigger.h" + +/** + * @class AliHLTTriggerITSMultiplicity + * HLT trigger component for cluster multiplicity in ITS. + * + * Triggers if number of clusters if over the set limit. + * + *

General properties:

+ * + * Component ID: \b ITSMultiplicityTrigger
+ * Library: \b libAliHLTTrigger.so
+ * Input Data Types: kAliHLTDataTypeClusters
+ * Output Data Types: ::kAliHLTAnyDataType
+ * + *

Mandatory arguments:

+ * + * + *

Optional arguments:

+ * + * + *

Configuration:

+ * + * \li -nclusters n
+ * Number of clusters to trigger on. + * + * By default, configuration is loaded from OCDB, can be overridden by + * component arguments. + * + *

Default CDB entries:

+ * HLT/ConfigHLT/ITSMultiplicityTrigger: TObjString storing the arguments + * + *

Performance:

+ * + * + *

Memory consumption:

+ * + * + *

Output size:

+ * + * + * \ingroup alihlt_trigger_components + */ +class AliHLTTriggerITSMultiplicity : public AliHLTTrigger +{ + public: + AliHLTTriggerITSMultiplicity(); + ~AliHLTTriggerITSMultiplicity(); + + /// 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); + + private: + + /// inherited from AliHLTTrigger: calculate the trigger + virtual int DoTrigger(); + + /// Number of clusters to trigger on + int fnClusters; //! transient + + /// the default configuration entry for this component + static const char* fgkOCDBEntry; //!transient + + ClassDef(AliHLTTriggerITSMultiplicity, 0) +}; +#endif //ALIHLTTRIGGERITSMULTIPLICITY_H diff --git a/HLT/trigger/AliHLTTriggerLinkDef.h b/HLT/trigger/AliHLTTriggerLinkDef.h index 56ab1a09550..bf8cd07f303 100644 --- a/HLT/trigger/AliHLTTriggerLinkDef.h +++ b/HLT/trigger/AliHLTTriggerLinkDef.h @@ -9,6 +9,9 @@ #pragma link C++ class AliHLTGlobalTriggerConfig+; #pragma link C++ class AliHLTGlobalTriggerComponent+; #pragma link C++ class AliHLTTriggerBarrelMultiplicity+; +#pragma link C++ class AliHLTD0Trigger+; +#pragma link C++ class AliHLTD0toKpi+; +#pragma link C++ class AliHLTTriggerITSMultiplicity+; #pragma link C++ class AliHLTTriggerBarrelGeomMultiplicity+; #pragma link C++ class AliHLTTriggerBarrelCosmic+; #pragma link C++ class AliHLTTriggerAgent+; -- 2.39.3