12 const std::string&
name,
38 for (
int i = 0;
i < 3; ++
i) {
66 ATH_MSG_INFO(
"Loading cell map associating cells to FEBs");
71 std::ifstream
file(cellMapPath.c_str());
78 int online_id, offline_id,
ch, con_num, fbr;
79 std::string feb, con_type;
82 std::getline(
file, feb);
87 file >> offline_id >> online_id >> feb >>
ch >> con_type >> con_num >> fbr;
89 if (
file.eof())
break;
92 caloCell.
id = offline_id;
99 m_gepCellsBase.insert(std::pair<unsigned int, Gep::GepCaloCell>(caloCell.
id, caloCell));
105 ATH_MSG_ERROR(
"Could not open file containing the cell to FEB association");
106 return StatusCode::FAILURE;
109 ATH_MSG_INFO(
"Loaded FEB information for " << n_cells <<
" cells");
112 return StatusCode::SUCCESS;
119 const EventContext& ctx)
const {
130 if (!electronicNoiseHdl.isValid()) {
return StatusCode::FAILURE;}
131 const CaloNoise* electronicNoiseCDO = *electronicNoiseHdl;
134 if (!totalNoiseHdl.isValid()) {
return StatusCode::FAILURE;}
135 const CaloNoise* totalNoiseCDO = *totalNoiseHdl;
138 std::map<std::string,std::vector<Gep::GepCaloCell>> gepCellsPerFEB;
145 caloCell.
id = (
cell->ID().get_identifier32()).get_compact();
147 if (base_cell_itr !=
m_gepCellsBase.end()) caloCell = base_cell_itr->second;
151 caloCell.
FEB =
"Tile";
154 float electronicNoise = electronicNoiseCDO->
getNoise(
cell->ID(),
cell->gain());
158 if ((
cell->energy() / totalNoise) < 2.0)
continue;
163 caloCell.e = caloCell.et * TMath::CosH(
cell->eta());
166 caloCell.e =
cell->energy();
167 caloCell.et = caloCell.e / TMath::CosH(
cell->eta());
169 caloCell.time =
cell->time();
170 caloCell.quality =
cell->quality();
171 caloCell.provenance =
cell->provenance();
173 caloCell.totalNoise = totalNoise;
174 caloCell.electronicNoise = electronicNoise;
175 caloCell.sigma =
cell->energy() / totalNoise;
177 caloCell.isBad =
cell->badcell();
178 caloCell.eta =
cell->eta();
179 caloCell.phi =
cell->phi();
180 caloCell.sinTh =
cell->sinTh();
181 caloCell.cosTh =
cell->cosTh();
182 caloCell.sinPhi =
cell->sinPhi();
183 caloCell.cosPhi =
cell->cosPhi();
184 caloCell.cotTh =
cell->cotTh();
185 caloCell.x =
cell->x();
186 caloCell.y =
cell->y();
187 caloCell.z =
cell->z();
192 bool IsEM_Barrel=
false;
193 bool IsEM_EndCap=
false;
194 bool IsEM_BarrelPos=
false;
195 bool IsEM_BarrelNeg=
false;
204 caloCell.isEM =
IsEM;
205 caloCell.isEM_barrel = IsEM_Barrel;
206 caloCell.isEM_endCap = IsEM_EndCap;
207 caloCell.isEM_barrelPos = IsEM_BarrelPos;
208 caloCell.isEM_barrelNeg = IsEM_BarrelNeg;
213 caloCell.sampling = samplingEnum;
217 caloCell.id = (
cell->ID().get_identifier32()).get_compact();
220 caloCell.layer =
cell->caloDDE()->getLayer();
222 float deta = elt->
deta();
223 float dphi = elt->
dphi();
225 float etamin = caloCell.eta - (0.5*deta);
226 float etamax = caloCell.eta + (0.5*deta);
228 float phimin = caloCell.phi - (0.5*dphi);
229 float phimax = caloCell.phi + (0.5*dphi);
232 caloCell.etaMax = etamax;
233 caloCell.phiMin = phimin;
234 caloCell.phiMax = phimax;
235 caloCell.etaGranularity = deta;
236 caloCell.phiGranularity = dphi;
238 caloCell.index =
idx;
241 auto feb_itr = gepCellsPerFEB.find(caloCell.FEB);
242 if (feb_itr != gepCellsPerFEB.end()) feb_itr->second.push_back(caloCell);
244 std::vector<Gep::GepCaloCell> cellsThisFEB;
245 cellsThisFEB.push_back(caloCell);
246 gepCellsPerFEB.insert(std::pair<std::string,std::vector<Gep::GepCaloCell>>(caloCell.FEB,cellsThisFEB));
251 auto itr = gepCellsPerFEB.begin();
252 for ( ;itr != gepCellsPerFEB.end(); ++itr) {
255 if (m_doTruncationOfOverflowingFEBs && itr->second.size() > m_maxCellsPerFEB && itr->first !=
"Tile") {
256 ATH_MSG_DEBUG(
"FEB " << itr->first <<
" is sending " << itr->second.size() <<
" cells, which is more cells than GEP can receive. Removing all but the possible " << m_maxCellsPerFEB <<
" cells.");
257 CHECK(removeCellsFromOverloadedFEB(itr->second));
260 gepCellsMap->insert(std::pair<unsigned int, Gep::GepCaloCell>(
cell.id,
cell));
262 ATH_MSG_DEBUG(
"GEP is receiving a total of " << gepCellsMap->size() <<
" cells in this event");
264 return StatusCode::SUCCESS;
274 int readoutRange = 0;
275 for (
int i = 1;
i <= 3; ++
i) {
292 std::vector<unsigned int>
295 const EventContext&)
const {
298 std::vector<IdentifierHash> cellNeighbours;
303 std::vector<unsigned int> neighbour_ids;
304 for (
unsigned int iNeighbour = 0;
305 iNeighbour < cellNeighbours.size();
317 return neighbour_ids;
324 std::map<int,Gep::GepCaloCell> orderedCells;
326 orderedCells.insert(std::pair<int,Gep::GepCaloCell>(
cell.channel,
cell));
331 for ( ;cell_itr != orderedCells.end(); ++cell_itr) {
332 cells.push_back(cell_itr->second);
336 return StatusCode::SUCCESS;