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 // The Trigger() method calls the GTU tracking simulation and //
22 // runs the triggers for HCO, HJT, HSE, HQU, HEE //
24 ///////////////////////////////////////////////////////////////////////////////
27 #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"
38 #include "AliTRDcalibDB.h"
39 #include "AliTRDCalDCSGTU.h"
41 AliTRDTriggerL1::AliTRDTriggerL1() :
51 fNoThresholdJetB(250),
54 fNoTrklThresholdElA(5),
55 fNoTrklThresholdElB(5),
64 AliTRDTriggerL1::~AliTRDTriggerL1()
69 void AliTRDTriggerL1::CreateInputs()
71 // create the trigger inputs for TRD
73 if (fInputs.GetEntriesFast() > 0)
76 fInputs.AddLast(new AliTriggerInput("1HCO", "TRD", 1));
77 fInputs.AddLast(new AliTriggerInput("1HJT", "TRD", 1));
78 fInputs.AddLast(new AliTriggerInput("1HSE", "TRD", 1));
79 fInputs.AddLast(new AliTriggerInput("1HQU", "TRD", 1));
80 fInputs.AddLast(new AliTriggerInput("1HEE", "TRD", 1));
83 void AliTRDTriggerL1::Trigger()
85 // run the trigger algorithms
87 AliRunLoader *runLoader = AliRunLoader::Instance();
90 AliLoader *trdLoader = runLoader->GetLoader("TRDLoader");
94 // now running the GTU tracking;
95 AliTRDgtuSim *gtusim = new AliTRDgtuSim();
96 gtusim->RunGTU(trdLoader, 0x0);
98 TTree *trackTree = trdLoader->GetDataLoader("gtutracks")->Tree();
100 AliDebug(1,"Did not find track tree");
103 TBranch *branch = trackTree->GetBranch("TRDtrackGTU");
104 AliDebug(1,Form("TRD trigger: found %lld tracks", trackTree->GetEntriesFast()));
106 // trigger algorithms to come, e.g.
107 Bool_t triggered1HCO = kFALSE;
108 Bool_t triggered1HJT = kFALSE;
109 Bool_t triggered1HSE = kFALSE;
110 Bool_t triggered1HQU = kFALSE;
111 Bool_t triggered1HEE = kFALSE;
114 AliTRDtrackGTU *trk = 0x0;
115 branch->SetAddress(&trk);
117 Int_t nTracks[90] = { 0 }; // number of tracks
118 Int_t nTracksA[90] = { 0 }; // number of tracks above pt threshold A
119 Int_t nTracksB[90] = { 0 }; // number of tracks above pt threshold B
120 Int_t nTracksElA[90] = { 0 }; // number of tracks above pt threshold A and PID threshold A
121 Int_t nTracksElB[90] = { 0 }; // number of tracks above pt threshold B and PID threshold B
123 for (Int_t iTrack = 0; iTrack < trackTree->GetEntriesFast(); iTrack++) {
124 trackTree->GetEntry(iTrack);
126 nTracks[5*trk->GetSector() + trk->GetStack()]++;
128 if (TMath::Abs(trk->GetPt()) > fPtThresholdA) {
129 nTracksA[5*trk->GetSector() + trk->GetStack()]++;
130 if ((trk->GetPID() > fPidThresholdA) &&
131 ((trk->GetTrackletMask() & fLayerMaskElA) == fLayerMaskElA) &&
132 (trk->GetNTracklets() >= fNoTrklThresholdElA))
133 nTracksElA[5*trk->GetSector() + trk->GetStack()]++;
136 if (TMath::Abs(trk->GetPt()) > fPtThresholdB) {
137 nTracksB[5*trk->GetSector() + trk->GetStack()]++;
138 if ((trk->GetPID() > fPidThresholdB) &&
139 ((trk->GetTrackletMask() & fLayerMaskElB) == fLayerMaskElB) &&
140 (trk->GetNTracklets() >= fNoTrklThresholdElB))
141 nTracksElB[5*trk->GetSector() + trk->GetStack()]++;
145 for (Int_t iStack = 0; iStack < 90; iStack++) {
146 if (nTracks[iStack] >= fNoThreshold)
147 triggered1HCO = kTRUE;
149 if ((nTracksA[iStack] >= fNoThresholdJetA) || (nTracksB[iStack] >= fNoThresholdJetB))
150 triggered1HJT = kTRUE;
152 if ((nTracksElA[iStack] >= fNoThresholdElA))
153 triggered1HSE = kTRUE;
155 if ((nTracksElB[iStack] >= fNoThresholdElB))
156 triggered1HQU = kTRUE;
160 AliWarning("GTU Branch not found");
164 AliDebug(1, "Fired cosmic trigger");
169 AliDebug(1, "Fired jet trigger");
174 AliDebug(1, "Fired single electron trigger");
179 AliDebug(1, "Fired single electron trigger");
184 AliDebug(1, "Fired single electron trigger");