]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ANALYSIS/AliTRDTriggerAnalysis.cxx
-solve coverity defect
[u/mrichter/AliRoot.git] / ANALYSIS / AliTRDTriggerAnalysis.cxx
CommitLineData
99d87d49 1/**************************************************************************
2 * Copyright(c) 2013, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16// evaluate TRD trigger conditions,
17// potentially with hardened conditions to remove
18// triggers caused by conversions of low-pt photons
19// at large radii
20//
21// Author: Jochen Klein <jochen.klein@cern.ch>
22
23#include "AliLog.h"
24#include "AliVTrack.h"
d384e2d6 25#include "AliVEvent.h"
26#include "AliVTrdTrack.h"
99d87d49 27
28#include "AliTRDTriggerAnalysis.h"
29
30AliTRDTriggerAnalysis::AliTRDTriggerAnalysis() :
31 TObject(),
32 fTriggerFlags(0),
33 fTriggerInputs(0),
34 fTriggerClasses(0),
35 fRequireMatch(kFALSE),
36 fRequireMatchElectron(kTRUE),
37 fRequireInTime(kFALSE),
38 fTRDptHSE(3.),
39 fTRDpidHSE(144),
40 fTRDptHQU(2.),
41 fTRDpidHQU(164),
42 fTRDptHEE(3.),
43 fTRDpidHEE(144),
44 fTRDminSectorHEE(6),
45 fTRDmaxSectorHEE(8),
46 fTRDptHJT(3.),
47 fTRDnHJT(3)
48{
49 // ctor
50}
51
52AliTRDTriggerAnalysis::~AliTRDTriggerAnalysis()
53{
54 // dtor
55}
56
d384e2d6 57Bool_t AliTRDTriggerAnalysis::CalcTriggers(const AliVEvent *event)
99d87d49 58{
59 // evaluate the TRD trigger conditions,
60 // so far HCO, HSE, HQU, HJT, HEE
61
62 ResetTriggers();
63
d384e2d6 64 if (!event) {
65 AliErrorClass("event pointer is null");
99d87d49 66 return kFALSE;
67 }
68
d384e2d6 69 TString trgClasses = event->GetFiredTriggerClasses();
70 // UInt_t trgInputs = event->GetHeader()->GetL1TriggerInputs();
99d87d49 71
72 Int_t nTracks[90] = { 0 }; // stack-wise counted number of tracks above pt threshold
73
d384e2d6 74 Int_t nTrdTracks = event->GetNumberOfTrdTracks();
99d87d49 75
76 if (nTrdTracks > 0)
77 Fire(kHCO);
78
79 for (Int_t iTrack = 0; iTrack < nTrdTracks; ++iTrack) {
d384e2d6 80 AliVTrdTrack *trdTrack = event->GetTrdTrack(iTrack);
99d87d49 81 if (!trdTrack)
82 continue;
83
84 // ignore the track if it was not in time
85 // (if required)
86 if (fRequireInTime && !trdTrack->GetTrackInTime())
87 continue;
88
89 AliVTrack *match = trdTrack->GetTrackMatch();
90 AliDebug(2, Form("GTU track %2i with pt = %5.2f has match: %p (pt = %5.2f)",
91 iTrack, trdTrack->Pt(), match, match ? match->Pt() : 0));
92
93 // ignore the track if it does not have a matched global track
94 // (if required)
95 if (fRequireMatch && !match)
96 continue;
97
98 Int_t globalStack = 5*trdTrack->GetSector() + trdTrack->GetStack();
99
100 // stack-wise counting of tracks above pt threshold for jet trigger
101 if (TMath::Abs(trdTrack->GetPt()) >= fTRDptHJT) {
102 ++nTracks[globalStack];
103 }
104
105 // ignore the track for the electron triggers
106 // if it does not have a matched global track
107 // (if required)
108 if (fRequireMatchElectron && !match)
109 continue;
110
111 if ((TMath::Abs(trdTrack->Pt()) > fTRDptHQU) && (trdTrack->GetPID() > fTRDpidHQU))
112 Fire(kHQU);
113
114 if ((TMath::Abs(trdTrack->Pt()) > fTRDptHSE) && (trdTrack->GetPID() > fTRDpidHSE))
115 Fire(kHSE);
116
117 if ((trdTrack->GetSector() >= fTRDminSectorHEE) && (trdTrack->GetSector() <= fTRDmaxSectorHEE) &&
118 (TMath::Abs(trdTrack->Pt()) > fTRDptHSE) && (trdTrack->GetPID() > fTRDpidHSE))
119 Fire(kHEE);
120 }
121
122 // check if HJT condition is fulfilled in any stack
123 for (Int_t iStack = 0; iStack < 90; ++iStack) {
124 if (nTracks[iStack] >= fTRDnHJT) {
125 Fire(kHJT);
126 break;
127 }
128 }
129
130 return kTRUE;
131}