ATLAS Offline Software
TileCellDigitAssociationTool.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: TileCellDigitAssociationTool.cxx
7  * Author: Stephen Cole <stephen.cole@cern.ch>
8  *
9  * Created on October 31, 2011, 11:23 AM
10  */
11 
12 #include "GaudiKernel/MsgStream.h"
15 #include "TileEvent/TileDigits.h"
16 #include "TileEvent/TileCell.h"
17 
19 
20 using namespace std;
21 
22 namespace D3PD{
23 
24 TileCellDigitAssociationTool::TileCellDigitAssociationTool(const string& type,
25  const string& name, const IInterface* parent) :
27  m_digitGetter(type,name,parent),
28  m_tilehwid(0),
29  m_nDigitReturned(0)
30 {
31  declareProperty("TileDigitsSGKey",m_tileDigitKey = "TileDigitsFlt");
32 }
33 
34 
36 }
37 
39 {
41  CHECK( m_digitGetter.setProperty("SGKey",m_tileDigitKey) );
43  return StatusCode::SUCCESS;
44 }
45 
48 
49  CHECK( m_digitGetter.reset(false) );
50 
51  const CaloCell* cell=&p;
52  const TileCell* tilecell = dynamic_cast<const TileCell*> (cell);
53  if(!tilecell){
54  MsgStream log(msgSvc(), name());
55  log << MSG::ERROR
56  << "Passed CaloCell is not a TileCell" << endmsg;
57  return StatusCode::FAILURE;
58  }
59  const CaloDetDescrElement * caloDDE = tilecell->caloDDE();
60  long gain1 = tilecell->gain1();
61  long gain2 = tilecell->gain2();
62  IdentifierHash hash1 = caloDDE->onl1();
63  IdentifierHash hash2 = caloDDE->onl2();
64  if (hash1 != TileHWID::NOT_VALID_HASH) {
65  m_adcId1 = m_tilehwid->adc_id(hash1,gain1);
66  }
67  else{
68  MsgStream log(msgSvc(), name());
69  log<<MSG::DEBUG<<"TileCellDigitAssociationTool: Invalid hash on gain1"<<
70  endmsg;
71  m_adcId1.clear();
72  }
73 
74  if (hash2 != TileHWID::NOT_VALID_HASH) {
75  m_adcId2 = m_tilehwid->adc_id(hash2,gain2);
76  }
77  else{
78  MsgStream log(msgSvc(), name());
79  log<<MSG::DEBUG<<"TileCellDigitAssociationTool: Invalid hash on gain2"<<
80  endmsg;
81  m_adcId2.clear();
82  }
83 
84  return StatusCode::SUCCESS;
85 }
86 
88  if(m_nDigitReturned>1)return 0;
89 
90  const TileDigits* tiledigit=
92  while(tiledigit){
93  HWIdentifier rId=tiledigit->adc_HWID();
94  if(m_adcId1.is_valid()){
95  if(m_adcId1==rId){
97  m_adcId1.clear();
98  return tiledigit;
99  }
100  }
101  if(m_adcId2.is_valid()){
102  if(m_adcId2==rId){
104  m_adcId2.clear();
105  return tiledigit;
106  }
107  }
108  tiledigit=(const TileDigits*) m_digitGetter.nextUntyped();
109  }
110 
111  return 0;
112 }
113 
114 
115 }
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
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
D3PD::TileCellDigitAssociationTool::reset
virtual StatusCode reset(const CaloCell &p)
Return the target object.
Definition: TileCellDigitAssociationTool.cxx:46
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloTime_fillDB.gain2
gain2
Definition: CaloTime_fillDB.py:357
D3PD::MultiAssociationTool< CaloCell, TileDigits >
D3PD::TileCellDigitAssociationTool::~TileCellDigitAssociationTool
virtual ~TileCellDigitAssociationTool()
Definition: TileCellDigitAssociationTool.cxx:35
TileRawData::adc_HWID
HWIdentifier adc_HWID(void) const
Definition: TileRawData.h:53
D3PD::SGTileDigitsGetterTool::reset
StatusCode reset(bool allowMissing=false)
Reset the iteration to the start of the collection.
Definition: SGTileDigitsGetterTool.cxx:50
CaloDetDescrElement::onl1
IdentifierHash onl1() const
cell online identifier 1
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:404
AthAlgorithm.h
D3PD::TileCellDigitAssociationTool::m_adcId1
HWIdentifier m_adcId1
Definition: TileCellDigitAssociationTool.h:62
D3PD::SGTileDigitsGetterTool::nextUntyped
const void * nextUntyped()
Return a pointer to the next element in the collection.
Definition: SGTileDigitsGetterTool.cxx:71
D3PD
Block filler tool for noisy FEB information.
Definition: CaloCellDetailsFillerTool.cxx:29
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
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
TileCell.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
D3PD::TileCellDigitAssociationTool::m_nDigitReturned
int m_nDigitReturned
Definition: TileCellDigitAssociationTool.h:63
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
D3PD::TileCellDigitAssociationTool::m_tilehwid
const TileHWID * m_tilehwid
Definition: TileCellDigitAssociationTool.h:61
TileHWID::NOT_VALID_HASH
@ NOT_VALID_HASH
Definition: TileHWID.h:314
TileCell::gain1
int gain1(void) const
get gain of first PMT
Definition: TileCell.cxx:182
D3PD::TileCellDigitAssociationTool::initialize
StatusCode initialize()
Definition: TileCellDigitAssociationTool.cxx:38
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:221
TileDigits
Definition: TileDigits.h:30
TileCellDigitAssociationTool.h
D3PD::TileCellDigitAssociationTool::m_tileDigitKey
std::string m_tileDigitKey
Definition: TileCellDigitAssociationTool.h:60
TileHWID::adc_id
HWIdentifier adc_id(int ros, int drawer, int channel, int adc) const
adc HWIdentifer
Definition: TileHWID.cxx:229
TileCell::gain2
int gain2(void) const
get gain of second PMT
Definition: TileCell.cxx:189
D3PD::SGTileDigitsGetterTool::initialize
StatusCode initialize()
Standard Gaudi initialize method.
Definition: SGTileDigitsGetterTool.cxx:26
D3PD::TileCellDigitAssociationTool::next
virtual const TileDigits * next()
Return a pointer to the next element in the association.
Definition: TileCellDigitAssociationTool.cxx:87
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
D3PD::TileCellDigitAssociationTool::m_digitGetter
Getter m_digitGetter
Definition: TileCellDigitAssociationTool.h:59
D3PD::TileCellDigitAssociationTool::m_adcId2
HWIdentifier m_adcId2
Definition: TileCellDigitAssociationTool.h:62
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
TileDigits.h