ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/ShallowTools/plugins/ShallowTracksProducer.cc
Revision: 1.3
Committed: Fri Jul 10 16:57:49 2009 UTC (15 years, 10 months ago) by bbetchar
Content type: text/plain
Branch: MAIN
Changes since 1.2: +13 -5 lines
Log Message:
Add qoverp and qoverperr

File Contents

# User Rev Content
1 bbetchar 1.1 #include "UserCode/ShallowTools/interface/ShallowTracksProducer.h"
2    
3     #include "DataFormats/TrackReco/interface/Track.h"
4     #include "DataFormats/TrackReco/interface/TrackFwd.h"
5     #include "TrackingTools/PatternTools/interface/Trajectory.h"
6     #include "boost/foreach.hpp"
7    
8     ShallowTracksProducer::ShallowTracksProducer(const edm::ParameterSet& iConfig)
9     : theTracksLabel( iConfig.getParameter<edm::InputTag>("Tracks") ),
10     Prefix ( iConfig.getParameter<std::string>("Prefix") ),
11     Suffix ( iConfig.getParameter<std::string>("Suffix") )
12     {
13     produces <unsigned int> ( Prefix + "number" + Suffix );
14     produces <std::vector<double> > ( Prefix + "chi2" + Suffix );
15     produces <std::vector<double> > ( Prefix + "ndof" + Suffix );
16     produces <std::vector<double> > ( Prefix + "chi2ndof" + Suffix );
17     produces <std::vector<float> > ( Prefix + "charge" + Suffix );
18     produces <std::vector<float> > ( Prefix + "momentum" + Suffix );
19     produces <std::vector<float> > ( Prefix + "pt" + Suffix );
20     produces <std::vector<float> > ( Prefix + "pterr" + Suffix );
21     produces <std::vector<unsigned int> > ( Prefix + "hitsvalid" + Suffix );
22     produces <std::vector<unsigned int> > ( Prefix + "hitslost" + Suffix );
23     produces <std::vector<double> > ( Prefix + "theta" + Suffix );
24 bbetchar 1.3 produces <std::vector<double> > ( Prefix + "thetaerr" + Suffix );
25 bbetchar 1.1 produces <std::vector<double> > ( Prefix + "phi" + Suffix );
26 bbetchar 1.3 produces <std::vector<double> > ( Prefix + "phierr" + Suffix );
27 bbetchar 1.1 produces <std::vector<double> > ( Prefix + "eta" + Suffix );
28 bbetchar 1.3 produces <std::vector<double> > ( Prefix + "etaerr" + Suffix );
29 bbetchar 1.1 produces <std::vector<double> > ( Prefix + "dxy" + Suffix );
30 bbetchar 1.3 produces <std::vector<double> > ( Prefix + "dxyerr" + Suffix );
31 bbetchar 1.1 produces <std::vector<double> > ( Prefix + "dsz" + Suffix );
32 bbetchar 1.3 produces <std::vector<double> > ( Prefix + "dszerr" + Suffix );
33     produces <std::vector<double> > ( Prefix + "qoverp" + Suffix );
34     produces <std::vector<double> > ( Prefix + "qoverperr" + Suffix );
35 bbetchar 1.1 produces <std::vector<double> > ( Prefix + "vx" + Suffix );
36     produces <std::vector<double> > ( Prefix + "vy" + Suffix );
37     produces <std::vector<double> > ( Prefix + "vz" + Suffix );
38     }
39    
40     void ShallowTracksProducer::
41     produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
42     std::auto_ptr<unsigned int> number ( new unsigned int(0) );
43     std::auto_ptr<std::vector<double> > chi2 ( new std::vector<double>() );
44     std::auto_ptr<std::vector<double> > ndof ( new std::vector<double>() );
45     std::auto_ptr<std::vector<double> > chi2ndof ( new std::vector<double>() );
46     std::auto_ptr<std::vector<float> > charge ( new std::vector<float>() );
47     std::auto_ptr<std::vector<float> > momentum ( new std::vector<float>() );
48     std::auto_ptr<std::vector<float> > pt ( new std::vector<float>() );
49     std::auto_ptr<std::vector<float> > pterr ( new std::vector<float>() );
50     std::auto_ptr<std::vector<unsigned int> > hitsvalid ( new std::vector<unsigned int>() );
51     std::auto_ptr<std::vector<unsigned int> > hitslost ( new std::vector<unsigned int>() );
52     std::auto_ptr<std::vector<double> > theta ( new std::vector<double>() );
53     std::auto_ptr<std::vector<double> > thetaerr ( new std::vector<double>() );
54     std::auto_ptr<std::vector<double> > phi ( new std::vector<double>() );
55     std::auto_ptr<std::vector<double> > phierr ( new std::vector<double>() );
56     std::auto_ptr<std::vector<double> > eta ( new std::vector<double>() );
57     std::auto_ptr<std::vector<double> > etaerr ( new std::vector<double>() );
58     std::auto_ptr<std::vector<double> > dxy ( new std::vector<double>() );
59     std::auto_ptr<std::vector<double> > dxyerr ( new std::vector<double>() );
60     std::auto_ptr<std::vector<double> > dsz ( new std::vector<double>() );
61     std::auto_ptr<std::vector<double> > dszerr ( new std::vector<double>() );
62 bbetchar 1.3 std::auto_ptr<std::vector<double> > qoverp ( new std::vector<double>() );
63     std::auto_ptr<std::vector<double> > qoverperr ( new std::vector<double>() );
64 bbetchar 1.1 std::auto_ptr<std::vector<double> > vx ( new std::vector<double>() );
65     std::auto_ptr<std::vector<double> > vy ( new std::vector<double>() );
66     std::auto_ptr<std::vector<double> > vz ( new std::vector<double>() );
67    
68 bbetchar 1.2 edm::Handle<edm::View<reco::Track> > tracks; iEvent.getByLabel(theTracksLabel, tracks);
69 bbetchar 1.1
70     *number = tracks->size();
71     BOOST_FOREACH( const reco::Track track, *tracks) {
72     chi2->push_back( track.chi2() );
73     ndof->push_back( track.ndof() );
74     chi2ndof->push_back( track.chi2()/track.ndof() );
75     charge->push_back( track.charge() );
76     momentum->push_back( track.p() );
77     pt->push_back( track.pt() );
78     pterr->push_back( track.ptError() );
79     hitsvalid->push_back( track.numberOfValidHits() );
80     hitslost->push_back( track.numberOfLostHits() );
81     theta->push_back( track.theta() );
82     thetaerr->push_back( track.thetaError() );
83     phi->push_back( track.phi() );
84     phierr->push_back( track.phiError() );
85     eta->push_back( track.eta() );
86     etaerr->push_back( track.etaError() );
87     dxy->push_back( track.dxy() );
88     dxyerr->push_back( track.dxyError() );
89     dsz->push_back( track.dsz() );
90     dszerr->push_back( track.dszError() );
91 bbetchar 1.3 qoverp->push_back( track.qoverp() );
92     qoverperr->push_back( track.qoverpError() );
93 bbetchar 1.1 vx->push_back( track.vx() );
94     vy->push_back( track.vy() );
95     vz->push_back( track.vz() );
96     }
97    
98     iEvent.put(number, Prefix + "number" + Suffix );
99     iEvent.put(chi2, Prefix + "chi2" + Suffix );
100     iEvent.put(ndof, Prefix + "ndof" + Suffix );
101     iEvent.put(chi2ndof, Prefix + "chi2ndof" + Suffix );
102     iEvent.put(charge, Prefix + "charge" + Suffix );
103     iEvent.put(momentum, Prefix + "momentum" + Suffix );
104     iEvent.put(pt, Prefix + "pt" + Suffix );
105     iEvent.put(pterr, Prefix + "pterr" + Suffix );
106     iEvent.put(hitsvalid, Prefix + "hitsvalid" + Suffix );
107     iEvent.put(hitslost, Prefix + "hitslost" + Suffix );
108     iEvent.put(theta, Prefix + "theta" + Suffix );
109     iEvent.put(thetaerr, Prefix + "thetaerr" + Suffix );
110     iEvent.put(phi, Prefix + "phi" + Suffix );
111     iEvent.put(phierr, Prefix + "phierr" + Suffix );
112     iEvent.put(eta, Prefix + "eta" + Suffix );
113     iEvent.put(etaerr, Prefix + "etaerr" + Suffix );
114     iEvent.put(dxy, Prefix + "dxy" + Suffix );
115     iEvent.put(dxyerr, Prefix + "dxyerr" + Suffix );
116     iEvent.put(dsz, Prefix + "dsz" + Suffix );
117     iEvent.put(dszerr, Prefix + "dszerr" + Suffix );
118 bbetchar 1.3 iEvent.put(qoverp, Prefix + "qoverp" + Suffix );
119     iEvent.put(qoverperr, Prefix + "qoverperr" + Suffix );
120 bbetchar 1.1 iEvent.put(vx, Prefix + "vx" + Suffix );
121     iEvent.put(vy, Prefix + "vy" + Suffix );
122     iEvent.put(vz, Prefix + "vz" + Suffix );
123    
124     }
125