81 produces<CaloTowerCollection>();
102 <<
" are invalid. empty merged collection";
103 iEvent.put(std::make_unique<CaloTowerCollection>());
107 regTower = extraTower;
108 iEvent.put(std::make_unique<CaloTowerCollection>(*regTower));
112 auto output = std::make_unique<CaloTowerCollection>();
120 std::vector<CaloTowerCollection::const_iterator> overlappingTowers;
121 overlappingTowers.reserve(extraTower->
size());
123 for (; rt_it != rt_end; ++rt_it) {
125 if (et_it != extraTower->
end()) {
135 overlappingTowers.push_back(et_it);
139 output->push_back(*rt_it);
145 for (; et_it != et_end; ++et_it) {
146 if (
std::find(overlappingTowers.begin(), overlappingTowers.end(), et_it) == overlappingTowers.end())
149 output->push_back(*et_it);
162 double newOuterE = 0;
170 if (
rt.ietaAbs() < 16 && (fabs(
rt.outerEnergy() -
et.outerEnergy()) < 0.00001)) {
172 newOuterE =
rt.outerEnergy();
174 newOuterE =
rt.outerEnergy() +
et.outerEnergy();
177 bool rt_hasEcalConstit =
false;
178 bool et_hasEcalConstit =
false;
180 bool rt_hasHcalConstit =
false;
181 bool et_hasHcalConstit =
false;
185 std::vector<DetId>::const_iterator rc_begin =
rt.constituents().begin();
186 std::vector<DetId>::const_iterator rc_end =
rt.constituents().end();
187 std::vector<DetId>::const_iterator rc_it;
189 for (rc_it = rc_begin; rc_it != rc_end; ++rc_it) {
191 rt_hasHcalConstit =
true;
194 for (rc_it = rc_begin; rc_it != rc_end; ++rc_it) {
196 rt_hasEcalConstit =
true;
200 std::vector<DetId>::const_iterator ec_begin =
et.constituents().begin();
201 std::vector<DetId>::const_iterator ec_end =
et.constituents().end();
202 std::vector<DetId>::const_iterator ec_it;
204 for (ec_it = ec_begin; ec_it != ec_end; ++ec_it) {
206 et_hasHcalConstit =
true;
209 for (ec_it = ec_begin; ec_it != ec_end; ++ec_it) {
211 et_hasEcalConstit =
true;
215 std::vector<DetId> combinedConstituents =
rt.constituents();
216 for (ec_it = ec_begin; ec_it != ec_end; ++ec_it) {
219 if (
std::find(combinedConstituents.begin(), combinedConstituents.end(), *ec_it) == combinedConstituents.end())
220 combinedConstituents.push_back(*ec_it);
229 if (rt_hasEcalConstit && et_hasEcalConstit) {
230 if (
rt.emEnergy() > 0 &&
et.emEnergy() > 0) {
231 double sumEmE =
rt.emEnergy() +
et.emEnergy();
233 double x =
rt.emEnergy() *
rt.emPosition().x() +
et.emEnergy() *
et.emPosition().x();
234 double y =
rt.emEnergy() *
rt.emPosition().y() +
et.emEnergy() *
et.emPosition().y();
235 double z =
rt.emEnergy() *
rt.emPosition().z() +
et.emEnergy() *
et.emPosition().z();
237 GlobalPoint weightedEmdPosition(
x / sumEmE,
y / sumEmE,
z / sumEmE);
238 newEmPosition = weightedEmdPosition;
241 }
else if (rt_hasEcalConstit && !et_hasEcalConstit) {
242 newEmPosition =
rt.emPosition();
243 }
else if (!rt_hasEcalConstit && et_hasEcalConstit) {
244 newEmPosition =
et.emPosition();
249 if (rt_hasHcalConstit) {
250 newHadPosition =
rt.hadPosition();
251 }
else if (et_hasHcalConstit) {
252 newHadPosition =
et.hadPosition();
258 rt.emEnergy() +
et.emEnergy(),
259 rt.hadEnergy() +
et.hadEnergy(),
272 unsigned int numBadHcalChan =
rt.numBadHcalCells() -
et.numProblematicHcalCells() -
rt.numRecoveredHcalCells();
273 unsigned int numBadEcalChan =
rt.numBadEcalCells() -
et.numProblematicEcalCells() -
rt.numRecoveredEcalCells();
275 unsigned int numProbHcalChan =
rt.numProblematicHcalCells() +
et.numProblematicHcalCells();
276 unsigned int numProbEcalChan =
rt.numProblematicEcalCells() +
et.numProblematicEcalCells();
278 unsigned int numRecHcalChan =
rt.numRecoveredHcalCells() +
et.numRecoveredHcalCells();
279 unsigned int numRecEcalChan =
rt.numRecoveredEcalCells() +
et.numRecoveredEcalCells();
282 numBadHcalChan, numBadEcalChan, numRecHcalChan, numRecEcalChan, numProbHcalChan, numProbEcalChan);