90 : srcCands_ (iConfig.getParameter<edm::InputTag> (
"srcObject"))
91 , srcObjects_ (iConfig.getParameter<vector<edm::InputTag> >(
"srcObjectsToRemove"))
92 , deltaRMin_ (iConfig.getParameter<double> (
"deltaRMin"))
93 , moduleLabel_(iConfig.getParameter<string> (
"@module_label"))
94 , objKeepCut_(iConfig.existsAs<std::string>(
"srcObjectSelection") ? iConfig.getParameter<std::string>(
"srcObjectSelection") :
"",
true)
95 ,objRemoveCut_(iConfig.existsAs<std::string>(
"srcObjectsToRemoveSelection") ? iConfig.getParameter<std::string>(
"srcObjectsToRemoveSelection") :
"",
true)
99 produces<edm::RefToBaseVector<T> >();
120 auto_ptr<edm::RefToBaseVector<T> >
126 bool* isClean =
new bool[candidates->size()];
127 for (
unsigned int iObject=0;iObject<candidates->size();iObject++) isClean[iObject] =
true;
129 for (
unsigned int iSrc=0;iSrc<srcObjects_.size();iSrc++) {
133 for (
unsigned int iObject=0;iObject<candidates->size();iObject++) {
134 const T& candidate = candidates->at(iObject);
135 if (!objKeepCut_(candidate)) isClean[iObject] =
false;
137 for (
unsigned int iObj=0;iObj<objects->size();iObj++) {
139 if (!objRemoveCut_(obj))
continue;
142 if (deltaR<deltaRMin_) isClean[iObject] =
false;
147 for (
unsigned int iObject=0;iObject<candidates->size();iObject++)
148 if (isClean[iObject]) cleanObjects->push_back(candidates->refAt(iObject));
150 nObjectsTot_ +=candidates->size();
151 nObjectsClean_+=cleanObjects->size();
154 iEvent.
put(cleanObjects);
163 ss<<
"nObjectsTot="<<nObjectsTot_<<
" nObjectsClean="<<nObjectsClean_
164 <<
" fObjectsClean="<<100.*(nObjectsClean_/(double)nObjectsTot_)<<
"%\n";
165 cout<<
"++++++++++++++++++++++++++++++++++++++++++++++++++"
166 <<
"\n"<<moduleLabel_<<
"(ObjectViewCleaner) SUMMARY:\n"<<ss.str()
167 <<
"++++++++++++++++++++++++++++++++++++++++++++++++++"
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup)
ObjectViewCleaner(const edm::ParameterSet &iConfig)
unsigned int nObjectsTot_
ObjectViewCleaner< reco::Photon > PhotonViewCleaner
#define DEFINE_FWK_MODULE(type)
unsigned int nObjectsClean_
std::vector< edm::InputTag > srcObjects_
double deltaR(double eta1, double phi1, double eta2, double phi2)
tuple obj
Example code starts here #.
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
ObjectViewCleaner< reco::GsfElectron > GsfElectronViewCleaner
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
double deltaR(double eta1, double eta2, double phi1, double phi2)
ObjectViewCleaner< reco::Candidate > CandViewCleaner
ObjectViewCleaner< reco::Electron > ElectronViewCleaner
ObjectViewCleaner< reco::Jet > JetViewCleaner
StringCutObjectSelector< reco::Candidate, true > objRemoveCut_
ObjectViewCleaner< reco::Muon > MuonViewCleaner
StringCutObjectSelector< T, true > objKeepCut_
virtual ~ObjectViewCleaner()