Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
ReadLArRaw.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  Kin Yip : May 22, 2002
8 
9  barrel_ec in software description has changed the definition.
10 
11  Now, we have +-1 for Barrel
12  +-2,3 for EndCap
13 
14  "pos_neg" in the ntuple is equivalent to "barrel_ec" in software description.
15 
16  Hong Ma : Aug 30, 2002
17  Add testing of RoI.
18  */
19 
20 
21 //#include <strstream>
22 
23 #include "GaudiKernel/MsgStream.h"
24 #include "CaloIdentifier/LArID.h"
28 
31 #include "ReadLArRaw.h"
32 
33 // access all RawChannel
34 //#include "EventContainers/SelectAllObject.h"
35 // access RawChannel in TrigTower
36 // #include "LArRawUtils/LArRawRoISelector.h"
37 //#include "LArRawUtils/LArTT_Selector.h"
38 
40 
41 using namespace std ;
42 
43 //const int max_chan = 2800 ;
44 
46 
47 ReadLArRaw::ReadLArRaw(const std::string& name, ISvcLocator* pSvcLocator) :
48  AthAlgorithm(name, pSvcLocator),
49  m_ChannelContainerName("LArRawChannelContainer"),
50  m_onlineID(nullptr),
51  m_larem_id(nullptr)
52 {
53  // Declare the properties
54  declareProperty("LArRawChannelContainerName",m_ChannelContainerName);
55  declareProperty("DumpFile",m_dumpFile="");
56 }
57 
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
59 
61 {
62  ATH_MSG_INFO( "in initialize()" );
63 
65 
66  ATH_CHECK( detStore()->retrieve(m_onlineID, "LArOnlineID") );
67 
68 // retrieve helpers for identifier
69  const CaloCell_ID* idHelper = nullptr;
70  ATH_CHECK( detStore()->retrieve (idHelper, "CaloCell_ID") );
71  m_larem_id = idHelper->em_idHelper();
72 
73 
74 
75  if (!m_dumpFile.empty()) {
76  m_outFile.open(m_dumpFile.c_str());
77  }
78 
79  // after all these ...
80  return StatusCode::SUCCESS;
81 
82 }
83 
84 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
85 
87 
88  ATH_MSG_DEBUG( "in execute()" );
89  const LArRawChannelContainer* LArRaw ;
91 
92 
93  int emax= 0;
94  HWIdentifier maxId;
95 
97  const LArOnOffIdMapping* cabling{*cablingHdl};
98  if(!cabling) {
99  ATH_MSG_ERROR("Do not have mapping object " << m_cablingKey.key());
100  return StatusCode::FAILURE;
101  }
102 
103  LArRawChannelContainer::const_iterator it1 = LArRaw->begin();
104  LArRawChannelContainer::const_iterator it2 = LArRaw->end();
105  for(; it1!=it2; ++it1){
106  HWIdentifier ch_id=it1->identify();
107  if (m_outFile.is_open()) {
108  if(cabling->isOnlineConnected(ch_id))
109  m_outFile << "LArRawChannelDump: 0x" << std::hex << ch_id.get_compact() << std::dec << " E=" << it1->energy()
110  << " t=" << it1->time() << " g=" << (int)it1->gain() << " Q=" << it1->quality() << std::endl;
111  }
112 
113  if(emax<it1->energy() ) {
114  emax=it1->energy() ;
115  maxId =ch_id;
116  // use LArOnlineID methods
117  ATH_MSG_VERBOSE( "--barrel_ec : " << m_onlineID->barrel_ec(ch_id)
118  << " Pos_neg : " << m_onlineID->pos_neg(ch_id)
119  << " FeedThrough no. : " << m_onlineID->feedthrough(ch_id)
120  << " slot no. : " << m_onlineID->slot(ch_id)
121  << " channel no. : " << m_onlineID->channel(ch_id)
122  );
123 
124  ATH_MSG_DEBUG( "Energy = " << it1->energy() << "; Time = "
125  << it1->time()
126  << "; Chi-Square = " << it1->quality() );
127  }
128  ATH_MSG_DEBUG( " Channel with max energy , maxID = "<< emax<<" "<<maxId.getString() );
129  }
130 
131  return StatusCode::SUCCESS;
132 }
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
135 
137 
138  if (m_outFile.is_open())
139  m_outFile.close();
140  ATH_MSG_INFO( "in finalize()" );
141 
142  return StatusCode::SUCCESS;
143 }
144 
145 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
LArEM_ID.h
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
LArID_Exception.h
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
LArOnlineID_Base::slot
int slot(const HWIdentifier id) const
Return the slot number of a hardware cell identifier: slot = [1,15] Slot-ID in top part of the crat...
Definition: LArOnlineID_Base.cxx:1957
ReadLArRaw::m_outFile
std::ofstream m_outFile
Definition: ReadLArRaw.h:37
ReadLArRaw::initialize
virtual StatusCode initialize()
Definition: ReadLArRaw.cxx:60
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
LArOnlineID_Base::barrel_ec
int barrel_ec(const HWIdentifier id) const
Return the position barrel or endcap of a hardware cell identifier: barrel_ec = [0,...
Definition: LArOnlineID_Base.cxx:1938
ReadLArRaw::m_larem_id
const LArEM_ID * m_larem_id
Definition: ReadLArRaw.h:42
CaloCell_ID.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
LArOnlineID_Base::channel
int channel(const HWIdentifier id) const
Return the channel number of a hardware cell identifier channel = [0,127] in all FEB.
Definition: LArOnlineID_Base.cxx:1963
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
DetDescrDictionaryDict::it1
std::vector< HWIdentifier >::iterator it1
Definition: DetDescrDictionaryDict.h:17
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
python.LArMinBiasAlgConfig.int
int
Definition: LArMinBiasAlgConfig.py:59
ReadLArRaw::m_ChannelContainerName
std::string m_ChannelContainerName
Definition: ReadLArRaw.h:35
LArOnlineID_Base::pos_neg
int pos_neg(const HWIdentifier id) const
Return the side of a hardware cell identifier pos_neg = [0,1] positive-side or negative-side Barrel...
Definition: LArOnlineID_Base.cxx:1950
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ReadLArRaw::m_onlineID
const LArOnlineID * m_onlineID
Definition: ReadLArRaw.h:41
AthAlgorithm
Definition: AthAlgorithm.h:47
LArRawChannel.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
ReadLArRaw::finalize
virtual StatusCode finalize()
Definition: ReadLArRaw.cxx:136
ReadLArRaw::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition: ReadLArRaw.h:39
LArID.h
LArOnlineID_Base::feedthrough
int feedthrough(const HWIdentifier id) const
Return the feedthrough of a hardware cell identifier : feedthrough = [0,31] Barrel - A/C side or H/...
Definition: LArOnlineID_Base.cxx:1944
ReadLArRaw::ReadLArRaw
ReadLArRaw(const std::string &name, ISvcLocator *pSvcLocator)
Definition: ReadLArRaw.cxx:47
ReadLArRaw::m_dumpFile
std::string m_dumpFile
Definition: ReadLArRaw.h:36
ReadLArRaw::execute
virtual StatusCode execute()
Definition: ReadLArRaw.cxx:86
LArRawChannelContainer.h
LArOnlineID.h
LArRawChannelContainer
Container for LArRawChannel (IDC using LArRawChannelCollection)
Definition: LArRawChannelContainer.h:26
ReadLArRaw.h