CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
lhef::JetMatchingMLM Class Reference

#include <JetMatchingMLM.h>

Inheritance diagram for lhef::JetMatchingMLM:
lhef::JetMatching

Public Member Functions

 JetMatchingMLM (const edm::ParameterSet &params)
 
 ~JetMatchingMLM ()
 
- Public Member Functions inherited from lhef::JetMatching
virtual void beforeHadronisation (const boost::shared_ptr< LHEEvent > &event)
 
const std::vector
< JetPartonMatch > & 
getMatchSummary () const
 
virtual void init (const boost::shared_ptr< LHERunInfo > &runInfo)
 
 JetMatching (const edm::ParameterSet &params)
 
virtual ~JetMatching ()
 

Private Types

enum  MatchMode { kExclusive = 0, kInclusive }
 

Private Member Functions

std::set< std::string > capabilities () const
 
double match (const HepMC::GenEvent *partonLevel, const HepMC::GenEvent *finalState, bool showeredFinalState)
 

Private Attributes

std::auto_ptr< JetClusteringjetClustering
 
std::auto_ptr< JetInputjetInput
 
MatchMode matchMode
 
double matchPtFraction
 
const double maxDeltaR
 
double maxEta
 
const double minJetPt
 
std::auto_ptr< JetInputpartonInput
 
bool useEt
 

Additional Inherited Members

- Public Types inherited from lhef::JetMatching
typedef
edmplugin::PluginFactory
< JetMatching *(const
edm::ParameterSet &)> 
Factory
 
- Static Public Member Functions inherited from lhef::JetMatching
static std::auto_ptr< JetMatchingcreate (const edm::ParameterSet &params)
 
- Protected Attributes inherited from lhef::JetMatching
std::vector< JetPartonMatchmatchSummary
 

Detailed Description

Definition at line 19 of file JetMatchingMLM.h.

Member Enumeration Documentation

Enumerator
kExclusive 
kInclusive 

Definition at line 31 of file JetMatchingMLM.h.

Constructor & Destructor Documentation

lhef::JetMatchingMLM::JetMatchingMLM ( const edm::ParameterSet params)

Definition at line 66 of file JetMatchingMLM.cc.

References edm::hlt::Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), jetClustering, kExclusive, kInclusive, matchMode, matchPtFraction, minJetPt, and partonInput.

66  :
67  JetMatching(params),
68  maxDeltaR(params.getParameter<double>("maxDeltaR")),
69  minJetPt(params.getParameter<double>("jetPtMin")),
70  maxEta(params.getParameter<double>("maxEta")),
71  matchPtFraction(0.75),
72  useEt(params.getParameter<bool>("useEt")),
73  partonInput(new JetInput(params)),
74  jetInput(new JetInput(*partonInput))
75 {
76  partonInput->setPartonicFinalState(false);
77  partonInput->setHardProcessOnly(false);
78 
79  if (params.exists("matchPtFraction"))
81  params.getParameter<double>("matchPtFraction");
82 
83  jetClustering.reset(
84  new JetClustering(params, minJetPt * matchPtFraction));
85 
86  std::string matchMode = params.getParameter<std::string>("matchMode");
87  if (matchMode == "inclusive")
88  this->matchMode = kInclusive;
89  else if (matchMode == "exclusive")
90  this->matchMode = kExclusive;
91  else
92  throw cms::Exception("Configuration")
93  << "Invalid matching mode '" << matchMode
94  << "' specified." << std::endl;
95 }
const double maxDeltaR
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::auto_ptr< JetInput > partonInput
std::auto_ptr< JetInput > jetInput
std::auto_ptr< JetClustering > jetClustering
const double minJetPt
JetMatching(const edm::ParameterSet &params)
Definition: JetMatching.cc:21
lhef::JetMatchingMLM::~JetMatchingMLM ( )

Definition at line 97 of file JetMatchingMLM.cc.

98 {
99 }

Member Function Documentation

std::set< std::string > lhef::JetMatchingMLM::capabilities ( ) const
privatevirtual

Reimplemented from lhef::JetMatching.

Definition at line 101 of file JetMatchingMLM.cc.

References lhef::JetMatching::capabilities(), and query::result.

102 {
103  std::set<std::string> result = JetMatching::capabilities();
104  result.insert("matchSummary");
105  return result;
106 }
tuple result
Definition: query.py:137
virtual std::set< std::string > capabilities() const
Definition: JetMatching.cc:38
double lhef::JetMatchingMLM::match ( const HepMC::GenEvent *  partonLevel,
const HepMC::GenEvent *  finalState,
bool  showeredFinalState 
)
privatevirtual

Implements lhef::JetMatching.

Definition at line 111 of file JetMatchingMLM.cc.

References abs, trackerHits::c, convert(), gather_cfg::cout, eta(), i, jetInput, fwrapper::jets, kExclusive, kInclusive, MultipleCompare::Match(), matchMode, lhef::JetMatching::matchSummary, maxDeltaR, maxEta, minJetPt, lhef::JetClustering::Jet::pt(), python.multivaluedict::sort(), and useEt.

114 {
115  JetInput::ParticleVector partons = (*partonInput)(partonLevel);
116  std::sort(partons.begin(), partons.end(), ParticlePtGreater());
117 
119  showeredFinalState ? (*partonInput)(finalState)
120  : (*this->jetInput)(finalState);
121  std::sort(jetInput.begin(), jetInput.end(), ParticlePtGreater());
122 
123  std::vector<JetClustering::Jet> jets = (*jetClustering)(jetInput);
124 
125 #ifdef DEBUG
126  std::cout << "===== Partons:" << std::endl;
127  for(JetClustering::ParticleVector::const_iterator c = partons.begin();
128  c != partons.end(); c++)
129  std::cout << "\tpid = " << (*c)->pdg_id()
130  << ", pt = " << (*c)->momentum().perp()
131  << ", eta = " << (*c)->momentum().eta()
132  << ", phi = " << (*c)->momentum().phi()
133  << std::endl;
134  std::cout << "===== JetInput:" << std::endl;
135  for(JetClustering::ParticleVector::const_iterator c = jetInput.begin();
136  c != jetInput.end(); c++)
137  std::cout << "\tpid = " << (*c)->pdg_id()
138  << ", pt = " << (*c)->momentum().perp()
139  << ", eta = " << (*c)->momentum().eta()
140  << ", phi = " << (*c)->momentum().phi()
141  << std::endl;
142  std::cout << "----- " << jets.size() << " jets:" << std::endl;
143  for(std::vector<JetClustering::Jet>::const_iterator iter = jets.begin();
144  iter != jets.end(); ++iter) {
145  std::cout << "* pt = " << iter->pt()
146  << ", eta = " << iter->eta()
147  << ", phi = " << iter->phi()
148  << std::endl;
149  for(JetClustering::ParticleVector::const_iterator c = iter->constituents().begin();
150  c != iter->constituents().end(); c++)
151  std::cout << "\tpid = " << (*c)->pdg_id()
152  << ", pt = " << (*c)->momentum().perp()
153  << ", eta = " << (*c)->momentum().eta()
154  << ", phi = " << (*c)->momentum().phi()
155  << std::endl;
156  }
157 
158  using boost::bind;
159  std::cout << partons.size() << " partons and "
160  << std::count_if(jets.begin(), jets.end(),
161  bind(std::greater<double>(),
162  bind(&JetClustering::Jet::pt, _1),
163  minJetPt)) << " jets." << std::endl;
164 #endif
165 
166  Matching<double> matching(partons, jets,
167  DeltaRSeparation<JetInput::ParticleVector::value_type,
168  JetClustering::Jet, double>());
169 
171  std::vector<Match> matches =
172  matching.match(
173  std::less<double>(),
174  std::bind2nd(std::less<double>(), maxDeltaR));
175 
176 #ifdef DEBUG
177  for(std::vector<Match>::const_iterator iter = matches.begin();
178  iter != matches.end(); ++iter)
179  std::cout << "\tParton " << iter->index1 << " matches jet "
180  << iter->index2 << " with a Delta_R of "
181  << matching.delta(*iter) << std::endl;
182 #endif
183 
184  unsigned int unmatchedPartons = 0;
185  unsigned int unmatchedJets = 0;
186 
187  matchSummary.clear();
188  for(std::vector<Match>::const_iterator iter = matches.begin();
189  iter != matches.end(); ++iter) {
190  if ((useEt ? jets[iter->index2].et()
191  : jets[iter->index2].pt()) < minJetPt ||
192  std::abs(jets[iter->index2].eta()) > maxEta)
193  unmatchedPartons++;
194  matchSummary.push_back(
195  JetPartonMatch(partons[iter->index1]->momentum(),
196  convert(jets[iter->index2]),
197  matching.delta(*iter),
198  partons[iter->index1]->pdg_id()));
199  }
200 
201  for(Matching<double>::index_type i = 0; i < partons.size(); i++) {
202  if (!matching.isMatched1st(i)) {
203  unmatchedPartons++;
204  matchSummary.push_back(
205  JetPartonMatch(partons[i]->momentum(),
206  partons[i]->pdg_id()));
207  }
208  }
209 
210  for(Matching<double>::index_type i = 0; i < jets.size(); i++) {
211  if (!matching.isMatched2nd(i)) {
212  if ((useEt ? jets[i].et()
213  : jets[i].pt()) >= minJetPt &&
214  std::abs(jets[i].eta()) <= maxEta)
215  unmatchedJets++;
216  matchSummary.push_back(
217  JetPartonMatch(convert(jets[i])));
218  }
219  }
220 
221  switch(matchMode) {
222  case kExclusive:
223  if (!unmatchedJets && !unmatchedPartons)
224  return 1.0;
225  break;
226  case kInclusive:
227  if (!unmatchedPartons)
228  return 1.0;
229  }
230 
231  return 0.0;
232 }
const double maxDeltaR
int i
Definition: DBlmapReader.cc:9
#define abs(x)
Definition: mlp_lapack.h:159
T eta() const
void convert(uint32 i, char_uint32 v)
Definition: MsgTools.h:46
std::auto_ptr< JetInput > jetInput
vector< PseudoJet > jets
Container::value_type value_type
const double minJetPt
std::vector< const HepMC::GenParticle * > ParticleVector
Definition: JetInput.h:17
tuple cout
Definition: gather_cfg.py:121
std::vector< JetPartonMatch > matchSummary
Definition: JetMatching.h:74

Member Data Documentation

std::auto_ptr<JetClustering> lhef::JetMatchingMLM::jetClustering
private

Definition at line 45 of file JetMatchingMLM.h.

Referenced by JetMatchingMLM().

std::auto_ptr<JetInput> lhef::JetMatchingMLM::jetInput
private

Definition at line 44 of file JetMatchingMLM.h.

Referenced by match().

MatchMode lhef::JetMatchingMLM::matchMode
private

Definition at line 41 of file JetMatchingMLM.h.

Referenced by JetMatchingMLM(), and match().

double lhef::JetMatchingMLM::matchPtFraction
private

Definition at line 39 of file JetMatchingMLM.h.

Referenced by JetMatchingMLM().

const double lhef::JetMatchingMLM::maxDeltaR
private

Definition at line 36 of file JetMatchingMLM.h.

Referenced by match().

double lhef::JetMatchingMLM::maxEta
private

Definition at line 38 of file JetMatchingMLM.h.

Referenced by match().

const double lhef::JetMatchingMLM::minJetPt
private

Definition at line 37 of file JetMatchingMLM.h.

Referenced by JetMatchingMLM(), and match().

std::auto_ptr<JetInput> lhef::JetMatchingMLM::partonInput
private

Definition at line 43 of file JetMatchingMLM.h.

Referenced by JetMatchingMLM().

bool lhef::JetMatchingMLM::useEt
private

Definition at line 40 of file JetMatchingMLM.h.

Referenced by match().