CMS 3D CMS Logo

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)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 RazorVarProducer (const edm::ParameterSet &)
 
 ~RazorVarProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::InputTag inputMetTag_
 
edm::EDGetTokenT< reco::CaloMETCollectioninputMetTagToken_
 
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
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
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)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 15 of file RazorVarProducer.h.

Constructor & Destructor Documentation

◆ RazorVarProducer()

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

Definition at line 26 of file RazorVarProducer.cc.

27  : inputTag_(iConfig.getParameter<edm::InputTag>("inputTag")),
28  inputMetTag_(iConfig.getParameter<edm::InputTag>("inputMetTag")) {
29  // set Token(-s)
30  inputTagToken_ = consumes<std::vector<math::XYZTLorentzVector>>(iConfig.getParameter<edm::InputTag>("inputTag"));
31  inputMetTagToken_ = consumes<reco::CaloMETCollection>(iConfig.getParameter<edm::InputTag>("inputMetTag"));
32 
33  produces<std::vector<double>>();
34 
35  LogDebug("") << "Inputs: " << inputTag_.encode() << " " << inputMetTag_.encode() << ".";
36 }

References edm::InputTag::encode(), edm::ParameterSet::getParameter(), inputMetTag_, inputMetTagToken_, inputTag_, inputTagToken_, and LogDebug.

◆ ~RazorVarProducer()

RazorVarProducer::~RazorVarProducer ( )
override

Definition at line 38 of file RazorVarProducer.cc.

38 {}

Member Function Documentation

◆ CalcMR()

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

Definition at line 69 of file RazorVarProducer.cc.

69  {
70  if (ja.Pt() <= 0.1)
71  return -1;
72 
73  ja.SetPtEtaPhiM(ja.Pt(), ja.Eta(), ja.Phi(), 0.0);
74  jb.SetPtEtaPhiM(jb.Pt(), jb.Eta(), jb.Phi(), 0.0);
75 
76  if (ja.Pt() > jb.Pt()) {
77  TLorentzVector temp = ja;
78  ja = jb;
79  jb = temp;
80  }
81 
82  double A = ja.P();
83  double B = jb.P();
84  double az = ja.Pz();
85  double bz = jb.Pz();
86  TVector3 jaT, jbT;
87  jaT.SetXYZ(ja.Px(), ja.Py(), 0.0);
88  jbT.SetXYZ(jb.Px(), jb.Py(), 0.0);
89  double ATBT = (jaT + jbT).Mag2();
90 
91  double MR = sqrt((A + B) * (A + B) - (az + bz) * (az + bz) -
92  (jbT.Dot(jbT) - jaT.Dot(jaT)) * (jbT.Dot(jbT) - jaT.Dot(jaT)) / (jaT + jbT).Mag2());
93 
94  double mybeta = (jbT.Dot(jbT) - jaT.Dot(jaT)) / sqrt(ATBT * ((A + B) * (A + B) - (az + bz) * (az + bz)));
95 
96  double mygamma = 1. / sqrt(1. - mybeta * mybeta);
97 
98  // use gamma times MRstar
99  return MR * mygamma;
100 }

References TtFullHadDaughter::B, mathSSE::sqrt(), and groupFilesInBlocks::temp.

Referenced by produce().

◆ CalcR()

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 102 of file RazorVarProducer.cc.

106  {
107  // now we can calculate MTR
108  TVector3 met;
109  met.SetPtEtaPhi((inputMet->front()).pt(), 0.0, (inputMet->front()).phi());
110 
111  std::vector<math::XYZTLorentzVector>::const_iterator muonIt;
112  for (muonIt = muons.begin(); muonIt != muons.end(); muonIt++) {
113  TVector3 tmp;
114  tmp.SetPtEtaPhi(muonIt->pt(), 0, muonIt->phi());
115  met -= tmp;
116  }
117 
118  double MTR = sqrt(0.5 * (met.Mag() * (ja.Pt() + jb.Pt()) - met.Dot(ja.Vect() + jb.Vect())));
119 
120  // filter events
121  return float(MTR) / float(MR); // R
122 }

References dqmMemoryStats::float, BTaggingMonitor_cfi::met, PDWG_BPHSkim_cff::muons, phi, DiDispStaMuonMonitor_cfi::pt, mathSSE::sqrt(), and createJobs::tmp.

Referenced by produce().

◆ produce()

void RazorVarProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 41 of file RazorVarProducer.cc.

41  {
42  using namespace std;
43  using namespace edm;
44  using namespace reco;
45 
46  // get hold of collection of objects
48  iEvent.getByToken(inputTagToken_, hemispheres);
49 
50  // get hold of the MET Collection
52  iEvent.getByToken(inputMetTagToken_, inputMet);
53 
54  std::unique_ptr<std::vector<double>> result(new std::vector<double>);
55  // check the the input collections are available
56  if (hemispheres.isValid() && inputMet.isValid() && hemispheres->size() > 1) {
57  TLorentzVector ja(hemispheres->at(0).x(), hemispheres->at(0).y(), hemispheres->at(0).z(), hemispheres->at(0).t());
58  TLorentzVector jb(hemispheres->at(1).x(), hemispheres->at(1).y(), hemispheres->at(1).z(), hemispheres->at(1).t());
59 
60  std::vector<math::XYZTLorentzVector> muonVec;
61  const double MR = CalcMR(ja, jb);
62  const double R = CalcR(MR, ja, jb, inputMet, muonVec);
63  result->push_back(MR);
64  result->push_back(R);
65  }
66  iEvent.put(std::move(result));
67 }

References CalcMR(), CalcR(), razorHemispheres_cff::hemispheres, iEvent, inputMetTagToken_, inputTagToken_, edm::HandleBase::isValid(), eostools::move(), dttmaxenums::R, and mps_fire::result.

Member Data Documentation

◆ inputMetTag_

edm::InputTag RazorVarProducer::inputMetTag_
private

Definition at line 30 of file RazorVarProducer.h.

Referenced by RazorVarProducer().

◆ inputMetTagToken_

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

Definition at line 34 of file RazorVarProducer.h.

Referenced by produce(), and RazorVarProducer().

◆ inputTag_

edm::InputTag RazorVarProducer::inputTag_
private

Definition at line 29 of file RazorVarProducer.h.

Referenced by RazorVarProducer().

◆ inputTagToken_

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

Definition at line 33 of file RazorVarProducer.h.

Referenced by produce(), and RazorVarProducer().

PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
RazorVarProducer::inputTag_
edm::InputTag inputTag_
Definition: RazorVarProducer.h:29
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
edm
HLT enums.
Definition: AlignableModifier.h:19
RazorVarProducer::inputTagToken_
edm::EDGetTokenT< std::vector< math::XYZTLorentzVector > > inputTagToken_
Definition: RazorVarProducer.h:33
RazorVarProducer::CalcMR
double CalcMR(TLorentzVector ja, TLorentzVector jb)
Definition: RazorVarProducer.cc:69
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
edm::Handle
Definition: AssociativeIterator.h:50
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
BTaggingMonitor_cfi.met
met
Definition: BTaggingMonitor_cfi.py:84
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
razorHemispheres_cff.hemispheres
hemispheres
Definition: razorHemispheres_cff.py:3
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::InputTag::encode
std::string encode() const
Definition: InputTag.cc:159
RazorVarProducer::inputMetTagToken_
edm::EDGetTokenT< reco::CaloMETCollection > inputMetTagToken_
Definition: RazorVarProducer.h:34
DDAxes::phi
RazorVarProducer::inputMetTag_
edm::InputTag inputMetTag_
Definition: RazorVarProducer.h:30
TtFullHadDaughter::B
static const std::string B
Definition: TtFullHadronicEvent.h:9
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
mps_fire.result
result
Definition: mps_fire.py:311
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
RazorVarProducer::CalcR
double CalcR(double MR, const TLorentzVector &ja, const TLorentzVector &jb, edm::Handle< reco::CaloMETCollection > met, const std::vector< math::XYZTLorentzVector > &muons)
Definition: RazorVarProducer.cc:102
A
dttmaxenums::R
Definition: DTTMax.h:29
edm::InputTag
Definition: InputTag.h:15