14 #include "CLHEP/Vector/LorentzVector.h" 41 outputFile_(iConfig.getUntrackedParameter<
std::
string>(
"outputFile")),
44 verbose_(iConfig.getUntrackedParameter<
bool>(
"verbose",
false)) {
48 tversion = tversion.erase(tversion.size() - 1, 1).erase(0, 1);
66 std::cout <<
" TrackParameterAnalyzer::beginJob conversion from sim units to rec units is " <<
simUnit_ << std::endl;
69 h1_pull0_ =
new TH1F(
"pull0",
"pull q/p", 100, -25., 25.);
70 h1_pull1_ =
new TH1F(
"pull1",
"pull lambda", 100, -25., 25.);
71 h1_pull2_ =
new TH1F(
"pull2",
"pull phi ", 100, -25., 25.);
72 h1_pull3_ =
new TH1F(
"pull3",
"pull dca ", 100, -25., 25.);
73 h1_pull4_ =
new TH1F(
"pull4",
"pull zdca ", 100, -25., 25.);
75 h1_res0_ =
new TH1F(
"res0",
"res q/p", 100, -0.1, 0.1);
76 h1_res1_ =
new TH1F(
"res1",
"res lambda", 100, -0.1, 0.1);
77 h1_res2_ =
new TH1F(
"res2",
"res phi ", 100, -0.1, 0.1);
78 h1_res3_ =
new TH1F(
"res3",
"res dca ", 100, -0.1, 0.1);
79 h1_res4_ =
new TH1F(
"res4",
"res zdca ", 100, -0.1, 0.1);
81 h1_Beff_ =
new TH1F(
"Beff",
"Beff", 2000, -10., 10.);
83 h1_par0_ =
new TH1F(
"par0",
"q/p", 100, -0.1, 0.1);
86 h1_par3_ =
new TH1F(
"par3",
"dca ", 100, -0.1, 0.1);
87 h1_par4_ =
new TH1F(
"par4",
"zdca ", 1000, -10., 10.);
115 double dtheta =
a(1) -
b(1);
116 double dphi =
a(2) -
b(2);
119 }
else if (dphi < -
M_PI) {
122 return ((fabs(dtheta) < 0.02) && (fabs(dphi) < 0.04));
127 using CLHEP::HepLorentzVector;
129 const double fBfield = 3.8;
134 std::cout <<
"SimVertex " << simVtcs->size() << std::endl;
135 for (edm::SimVertexContainer::const_iterator
v = simVtcs->begin();
v != simVtcs->end(); ++
v) {
136 std::cout <<
"simvtx " << std::setw(10) << std::setprecision(4) <<
v->position().x() <<
" " <<
v->position().y()
137 <<
" " <<
v->position().z() <<
" " <<
v->parentIndex() <<
" " <<
v->noParent() <<
" " << std::endl;
146 std::cout <<
"simtrks " << simTrks->size() << std::endl;
148 std::vector<ParameterVector> tsim;
149 for (edm::SimTrackContainer::const_iterator
t = simTrks->begin();
t != simTrks->end(); ++
t) {
151 std::cout <<
"simtrk has no vertex" << std::endl;
155 HepLorentzVector
v((*simVtcs)[
t->vertIndex()].position().x(),
156 (*simVtcs)[
t->vertIndex()].position().y(),
157 (*simVtcs)[
t->vertIndex()].position().z(),
158 (*simVtcs)[
t->vertIndex()].position().e());
159 int pdgCode =
t->type();
161 if (pdgCode == -99) {
163 std::cout <<
"funny particle skipped , code=" << pdgCode << std::endl;
166 if ((pdgCode == 11) || (pdgCode == 13) || (pdgCode == 15) || (pdgCode == -211) || (pdgCode == -2212) ||
169 }
else if ((pdgCode == -11) || (pdgCode == -13) || (pdgCode == -15) || (pdgCode == 211) || (pdgCode == 2212) ||
173 std::cout << pdgCode <<
" " << std::endl;
175 HepLorentzVector
p(
t->momentum().x(),
t->momentum().y(),
t->momentum().z(),
t->momentum().e());
178 <<
" gen=" << std::setw(4) <<
t->genpartIndex() <<
" vtx=" << std::setw(4) <<
t->vertIndex()
179 <<
" pdg=" << std::setw(5) <<
t->type() <<
" Q=" << std::setw(3) << Q <<
" pt=" << std::setw(6)
180 <<
p.perp() <<
" vx=" << std::setw(6) <<
v.x() <<
" vy=" << std::setw(6) <<
v.y()
181 <<
" vz=" << std::setw(6) <<
v.z() << std::endl;
183 if ((Q != 0) && (
p.perp() > 0.1)) {
187 double kappa = -Q * 0.002998 * fBfield /
p.perp();
188 double D0 = x0 *
sin(
p.phi()) - y0 *
cos(
p.phi()) - 0.5 *
kappa * (x0 * x0 + y0 * y0);
190 double s0 = (x0 *
cos(
p.phi()) + y0 *
sin(
p.phi())) /
q;
192 if (fabs(
kappa * s0) > 0.001) {
196 s1 = s0 * (1. + ks02 / 6. + 3. / 40. * ks02 * ks02 + 5. / 112. *
pow(ks02, 3));
216 for (reco::TrackCollection::const_iterator
t = recTracks->begin();
t != recTracks->end(); ++
t) {
222 for (std::vector<ParameterVector>::const_iterator
s = tsim.begin();
s != tsim.end(); ++
s) {
Sin< T >::type sin(const T &t)
std::vector< Track > TrackCollection
collection of Tracks
TrackParameterAnalyzer(const edm::ParameterSet &)
math::Vector< dimension >::type ParameterVector
parameter vector
bool match(const ParameterVector &a, const ParameterVector &b)
edm::EDGetTokenT< edm::SimTrackContainer > edmSimTrackContainerToken_
Cos< T >::type cos(const T &t)
edm::EDGetTokenT< reco::TrackCollection > recoTrackCollectionToken_
std::string getReleaseVersion()
edm::EDGetTokenT< edm::SimVertexContainer > edmSimVertexContainerToken_
std::vector< SimVertex > SimVertexContainer
reco::TrackBase::ParameterVector ParameterVector
void analyze(const edm::Event &, const edm::EventSetup &) override
~TrackParameterAnalyzer() override
std::vector< SimTrack > SimTrackContainer
Power< A, B >::type pow(const A &a, const B &b)
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix