7 #include "CLHEP/Units/SystemOfUnits.h"
11 #include "CaloDetDescr/CaloDetDescrElement.h"
34 declareInterface<IDataRetriever>(
this);
43 "Input collection to retrieve Tile digits, used when doTileDigit is True");
49 "Input collection to retrieve Tile raw channels, used when DoMBTSCellDetails is True.");
72 return StatusCode::SUCCESS;
83 if (!cellContainerMBTS.
isValid()){
95 return StatusCode::SUCCESS;
111 DataVect phi; phi.reserve(tileMBTSCellContainer->
size());
112 DataVect eta; eta.reserve(tileMBTSCellContainer->
size());
113 DataVect sampling; sampling.reserve(tileMBTSCellContainer->
size());
114 DataVect timeVec; timeVec.reserve(tileMBTSCellContainer->
size());
115 DataVect quality; quality.reserve(tileMBTSCellContainer->
size());
119 DataVect cellPedestal; cellPedestal.reserve(tileMBTSCellContainer->
size());
120 DataVect cellRawAmplitude; cellRawAmplitude.reserve(tileMBTSCellContainer->
size());
121 DataVect cellRawTime; cellRawTime.reserve(tileMBTSCellContainer->
size());
122 DataVect adcCounts; adcCounts.reserve(tileMBTSCellContainer->
size() * 10);
124 std::string adcCountsStr=
"adcCounts multiple=\"0\"";
130 bool offlineRch =
false;
133 ATH_MSG_ERROR(
"in getMBTSData(), Could not retrieve m_tileTBID" );
137 ATH_MSG_ERROR(
"in getMBTSData(), Could not retrieve TileHWID" );
141 ATH_MSG_ERROR(
"in getMBTSData(), Could not retrieve TileInfo" );
151 RChUnit = RawChannelCnt->
get_unit();
171 double energyMeV = 0.;
173 double amplitude = 0.;
174 unsigned long int cellid;
175 std::map<unsigned long int,double> theMbtspedestal;
176 std::map<unsigned long int,double> theMbtsrawamp;
177 std::map<unsigned long int,double> theMbtsrawtime;
178 std::map<unsigned long int,std::vector<float> > theMbtsdigit;
179 std::string myCellRawTimeStr =
"0.";
186 for (
const auto rawChannel : *RawChannelCnt) {
187 for (
const auto cell : *rawChannel) {
191 cellid =
id.get_identifier32().get_compact();
193 int adc = tileHWID->
adc(hwid);
196 int ros = tileHWID->
ros(hwid);
199 amplitude =
cell->amplitude();
206 theMbtspedestal.insert(std::make_pair( cellid,
cell->pedestal() ) );
207 theMbtsrawamp.insert(std::make_pair( cellid, amplitude ));
208 theMbtsrawtime.insert(std::make_pair( cellid,
cell->time(
cell->uncorrTime()) ));
223 for (
const auto digitChannel : *tileDigits) {
225 for (
const auto cell : *digitChannel) {
231 cellid =
id.get_identifier32().get_compact();
233 nTileSamples =
cell->NtimeSamples();
234 std::vector<float> tileSamples =
cell->samples();
235 theMbtsdigit.insert(std::make_pair( cellid, tileSamples));
244 for (
const auto cell : *tileMBTSCellContainer) {
253 energyMeV =
cell->energy();
283 cellPedestal.push_back(
DataType( theMbtspedestal[
id.get_identifier32().get_compact()] ));
284 cellRawAmplitude.push_back(
DataType( theMbtsrawamp[
id.get_identifier32().get_compact()] ));
285 myCellRawTimeStr =
DataType(theMbtsrawtime[
id.get_identifier32().get_compact()]).toString();
287 if ( myCellRawTimeStr.find(
'n') == 1 ) myCellRawTimeStr=
"0.";
288 cellRawTime.push_back( myCellRawTimeStr );
297 if (gain<0 || gain>1) {
298 cellRawAmplitude.push_back(
DataType(0));
300 cellPedestal.push_back(
DataType(0));
305 int adc = tileHWID->
adc(hwid);
308 int ros = tileHWID->
ros(hwid);
316 float time =
cell->time();
318 if ((
qual != 0 || amp != 0.0) && (fabs(time) < maxTime && time != 0.0)) {
322 cellRawAmplitude.push_back(
DataType(amp));
323 cellRawTime.push_back(
DataType(time));
324 cellPedestal.push_back(
DataType(0));
331 if ( !theMbtsdigit[
id.get_identifier32().get_compact()].
empty() ) {
332 for (
int i=0;
i<nTileSamples;
i++) {
333 adcCountsStr=
"adcCounts multiple=\""+
DataType(nTileSamples).toString()+
"\"";
334 adcCounts.push_back(
DataType(
int(theMbtsdigit[
id.get_identifier32().get_compact()][
i]) ));
338 for (
int i=0;
i<nTileSamples;
i++) {
339 adcCountsStr=
"adcCounts multiple=\""+
DataType(nTileSamples).toString()+
"\"";
347 <<
", energy MeV pC: " << energyMeV );
355 if (!theMbtspedestal.empty()) theMbtspedestal.clear();
356 if (!theMbtsrawamp.empty() ) theMbtsrawamp.clear();
357 if (!theMbtsrawtime.empty()) theMbtsrawtime.clear();
363 DataMap[
"phi"] = std::move(phi);
364 DataMap[
"eta"] = std::move(eta);
365 DataMap[
"sampling"] = std::move(sampling);
366 DataMap[
"time"] = std::move(timeVec);
367 DataMap[
"quality"] = std::move(quality);
371 DataMap[
"cellPedestal"] = std::move(cellPedestal);
372 DataMap[
"cellRawAmplitude"] = std::move(cellRawAmplitude);
373 DataMap[
"cellRawTime"] = std::move(cellRawTime);
374 DataMap[adcCountsStr] = std::move(adcCounts);