]>
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 // | |
21 | // currently the Trigger() method calls the GTU tracking simulation and // | |
22 | // runs two example triggers, namely on a single high pt particle and // | |
23 | // on a jet. // | |
24 | // // | |
25 | /////////////////////////////////////////////////////////////////////////////// | |
26 | ||
27 | ||
28 | #include "TObjArray.h" | |
c93255fe | 29 | #include <TTree.h> |
e58e15dc | 30 | |
31 | #include "AliLog.h" | |
32 | #include "AliTriggerInput.h" | |
33 | #include "AliRunLoader.h" | |
34 | #include "AliLoader.h" | |
35 | ||
36 | #include "AliTRDTriggerL1.h" | |
37 | #include "AliTRDgtuSim.h" | |
38 | #include "AliTRDtrackGTU.h" | |
b5d16822 | 39 | #include "AliTRDcalibDB.h" |
40 | #include "AliTRDCalDCSGTU.h" | |
41 | ||
42 | AliTRDTriggerL1::AliTRDTriggerL1() : | |
43 | AliTriggerDetector(), | |
44 | fPtThresholdA(3.), | |
45 | fPtThresholdB(5.), | |
46 | fPidThresholdA(0), | |
47 | fPidThresholdB(185), | |
48 | fNoThreshold(1), | |
49 | fNoThresholdA(3), | |
50 | fNoThresholdB(200), | |
51 | fNoThresholdJetA(3), | |
52 | fNoThresholdJetB(200), | |
53 | fNoThresholdElA(1), | |
54 | fNoThresholdElB(1) | |
e58e15dc | 55 | { |
b5d16822 | 56 | // ctor |
57 | ||
e58e15dc | 58 | SetName("TRD"); |
59 | } | |
60 | ||
61 | AliTRDTriggerL1::~AliTRDTriggerL1() | |
62 | { | |
b5d16822 | 63 | // dtor |
e58e15dc | 64 | } |
65 | ||
66 | void AliTRDTriggerL1::CreateInputs() | |
67 | { | |
36dc3337 | 68 | // create the trigger inputs for TRD |
69 | ||
e58e15dc | 70 | if (fInputs.GetEntriesFast() > 0) |
71 | return; | |
72 | ||
b5d16822 | 73 | fInputs.AddLast(new AliTriggerInput("1HCO", "TRD", 1)); |
e43b478f | 74 | fInputs.AddLast(new AliTriggerInput("1HJT", "TRD", 1)); |
b5d16822 | 75 | fInputs.AddLast(new AliTriggerInput("1HSE", "TRD", 1)); |
e58e15dc | 76 | } |
77 | ||
78 | void AliTRDTriggerL1::Trigger() | |
79 | { | |
36dc3337 | 80 | // run the trigger algorithms |
81 | ||
e58e15dc | 82 | AliRunLoader *runLoader = AliRunLoader::Instance(); |
83 | if (!runLoader) | |
84 | return; | |
85 | AliLoader *trdLoader = runLoader->GetLoader("TRDLoader"); | |
86 | if (!trdLoader) | |
87 | return; | |
5f006bd7 | 88 | |
e58e15dc | 89 | // now running the GTU tracking; |
90 | AliTRDgtuSim *gtusim = new AliTRDgtuSim(); | |
91 | gtusim->RunGTU(trdLoader, 0x0); | |
5f006bd7 | 92 | |
e58e15dc | 93 | TTree *trackTree = trdLoader->GetDataLoader("gtutracks")->Tree(); |
94 | if (!trackTree) { | |
95 | AliDebug(1,"Did not find track tree"); | |
96 | return; | |
97 | } | |
98 | TBranch *branch = trackTree->GetBranch("TRDtrackGTU"); | |
20a6e9c2 | 99 | AliDebug(1,Form("TRD trigger: found %lld tracks", trackTree->GetEntriesFast())); |
5f006bd7 | 100 | |
e58e15dc | 101 | // trigger algorithms to come, e.g. |
b5d16822 | 102 | Bool_t triggered1HCO = kFALSE; |
103 | Bool_t triggered1HJT = kFALSE; | |
104 | Bool_t triggered1HSE = kFALSE; | |
5f006bd7 | 105 | |
e58e15dc | 106 | if (branch) { |
107 | AliTRDtrackGTU *trk = 0x0; | |
108 | branch->SetAddress(&trk); | |
109 | ||
b5d16822 | 110 | Int_t nTracks[90] = { 0 }; // number of tracks |
111 | Int_t nTracksA[90] = { 0 }; // number of tracks above pt threshold A | |
112 | Int_t nTracksB[90] = { 0 }; // number of tracks above pt threshold B | |
113 | Int_t nTracksElA[90] = { 0 }; // number of tracks above pt threshold A and PID threshold A | |
114 | Int_t nTracksElB[90] = { 0 }; // number of tracks above pt threshold B and PID threshold B | |
115 | ||
e58e15dc | 116 | for (Int_t iTrack = 0; iTrack < trackTree->GetEntriesFast(); iTrack++) { |
117 | trackTree->GetEntry(iTrack); | |
b5d16822 | 118 | |
119 | nTracks[5*trk->GetSector() + trk->GetStack()]++; | |
120 | ||
121 | if (TMath::Abs(trk->GetPt()) > fPtThresholdA) { | |
122 | nTracksA[5*trk->GetSector() + trk->GetStack()]++; | |
123 | if (trk->GetPID() > fPidThresholdA) | |
124 | nTracksElA[5*trk->GetSector() + trk->GetStack()]++; | |
e58e15dc | 125 | } |
e58e15dc | 126 | |
b5d16822 | 127 | if (TMath::Abs(trk->GetPt()) > fPtThresholdB) { |
128 | nTracksB[5*trk->GetSector() + trk->GetStack()]++; | |
129 | if (trk->GetPID() > fPidThresholdB) | |
130 | nTracksElB[5*trk->GetSector() + trk->GetStack()]++; | |
131 | } | |
e58e15dc | 132 | } |
b5d16822 | 133 | |
e58e15dc | 134 | for (Int_t iStack = 0; iStack < 90; iStack++) { |
b5d16822 | 135 | if ((nTracksA[iStack] >= fNoThresholdJetA) || (nTracksB[iStack] >= fNoThresholdJetB)) |
136 | triggered1HJT = kTRUE; | |
137 | ||
138 | if ((nTracksElA[iStack] >= fNoThresholdElA)) | |
139 | triggered1HCO = kTRUE; | |
140 | ||
141 | if ((nTracksElB[iStack] >= fNoThresholdElB)) | |
142 | triggered1HSE = kTRUE; | |
e58e15dc | 143 | } |
144 | } | |
145 | else { | |
146 | AliWarning("GTU Branch not found"); | |
147 | } | |
148 | ||
b5d16822 | 149 | if (triggered1HCO) { |
150 | AliDebug(1, "Fired cosmic trigger"); | |
151 | SetInput("1HCO"); | |
e58e15dc | 152 | } |
153 | ||
b5d16822 | 154 | if (triggered1HJT) { |
155 | AliDebug(1, "Fired jet trigger"); | |
e43b478f | 156 | SetInput("1HJT"); |
e58e15dc | 157 | } |
158 | ||
b5d16822 | 159 | if (triggered1HSE) { |
160 | AliDebug(1, "Fired single electron trigger"); | |
161 | SetInput("1HSE"); | |
162 | } | |
163 | ||
e58e15dc | 164 | // cleaning up |
165 | delete gtusim; | |
166 | } |