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: Matthias Richter <Matthias.Richter@ift.uib.no> *
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 AliHLTTriggerBarrelMultiplicity.cxx
19 /// @author Matthias Richter
21 /// @brief HLT trigger component for charged particle multiplicity in
22 /// the central barrel.
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
30 #include "AliHLTTriggerBarrelMultiplicity.h"
31 #include "AliESDEvent.h"
32 #include "AliHLTTriggerDecision.h"
33 #include "AliHLTDomainEntry.h"
34 #include "AliHLTGlobalBarrelTrack.h"
36 /** ROOT macro for the implementation of ROOT specific class methods */
37 ClassImp(AliHLTTriggerBarrelMultiplicity)
39 AliHLTTriggerBarrelMultiplicity::AliHLTTriggerBarrelMultiplicity()
45 // see header file for class documentation
47 // refer to README to build package
49 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
52 const char* AliHLTTriggerBarrelMultiplicity::fgkOCDBEntry="HLT/ConfigHLT/BarrelMultiplicityTrigger";
54 AliHLTTriggerBarrelMultiplicity::~AliHLTTriggerBarrelMultiplicity()
56 // see header file for class documentation
59 const char* AliHLTTriggerBarrelMultiplicity::GetTriggerName() const
61 // see header file for class documentation
62 return "BarrelMultiplicityTrigger";
65 AliHLTComponent* AliHLTTriggerBarrelMultiplicity::Spawn()
67 // see header file for class documentation
68 return new AliHLTTriggerBarrelMultiplicity;
71 int AliHLTTriggerBarrelMultiplicity::DoTrigger()
73 // see header file for class documentation
75 int numberOfTracks=-1;
77 // try the ESD as input
78 const TObject* obj = GetFirstInputObject(kAliHLTAllDataTypes, "AliESDEvent");
79 AliESDEvent* esd = dynamic_cast<AliESDEvent*>(const_cast<TObject*>(obj));
86 for (Int_t i = 0; i < esd->GetNumberOfTracks(); i++) {
87 if (CheckCondition(esd->GetTrack(i))) numberOfTracks++;
91 // try the AliHLTExternal track data as input
92 if (iResult>=0 && numberOfTracks<0) {
93 for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTrack);
94 pBlock!=NULL; pBlock=GetNextInputBlock()) {
95 vector<AliHLTGlobalBarrelTrack> tracks;
96 if ((iResult=AliHLTGlobalBarrelTrack::ConvertTrackDataArray(reinterpret_cast<const AliHLTTracksData*>(pBlock->fPtr), pBlock->fSize, tracks))>0) {
97 for (vector<AliHLTGlobalBarrelTrack>::iterator element=tracks.begin();
98 element!=tracks.end(); element++) {
99 if (CheckCondition(&(*element))) numberOfTracks++;
101 } else if (iResult<0) {
102 HLTError("can not extract tracks from data block of type %s (specification %08x) of size %d: error %d",
103 DataType2Text(pBlock->fDataType).c_str(), pBlock->fSpecification, pBlock->fSize, iResult);
108 if (iResult>=0 && numberOfTracks>=0) {
110 ptcut.Form(" %.02f GeV/c <= pt < %.02f GeV/c", fPtMin, fPtMax);
112 ptcut.Form(" pt >= %.02f GeV/c", fPtMin);
114 if (numberOfTracks>=fMinTracks) {
115 description.Form("Event contains %d track(s) with ", numberOfTracks);
117 SetDescription(description.Data());
118 // Enable the central detectors for readout.
119 GetReadoutList().Enable(
120 AliHLTReadoutList::kITSSPD |
121 AliHLTReadoutList::kITSSDD |
122 AliHLTReadoutList::kITSSSD |
123 AliHLTReadoutList::kTPC |
124 AliHLTReadoutList::kTRD |
125 AliHLTReadoutList::kTOF |
126 AliHLTReadoutList::kHMPID |
127 AliHLTReadoutList::kPHOS
129 // Add the available HLT information for readout too.
130 GetTriggerDomain().Add("CLUSTERS", "TPC ");
134 description.Form("No tracks matching the tresholds found in the central barrel (min tracks %d, %s)",
135 fMinTracks, ptcut.Data());
137 description.Form("No input blocks found");
139 SetDescription(description.Data());
145 bool AliHLTTriggerBarrelMultiplicity::CheckCondition(T* track)
147 // see header file for class documentation
148 if (track && track->Pt() >= fPtMin &&
149 (fPtMax<=fPtMin || track->Pt() < fPtMax)) {
155 int AliHLTTriggerBarrelMultiplicity::DoInit(int argc, const char** argv)
157 // see header file for class documentation
159 // first configure the default
160 int iResult=ConfigureFromCDBTObjString(fgkOCDBEntry);
162 // configure from the command line parameters if specified
163 if (iResult>=0 && argc>0)
164 iResult=ConfigureFromArgumentString(argc, argv);
168 int AliHLTTriggerBarrelMultiplicity::DoDeinit()
170 // see header file for class documentation
174 int AliHLTTriggerBarrelMultiplicity::Reconfigure(const char* cdbEntry, const char* /*chainId*/)
176 // see header file for class documentation
178 // configure from the specified antry or the default one
179 const char* entry=cdbEntry;
180 if (!entry || entry[0]==0) entry=fgkOCDBEntry;
182 return ConfigureFromCDBTObjString(entry);
185 int AliHLTTriggerBarrelMultiplicity::ScanConfigurationArgument(int argc, const char** argv)
187 // see header file for class documentation
188 if (argc<=0) return 0;
190 TString argument=argv[i];
193 if (argument.CompareTo("-maxpt")==0) {
194 if (++i>=argc) return -EPROTO;
196 fPtMax=argument.Atof();
201 if (argument.CompareTo("-minpt")==0) {
202 if (++i>=argc) return -EPROTO;
204 fPtMin=argument.Atof();
209 if (argument.CompareTo("-mintracks")==0) {
210 if (++i>=argc) return -EPROTO;
212 fMinTracks=argument.Atoi();