119 int uncleanSize = pUncleanSC->size();
120 int cleanSize = pCleanSC->size();
122 LogTrace(
"EcalCleaning") <<
"Size of Clean Collection: " << cleanSize <<
", uncleanSize: " << uncleanSize
126 std::vector<int> isUncleanOnly;
127 std::vector<int> basicClusterOwner;
128 std::vector<int> isSeed;
129 for (
int isc = 0; isc < uncleanSize; ++isc) {
131 const std::vector<std::pair<DetId, float> >& uhits = unscRef->hitsAndFractions();
132 int uhitsSize = uhits.size();
133 bool foundTheSame =
false;
134 for (
int jsc = 0; jsc < cleanSize; ++jsc) {
136 const std::vector<std::pair<DetId, float> >& chits = cscRef->hitsAndFractions();
137 int chitsSize = chits.size();
139 if (unscRef->seed()->seed() == cscRef->seed()->seed() && chitsSize == uhitsSize) {
143 for (
int i = 0;
i < chitsSize; ++
i) {
145 foundTheSame =
false;
153 isUncleanOnly.push_back(0);
158 if (not foundTheSame) {
160 isUncleanOnly.push_back(1);
164 basicClusters.push_back(**bciter);
165 basicClusterOwner.push_back(isc);
169 int bcSize = basicClusters.size();
171 LogDebug(
"EcalCleaning") <<
"Found cleaned SC: " << cleanSize <<
" uncleaned SC: " << uncleanSize <<
" from which " 172 << scRefs->
size() <<
" will become refs to the cleaned collection";
177 auto basicClusters_p = std::make_unique<reco::BasicClusterCollection>();
178 basicClusters_p->assign(basicClusters.begin(), basicClusters.end());
181 edm::LogWarning(
"MissingInput") <<
"could not get a handle on the BasicClusterCollection!" << std::endl;
185 LogDebug(
"EcalCleaning") <<
"Got the BasicClusters from the event again";
189 for (
int isc = 0; isc < uncleanSize; ++isc) {
190 if (isUncleanOnly[isc] == 1) {
195 for (
int jbc = 0; jbc < bcSize; ++jbc) {
196 if (basicClusterOwner[jbc] == isc) {
199 if (energy < currentClu->
energy()) {
200 energy = currentClu->energy();
211 std::unique_ptr<reco::SuperClusterRefVector> scRefs_p(scRefs);
216 auto superClusters_p = std::make_unique<reco::SuperClusterCollection>();
219 LogDebug(
"EcalCleaning") <<
"Hybrid Clusters (Basic/Super) added to the Event! :-)";
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void push_back(Ptr< T > const &iPtr)
edm::EDGetTokenT< reco::SuperClusterCollection > uncleanScToken_
std::string refScCollection_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::Ptr< CaloCluster > CaloClusterPtr
edm::EDGetTokenT< reco::SuperClusterCollection > cleanScToken_
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
std::string scCollection_
size_type size() const
Size of the RefVector.
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Log< level::Warning, false > LogWarning
edm::RefVector< SuperClusterCollection > SuperClusterRefVector
vector of references to objects in the same colletion of SuperCluster objects
std::string bcCollection_