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;
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) {
237 GlobalPoint weightedEmdPosition(x / sumEmE, y / sumEmE, z / sumEmE);
238 newEmPosition = weightedEmdPosition;
241 }
else if (rt_hasEcalConstit && !et_hasEcalConstit) {
243 }
else if (!rt_hasEcalConstit && et_hasEcalConstit) {
249 if (rt_hasHcalConstit) {
251 }
else if (et_hasHcalConstit) {
282 numBadHcalChan, numBadEcalChan, numRecHcalChan, numRecEcalChan, numProbHcalChan, numProbEcalChan);
edm::EDGetTokenT< CaloTowerCollection > tok_reg_
unsigned int numRecoveredEcalCells() const
T getParameter(std::string const &) 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
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
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)
#define DEFINE_FWK_MODULE(type)
const GlobalPoint & hadPosition() const
const std::vector< DetId > & constituents() const
const_iterator end() 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
iterator find(key_type k)
double outerEnergy() const
const_iterator begin() const