62 bcCollection_(ps.getParameter<
std::
string>(
"bcCollection")),
63 scCollection_(ps.getParameter<
std::
string>(
"scCollection")) {
88 int uncleanSize = pUncleanSC->size();
89 int cleanSize = pCleanSC->size();
91 LogTrace(
"EcalCleaning") <<
"Size of Clean Collection: " << cleanSize <<
", uncleanSize: " << uncleanSize;
105 std::vector<std::pair<int, int> > basicClusterOwner;
107 std::vector<DetId> scUncleanSeedDetId;
108 for (
int isc = 0; isc < uncleanSize; ++isc) {
110 scUncleanSeedDetId.push_back(unsc.
seed()->seed());
114 basicClusters.push_back(**bciter);
116 basicClusterOwner.push_back(std::make_pair(isc, 0));
122 std::vector<DetId> scCleanSeedDetId;
123 std::vector<int> isToBeKept;
124 for (
int isc = 0; isc < cleanSize; ++isc) {
126 scCleanSeedDetId.push_back(cscRef->seed()->seed());
129 basicClusters.push_back(**bciter);
131 basicClusterOwner.push_back(std::make_pair(isc, 1));
133 if (cscRef->isInUnclean())
134 isToBeKept.push_back(1);
136 isToBeKept.push_back(0);
140 auto basicClusters_p = std::make_unique<reco::BasicClusterCollection>();
141 basicClusters_p->assign(basicClusters.begin(), basicClusters.end());
144 edm::LogWarning(
"MissingInput") <<
"could not handle the new BasicClusters!";
149 LogTrace(
"EcalCleaning") <<
"Got the BasicClusters from the event again";
150 int bcSize = bccHandle->size();
155 for (
int isc = 0; isc < uncleanSize; ++isc) {
159 for (
int jbc = 0; jbc < bcSize; ++jbc) {
160 std::pair<int, int> theBcOwner = basicClusterOwner[jbc];
161 if (theBcOwner.first == isc && theBcOwner.second == 0) {
164 if (scUncleanSeedDetId[isc] == currentClu->seed()) {
176 for (
int isc = 0; isc < cleanSize; ++isc) {
178 if (not cscRef->isInUnclean())
183 for (
int jbc = 0; jbc < bcSize; ++jbc) {
184 std::pair<int, int> theBcOwner = basicClusterOwner[jbc];
185 if (theBcOwner.first == isc && theBcOwner.second == 1) {
188 if (scCleanSeedDetId[isc] == currentClu->seed()) {
198 auto superClusters_p = std::make_unique<reco::SuperClusterCollection>();
203 LogTrace(
"EcalCleaning") <<
"Clusters (Basic/Super) added to the Event! :-)";
208 LogTrace(
"EcalCleaning") <<
"Clean Collection SC ";
209 for (
int i = 0;
i < cleanSize; ++
i) {
211 LogTrace(
"EcalCleaning") <<
" >>> clean #" <<
i <<
"; Energy: " <<
csc.energy() <<
" eta: " <<
csc.eta()
212 <<
" sc seed detid: " <<
csc.seed()->seed().rawId();
215 LogTrace(
"EcalCleaning") <<
"Unclean Collection SC ";
216 for (
int i = 0;
i < uncleanSize; ++
i) {
218 LogTrace(
"EcalCleaning") <<
" >>> unclean #" <<
i <<
"; Energy: " << usc.
energy() <<
" eta: " << usc.
eta()
219 <<
" sc seed detid: " << usc.
seed()->seed().rawId();
225 LogTrace(
"EcalCleaning") <<
" >>> newSC #" <<
i <<
"; Energy: " << nsc.
energy() <<
" eta: " << nsc.
eta()
227 <<
" sc seed detid: " << nsc.
seed()->seed().rawId();
const math::XYZPoint & position() const
cluster centroid position
UncleanSCRecoveryProducer(const edm::ParameterSet &ps)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const std::string bcCollection_
void push_back(Ptr< T > const &iPtr)
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
T const * product() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::Ptr< CaloCluster > CaloClusterPtr
const edm::EDGetTokenT< reco::SuperClusterCollection > uncleanScCollection_
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
const edm::EDGetTokenT< reco::SuperClusterCollection > cleanScCollection_
void setFlags(uint32_t flags)
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
const edm::EDGetTokenT< reco::BasicClusterCollection > cleanBcCollection_
#define DEFINE_FWK_MODULE(type)
const std::string scCollection_
double energy() const
cluster energy
const edm::EDGetTokenT< reco::BasicClusterCollection > uncleanBcCollection_
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
const CaloClusterPtr & seed() const
seed BasicCluster
double eta() const
pseudorapidity of cluster centroid
Log< level::Warning, false > LogWarning