CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
RazorComputer Class Reference

#include <RazorComputer.h>

Inheritance diagram for RazorComputer:
VariableComputer

Public Member Functions

void compute (const edm::Event &iEvent) const override
 
 RazorComputer (const CachingVariable::CachingVariableFactoryArg &arg, edm::ConsumesCollector &iC)
 
 ~RazorComputer () override
 
- Public Member Functions inherited from VariableComputer
void assign (std::string var, double &value) const
 
void declare (std::string var, edm::ConsumesCollector &iC)
 
void doesNotCompute () const
 
void doesNotCompute (std::string var) const
 
const std::string & name () const
 
bool notSeenThisEventAlready (const edm::Event &iEvent) const
 
 VariableComputer (const CachingVariable::CachingVariableFactoryArg &arg, edm::ConsumesCollector &iC)
 
virtual ~VariableComputer ()
 

Private Attributes

float eta_
 
edm::InputTag jet_
 
edm::EDGetTokenT< std::vector< pat::Jet > > jetToken_
 
edm::InputTag met_
 
edm::EDGetTokenT< std::vector< pat::MET > > metToken_
 
float pt_
 

Additional Inherited Members

- Protected Attributes inherited from VariableComputer
const CachingVariable::CachingVariableFactoryArgarg_
 
edm::Event::CacheIdentifier_t eventCacheID_ = 0
 
std::map< std::string, const ComputedVariable * > iCompute_
 
std::string method_
 
std::string name_
 
std::string separator_
 

Detailed Description

Definition at line 18 of file RazorComputer.h.

Constructor & Destructor Documentation

◆ RazorComputer()

RazorComputer::RazorComputer ( const CachingVariable::CachingVariableFactoryArg arg,
edm::ConsumesCollector iC 
)

Definition at line 9 of file RazorComputer.cc.

10  : VariableComputer(arg, iC) {
11  jet_ = edm::Service<InputTagDistributorService>()->retrieve("jet", arg.iConfig);
12  met_ = edm::Service<InputTagDistributorService>()->retrieve("met", arg.iConfig);
13  jetToken_ = iC.consumes<std::vector<pat::Jet>>(jet_);
14  metToken_ = iC.consumes<std::vector<pat::MET>>(met_);
15  pt_ = 40.;
16  eta_ = 2.4;
17 
18  declare("MRT", iC);
19  declare("MR", iC);
20  declare("R2", iC);
21  declare("R", iC);
22 }

References edm::ConsumesCollector::consumes(), VariableComputer::declare(), eta_, jet_, jetToken_, met_, metToken_, and pt_.

◆ ~RazorComputer()

RazorComputer::~RazorComputer ( )
inlineoverride

Definition at line 21 of file RazorComputer.h.

21 {};

Member Function Documentation

◆ compute()

void RazorComputer::compute ( const edm::Event iEvent) const
overridevirtual

Implements VariableComputer.

Definition at line 47 of file RazorComputer.cc.

47  {
48  //std::cout<<"getting into computation"<<std::endl;
49 
52  iEvent.getByToken(jetToken_, jetH);
53  iEvent.getByToken(metToken_, metH);
54 
56 
57  std::vector<LorentzVector> jets;
58  jets.reserve(jetH.product()->size());
59  for (std::vector<pat::Jet>::const_iterator jetit = jetH.product()->begin(); jetit != jetH.product()->end(); ++jetit) {
60  if (jetit->et() > pt_ && fabs(jetit->eta()) < eta_) {
61  jets.push_back(jetit->p4());
62  }
63  }
64 
65  reco::Candidate::LorentzVector HEM_1, HEM_2;
66 
67  HEM_1.SetPxPyPzE(0.0, 0.0, 0.0, 0.0);
68  HEM_2.SetPxPyPzE(0.0, 0.0, 0.0, 0.0);
69 
70  if (jets.size() < 2) {
71  } else {
72  unsigned int N_comb = 1;
73  for (unsigned int i = 0; i < jets.size(); i++) {
74  N_comb *= 2;
75  }
76 
77  double M_temp;
78 
79  double M_min = 9999999999.0;
80  int j_count;
81 
82  for (unsigned int i = 1; i < N_comb - 1; i++) {
83  LorentzVector j_temp1, j_temp2;
84  int itemp = i;
85  j_count = N_comb / 2;
86  int count = 0;
87  while (j_count > 0) {
88  if (itemp / j_count == 1) {
89  j_temp1 += jets[count];
90  } else {
91  j_temp2 += jets[count];
92  }
93  itemp -= j_count * (itemp / j_count);
94  j_count /= 2;
95  count++;
96  }
97 
98  M_temp = j_temp1.M2() + j_temp2.M2();
99 
100  if (M_temp < M_min) {
101  M_min = M_temp;
102  HEM_1 = j_temp1;
103  HEM_2 = j_temp2;
104  }
105  }
106 
107  if (HEM_2.Pt() > HEM_1.Pt()) {
108  LorentzVector temp = HEM_1;
109  HEM_1 = HEM_2;
110  HEM_2 = temp;
111  }
112  }
113 
114  double mrt = razor::CalcMTR(HEM_1, HEM_2, metH.product()->at(0));
115  double mr = razor::CalcMR(HEM_1, HEM_2);
116 
117  assign("MRT", mrt);
118  assign("MR", mr);
119  double r = -1, r2 = -1;
120  if (mr != 0) {
121  r = mrt / mr;
122  r2 = r * r;
123  }
124  assign("R", r);
125  assign("R2", r2);
126 
127  //std::cout<<"MR,R2 "<<mr<<" , "<<r2<<std::endl;
128 }

References VariableComputer::assign(), razor::CalcMR(), razor::CalcMTR(), submitPVResolutionJobs::count, eta_, mps_fire::i, iEvent, runTauDisplay::jetH, singleTopDQM_cfi::jets, jetToken_, metToken_, HLTObjectMonitor_cfi::mr, edm::Handle< T >::product(), pt_, alignCSCRings::r, diffTwoXMLs::r2, and groupFilesInBlocks::temp.

Member Data Documentation

◆ eta_

float RazorComputer::eta_
private

Definition at line 30 of file RazorComputer.h.

Referenced by compute(), and RazorComputer().

◆ jet_

edm::InputTag RazorComputer::jet_
private

Definition at line 26 of file RazorComputer.h.

Referenced by RazorComputer().

◆ jetToken_

edm::EDGetTokenT<std::vector<pat::Jet> > RazorComputer::jetToken_
private

Definition at line 28 of file RazorComputer.h.

Referenced by compute(), and RazorComputer().

◆ met_

edm::InputTag RazorComputer::met_
private

Definition at line 27 of file RazorComputer.h.

Referenced by RazorComputer().

◆ metToken_

edm::EDGetTokenT<std::vector<pat::MET> > RazorComputer::metToken_
private

Definition at line 29 of file RazorComputer.h.

Referenced by compute(), and RazorComputer().

◆ pt_

float RazorComputer::pt_
private

Definition at line 30 of file RazorComputer.h.

Referenced by compute(), and RazorComputer().

mps_fire.i
i
Definition: mps_fire.py:428
edm::Handle::product
T const * product() const
Definition: Handle.h:70
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
razor::CalcMTR
double CalcMTR(const LorentzVector &j1, const LorentzVector &j2, const pat::MET &met)
Definition: RazorComputer.cc:37
edm::Handle
Definition: AssociativeIterator.h:50
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
razor::CalcMR
double CalcMR(const LorentzVector &ja, const LorentzVector &jb)
Definition: RazorComputer.cc:27
RazorComputer::metToken_
edm::EDGetTokenT< std::vector< pat::MET > > metToken_
Definition: RazorComputer.h:29
VariableComputer::VariableComputer
VariableComputer(const CachingVariable::CachingVariableFactoryArg &arg, edm::ConsumesCollector &iC)
Definition: CachingVariable.cc:44
RazorComputer::eta_
float eta_
Definition: RazorComputer.h:30
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
VariableComputer::assign
void assign(std::string var, double &value) const
Definition: CachingVariable.cc:66
RazorComputer::pt_
float pt_
Definition: RazorComputer.h:30
diffTwoXMLs.r2
r2
Definition: diffTwoXMLs.py:73
edm::Service
Definition: Service.h:30
iEvent
int iEvent
Definition: GenABIO.cc:224
VariableComputer::declare
void declare(std::string var, edm::ConsumesCollector &iC)
Definition: CachingVariable.cc:55
alignCSCRings.r
r
Definition: alignCSCRings.py:93
RazorComputer::met_
edm::InputTag met_
Definition: RazorComputer.h:27
LorentzVector
math::XYZTLorentzVector LorentzVector
Definition: HLTMuonMatchAndPlot.h:49
runTauDisplay.jetH
jetH
Definition: runTauDisplay.py:31
razor::LorentzVector
reco::Candidate::LorentzVector LorentzVector
Definition: RazorComputer.cc:25
funct::arg
A arg
Definition: Factorize.h:31
RazorComputer::jet_
edm::InputTag jet_
Definition: RazorComputer.h:26
reco::Candidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
RazorComputer::jetToken_
edm::EDGetTokenT< std::vector< pat::Jet > > jetToken_
Definition: RazorComputer.h:28
HLTObjectMonitor_cfi.mr
mr
Definition: HLTObjectMonitor_cfi.py:366