67 {
68 const EventContext& ctx = Gaudi::Hive::currentContext();
69
70
71 std::vector<bool>
mask;
72
73
74 unsigned long nKeep(0),nReject(0),nTotal(0);
76
77 SG::ThinningHandle<xAOD::TriggerTowerContainer> tts
79
80 mask.assign(tts->size(),
false);
81
82
83
84
85
86
87
88
89
90 bool globalSaveMe(false);
91
93 if(globalSaveMe == false){
94 ATHRNG::RNGWrapper* wrapper =
m_rndmSvc->getEngine (
this);
97 if (CLHEP::RandFlat::shoot (engine) <
m_minRandom) {
98 globalSaveMe = true;
100 }
101 }
102 }
103
104 SG::ReadDecorHandle<xAOD::TriggerTowerContainer, std::vector<float> > caloCellETByLayerHandle(
m_caloCellETByLayerKey, ctx);
105 bool isDecorAvailable = caloCellETByLayerHandle.isAvailable();
106
107
108 for(auto tt : *tts){
109
110 bool saveMe(false);
111 if(globalSaveMe == true){saveMe = true;}
112
113
114 if(saveMe == false){
115 if (isDecorAvailable) {
116 const std::vector<float>& caloCellETByLayer = caloCellETByLayerHandle(*tt);
117
118 float totalCaloCellET(0.);
119 for (float c : caloCellETByLayer) {
120 totalCaloCellET +=
c;
121 }
123 saveMe = true;
124 }
125 }
126 }
127
128
129
130 if (saveMe == false) {
131 const std::vector<uint16_t>& ttADC =
tt->adc();
132 for (uint16_t i : ttADC) {
134 saveMe = true;
135 break;
136 }
137 }
138 }
139
140
141 mask[nTotal] = saveMe;
142
143 ++nTotal;
144 }
145
146
147 tts.keep (mask);
148
149
151
154
155 ATH_MSG_DEBUG(
" L1Calo Trigger Tower Thinning statistics: keeping " << nKeep <<
" cells"
156 << " and rejecting " << nReject << " cells");
157
158
159 return StatusCode::SUCCESS;
160 }
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
SG::ReadDecorHandleKey< xAOD::TriggerTowerContainer > m_caloCellETByLayerKey
ServiceHandle< IAthRNGSvc > m_rndmSvc
SG::ThinningHandleKey< xAOD::TriggerTowerContainer > m_triggerTowerLocation