Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
31 std::size_t getIndex(
const std::vector<float> &
bins,
float value)
37 if (itr ==
bins.end())
39 if (itr ==
bins.begin())
55 float start = integrals.begin()->first;
56 float end = integrals.rbegin()->first;
57 std::uniform_real_distribution<float> distr(
start,
end);
59 auto itr = integrals.lower_bound(
r);
60 if (itr == integrals.end() || itr == integrals.begin())
65 float lowBinEdge, lowBinValue, highBinEdge, highBinValue;
66 std::tie(highBinEdge, highBinValue) = *itr;
67 std::tie(lowBinEdge, lowBinValue) = *(--itr);
69 float pctDiff = (
r - lowBinEdge) / (highBinEdge - lowBinEdge);
70 return lowBinValue + pctDiff * (highBinValue - lowBinValue);
105 if (!timingFile || timingFile->IsZombie())
108 return StatusCode::FAILURE;
110 TDirectory *tdir = timingFile->GetDirectory(
"CellTiming");
114 return StatusCode::FAILURE;
118 std::regex pattern(
"Layer(\\d+)_([\\d.]+)eta([\\d.]+)_([\\d.-]+)ET([\\d.-]+)_midtrain");
119 std::map<CaloSampling::CaloSample, std::set<std::pair<float, float>>>
etaBins;
120 std::map<CaloSampling::CaloSample, std::set<std::pair<float, float>>> etBins;
121 std::map<CaloSampling::CaloSample, std::map<std::pair<std::pair<float, float>, std::pair<float, float>>,
TH1F *>> tmpHistMap;
122 std::set<CaloSampling::CaloSample> samples;
123 for (TObject *
obj : *tdir->GetListOfKeys())
125 TKey *
key =
dynamic_cast<TKey *
>(
obj);
129 return StatusCode::FAILURE;
136 if (std::strcmp(
key->GetClassName(),
"TH1F") != 0)
138 ATH_MSG_ERROR(
"Object " <<
key->GetName() <<
" not histogram as expected!");
139 return StatusCode::FAILURE;
144 auto etaBin = std::make_pair(std::stof(
match.str(2)), std::stof(
match.str(3)));
145 auto etBin = std::make_pair(std::stof(
match.str(4)), std::stof(
match.str(5)));
148 etBins[
sample].insert(etBin);
160 for (; itr !=
end; ++itr)
166 return StatusCode::FAILURE;
171 itr = etBins[
sample].begin();
177 for (; itr !=
end; ++itr)
183 return StatusCode::FAILURE;
189 for (
const auto &
p : tmpHistMap[
sample])
194 auto mapKey = std::make_tuple(
sample, etaIndex, etIndex);
196 float cumulativeSum = 0;
197 TAxis *
axis =
p.second->GetXaxis();
198 integrals[cumulativeSum] =
axis->GetBinLowEdge(1);
201 cumulativeSum +=
p.second->GetBinContent(
idx);
202 integrals[cumulativeSum] =
axis->GetBinUpEdge(
idx);
206 return StatusCode::SUCCESS;
212 auto superCells = std::make_unique<CaloCellContainer>();
215 if (!
cells.isValid())
218 return StatusCode::FAILURE;
226 if (!handle.isValid())
229 return StatusCode::FAILURE;
231 caloBCIDAvg = handle.cptr();
239 return StatusCode::FAILURE;
241 caloNoiseSigmaDiff = handle.
cptr();
248 if (!evtInfo.isValid())
251 return StatusCode::FAILURE;
255 generator.seed(evtInfo->eventNumber() * evtInfo->runNumber());
264 std::vector<float> energies(nSuperCells, 0.0);
265 std::vector<float> enTime(nSuperCells, 0.0);
266 std::vector<float> enForTime(nSuperCells, 0.0);
267 std::vector<char> timeDef(nSuperCells,
false);
268 std::vector<uint16_t> qualities(nSuperCells, 0);
269 std::vector<float> sigmaNoisePerSuperCell(nSuperCells, 0.0);
286 energies[scIDHash] +=
energy;
288 sigmaNoisePerSuperCell[scIDHash] += (*caloNoiseSigmaDiff)[cellIDHash];
292 bool isTile_BAD =
s >= 9 &&
s < 21;
293 if (
cell->provenance() & 0x2000)
295 if (
cell->energy() > 256)
298 timeDef[scIDHash] |=
true;
299 enForTime[scIDHash] +=
cell->energy();
300 enTime[scIDHash] +=
cell->energy() *
cell->time();
302 else if (!isTile_BAD)
309 if (
iEta == SIZE_MAX)
312 return StatusCode::FAILURE;
318 return StatusCode::FAILURE;
321 timeDef.at(scIDHash) |=
true;
322 enForTime.at(scIDHash) +=
cell->energy();
323 enTime.at(scIDHash) +=
cell->energy() * cellTime;
337 int side = tileCellID->
side(cellID);
339 int tower = tileCellID->
tower(cellID);
347 int tower2 = tower - 1;
355 else if (tower == 10)
370 for (std::size_t
idx = 0;
idx < energies.size(); ++
idx)
380 bool isTile_BAD =
s >= 9 &&
s < 21;
384 float sigmaNoise = sigmaNoisePerSuperCell.at(dde->
calo_hash());
385 if (!dde->
is_tile() && sigmaNoise > 0.0)
387 std::normal_distribution<double> distribution(0.0, sigmaNoise);
390 auto superCell = std::make_unique<CaloCell>();
391 superCell->setCaloDDE(dde);
392 superCell->setEnergy(
energy);
394 if (timeDef.at(
idx) && enForTime.at(
idx) != 0)
396 float time = enTime.at(
idx) / enForTime.at(
idx);
397 superCell->setTime(time);
398 float et = superCell->et();
400 if ((
et > 10
e3 && time > -8 && time < 18) || (
et <= 10
e3 && std::abs(time) < 8))
404 superCell->setTime(999.0);
405 superCell->setProvenance(prov);
407 superCells->push_back(superCell.release());
410 ATH_CHECK(superCellHandle.record(std::move(superCells)));
411 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
static std::string find_calib_file(const std::string &logical_file_name)
std::vector< float > CaloNoiseSigmaDiff
NAME : CaloNoiseSigmaDiff.h PACKAGE : Calorimeter/CaloConditions.
Extra patterns decribing particle interation process.
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
std::map< CaloSampling::CaloSample, std::vector< float > > m_etBins
Et binning read from timing file.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
ToolHandle< ICaloSuperCellIDTool > m_scidTool
Offline<->supercell mapping tool.
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
int side(const Identifier &id) const
std::map< std::tuple< CaloSampling::CaloSample, std::size_t, std::size_t >, std::map< float, float > > m_timingSamples
Timing distributions.
Helper class for Tile offline identifiers for supercells.
int tower(const Identifier &id) const
const Tile_SuperCell_ID * getTile_SuperCell_ID(void) const
const std::string & key() const
Return the StoreGate ID for the referenced object.
SG::ReadCondHandleKey< CaloNoiseSigmaDiff > m_caloNoiseSigmaDiffKey
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
std::size_t getEtIndex(CaloSampling::CaloSample sample, float et) const
bool is_valid() const
Check if id is in a valid state.
std::size_t getEtaIndex(CaloSampling::CaloSample sample, float eta) const
std::string m_cellTimingFile
The cell timing file.
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())
Handle class for recording to StoreGate.
const TileID * getTileID(void) const
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin
virtual StatusCode initialize() override
IdentifierHash calo_hash() const
cell calo hash
int module(const Identifier &id) const
Helper class for offline supercell identifiers.
Helper class for TileCal offline identifiers.
::StatusCode StatusCode
StatusCode definition for legacy code.
bool m_useNoise
Use noise values.
Helper class for offline supercell identifiers.
int sampling(const Identifier &id) const
Helper class for offline cell identifiers.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
def getRandom(smk, lhcRun)
bool is_tile() const
cell belongs to Tile
SG::WriteHandleKey< CaloCellContainer > m_outputSuperCellsKey
virtual ~SCEmulation() override
const CaloCell_ID * getCaloCell_ID(void) const
Access to IdHelper.
StatusCode initialize(bool used=true)
SG::ReadHandleKey< CaloBCIDAverage > m_caloBCIDAverageKey
std::map< CaloSampling::CaloSample, std::vector< float > > m_etaBins
eta binning read from timing file
SG::ReadHandleKey< CaloCellContainer > m_inputCellsKey
float average(const Identifier &id) const
SCEmulation(const std::string &name, ISvcLocator *pSvcLocator)
generator
Configure Herwig7 These are the commands corresponding to what would go into the regular Herwig infil...
virtual StatusCode execute(const EventContext &ctx) const override
Data object for each calorimeter readout cell.
CaloCell_ID::CaloSample getSampling() const
cell sampling
#define ATH_MSG_WARNING(x)
const CaloCell_SuperCell_ID * getCaloCell_SuperCell_ID(void) const
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
int section(const Identifier &id) const
Handle class for reading from StoreGate.
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
bool m_useBCID
Compensate for BCIDs.
Identifier cell_id(const Identifier &any_id) const
setScale setgFexType iEta
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
const CaloIdManager * m_caloIdMgr
Calo ID helpers.
SG::ReadCondHandleKey< CaloSuperCellDetDescrManager > m_caloSuperCellMgrKey
Super cell manager key.
bool match(std::string s1, std::string s2)
match the individual directories of two strings
size_type calo_cell_hash_max(void) const
cell 'global' hash table max size
const_pointer_type cptr()