75 produces<CaloTowerCollection>();
96 <<
" are invalid. empty merged collection";
97 iEvent.
put(std::make_unique<CaloTowerCollection>());
101 regTower = extraTower;
102 iEvent.
put(std::make_unique<CaloTowerCollection>(*regTower));
106 auto output = std::make_unique<CaloTowerCollection>();
107 output->reserve(regTower->size() + extraTower->size());
114 std::vector<CaloTowerCollection::const_iterator> overlappingTowers;
115 overlappingTowers.reserve(extraTower->size());
117 for (; rt_it != rt_end; ++rt_it) {
119 if (et_it != extraTower->end()) {
129 overlappingTowers.push_back(et_it);
133 output->push_back(*rt_it);
139 for (; et_it != et_end; ++et_it) {
140 if (
std::find(overlappingTowers.begin(), overlappingTowers.end(), et_it) == overlappingTowers.end())
143 output->push_back(*et_it);
156 double newOuterE = 0;
171 bool rt_hasEcalConstit =
false;
172 bool et_hasEcalConstit =
false;
174 bool rt_hasHcalConstit =
false;
175 bool et_hasHcalConstit =
false;
179 std::vector<DetId>::const_iterator rc_begin = rt.
constituents().begin();
180 std::vector<DetId>::const_iterator rc_end = rt.
constituents().end();
181 std::vector<DetId>::const_iterator rc_it;
183 for (rc_it = rc_begin; rc_it != rc_end; ++rc_it) {
185 rt_hasHcalConstit =
true;
188 for (rc_it = rc_begin; rc_it != rc_end; ++rc_it) {
190 rt_hasEcalConstit =
true;
194 std::vector<DetId>::const_iterator ec_begin = et.
constituents().begin();
195 std::vector<DetId>::const_iterator ec_end = et.
constituents().end();
196 std::vector<DetId>::const_iterator ec_it;
198 for (ec_it = ec_begin; ec_it != ec_end; ++ec_it) {
200 et_hasHcalConstit =
true;
203 for (ec_it = ec_begin; ec_it != ec_end; ++ec_it) {
205 et_hasEcalConstit =
true;
209 std::vector<DetId> combinedConstituents = rt.
constituents();
210 for (ec_it = ec_begin; ec_it != ec_end; ++ec_it) {
213 if (
std::find(combinedConstituents.begin(), combinedConstituents.end(), *ec_it) == combinedConstituents.end())
214 combinedConstituents.push_back(*ec_it);
223 if (rt_hasEcalConstit && et_hasEcalConstit) {
231 GlobalPoint weightedEmdPosition(x / sumEmE, y / sumEmE, z / sumEmE);
232 newEmPosition = weightedEmdPosition;
235 }
else if (rt_hasEcalConstit && !et_hasEcalConstit) {
237 }
else if (!rt_hasEcalConstit && et_hasEcalConstit) {
243 if (rt_hasHcalConstit) {
245 }
else if (et_hasHcalConstit) {
276 numBadHcalChan, numBadEcalChan, numRecHcalChan, numRecEcalChan, numProbHcalChan, numProbEcalChan);
edm::EDGetTokenT< CaloTowerCollection > tok_reg_
unsigned int numRecoveredEcalCells() const
CaloTower mergedTower(const CaloTower &t1, const CaloTower &t2)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
math::PtEtaPhiMLorentzVector p4(double vtxZ) const
CaloTowersMerger(const edm::ParameterSet &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
void setCaloTowerStatus(unsigned int numBadHcalChan, unsigned int numBadEcalChan, unsigned int numRecHcalChan, unsigned int numRecEcalChan, unsigned int numProbHcalChan, unsigned int numProbEcalChan)
edm::EDGetTokenT< CaloTowerCollection > tok_ext_
std::vector< CaloTower >::const_iterator const_iterator
edm::InputTag extraTowerTag
unsigned int numRecoveredHcalCells() const
unsigned int numBadHcalCells() const
double hottestCellE() const
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const GlobalPoint & emPosition() const
void setHottestCellE(double e)
unsigned int numBadEcalCells() const
void addConstituents(const std::vector< DetId > &ids)
const GlobalPoint & hadPosition() const
const std::vector< DetId > & constituents() const
void produce(edm::Event &, const edm::EventSetup &) override
CaloTowerDetId id() const
unsigned int numProblematicEcalCells() const
edm::InputTag regularTowerTag
unsigned int numProblematicHcalCells() const
~CaloTowersMerger() override
T getParameter(std::string const &) const
double outerEnergy() const