CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ColinsSoperVariablesComputer Class Reference
Inheritance diagram for ColinsSoperVariablesComputer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ColinsSoperVariablesComputer (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~ColinsSoperVariablesComputer () 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::EDGetTokenT< edm::View< reco::Candidate > > parentBosonToken_
 

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 25 of file ColinsSoperVariablesComputer.cc.

Constructor & Destructor Documentation

◆ ColinsSoperVariablesComputer()

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

Definition at line 36 of file ColinsSoperVariablesComputer.cc.

38  produces<edm::ValueMap<float>>("costheta");
39  produces<edm::ValueMap<float>>("sin2theta");
40  produces<edm::ValueMap<float>>("tanphi");
41 }

◆ ~ColinsSoperVariablesComputer()

ColinsSoperVariablesComputer::~ColinsSoperVariablesComputer ( )
override

Definition at line 43 of file ColinsSoperVariablesComputer.cc.

43 {}

Member Function Documentation

◆ produce()

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

Implements edm::EDProducer.

Definition at line 45 of file ColinsSoperVariablesComputer.cc.

45  {
46  using namespace edm;
47 
48  // read input
50  iEvent.getByToken(parentBosonToken_, bosons);
51 
52  // prepare vector for output
53  std::vector<float> values;
54  std::vector<float> values2;
55  std::vector<float> values3;
56 
57  // fill: use brute force
58  double costheta = -10.0;
59  double sin2theta = -10.0;
60  double tanphi = -10.0;
61 
62  const reco::Candidate* daughter1 = nullptr;
63  const reco::Candidate* daughter2 = nullptr;
64  TLorentzVector mu(0., 0., 0., 0.);
65  TLorentzVector mubar(0., 0., 0., 0.);
66  bool isOS = false;
67  int charge1 = 0, charge2 = 0;
68  double res[3] = {-10., -10., -10.};
69 
70  View<reco::Candidate>::const_iterator boson, endbosons = bosons->end();
71 
72  for (boson = bosons->begin(); boson != endbosons; ++boson) {
73  daughter1 = boson->daughter(0);
74  daughter2 = boson->daughter(1);
75 
76  if (!(nullptr == daughter1 || nullptr == daughter2)) {
77  isOS = false;
78  charge1 = daughter1->charge();
79  charge2 = daughter2->charge();
80  isOS = charge1 * charge2 < 0;
81  if (isOS && charge1 < 0) {
82  mu.SetPxPyPzE(daughter1->px(), daughter1->py(), daughter1->pz(), daughter1->energy());
83  mubar.SetPxPyPzE(daughter2->px(), daughter2->py(), daughter2->pz(), daughter2->energy());
84  }
85  if (isOS && charge1 > 0) {
86  mu.SetPxPyPzE(daughter2->px(), daughter2->py(), daughter2->pz(), daughter2->energy());
87  mubar.SetPxPyPzE(daughter1->px(), daughter1->py(), daughter1->pz(), daughter1->energy());
88  }
89  }
90 
91  calCSVariables(mu, mubar, res, boson->pz() < 0.0);
92 
93  costheta = res[0];
94  sin2theta = res[1];
95  tanphi = res[2];
96 
97  values.push_back(costheta);
98  values2.push_back(sin2theta);
99  values3.push_back(tanphi);
100  }
101 
102  // convert into ValueMap and store
103  auto valMap = std::make_unique<ValueMap<float>>();
105  filler.insert(bosons, values.begin(), values.end());
106  filler.fill();
107  iEvent.put(std::move(valMap), "costheta");
108 
109  // ---> same for sin2theta
110  auto valMap2 = std::make_unique<ValueMap<float>>();
111  ValueMap<float>::Filler filler2(*valMap2);
112  filler2.insert(bosons, values2.begin(), values2.end());
113  filler2.fill();
114  iEvent.put(std::move(valMap2), "sin2theta");
115 
116  // ---> same for tanphi
117  auto valMap3 = std::make_unique<ValueMap<float>>();
118  ValueMap<float>::Filler filler3(*valMap3);
119  filler3.insert(bosons, values3.begin(), values3.end());
120  filler3.fill();
121  iEvent.put(std::move(valMap3), "tanphi");
122 }

References calCSVariables(), reco::Candidate::charge(), reco::Candidate::daughter(), reco::Candidate::energy(), trigObjTnPSource_cfi::filler, iEvent, eostools::move(), amptDefaultParameters_cff::mu, RPCpg::mubar, parentBosonToken_, reco::Candidate::px(), reco::Candidate::py(), reco::Candidate::pz(), and contentValuesCheck::values.

Member Data Documentation

◆ parentBosonToken_

edm::EDGetTokenT<edm::View<reco::Candidate> > ColinsSoperVariablesComputer::parentBosonToken_
private

Definition at line 33 of file ColinsSoperVariablesComputer.cc.

Referenced by produce().

reco::Candidate::energy
virtual double energy() const =0
energy
ColinsSoperVariablesComputer::parentBosonToken_
edm::EDGetTokenT< edm::View< reco::Candidate > > parentBosonToken_
Definition: ColinsSoperVariablesComputer.cc:33
amptDefaultParameters_cff.mu
mu
Definition: amptDefaultParameters_cff.py:16
edm
HLT enums.
Definition: AlignableModifier.h:19
calCSVariables
void calCSVariables(TLorentzVector mu, TLorentzVector mubar, double *res, bool swap)
Definition: ColinsSoperVariables.h:10
edm::Handle
Definition: AssociativeIterator.h:50
reco::Candidate::pz
virtual double pz() const =0
z coordinate of momentum vector
reco::Candidate::charge
virtual int charge() const =0
electric charge
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
reco::Candidate::py
virtual double py() const =0
y coordinate of momentum vector
edm::View
Definition: CaloClusterFwd.h:14
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition: GenABIO.cc:224
RPCpg::mubar
const int mubar
Definition: Constants.h:23
res
Definition: Electron.h:6
reco::Candidate
Definition: Candidate.h:27
eostools.move
def move(src, dest)
Definition: eostools.py:511
reco::Candidate::px
virtual double px() const =0
x coordinate of momentum vector
edm::ValueMap
Definition: ValueMap.h:107
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:159
edm::InputTag
Definition: InputTag.h:15