Public Member Functions | |
void | endJob () |
ObjectViewMatcher (const edm::ParameterSet &iConfig) | |
void | produce (edm::Event &iEvent, const edm::EventSetup &iSetup) |
virtual | ~ObjectViewMatcher () |
Private Attributes | |
double | deltaRMax_ |
std::string | moduleLabel_ |
unsigned int | nObjectsMatch_ |
unsigned int | nObjectsTot_ |
StringCutObjectSelector< T1, true > | objCut_ |
StringCutObjectSelector< T2, true > | objMatchCut_ |
edm::InputTag | srcCands_ |
std::vector< edm::InputTag > | srcObjects_ |
Definition at line 51 of file ObjectViewMatcher.cc.
ObjectViewMatcher< T1, T2 >::ObjectViewMatcher | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 86 of file ObjectViewMatcher.cc.
: srcCands_ (iConfig.getParameter<edm::InputTag> ("srcObject")) , srcObjects_ (iConfig.getParameter<std::vector<edm::InputTag> >("srcObjectsToMatch")) , deltaRMax_ (iConfig.getParameter<double> ("deltaRMax")) , moduleLabel_(iConfig.getParameter<std::string> ("@module_label")) , objCut_(iConfig.existsAs<std::string>("srcObjectSelection") ? iConfig.getParameter<std::string>("srcObjectSelection") : "", true) ,objMatchCut_(iConfig.existsAs<std::string>("srcObjectsToMatchSelection") ? iConfig.getParameter<std::string>("srcObjectsToMatchSelection") : "", true) , nObjectsTot_(0) , nObjectsMatch_(0) { produces<std::vector<T1> >(); }
ObjectViewMatcher< T1, T2 >::~ObjectViewMatcher | ( | ) | [virtual] |
Definition at line 102 of file ObjectViewMatcher.cc.
{}
void ObjectViewMatcher< T1, T2 >::endJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDProducer.
Definition at line 160 of file ObjectViewMatcher.cc.
References gather_cfg::cout.
{ std::stringstream ss; ss<<"nObjectsTot="<<nObjectsTot_<<" nObjectsMatched="<<nObjectsMatch_ <<" fObjectsMatch="<<100.*(nObjectsMatch_/(double)nObjectsTot_)<<"%\n"; std::cout<<"++++++++++++++++++++++++++++++++++++++++++++++++++" <<"\n"<<moduleLabel_<<"(ObjectViewMatcher) SUMMARY:\n"<<ss.str() <<"++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl; }
void ObjectViewMatcher< T1, T2 >::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 112 of file ObjectViewMatcher.cc.
References reco::deltaR(), deltaR(), edm::Event::getByLabel(), VarParsing::obj, and edm::Event::put().
{ std::auto_ptr<std::vector<T1> > cleanObjects(new std::vector<T1 >); edm::Handle<edm::View<T1> > candidates; iEvent.getByLabel(srcCands_,candidates); bool* isMatch = new bool[candidates->size()]; for (unsigned int iObject=0;iObject<candidates->size();iObject++) isMatch[iObject] = false; for (unsigned int iSrc=0;iSrc<srcObjects_.size();iSrc++) { edm::Handle<edm::View<T2> > objects; iEvent.getByLabel(srcObjects_[iSrc],objects); if(objects->size()==0) continue; for (unsigned int iObject=0;iObject<candidates->size();iObject++) { const T1& candidate = candidates->at(iObject); if (!objCut_(candidate)) continue; for (unsigned int iObj=0;iObj<objects->size();iObj++) { const T2& obj = objects->at(iObj); if (!objMatchCut_(obj)) continue; double deltaR = reco::deltaR(candidate,obj); if (deltaR<deltaRMax_) isMatch[iObject] = true; } } } unsigned int counter=0; typename edm::View<T1>::const_iterator tIt, endcands = candidates->end(); for (tIt = candidates->begin(); tIt != endcands; ++tIt, ++counter) { if(isMatch[counter]) cleanObjects->push_back( *tIt ); } nObjectsTot_ +=candidates->size(); nObjectsMatch_+=cleanObjects->size(); delete [] isMatch; iEvent.put(cleanObjects); }
double ObjectViewMatcher< T1, T2 >::deltaRMax_ [private] |
Definition at line 66 of file ObjectViewMatcher.cc.
std::string ObjectViewMatcher< T1, T2 >::moduleLabel_ [private] |
Definition at line 68 of file ObjectViewMatcher.cc.
unsigned int ObjectViewMatcher< T1, T2 >::nObjectsMatch_ [private] |
Definition at line 75 of file ObjectViewMatcher.cc.
unsigned int ObjectViewMatcher< T1, T2 >::nObjectsTot_ [private] |
Definition at line 74 of file ObjectViewMatcher.cc.
StringCutObjectSelector<T1,true> ObjectViewMatcher< T1, T2 >::objCut_ [private] |
Definition at line 70 of file ObjectViewMatcher.cc.
StringCutObjectSelector<T2,true> ObjectViewMatcher< T1, T2 >::objMatchCut_ [private] |
Definition at line 71 of file ObjectViewMatcher.cc.
edm::InputTag ObjectViewMatcher< T1, T2 >::srcCands_ [private] |
Definition at line 64 of file ObjectViewMatcher.cc.
std::vector<edm::InputTag> ObjectViewMatcher< T1, T2 >::srcObjects_ [private] |
Definition at line 65 of file ObjectViewMatcher.cc.