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"
32 #include "AliTriggerInput.h"
33 #include "AliRunLoader.h"
34 #include "AliLoader.h"
36 #include "AliTRDTriggerL1.h"
37 #include "AliTRDgtuSim.h"
38 #include "AliTRDtrackGTU.h"
39 #include "AliTRDcalibDB.h"
40 #include "AliTRDCalDCSGTU.h"
42 AliTRDTriggerL1::AliTRDTriggerL1() :
52 fNoThresholdJetB(200),
61 AliTRDTriggerL1::~AliTRDTriggerL1()
66 void AliTRDTriggerL1::CreateInputs()
68 // create the trigger inputs for TRD
70 if (fInputs.GetEntriesFast() > 0)
73 fInputs.AddLast(new AliTriggerInput("1HCO", "TRD", 1));
74 fInputs.AddLast(new AliTriggerInput("1HJT", "TRD", 1));
75 fInputs.AddLast(new AliTriggerInput("1HSE", "TRD", 1));
78 void AliTRDTriggerL1::Trigger()
80 // run the trigger algorithms
82 AliRunLoader *runLoader = AliRunLoader::Instance();
85 AliLoader *trdLoader = runLoader->GetLoader("TRDLoader");
89 // now running the GTU tracking;
90 AliTRDgtuSim *gtusim = new AliTRDgtuSim();
91 gtusim->RunGTU(trdLoader, 0x0);
93 TTree *trackTree = trdLoader->GetDataLoader("gtutracks")->Tree();
95 AliDebug(1,"Did not find track tree");
98 TBranch *branch = trackTree->GetBranch("TRDtrackGTU");
99 AliDebug(1,Form("TRD trigger: found %lld tracks", trackTree->GetEntriesFast()));
101 // trigger algorithms to come, e.g.
102 Bool_t triggered1HCO = kFALSE;
103 Bool_t triggered1HJT = kFALSE;
104 Bool_t triggered1HSE = kFALSE;
107 AliTRDtrackGTU *trk = 0x0;
108 branch->SetAddress(&trk);
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
116 for (Int_t iTrack = 0; iTrack < trackTree->GetEntriesFast(); iTrack++) {
117 trackTree->GetEntry(iTrack);
119 nTracks[5*trk->GetSector() + trk->GetStack()]++;
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()]++;
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()]++;
134 for (Int_t iStack = 0; iStack < 90; iStack++) {
135 if ((nTracksA[iStack] >= fNoThresholdJetA) || (nTracksB[iStack] >= fNoThresholdJetB))
136 triggered1HJT = kTRUE;
138 if ((nTracksElA[iStack] >= fNoThresholdElA))
139 triggered1HCO = kTRUE;
141 if ((nTracksElB[iStack] >= fNoThresholdElB))
142 triggered1HSE = kTRUE;
146 AliWarning("GTU Branch not found");
150 AliDebug(1, "Fired cosmic trigger");
155 AliDebug(1, "Fired jet trigger");
160 AliDebug(1, "Fired single electron trigger");