#include <HLTriggerOffline/Tau/interface/HLTTauRefCombiner.h>
Public Member Functions | |
HLTTauRefCombiner (const edm::ParameterSet &) | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
~HLTTauRefCombiner () | |
Private Types | |
typedef math::XYZTLorentzVectorD | LorentzVector |
typedef std::vector < LorentzVector > | LorentzVectorCollection |
Private Member Functions | |
bool | match (const LorentzVector &, const LorentzVectorCollection &) |
Private Attributes | |
std::vector< edm::InputTag > | inputColl_ |
double | matchDeltaR_ |
std::string | outName_ |
Definition at line 21 of file HLTTauRefCombiner.h.
typedef math::XYZTLorentzVectorD HLTTauRefCombiner::LorentzVector [private] |
Definition at line 30 of file HLTTauRefCombiner.h.
typedef std::vector<LorentzVector> HLTTauRefCombiner::LorentzVectorCollection [private] |
Definition at line 31 of file HLTTauRefCombiner.h.
HLTTauRefCombiner::HLTTauRefCombiner | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 9 of file HLTTauRefCombiner.cc.
References edm::ParameterSet::getParameter(), inputColl_, matchDeltaR_, and outName_.
00010 { 00011 inputColl_ = iConfig.getParameter< std::vector<InputTag> >("InputCollections"); 00012 matchDeltaR_ = iConfig.getParameter<double>("MatchDeltaR"); 00013 outName_ = iConfig.getParameter<string>("OutputCollection"); 00014 00015 produces<LorentzVectorCollection> ( outName_); 00016 }
HLTTauRefCombiner::~HLTTauRefCombiner | ( | ) |
bool HLTTauRefCombiner::match | ( | const LorentzVector & | lv, | |
const LorentzVectorCollection & | lvcol | |||
) | [private] |
Definition at line 84 of file HLTTauRefCombiner.cc.
References it, and matchDeltaR_.
Referenced by produce().
00085 { 00086 bool matched=false; 00087 00088 if(lvcol.size()>0) 00089 for(LorentzVectorCollection::const_iterator it = lvcol.begin();it!=lvcol.end();++it) 00090 { 00091 double delta = ROOT::Math::VectorUtil::DeltaR(lv,*it); 00092 if(delta<matchDeltaR_) 00093 { 00094 matched=true; 00095 00096 } 00097 } 00098 00099 00100 00101 return matched; 00102 }
void HLTTauRefCombiner::produce | ( | edm::Event & | iEvent, | |
const edm::EventSetup & | iES | |||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 20 of file HLTTauRefCombiner.cc.
References edm::Event::getByLabel(), i, inputColl_, j, match(), outName_, edm::Event::put(), size, and tmp.
00021 { 00022 auto_ptr<LorentzVectorCollection> out_product(new LorentzVectorCollection); 00023 00024 //Create The Handles.. 00025 std::vector< Handle<LorentzVectorCollection> > handles; 00026 00027 bool allCollectionsExist = true; 00028 //Map the Handles to the collections if all collections exist 00029 for(size_t i = 0;i<inputColl_.size();++i) 00030 { 00031 edm::Handle<LorentzVectorCollection> tmp; 00032 if(iEvent.getByLabel(inputColl_[i],tmp)) 00033 { 00034 handles.push_back(tmp); 00035 } 00036 else 00037 { 00038 allCollectionsExist = false; 00039 } 00040 00041 } 00042 00043 //The reference output object collection will be the first one.. 00044 if(allCollectionsExist) 00045 { 00046 //loop on the first collection 00047 for(size_t i = 0; i < (handles[0])->size();++i) 00048 { 00049 bool MatchedObj = true; 00050 00051 //get reference Vector 00052 const LorentzVector lvRef = (*(handles[0]))[i]; 00053 00054 //Loop on all other collections and match 00055 for(size_t j = 1; j < handles.size();++j) 00056 { 00057 if(!match(lvRef,*(handles[j]))) 00058 MatchedObj = false; 00059 00060 } 00061 00062 //If the Object is Matched Everywhere store 00063 if(MatchedObj) 00064 { 00065 out_product->push_back(lvRef); 00066 } 00067 00068 00069 } 00070 00071 //Put product to file 00072 iEvent.put(out_product,outName_); 00073 00074 } 00075 00076 00077 00078 00079 }
std::vector<edm::InputTag> HLTTauRefCombiner::inputColl_ [private] |
Definition at line 33 of file HLTTauRefCombiner.h.
Referenced by HLTTauRefCombiner(), and produce().
double HLTTauRefCombiner::matchDeltaR_ [private] |
std::string HLTTauRefCombiner::outName_ [private] |
Definition at line 35 of file HLTTauRefCombiner.h.
Referenced by HLTTauRefCombiner(), and produce().