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 AliHLTTriggerCaloClusterEnergy.cxx
19 /// @author Svein Lindal <slindal@fys.uio.no>
21 /// @brief BASE class for energy threshold trigger for Calorimeters
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 "AliHLTTriggerCaloClusterEnergy.h"
32 #include "AliESDEvent.h"
33 #include "AliESDCaloCluster.h"
34 #include "AliHLTTriggerDecision.h"
35 #include "AliHLTDomainEntry.h"
36 #include "AliHLTCaloClusterReader.h"
37 #include "AliHLTCaloClusterDataStruct.h"
38 #include "TRefArray.h"
42 /** ROOT macro for the implementation of ROOT specific class methods */
43 ClassImp(AliHLTTriggerCaloClusterEnergy)
45 AliHLTTriggerCaloClusterEnergy::AliHLTTriggerCaloClusterEnergy(TString detector) :
54 // see header file for class documentation
56 // refer to README to build package
58 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlts
60 fClusterReader = new AliHLTCaloClusterReader();
61 fClustersRefs = new TRefArray();
66 AliHLTTriggerCaloClusterEnergy::~AliHLTTriggerCaloClusterEnergy() {
67 // see header file for class documentation
69 delete fClusterReader;
70 fClusterReader = NULL;
77 Int_t AliHLTTriggerCaloClusterEnergy::DoTrigger() {
78 // see header file for class documentation
83 if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) )
86 //Try the caloclusterstruct input
89 for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(fInputDataType); pBlock!=NULL; pBlock=GetNextInputBlock()) {
90 AliHLTCaloClusterHeaderStruct *caloClusterHeader = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(pBlock->fPtr);
91 fClusterReader->SetMemory(caloClusterHeader);
93 AliHLTCaloClusterDataStruct * caloClusterStruct;
94 while( (caloClusterStruct = fClusterReader->NextCluster()) != 0) {
95 if (TriggerOnCluster(caloClusterStruct)) {
102 const TObject* obj = GetFirstInputObject(kAliHLTAllDataTypes, "AliESDEvent");
103 AliESDEvent* esd = dynamic_cast<AliESDEvent*>(const_cast<TObject*>(obj));
106 esd->GetStdContent();
108 Int_t ncc = GetClustersFromEsd(esd, fClustersRefs);
110 for (Int_t i = 0; i < ncc ; i++) {
112 AliESDCaloCluster * cluster = static_cast<AliESDCaloCluster*>(fClustersRefs->At(i));
113 if(TriggerOnCluster(cluster)) {
119 // If we got to this point then we did not find any clusters with E > fEThreshold
120 // generate negative trigger decision
122 description.Form("No %s clusters containing energy > %.02f GeV found.", fDetector.Data(), fEThreshold);
123 SetDescription(description.Data());
131 Bool_t AliHLTTriggerCaloClusterEnergy::TriggerOnCluster(T* cluster) {
133 if (cluster->E() > fEThreshold) {
135 //We have a cluster satisfying trigger criteria
137 description.Form("Event contains at least one %s cluster with energy > %.02f GeV.", fDetector.Data(), fEThreshold);
138 SetDescription(description.Data());
141 // Enable the detectors for readout.
143 //GetReadoutList().Enable(AliHLTReadoutList::kPHOS);
144 SetCaloReadoutList(); //FR
146 // Add the available HLT information for readout too.
147 GetTriggerDomain().Add(kAliHLTAnyDataTypeID, fDetector.Data());
149 //Set trigger decision
163 int AliHLTTriggerCaloClusterEnergy::DoInit(int argc, const char** argv) {
164 // see header file for class documentation
166 // first configure the default
167 int iResult=ConfigureFromCDBTObjString(fOCDBEntry);
169 // configure from the command line parameters if specified
170 if (iResult>=0 && argc>0) {
171 iResult=ConfigureFromArgumentString(argc, argv);
172 HLTImportant("Trigger threshold set from argument string: %.02f GeV:", fEThreshold );
173 } else if ( iResult >=0 ) {
174 HLTImportant("Trigger threshold set from OCDB database entry: %.02f GeV:", fEThreshold );
179 int AliHLTTriggerCaloClusterEnergy::DoDeinit() {
181 // see header file for class documentation
186 int AliHLTTriggerCaloClusterEnergy::Reconfigure(const char* cdbEntry, const char* /*chainId*/) {
187 // see header file for class documentation
189 // configure from the specified antry or the default one
190 const char* entry=cdbEntry;
191 if (!entry || entry[0]==0) entry=fOCDBEntry;
193 return ConfigureFromCDBTObjString(entry);
196 int AliHLTTriggerCaloClusterEnergy::ScanConfigurationArgument(int argc, const char** argv) {
197 // see header file for class documentation
198 if (argc<=0) return 0;
200 TString argument=argv[i];
203 if (argument.CompareTo("-energy")==0) {
204 if (++i>=argc) return -EPROTO;
206 fEThreshold=argument.Atof();
214 void AliHLTTriggerCaloClusterEnergy::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier) {
215 // see header file for documentation
216 constBase = sizeof(AliHLTTriggerDecision) + sizeof(AliHLTDomainEntry)*14;
221 void AliHLTTriggerCaloClusterEnergy::GetOCDBObjectDescription( TMap* const targetMap) {
222 // Get a list of OCDB object description.
223 if (!targetMap) return;
224 targetMap->Add(new TObjString(fOCDBEntry),
225 new TObjString(Form("%s threshold trigger OCDB object", fDetector.Data()) )