ATLAS Offline Software
Loading...
Searching...
No Matches
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"
16#include "TileEvent/TileCell.h"
17
19
20using namespace std;
21
22namespace D3PD{
23
25 const string& name, const IInterface* parent) :
26 Base(type,name,parent),
27 m_digitGetter(type,name,parent),
28 m_tilehwid(0),
30{
31 declareProperty("TileDigitsSGKey",m_tileDigitKey = "TileDigitsFlt");
32}
33
34
37
39{
40 CHECK( m_digitGetter.initialize()) ;
41 CHECK( m_digitGetter.setProperty("SGKey",m_tileDigitKey) );
42 CHECK( detStore()->retrieve(m_tilehwid) );
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=
91 (const TileDigits*) m_digitGetter.nextUntyped();
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}
#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
virtual const TileDigits * next()
Return a pointer to the next element in the association.
TileCellDigitAssociationTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
MultiAssociationTool< CaloCell, TileDigits > Base
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.