Line data Source code
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 :
32 : #include "AliTRDptrgParam.h"
33 : #include "AliTRDptrgCBB.h"
34 :
35 : #include "AliTRDTriggerL0.h"
36 :
37 4 : AliTRDTriggerL0::AliTRDTriggerL0()
38 20 : {
39 : // constructor
40 :
41 4 : SetName("TRD");
42 8 : }
43 :
44 : AliTRDTriggerL0::~AliTRDTriggerL0()
45 16 : {
46 : // destructor
47 16 : }
48 :
49 : void AliTRDTriggerL0::CreateInputs()
50 : {
51 : // create the L0 inputs which are provided by the TRD
52 :
53 8 : if (fInputs.GetEntriesFast() > 0)
54 : return;
55 :
56 20 : fInputs.AddLast(new AliTriggerInput("0HWU", "TRD", 1)); // TRD wake up
57 20 : fInputs.AddLast(new AliTriggerInput("0HSG", "TRD", 1)); // single gap
58 20 : fInputs.AddLast(new AliTriggerInput("0HDG", "TRD", 1)); // double gap
59 8 : }
60 :
61 : void AliTRDTriggerL0::Trigger()
62 : {
63 : // do the actual trigger calculation
64 :
65 8 : AliRunLoader *runLoader = AliRunLoader::Instance();
66 4 : if (!runLoader)
67 0 : return;
68 4 : AliLoader *trdLoader = runLoader->GetLoader("TRDLoader");
69 4 : if (!trdLoader)
70 0 : return;
71 :
72 4 : AliTRDptrgParam* param = AliTRDptrgParam::Instance();
73 :
74 4 : AliTRDptrgCBB* ptrgCBB = new AliTRDptrgCBB(runLoader, param, AliTRDptrgParam::kDigits);
75 :
76 : Int_t* simulationResult;
77 4 : simulationResult = ptrgCBB->Simulate();
78 4 : if (!simulationResult) {
79 0 : return;
80 : }
81 40 : for (Int_t iResult = 1; iResult <= simulationResult[0]; iResult++) {
82 48 : AliDebug(5, Form("Result[%d]=0x%x\n",iResult,simulationResult[iResult]));
83 : }
84 4 : if ((simulationResult[0] > 0) || (simulationResult[1] > 0)) {
85 4 : AliInfo("Fired single gap trigger");
86 4 : SetInput("0HSG");
87 4 : }
88 :
89 4 : if (simulationResult[2] > 0) {
90 4 : AliInfo("Fired double gap trigger");
91 4 : SetInput("0HDG");
92 4 : }
93 :
94 4 : if (simulationResult[3] > 0) {
95 4 : AliInfo("Fired TRD wake up call trigger");
96 4 : SetInput("0HWU");
97 4 : }
98 :
99 8 : delete ptrgCBB;
100 8 : delete[] simulationResult;
101 : simulationResult = 0x0;
102 :
103 12 : AliDebug(5, Form("memory state: %d", param->CheckVariables()));
104 8 : }
|