ATLAS Offline Software
Loading...
Searching...
No Matches
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
21using namespace std;
22
23namespace D3PD{
24
26 const string& name, const IInterface* parent) :
27 Base(type,name,parent),
28 m_rawGetter(type,name,parent),
29 m_tilehwid(0),
31{
32 declareProperty("TileRawChannelSGKey",m_tileRawKey = "TileRawChannelFlt");
33
34}
35
38
40{
41 CHECK( m_rawGetter.initialize() );
42 CHECK( m_rawGetter.setProperty("SGKey",m_tileRawKey) );
43 CHECK( detStore()->retrieve(m_tilehwid) );
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=
95 (const TileRawChannel*) m_rawGetter.nextUntyped();
96 while(tileraw){
97 HWIdentifier rId=tileraw->adc_HWID();
98 if(m_adcId1.is_valid()){
99 if(m_adcId1==rId){
101 m_adcId1.clear();
102 return tileraw;
103 }
104 }
105 if(m_adcId2.is_valid()){
106 if(m_adcId2==rId){
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}
#define endmsg
#define CHECK(...)
Evaluate an expression and check for errors.
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition CaloCell.h:321
This class groups all DetDescr information related to a CaloCell.
IdentifierHash onl2() const
cell online identifier 2
IdentifierHash onl1() const
cell online identifier 1
TileCellRawAssociationTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
MultiAssociationTool< CaloCell, TileRawChannel > Base
virtual const TileRawChannel * next()
Return a pointer to the next element in the association.
virtual StatusCode reset(const CaloCell &p)
Return the target object.
This is a "hash" representation of an Identifier.
int gain2(void) const
get gain of second PMT
Definition TileCell.cxx:175
int gain1(void) const
get gain of first PMT
Definition TileCell.cxx:168
@ NOT_VALID_HASH
Definition TileHWID.h:314
HWIdentifier adc_HWID(void) const
Definition TileRawData.h:53
Block filler tool for noisy FEB information.
STL namespace.