]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDTriggerL0.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / TRD / AliTRDTriggerL0.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: AliTRDTriggerL0.cxx 31904 2009-04-08 16:42:03Z cblume $ */
17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// TRD trigger L0 (pretrigger) simulation //
21// So far no real trigger decision is done. //
22// //
23///////////////////////////////////////////////////////////////////////////////
24
25#include "TObjArray.h"
26
27#include "AliLog.h"
28#include "AliTriggerInput.h"
29#include "AliRunLoader.h"
30#include "AliLoader.h"
31
f9720615 32#include "AliTRDptrgParam.h"
33#include "AliTRDptrgCBB.h"
34
e58e15dc 35#include "AliTRDTriggerL0.h"
e58e15dc 36
37AliTRDTriggerL0::AliTRDTriggerL0()
38{
6419bebb 39 // constructor
40
e58e15dc 41 SetName("TRD");
42}
43
44AliTRDTriggerL0::~AliTRDTriggerL0()
45{
6419bebb 46 // destructor
e58e15dc 47}
48
49void AliTRDTriggerL0::CreateInputs()
50{
6419bebb 51 // create the L0 inputs which are provided by the TRD
52
e58e15dc 53 if (fInputs.GetEntriesFast() > 0)
54 return;
55
f9720615 56 fInputs.AddLast(new AliTriggerInput("0HWU", "TRD", 1)); // TRD wake up
57 fInputs.AddLast(new AliTriggerInput("0HSG", "TRD", 1)); // single gap
58 fInputs.AddLast(new AliTriggerInput("0HDG", "TRD", 1)); // double gap
e58e15dc 59}
60
61void AliTRDTriggerL0::Trigger()
62{
6419bebb 63 // do the actual trigger calculation
f9720615 64
e58e15dc 65 AliRunLoader *runLoader = AliRunLoader::Instance();
66 if (!runLoader)
67 return;
68 AliLoader *trdLoader = runLoader->GetLoader("TRDLoader");
69 if (!trdLoader)
70 return;
71
f9720615 72 AliTRDptrgParam* param = AliTRDptrgParam::Instance();
73
89ae5c14 74 AliTRDptrgCBB* ptrgCBB = new AliTRDptrgCBB(runLoader, param, AliTRDptrgParam::kDigits);
f9720615 75
76 Int_t* simulationResult;
77 simulationResult = ptrgCBB->Simulate();
2f9bdd85 78 if (!simulationResult) {
79 return;
80 }
f9720615 81 for (Int_t iResult = 1; iResult <= simulationResult[0]; iResult++) {
82 AliDebug(5, Form("Result[%d]=0x%x\n",iResult,simulationResult[iResult]));
83 }
5f006bd7 84 if ((simulationResult[0] > 0) || (simulationResult[1] > 0)) {
f9720615 85 AliInfo("Fired single gap trigger");
86 SetInput("0HSG");
87 }
88
7788992c 89 if (simulationResult[2] > 0) {
f9720615 90 AliInfo("Fired double gap trigger");
91 SetInput("0HDG");
92 }
7788992c 93
94 if (simulationResult[3] > 0) {
f9720615 95 AliInfo("Fired TRD wake up call trigger");
96 SetInput("0HWU");
97 }
98
99 delete ptrgCBB;
2f9bdd85 100 delete[] simulationResult;
f9720615 101 simulationResult = 0x0;
e58e15dc 102
f9720615 103 AliDebug(5, Form("memory state: %d", param->CheckVariables()));
e58e15dc 104}