CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RecoConversionMaker.cc
Go to the documentation of this file.
2 
3 using namespace std;
4 using namespace reco;
5 using namespace edm;
8 
10 
11  Conversion_ = iCollector.consumes<edm::View<reco::Conversion> >(iConfig.getParameter<edm::InputTag>("recoConversionInputTag"));
12  BeamSpot_ = iCollector.consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpotTag"));
13 
14 }
15 
16 double lxy(const math::XYZPoint& myBeamSpot, const Conversion& conv) {
17 
18  const reco::Vertex &vtx = conv.conversionVertex();
19  if (!vtx.isValid()) return -9999.;
20 
22 
23  double dbsx = vtx.x() - myBeamSpot.x();
24  double dbsy = vtx.y() - myBeamSpot.y();
25  double lxy = (mom.x()*dbsx + mom.y()*dbsy)/mom.rho();
26  return lxy;
27 
28 }
29 
31 
33  hww.Load_convs_quality();
34  hww.Load_convs_tkidx();
35  hww.Load_convs_tkalgo();
37  hww.Load_convs_ndof();
38  hww.Load_convs_chi2();
39  hww.Load_convs_dl();
40 
41  bool validToken;
42 
43  // get reco Conversions
44  Handle<View<Conversion> > convs_h;
45  validToken = iEvent.getByToken(Conversion_, convs_h);
46  if(!validToken) return;
47 
48  Handle<BeamSpot> beamSpotH;
49  validToken = iEvent.getByToken(BeamSpot_, beamSpotH);
50  if(!validToken) return;
51 
52  for(View<Conversion>::const_iterator it = convs_h->begin();
53  it != convs_h->end(); it++) {
54 
55  hww.convs_isConverted().push_back(it->isConverted());
56  //quality
57  int qualityMask = 0;
58  for(int iM = 0; iM < 32; ++iM) {
59  if(it->quality((Conversion::ConversionQuality)iM)) qualityMask |= 1 << iM;
60  }
61 
62  hww.convs_quality().push_back(qualityMask);
63 
64  vector<edm::RefToBase<reco::Track> > v_temp_trks = it->tracks();
65  vector<int> v_temp_out;
66  vector<int> v_temp_outalgo;
67  for(unsigned int i = 0; i < v_temp_trks.size(); i++) {
68  v_temp_out.push_back(v_temp_trks.at(i).key());
69  v_temp_outalgo.push_back(v_temp_trks.at(i)->algo());
70  }
71 
72 
73  hww.convs_tkidx().push_back(v_temp_out);
74  hww.convs_tkalgo().push_back(v_temp_outalgo);
75 
76  v_temp_out.clear();
77  v_temp_outalgo.clear();
78  vector<uint8_t> v_temp_nhits = it->nHitsBeforeVtx();
79 
80  for(unsigned int i = 0; i < v_temp_nhits.size(); i++) v_temp_out.push_back(v_temp_nhits.at(i));
81 
82  hww.convs_nHitsBeforeVtx().push_back(v_temp_out);
83  hww.convs_ndof().push_back(it->conversionVertex().ndof() );
84  hww.convs_chi2().push_back(it->conversionVertex().chi2() );
85  hww.convs_dl().push_back(lxy(beamSpotH->position(), *it));
86 
87  }//reco conversion loop
88 }
89 
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
Definition: Conversion.h:97
double lxy(const math::XYZPoint &myBeamSpot, const Conversion &conv)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
void SetVars(HWW &, const edm::Event &, const edm::EventSetup &)
void Load_convs_isConverted()
Definition: HWW.cc:1283
int i
Definition: DBlmapReader.cc:9
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
void Load_convs_tkalgo()
Definition: HWW.cc:1286
RecoConversionMaker(const edm::ParameterSet &, edm::ConsumesCollector)
void Load_convs_nHitsBeforeVtx()
Definition: HWW.cc:1292
static HepMC::IO_HEPEVT conv
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
double y() const
y coordinate
Definition: Vertex.h:110
bool isValid() const
Tells whether the vertex is valid.
Definition: Vertex.h:60
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
Definition: Point3D.h:10
void Load_convs_quality()
Definition: HWW.cc:1295
std::pair< double, double > Point
Definition: CaloEllipse.h:18
math::XYZVectorF refittedPairMomentum() const
Conversion tracks momentum from the tracks refitted with vertex constraint.
Definition: Conversion.cc:248
void Load_convs_dl()
Definition: HWW.cc:1280
void Load_convs_ndof()
Definition: HWW.cc:1274
int iEvent
Definition: GenABIO.cc:230
std::vector< std::vector< int > > & convs_nHitsBeforeVtx()
Definition: HWW.cc:673
std::vector< std::vector< int > > & convs_tkalgo()
Definition: HWW.cc:665
std::vector< float > & convs_chi2()
Definition: HWW.cc:653
std::vector< float > & convs_ndof()
Definition: HWW.cc:649
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float > > XYZVectorF
spatial vector with cartesian internal representation
Definition: Vector3D.h:17
std::vector< int > & convs_quality()
Definition: HWW.cc:677
std::vector< float > & convs_dl()
Definition: HWW.cc:657
Definition: HWW.h:11
double x() const
x coordinate
Definition: Vertex.h:108
void Load_convs_chi2()
Definition: HWW.cc:1277
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
void Load_convs_tkidx()
Definition: HWW.cc:1289
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< float > > XYZTLorentzVectorF
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:22
std::vector< int > & convs_isConverted()
Definition: HWW.cc:661
std::vector< std::vector< int > > & convs_tkidx()
Definition: HWW.cc:669
math::PtEtaPhiELorentzVectorF LorentzVector