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