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 Attributes
RazorComputer Class Reference

#include <RazorComputer.h>

Inheritance diagram for RazorComputer:
VariableComputer

Public Member Functions

void compute (const edm::Event &iEvent) const
 
 RazorComputer (const CachingVariable::CachingVariableFactoryArg &arg, edm::ConsumesCollector &iC)
 
 ~RazorComputer ()
 
- 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::CachingVariableFactoryArg
arg_
 
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 ( const CachingVariable::CachingVariableFactoryArg arg,
edm::ConsumesCollector iC 
)

Definition at line 13 of file RazorComputer.cc.

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

13  : VariableComputer(arg,iC){
14  jet_ = edm::Service<InputTagDistributorService>()->retrieve("jet",arg.iConfig);
15  met_ = edm::Service<InputTagDistributorService>()->retrieve("met",arg.iConfig);
16  jetToken_ = iC.consumes<std::vector<pat::Jet>>(jet_);
17  metToken_ = iC.consumes<std::vector<pat::MET>>(met_);
18  pt_ = 40.;
19  eta_=2.4;
20 
21  declare("MRT",iC);
22  declare("MR",iC);
23  declare("R2",iC);
24  declare("R",iC);
25 
26 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::InputTag met_
Definition: RazorComputer.h:26
edm::InputTag jet_
Definition: RazorComputer.h:25
VariableComputer(const CachingVariable::CachingVariableFactoryArg &arg, edm::ConsumesCollector &iC)
edm::EDGetTokenT< std::vector< pat::MET > > metToken_
Definition: RazorComputer.h:28
edm::EDGetTokenT< std::vector< pat::Jet > > jetToken_
Definition: RazorComputer.h:27
void declare(std::string var, edm::ConsumesCollector &iC)
RazorComputer::~RazorComputer ( )
inline

Definition at line 21 of file RazorComputer.h.

21 {};

Member Function Documentation

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

Implements VariableComputer.

Definition at line 53 of file RazorComputer.cc.

References VariableComputer::assign(), razor::CalcMR(), razor::CalcMTR(), prof2calltree::count, eta_, edm::Event::getByToken(), i, fwrapper::jets, jetToken_, metToken_, edm::Handle< T >::product(), pt_, alignCSCRings::r, diffTwoXMLs::r2, and groupFilesInBlocks::temp.

53  {
54  //std::cout<<"getting into computation"<<std::endl;
55 
58  iEvent.getByToken( jetToken_, jetH);
59  iEvent.getByToken( metToken_, metH);
60 
62 
63 
64  std::vector<LorentzVector> jets;
65  jets.reserve( jetH.product()->size() );
66  for (std::vector<pat::Jet>::const_iterator jetit = jetH.product()->begin();
67  jetit!= jetH.product()->end(); ++ jetit){
68  if (jetit->et() > pt_ && fabs(jetit->eta()) < eta_){
69  jets.push_back( jetit->p4());
70  }
71  }
72 
74 
75  HEM_1.SetPxPyPzE(0.0,0.0,0.0,0.0);
76  HEM_2.SetPxPyPzE(0.0,0.0,0.0,0.0);
77 
78  if(jets.size() < 2) {
79  }
80  else{
81  unsigned int N_comb = 1;
82  for(unsigned int i = 0; i < jets.size(); i++){
83  N_comb *= 2;
84  }
85 
86  double M_temp;
87 
88  double M_min = 9999999999.0;
89  int j_count;
90 
91  for(unsigned int i = 1; i < N_comb-1; i++){
92  LorentzVector j_temp1, j_temp2;
93  int itemp = i;
94  j_count = N_comb/2;
95  int count = 0;
96  while(j_count > 0){
97  if(itemp/j_count == 1){
98  j_temp1 += jets[count];
99  } else {
100  j_temp2 += jets[count];
101  }
102  itemp -= j_count*(itemp/j_count);
103  j_count /= 2;
104  count++;
105  }
106 
107  M_temp = j_temp1.M2()+j_temp2.M2();
108 
109  if(M_temp < M_min){
110  M_min = M_temp;
111  HEM_1 = j_temp1;
112  HEM_2 = j_temp2;
113  }
114 
115  }
116 
117 
118  if(HEM_2.Pt() > HEM_1.Pt()){
119  LorentzVector temp = HEM_1;
120  HEM_1 = HEM_2;
121  HEM_2 = temp;
122  }
123  }
124 
125  double mrt=razor::CalcMTR( HEM_1, HEM_2, metH.product()->at(0));
126  double mr=razor::CalcMR( HEM_1, HEM_2);
127 
128 
129  assign("MRT",mrt);
130  assign("MR",mr);
131  double r=-1,r2=-1;
132  if (mr!=0){
133  r=mrt/mr;
134  r2=r*r;
135  }
136  assign("R",r);
137  assign("R2",r2);
138 
139  //std::cout<<"MR,R2 "<<mr<<" , "<<r2<<std::endl;
140 }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
double CalcMTR(const LorentzVector &j1, const LorentzVector &j2, const pat::MET &met)
void assign(std::string var, double &value) const
edm::EDGetTokenT< std::vector< pat::MET > > metToken_
Definition: RazorComputer.h:28
vector< PseudoJet > jets
T const * product() const
Definition: Handle.h:81
double CalcMR(const LorentzVector &ja, const LorentzVector &jb)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
edm::EDGetTokenT< std::vector< pat::Jet > > jetToken_
Definition: RazorComputer.h:27
math::PtEtaPhiELorentzVectorF LorentzVector

Member Data Documentation

float RazorComputer::eta_
private

Definition at line 29 of file RazorComputer.h.

Referenced by compute(), and RazorComputer().

edm::InputTag RazorComputer::jet_
private

Definition at line 25 of file RazorComputer.h.

Referenced by RazorComputer().

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

Definition at line 27 of file RazorComputer.h.

Referenced by compute(), and RazorComputer().

edm::InputTag RazorComputer::met_
private

Definition at line 26 of file RazorComputer.h.

Referenced by RazorComputer().

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

Definition at line 28 of file RazorComputer.h.

Referenced by compute(), and RazorComputer().

float RazorComputer::pt_
private

Definition at line 29 of file RazorComputer.h.

Referenced by compute(), and RazorComputer().