]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/trigger/AliHLTTriggerPhosClusterEnergy.cxx
Changed histogram output name.
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTTriggerPhosClusterEnergy.cxx
1 // $Id$
2 //**************************************************************************
3 //* This file is property of and copyright by the ALICE HLT Project        * 
4 //* ALICE Experiment at CERN, All rights reserved.                         *
5 //*                                                                        *
6 //* Primary Authors: Svein Lindal <svein.lindal@gmail.com>                 *
7 //*                  for The ALICE HLT Project.                            *
8 //*                                                                        *
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 //**************************************************************************
17
18 /// @file   AliHLTTriggerPhosClusterEnergy.cxx
19 /// @author Svein Lindal <slindal@fys.uio.no>
20 /// @date   2009-08-17
21 /// @brief  HLT energy threshold trigger for PHOS
22 ///      
23
24 // see header file for class documentation
25 // or
26 // refer to README to build package
27 // or
28 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
29
30
31 #include "AliHLTTriggerPhosClusterEnergy.h"
32 #include "AliESDEvent.h"
33 #include "AliESDCaloCluster.h"
34 #include "AliHLTTriggerDecision.h"
35 #include "AliHLTDomainEntry.h"
36
37 /** ROOT macro for the implementation of ROOT specific class methods */
38 ClassImp(AliHLTTriggerPhosClusterEnergy)
39
40 AliHLTTriggerPhosClusterEnergy::AliHLTTriggerPhosClusterEnergy() 
41   : AliHLTTrigger()
42   , fEThreshold(0.0)
43 {
44   // see header file for class documentation
45   // or
46   // refer to README to build package
47   // or
48   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlts
49 }
50
51 const char* AliHLTTriggerPhosClusterEnergy::fgkOCDBEntry="HLT/ConfigHLT/PhosClusterEnergyTrigger";
52
53 AliHLTTriggerPhosClusterEnergy::~AliHLTTriggerPhosClusterEnergy()
54 {
55   // see header file for class documentation
56 }
57
58 const char* AliHLTTriggerPhosClusterEnergy::GetTriggerName() const
59 {
60   // see header file for class documentation
61   return "PhosClusterEnergyTrigger";
62 }
63
64 AliHLTComponent* AliHLTTriggerPhosClusterEnergy::Spawn()
65 {
66   // see header file for class documentation
67   return new AliHLTTriggerPhosClusterEnergy;
68 }
69
70 int AliHLTTriggerPhosClusterEnergy::DoTrigger()
71 {
72   // see header file for class documentation
73
74   TString description;
75
76   const TObject* obj = GetFirstInputObject(kAliHLTAllDataTypes, "AliESDEvent");
77   AliESDEvent* esd = dynamic_cast<AliESDEvent*>(const_cast<TObject*>(obj));
78   
79   if (esd != NULL) {
80     esd->GetStdContent();
81     
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);
86       
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());
91
92         // Enable the detectors for readout.
93         GetReadoutList().Enable( AliHLTReadoutList::kPHOS );
94         
95         // Add the available HLT information for readout too.
96         GetTriggerDomain().Add(kAliHLTAnyDataTypeID, "PHOS");
97         
98         //Set trigger decision
99         TriggerEvent(true);
100         
101         return 0;
102       }
103     }
104   }
105   
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());
110   TriggerEvent(false);
111   return 0;
112 }
113
114 int AliHLTTriggerPhosClusterEnergy::DoInit(int argc, const char** argv) {
115   // see header file for class documentation
116
117   // first configure the default
118   int iResult=ConfigureFromCDBTObjString(fgkOCDBEntry);
119
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 ); 
126   }
127   return iResult;
128 }
129
130 int AliHLTTriggerPhosClusterEnergy::DoDeinit()
131 {
132   // see header file for class documentation
133   return 0;
134 }
135
136 int AliHLTTriggerPhosClusterEnergy::Reconfigure(const char* cdbEntry, const char* /*chainId*/)
137 {
138   // see header file for class documentation
139
140   // configure from the specified antry or the default one
141   const char* entry=cdbEntry;
142   if (!entry || entry[0]==0) entry=fgkOCDBEntry;
143
144   return ConfigureFromCDBTObjString(entry);
145 }
146
147 int AliHLTTriggerPhosClusterEnergy::ScanConfigurationArgument(int argc, const char** argv)
148 {
149   // see header file for class documentation
150   if (argc<=0) return 0;
151   int i=0;
152   TString argument=argv[i];
153
154   // -maxpt
155   if (argument.CompareTo("-energy")==0) {
156     if (++i>=argc) return -EPROTO;
157     argument=argv[i];
158     fEThreshold=argument.Atof();
159     return 2;
160   }    
161   
162   // unknown argument
163   return -EINVAL;
164 }
165
166 void AliHLTTriggerPhosClusterEnergy::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
167 {
168   // see header file for class documentation
169   constBase = sizeof(AliHLTTriggerDecision) + sizeof(AliHLTDomainEntry)*14;
170   inputMultiplier = 1;
171 }