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!";
148 LogTrace(
"EcalCleaning") <<
"Got the BasicClusters from the event again";
149 int bcSize = bccHandle->size();
154 for (
int isc = 0; isc < uncleanSize; ++isc) {
158 for (
int jbc = 0; jbc < bcSize; ++jbc) {
159 std::pair<int, int> theBcOwner = basicClusterOwner[jbc];
160 if (theBcOwner.first == isc && theBcOwner.second == 0) {
163 if (scUncleanSeedDetId[isc] == currentClu->seed()) {
175 for (
int isc = 0; isc < cleanSize; ++isc) {
177 if (not cscRef->isInUnclean())
182 for (
int jbc = 0; jbc < bcSize; ++jbc) {
183 std::pair<int, int> theBcOwner = basicClusterOwner[jbc];
184 if (theBcOwner.first == isc && theBcOwner.second == 1) {
187 if (scCleanSeedDetId[isc] == currentClu->seed()) {
197 auto superClusters_p = std::make_unique<reco::SuperClusterCollection>();
202 LogTrace(
"EcalCleaning") <<
"Clusters (Basic/Super) added to the Event! :-)";
207 LogTrace(
"EcalCleaning") <<
"Clean Collection SC ";
208 for (
int i = 0;
i < cleanSize; ++
i) {
210 LogTrace(
"EcalCleaning") <<
" >>> clean #" <<
i <<
"; Energy: " <<
csc.energy() <<
" eta: " <<
csc.eta()
211 <<
" sc seed detid: " <<
csc.seed()->seed().rawId();
214 LogTrace(
"EcalCleaning") <<
"Unclean Collection SC ";
215 for (
int i = 0;
i < uncleanSize; ++
i) {
217 LogTrace(
"EcalCleaning") <<
" >>> unclean #" <<
i <<
"; Energy: " << usc.
energy() <<
" eta: " << usc.
eta()
218 <<
" sc seed detid: " << usc.
seed()->seed().rawId();
224 LogTrace(
"EcalCleaning") <<
" >>> newSC #" <<
i <<
"; Energy: " << nsc.
energy() <<
" eta: " << nsc.
eta()
226 <<
" 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