]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDTriggerL1.cxx
Fix for FindRuleChecker, few pkgs, updated readme, added class level targets for...
[u/mrichter/AliRoot.git] / TRD / AliTRDTriggerL1.cxx
CommitLineData
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"
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
39AliTRDTriggerL1::AliTRDTriggerL1()
40{
41 SetName("TRD");
42}
43
44AliTRDTriggerL1::~AliTRDTriggerL1()
45{
46
47}
48
49void AliTRDTriggerL1::CreateInputs()
50{
36dc3337 51 // create the trigger inputs for TRD
52
e58e15dc 53 if (fInputs.GetEntriesFast() > 0)
54 return;
55
e43b478f 56 fInputs.AddLast(new AliTriggerInput("1HSH", "TRD", 1));
57 fInputs.AddLast(new AliTriggerInput("1HJT", "TRD", 1));
e58e15dc 58}
59
60void AliTRDTriggerL1::Trigger()
61{
36dc3337 62 // run the trigger algorithms
63
e58e15dc 64 AliRunLoader *runLoader = AliRunLoader::Instance();
65 if (!runLoader)
66 return;
67 AliLoader *trdLoader = runLoader->GetLoader("TRDLoader");
68 if (!trdLoader)
69 return;
70
71 // now running the GTU tracking;
72 AliTRDgtuSim *gtusim = new AliTRDgtuSim();
73 gtusim->RunGTU(trdLoader, 0x0);
74 gtusim->WriteTracksToLoader();
75
76 TTree *trackTree = trdLoader->GetDataLoader("gtutracks")->Tree();
77 if (!trackTree) {
78 AliDebug(1,"Did not find track tree");
79 return;
80 }
81 TBranch *branch = trackTree->GetBranch("TRDtrackGTU");
20a6e9c2 82 AliDebug(1,Form("TRD trigger: found %lld tracks", trackTree->GetEntriesFast()));
e58e15dc 83
84 // trigger thresholds should go elsewhere
85 Float_t ptThreshold1 = 2;
86 Float_t ptThreshold2 = 9.9;
87 Int_t trackThreshold1 = 6;
88 Int_t trackThreshold2 = 2;
89
90 // trigger algorithms to come, e.g.
36dc3337 91 Bool_t triggeredHighPt = kFALSE;
92 Bool_t triggeredJet = kFALSE;
e58e15dc 93
94 if (branch) {
95 AliTRDtrackGTU *trk = 0x0;
96 branch->SetAddress(&trk);
97
98 // high pt trigger
99 for (Int_t iTrack = 0; iTrack < trackTree->GetEntriesFast(); iTrack++) {
100 trackTree->GetEntry(iTrack);
101 if (TMath::Abs(trk->GetPt()) > 3.0) {
102 AliDebug(1, Form("Found track in sector %2i, stack %i with pt = %3.1f, triggered",
103 trk->GetSector(), trk->GetStack(), trk->GetPt()));
36dc3337 104 triggeredHighPt = kTRUE;
e58e15dc 105 }
106 }
107
108 // jet trigger
109 Int_t nTracks1[90]; // tracks above lower pt threshold
110 Int_t nTracks2[90]; // tracks above higher pt threshold
2f9bdd85 111 memset(nTracks1,0,sizeof(Int_t)*90);
112 memset(nTracks2,0,sizeof(Int_t)*90);
e58e15dc 113 for (Int_t iTrack = 0; iTrack < trackTree->GetEntriesFast(); iTrack++) {
114 trackTree->GetEntry(iTrack);
115 if (TMath::Abs(trk->GetPt()) > ptThreshold1)
116 nTracks1[5*trk->GetSector() + trk->GetStack()]++;
117 if (TMath::Abs(trk->GetPt()) > ptThreshold2)
118 nTracks2[5*trk->GetSector() + trk->GetStack()]++;
119 }
120 for (Int_t iStack = 0; iStack < 90; iStack++) {
121 if ((nTracks1[iStack] >= trackThreshold1) || (nTracks2[iStack] >= trackThreshold2))
36dc3337 122 triggeredJet = kTRUE;
e58e15dc 123 }
124 }
125 else {
126 AliWarning("GTU Branch not found");
127 }
128
36dc3337 129 if (triggeredHighPt) {
e58e15dc 130 AliInfo("Fired high-pt trigger");
e43b478f 131 SetInput("1HSH");
e58e15dc 132 }
133
36dc3337 134 if (triggeredJet) {
e58e15dc 135 AliInfo("Fired jet trigger");
e43b478f 136 SetInput("1HJT");
e58e15dc 137 }
138
139 // cleaning up
140 delete gtusim;
141}