]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - MUON/AliMUONTrigger.cxx
(hopefully) Last tweaks to have the embedding straight : the charge of sdigits is...
[u/mrichter/AliRoot.git] / MUON / AliMUONTrigger.cxx
... / ...
CommitLineData
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$ */
17
18#include "AliMUONTrigger.h"
19
20#include "AliLog.h"
21#include "AliMUONGlobalTrigger.h"
22#include "AliMUONVTriggerStore.h"
23#include "AliRun.h"
24#include "AliRunLoader.h"
25#include "AliTriggerInput.h"
26
27
28//-----------------------------------------------------------------------------
29/// \class AliMUONTrigger
30///
31/// Implementation of AliTriggerDetector for MUON detector
32///
33/// So far, the inputs are taken from AliMUONTriggerDecision object
34/// April 06, E.L.T.
35/// May 06, taken info from Global Trigger branch (Ch.F)
36///
37/// \author E. Lopez Torres
38//-----------------------------------------------------------------------------
39
40//----------------------------------------------------------------------
41/// \cond CLASSIMP
42ClassImp(AliMUONTrigger)
43/// \endcond
44
45//----------------------------------------------------------------------
46AliMUONTrigger::AliMUONTrigger()
47 : AliTriggerDetector(), fTriggerStore(0x0)
48{
49/// Default constructor
50
51 SetName("MUON");
52 CreateInputs();
53}
54
55//----------------------------------------------------------------------
56AliMUONTrigger::~AliMUONTrigger()
57{
58 /// Destructor
59 delete fTriggerStore;
60}
61
62//----------------------------------------------------------------------
63void AliMUONTrigger::CreateInputs()
64{
65 /// inputs
66
67 // Do not create inputs again!!
68 if( fInputs.GetEntriesFast() > 0 ) return;
69
70 fInputs.AddLast( new AliTriggerInput( "0MSL", "MUONTRG", 0 ) );
71 fInputs.AddLast( new AliTriggerInput( "0MSH", "MUONTRG", 0 ) );
72
73 fInputs.AddLast( new AliTriggerInput( "0MUL", "MUONTRG", 0 ) );
74 fInputs.AddLast( new AliTriggerInput( "0MUH", "MUONTRG", 0 ) );
75
76 fInputs.AddLast( new AliTriggerInput( "0MLL", "MUONTRG", 0 ) );
77 fInputs.AddLast( new AliTriggerInput( "0MLH", "MUONTRG", 0 ) );
78}
79
80//----------------------------------------------------------------------
81void AliMUONTrigger::Trigger()
82{
83 /// sets the trigger inputs
84
85 AliRunLoader* runLoader = AliRunLoader::Instance();
86
87 AliLoader * muonLoader = runLoader->GetDetectorLoader("MUON");
88 muonLoader->LoadDigits("READ");
89
90 TTree* treeD = muonLoader->TreeD();
91
92 if (!treeD)
93 {
94 AliError("No TreeD available. Cannot make trigger");
95 return;
96 }
97
98 if (!fTriggerStore)
99 {
100 fTriggerStore = AliMUONVTriggerStore::Create(*treeD);
101 if (!fTriggerStore)
102 {
103 AliError("Could not create triggerStore from treeD");
104 return;
105 }
106 }
107
108 Bool_t ok = fTriggerStore->Connect(*treeD,kTRUE);
109
110 if (!ok)
111 {
112 AliError("Could not read trigger from TreeD !");
113 return;
114 }
115
116 treeD->GetEvent(0);
117
118 AliMUONGlobalTrigger* globalTrigger = fTriggerStore->Global();
119 if (globalTrigger == 0x0)
120 {
121 AliWarning("No Global Trigger available");
122 }
123 else
124 {
125 // set CTP
126 if (globalTrigger->SingleLpt()) SetInput("0MSL");
127 if (globalTrigger->SingleHpt()) SetInput("0MSH");
128
129 if (globalTrigger->PairUnlikeLpt()) SetInput("0MUL");
130 if (globalTrigger->PairUnlikeHpt()) SetInput("0MUH");
131
132 if (globalTrigger->PairLikeLpt()) SetInput("0MLL");
133 if (globalTrigger->PairLikeHpt()) SetInput("0MLH");
134 }
135 muonLoader->UnloadDigits();
136 fTriggerStore->Clear();
137}