1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /* $Id: AliTRDTriggerL1.cxx 31904 2009-04-08 16:42:03Z cblume $ */
18 ///////////////////////////////////////////////////////////////////////////////
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 //
25 ///////////////////////////////////////////////////////////////////////////////
28 #include "TObjArray.h"
31 #include "AliTriggerInput.h"
32 #include "AliRunLoader.h"
33 #include "AliLoader.h"
35 #include "AliTRDTriggerL1.h"
36 #include "AliTRDgtuSim.h"
37 #include "AliTRDtrackGTU.h"
39 AliTRDTriggerL1::AliTRDTriggerL1()
44 AliTRDTriggerL1::~AliTRDTriggerL1()
49 void AliTRDTriggerL1::CreateInputs()
51 // create the trigger inputs for TRD
53 if (fInputs.GetEntriesFast() > 0)
56 fInputs.AddLast(new AliTriggerInput("1HSH", "TRD", 1));
57 fInputs.AddLast(new AliTriggerInput("1HJT", "TRD", 1));
60 void AliTRDTriggerL1::Trigger()
62 // run the trigger algorithms
64 AliRunLoader *runLoader = AliRunLoader::Instance();
67 AliLoader *trdLoader = runLoader->GetLoader("TRDLoader");
71 // now running the GTU tracking;
72 AliTRDgtuSim *gtusim = new AliTRDgtuSim();
73 gtusim->RunGTU(trdLoader, 0x0);
74 gtusim->WriteTracksToLoader();
76 TTree *trackTree = trdLoader->GetDataLoader("gtutracks")->Tree();
78 AliDebug(1,"Did not find track tree");
81 TBranch *branch = trackTree->GetBranch("TRDtrackGTU");
82 AliDebug(1,Form("TRD trigger: found %i tracks", trackTree->GetEntriesFast()));
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;
90 // trigger algorithms to come, e.g.
91 Bool_t triggeredHighPt = kFALSE;
92 Bool_t triggeredJet = kFALSE;
95 AliTRDtrackGTU *trk = 0x0;
96 branch->SetAddress(&trk);
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()));
104 triggeredHighPt = kTRUE;
109 Int_t nTracks1[90]; // tracks above lower pt threshold
110 Int_t nTracks2[90]; // tracks above higher pt threshold
111 for (Int_t iTrack = 0; iTrack < trackTree->GetEntriesFast(); iTrack++) {
112 trackTree->GetEntry(iTrack);
113 if (TMath::Abs(trk->GetPt()) > ptThreshold1)
114 nTracks1[5*trk->GetSector() + trk->GetStack()]++;
115 if (TMath::Abs(trk->GetPt()) > ptThreshold2)
116 nTracks2[5*trk->GetSector() + trk->GetStack()]++;
118 for (Int_t iStack = 0; iStack < 90; iStack++) {
119 if ((nTracks1[iStack] >= trackThreshold1) || (nTracks2[iStack] >= trackThreshold2))
120 triggeredJet = kTRUE;
124 AliWarning("GTU Branch not found");
127 if (triggeredHighPt) {
128 AliInfo("Fired high-pt trigger");
133 AliInfo("Fired jet trigger");