ATLAS Offline Software
Loading...
Searching...
No Matches
TBBeamQualityMuonToolH6.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5//#####################################################
6//# #
7//# File : TBBeamQualityMuonToolH6.cxx #
8//# Package: TBRec #
9//# #
10//# Author : Marco Bieri <mbieri@sfu.ca> #
11//# #
12//# Last Modofied: Nov 18/2004 #
13//#####################################################
14
16
17// TRIGGERS
19
20
21#include <string>
22#include <ios>
23#include <algorithm>
24
26 const std::string& name,
27 const IInterface* parent)
28 : TBBeamQualityTool(type,name,parent),
29 m_mu1(false),
30 m_mu2(false),
31 m_mu3(false),
32 m_mu4(false),
33 m_successflag(false)
34{
35 declareInterface<TBBeamQualityTool>(this);
36}
37
40
42{
43 MsgStream log(msgSvc(),name());
44
45 log << MSG::DEBUG
46 << "initialize"
47 << endmsg;
48
49 // setting triggflag
50
51 if(m_triggflag.size()==0){ //trig
52
53 m_triggflag.push_back(0x00000001); // Entry 0: S1 accept
54 m_triggflag.push_back(0x00000002); // Entry 1: S2 accept
55 m_triggflag.push_back(0x00000004); // Enrty 2: S3 accept
56 m_triggflag.push_back(0x00000008); // Entry 3: B2 accept
57 m_triggflag.push_back(0x00000010); // Entry 4: VetoLeft
58 m_triggflag.push_back(0x00000020); // Entry 5: VetoRight
59 m_triggflag.push_back(0x00000040); // Entry 6: VetoDown
60 m_triggflag.push_back(0x00000080); // Entry 7: VetoUp
61 m_triggflag.push_back(0x00000100); // Entry 8: Mu 1 Left
62 m_triggflag.push_back(0x00000200); // Entry 9: Mu 2 Left
63 m_triggflag.push_back(0x00000400); // Entry 10: Mu 2 Left
64 m_triggflag.push_back(0x00000800); // Entry 11: Early PileUp
65 m_triggflag.push_back(0x00001000); // Enrty 12: Late PileUp
66 m_triggflag.push_back(0x00002000); // Entry 13: In Spill Tag
67 m_triggflag.push_back(0x00004000); // Entry 14: Off Spill Tag
68 m_triggflag.push_back(0x00008000); // Entry 15: Cedar 6 0f 8 segments
69 m_triggflag.push_back(0x00010000); // Entry 16: Mu 2 Right
70 m_triggflag.push_back(0x00020000); // Entry 17: Hole Counter
71 m_triggflag.push_back(0x00040000); // Entry 18: W1*W2 coincidence
72 m_triggflag.push_back(0x00080000); // Entry 19: B1 accept
73 m_triggflag.push_back(0x00100000); // Entry 20: Scalar Reset Tag
74 m_triggflag.push_back(0x08000000); // Entry 21: Cedar 7 of 8 segments
75 m_triggflag.push_back(0x10000000); // Entry 21: Cedar 8 of 8 segments
76 } //trig
77 return StatusCode::SUCCESS;
78}
79
80StatusCode TBBeamQualityMuonToolH6::accept(const std::vector<std::string>& particles)
81{//accept
82
83 MsgStream log(msgSvc(),name());
84
85 // Trigger Pattern Pointer
86 TBTriggerPatternUnit * triggpat_object;
87
88 ATH_CHECK( evtStore()->retrieve(triggpat_object, m_SGTrigkey) );
89
90 unsigned int word =triggpat_object->getTriggerWord();
91
92 m_mu1=false;
93 m_mu2=false;
94 m_mu3=false;
95 m_mu4=false;
96
97 // muon triggers are:
98 // Entry 8: Mu 1 Left
99 // Entry 9: Mu 2 Left
100 // Entry 10: Mu 2 Left
101 // Entry 16: Mu 2 Right
102
103 if ((word & m_triggflag[8])!=0) {
104 m_mu1=true;
105 }
106 if ((word & m_triggflag[9])!=0) {
107 m_mu2=true;
108 }
109 if ((word & m_triggflag[10])!=0) {
110 m_mu3=true;
111 }
112 if ((word & m_triggflag[16])!=0) {
113 m_mu4=true;
114 }
115
116 //checking for muon coincidence:
117
118 // rejecting event for all particles except for muons
119
120 //muons
121 log<<MSG::DEBUG
122 <<particles[0]
123 <<endmsg;
124
125 if(particles[0]=="mu+" || particles[0]=="mu-"){
126 m_successflag=false;
127
128 if (((m_mu1==true)&(m_mu3==true))||((m_mu1==true)&(m_mu4==true))||((m_mu2==true)&(m_mu3==true))||((m_mu2==true)&(m_mu4==true))) {
129 m_successflag=true;
130 }
131 }else{
132 //all particles except muons
133 m_successflag=true;
134
135 if (((m_mu1==true)&(m_mu3==true))||((m_mu1==true)&(m_mu4==true))||((m_mu2==true)&(m_mu3==true))||((m_mu2==true)&(m_mu4==true))) {
136 m_successflag=false;
137 }
138 }
139 if(m_successflag==true){
140 return StatusCode::SUCCESS;
141 }else{
142 return StatusCode::FAILURE;
143 }
144}//accept
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
ServiceHandle< StoreGateSvc > & evtStore()
std::vector< unsigned int > m_triggflag
virtual StatusCode initializeTool() override
TBBeamQualityMuonToolH6(const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode accept(const std::vector< std::string > &) override
TBBeamQualityTool(const std::string &name, const std::string &type, const IInterface *parent)
unsigned int getTriggerWord() const