ATLAS Offline Software
TileCellRawAssociationTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /*
6  * File: TileCellRawAssociationTool.cxx
7  * Author: Stephen Cole <stephen.cole@cern.ch>
8  *
9  * Created on October 26, 2011, 11:08 AM
10  */
11 
12 #include "GaudiKernel/MsgStream.h"
16 #include "TileEvent/TileCell.h"
17 
19 
20 
21 using namespace std;
22 
23 namespace D3PD{
24 
25 TileCellRawAssociationTool::TileCellRawAssociationTool(const string& type,
26  const string& name, const IInterface* parent) :
28  m_rawGetter(type,name,parent),
29  m_tilehwid(0),
30  m_nRawReturned(0)
31 {
32  declareProperty("TileRawChannelSGKey",m_tileRawKey = "TileRawChannelFlt");
33 
34 }
35 
37 }
38 
40 {
42  CHECK( m_rawGetter.setProperty("SGKey",m_tileRawKey) );
44  return StatusCode::SUCCESS;
45 }
46 
49 
50  CHECK( m_rawGetter.reset(false) );
51 
52  const CaloCell* cell=&p;
53  const TileCell* tilecell = dynamic_cast<const TileCell*> (cell);
54  if(!tilecell){
55  MsgStream log(msgSvc(), name());
56  log << MSG::ERROR
57  << "Passed CaloCell is not a TileCell" << endmsg;
58  return StatusCode::FAILURE;
59  }
60  const CaloDetDescrElement * caloDDE = tilecell->caloDDE();
61  long gain1 = tilecell->gain1();
62  long gain2 = tilecell->gain2();
63  IdentifierHash hash1 = caloDDE->onl1();
64  IdentifierHash hash2 = caloDDE->onl2();
65  if (hash1 != TileHWID::NOT_VALID_HASH) {
66  m_adcId1 = m_tilehwid->adc_id(hash1,gain1);
67  }
68  else{
69  MsgStream log(msgSvc(), name());
70  log<<MSG::DEBUG<<"TileCellRawAssociationTool: Invalid hash on gain1"<<
71  endmsg;
72  m_adcId1.clear();
73  }
74 
75  if (hash2 != TileHWID::NOT_VALID_HASH) {
76  m_adcId2 = m_tilehwid->adc_id(hash2,gain2);
77  }
78  else{
79  MsgStream log(msgSvc(), name());
80  log<<MSG::DEBUG<<"TileCellRawAssociationTool: Invalid hash on gain2"<<
81  endmsg;
82  m_adcId2.clear();
83  }
84 
85  return StatusCode::SUCCESS;
86 }
87 
89  MsgStream log(msgSvc(), name());
90  log << MSG::DEBUG << " in TileCellRawAssociationTool::next()" <<
91  endmsg;
92  if(m_nRawReturned>1)return 0;
93 
94  const TileRawChannel* tileraw=
96  while(tileraw){
97  HWIdentifier rId=tileraw->adc_HWID();
98  if(m_adcId1.is_valid()){
99  if(m_adcId1==rId){
100  ++m_nRawReturned;
101  m_adcId1.clear();
102  return tileraw;
103  }
104  }
105  if(m_adcId2.is_valid()){
106  if(m_adcId2==rId){
107  ++m_nRawReturned;
108  m_adcId2.clear();
109  return tileraw;
110  }
111  }
112  tileraw=(const TileRawChannel*) m_rawGetter.nextUntyped();
113  }
114 
115  log<<MSG::DEBUG<<"TileCellRawAssociationTool: Found only "<<
116  m_nRawReturned<<" associated raw channels."<<endmsg;
117  return 0;
118 }
119 
120 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
TileCell
Definition: TileCell.h:57
CaloDetDescrElement::onl2
IdentifierHash onl2() const
cell online identifier 2
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:408
TileRawChannel.h
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
D3PD::SGTileRawChannelGetterTool::nextUntyped
const void * nextUntyped()
Return a pointer to the next element in the collection.
Definition: SGTileRawChannelGetterTool.cxx:70
CaloTime_fillDB.gain2
gain2
Definition: CaloTime_fillDB.py:357
TileCellRawAssociationTool.h
D3PD::TileCellRawAssociationTool::m_tileRawKey
std::string m_tileRawKey
Definition: TileCellRawAssociationTool.h:62
D3PD::MultiAssociationTool< CaloCell, TileRawChannel >
TileRawData::adc_HWID
HWIdentifier adc_HWID(void) const
Definition: TileRawData.h:53
D3PD::TileCellRawAssociationTool::m_nRawReturned
int m_nRawReturned
Definition: TileCellRawAssociationTool.h:65
D3PD::TileCellRawAssociationTool::next
virtual const TileRawChannel * next()
Return a pointer to the next element in the association.
Definition: TileCellRawAssociationTool.cxx:88
CaloDetDescrElement::onl1
IdentifierHash onl1() const
cell online identifier 1
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:404
AthAlgorithm.h
D3PD
Block filler tool for noisy FEB information.
Definition: InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/TrigD3PD/ChainGroup.h:21
TileHWID.h
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
CaloCell::caloDDE
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition: CaloCell.h:305
D3PD::TileCellRawAssociationTool::reset
virtual StatusCode reset(const CaloCell &p)
Return the target object.
Definition: TileCellRawAssociationTool.cxx:47
TileCell.h
TileRawChannel
Definition: TileRawChannel.h:35
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
D3PD::TileCellRawAssociationTool::~TileCellRawAssociationTool
virtual ~TileCellRawAssociationTool()
Definition: TileCellRawAssociationTool.cxx:36
D3PD::TileCellRawAssociationTool::m_tilehwid
const TileHWID * m_tilehwid
Definition: TileCellRawAssociationTool.h:63
TileCell::gain1
int gain1(void) const
get gain of first PMT
Definition: TileCell.cxx:182
CaloTime_fillDB.gain1
gain1
Definition: CaloTime_fillDB.py:356
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
D3PD::TileCellRawAssociationTool::m_rawGetter
Getter m_rawGetter
Definition: TileCellRawAssociationTool.h:61
D3PD::TileCellRawAssociationTool::m_adcId2
HWIdentifier m_adcId2
Definition: TileCellRawAssociationTool.h:64
D3PD::TileCellRawAssociationTool::initialize
StatusCode initialize()
Definition: TileCellRawAssociationTool.cxx:39
TileHWID::adc_id
HWIdentifier adc_id(int ros, int drawer, int channel, int adc) const
adc HWIdentifer
Definition: TileHWID.cxx:228
TileCell::gain2
int gain2(void) const
get gain of second PMT
Definition: TileCell.cxx:189
TileHWID::NOT_VALID_HASH
@ NOT_VALID_HASH
Definition: TileHWID.h:314
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
D3PD::SGTileRawChannelGetterTool::initialize
StatusCode initialize()
Standard Gaudi initialize method.
Definition: SGTileRawChannelGetterTool.cxx:26
D3PD::TileCellRawAssociationTool::m_adcId1
HWIdentifier m_adcId1
Definition: TileCellRawAssociationTool.h:64
D3PD::SGTileRawChannelGetterTool::reset
StatusCode reset(bool allowMissing=false)
Reset the iteration to the start of the collection.
Definition: SGTileRawChannelGetterTool.cxx:50