Changing ownership logic (Laurent)
[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
7ca4655f 18#include <TClonesArray.h>
19
3b2353d8 20#include "AliLog.h"
21#include "AliRun.h"
22#include "AliRunLoader.h"
23#include "AliTriggerInput.h"
24
25#include "AliMUON.h"
6b092dfc 26#include "AliMUONSimLoader.h"
3b2353d8 27#include "AliMUONData.h"
28#include "AliMUONDigit.h"
f57d136a 29#include "AliMUONGlobalTrigger.h"
3b2353d8 30#include "AliMUONTrigger.h"
31
85fec35d 32///
33/// \class AliMUONTrigger
34///
35/// Implementation of AliTriggerDetector for MUON detector
36///
37/// So far, the inputs are taken from AliMUONTriggerDecision object
f57d136a 38/// April 06, E.L.T.
39/// May 06, taken info from Global Trigger branch (Ch.F)
85fec35d 40
3b2353d8 41//----------------------------------------------------------------------
71a2d3aa 42/// \cond CLASSIMP
3b2353d8 43ClassImp(AliMUONTrigger)
71a2d3aa 44/// \endcond
3b2353d8 45
46//----------------------------------------------------------------------
47AliMUONTrigger::AliMUONTrigger()
48 : AliTriggerDetector()
49{
71a2d3aa 50/// Default constructor
51
3b2353d8 52 SetName("MUON");
53 CreateInputs();
54}
55
56//----------------------------------------------------------------------
71a2d3aa 57AliMUONTrigger::~AliMUONTrigger()
58{
59/// Destructor
60}
61
62//----------------------------------------------------------------------
3b2353d8 63void AliMUONTrigger::CreateInputs()
64{
71a2d3aa 65 /// inputs
3b2353d8 66
67 // Do not create inputs again!!
68 if( fInputs.GetEntriesFast() > 0 ) return;
69
8d4fefab 70 fInputs.AddLast( new AliTriggerInput( "MUON_Single_LPt_L0", "Single Low Pt", 0x01 ) );
71 fInputs.AddLast( new AliTriggerInput( "MUON_Single_HPt_L0", "Single High Pt", 0x02 ) );
3b2353d8 72
8d4fefab 73 fInputs.AddLast( new AliTriggerInput( "MUON_Unlike_LPt_L0", "Dimuon Unlike Sign pair Low Pt", 0x04 ) );
74 fInputs.AddLast( new AliTriggerInput( "MUON_Unlike_HPt_L0", "Dimuon Unlike Sign pair High Pt", 0x08 ) );
3b2353d8 75
8d4fefab 76 fInputs.AddLast( new AliTriggerInput( "MUON_Like_LPt_L0", "Dimuon Like Sign pair Low Pt", 0x10 ) );
77 fInputs.AddLast( new AliTriggerInput( "MUON_Like_HPt_L0", "Dimuon Like Sign pair High Pt", 0x20 ) );
3b2353d8 78}
79
80//----------------------------------------------------------------------
81void AliMUONTrigger::Trigger()
82{
71a2d3aa 83 /// sets the trigger inputs
84
f57d136a 85 AliMUONGlobalTrigger* globalTrigger;
86 TClonesArray* globalTriggerArray;
3b2353d8 87
88 AliRunLoader* runLoader = gAlice->GetRunLoader();
89
84aac932 90 AliLoader * muonLoader = runLoader->GetLoader("MUONLoader");
91 muonLoader->LoadDigits("READ");
f57d136a 92
3b2353d8 93 // Creating MUON data container
84aac932 94 AliMUONData* muonData = new AliMUONData(muonLoader,"MUON","MUON");
f57d136a 95
96 // get global info
97 muonData->SetTreeAddress("GLT");
98 muonData->GetTriggerD();
99 globalTriggerArray = muonData->GlobalTrigger();
698b2e52 100 if (globalTriggerArray == 0x0) {
101 AliWarning("No Global Trigger Array available");
102 return;
103 }
f57d136a 104 globalTrigger = (AliMUONGlobalTrigger*)globalTriggerArray->UncheckedAt(0);
105
106 if (globalTrigger == 0x0) {
107 AliWarning("No Global Trigger available");
108 return;
109 }
110 // set CTP
8d4fefab 111 if (globalTrigger->SingleLpt()) SetInput("MUON_Single_LPt_L0");
112 if (globalTrigger->SingleHpt()) SetInput("MUON_Single_HPt_L0");
3b2353d8 113
f57d136a 114 if (globalTrigger->PairUnlikeLpt()) SetInput("MUON_Unlike_LPt_L0");
115 if (globalTrigger->PairUnlikeHpt()) SetInput("MUON_Unlike_HPt_L0");
3b2353d8 116
f57d136a 117 if (globalTrigger->PairLikeLpt()) SetInput("MUON_Like_LPt_L0");
118 if (globalTrigger->PairLikeHpt()) SetInput("MUON_Like_HPt_L0");
f57d136a 119
120 muonData->ResetTrigger();
121 muonLoader->UnloadDigits();
122
3b2353d8 123}