7 #include "CLHEP/Units/SystemOfUnits.h"
11 #include "CaloDetDescr/CaloDetDescrElement.h"
35 declareInterface<IDataRetriever>(
this);
44 "Input collection to retrieve Tile digits, used when doTileDigit is True");
50 "Input collection to retrieve Tile raw channels, used when DoMBTSCellDetails is True.");
73 return StatusCode::SUCCESS;
84 if (!cellContainerMBTS.
isValid()){
96 return StatusCode::SUCCESS;
114 DataVect sampling; sampling.reserve(tileMBTSCellContainer->
size());
115 DataVect timeVec; timeVec.reserve(tileMBTSCellContainer->
size());
116 DataVect quality; quality.reserve(tileMBTSCellContainer->
size());
120 DataVect cellPedestal; cellPedestal.reserve(tileMBTSCellContainer->
size());
121 DataVect cellRawAmplitude; cellRawAmplitude.reserve(tileMBTSCellContainer->
size());
122 DataVect cellRawTime; cellRawTime.reserve(tileMBTSCellContainer->
size());
123 DataVect adcCounts; adcCounts.reserve(tileMBTSCellContainer->
size() * 10);
125 std::string adcCountsStr=
"adcCounts multiple=\"0\"";
131 bool offlineRch =
false;
134 ATH_MSG_ERROR(
"in getMBTSData(), Could not retrieve m_tileTBID" );
138 ATH_MSG_ERROR(
"in getMBTSData(), Could not retrieve TileHWID" );
142 ATH_MSG_ERROR(
"in getMBTSData(), Could not retrieve TileInfo" );
152 RChUnit = RawChannelCnt->
get_unit();
172 double energyMeV = 0.;
174 double amplitude = 0.;
175 unsigned long int cellid;
176 std::map<unsigned long int,double> theMbtspedestal;
177 std::map<unsigned long int,double> theMbtsrawamp;
178 std::map<unsigned long int,double> theMbtsrawtime;
179 std::map<unsigned long int,std::vector<float> > theMbtsdigit;
180 std::string myCellRawTimeStr =
"0.";
187 for (
const auto rawChannel : *RawChannelCnt) {
189 for (
const auto cell : *rawChannel) {
195 cellid =
id.get_identifier32().get_compact();
197 int adc = tileHWID->
adc(hwid);
200 int ros = tileHWID->
ros(hwid);
203 amplitude =
cell->amplitude();
211 theMbtspedestal.insert(std::make_pair( cellid,
cell->pedestal() ) );
212 theMbtsrawamp.insert(std::make_pair( cellid, amplitude ));
213 theMbtsrawtime.insert(std::make_pair( cellid,
cell->time(
cell->uncorrTime()) ));
228 for (
const auto digitChannel : *tileDigits) {
230 for (
const auto cell : *digitChannel) {
236 cellid =
id.get_identifier32().get_compact();
238 nTileSamples =
cell->NtimeSamples();
239 std::vector<float> tileSamples =
cell->samples();
240 theMbtsdigit.insert(std::make_pair( cellid, tileSamples));
249 for (
const auto cell : *tileMBTSCellContainer) {
258 energyMeV =
cell->energy();
288 cellPedestal.push_back(
DataType( theMbtspedestal[
id.get_identifier32().get_compact()] ));
289 cellRawAmplitude.push_back(
DataType( theMbtsrawamp[
id.get_identifier32().get_compact()] ));
290 myCellRawTimeStr =
DataType(theMbtsrawtime[
id.get_identifier32().get_compact()]).toString();
292 if ( myCellRawTimeStr.find(
"n") == 1 ) myCellRawTimeStr=
"0.";
293 cellRawTime.push_back( myCellRawTimeStr );
302 if (gain<0 || gain>1) {
303 cellRawAmplitude.push_back(
DataType(0));
305 cellPedestal.push_back(
DataType(0));
310 int adc = tileHWID->
adc(hwid);
313 int ros = tileHWID->
ros(hwid);
323 if ((
qual != 0 || amp != 0.0) && (fabs(
time) < maxTime &&
time != 0.0)) {
327 cellRawAmplitude.push_back(
DataType(amp));
329 cellPedestal.push_back(
DataType(0));
336 if ( !theMbtsdigit[
id.get_identifier32().get_compact()].
empty() ) {
337 for (
int i=0;
i<nTileSamples;
i++) {
338 adcCountsStr=
"adcCounts multiple=\""+
DataType(nTileSamples).toString()+
"\"";
339 adcCounts.push_back(
DataType(
int(theMbtsdigit[
id.get_identifier32().get_compact()][
i]) ));
343 for (
int i=0;
i<nTileSamples;
i++) {
344 adcCountsStr=
"adcCounts multiple=\""+
DataType(nTileSamples).toString()+
"\"";
352 <<
", energy MeV pC: " << energyMeV );
360 if (!theMbtspedestal.empty()) theMbtspedestal.clear();
361 if (!theMbtsrawamp.empty() ) theMbtsrawamp.clear();
362 if (!theMbtsrawtime.empty()) theMbtsrawtime.clear();
369 DataMap[
"sampling"] = sampling;
375 DataMap[
"cellPedestal"] = cellPedestal;
376 DataMap[
"cellRawAmplitude"] = cellRawAmplitude;
377 DataMap[
"cellRawTime"] = cellRawTime;
378 DataMap[adcCountsStr] = adcCounts;