ATLAS Offline Software
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 "LArRawChannelBuilder.h"
32 #include "ReadLArRaw.h"
33 
34 // access all RawChannel
35 //#include "EventContainers/SelectAllObject.h"
36 // access RawChannel in TrigTower
37 // #include "LArRawUtils/LArRawRoISelector.h"
38 //#include "LArRawUtils/LArTT_Selector.h"
39 
41 
42 using namespace std ;
43 
44 //const int max_chan = 2800 ;
45 
47 
48 ReadLArRaw::ReadLArRaw(const std::string& name, ISvcLocator* pSvcLocator) :
49  AthAlgorithm(name, pSvcLocator),
50  m_ChannelContainerName("LArRawChannelContainer"),
51  m_onlineID(nullptr),
52  m_larem_id(nullptr)
53 {
54  // Declare the properties
55  declareProperty("LArRawChannelContainerName",m_ChannelContainerName);
56  declareProperty("DumpFile",m_dumpFile="");
57 }
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
60 
62 {
63  ATH_MSG_INFO( "in initialize()" );
64 
66 
67  ATH_CHECK( detStore()->retrieve(m_onlineID, "LArOnlineID") );
68 
69 // retrieve helpers for identifier
70  const CaloCell_ID* idHelper = nullptr;
71  ATH_CHECK( detStore()->retrieve (idHelper, "CaloCell_ID") );
72  m_larem_id = idHelper->em_idHelper();
73 
74 
75 
76  if (!m_dumpFile.empty()) {
77  m_outFile.open(m_dumpFile.c_str());
78  }
79 
80  // after all these ...
81  return StatusCode::SUCCESS;
82 
83 }
84 
85 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
86 
88 
89  ATH_MSG_DEBUG( "in execute()" );
90  const LArRawChannelContainer* LArRaw ;
92 
93 
94  int emax= 0;
95  HWIdentifier maxId;
96 
98  const LArOnOffIdMapping* cabling{*cablingHdl};
99  if(!cabling) {
100  ATH_MSG_ERROR("Do not have mapping object " << m_cablingKey.key());
101  return StatusCode::FAILURE;
102  }
103 
104  LArRawChannelContainer::const_iterator it1 = LArRaw->begin();
105  LArRawChannelContainer::const_iterator it2 = LArRaw->end();
106  for(; it1!=it2; ++it1){
107  HWIdentifier ch_id=it1->identify();
108  if (m_outFile.is_open()) {
109  if(cabling->isOnlineConnected(ch_id))
110  m_outFile << "LArRawChannelDump: 0x" << std::hex << ch_id.get_compact() << std::dec << " E=" << it1->energy()
111  << " t=" << it1->time() << " g=" << (int)it1->gain() << " Q=" << it1->quality() << std::endl;
112  }
113 
114  if(emax<it1->energy() ) {
115  emax=it1->energy() ;
116  maxId =ch_id;
117  // use LArOnlineID methods
118  ATH_MSG_VERBOSE( "--barrel_ec : " << m_onlineID->barrel_ec(ch_id)
119  << " Pos_neg : " << m_onlineID->pos_neg(ch_id)
120  << " FeedThrough no. : " << m_onlineID->feedthrough(ch_id)
121  << " slot no. : " << m_onlineID->slot(ch_id)
122  << " channel no. : " << m_onlineID->channel(ch_id)
123  );
124 
125  ATH_MSG_DEBUG( "Energy = " << it1->energy() << "; Time = "
126  << it1->time()
127  << "; Chi-Square = " << it1->quality() );
128  }
129  ATH_MSG_DEBUG( " Channel with max energy , maxID = "<< emax<<" "<<maxId.getString() );
130  }
131 
132  return StatusCode::SUCCESS;
133 }
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
136 
138 
139  if (m_outFile.is_open())
140  m_outFile.close();
141  ATH_MSG_INFO( "in finalize()" );
142 
143  return StatusCode::SUCCESS;
144 }
145 
146 
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
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
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:1961
ReadLArRaw::m_outFile
std::ofstream m_outFile
Definition: ReadLArRaw.h:37
ReadLArRaw::initialize
virtual StatusCode initialize()
Definition: ReadLArRaw.cxx:61
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:1942
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:1967
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
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:1954
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:195
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
ReadLArRaw::finalize
virtual StatusCode finalize()
Definition: ReadLArRaw.cxx:137
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:1948
ReadLArRaw::ReadLArRaw
ReadLArRaw(const std::string &name, ISvcLocator *pSvcLocator)
Definition: ReadLArRaw.cxx:48
ReadLArRaw::m_dumpFile
std::string m_dumpFile
Definition: ReadLArRaw.h:36
ReadLArRaw::execute
virtual StatusCode execute()
Definition: ReadLArRaw.cxx:87
LArRawChannelContainer.h
LArOnlineID.h
LArRawChannelContainer
Container for LArRawChannel (IDC using LArRawChannelCollection)
Definition: LArRawChannelContainer.h:26
ReadLArRaw.h