ATLAS Offline Software
BunchCrossingAverageCondTest.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Local include(s):
7 
8 
10  ATH_MSG_INFO( "Initializing..." );
11 
13 
14  if (m_fileName.size()>0) {
15  m_fileOut.open(m_fileName);
16  if (m_fileOut.is_open()) {
17  ATH_MSG_INFO("Writing to file " << m_fileName);
18  }
19  else {
20  msg(MSG::ERROR) << "Failed to open file " << m_fileName << endmsg;
21  return StatusCode::FAILURE;
22  }
23  }
24  else
25  ATH_MSG_INFO("Writing to stdout");
26 
27  return StatusCode::SUCCESS;
28 }
29 
31 
32  // Retrieve the object holding the BCID of the current event:
33  const EventContext& ctx = Gaudi::Hive::currentContext();
34 
35  std::ostream& out = m_fileOut.good() ? m_fileOut : std::cout;
37  const BunchCrossingAverageCondData* bccd=*readHdl;
38  out << "\nTimestamp:" << ctx.eventID().time_stamp() << " ns:" << ctx.eventID().time_stamp_ns_offset() << std::endl;
39  for (unsigned channel=0;channel<2;++channel)
40  printInfo(bccd,channel,out);
41 
42  return StatusCode::SUCCESS;
43 }
44 
45 void BunchCrossingAverageCondTest::printInfo(const BunchCrossingAverageCondData* bccd, unsigned int channel, std::ostream& out ) {
46 
47  out << "channel " << channel;
48  out << " GetBeam1Intensity " << bccd->GetBeam1Intensity(channel)
49  << " GetBeam2Intensity " << bccd->GetBeam2Intensity(channel)
50  << " GetBeam1IntensityAll " << bccd->GetBeam1IntensityAll(channel)
51  << " GetBeam2IntensityAll " << bccd->GetBeam2IntensityAll(channel)
52  << " GetBeam1IntensitySTD " << bccd->GetBeam1IntensitySTD(channel)
53  << " GetBeam2IntensitySTD " << bccd->GetBeam2IntensitySTD(channel)
54  << " GetBeam1IntensityAllSTD " << bccd->GetBeam1IntensityAllSTD(channel)
55  << " GetBeam2IntensityAllSTD " << bccd->GetBeam2IntensityAllSTD(channel);
56  out << std::endl;
57 
58 }
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
BunchCrossingAverageCondTest::printInfo
static void printInfo(const BunchCrossingAverageCondData *bccd, unsigned int channel, std::ostream &out)
Function for printing detailed info about a given bunch crossing.
Definition: BunchCrossingAverageCondTest.cxx:45
BunchCrossingAverageCondData::GetBeam1IntensitySTD
float GetBeam1IntensitySTD(int channel) const
Definition: BunchCrossingAverageCondData.cxx:104
BunchCrossingAverageCondTest::m_fileOut
std::ofstream m_fileOut
Definition: BunchCrossingAverageCondTest.h:39
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
BunchCrossingAverageCondData::GetBeam1Intensity
float GetBeam1Intensity(int channel) const
Definition: BunchCrossingAverageCondData.cxx:40
BunchCrossingAverageCondData::GetBeam1IntensityAllSTD
float GetBeam1IntensityAllSTD(int channel) const
Definition: BunchCrossingAverageCondData.cxx:74
BunchCrossingAverageCondTest.h
BunchCrossingAverageCondTest::m_inputKey
SG::ReadCondHandleKey< BunchCrossingAverageCondData > m_inputKey
Definition: BunchCrossingAverageCondTest.h:33
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
BunchCrossingAverageCondData::GetBeam1IntensityAll
float GetBeam1IntensityAll(int channel) const
Definition: BunchCrossingAverageCondData.cxx:10
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
BunchCrossingAverageCondData::GetBeam2IntensityAllSTD
float GetBeam2IntensityAllSTD(int channel) const
Definition: BunchCrossingAverageCondData.cxx:89
BunchCrossingAverageCondData::GetBeam2IntensitySTD
float GetBeam2IntensitySTD(int channel) const
Definition: BunchCrossingAverageCondData.cxx:119
BunchCrossingAverageCondData::GetBeam2IntensityAll
float GetBeam2IntensityAll(int channel) const
Definition: BunchCrossingAverageCondData.cxx:25
BunchCrossingAverageCondTest::execute
virtual StatusCode execute()
Function called once per event.
Definition: BunchCrossingAverageCondTest.cxx:30
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
BunchCrossingAverageCondData
Definition: BunchCrossingAverageCondData.h:23
BunchCrossingAverageCondTest::m_fileName
Gaudi::Property< std::string > m_fileName
Definition: BunchCrossingAverageCondTest.h:35
AthCommonMsg< Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
BunchCrossingAverageCondTest::initialize
virtual StatusCode initialize()
Initialization run before the event loop.
Definition: BunchCrossingAverageCondTest.cxx:9
BunchCrossingAverageCondData::GetBeam2Intensity
float GetBeam2Intensity(int channel) const
Definition: BunchCrossingAverageCondData.cxx:55