5 src_(iConfig.getParameter<edm::InputTag>(
"tagProbePairs")),
8 std::string arbitration = iConfig.
getParameter<std::string>(
"arbitration");
9 if (arbitration ==
"None") {
11 }
else if (arbitration ==
"OneProbe") {
13 }
else if (arbitration ==
"OnePair") {
15 }
else if (arbitration ==
"NonDuplicate") {
17 }
else if (arbitration ==
"BestMass") {
20 }
else if (arbitration ==
"Random2") {
23 }
else throw cms::Exception(
"Configuration") <<
"TagProbePairMakerOnTheFly: the only currently "
24 <<
"allowed values for 'arbitration' are "
25 <<
"'None', 'OneProbe', 'BestMass', 'Random2'\n";
44 src->refAt(it - src->begin()), mother.
mass()));
47 if ((arbitration_ != None) && (pairs.size() > 1)) {
59 size_t nclean = pairs.size();
60 for (TagProbePairs::iterator it = pairs.begin(), ed = pairs.end(); it != ed; ++it) {
61 if (it->tag.isNull())
continue;
64 for (TagProbePairs::iterator it2 = pairs.begin(); it2 != ed; ++it2) {
65 if(it!=it2 && it->probe==it2->tag && it->tag==it2->probe){
71 bool invalidateThis =
false;
73 for (TagProbePairs::iterator it2 = it + 1; it2 != ed; ++it2) {
75 if ((arbitration_ != NonDuplicate) && (it->tag == it2->tag)) {
82 if (arbitration_ == OneProbe) {
86 invalidateThis =
true;
87 }
else if (arbitration_ == BestMass) {
89 if (fabs(it2->mass-arbitrationMass_) < fabs(it->mass-arbitrationMass_)) {
94 }
else if (arbitration_ == Random2) {
96 if (numberOfProbes>1) {
103 if (randGen_->Rndm()>0.5) {
113 if ((arbitration_ == NonDuplicate) && (it->probe == it2->probe)) {
115 if (it2->tag->pt() > it->tag->pt())
std::swap(*it, *it2);
120 if ((arbitration_ == OnePair) &&
122 std::abs( it->probe->phi() - it2->tag->phi()) < 1
e-5 &&
123 std::abs( it->probe->eta() - it2->tag->eta()) < 1
e-5 &&
124 std::abs( it->probe->pt() - it2->tag->pt() ) < 1
e-5 &&
125 std::abs(it2->probe->phi() - it->tag->phi()) < 1
e-5 &&
126 std::abs(it2->probe->eta() - it->tag->eta()) < 1
e-5 &&
127 std::abs(it2->probe->pt() - it->tag->pt() ) < 1
e-5) {
136 }
else if (nclean < pairs.size()) {
138 for (TagProbePairs::iterator it = pairs.begin(), ed = pairs.end(); it != ed; ++it) {
139 if (it->tag.isNonnull()) cleaned.push_back(*it);
T getParameter(std::string const &) const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
std::vector< TagProbePair > TagProbePairs
virtual double mass() const =0
mass
virtual size_type numberOfDaughters() const =0
number of daughters
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
TagProbePairMaker(const edm::ParameterSet &iConfig)
edm::RefToBase< Candidate > CandidateBaseRef
persistent reference to an object in a collection of Candidate objects
TagProbePairs run(const edm::Event &iEvent) const
fill in tghe T&P pairs for this event
a simple struct to hold tag, probe and mass
void arbitrate(TagProbePairs &pairs) const
virtual const CandidateBaseRef & masterClone() const =0