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
RazorVarProducer Class Reference

#include <RazorVarProducer.h>

Inheritance diagram for RazorVarProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

double CalcMR (TLorentzVector ja, TLorentzVector jb)
 
double CalcR (double MR, TLorentzVector ja, TLorentzVector jb, edm::Handle< reco::CaloMETCollection > met, std::vector< math::XYZTLorentzVector > muons)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 RazorVarProducer (const edm::ParameterSet &)
 
 ~RazorVarProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

edm::InputTag inputMetTag_
 
edm::InputTag inputTag_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 13 of file RazorVarProducer.h.

Constructor & Destructor Documentation

RazorVarProducer::RazorVarProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 26 of file RazorVarProducer.cc.

References edm::InputTag::encode(), inputMetTag_, inputTag_, and LogDebug.

26  :
27  inputTag_ (iConfig.getParameter<edm::InputTag>("inputTag")),
28  inputMetTag_ (iConfig.getParameter<edm::InputTag>("inputMetTag")){
29 
30  produces<std::vector<double> >();
31 
32  LogDebug("") << "Inputs: "
33  << inputTag_.encode() << " "
34  << inputMetTag_.encode() << ".";
35 }
#define LogDebug(id)
T getParameter(std::string const &) const
std::string encode() const
Definition: InputTag.cc:72
edm::InputTag inputMetTag_
edm::InputTag inputTag_
RazorVarProducer::~RazorVarProducer ( )

Definition at line 37 of file RazorVarProducer.cc.

38 {
39 }

Member Function Documentation

double RazorVarProducer::CalcMR ( TLorentzVector  ja,
TLorentzVector  jb 
)

Definition at line 76 of file RazorVarProducer.cc.

References funct::A, mathSSE::sqrt(), and groupFilesInBlocks::temp.

Referenced by produce().

76  {
77  if(ja.Pt()<=0.1) return -1;
78 
79  ja.SetPtEtaPhiM(ja.Pt(),ja.Eta(),ja.Phi(),0.0);
80  jb.SetPtEtaPhiM(jb.Pt(),jb.Eta(),jb.Phi(),0.0);
81 
82  if(ja.Pt() > jb.Pt()){
83  TLorentzVector temp = ja;
84  ja = jb;
85  jb = temp;
86  }
87 
88  double A = ja.P();
89  double B = jb.P();
90  double az = ja.Pz();
91  double bz = jb.Pz();
92  TVector3 jaT, jbT;
93  jaT.SetXYZ(ja.Px(),ja.Py(),0.0);
94  jbT.SetXYZ(jb.Px(),jb.Py(),0.0);
95  double ATBT = (jaT+jbT).Mag2();
96 
97  double MR = sqrt((A+B)*(A+B)-(az+bz)*(az+bz)-
98  (jbT.Dot(jbT)-jaT.Dot(jaT))*(jbT.Dot(jbT)-jaT.Dot(jaT))/(jaT+jbT).Mag2());
99 
100  double mybeta = (jbT.Dot(jbT)-jaT.Dot(jaT))/
101  sqrt(ATBT*((A+B)*(A+B)-(az+bz)*(az+bz)));
102 
103  double mygamma = 1./sqrt(1.-mybeta*mybeta);
104 
105  //use gamma times MRstar
106  return MR*mygamma;
107 }
T sqrt(T t)
Definition: SSEVec.h:46
double RazorVarProducer::CalcR ( double  MR,
TLorentzVector  ja,
TLorentzVector  jb,
edm::Handle< reco::CaloMETCollection met,
std::vector< math::XYZTLorentzVector muons 
)

Definition at line 110 of file RazorVarProducer.cc.

References CaloMET_cfi::met, phi, mathSSE::sqrt(), and tmp.

Referenced by produce().

110  {
111  //now we can calculate MTR
112  TVector3 met;
113  met.SetPtEtaPhi((inputMet->front()).pt(),0.0,(inputMet->front()).phi());
114 
115  std::vector<math::XYZTLorentzVector>::const_iterator muonIt;
116  for(muonIt = muons.begin(); muonIt!=muons.end(); muonIt++){
117  TVector3 tmp;
118  tmp.SetPtEtaPhi(muonIt->pt(),0,muonIt->phi());
119  met-=tmp;
120  }
121 
122  double MTR = sqrt(0.5*(met.Mag()*(ja.Pt()+jb.Pt()) - met.Dot(ja.Vect()+jb.Vect())));
123 
124  //filter events
125  return float(MTR)/float(MR); //R
126 
127 }
T sqrt(T t)
Definition: SSEVec.h:46
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
tuple muons
Definition: patZpeak.py:38
Definition: DDAxes.h:10
void RazorVarProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 43 of file RazorVarProducer.cc.

References CalcMR(), CalcR(), edm::Event::getByLabel(), inputMetTag_, inputTag_, edm::Event::put(), dttmaxenums::R, dt_dqm_sourceclient_common_cff::reco, and query::result.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

44 {
45  using namespace std;
46  using namespace edm;
47  using namespace reco;
48 
49 
50  // get hold of collection of objects
52  iEvent.getByLabel (inputTag_,hemispheres);
53 
54  // get hold of the MET Collection
56  iEvent.getByLabel(inputMetTag_,inputMet);
57 
58  std::auto_ptr<std::vector<double> > result(new std::vector<double>);
59  // check the the input collections are available
60  if (hemispheres.isValid() && inputMet.isValid() && hemispheres->size() > 1){
61 
62  TLorentzVector ja(hemispheres->at(0).x(),hemispheres->at(0).y(),hemispheres->at(0).z(),hemispheres->at(0).t());
63  TLorentzVector jb(hemispheres->at(1).x(),hemispheres->at(1).y(),hemispheres->at(1).z(),hemispheres->at(1).t());
64 
65  std::vector<math::XYZTLorentzVector> muonVec;
66  const double MR = CalcMR(ja,jb);
67  const double R = CalcR(MR,ja,jb,inputMet,muonVec);
68  result->push_back(MR);
69  result->push_back(R);
70 
71  }
72  iEvent.put(result);
73 }
double CalcR(double MR, TLorentzVector ja, TLorentzVector jb, edm::Handle< reco::CaloMETCollection > met, std::vector< math::XYZTLorentzVector > muons)
double CalcMR(TLorentzVector ja, TLorentzVector jb)
edm::InputTag inputMetTag_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
tuple result
Definition: query.py:137
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
edm::InputTag inputTag_

Member Data Documentation

edm::InputTag RazorVarProducer::inputMetTag_
private

Definition at line 25 of file RazorVarProducer.h.

Referenced by produce(), and RazorVarProducer().

edm::InputTag RazorVarProducer::inputTag_
private

Definition at line 24 of file RazorVarProducer.h.

Referenced by produce(), and RazorVarProducer().