ATLAS Offline Software
Loading...
Searching...
No Matches
TileCellDetailsFillerTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5/*
6 * File: TileCellDetailsFillerTool.cxx
7 * Author: Stephen Cole <scole@niu.edu>
8 *
9 * Created on January 28, 2011, 3:12 PM
10 */
11
16#include "TileEvent/TileCell.h"
17#include "GaudiKernel/ISvcLocator.h"
18#include "GaudiKernel/StatusCode.h"
19#include "GaudiKernel/MsgStream.h"
22
23
24namespace D3PD{
25
26
28 const std::string& name,
29 const IInterface* parent):
30 BlockFillerTool<CaloCell>(type,name,parent),
31 m_tileid (0),
32 m_tilehwid(0),
33 m_cabling(0),
34 m_tileBadChanTool("TileBadChanTool"),
35 m_run2plus(false),
37 {
38 declareProperty("SaveCellDetails", m_saveCellDetails = true);
39 declareProperty("SavePositionInfo", m_savePosition = true );
40 declareProperty("TileBadChanTool", m_tileBadChanTool);
41
42 TileCellDetailsFillerTool::book().ignore(); // Avoid coverity warnings
43 }
44
45
50 {
51 CHECK( detStore()->retrieve(m_tileid) );
52 CHECK( detStore()->retrieve(m_tilehwid) );
53 CHECK( m_tileBadChanTool.retrieve() );
55 m_run2plus = m_cabling->isRun2PlusCabling();
56
57 if (m_run2plus) {
58 for (int ros = 3; ros < 5; ++ros) {
59 for (int drawer = 0; drawer < 64; ++drawer) {
60 int drawer2 = m_cabling->E1_merged_with_run2plus(ros, drawer);
61 m_notRealE1run2[ros - 3][drawer2] = (drawer2 != 0);
62 }
63 }
64 }
65
66 return StatusCode::SUCCESS;
67 }
68
69
71 if (m_savePosition) {
77 }
78
81 CHECK(addVariable("Timediff",m_tdiffCells));
95 CHECK(addVariable("QBits1",m_qbits1));
96 CHECK(addVariable("QBits2",m_qbits2));
97 }
98
99
100 return StatusCode::SUCCESS;
101 }
102
104 MsgStream log( msgSvc(), name() );
105 const EventContext& ctx = Gaudi::Hive::currentContext();
106 log << MSG::DEBUG << " in TileCellDetailsFillerTool::fill()" << endmsg;
107 const CaloCell* cell=&p;
108 const TileCell* tilecell = dynamic_cast<const TileCell*> (cell);
109 if(tilecell){
110 Identifier id = tilecell->ID();
111 if ( log.level() < MSG::DEBUG ) log << MSG::VERBOSE << " cell_id " << m_tileid->to_string(id,-2) << endmsg;
112 int partition(0);
113 uint32_t bad1(0),bad2(0);
114 long chan1(-1),chan2(-1),pmt1(-1),pmt2(-1);
115 long gain1 = tilecell->gain1();
116 long gain2 = tilecell->gain2();
117 long qual1 = tilecell->qual1();
118 long qual2 = tilecell->qual2();
119 int module = m_tileid->module(id);
120
121 const CaloDetDescrElement * caloDDE = tilecell->caloDDE();
122 IdentifierHash hash1 = (gain1<0) ? TileHWID::NOT_VALID_HASH : caloDDE->onl1();
123 IdentifierHash hash2 = (gain2<0) ? TileHWID::NOT_VALID_HASH : caloDDE->onl2();
124 if (m_savePosition) {
125 *m_xCells=tilecell->x();
126 *m_yCells=tilecell->y();
127 *m_zCells=tilecell->z();
128 *m_pmt1Cells=pmt1;
129 *m_pmt2Cells=pmt2;
130 }
131 if (m_saveCellDetails) {
132 if (hash1 != TileHWID::NOT_VALID_HASH) {
133 HWIdentifier adc_id = m_tilehwid->adc_id(hash1,gain1);
134 if ( log.level() < MSG::DEBUG ) log << MSG::VERBOSE << " adc_id1 " << m_tilehwid->to_string(adc_id) << " hash " << hash1 << " " << gain1 << endmsg;
135 partition = m_tilehwid->ros(adc_id);
136 chan1 = m_tilehwid->channel(adc_id);
137 if (m_run2plus && partition > 2 && chan1 == E1_CHANNEL && m_notRealE1run2[partition - 3][module]) chan1 = -E1_CHANNEL;
138 pmt1 = m_cabling->channel2hole(partition,chan1);
139 bad1 = m_tileBadChanTool->encodeStatus(m_tileBadChanTool->getAdcStatus(adc_id, ctx));
140 }
141 if (hash2 != TileHWID::NOT_VALID_HASH) {
142 HWIdentifier adc_id = m_tilehwid->adc_id(hash2,gain2);
143 if ( log.level() < MSG::DEBUG ) log << MSG::VERBOSE << " adc_id2 " << m_tilehwid->to_string(adc_id) << " hash " << hash2 << " " << gain2 << endmsg;
144 if (hash1 == TileHWID::NOT_VALID_HASH) partition = m_tilehwid->ros(adc_id);
145 chan2 = m_tilehwid->channel(adc_id);
146 pmt2 = m_cabling->channel2hole(partition,chan2);
147 bad2 = m_tileBadChanTool->encodeStatus(m_tileBadChanTool->getAdcStatus(adc_id, ctx));
148 }
149
150
151
152 *m_moduleCells=module+1; // Note the +1 !!!
153 *m_partitionCells=partition;
154 *m_towerCells=m_tileid->tower(id);
155 *m_sampleCells=m_tileid->sample(id);
156 *m_qbits1=tilecell->qbit1();
157 *m_qbits2=tilecell->qbit2();
158 if(gain1>=0 && ((*m_qbits1) & TileCell::MASK_BADCH)!=0 &&
159 qual1!=qual2 && (qual1!=255 || qual2!=255))
160 gain1= !gain1;
161 if(gain2>=0 && ((*m_qbits2) & TileCell::MASK_BADCH)!=0 &&
162 qual1!=qual2 && (qual1!=255 || qual2!=255))
163 gain2= !gain2;
164 *m_gain1Cells=gain1;
165 *m_gain2Cells=gain2;
166 *m_chan1Cells=chan1;
167 *m_chan2Cells=chan2;
168 if(tilecell->badch1())
169 *m_status1Cells=bad1+10;
170 else *m_status1Cells=bad1;
171 if(tilecell->badch2())
172 *m_status2Cells=bad2+10;
173 else *m_status2Cells=bad2;
174 *m_qual1Cells=qual1;
175 *m_qual2Cells=qual2;
176 *m_timeCells=tilecell->time();
177 *m_ediffCells=tilecell->eneDiff();
178 *m_tdiffCells=tilecell->timeDiff();
179 }
180 if ( log.level() < MSG::DEBUG )DumpCellInfo(); // Dump cell info only if in VERBOSE mode
181 }
182 else log << MSG::WARNING << " Cell of id "<< cell->ID()
183 <<" : TileHelper is_tile, but TileCell pointer is 0 "
184 << endmsg;
185
186
187 return StatusCode::SUCCESS;
188 }
189
191 MsgStream log( msgSvc(), name() );
192 log << MSG::INFO << "Dumping Cell info:" << endmsg;
193 if (m_savePosition) {
194 log << MSG::INFO << " X :" <<*m_xCells << endmsg;
195 log << MSG::INFO << " Y :" <<*m_yCells << endmsg;
196 log << MSG::INFO << " Z :" <<*m_zCells << endmsg;
197 log << MSG::INFO << " PMT1 :" <<*m_pmt1Cells << endmsg;
198 log << MSG::INFO << " PMT2 :" <<*m_pmt2Cells << endmsg;
199 }
200 if (m_saveCellDetails) {
201 log << MSG::INFO << " Time :" <<*m_timeCells << endmsg;
202 log << MSG::INFO << " Ediff :" <<*m_ediffCells << endmsg;
203 log << MSG::INFO << " Tdiff :" <<*m_tdiffCells << endmsg;
204 log << MSG::INFO << " Module :" <<*m_moduleCells << endmsg;
205 log << MSG::INFO << " Partition :" <<*m_partitionCells << endmsg;
206 log << MSG::INFO << " Tower :" <<*m_towerCells << endmsg;
207 log << MSG::INFO << " Sample :" <<*m_sampleCells << endmsg;
208 log << MSG::INFO << " Gain1 :" <<*m_gain1Cells << endmsg;
209 log << MSG::INFO << " Gain2 :" <<*m_gain2Cells << endmsg;
210 log << MSG::INFO << " Chan1 :" <<*m_chan1Cells << endmsg;
211 log << MSG::INFO << " Chan2 :" <<*m_chan2Cells << endmsg;
212 log << MSG::INFO << " Status1 :" <<*m_status1Cells << endmsg;
213 log << MSG::INFO << " Status2 :" <<*m_status2Cells << endmsg;
214 log << MSG::INFO << " QF1 :" <<*m_qual1Cells << endmsg;
215 log << MSG::INFO << " QF2 :" <<*m_qual2Cells << endmsg;
216 }
217 }
218
219}
220
#define endmsg
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
float time() const
get time (data member)
Definition CaloCell.h:368
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition CaloCell.h:321
float y() const
get y (through CaloDetDescrElement)
Definition CaloCell.h:436
float z() const
get z (through CaloDetDescrElement)
Definition CaloCell.h:443
float x() const
get x (through CaloDetDescrElement)
Definition CaloCell.h:429
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
Definition CaloCell.h:295
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 StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
Type-safe wrapper for block filler tools.
ToolHandle< ITileBadChanTool > m_tileBadChanTool
virtual StatusCode book()
Declare tuple variables.
virtual StatusCode fill(const CaloCell &p)
Fill one block.
virtual StatusCode initialize()
Standard Gaudi initialize method.
TileCellDetailsFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
This is a "hash" representation of an Identifier.
static const TileCablingService * getInstance()
get pointer to service instance
uint8_t qual1(void) const
get quality of first PMT (data member)
Definition TileCell.h:197
float eneDiff(void) const
all get methods
Definition TileCell.h:182
int gain2(void) const
get gain of second PMT
Definition TileCell.cxx:175
bool badch1(void) const
check if first PMT is in bad channel list and masked
Definition TileCell.h:209
uint8_t qbit2(void) const
get quality bits of second PMT (data member)
Definition TileCell.h:206
int gain1(void) const
get gain of first PMT
Definition TileCell.cxx:168
uint8_t qual2(void) const
get quality of second PMT (data member)
Definition TileCell.h:200
bool badch2(void) const
check if second PMT is in bad channel list and masked
Definition TileCell.h:212
float timeDiff(void) const
get time diff for two PMTs (data member)
Definition TileCell.h:184
@ MASK_BADCH
Definition TileCell.h:63
uint8_t qbit1(void) const
get quality bits of first PMT (data member)
Definition TileCell.h:203
@ NOT_VALID_HASH
Definition TileHWID.h:314
Block filler tool for noisy FEB information.