test
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::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

double CalcMR (TLorentzVector ja, TLorentzVector jb)
 
double CalcR (double MR, const TLorentzVector &ja, const TLorentzVector &jb, edm::Handle< reco::CaloMETCollection > met, const 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 ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

edm::InputTag inputMetTag_
 
edm::EDGetTokenT
< reco::CaloMETCollection
inputMetTagToken_
 
edm::InputTag inputTag_
 
edm::EDGetTokenT< std::vector
< math::XYZTLorentzVector > > 
inputTagToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 14 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(), edm::ParameterSet::getParameter(), inputMetTag_, inputMetTagToken_, inputTag_, inputTagToken_, and LogDebug.

26  :
27  inputTag_ (iConfig.getParameter<edm::InputTag>("inputTag")),
28  inputMetTag_ (iConfig.getParameter<edm::InputTag>("inputMetTag")){
29 
30  //set Token(-s)
31  inputTagToken_ = consumes<std::vector<math::XYZTLorentzVector> >(iConfig.getParameter<edm::InputTag>("inputTag"));
32  inputMetTagToken_ = consumes<reco::CaloMETCollection>(iConfig.getParameter<edm::InputTag>("inputMetTag"));
33 
34  produces<std::vector<double> >();
35 
36  LogDebug("") << "Inputs: "
37  << inputTag_.encode() << " "
38  << inputMetTag_.encode() << ".";
39 }
#define LogDebug(id)
T getParameter(std::string const &) const
std::string encode() const
Definition: InputTag.cc:164
edm::InputTag inputMetTag_
edm::EDGetTokenT< reco::CaloMETCollection > inputMetTagToken_
edm::InputTag inputTag_
edm::EDGetTokenT< std::vector< math::XYZTLorentzVector > > inputTagToken_
RazorVarProducer::~RazorVarProducer ( )

Definition at line 41 of file RazorVarProducer.cc.

42 {
43 }

Member Function Documentation

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

Definition at line 80 of file RazorVarProducer.cc.

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

Referenced by produce().

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

Definition at line 114 of file RazorVarProducer.cc.

References objects.METAnalyzer::met, phi, EnergyCorrector::pt, mathSSE::sqrt(), and tmp.

Referenced by produce().

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

Implements edm::EDProducer.

Definition at line 47 of file RazorVarProducer.cc.

References CalcMR(), CalcR(), edm::Event::getByToken(), razorHemispheres_cff::hemispheres, inputMetTagToken_, inputTagToken_, edm::Event::put(), dttmaxenums::R, dt_dqm_sourceclient_common_cff::reco, and mps_fire::result.

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

48 {
49  using namespace std;
50  using namespace edm;
51  using namespace reco;
52 
53 
54  // get hold of collection of objects
57 
58  // get hold of the MET Collection
60  iEvent.getByToken(inputMetTagToken_, inputMet);
61 
62  std::auto_ptr<std::vector<double> > result(new std::vector<double>);
63  // check the the input collections are available
64  if (hemispheres.isValid() && inputMet.isValid() && hemispheres->size() > 1){
65 
66  TLorentzVector ja(hemispheres->at(0).x(),hemispheres->at(0).y(),hemispheres->at(0).z(),hemispheres->at(0).t());
67  TLorentzVector jb(hemispheres->at(1).x(),hemispheres->at(1).y(),hemispheres->at(1).z(),hemispheres->at(1).t());
68 
69  std::vector<math::XYZTLorentzVector> muonVec;
70  const double MR = CalcMR(ja,jb);
71  const double R = CalcR(MR,ja,jb,inputMet,muonVec);
72  result->push_back(MR);
73  result->push_back(R);
74 
75  }
76  iEvent.put(result);
77 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
double CalcMR(TLorentzVector ja, TLorentzVector jb)
tuple result
Definition: mps_fire.py:83
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
edm::EDGetTokenT< reco::CaloMETCollection > inputMetTagToken_
double CalcR(double MR, const TLorentzVector &ja, const TLorentzVector &jb, edm::Handle< reco::CaloMETCollection > met, const std::vector< math::XYZTLorentzVector > &muons)
edm::EDGetTokenT< std::vector< math::XYZTLorentzVector > > inputTagToken_

Member Data Documentation

edm::InputTag RazorVarProducer::inputMetTag_
private

Definition at line 26 of file RazorVarProducer.h.

Referenced by RazorVarProducer().

edm::EDGetTokenT<reco::CaloMETCollection> RazorVarProducer::inputMetTagToken_
private

Definition at line 30 of file RazorVarProducer.h.

Referenced by produce(), and RazorVarProducer().

edm::InputTag RazorVarProducer::inputTag_
private

Definition at line 25 of file RazorVarProducer.h.

Referenced by RazorVarProducer().

edm::EDGetTokenT<std::vector<math::XYZTLorentzVector> > RazorVarProducer::inputTagToken_
private

Definition at line 29 of file RazorVarProducer.h.

Referenced by produce(), and RazorVarProducer().