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