2 //**************************************************************************
3 //* This file is property of and copyright by the ALICE HLT Project *
4 //* ALICE Experiment at CERN, All rights reserved. *
6 //* Primary Authors: Svein Lindal <svein.lindal@gmail.com> *
7 //* for The ALICE HLT Project. *
9 //* Permission to use, copy, modify and distribute this software and its *
10 //* documentation strictly for non-commercial purposes is hereby granted *
11 //* without fee, provided that the above copyright notice appears in all *
12 //* copies and that both the copyright notice and this permission notice *
13 //* appear in the supporting documentation. The authors make no claims *
14 //* about the suitability of this software for any purpose. It is *
15 //* provided "as is" without express or implied warranty. *
16 //**************************************************************************
18 /// @file AliHLTTriggerPhosClusterEnergy.cxx
19 /// @author Svein Lindal <slindal@fys.uio.no>
21 /// @brief HLT energy threshold trigger for PHOS
24 // see header file for class documentation
26 // refer to README to build package
28 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
31 #include "AliHLTTriggerPhosClusterEnergy.h"
32 #include "AliESDEvent.h"
33 #include "AliESDCaloCluster.h"
34 #include "AliHLTTriggerDecision.h"
35 #include "AliHLTDomainEntry.h"
37 /** ROOT macro for the implementation of ROOT specific class methods */
38 ClassImp(AliHLTTriggerPhosClusterEnergy)
40 AliHLTTriggerPhosClusterEnergy::AliHLTTriggerPhosClusterEnergy()
44 // see header file for class documentation
46 // refer to README to build package
48 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlts
51 const char* AliHLTTriggerPhosClusterEnergy::fgkOCDBEntry="HLT/ConfigHLT/PhosClusterEnergyTrigger";
53 AliHLTTriggerPhosClusterEnergy::~AliHLTTriggerPhosClusterEnergy()
55 // see header file for class documentation
58 const char* AliHLTTriggerPhosClusterEnergy::GetTriggerName() const
60 // see header file for class documentation
61 return "PhosClusterEnergyTrigger";
64 AliHLTComponent* AliHLTTriggerPhosClusterEnergy::Spawn()
66 // see header file for class documentation
67 return new AliHLTTriggerPhosClusterEnergy;
70 int AliHLTTriggerPhosClusterEnergy::DoTrigger()
72 // see header file for class documentation
76 const TObject* obj = GetFirstInputObject(kAliHLTAllDataTypes, "AliESDEvent");
77 AliESDEvent* esd = dynamic_cast<AliESDEvent*>(const_cast<TObject*>(obj));
82 //Loop over Calorimeter clusters
83 Int_t ncc = esd->GetNumberOfCaloClusters();
84 for (Int_t i = 0; i < ncc ; i++) {
85 AliESDCaloCluster * cluster = esd->GetCaloCluster(i);
87 // Trigger condition: PHOS clusters with energy > fEThreshold
88 if (cluster->IsPHOS() && cluster->E() > fEThreshold) {
89 description.Form("Event contains at least one PHOS cluster with energy > %.02f GeV.", fEThreshold);
90 SetDescription(description.Data());
92 // Enable the detectors for readout.
93 GetReadoutList().Enable( AliHLTReadoutList::kPHOS );
95 // Add the available HLT information for readout too.
96 GetTriggerDomain().Add(kAliHLTAnyDataTypeID, "PHOS");
98 //Set trigger decision
106 // If we got to this point then we did not find any tracks with E > fEThreshold
107 // generate negative trigger decision
108 description.Form("No PHOS clusters containing energy > %.02f GeV found.", fEThreshold);
109 SetDescription(description.Data());
114 int AliHLTTriggerPhosClusterEnergy::DoInit(int argc, const char** argv) {
115 // see header file for class documentation
117 // first configure the default
118 int iResult=ConfigureFromCDBTObjString(fgkOCDBEntry);
120 // configure from the command line parameters if specified
121 if (iResult>=0 && argc>0) {
122 iResult=ConfigureFromArgumentString(argc, argv);
123 HLTImportant("Trigger threshold set from argument string: %.02f GeV:", fEThreshold );
124 } else if ( iResult >=0 ) {
125 HLTImportant("Trigger threshold set from OCDB database entry: %.02f GeV:", fEThreshold );
130 int AliHLTTriggerPhosClusterEnergy::DoDeinit()
132 // see header file for class documentation
136 int AliHLTTriggerPhosClusterEnergy::Reconfigure(const char* cdbEntry, const char* /*chainId*/)
138 // see header file for class documentation
140 // configure from the specified antry or the default one
141 const char* entry=cdbEntry;
142 if (!entry || entry[0]==0) entry=fgkOCDBEntry;
144 return ConfigureFromCDBTObjString(entry);
147 int AliHLTTriggerPhosClusterEnergy::ScanConfigurationArgument(int argc, const char** argv)
149 // see header file for class documentation
150 if (argc<=0) return 0;
152 TString argument=argv[i];
155 if (argument.CompareTo("-energy")==0) {
156 if (++i>=argc) return -EPROTO;
158 fEThreshold=argument.Atof();
166 void AliHLTTriggerPhosClusterEnergy::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
168 // see header file for class documentation
169 constBase = sizeof(AliHLTTriggerDecision) + sizeof(AliHLTDomainEntry)*14;