]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - TRD/AliTRDTriggerL1.cxx
Adding using std::...
[u/mrichter/AliRoot.git] / TRD / AliTRDTriggerL1.cxx
... / ...
CommitLineData
1/**************************************************************************
2 * Copyright(c) 1998-1999, 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/* $Id: AliTRDTriggerL1.cxx 31904 2009-04-08 16:42:03Z cblume $ */
17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// TRD trigger L1 (GTU) simulation steering //
21// The Trigger() method calls the GTU tracking simulation and //
22// runs the triggers for HCO, HJT, HSE, HQU, HEE //
23// //
24///////////////////////////////////////////////////////////////////////////////
25
26
27#include "TObjArray.h"
28#include <TTree.h>
29
30#include "AliLog.h"
31#include "AliTriggerInput.h"
32#include "AliRunLoader.h"
33#include "AliLoader.h"
34
35#include "AliTRDTriggerL1.h"
36#include "AliTRDgtuSim.h"
37#include "AliTRDtrackGTU.h"
38#include "AliTRDcalibDB.h"
39#include "AliTRDCalDCSGTU.h"
40
41AliTRDTriggerL1::AliTRDTriggerL1() :
42 AliTriggerDetector(),
43 fPtThresholdA(3.),
44 fPtThresholdB(2.),
45 fPidThresholdA(144),
46 fPidThresholdB(164),
47 fNoThreshold(1),
48 fNoThresholdA(1),
49 fNoThresholdB(1),
50 fNoThresholdJetA(3),
51 fNoThresholdJetB(250),
52 fNoThresholdElA(1),
53 fNoThresholdElB(1),
54 fNoTrklThresholdElA(5),
55 fNoTrklThresholdElB(5),
56 fLayerMaskElA(0x1),
57 fLayerMaskElB(0x1)
58{
59 // ctor
60
61 SetName("TRD");
62}
63
64AliTRDTriggerL1::~AliTRDTriggerL1()
65{
66 // dtor
67}
68
69void AliTRDTriggerL1::CreateInputs()
70{
71 // create the trigger inputs for TRD
72
73 if (fInputs.GetEntriesFast() > 0)
74 return;
75
76 fInputs.AddLast(new AliTriggerInput("1HCO", "TRD", 1));
77 fInputs.AddLast(new AliTriggerInput("1HJT", "TRD", 1));
78 fInputs.AddLast(new AliTriggerInput("1HSE", "TRD", 1));
79 fInputs.AddLast(new AliTriggerInput("1HQU", "TRD", 1));
80 fInputs.AddLast(new AliTriggerInput("1HEE", "TRD", 1));
81}
82
83void AliTRDTriggerL1::Trigger()
84{
85 // run the trigger algorithms
86
87 AliRunLoader *runLoader = AliRunLoader::Instance();
88 if (!runLoader)
89 return;
90 AliLoader *trdLoader = runLoader->GetLoader("TRDLoader");
91 if (!trdLoader)
92 return;
93
94 // now running the GTU tracking;
95 AliTRDgtuSim *gtusim = new AliTRDgtuSim();
96 gtusim->RunGTU(trdLoader, 0x0);
97
98 TTree *trackTree = trdLoader->GetDataLoader("gtutracks")->Tree();
99 if (!trackTree) {
100 AliDebug(1,"Did not find track tree");
101 return;
102 }
103 TBranch *branch = trackTree->GetBranch("TRDtrackGTU");
104 AliDebug(1,Form("TRD trigger: found %lld tracks", trackTree->GetEntriesFast()));
105
106 // trigger algorithms to come, e.g.
107 Bool_t triggered1HCO = kFALSE;
108 Bool_t triggered1HJT = kFALSE;
109 Bool_t triggered1HSE = kFALSE;
110 Bool_t triggered1HQU = kFALSE;
111 Bool_t triggered1HEE = kFALSE;
112
113 if (branch) {
114 AliTRDtrackGTU *trk = 0x0;
115 branch->SetAddress(&trk);
116
117 Int_t nTracks[90] = { 0 }; // number of tracks
118 Int_t nTracksA[90] = { 0 }; // number of tracks above pt threshold A
119 Int_t nTracksB[90] = { 0 }; // number of tracks above pt threshold B
120 Int_t nTracksElA[90] = { 0 }; // number of tracks above pt threshold A and PID threshold A
121 Int_t nTracksElB[90] = { 0 }; // number of tracks above pt threshold B and PID threshold B
122
123 for (Int_t iTrack = 0; iTrack < trackTree->GetEntriesFast(); iTrack++) {
124 trackTree->GetEntry(iTrack);
125
126 nTracks[5*trk->GetSector() + trk->GetStack()]++;
127
128 if (TMath::Abs(trk->GetPt()) > fPtThresholdA) {
129 nTracksA[5*trk->GetSector() + trk->GetStack()]++;
130 if ((trk->GetPID() > fPidThresholdA) &&
131 ((trk->GetTrackletMask() & fLayerMaskElA) == fLayerMaskElA) &&
132 (trk->GetNTracklets() >= fNoTrklThresholdElA))
133 nTracksElA[5*trk->GetSector() + trk->GetStack()]++;
134 }
135
136 if (TMath::Abs(trk->GetPt()) > fPtThresholdB) {
137 nTracksB[5*trk->GetSector() + trk->GetStack()]++;
138 if ((trk->GetPID() > fPidThresholdB) &&
139 ((trk->GetTrackletMask() & fLayerMaskElB) == fLayerMaskElB) &&
140 (trk->GetNTracklets() >= fNoTrklThresholdElB))
141 nTracksElB[5*trk->GetSector() + trk->GetStack()]++;
142 }
143 }
144
145 for (Int_t iStack = 0; iStack < 90; iStack++) {
146 if (nTracks[iStack] >= fNoThreshold)
147 triggered1HCO = kTRUE;
148
149 if ((nTracksA[iStack] >= fNoThresholdJetA) || (nTracksB[iStack] >= fNoThresholdJetB))
150 triggered1HJT = kTRUE;
151
152 if ((nTracksElA[iStack] >= fNoThresholdElA))
153 triggered1HSE = kTRUE;
154
155 if ((nTracksElB[iStack] >= fNoThresholdElB))
156 triggered1HQU = kTRUE;
157 }
158 }
159 else {
160 AliWarning("GTU Branch not found");
161 }
162
163 if (triggered1HCO) {
164 AliDebug(1, "Fired cosmic trigger");
165 SetInput("1HCO");
166 }
167
168 if (triggered1HJT) {
169 AliDebug(1, "Fired jet trigger");
170 SetInput("1HJT");
171 }
172
173 if (triggered1HSE) {
174 AliDebug(1, "Fired single electron trigger");
175 SetInput("1HSE");
176 }
177
178 if (triggered1HQU) {
179 AliDebug(1, "Fired single electron trigger");
180 SetInput("1HQU");
181 }
182
183 if (triggered1HEE) {
184 AliDebug(1, "Fired single electron trigger");
185 SetInput("1HEE");
186 }
187
188 // cleaning up
189 delete gtusim;
190}