]>
Commit | Line | Data |
---|---|---|
e58e15dc | 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 // | |
89fb1696 | 21 | // The Trigger() method calls the GTU tracking simulation and // |
22 | // runs the triggers for HCO, HJT, HSE, HQU, HEE // | |
e58e15dc | 23 | // // |
24 | /////////////////////////////////////////////////////////////////////////////// | |
25 | ||
26 | ||
27 | #include "TObjArray.h" | |
c93255fe | 28 | #include <TTree.h> |
e58e15dc | 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" | |
b5d16822 | 38 | #include "AliTRDcalibDB.h" |
39 | #include "AliTRDCalDCSGTU.h" | |
40 | ||
41 | AliTRDTriggerL1::AliTRDTriggerL1() : | |
42 | AliTriggerDetector(), | |
43 | fPtThresholdA(3.), | |
89fb1696 | 44 | fPtThresholdB(2.), |
45 | fPidThresholdA(144), | |
46 | fPidThresholdB(164), | |
b5d16822 | 47 | fNoThreshold(1), |
89fb1696 | 48 | fNoThresholdA(1), |
49 | fNoThresholdB(1), | |
b5d16822 | 50 | fNoThresholdJetA(3), |
89fb1696 | 51 | fNoThresholdJetB(250), |
b5d16822 | 52 | fNoThresholdElA(1), |
89fb1696 | 53 | fNoThresholdElB(1), |
54 | fNoTrklThresholdElA(5), | |
55 | fNoTrklThresholdElB(5), | |
56 | fLayerMaskElA(0x1), | |
57 | fLayerMaskElB(0x1) | |
e58e15dc | 58 | { |
b5d16822 | 59 | // ctor |
60 | ||
e58e15dc | 61 | SetName("TRD"); |
62 | } | |
63 | ||
64 | AliTRDTriggerL1::~AliTRDTriggerL1() | |
65 | { | |
b5d16822 | 66 | // dtor |
e58e15dc | 67 | } |
68 | ||
69 | void AliTRDTriggerL1::CreateInputs() | |
70 | { | |
36dc3337 | 71 | // create the trigger inputs for TRD |
72 | ||
e58e15dc | 73 | if (fInputs.GetEntriesFast() > 0) |
74 | return; | |
75 | ||
b5d16822 | 76 | fInputs.AddLast(new AliTriggerInput("1HCO", "TRD", 1)); |
e43b478f | 77 | fInputs.AddLast(new AliTriggerInput("1HJT", "TRD", 1)); |
b5d16822 | 78 | fInputs.AddLast(new AliTriggerInput("1HSE", "TRD", 1)); |
89fb1696 | 79 | fInputs.AddLast(new AliTriggerInput("1HQU", "TRD", 1)); |
80 | fInputs.AddLast(new AliTriggerInput("1HEE", "TRD", 1)); | |
e58e15dc | 81 | } |
82 | ||
83 | void AliTRDTriggerL1::Trigger() | |
84 | { | |
36dc3337 | 85 | // run the trigger algorithms |
86 | ||
e58e15dc | 87 | AliRunLoader *runLoader = AliRunLoader::Instance(); |
88 | if (!runLoader) | |
89 | return; | |
90 | AliLoader *trdLoader = runLoader->GetLoader("TRDLoader"); | |
91 | if (!trdLoader) | |
92 | return; | |
5f006bd7 | 93 | |
e58e15dc | 94 | // now running the GTU tracking; |
95 | AliTRDgtuSim *gtusim = new AliTRDgtuSim(); | |
96 | gtusim->RunGTU(trdLoader, 0x0); | |
5f006bd7 | 97 | |
e58e15dc | 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"); | |
20a6e9c2 | 104 | AliDebug(1,Form("TRD trigger: found %lld tracks", trackTree->GetEntriesFast())); |
5f006bd7 | 105 | |
e58e15dc | 106 | // trigger algorithms to come, e.g. |
b5d16822 | 107 | Bool_t triggered1HCO = kFALSE; |
108 | Bool_t triggered1HJT = kFALSE; | |
109 | Bool_t triggered1HSE = kFALSE; | |
89fb1696 | 110 | Bool_t triggered1HQU = kFALSE; |
111 | Bool_t triggered1HEE = kFALSE; | |
5f006bd7 | 112 | |
e58e15dc | 113 | if (branch) { |
114 | AliTRDtrackGTU *trk = 0x0; | |
115 | branch->SetAddress(&trk); | |
116 | ||
b5d16822 | 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 | ||
e58e15dc | 123 | for (Int_t iTrack = 0; iTrack < trackTree->GetEntriesFast(); iTrack++) { |
124 | trackTree->GetEntry(iTrack); | |
b5d16822 | 125 | |
126 | nTracks[5*trk->GetSector() + trk->GetStack()]++; | |
127 | ||
128 | if (TMath::Abs(trk->GetPt()) > fPtThresholdA) { | |
129 | nTracksA[5*trk->GetSector() + trk->GetStack()]++; | |
89fb1696 | 130 | if ((trk->GetPID() > fPidThresholdA) && |
131 | ((trk->GetTrackletMask() & fLayerMaskElA) == fLayerMaskElA) && | |
132 | (trk->GetNTracklets() >= fNoTrklThresholdElA)) | |
b5d16822 | 133 | nTracksElA[5*trk->GetSector() + trk->GetStack()]++; |
e58e15dc | 134 | } |
e58e15dc | 135 | |
b5d16822 | 136 | if (TMath::Abs(trk->GetPt()) > fPtThresholdB) { |
137 | nTracksB[5*trk->GetSector() + trk->GetStack()]++; | |
89fb1696 | 138 | if ((trk->GetPID() > fPidThresholdB) && |
139 | ((trk->GetTrackletMask() & fLayerMaskElB) == fLayerMaskElB) && | |
140 | (trk->GetNTracklets() >= fNoTrklThresholdElB)) | |
b5d16822 | 141 | nTracksElB[5*trk->GetSector() + trk->GetStack()]++; |
142 | } | |
e58e15dc | 143 | } |
b5d16822 | 144 | |
e58e15dc | 145 | for (Int_t iStack = 0; iStack < 90; iStack++) { |
89fb1696 | 146 | if (nTracks[iStack] >= fNoThreshold) |
147 | triggered1HCO = kTRUE; | |
148 | ||
b5d16822 | 149 | if ((nTracksA[iStack] >= fNoThresholdJetA) || (nTracksB[iStack] >= fNoThresholdJetB)) |
150 | triggered1HJT = kTRUE; | |
151 | ||
152 | if ((nTracksElA[iStack] >= fNoThresholdElA)) | |
89fb1696 | 153 | triggered1HSE = kTRUE; |
b5d16822 | 154 | |
155 | if ((nTracksElB[iStack] >= fNoThresholdElB)) | |
89fb1696 | 156 | triggered1HQU = kTRUE; |
e58e15dc | 157 | } |
158 | } | |
159 | else { | |
160 | AliWarning("GTU Branch not found"); | |
161 | } | |
162 | ||
b5d16822 | 163 | if (triggered1HCO) { |
164 | AliDebug(1, "Fired cosmic trigger"); | |
165 | SetInput("1HCO"); | |
e58e15dc | 166 | } |
167 | ||
b5d16822 | 168 | if (triggered1HJT) { |
169 | AliDebug(1, "Fired jet trigger"); | |
e43b478f | 170 | SetInput("1HJT"); |
e58e15dc | 171 | } |
172 | ||
b5d16822 | 173 | if (triggered1HSE) { |
174 | AliDebug(1, "Fired single electron trigger"); | |
175 | SetInput("1HSE"); | |
176 | } | |
177 | ||
89fb1696 | 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 | ||
e58e15dc | 188 | // cleaning up |
189 | delete gtusim; | |
190 | } |