]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/trigger/AliHLTTriggerBarrelMultiplicity.cxx
adding skeletons for a multiplicity and a cosmics trigger component for the
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTTriggerBarrelMultiplicity.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: Matthias Richter <Matthias.Richter@ift.uib.no>        *
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   AliHLTTriggerBarrelMultiplicity.cxx
19 /// @author Matthias Richter
20 /// @date   2009-06-30
21 /// @brief  HLT trigger component for charged particle multiplicity in
22 ///         the central barrel.
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 #include "AliHLTTriggerBarrelMultiplicity.h"
31 #include "AliESDEvent.h"
32 #include "AliHLTTriggerDecision.h"
33 #include "AliHLTDomainEntry.h"
34
35 /** ROOT macro for the implementation of ROOT specific class methods */
36 ClassImp(AliHLTTriggerBarrelMultiplicity)
37
38 AliHLTTriggerBarrelMultiplicity::AliHLTTriggerBarrelMultiplicity()
39   : AliHLTTrigger()
40   , fPtMin(0.0)
41   , fPtMax(0.0)
42   , fMinTracks(1)
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-hlt
49 }
50
51 AliHLTTriggerBarrelMultiplicity::~AliHLTTriggerBarrelMultiplicity()
52 {
53   // see header file for class documentation
54 }
55
56 const char* AliHLTTriggerBarrelMultiplicity::GetTriggerName() const
57 {
58   // see header file for class documentation
59   return "BarrelMultiplicityTrigger";
60 }
61
62 AliHLTComponent* AliHLTTriggerBarrelMultiplicity::Spawn()
63 {
64   // see header file for class documentation
65   return new AliHLTTriggerBarrelMultiplicity;
66 }
67
68 int AliHLTTriggerBarrelMultiplicity::DoTrigger()
69 {
70   // see header file for class documentation
71   const TObject* obj = GetFirstInputObject(kAliHLTAllDataTypes, "AliESDEvent");
72   AliESDEvent* esd = dynamic_cast<AliESDEvent*>(const_cast<TObject*>(obj));
73   TString description;
74   TString ptcut;
75   if (esd != NULL) {
76     esd->GetStdContent();
77     
78     unsigned int numberOfTracks=0;
79     for (Int_t i = 0; i < esd->GetNumberOfTracks(); i++) {
80       AliESDtrack* track = esd->GetTrack(i);
81       if (track && track->Pt() >= fPtMin &&
82           (fPtMax<=fPtMin || track->Pt() < fPtMax)) {
83         numberOfTracks++;
84       }
85     }
86
87     if (fPtMax>fPtMin) {
88       ptcut.Form(" %.02f GeV/c <= pt < %.02f GeV/c", fPtMin, fPtMax);
89     } else {
90       ptcut.Form(" pt >= %.02f GeV/c", fPtMin);
91     }
92     if (numberOfTracks>=fMinTracks) {
93       description.Form("Event contains %d track(s) with ", numberOfTracks);
94       description+=ptcut;
95       SetDescription(description.Data());
96       // Enable the central detectors for readout.
97       GetReadoutList().Enable(
98                               AliHLTReadoutList::kITSSPD |
99                               AliHLTReadoutList::kITSSDD |
100                               AliHLTReadoutList::kITSSSD |
101                               AliHLTReadoutList::kTPC |
102                               AliHLTReadoutList::kTRD |
103                               AliHLTReadoutList::kTOF |
104                               AliHLTReadoutList::kHMPID |
105                               AliHLTReadoutList::kPHOS
106                               );
107       // Add the available HLT information for readout too.
108       GetTriggerDomain().Add("CLUSTERS", "TPC ");
109       TriggerEvent(true);
110       return 0;
111     }
112   }
113   description.Form("No tracks matching the tresholds found in the central barrel (min tracks %d, %s)",
114                    fMinTracks, ptcut.Data());
115   SetDescription(description.Data());
116   TriggerEvent(false);
117   return 0;
118 }