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()) {
172 superClusters.push_back(newSC);
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()) {
195 superClusters.push_back(newSC);
198 auto superClusters_p = std::make_unique<reco::SuperClusterCollection>();
199 superClusters_p->assign(superClusters.begin(), superClusters.end());
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();
222 LogTrace(
"EcalCleaning") <<
"The new SC clean collection with size " << superClusters.size();
223 for (
unsigned int i = 0;
i < superClusters.size(); ++
i) {
225 LogTrace(
"EcalCleaning") <<
" >>> newSC #" <<
i <<
"; Energy: " << nsc.
energy() <<
" eta: " << nsc.
eta()
227 <<
" sc seed detid: " << nsc.
seed()->seed().rawId();
UncleanSCRecoveryProducer(const edm::ParameterSet &ps)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
const math::XYZPoint & position() const
cluster centroid position
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const std::string bcCollection_
#define DEFINE_FWK_MODULE(type)
void push_back(Ptr< T > const &iPtr)
edm::Ptr< CaloCluster > CaloClusterPtr
const edm::EDGetTokenT< reco::SuperClusterCollection > uncleanScCollection_
double eta() const
pseudorapidity of cluster centroid
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_
double energy() const
cluster energy
const std::string scCollection_
const edm::EDGetTokenT< reco::BasicClusterCollection > uncleanBcCollection_
T const * product() const
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
const CaloClusterPtr & seed() const
seed BasicCluster
Log< level::Warning, false > LogWarning
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents