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
 
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)
 
 ~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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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 wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 27 of file ColinsSoperVariablesComputer.cc.

Constructor & Destructor Documentation

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

Definition at line 38 of file ColinsSoperVariablesComputer.cc.

38  :
40 {
41  produces<edm::ValueMap<float> >("costheta");
42  produces<edm::ValueMap<float> >("sin2theta");
43  produces<edm::ValueMap<float> >("tanphi");
44 }
T getParameter(std::string const &) const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::View< reco::Candidate > > parentBosonToken_
ColinsSoperVariablesComputer::~ColinsSoperVariablesComputer ( )
override

Definition at line 47 of file ColinsSoperVariablesComputer.cc.

48 {
49 }

Member Function Documentation

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

Definition at line 52 of file ColinsSoperVariablesComputer.cc.

References calCSVariables(), reco::Candidate::charge(), DEFINE_FWK_MODULE, reco::Candidate::energy(), objects.autophobj::filler, edm::Event::getByToken(), eostools::move(), RPCpg::mu, RPCpg::mubar, parentBosonToken_, edm::Event::put(), reco::Candidate::px(), reco::Candidate::py(), reco::Candidate::pz(), and MuonErrorMatrixValues_cff::values.

52  {
53  using namespace edm;
54 
55  // read input
57  iEvent.getByToken(parentBosonToken_, bosons);
58 
59 
60  // prepare vector for output
61  std::vector<float> values;
62  std::vector<float> values2;
63  std::vector<float> values3;
64 
65  // fill: use brute force
66  double costheta = -10.0;
67  double sin2theta = -10.0;
68  double tanphi = -10.0;
69 
70  const reco::Candidate* daughter1=nullptr;
71  const reco::Candidate* daughter2=nullptr;
72  TLorentzVector mu (0., 0., 0., 0.);
73  TLorentzVector mubar (0., 0., 0., 0.);
74  bool isOS = false;
75  int charge1=0, charge2 =0;
76  double res[3] = { -10., -10., -10.};
77 
78  View<reco::Candidate>::const_iterator boson, endbosons = bosons->end();
79 
80  for (boson = bosons->begin(); boson != endbosons; ++boson) {
81 
82  daughter1 = boson->daughter(0);
83  daughter2 = boson->daughter(1);
84 
85  if( !(nullptr==daughter1 || nullptr==daughter2) ) {
86  isOS = false;
87  charge1 = daughter1->charge();
88  charge2 = daughter2->charge();
89  isOS = charge1*charge2<0;
90  if(isOS && charge1<0) {
91  mu.SetPxPyPzE( daughter1->px(), daughter1->py(), daughter1->pz(), daughter1->energy() );
92  mubar.SetPxPyPzE( daughter2->px(), daughter2->py(), daughter2->pz(), daughter2->energy() );
93  }
94  if(isOS && charge1>0) {
95  mu.SetPxPyPzE( daughter2->px(), daughter2->py(), daughter2->pz(), daughter2->energy() );
96  mubar.SetPxPyPzE( daughter1->px(), daughter1->py(), daughter1->pz(), daughter1->energy() );
97  }
98  }
99 
100 
101  calCSVariables(mu, mubar, res, boson->pz()<0.0);
102 
103  costheta = res[0];
104  sin2theta = res[1];
105  tanphi = res[2];
106 
107  values.push_back(costheta);
108  values2.push_back(sin2theta);
109  values3.push_back(tanphi);
110  }
111 
112 
113  // convert into ValueMap and store
114  auto valMap = std::make_unique<ValueMap<float>>();
116  filler.insert(bosons, values.begin(), values.end());
117  filler.fill();
118  iEvent.put(std::move(valMap), "costheta");
119 
120 
121  // ---> same for sin2theta
122  auto valMap2 = std::make_unique<ValueMap<float>>();
123  ValueMap<float>::Filler filler2(*valMap2);
124  filler2.insert(bosons, values2.begin(), values2.end());
125  filler2.fill();
126  iEvent.put(std::move(valMap2), "sin2theta");
127 
128  // ---> same for tanphi
129  auto valMap3 = std::make_unique<ValueMap<float>>();
130  ValueMap<float>::Filler filler3(*valMap3);
131  filler3.insert(bosons, values3.begin(), values3.end());
132  filler3.fill();
133  iEvent.put(std::move(valMap3), "tanphi");
134 
135 }
virtual double pz() const =0
z coordinate of momentum vector
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
Definition: Electron.h:6
virtual double energy() const =0
energy
virtual double py() const =0
y coordinate of momentum vector
edm::EDGetTokenT< edm::View< reco::Candidate > > parentBosonToken_
const int mu
Definition: Constants.h:22
const int mubar
Definition: Constants.h:23
void calCSVariables(TLorentzVector mu, TLorentzVector mubar, double *res, bool swap)
virtual int charge() const =0
electric charge
HLT enums.
virtual double px() const =0
x coordinate of momentum vector
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

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

Definition at line 35 of file ColinsSoperVariablesComputer.cc.

Referenced by produce().