21 simG4_( iConfig.getParameter<edm::InputTag>(
"simG4" ) ) {
28 tversion = tversion.Remove(0,1);
29 tversion = tversion.Remove(tversion.Length()-1,tversion.Length());
30 outputFile_ = std::string(tversion)+
"_"+
outputFile_;
32 rootFile_ = TFile::Open(outputFile_.c_str(),
"RECREATE");
55 std::cout <<
" TrackParameterAnalyzer::beginJob conversion from sim units to rec units is " <<
simUnit_ << std::endl;
58 h1_pull0_ =
new TH1F(
"pull0",
"pull q/p",100,-25.,25.);
59 h1_pull1_ =
new TH1F(
"pull1",
"pull lambda",100,-25.,25.);
60 h1_pull2_ =
new TH1F(
"pull2",
"pull phi ",100,-25.,25.);
61 h1_pull3_ =
new TH1F(
"pull3",
"pull dca ",100,-25.,25.);
62 h1_pull4_ =
new TH1F(
"pull4",
"pull zdca ",100,-25.,25.);
64 h1_res0_ =
new TH1F(
"res0",
"res q/p",100,-0.1,0.1);
65 h1_res1_ =
new TH1F(
"res1",
"res lambda",100,-0.1,0.1);
66 h1_res2_ =
new TH1F(
"res2",
"res phi ",100,-0.1,0.1);
67 h1_res3_ =
new TH1F(
"res3",
"res dca ",100,-0.1,0.1);
68 h1_res4_ =
new TH1F(
"res4",
"res zdca ",100,-0.1,0.1);
70 h1_Beff_ =
new TH1F(
"Beff",
"Beff",2000,-10.,10.);
72 h1_par0_ =
new TH1F(
"par0",
"q/p",100,-0.1,0.1);
75 h1_par3_ =
new TH1F(
"par3",
"dca ",100,-0.1,0.1);
76 h1_par4_ =
new TH1F(
"par4",
"zdca ",1000,-10.,10.);
106 double dtheta=
a(1)-
b(1);
107 double dphi =
a(2)-
b(2);
108 if (dphi>
M_PI){ dphi-=M_2_PI; }
else if(dphi<-
M_PI){dphi+=M_2_PI;}
109 return ( (fabs(dtheta)<0.02) && (fabs(dphi)<0.04) );
117 using CLHEP::HepLorentzVector;
122 const double fBfield=3.8;
127 std::cout <<
"SimVertex " << simVtcs->size() << std::endl;
128 for(edm::SimVertexContainer::const_iterator
v=simVtcs->begin();
129 v!=simVtcs->end(); ++
v){
131 << std::setw(10) << std::setprecision(4)
132 <<
v->position().x() <<
" "
133 <<
v->position().y() <<
" "
134 <<
v->position().z() <<
" "
135 <<
v->parentIndex() <<
" "
136 <<
v->noParent() <<
" "
146 std::vector<ParameterVector > tsim;
147 for(edm::SimTrackContainer::const_iterator
t=simTrks->begin();
148 t!=simTrks->end(); ++
t){
150 std::cout <<
"simtrk has no vertex" << std::endl;
154 HepLorentzVector
v((*simVtcs)[
t->vertIndex()].position().x(),
155 (*simVtcs)[
t->vertIndex()].position().y(),
156 (*simVtcs)[
t->vertIndex()].position().z(),
157 (*simVtcs)[
t->vertIndex()].position().e());
158 int pdgCode=
t->type();
162 std::cout <<
"funny particle skipped , code=" << pdgCode << std::endl;
165 if ((pdgCode==11)||(pdgCode==13)||(pdgCode==15)||(pdgCode==-211)||(pdgCode==-2212)||(pdgCode==321)){Q=-1;}
166 else if((pdgCode==-11)||(pdgCode==-13)||(pdgCode==-15)||(pdgCode==211)||(pdgCode==2212)||(pdgCode==321)){Q=1;}
170 HepLorentzVector
p(
t->momentum().x(),
t->momentum().y(),
t->momentum().z(),
t->momentum().e());
173 <<
" gen=" << std::setw( 4) <<
t->genpartIndex()
174 <<
" vtx=" << std::setw( 4) <<
t->vertIndex()
175 <<
" pdg=" << std::setw( 5) <<
t->type()
176 <<
" Q=" << std::setw( 3) << Q
177 <<
" pt=" << std::setw(6) <<
p.perp()
178 <<
" vx=" << std::setw(6) <<
v.x()
179 <<
" vy=" << std::setw(6) <<
v.y()
180 <<
" vz=" << std::setw(6) <<
v.z()
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);
189 double q=
sqrt(1.-2.*kappa*D0);
190 double s0=(x0*
cos(
p.phi())+y0*
sin(
p.phi()))/
q;
192 if (fabs(kappa*s0)>0.001){
193 s1=asin(kappa*s0)/kappa;
195 double ks02=(kappa*s0)*(kappa*s0);
196 s1=s0*(1.+ks02/6.+3./40.*ks02*ks02+5./112.*
pow(ks02,3));
217 for(reco::TrackCollection::const_iterator
t=recTracks->begin();
218 t!=recTracks->end(); ++
t){
222 std::cout <<
"reco pars= " << p << std::endl;
225 for(std::vector<ParameterVector>::const_iterator
s=tsim.begin();
T getUntrackedParameter(std::string const &, T const &) const
Sin< T >::type sin(const T &t)
TrackParameterAnalyzer(const edm::ParameterSet &)
math::Vector< dimension >::type ParameterVector
parameter vector
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
bool match(const ParameterVector &a, const ParameterVector &b)
std::string recoTrackProducer_
Cos< T >::type cos(const T &t)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
std::string getReleaseVersion()
reco::TrackBase::ParameterVector ParameterVector
~TrackParameterAnalyzer()
Power< A, B >::type pow(const A &a, const B &b)
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix