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
ColinsSoperVariablesComputer Class Reference
Inheritance diagram for ColinsSoperVariablesComputer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 ColinsSoperVariablesComputer (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
virtual ~ColinsSoperVariablesComputer ()
 
- 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 parentBoson_
 

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

Constructor & Destructor Documentation

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

Definition at line 38 of file ColinsSoperVariablesComputer.cc.

38  :
39  parentBoson_(iConfig.getParameter<edm::InputTag>("parentBoson"))
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
ColinsSoperVariablesComputer::~ColinsSoperVariablesComputer ( )
virtual

Definition at line 47 of file ColinsSoperVariablesComputer.cc.

48 {
49 }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 52 of file ColinsSoperVariablesComputer.cc.

References calCSVariables(), edm::Event::getByLabel(), RPCpg::mu, RPCpg::mubar, NULL, parentBoson_, edm::Event::put(), and makeHLTPrescaleTable::values.

52  {
53  using namespace edm;
54 
55  // read input
57  iEvent.getByLabel(parentBoson_, 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=NULL;
71  const reco::Candidate* daughter2=NULL;
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( !(0==daughter1 || 0==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  std::auto_ptr<ValueMap<float> > valMap(new ValueMap<float>());
115  ValueMap<float>::Filler filler(*valMap);
116  filler.insert(bosons, values.begin(), values.end());
117  filler.fill();
118  iEvent.put(valMap, "costheta");
119 
120 
121  // ---> same for sin2theta
122  std::auto_ptr<ValueMap<float> > valMap2(new ValueMap<float>());
123  ValueMap<float>::Filler filler2(*valMap2);
124  filler2.insert(bosons, values2.begin(), values2.end());
125  filler2.fill();
126  iEvent.put(valMap2, "sin2theta");
127 
128  // ---> same for tanphi
129  std::auto_ptr<ValueMap<float> > valMap3(new ValueMap<float>());
130  ValueMap<float>::Filler filler3(*valMap3);
131  filler3.insert(bosons, values3.begin(), values3.end());
132  filler3.fill();
133  iEvent.put(valMap3, "tanphi");
134 
135 }
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
#define NULL
Definition: scimark2.h:8
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
const int mu
Definition: Constants.h:23
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
const int mubar
Definition: Constants.h:24
void calCSVariables(TLorentzVector mu, TLorentzVector mubar, double *res, bool swap)

Member Data Documentation

edm::InputTag ColinsSoperVariablesComputer::parentBoson_
private

Definition at line 35 of file ColinsSoperVariablesComputer.cc.

Referenced by produce().