 |
ATLAS Offline Software
|
Go to the documentation of this file.
40 if (!
m_writeAllCells)
ATH_MSG_WARNING(
"Will write all cells even if they would get truncated for GEP and/or are below the 2sigma threshold. This might lead to large output Ntuples and is not a realistic representation of GEP cells");
47 for (
int i = 0;
i < 3; ++
i) {
80 std::ifstream
file(cellMapPath.c_str());
87 int online_id, offline_id,
ch, con_num, fbr;
88 std::string feb, con_type;
91 std::getline(
file, feb);
96 file >> offline_id >> online_id >> feb >>
ch >> con_type >> con_num >> fbr;
98 if (
file.eof())
break;
101 caloCell.
id = offline_id;
104 caloCell.
fiber = fbr;
108 m_gepCellsBase.insert(std::pair<unsigned int, Gep::GepCaloCell>(caloCell.
id, caloCell));
114 ATH_MSG_ERROR(
"Could not open file containing the cell to FEB association");
115 return StatusCode::FAILURE;
118 ATH_MSG_DEBUG(
"Loaded FEB information for " << n_cells <<
" cells");
121 return StatusCode::SUCCESS;
139 CHECK(h_caloCells.isValid());
140 const auto &
cells = *h_caloCells;
145 if (!electronicNoiseHdl.isValid()) {
return StatusCode::FAILURE;}
146 const CaloNoise* electronicNoiseCDO = *electronicNoiseHdl;
149 if (!totalNoiseHdl.isValid()) {
return StatusCode::FAILURE;}
150 const CaloNoise* totalNoiseCDO = *totalNoiseHdl;
153 std::map<std::string,std::vector<Gep::GepCaloCell>> gepCellsPerFEB;
160 caloCell.
id = (
cell->ID().get_identifier32()).get_compact();
162 if (base_cell_itr !=
m_gepCellsBase.end()) caloCell = base_cell_itr->second;
166 caloCell.
FEB =
"Tile";
169 float electronicNoise = electronicNoiseCDO->
getNoise(
cell->ID(),
cell->gain());
176 caloCell.offline_et =
cell->energy() / TMath::CosH(
cell->eta());
179 caloCell.e = caloCell.et * TMath::CosH(
cell->eta());
182 caloCell.e =
cell->energy();
183 caloCell.et = caloCell.offline_et;
185 caloCell.time =
cell->time();
186 caloCell.quality =
cell->quality();
187 caloCell.provenance =
cell->provenance();
189 caloCell.totalNoise = totalNoise;
190 caloCell.electronicNoise = electronicNoise;
191 caloCell.sigma =
cell->energy() / totalNoise;
193 caloCell.isBad =
cell->badcell();
194 caloCell.eta =
cell->eta();
195 caloCell.phi =
cell->phi();
196 caloCell.sinTh =
cell->sinTh();
197 caloCell.cosTh =
cell->cosTh();
198 caloCell.sinPhi =
cell->sinPhi();
199 caloCell.cosPhi =
cell->cosPhi();
200 caloCell.cotTh =
cell->cotTh();
201 caloCell.x =
cell->x();
202 caloCell.y =
cell->y();
203 caloCell.z =
cell->z();
208 bool IsEM_Barrel=
false;
209 bool IsEM_EndCap=
false;
210 bool IsEM_BarrelPos=
false;
211 bool IsEM_BarrelNeg=
false;
220 caloCell.isEM =
IsEM;
221 caloCell.isEM_barrel = IsEM_Barrel;
222 caloCell.isEM_endCap = IsEM_EndCap;
223 caloCell.isEM_barrelPos = IsEM_BarrelPos;
224 caloCell.isEM_barrelNeg = IsEM_BarrelNeg;
229 caloCell.sampling = samplingEnum;
233 caloCell.id = (
cell->ID().get_identifier32()).get_compact();
236 caloCell.layer =
cell->caloDDE()->getLayer();
238 float deta = elt->
deta();
239 float dphi = elt->
dphi();
241 float etamin = caloCell.eta - (0.5*deta);
242 float etamax = caloCell.eta + (0.5*deta);
244 float phimin = caloCell.phi - (0.5*dphi);
245 float phimax = caloCell.phi + (0.5*dphi);
248 caloCell.etaMax = etamax;
249 caloCell.phiMin = phimin;
250 caloCell.phiMax = phimax;
251 caloCell.etaGranularity = deta;
252 caloCell.phiGranularity = dphi;
254 caloCell.index =
idx;
257 auto feb_itr = gepCellsPerFEB.find(caloCell.FEB);
258 if (feb_itr != gepCellsPerFEB.end()) feb_itr->second.push_back(caloCell);
260 std::vector<Gep::GepCaloCell> cellsThisFEB;
261 cellsThisFEB.push_back(caloCell);
262 gepCellsPerFEB.insert(std::pair<std::string,std::vector<Gep::GepCaloCell>>(caloCell.FEB,cellsThisFEB));
269 auto itr = gepCellsPerFEB.begin();
270 for ( ;itr != gepCellsPerFEB.end(); ++itr) {
273 if (m_doTruncationOfOverflowingFEBs && itr->second.size() > m_maxCellsPerFEB && itr->first !=
"Tile" && !m_writeAllCells) {
274 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.");
275 CHECK(removeCellsFromOverloadedFEB(itr->second));
280 ATH_MSG_DEBUG(
"GEP is receiving a total of " << gepCellMap.
size() <<
" cells in this event");
283 ATH_CHECK( h_gepCellMap.
record( std::make_unique<Gep::GepCellMap>(gepCellMap) ) );
285 return StatusCode::SUCCESS;
296 int readoutRange = 0;
297 for (
int i = 1;
i <= 3; ++
i) {
316 const EventContext&)
const {
319 std::vector<IdentifierHash> cellNeighbours;
324 std::vector<unsigned int> neighbour_ids;
325 for (
unsigned int iNeighbour = 0;
326 iNeighbour < cellNeighbours.size();
338 return neighbour_ids;
345 std::map<int,Gep::GepCaloCell> orderedCells;
347 orderedCells.insert(std::pair<int,Gep::GepCaloCell>(
cell.channel,
cell));
352 for ( ;cell_itr != orderedCells.end(); ++cell_itr) {
353 cells.push_back(cell_itr->second);
357 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
JetConstituentVector::iterator iterator
virtual StatusCode initialize() override
@ IsEM
cut-based identification for egamma objects (cluster and track-based)
void insert(unsigned int id, const Gep::GepCaloCell &cell)
StatusCode setLeastSignificantBit(int value)
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
std::map< unsigned int, Gep::GepCaloCell > m_gepCellsBase
bool is_em_endcap(const Identifier id) const
test if the id belongs to the EM Endcap
int pos_neg(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
SG::WriteHandleKey< Gep::GepCellMap > m_outputGepCellsKey
double dphi() const
delta phi
SG::ReadCondHandleKey< CaloNoise > m_electronicNoiseKey
Key of the CaloNoise Conditions data object.
SG::ReadHandleKey< CaloCellContainer > m_caloCellsKey
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
std::vector< unsigned int > getNeighbours(const CaloCellContainer &allcells, const CaloCell *acell, const EventContext &) const
int calo_sample(const Identifier id) const
returns an int taken from Sampling enum and describing the subCalo to which the Id belongs.
bool is_tile(const Identifier id) const
test if the id belongs to the Tiles
float getNoise(const IdentifierHash h, const int gain) const
Accessor by IdentifierHash and gain.
bool is_hec(const Identifier id) const
test if the id belongs to the HEC
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
An algorithm that can be simultaneously executed in multiple threads.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Gaudi::Property< bool > m_doGepHardwareStyleEnergyEncoding
bool is_em(const Identifier id) const
test if the id belongs to LArEM
bool is_fcal(const Identifier id) const
test if the id belongs to the FCAL - true also for MiniFCAL
::StatusCode StatusCode
StatusCode definition for legacy code.
std::string connection_type
virtual StatusCode execute(const EventContext &) const override
Gaudi::Property< std::string > m_GepEnergyEncodingScheme
SG::ReadCondHandleKey< CaloNoise > m_totalNoiseKey
#define CHECK(...)
Evaluate an expression and check for errors.
unsigned m_maxCellsPerFEB
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
double deta() const
delta eta
const CaloCell * findCell(const IdentifierHash theHash) const
fast find method given identifier hash.
Gaudi::Property< std::string > m_LArCellMap
bool is_em_barrel(const Identifier id) const
test if the id belongs to the EM barrel
StatusCode removeCellsFromOverloadedFEB(std::vector< Gep::GepCaloCell > &cells) const
GepCellsHandlerAlg(const std::string &name, ISvcLocator *pSvcLocator)
std::string to_string(const DetectorType &type)
Gaudi::Property< bool > m_writeAllCells
int get_neighbours(const IdentifierHash caloHash, const LArNeighbours::neighbourOption &option, std::vector< IdentifierHash > &neighbourList) const
access to hashes for neighbours return == 0 for neighbours found
StatusCode initialize(bool used=true)
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
Container class for CaloCell.
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
StatusCode setNumberOfEnergyBits(int value)
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Data object for each calorimeter readout cell.
This is a base class for LAr and Tile Descriptors The primary goal is to speed up loops over all the ...
#define ATH_MSG_WARNING(x)
const CaloCell_ID * m_CaloCell_ID
int getGepEnergy(float offline_et) const
static std::string getSamplingName(CaloSample theSample)
Returns a string (name) for each CaloSampling.
StatusCode setG(int value)
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Gaudi::Property< bool > m_doTruncationOfOverflowingFEBs
constexpr int pow(int base, int exp) noexcept