68 std::map<std::string,double> providedParameters;
69 providedParameters.insert(std::make_pair(
"LogWeighted",ps.
getParameter<
bool>(
"posCalc_logweight")));
70 providedParameters.insert(std::make_pair(
"T0_barl",ps.
getParameter<
double>(
"posCalc_t0")));
71 providedParameters.insert(std::make_pair(
"W0",ps.
getParameter<
double>(
"posCalc_w0")));
72 providedParameters.insert(std::make_pair(
"X0",ps.
getParameter<
double>(
"posCalc_x0")));
112 int uncleanSize = pUncleanSC->size();
113 int cleanSize = pCleanSC->size();
115 LogTrace(
"EcalCleaning") <<
"Size of Clean Collection: " << cleanSize
116 <<
", uncleanSize: " << uncleanSize << std::endl;
119 std::vector<int> isUncleanOnly;
120 std::vector<int> basicClusterOwner;
121 std::vector<int> isSeed;
122 for (
int isc =0; isc< uncleanSize; ++isc) {
124 const std::vector< std::pair<DetId, float> > & uhits = unscRef->hitsAndFractions();
125 int uhitsSize = uhits.size();
126 bool foundTheSame =
false;
127 for (
int jsc=0; jsc < cleanSize; ++jsc) {
129 const std::vector< std::pair<DetId, float> > & chits = cscRef->hitsAndFractions();
130 int chitsSize = chits.size();
132 if (unscRef->seed()->seed() == cscRef->seed()->seed() && chitsSize == uhitsSize) {
136 for (
int i=0;
i< chitsSize; ++
i) {
137 if (uhits[
i].
first != chits[
i].
first ) { foundTheSame=
false;
break;}
143 isUncleanOnly.push_back(0);
148 if (not foundTheSame) {
150 isUncleanOnly.push_back(1);
154 basicClusters.push_back(**bciter);
155 basicClusterOwner.push_back(isc);
159 int bcSize = basicClusters.size();
161 LogDebug(
"EcalCleaning") <<
"Found cleaned SC: " << cleanSize <<
" uncleaned SC: " 162 << uncleanSize <<
" from which " << scRefs->
size()
163 <<
" will become refs to the cleaned collection" ;
169 auto basicClusters_p = std::make_unique<reco::BasicClusterCollection>();
170 basicClusters_p->assign(basicClusters.begin(), basicClusters.end());
174 edm::LogWarning(
"MissingInput")<<
"could not get a handle on the BasicClusterCollection!" << std::endl;
178 LogDebug(
"EcalCleaning")<<
"Got the BasicClusters from the event again";
182 for (
int isc=0; isc< uncleanSize; ++isc) {
183 if (isUncleanOnly[isc]==1) {
188 for (
int jbc=0; jbc< bcSize; ++jbc) {
189 if (basicClusterOwner[jbc]==isc) {
192 if (energy< currentClu->energy()) {
193 energy = currentClu->energy(); seed = currentClu;
199 superClusters.push_back(newSC);
204 std::unique_ptr<reco::SuperClusterRefVector> scRefs_p(scRefs);
209 auto superClusters_p = std::make_unique<reco::SuperClusterCollection>();
210 superClusters_p->assign(superClusters.begin(), superClusters.end());
212 LogDebug(
"EcalCleaning")<<
"Hybrid Clusters (Basic/Super) added to the Event! :-)";
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void push_back(Ptr< T > const &iPtr)
edm::EDGetTokenT< reco::SuperClusterCollection > uncleanScToken_
void produce(edm::Event &, const edm::EventSetup &) override
std::string refScCollection_
edm::Ptr< CaloCluster > CaloClusterPtr
edm::EDGetTokenT< reco::SuperClusterCollection > cleanScToken_
~CleanAndMergeProducer() override
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
std::string scCollection_
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
size_type size() const
Size of the RefVector.
edm::RefVector< SuperClusterCollection > SuperClusterRefVector
vector of references to objects in the same colletion of SuperCluster objects
std::string bcCollection_
CleanAndMergeProducer(const edm::ParameterSet &ps)