CMS 3D CMS Logo

ShallowTracksProducer.cc
Go to the documentation of this file.
2 
8 
10  : tracks_token_(consumes<edm::View<reco::Track>>(iConfig.getParameter<edm::InputTag>("Tracks"))),
11  Prefix(iConfig.getParameter<std::string>("Prefix")),
12  Suffix(iConfig.getParameter<std::string>("Suffix")),
13  numberPut_(produces<unsigned int>(Prefix + "number" + Suffix)),
14  chi2Put_(produces<std::vector<double>>(Prefix + "chi2" + Suffix)),
15  ndofPut_(produces<std::vector<double>>(Prefix + "ndof" + Suffix)),
16  chi2ndofPut_(produces<std::vector<double>>(Prefix + "chi2ndof" + Suffix)),
17  chargePut_(produces<std::vector<float>>(Prefix + "charge" + Suffix)),
18  momentumPut_(produces<std::vector<float>>(Prefix + "momentum" + Suffix)),
19  ptPut_(produces<std::vector<float>>(Prefix + "pt" + Suffix)),
20  pterrPut_(produces<std::vector<float>>(Prefix + "pterr" + Suffix)),
21  hitsvalidPut_(produces<std::vector<unsigned int>>(Prefix + "hitsvalid" + Suffix)),
22  hitslostPut_(produces<std::vector<unsigned int>>(Prefix + "hitslost" + Suffix)),
23  thetaPut_(produces<std::vector<double>>(Prefix + "theta" + Suffix)),
24  thetaerrPut_(produces<std::vector<double>>(Prefix + "thetaerr" + Suffix)),
25  phiPut_(produces<std::vector<double>>(Prefix + "phi" + Suffix)),
26  phierrPut_(produces<std::vector<double>>(Prefix + "phierr" + Suffix)),
27  etaPut_(produces<std::vector<double>>(Prefix + "eta" + Suffix)),
28  etaerrPut_(produces<std::vector<double>>(Prefix + "etaerr" + Suffix)),
29  dxyPut_(produces<std::vector<double>>(Prefix + "dxy" + Suffix)),
30  dxyerrPut_(produces<std::vector<double>>(Prefix + "dxyerr" + Suffix)),
31  dszPut_(produces<std::vector<double>>(Prefix + "dsz" + Suffix)),
32  dszerrPut_(produces<std::vector<double>>(Prefix + "dszerr" + Suffix)),
33  qoverpPut_(produces<std::vector<double>>(Prefix + "qoverp" + Suffix)),
34  qoverperrPut_(produces<std::vector<double>>(Prefix + "qoverperr" + Suffix)),
35  vxPut_(produces<std::vector<double>>(Prefix + "vx" + Suffix)),
36  vyPut_(produces<std::vector<double>>(Prefix + "vy" + Suffix)),
37  vzPut_(produces<std::vector<double>>(Prefix + "vz" + Suffix)),
38  algoPut_(produces<std::vector<int>>(Prefix + "algo" + Suffix)) {}
39 
42  iEvent.getByToken(tracks_token_, tracks);
43 
44  unsigned int number = tracks->size();
45  std::vector<double> chi2;
46  chi2.reserve(number);
47  std::vector<double> ndof;
48  ndof.reserve(number);
49  std::vector<double> chi2ndof;
50  chi2ndof.reserve(number);
51  std::vector<float> charge;
52  charge.reserve(number);
53  std::vector<float> momentum;
54  momentum.reserve(number);
55  std::vector<float> pt;
56  pt.reserve(number);
57  std::vector<float> pterr;
58  pterr.reserve(number);
59  std::vector<unsigned int> hitsvalid;
60  hitsvalid.reserve(number);
61  std::vector<unsigned int> hitslost;
62  hitslost.reserve(number);
63  std::vector<double> theta;
64  theta.reserve(number);
65  std::vector<double> thetaerr;
66  thetaerr.reserve(number);
67  std::vector<double> phi;
68  phi.reserve(number);
69  std::vector<double> phierr;
70  phierr.reserve(number);
71  std::vector<double> eta;
72  eta.reserve(number);
73  std::vector<double> etaerr;
74  etaerr.reserve(number);
75  std::vector<double> dxy;
76  dxy.reserve(number);
77  std::vector<double> dxyerr;
78  dxyerr.reserve(number);
79  std::vector<double> dsz;
80  dsz.reserve(number);
81  std::vector<double> dszerr;
82  dszerr.reserve(number);
83  std::vector<double> qoverp;
84  qoverp.reserve(number);
85  std::vector<double> qoverperr;
86  qoverperr.reserve(number);
87  std::vector<double> vx;
88  vx.reserve(number);
89  std::vector<double> vy;
90  vy.reserve(number);
91  std::vector<double> vz;
92  vz.reserve(number);
93  std::vector<int> algo;
94  algo.reserve(number);
95 
96  for (auto const& track : *tracks) {
97  chi2.push_back(track.chi2());
98  ndof.push_back(track.ndof());
99  chi2ndof.push_back(track.chi2() / track.ndof());
100  charge.push_back(track.charge());
101  momentum.push_back(track.p());
102  pt.push_back(track.pt());
103  pterr.push_back(track.ptError());
104  hitsvalid.push_back(track.numberOfValidHits());
105  hitslost.push_back(track.numberOfLostHits());
106  theta.push_back(track.theta());
107  thetaerr.push_back(track.thetaError());
108  phi.push_back(track.phi());
109  phierr.push_back(track.phiError());
110  eta.push_back(track.eta());
111  etaerr.push_back(track.etaError());
112  dxy.push_back(track.dxy());
113  dxyerr.push_back(track.dxyError());
114  dsz.push_back(track.dsz());
115  dszerr.push_back(track.dszError());
116  qoverp.push_back(track.qoverp());
117  qoverperr.push_back(track.qoverpError());
118  vx.push_back(track.vx());
119  vy.push_back(track.vy());
120  vz.push_back(track.vz());
121  algo.push_back((int)track.algo());
122  }
123 
124  iEvent.emplace(numberPut_, number);
125  iEvent.emplace(chi2Put_, std::move(chi2));
126  iEvent.emplace(ndofPut_, std::move(ndof));
127  iEvent.emplace(chi2ndofPut_, std::move(chi2ndof));
128  iEvent.emplace(chargePut_, std::move(charge));
129  iEvent.emplace(momentumPut_, std::move(momentum));
130  iEvent.emplace(ptPut_, std::move(pt));
131  iEvent.emplace(pterrPut_, std::move(pterr));
132  iEvent.emplace(hitsvalidPut_, std::move(hitsvalid));
133  iEvent.emplace(hitslostPut_, std::move(hitslost));
134  iEvent.emplace(thetaPut_, std::move(theta));
135  iEvent.emplace(thetaerrPut_, std::move(thetaerr));
136  iEvent.emplace(phiPut_, std::move(phi));
137  iEvent.emplace(phierrPut_, std::move(phierr));
138  iEvent.emplace(etaPut_, std::move(eta));
139  iEvent.emplace(etaerrPut_, std::move(etaerr));
140  iEvent.emplace(dxyPut_, std::move(dxy));
141  iEvent.emplace(dxyerrPut_, std::move(dxyerr));
142  iEvent.emplace(dszPut_, std::move(dsz));
143  iEvent.emplace(dszerrPut_, std::move(dszerr));
144  iEvent.emplace(qoverpPut_, std::move(qoverp));
145  iEvent.emplace(qoverperrPut_, std::move(qoverperr));
146  iEvent.emplace(vxPut_, std::move(vx));
147  iEvent.emplace(vyPut_, std::move(vy));
148  iEvent.emplace(vzPut_, std::move(vz));
149  iEvent.emplace(algoPut_, std::move(algo));
150 }
const edm::EDPutTokenT< std::vector< double > > dxyPut_
const edm::EDPutTokenT< std::vector< double > > dszerrPut_
const edm::EDPutTokenT< std::vector< float > > ptPut_
const edm::EDPutTokenT< std::vector< int > > algoPut_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
const edm::EDPutTokenT< std::vector< double > > qoverperrPut_
const edm::EDGetTokenT< edm::View< reco::Track > > tracks_token_
const edm::EDPutTokenT< std::vector< double > > vyPut_
const edm::EDPutTokenT< std::vector< float > > momentumPut_
int iEvent
Definition: GenABIO.cc:224
const edm::EDPutTokenT< std::vector< unsigned int > > hitslostPut_
const edm::EDPutTokenT< std::vector< double > > dxyerrPut_
const edm::EDPutTokenT< std::vector< double > > ndofPut_
const edm::EDPutTokenT< std::vector< float > > pterrPut_
ShallowTracksProducer(const edm::ParameterSet &)
const edm::EDPutTokenT< unsigned int > numberPut_
const edm::EDPutTokenT< std::vector< double > > vzPut_
const edm::EDPutTokenT< std::vector< double > > phierrPut_
const edm::EDPutTokenT< std::vector< double > > qoverpPut_
const edm::EDPutTokenT< std::vector< double > > chi2ndofPut_
const edm::EDPutTokenT< std::vector< double > > thetaerrPut_
const edm::EDPutTokenT< std::vector< double > > chi2Put_
const edm::EDPutTokenT< std::vector< unsigned int > > hitsvalidPut_
const edm::EDPutTokenT< std::vector< double > > vxPut_
fixed size matrix
HLT enums.
const edm::EDPutTokenT< std::vector< double > > phiPut_
const edm::EDPutTokenT< std::vector< double > > etaPut_
const edm::EDPutTokenT< std::vector< double > > dszPut_
const edm::EDPutTokenT< std::vector< double > > etaerrPut_
const edm::EDPutTokenT< std::vector< float > > chargePut_
Geom::Theta< T > theta() const
def move(src, dest)
Definition: eostools.py:511
const edm::EDPutTokenT< std::vector< double > > thetaPut_