3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Svein Lindal <svein.lindal@fys.uio.no> *
8 //* for The ALICE HLT Project. *
10 //* Permission to use, copy, modify and distribute this software and its *
11 //* documentation strictly for non-commercial purposes is hereby granted *
12 //* without fee, provided that the above copyright notice appears in all *
13 //* copies and that both the copyright notice and this permission notice *
14 //* appear in the supporting documentation. The authors make no claims *
15 //* about the suitability of this software for any purpose. It is *
16 //* provided "as is" without express or implied warranty. *
17 //**************************************************************************
19 /// @file AliHLTTriggerPhosMip.cxx
20 /// @author Svein Lindal
22 /// @brief HLT Minimum Ionizing Particle (MIP) 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 "AliHLTTriggerPhosMip.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(AliHLTTriggerPhosMip)
40 AliHLTTriggerPhosMip::AliHLTTriggerPhosMip()
46 // see header file for class documentation
48 // refer to README to build package
50 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlts
53 const char* AliHLTTriggerPhosMip::fgkOCDBEntry="HLT/ConfigHLT/PhosMipTrigger";
55 AliHLTTriggerPhosMip::~AliHLTTriggerPhosMip()
57 // see header file for class documentation
60 const char* AliHLTTriggerPhosMip::GetTriggerName() const
62 // see header file for class documentation
63 return "PhosMipTrigger";
66 AliHLTComponent* AliHLTTriggerPhosMip::Spawn()
68 // see header file for class documentation
69 return new AliHLTTriggerPhosMip;
72 int AliHLTTriggerPhosMip::DoTrigger()
74 // see header file for class documentation
78 const TObject* obj = GetFirstInputObject(kAliHLTAllDataTypes, "AliESDEvent");
79 AliESDEvent* esd = dynamic_cast<AliESDEvent*>(const_cast<TObject*>(obj));
84 //Loop over Calorimeter clusters
85 Int_t ncc = esd->GetNumberOfCaloClusters();
86 for (Int_t i = 0; i < ncc ; i++) {
87 AliESDCaloCluster * cluster = esd->GetCaloCluster(i);
89 // Trigger condition: PHOS clusters within energy range, cells < fNCellsMax
90 if ( cluster->IsPHOS() &&
91 cluster->E() > fEMin &&
92 cluster->E() < fEMax &&
93 cluster->GetNCells() <= fNCellsMax ) {
95 description.Form("Event contains at least one PHOS cluster satisfying MIP criteria");
96 SetDescription(description.Data());
98 // Enable the detectors for readout.
99 GetReadoutList().Enable( AliHLTReadoutList::kPHOS );
101 // Add the available HLT information for readout too.
102 GetTriggerDomain().Add(kAliHLTAnyDataTypeID, "PHOS");
104 //Set trigger decision
108 } /// if trigger criteria
112 // If we got to this point then we did not find any good MIP candidates
113 // generate negative trigger decision
114 description.Form("No PHOS clusters satisfying MIP criteria found");
115 SetDescription(description.Data());
120 int AliHLTTriggerPhosMip::DoInit(int argc, const char** argv) {
121 // see header file for class documentation
123 // first configure the default
124 int iResult=ConfigureFromCDBTObjString(fgkOCDBEntry);
126 // configure from the command line parameters if specified
127 if (iResult>=0 && argc>0) {
128 HLTInfo("Trigger configuration from OCDB database entry: emin %.03f GeV \n emax %.03f, \n ncells: %i", fEMin, fEMax, fNCellsMax );
129 iResult=ConfigureFromArgumentString(argc, argv);
130 HLTInfo("Trigger configuration overwritten from command line: emin %.03f GeV \n emax %.03f, \n ncells: %i", fEMin, fEMax, fNCellsMax );
131 } else if ( iResult >=0 ) {
132 HLTInfo("Trigger configuration from OCDB database entry: emin %.03f GeV \n emax %.03f, \n ncells: %i", fEMin, fEMax, fNCellsMax );
137 int AliHLTTriggerPhosMip::DoDeinit()
139 // see header file for class documentation
143 int AliHLTTriggerPhosMip::Reconfigure(const char* cdbEntry, const char* /*chainId*/)
145 // see header file for class documentation
147 // configure from the specified antry or the default one
148 const char* entry=cdbEntry;
149 if (!entry || entry[0]==0) entry=fgkOCDBEntry;
151 return ConfigureFromCDBTObjString(entry);
154 int AliHLTTriggerPhosMip::ScanConfigurationArgument(int argc, const char** argv)
156 // see header file for class documentation
157 if (argc<=0) return 0;
159 TString argument=argv[i];
162 if (argument.CompareTo("-emin")==0) {
163 if (++i>=argc) return -EPROTO;
165 fEMin=argument.Atof();
170 else if (argument.CompareTo("-emax")==0) {
171 if (++i>=argc) return -EPROTO;
173 fEMax=argument.Atof();
178 else if (argument.CompareTo("-ncells")==0) {
179 if (++i>=argc) return -EPROTO;
181 fNCellsMax=argument.Atoi();
189 void AliHLTTriggerPhosMip::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
191 // see header file for class documentation
192 constBase = sizeof(AliHLTTriggerDecision) + sizeof(AliHLTDomainEntry)*14;