--- /dev/null
+
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* *
+//* Primary Authors: Kenneth Aamodt <kenneth.aamodt@cern.ch> *
+//* 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 AliHLTTriggerGammaConversion.cxx
+/// @author Kenneth Aamodt
+/// @date 2009-11-01
+/// @brief HLT trigger component for gamma conversions.
+///
+
+// 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 "AliHLTTriggerGammaConversion.h"
+#include "AliESDEvent.h"
+#include "AliESDv0.h"
+#include "AliHLTTriggerDecision.h"
+#include "AliHLTDomainEntry.h"
+#include "AliHLTGlobalBarrelTrack.h"
+#include "AliKFParticle.h"
+#include "AliKFVertex.h"
+#include "TObjArray.h"
+#include "TObjString.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTTriggerGammaConversion)
+
+AliHLTTriggerGammaConversion::AliHLTTriggerGammaConversion()
+ : AliHLTTrigger()
+ , fMaxInvMass(0.0)
+ , fPtMax(0.0)
+ , fPtMin(0.0)
+ , fMaxDca(0.0)
+ , fMaxR(0)
+ , fNReconstructedGammas(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* AliHLTTriggerGammaConversion::fgkOCDBEntry="HLT/ConfigHLT/GammaConversionTrigger";
+
+AliHLTTriggerGammaConversion::~AliHLTTriggerGammaConversion()
+{
+ // see header file for class documentation
+}
+
+const char* AliHLTTriggerGammaConversion::GetTriggerName() const
+{
+ // see header file for class documentation
+ return "GammaConversionTrigger";
+}
+
+AliHLTComponent* AliHLTTriggerGammaConversion::Spawn()
+{
+ // see header file for class documentation
+ return new AliHLTTriggerGammaConversion;
+}
+
+int AliHLTTriggerGammaConversion::DoTrigger()
+{
+ // see header file for class documentation
+ int iResult=0;
+ fNReconstructedGammas=0;
+
+ if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) )
+ return 0;
+
+ for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDObject); iter != NULL; iter = GetNextInputObject() ) {
+
+ AliESDEvent *event = dynamic_cast<AliESDEvent*>(const_cast<TObject*>( iter ) );
+ event->GetStdContent();
+ Int_t nV0 = event->GetNumberOfV0s();
+ if(nV0<=0){
+ continue;
+ }
+ AliKFParticle::SetField( event->GetMagneticField() );
+
+ for (Int_t iv=0; iv<nV0; iv++) {
+
+ AliESDtrack *t1=event->GetTrack( event->GetV0(iv)->GetNindex());
+ AliESDtrack *t2=event->GetTrack( event->GetV0(iv)->GetPindex());
+
+ AliKFParticle kf1( *t1->GetInnerParam(), 11 );
+ AliKFParticle kf2( *t2->GetInnerParam(), 11 );
+
+ AliKFVertex primVtx( *event->GetPrimaryVertexTracks() );
+
+ AliKFParticle v0( kf1, kf2 );
+ primVtx+=v0;
+ v0.SetProductionVertex( primVtx );
+
+ if(kf1.GetDistanceFromParticle(kf2)>fMaxDca){
+ continue;
+ }
+
+ double mass, error;
+ v0.GetMass(mass,error);
+ if( TMath::Abs(mass)>fMaxInvMass ){
+ continue;
+ }
+
+ AliKFParticle gamma = v0;
+ gamma.SetMassConstraint(0);
+
+ double r= sqrt(gamma.GetX()*gamma.GetX()+gamma.GetY()*gamma.GetY());
+ if(r>fMaxR){
+ continue;
+ }
+ if(gamma.GetPt()<fPtMin){
+ continue;
+ }
+
+ if (fPtMax>0.){
+ if(gamma.GetPt()>fPtMax){
+ continue;
+ }
+ }
+
+ fNReconstructedGammas++;
+ }
+ }
+ TString description;
+ TString maxInvMass, ptcut, maxDca, maxR;
+ maxInvMass.Form(" mass < %.03f GeV ,",fMaxInvMass);
+ if (fPtMax>fPtMin) {
+ ptcut.Form(" %.02f GeV/c <= pt <= %.02f GeV/c ,", fPtMin, fPtMax);
+ } else {
+ ptcut.Form(" pt >= %.02f GeV/c ,", fPtMin);
+ }
+ maxDca.Form(" dca <= %.04fcm ,",fMaxDca);
+ maxR.Form(" r <= %.02cm");
+
+ if(fNReconstructedGammas>0){
+ description.Form("Event contains %d gamma conversions,", fNReconstructedGammas);
+ description += ptcut;
+ description += maxDca;
+ description += maxR;
+
+ SetDescription(description.Data());
+
+ 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.
+ TriggerEvent(true);
+ return 0;
+ }
+ else{
+ description.Form("No Gamma Conversions reconstructed that satisfy:");
+ description += ptcut;
+ description += maxDca;
+ description += maxR;
+ }
+ SetDescription(description.Data());
+ TriggerEvent(false);
+ return iResult;
+}
+
+int AliHLTTriggerGammaConversion::DoInit(int argc, const char** argv)
+{
+ // see header file for class documentation
+
+ // first configure the default
+ int 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 AliHLTTriggerGammaConversion::DoDeinit()
+{
+ // see header file for class documentation
+ return 0;
+}
+
+int AliHLTTriggerGammaConversion::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 AliHLTTriggerGammaConversion::ScanConfigurationArgument(int argc, const char** argv)
+{
+ // see header file for class documentation
+ if (argc<=0) return 0;
+ int i=0;
+ TString argument=argv[i];
+
+ // -max-invmass
+ if (argument.CompareTo("-max-invmass")==0) {
+ if (++i>=argc) return -EPROTO;
+ argument=argv[i];
+ fMaxInvMass=argument.Atof();
+ return 2;
+ }
+
+ // -max-pt
+ if (argument.CompareTo("-max-pt")==0) {
+ if (++i>=argc) return -EPROTO;
+ argument=argv[i];
+ fPtMax=argument.Atof();
+ return 2;
+ }
+
+ // -min-pt
+ if (argument.CompareTo("-min-pt")==0) {
+ if (++i>=argc) return -EPROTO;
+ argument=argv[i];
+ fPtMin=argument.Atof();
+ return 2;
+ }
+
+ // -max-dca
+ // maximum dca of v0
+ if (argument.CompareTo("-max-dca")==0) {
+ if (++i>=argc) return -EPROTO;
+ argument=argv[i];
+ fMaxDca=argument.Atof();
+ return 2;
+ }
+
+ // -max-r
+ // maximum radius of v0 in xy-plane
+ if (argument.CompareTo("-max-r")==0) {
+ if (++i>=argc) return -EPROTO;
+ argument=argv[i];
+ fMaxR=argument.Atof();
+ return 2;
+ }
+
+ // unknown argument
+ return -EINVAL;
+}
--- /dev/null
+//-*- Mode: C++ -*-
+
+#ifndef ALIHLTTRIGGERGAMMACONVERSION_H
+#define ALIHLTTRIGGERGAMMACONVERSION_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 AliHLTTriggerGammaConversion.h
+/// @author Kenneth Aamodt
+/// @date 2009-11-01
+/// @brief HLT trigger component for gamma conversions.
+///
+
+#include "AliHLTTrigger.h"
+
+class AliESDtrack;
+
+/**
+ * @class AliHLTTriggerGammaConversion
+ * HLT trigger component for gamma conversions
+ *
+ *
+ * Triggers on gamma conversions wich satisfy cuts on invariant mass, radius, dca and Pt.
+ *
+ * <h2>General properties:</h2>
+ *
+ * Component ID: \b GammaConversionTrigger <br>
+ * Library: \b libAliHLTTrigger.so <br>
+ * Input Data Types: kAliHLTDataTypeESDObject <br>
+ * Output Data Types: ::kAliHLTAnyDataType <br>
+ *
+ * <h2>Mandatory arguments:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ *
+ * <h2>Optional arguments:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ *
+ * <h2>Configuration:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ * \li -max-invmass <i> mass </i> <br>
+ * invariant mass of the two gamma daughters
+ * \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 -max-dca <i> distance </i> <br>
+ * dca between the two gamma daughters
+ * \li -max-radius <i> r </i> <br>
+ * maximum radius from the collision point in xy-plane
+
+ *
+ * By default, configuration is loaded from OCDB, can be overridden by
+ * component arguments.
+ *
+ * <h2>Default CDB entries:</h2>
+ * HLT/ConfigHLT/GammaConversionTrigger: TObjString storing the arguments
+ *
+ * <h2>Performance:</h2>
+ *
+ *
+ * <h2>Memory consumption:</h2>
+ *
+ *
+ * <h2>Output size:</h2>
+ *
+ *
+ * \ingroup alihlt_trigger_components
+ */
+class AliHLTTriggerGammaConversion : public AliHLTTrigger
+{
+ public:
+ AliHLTTriggerGammaConversion();
+ ~AliHLTTriggerGammaConversion();
+
+ /// 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();
+
+ /// mass cut, maximum
+ double fMaxInvMass; //! transient
+ /// pt cut, maximum
+ double fPtMax; //! transient
+ /// pt cut, minimum
+ double fPtMin; //! transient
+ /// maximum dca to qualify as a gamma conversion
+ double fMaxDca; //! transient
+ /// maximum radius from collision point in xy-plane
+ double fMaxR;
+
+ /// number of reconstructed gammas
+ Int_t fNReconstructedGammas; //! transient
+
+ /// the default configuration entry for this component
+ static const char* fgkOCDBEntry; //!transient
+
+ ClassDef(AliHLTTriggerGammaConversion, 0)
+};
+#endif //ALIHLTTRIGGERGAMMACONVERSION_H