Retrieve MBTS cell location and details.
74 {
75
77
79
84 DataVect sampling; sampling.reserve(tileMBTSCellContainer->
size());
85 DataVect timeVec; timeVec.reserve(tileMBTSCellContainer->
size());
86 DataVect quality; quality.reserve(tileMBTSCellContainer->
size());
90 DataVect cellPedestal; cellPedestal.reserve(tileMBTSCellContainer->
size());
91 DataVect cellRawAmplitude; cellRawAmplitude.reserve(tileMBTSCellContainer->
size());
92 DataVect cellRawTime; cellRawTime.reserve(tileMBTSCellContainer->
size());
93 DataVect adcCounts; adcCounts.reserve(tileMBTSCellContainer->
size() * 10);
94
95 std::string adcCountsStr="adcCounts multiple=\"0\"";
97 const TileInfo* tileInfo = nullptr;
98 const TileCablingService*
cabling=
nullptr;
101 bool offlineRch = false;
102
104 ATH_MSG_ERROR(
"in getMBTSData(), Could not retrieve m_tileTBID" );
105 }
106
107 if ( detStore()->
retrieve(tileHWID).isFailure() ) {
108 ATH_MSG_ERROR(
"in getMBTSData(), Could not retrieve TileHWID" );
109 }
110
111 if ( detStore()->
retrieve(tileInfo,
"TileInfo").isFailure() ) {
112 ATH_MSG_ERROR(
"in getMBTSData(), Could not retrieve TileInfo" );
113 }
114
115 SG::ReadHandle<TileRawChannelContainer> RawChannelCnt;
120 }
121 else{
122 RChUnit = RawChannelCnt->get_unit();
125 }
126 }
127
128 SG::ReadHandle<TileDigitsContainer> tileDigits;
133 }
134 }
135
136
137
138 std::string MBTS_ID;
140 int nTileSamples=0;
142 double energyMeV = 0.;
143 double phiMBTS = 0.;
144 double amplitude = 0.;
145 unsigned long int cellid;
146 std::map<unsigned long int,double> theMbtspedestal;
147 std::map<unsigned long int,double> theMbtsrawamp;
148 std::map<unsigned long int,double> theMbtsrawtime;
149 std::map<unsigned long int,std::vector<float> > theMbtsdigit;
150 std::string myCellRawTimeStr = "0.";
151
152
153
155 if (offlineRch) {
156
157 for (const auto rawChannel : *RawChannelCnt) {
158 for (const auto cell : *rawChannel) {
159 Identifier pmt_id =
cell->pmt_ID();
161 Identifier
id =
cell->cell_ID();
162 cellid = id.get_identifier32().get_compact();
163 HWIdentifier hwid=
cell->adc_HWID();
164 int adc = tileHWID->
adc(hwid);
167 int ros = tileHWID->
ros(hwid);
169
170 amplitude =
cell->amplitude();
171
175 amplitude =
m_tileToolEmscale->undoOnlCalib(drawerIdx, channel, adc, amplitude, RChUnit);
176 }
177 theMbtspedestal.insert(std::make_pair( cellid,
cell->pedestal() ) );
178 theMbtsrawamp.insert(std::make_pair( cellid, amplitude ));
179 theMbtsrawtime.insert(std::make_pair( cellid,
cell->time(
cell->uncorrTime()) ));
180 break;
181
182 }
183 }
184 }
185 }
186
187
188
190
191
192
193
194 for (const auto digitChannel : *tileDigits) {
195
196 for (const auto cell : *digitChannel) {
197
198 Identifier pmt_id =
cell->pmt_ID();
200
201 Identifier
id =
cell->cell_ID();
202 cellid = id.get_identifier32().get_compact();
203
204 nTileSamples =
cell->NtimeSamples();
205 std::vector<float> tileSamples =
cell->samples();
206 theMbtsdigit.insert(std::make_pair( cellid, tileSamples));
207 break;
208
209 }
210 }
211 }
212
213
214
215 for (const auto cell : *tileMBTSCellContainer) {
216
219
221 quality.push_back(
DataType( qual ));
222
224 energyMeV =
cell->energy();
225 }else{
226 energyMeV = 0.;
227 }
229
230 Identifier
id=
cell->ID();
231
232
233
234
235
238 module.push_back(DataType( m_tileTBID->module(id) ));
239
243
245
247
251
253
254 cellPedestal.push_back(
DataType( theMbtspedestal[
id.get_identifier32().get_compact()] ));
255 cellRawAmplitude.push_back(
DataType( theMbtsrawamp[
id.get_identifier32().get_compact()] ));
256 myCellRawTimeStr =
DataType(theMbtsrawtime[
id.get_identifier32().get_compact()]).toString();
257
258 if ( myCellRawTimeStr.find('n') == 1 ) myCellRawTimeStr="0.";
259 cellRawTime.push_back( myCellRawTimeStr );
260
261
262 }
263 else {
264
267
268 if (gain<0 || gain>1) {
269 cellRawAmplitude.push_back(
DataType(0));
271 cellPedestal.push_back(
DataType(0));
272 }
273 else {
274
275 HWIdentifier hwid = tileHWID->
adc_id(
cabling->s2h_channel_id(
id),gain);
276 int adc = tileHWID->
adc(hwid);
279 int ros = tileHWID->
ros(hwid);
283 float amp;
284
286 else amp = 0.0;
288
289 if ((qual != 0 || amp != 0.0) && (fabs(time) < maxTime && time != 0.0)) {
291 }
292
293 cellRawAmplitude.push_back(
DataType(amp));
294 cellRawTime.push_back(
DataType(time));
295 cellPedestal.push_back(
DataType(0));
296 }
297 }
298
299
301
302 if ( !theMbtsdigit[
id.get_identifier32().get_compact()].
empty() ) {
303 for (
int i=0;
i<nTileSamples;
i++) {
304 adcCountsStr=
"adcCounts multiple=\""+
DataType(nTileSamples).toString()+
"\"";
305 adcCounts.push_back(
DataType(
int(theMbtsdigit[
id.get_identifier32().get_compact()][i]) ));
306 }
307 }
308 else {
309 for (
int i=0;
i<nTileSamples;
i++) {
310 adcCountsStr=
"adcCounts multiple=\""+
DataType(nTileSamples).toString()+
"\"";
312 }
313 }
314 }
315
316
317 ATH_MSG_DEBUG(
"MBTS no: " << nchan <<
", type_chan_mod: " << MBTS_ID
318 << ", energy MeV pC: " << energyMeV );
319
321
323
324 }
325
326 if (!theMbtspedestal.empty()) theMbtspedestal.clear();
327 if (!theMbtsrawamp.empty() ) theMbtsrawamp.clear();
328 if (!theMbtsrawtime.empty()) theMbtsrawtime.clear();
329
330
332 DataMap[
"energy"] = std::move(energy);
336 DataMap[
"sampling"] = std::move(sampling);
337 DataMap[
"time"] = std::move(timeVec);
338 DataMap[
"quality"] = std::move(quality);
339 DataMap[
"type"] = std::move(type);
340 DataMap[
"channel"] = std::move(channel);
341 DataMap[
"module"] = std::move(module);
342 DataMap[
"cellPedestal"] = std::move(cellPedestal);
343 DataMap[
"cellRawAmplitude"] = std::move(cellRawAmplitude);
344 DataMap[
"cellRawTime"] = std::move(cellRawTime);
345 DataMap[adcCountsStr] = std::move(adcCounts);
346
347
349
350
352
353 }
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_MSG_WARNING(x)
static const Attributes_t empty
size_type size() const noexcept
virtual std::string dataTypeName() const override
Return the name of the data type.
Gaudi::Property< double > m_mbtsThreshold
SG::ReadHandleKey< TileRawChannelContainer > m_sgKeyTileRawChannel
Gaudi::Property< bool > m_mbtsCellDetails
Gaudi::Property< bool > m_mbtsdigit
ToolHandle< TileCondToolEmscale > m_tileToolEmscale
ToolHandle< TileCondToolTiming > m_tileToolTiming
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool) override
Retrieve all the data.
const TileTBID * m_tileTBID
SG::ReadHandleKey< TileDigitsContainer > m_sgKeyTileDigits
virtual bool isValid() override final
Can the handle be successfully dereferenced?
static const TileCablingService * getInstance()
get pointer to service instance
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
int channel(const HWIdentifier &id) const
extract channel field from HW identifier
int adc(const HWIdentifier &id) const
extract adc field from HW identifier
int drawer(const HWIdentifier &id) const
extract drawer field from HW identifier
HWIdentifier adc_id(int ros, int drawer, int channel, int adc) const
adc HWIdentifer
int ros(const HWIdentifier &id) const
extract ros field from HW identifier
int NdigitSamples() const
Returns the number of sammples (digits) per event.
std::string label(const std::string &format, int i)
time(flags, cells_name, *args, **kw)
std::map< std::string, DataVect > DataMap
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())