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";
27 if (iConfig.
existsAs<
bool>(
"phiCutForTwoLeg")) {
52 src->refAt(it - src->begin()), mother.
mass()));
55 if ((arbitration_ !=
None) && (pairs.size() > 1)) {
60 if (phiCutForTwoLeg_ && pairs.size() > 0) {
61 int eventNum = iEvent.
id().
event();
62 std::cout <<
"Calling phiCutByEventNumber on eventNum=" << eventNum << std::endl;
63 phiCutByEventNumber(pairs,eventNum);
73 unsigned int currentNum = 0;
75 size_t nclean = pairs.size();
76 for (TagProbePairs::iterator it = pairs.begin(), ed = pairs.end(); it != ed; ++it) {
77 if (it->tag.isNull())
continue;
79 std::cout <<
"Odd event number " << eventNumber <<
", require 0 < phi(tag) < pi... ";
80 if (!(it->tag->phi() > 0. && it->tag->phi() < 3.141592654)) {
81 std::cout <<
"Rejecting pair number " << currentNum++ <<
" with tag phi " << it->tag->phi();
85 std::cout <<
"Keeping pair number " << currentNum++ <<
" with tag phi " << it->tag->phi();
88 std::cout <<
"Even event number " << eventNumber <<
", require -pi < phi(tag) < 0... ";
90 if (!(it->tag->phi() > -3.141592654 && it->tag->phi() < 0)) {
91 std::cout <<
"Rejecting pair number " << currentNum++ <<
" with tag phi " << it->tag->phi();
95 std::cout <<
"Keeping pair number " << currentNum++ <<
" with tag phi " << it->tag->phi();
103 }
else if (nclean < pairs.size()) {
105 for (TagProbePairs::iterator it = pairs.begin(), ed = pairs.end(); it != ed; ++it) {
106 if (it->tag.isNonnull()) cleaned.push_back(*it);
115 size_t nclean = pairs.size();
116 for (TagProbePairs::iterator it = pairs.begin(), ed = pairs.end(); it != ed; ++it) {
117 if (it->tag.isNull())
continue;
120 for (TagProbePairs::iterator it2 = pairs.begin(); it2 != ed; ++it2) {
121 if(it!=it2 && it->probe==it2->tag && it->tag==it2->probe){
127 bool invalidateThis =
false;
128 int numberOfProbes=0;
129 for (TagProbePairs::iterator it2 = it + 1; it2 != ed; ++it2) {
131 if ((arbitration_ != NonDuplicate) && (it->tag == it2->tag)) {
138 if (arbitration_ == OneProbe) {
142 invalidateThis =
true;
143 }
else if (arbitration_ == BestMass) {
145 if (fabs(it2->mass-arbitrationMass_) < fabs(it->mass-arbitrationMass_)) {
150 }
else if (arbitration_ == Random2) {
152 if (numberOfProbes>1) {
159 if (randGen_->Rndm()>0.5) {
169 if ((arbitration_ == NonDuplicate) && (it->probe == it2->probe)) {
171 if (it2->tag->pt() > it->tag->pt())
std::swap(*it, *it2);
176 if ((arbitration_ == OnePair) &&
178 std::abs( it->probe->phi() - it2->tag->phi()) < 1
e-5 &&
179 std::abs( it->probe->eta() - it2->tag->eta()) < 1
e-5 &&
180 std::abs( it->probe->pt() - it2->tag->pt() ) < 1
e-5 &&
181 std::abs(it2->probe->phi() - it->tag->phi()) < 1
e-5 &&
182 std::abs(it2->probe->eta() - it->tag->eta()) < 1
e-5 &&
183 std::abs(it2->probe->pt() - it->tag->pt() ) < 1
e-5) {
192 }
else if (nclean < pairs.size()) {
194 for (TagProbePairs::iterator it = pairs.begin(), ed = pairs.end(); it != ed; ++it) {
195 if (it->tag.isNonnull()) cleaned.push_back(*it);
T getParameter(std::string const &) const
EventNumber_t event() const
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
bool getByToken(EDGetToken token, Handle< PROD > &result) const
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)
Abs< T >::type abs(const T &t)
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
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
a simple struct to hold tag, probe and mass
TagProbePairMaker(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
void phiCutByEventNumber(TagProbePairs &pairs, int eventNumber) const
void arbitrate(TagProbePairs &pairs) const
virtual const CandidateBaseRef & masterClone() const =0