ATLAS Offline Software
TBBeamQualityDoubleHitsTool.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 : TBBeamQualityDoubleHitsTool.cxx #
8 //# Package: TBRec #
9 //# #
10 //# Author : Marco Bieri <mbieri@sfu.ca> #
11 //# #
12 //# Last Modified: Feb 7/2005 #
13 //#####################################################
14 
15 
17 
19 #include "TBEvent/TBScintillator.h"
20 
21 #include <string>
22 #include <ios>
23 #include <algorithm>
24 
26  const std::string& name,
27  const IInterface* parent)
29  m_Scint1ADC(0),
30  m_Scint2ADC(0)
31 {
32 
33  // enter cut parameters
34  // H6 default:
35  declareInterface<TBBeamQualityTool>(this);
36  declareProperty("Scintnames",m_scint_names);
37  declareProperty("ScintCut1",m_ScintCut1=1);
38  declareProperty("ScintCut2",m_ScintCut2=2);
39  declareProperty("ScintCut1ADC",m_ScintCut1ADC);
40  declareProperty("ScintCut2ADC",m_ScintCut2ADC);
41  declareProperty("h6cuts",m_h6cuts=true);
42 }
43 
45 { }
46 
47 /*---------------INITIALIZE---------------*/
49 { //init
50  MsgStream log(msgSvc(),name());
51 
52 
53  return StatusCode::SUCCESS;
54 }//init
55 
57 {//accept
58  MsgStream log(msgSvc(),name());
59 
60  log << MSG::DEBUG
61  << "TBBeamQualityDoubleHits: Started Accept"
62  << endmsg;
63 
64  if (m_h6cuts==true) {// h6cuts
65 
66  // specifying correct cuts
67  // wide/narrow beam selection to be added
68 
69  // Hadrons
70  if (particles[0]=="pi+" || particles[0]=="pi-" || particles[0]=="p+" ) {
71  m_ScintCut1ADC= 270;
72  m_ScintCut2ADC = 265;
73  }
74 
75  // Leptons
76  if (particles[0]=="e+" || particles[0]=="e-" || particles[0]=="mu+" || particles[0]=="mu-" ) {
77  m_ScintCut1ADC= 280;
78  m_ScintCut2ADC = 275;
79  }
80 
81  }// h6cuts
82 
83  log <<MSG::DEBUG
84  << "m_ScintCut1ADC: "<< m_ScintCut1ADC
85  << "m_ScintCut2ADC: "<< m_ScintCut2ADC
86  <<endmsg;
87 
88  TBScintillatorCont * scintCont = nullptr;
89  if (evtStore()->retrieve(scintCont, m_SGScintkey).isFailure()) {
90  log << MSG::DEBUG
91  << "Can't Retrieve "
92  << m_SGScintkey
93  <<" from SG"
94  << endmsg;
95  }
96  else {
97 
98  m_Scint1ADC = 0;
99  m_Scint2ADC = 0;
100 
101  for (const TBScintillator* scint : *scintCont) {
102  std::string detect = scint->getDetectorName();
103  if (detect==m_scint_names[m_ScintCut1]){
104  m_Scint1ADC = scint->getSignal();
105  }
106  if (detect==m_scint_names[m_ScintCut2]){
107  m_Scint2ADC = scint->getSignal();
108  }
109  }
110  }
111 
113  return StatusCode::FAILURE;
114  }
115  else {
116  return StatusCode::SUCCESS;
117  }
118 
119 }//accept
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
TBBeamQualityDoubleHitsTool::m_SGScintkey
std::string m_SGScintkey
Definition: TBBeamQualityDoubleHitsTool.h:38
TBScintillatorCont.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
TBBeamQualityDoubleHitsTool::initializeTool
virtual StatusCode initializeTool() override
Definition: TBBeamQualityDoubleHitsTool.cxx:48
TBScintillator.h
TBScintillatorCont
Definition: TBScintillatorCont.h:19
TBBeamQualityDoubleHitsTool::m_Scint1ADC
float m_Scint1ADC
Definition: TBBeamQualityDoubleHitsTool.h:51
TBBeamQualityDoubleHitsTool::m_Scint2ADC
float m_Scint2ADC
Definition: TBBeamQualityDoubleHitsTool.h:52
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TBBeamQualityTool
Definition: TBBeamQualityTool.h:26
TBBeamQualityDoubleHitsTool::m_ScintCut2ADC
float m_ScintCut2ADC
Definition: TBBeamQualityDoubleHitsTool.h:49
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TBBeamQualityDoubleHitsTool::m_ScintCut1ADC
float m_ScintCut1ADC
Definition: TBBeamQualityDoubleHitsTool.h:48
TBBeamQualityDoubleHitsTool::m_scint_names
std::vector< std::string > m_scint_names
Definition: TBBeamQualityDoubleHitsTool.h:41
TBBeamQualityDoubleHitsTool::m_h6cuts
bool m_h6cuts
Definition: TBBeamQualityDoubleHitsTool.h:43
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DEBUG
#define DEBUG
Definition: page_access.h:11
TBBeamQualityDoubleHitsTool.h
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
LArG4FSStartPointFilter.particles
list particles
Definition: LArG4FSStartPointFilter.py:84
TBBeamQualityDoubleHitsTool::accept
virtual StatusCode accept(const std::vector< std::string > &) override
Definition: TBBeamQualityDoubleHitsTool.cxx:56
TBScintillator
Definition: TBScintillator.h:25
TBBeamQualityDoubleHitsTool::TBBeamQualityDoubleHitsTool
TBBeamQualityDoubleHitsTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TBBeamQualityDoubleHitsTool.cxx:25
TBBeamQualityDoubleHitsTool::m_ScintCut2
int m_ScintCut2
Definition: TBBeamQualityDoubleHitsTool.h:46
TBBeamQualityDoubleHitsTool::m_ScintCut1
int m_ScintCut1
Definition: TBBeamQualityDoubleHitsTool.h:45
TBBeamQualityDoubleHitsTool::~TBBeamQualityDoubleHitsTool
virtual ~TBBeamQualityDoubleHitsTool()
Definition: TBBeamQualityDoubleHitsTool.cxx:44