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 if (fInputs.GetEntriesFast() > 0)
54 fInputs.AddLast(new AliTriggerInput("TRD_HIGHPT_L1", "TRD", 1));
55 fInputs.AddLast(new AliTriggerInput("TRD_JET_L1", "TRD", 1));
58 void AliTRDTriggerL1::Trigger()
60 AliRunLoader *runLoader = AliRunLoader::Instance();
63 AliLoader *trdLoader = runLoader->GetLoader("TRDLoader");
67 // now running the GTU tracking;
68 AliTRDgtuSim *gtusim = new AliTRDgtuSim();
69 gtusim->RunGTU(trdLoader, 0x0);
70 gtusim->WriteTracksToLoader();
72 TTree *trackTree = trdLoader->GetDataLoader("gtutracks")->Tree();
74 AliDebug(1,"Did not find track tree");
77 TBranch *branch = trackTree->GetBranch("TRDtrackGTU");
78 AliDebug(1,Form("TRD trigger: found %i tracks", trackTree->GetEntriesFast()));
80 // trigger thresholds should go elsewhere
81 Float_t ptThreshold1 = 2;
82 Float_t ptThreshold2 = 9.9;
83 Int_t trackThreshold1 = 6;
84 Int_t trackThreshold2 = 2;
86 // trigger algorithms to come, e.g.
87 Bool_t triggered_highpt = kFALSE;
88 Bool_t triggered_jet = kFALSE;
91 AliTRDtrackGTU *trk = 0x0;
92 branch->SetAddress(&trk);
95 for (Int_t iTrack = 0; iTrack < trackTree->GetEntriesFast(); iTrack++) {
96 trackTree->GetEntry(iTrack);
97 if (TMath::Abs(trk->GetPt()) > 3.0) {
98 AliDebug(1, Form("Found track in sector %2i, stack %i with pt = %3.1f, triggered",
99 trk->GetSector(), trk->GetStack(), trk->GetPt()));
100 triggered_highpt = kTRUE;
105 Int_t nTracks1[90]; // tracks above lower pt threshold
106 Int_t nTracks2[90]; // tracks above higher pt threshold
107 for (Int_t iTrack = 0; iTrack < trackTree->GetEntriesFast(); iTrack++) {
108 trackTree->GetEntry(iTrack);
109 if (TMath::Abs(trk->GetPt()) > ptThreshold1)
110 nTracks1[5*trk->GetSector() + trk->GetStack()]++;
111 if (TMath::Abs(trk->GetPt()) > ptThreshold2)
112 nTracks2[5*trk->GetSector() + trk->GetStack()]++;
114 for (Int_t iStack = 0; iStack < 90; iStack++) {
115 if ((nTracks1[iStack] >= trackThreshold1) || (nTracks2[iStack] >= trackThreshold2))
116 triggered_jet = kTRUE;
120 AliWarning("GTU Branch not found");
123 if (triggered_highpt) {
124 AliInfo("Fired high-pt trigger");
125 SetInput("TRD_HIGHPT_L1");
129 AliInfo("Fired jet trigger");
130 SetInput("TRD_JET_L1");