|
ATLAS Offline Software
|
Go to the documentation of this file.
28 #include "GaudiKernel/ThreadLocalContext.h"
29 #include "CLHEP/Random/RandomEngine.h"
30 #include "CLHEP/Random/RandFlat.h"
40 m_nEventsProcessed(0),
41 m_nEventsAllTriggerTowersKeptByRandom(0),
42 m_nTriggerTowersProcessed(0),
43 m_nTriggerTowersKept(0),
44 m_nTriggerTowersRejected(0)
57 ATH_MSG_INFO(
"L1Calo TriggerTowerThinningAlg::initialize()");
64 return StatusCode::SUCCESS;
68 const EventContext& ctx = Gaudi::Hive::currentContext();
71 std::vector<bool>
mask;
74 unsigned long nKeep(0),nReject(0),nTotal(0);
80 mask.assign(tts->size(),
false);
90 bool globalSaveMe(
false);
93 if(globalSaveMe ==
false){
96 CLHEP::HepRandomEngine* engine = wrapper->
getEngine (ctx);
97 if (CLHEP::RandFlat::shoot (engine) <
m_minRandom) {
105 bool isDecorAvailable = caloCellETByLayerHandle.
isAvailable();
111 if(globalSaveMe ==
true){saveMe =
true;}
115 if (isDecorAvailable) {
116 const std::vector<float>& caloCellETByLayer = caloCellETByLayerHandle(*
tt);
118 float totalCaloCellET(0.);
119 for (
float c : caloCellETByLayer) {
120 totalCaloCellET +=
c;
130 if (saveMe ==
false) {
131 const std::vector<uint16_t>& ttADC =
tt->adc();
141 mask[nTotal] = saveMe;
155 ATH_MSG_DEBUG(
" L1Calo Trigger Tower Thinning statistics: keeping " << nKeep <<
" cells"
156 <<
" and rejecting " << nReject <<
" cells");
159 return StatusCode::SUCCESS;
165 "==> finalize " <<
name() <<
"...\n"
166 <<
"***************************************************************\n"
167 <<
"Results of " <<
name() <<
" thinning algorithm:\n"
173 " Average percent of Trigger Towers kept = "
178 " Percentage of events where all Trigger Towers were kept (should be approx "<< 100.0*
m_minRandom <<
") = "
183 return StatusCode::SUCCESS;
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
ServiceHandle< IAthRNGSvc > m_rndmSvc
std::atomic< unsigned long > m_nEventsProcessed
Handle for requesting thinning for a data object.
std::atomic< unsigned long > m_nEventsAllTriggerTowersKeptByRandom
virtual ~TriggerTowerThinningAlg()
std::atomic< unsigned long > m_nTriggerTowersRejected
Handle for requesting thinning for a data object.
std::atomic< unsigned long > m_nTriggerTowersKept
virtual StatusCode initialize() override
Handle class for reading a decoration on an object.
::StatusCode StatusCode
StatusCode definition for legacy code.
std::atomic< unsigned long > m_nTriggerTowersProcessed
StringProperty m_streamName
TriggerTowerThinningAlg(const std::string &t, const std::string &n, const IInterface *p)
A wrapper class for event-slot-local random engines.
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
SG::ReadDecorHandleKey< xAOD::TriggerTowerContainer > m_caloCellETByLayerKey
virtual StatusCode doThinning() const override
SG::ThinningHandleKey< xAOD::TriggerTowerContainer > m_triggerTowerLocation
Handle class for reading a decoration on an object.
bool isAvailable()
Test to see if this variable exists in the store, for the referenced object.
virtual StatusCode finalize() override