103 using namespace reco;
140 void writeGlPosRcd(CLHEP::HepVector& d3);
141 inline double CLHEP_dot(
const CLHEP::HepVector&
a,
const CLHEP::HepVector&
b)
143 return a(1)*
b(1)+
a(2)*
b(2)+
a(3)*
b(3);
150 virtual void endJob()
override ;
203 std::vector<AlignTransform>::const_iterator
205 std::vector<AlignTransform>::const_iterator
207 std::vector<AlignTransform>::const_iterator
209 std::vector<AlignTransform>::const_iterator
272 :trackTags_(iConfig.getParameter<edm::
InputTag>(
"tracks")),
273 muonTags_(iConfig.getParameter<edm::
InputTag>(
"muons")),
274 gmuonTags_(iConfig.getParameter<edm::
InputTag>(
"gmuons")),
275 smuonTags_(iConfig.getParameter<edm::
InputTag>(
"smuons")),
276 propagator_(iConfig.getParameter<
string>(
"Propagator")),
278 cosmicMuonMode_(iConfig.getParameter<bool>(
"cosmics")),
279 isolatedMuonMode_(iConfig.getParameter<bool>(
"isolated")),
281 refitMuon_(iConfig.getParameter<bool>(
"refitmuon")),
282 refitTrack_(iConfig.getParameter<bool>(
"refittrack")),
284 rootOutFile_(iConfig.getUntrackedParameter<
string>(
"rootOutFile")),
285 txtOutFile_(iConfig.getUntrackedParameter<
string>(
"txtOutFile")),
286 writeDB_(iConfig.getUntrackedParameter<bool>(
"writeDB")),
287 debug_(iConfig.getUntrackedParameter<bool>(
"debug")),
290 #ifdef NO_FALSE_FALSE_MODE
293 <<
"Use from GlobalTrackerMuonAlignment_test_cfg.py.";
297 throw cms::Exception(
"BadConfig") <<
"Muon collection can be either cosmic or isolated! "
298 <<
"Please set only one to true.";
335 for(
int i=0;
i<=2;
i++){
337 for(
int j=0;
j<=2;
j++){
341 Grad = CLHEP::HepVector(6,0);
342 Hess = CLHEP::HepSymMatrix(6,0);
344 GradL = CLHEP::HepVector(6,0);
345 HessL = CLHEP::HepSymMatrix(6,0);
348 TDirectory * dirsave = gDirectory;
351 const bool oldAddDir = TH1::AddDirectoryStatus();
353 TH1::AddDirectory(
true);
357 TH1::AddDirectory(oldAddDir);
370 for(
int i=0;
i<=2;
i++)
371 for(
int j=0;
j<=2;
j++){
374 bool ierr = !InfI.Invert();
375 if( ierr ) {
if(alarm)
376 std::cout<<
" Error inverse Inf matrix !!!!!!!!!!!"<<std::endl;}
378 for(
int i=0;
i<=2;
i++)
383 CLHEP::HepVector d3 = CLHEP::solve(
Hess, -
Grad);
385 CLHEP::HepMatrix Errd3 =
Hess.inverse(iEr3);
386 if( iEr3 != 0) {
if(alarm)
387 std::cout<<
" endJob Error inverse Hess matrix !!!!!!!!!!!"<<std::endl;
392 CLHEP::HepVector dLI = CLHEP::solve(
HessL, -
GradL);
394 CLHEP::HepMatrix ErrdLI =
HessL.inverse(iErI);
395 if( iErI != 0) {
if(alarm)
396 std::cout<<
" endJob Error inverse HessL matrix !!!!!!!!!!!"<<std::endl;
413 std::cout<<
" dG "<<d3(1)<<
" "<<d3(2)<<
" "<<d3(3)<<
" "<<d3(4)<<
" "
414 <<d3(5)<<
" "<<d3(6)<<std::endl;;
416 <<
" "<<
sqrt(Errd3(4,4))<<
" "<<
sqrt(Errd3(5,5))<<
" "<<
sqrt(Errd3(6,6))
418 std::cout<<
" dL "<<dLI(1)<<
" "<<dLI(2)<<
" "<<dLI(3)<<
" "<<dLI(4)<<
" "
419 <<dLI(5)<<
" "<<dLI(6)<<std::endl;;
421 <<
" "<<
sqrt(ErrdLI(4,4))<<
" "<<
sqrt(ErrdLI(5,5))<<
" "<<
sqrt(ErrdLI(6,6))
425 CLHEP::HepVector vectorToDb(6,0), vectorErrToDb(6,0);
429 for(
unsigned int i=1;
i<=6;
i++) vectorErrToDb(
i) =
sqrt(ErrdLI(
i,
i));
439 OutGlobalTxt<<vectorToDb(1)<<
" "<<vectorToDb(2)<<
" "<<vectorToDb(3)<<
" "<<vectorToDb(4)<<
" "
440 <<vectorToDb(5)<<
" "<<vectorToDb(6)<<
" muon Global.\n";
441 OutGlobalTxt<<vectorErrToDb(1)<<
" "<<vectorErrToDb(1)<<
" "<<vectorErrToDb(1)<<
" "
442 <<vectorErrToDb(1)<<
" "<<vectorErrToDb(1)<<
" "<<vectorErrToDb(1)<<
" errors.\n";
449 std::cout<<
" Write to the file outglobal.txt done "<<std::endl;
462 double PI = 3.1415927;
463 histo =
new TH1F(
"Pt",
"pt",1000,0,100);
464 histo2 =
new TH1F(
"P",
"P [GeV/c]",400,0.,400.);
465 histo2->GetXaxis()->SetTitle(
"momentum [GeV/c]");
466 histo3 =
new TH1F(
"outerLambda",
"#lambda outer",100,-PI/2.,PI/2.);
467 histo3->GetXaxis()->SetTitle(
"#lambda outer");
468 histo4 =
new TH1F(
"phi",
"#phi [rad]",100,-PI,PI);
469 histo4->GetXaxis()->SetTitle(
"#phi [rad]");
470 histo5 =
new TH1F(
"Rmuon",
"inner muon hit R [cm]",100,0.,800.);
471 histo5->GetXaxis()->SetTitle(
"R of muon [cm]");
472 histo6 =
new TH1F(
"Zmuon",
"inner muon hit Z[cm]",100,-1000.,1000.);
473 histo6->GetXaxis()->SetTitle(
"Z of muon [cm]");
474 histo7 =
new TH1F(
"(Pm-Pt)/Pt",
" (Pmuon-Ptrack)/Ptrack", 100,-2.,2.);
475 histo7->GetXaxis()->SetTitle(
"(Pmuon-Ptrack)/Ptrack");
476 histo8 =
new TH1F(
"chi muon-track",
"#chi^{2}(muon-track)", 1000,0.,1000.);
477 histo8->GetXaxis()->SetTitle(
"#chi^{2} of muon w.r.t. propagated track");
478 histo11 =
new TH1F(
"distance muon-track",
"distance muon w.r.t track [cm]",100,0.,30.);
479 histo11->GetXaxis()->SetTitle(
"distance of muon w.r.t. track [cm]");
480 histo12 =
new TH1F(
"Xmuon-Xtrack",
"Xmuon-Xtrack [cm]",200,-20.,20.);
481 histo12->GetXaxis()->SetTitle(
"Xmuon - Xtrack [cm]");
482 histo13 =
new TH1F(
"Ymuon-Ytrack",
"Ymuon-Ytrack [cm]",200,-20.,20.);
483 histo13->GetXaxis()->SetTitle(
"Ymuon - Ytrack [cm]");
484 histo14 =
new TH1F(
"Zmuon-Ztrack",
"Zmuon-Ztrack [cm]",200,-20.,20.);
485 histo14->GetXaxis()->SetTitle(
"Zmuon-Ztrack [cm]");
486 histo15 =
new TH1F(
"NXmuon-NXtrack",
"NXmuon-NXtrack [rad]",200,-.1,.1);
487 histo15->GetXaxis()->SetTitle(
"N_{X}(muon)-N_{X}(track) [rad]");
488 histo16 =
new TH1F(
"NYmuon-NYtrack",
"NYmuon-NYtrack [rad]",200,-.1,.1);
489 histo16->GetXaxis()->SetTitle(
"N_{Y}(muon)-N_{Y}(track) [rad]");
490 histo17 =
new TH1F(
"NZmuon-NZtrack",
"NZmuon-NZtrack [rad]",200,-.1,.1);
491 histo17->GetXaxis()->SetTitle(
"N_{Z}(muon)-N_{Z}(track) [rad]");
492 histo18 =
new TH1F(
"expected error of Xinner",
"outer hit of inner tracker",100,0,.01);
493 histo18->GetXaxis()->SetTitle(
"expected error of Xinner [cm]");
494 histo19 =
new TH1F(
"expected error of Xmuon",
"inner hit of muon",100,0,.1);
495 histo19->GetXaxis()->SetTitle(
"expected error of Xmuon [cm]");
496 histo20 =
new TH1F(
"expected error of Xmuon-Xtrack",
"muon w.r.t. propagated track",100,0.,10.);
497 histo20->GetXaxis()->SetTitle(
"expected error of Xmuon-Xtrack [cm]");
498 histo21 =
new TH1F(
"pull of Xmuon-Xtrack",
"pull of Xmuon-Xtrack",100,-10.,10.);
499 histo21->GetXaxis()->SetTitle(
"(Xmuon-Xtrack)/expected error");
500 histo22 =
new TH1F(
"pull of Ymuon-Ytrack",
"pull of Ymuon-Ytrack",100,-10.,10.);
501 histo22->GetXaxis()->SetTitle(
"(Ymuon-Ytrack)/expected error");
502 histo23 =
new TH1F(
"pull of Zmuon-Ztrack",
"pull of Zmuon-Ztrack",100,-10.,10.);
503 histo23->GetXaxis()->SetTitle(
"(Zmuon-Ztrack)/expected error");
504 histo24 =
new TH1F(
"pull of PXmuon-PXtrack",
"pull of PXmuon-PXtrack",100,-10.,10.);
505 histo24->GetXaxis()->SetTitle(
"(P_{X}(muon)-P_{X}(track))/expected error");
506 histo25 =
new TH1F(
"pull of PYmuon-PYtrack",
"pull of PYmuon-PYtrack",100,-10.,10.);
507 histo25->GetXaxis()->SetTitle(
"(P_{Y}(muon)-P_{Y}(track))/expected error");
508 histo26 =
new TH1F(
"pull of PZmuon-PZtrack",
"pull of PZmuon-PZtrack",100,-10.,10.);
509 histo26->GetXaxis()->SetTitle(
"(P_{Z}(muon)-P_{Z}(track))/expected error");
510 histo27 =
new TH1F(
"N_x",
"Nx of tangent plane",120,-1.1,1.1);
511 histo27->GetXaxis()->SetTitle(
"normal vector projection N_{X}");
512 histo28 =
new TH1F(
"N_y",
"Ny of tangent plane",120,-1.1,1.1);
513 histo28->GetXaxis()->SetTitle(
"normal vector projection N_{Y}");
514 histo29 =
new TH1F(
"lenght of track",
"lenght of track",200,0.,400);
515 histo29->GetXaxis()->SetTitle(
"lenght of track [cm]");
516 histo30 =
new TH1F(
"lenght of muon",
"lenght of muon",200,0.,800);
517 histo30->GetXaxis()->SetTitle(
"lenght of muon [cm]");
519 histo31 =
new TH1F(
"local chi muon-track",
"#local chi^{2}(muon-track)", 1000,0.,1000.);
520 histo31->GetXaxis()->SetTitle(
"#local chi^{2} of muon w.r.t. propagated track");
521 histo32 =
new TH1F(
"pull of Px/Pz local",
"pull of Px/Pz local",100,-10.,10.);
522 histo32->GetXaxis()->SetTitle(
"local (Px/Pz(muon) - Px/Pz(track))/expected error");
523 histo33 =
new TH1F(
"pull of Py/Pz local",
"pull of Py/Pz local",100,-10.,10.);
524 histo33->GetXaxis()->SetTitle(
"local (Py/Pz(muon) - Py/Pz(track))/expected error");
525 histo34 =
new TH1F(
"pull of X local",
"pull of X local",100,-10.,10.);
526 histo34->GetXaxis()->SetTitle(
"local (Xmuon - Xtrack)/expected error");
527 histo35 =
new TH1F(
"pull of Y local",
"pull of Y local",100,-10.,10.);
528 histo35->GetXaxis()->SetTitle(
"local (Ymuon - Ytrack)/expected error");
530 histo101 =
new TH2F(
"Rtr/mu vs Ztr/mu",
"hit of track/muon",100,-800.,800.,100,0.,600.);
531 histo101->GetXaxis()->SetTitle(
"Z of track/muon [cm]");
532 histo101->GetYaxis()->SetTitle(
"R of track/muon [cm]");
533 histo102 =
new TH2F(
"Ytr/mu vs Xtr/mu",
"hit of track/muon",100,-600.,600.,100,-600.,600.);
534 histo102->GetXaxis()->SetTitle(
"X of track/muon [cm]");
535 histo102->GetYaxis()->SetTitle(
"Y of track/muon [cm]");
568 using namespace reco;
573 double PI = 3.1415927;
575 cosmicMuonMode_ =
true;
576 isolatedMuonMode_ = !cosmicMuonMode_;
582 if (
info || debug_) {
583 std::cout <<
"----- event " << N_event <<
" -- tracks "<<N_track<<
" ---";
584 if (cosmicMuonMode_)
std::cout <<
" treated as CosmicMu ";
585 if (isolatedMuonMode_)
std::cout <<
" treated as IsolatedMu ";
594 if (collectionIsolated){
597 iEvent.
getByLabel(
"ALCARECOMuAlCalIsolatedMu",
"GlobalMuon", gmuons);
598 iEvent.
getByLabel(
"ALCARECOMuAlCalIsolatedMu",
"SelectedMuons", smuons);
600 else if (collectionCosmic){
603 iEvent.
getByLabel(
"ALCARECOMuAlGlobalCosmics",
"GlobalMuon", gmuons);
604 iEvent.
getByLabel(
"ALCARECOMuAlGlobalCosmics",
"SelectedMuons", smuons);
615 <<
" runN " << (int)iEvent.
run() <<std::endl;
617 <<
" "<<gmuons->size() <<
" " << smuons->size() << std::endl;
618 for (MuonCollection::const_iterator itMuon = smuons->begin();
619 itMuon != smuons->end();
621 std::cout <<
" is isolatValid Matches " << itMuon->isIsolationValid()
622 <<
" " <<itMuon->isMatchesValid() << std::endl;
626 if (isolatedMuonMode_) {
627 if (
tracks->size() != 1)
return;
628 if (
muons->size() != 1)
return;
629 if (gmuons->size() != 1)
return;
630 if (smuons->size() != 1)
return;
633 if (cosmicMuonMode_){
634 if (smuons->size() > 2)
return;
635 if (
tracks->size() != smuons->size())
return;
636 if (
muons->size() != smuons->size())
return;
637 if (gmuons->size() != smuons->size())
return;
650 if (watchTrackingGeometry_.check(iSetup) || !trackingGeometry_) {
653 trackingGeometry_ = &*trackingGeometry;
656 if (watchMagneticFieldRecord_.check(iSetup) || !magneticField_) {
662 if (watchGlobalPositionRcd_.check(iSetup) || !globalPositionRcd_) {
665 globalPositionRcd_ = &*globalPositionRcd;
666 for (std::vector<AlignTransform>::const_iterator
i
667 = globalPositionRcd_->m_align.begin();
668 i != globalPositionRcd_->m_align.end(); ++
i){
675 std::cout <<
"=== iteratorMuonRcd " << iteratorMuonRcd->rawId()<<
" ====\n"
676 <<
" translation " << iteratorMuonRcd->translation()<<
"\n"
677 <<
" angles " << iteratorMuonRcd->rotation().eulerAngles() << std::endl;
678 std::cout << iteratorMuonRcd->rotation() << std::endl;
702 for(MuonCollection::const_iterator itMuon = smuons->begin();
703 itMuon != smuons->end(); ++itMuon) {
706 std::cout<<
" mu gM is GM Mu SaM tM "<<itMuon->isGlobalMuon()<<
" "
707 <<itMuon->isMuon()<<
" "<<itMuon->isStandAloneMuon()
708 <<
" "<<itMuon->isTrackerMuon()<<
" "
713 TransientTrack muTT(itMuon->outerTrack(), magneticField_, trackingGeometry_);
718 TransientTrack trackTT(itMuon->track(), magneticField_, trackingGeometry_);
723 GlobalPoint pointTrackOut = outerTrackTSOS.globalPosition();
724 float lenghtTrack = (pointTrackOut-pointTrackIn).
mag();
725 GlobalPoint pointMuonIn = innerMuTSOS.globalPosition();
727 float lenghtMuon = (pointMuonOut - pointMuonIn).
mag();
728 GlobalVector momentumTrackOut = outerTrackTSOS.globalMomentum();
730 float distanceInIn = (pointTrackIn - pointMuonIn).
mag();
731 float distanceInOut = (pointTrackIn - pointMuonOut).
mag();
732 float distanceOutIn = (pointTrackOut - pointMuonIn).
mag();
733 float distanceOutOut = (pointTrackOut - pointMuonOut).
mag();
736 std::cout<<
" pointTrackIn "<<pointTrackIn<<std::endl;
737 std::cout<<
" Out "<<pointTrackOut<<
" lenght "<<lenghtTrack<<std::endl;
738 std::cout<<
" point MuonIn "<<pointMuonIn<<std::endl;
739 std::cout<<
" Out "<<pointMuonOut<<
" lenght "<<lenghtMuon<<std::endl;
740 std::cout<<
" momeTrackIn Out "<<momentumTrackIn<<
" "<<momentumTrackOut<<std::endl;
741 std::cout<<
" doi io ii oo "<<distanceOutIn<<
" "<<distanceInOut<<
" "
742 <<distanceInIn<<
" "<<distanceOutOut<<std::endl;
745 if(lenghtTrack < 90.)
continue;
746 if(lenghtMuon < 300.)
continue;
747 if(momentumTrackIn.
mag() < 15. || momentumTrackOut.
mag() < 15.)
continue;
748 if(trackTT.charge() != muTT.charge())
continue;
751 std::cout<<
" passed lenght momentum cuts"<<std::endl;
759 if( isolatedMuonMode_ ){
760 const Surface& refSurface = innerMuTSOS.surface();
762 tpMuLocal(refSurface.
tangentPlane(innerMuTSOS.localPosition()));
763 Nl = tpMuLocal->normalVector();
765 tpMuGlobal(refSurface.
tangentPlane(innerMuTSOS.globalPosition()));
768 const Plane* refPlane =
dynamic_cast<Plane*
>(surf);
772 std::cout<<
" Nlocal "<<Nl.
x()<<
" "<<Nl.
y()<<
" "<<Nl.
z()<<
" "
773 <<
" alfa "<<int(asin(Nl.
x())*57.29578)<<std::endl;
774 std::cout<<
" global "<<Ng.
x()<<
" "<<Ng.
y()<<
" "<<Ng.
z()<<std::endl;
775 std::cout<<
" lp "<<Nlp.
x()<<
" "<<Nlp.
y()<<
" "<<Nlp.
z()<<std::endl;
782 extrapolationT = alongSmPr.propagate(outerTrackTSOS, refSurface);
787 std::cout<<
" !!!!!!!!! Catastrophe Out-In extrapolationT.isValid "
800 (innerMuTSOS.globalPosition()).y(),
801 (innerMuTSOS.globalPosition()).z());
802 GPm = innerMuTSOS.globalMomentum();
804 (outerTrackTSOS.globalPosition()).y(),
805 (outerTrackTSOS.globalPosition()).z());
807 innerMuTSOS.cartesianError().matrix());
815 if( cosmicMuonMode_ ){
817 if((distanceOutIn <= distanceInOut) & (distanceOutIn <= distanceInIn) &
818 (distanceOutIn <= distanceOutOut)){
819 if(debug_)
std::cout<<
" ----- Out - In -----"<<std::endl;
821 const Surface& refSurface = innerMuTSOS.surface();
823 tpMuGlobal(refSurface.
tangentPlane(innerMuTSOS.globalPosition()));
824 Nl = tpMuGlobal->normalVector();
827 extrapolationT = alongSmPr.propagate(outerTrackTSOS, refSurface);
832 std::cout<<
" !!!!!!!!! Catastrophe Out-In extrapolationT.isValid "
848 (innerMuTSOS.globalPosition()).y(),
849 (innerMuTSOS.globalPosition()).z());
850 GPm = innerMuTSOS.globalMomentum();
852 (outerTrackTSOS.globalPosition()).y(),
853 (outerTrackTSOS.globalPosition()).z());
855 innerMuTSOS.cartesianError().matrix());
864 <<Chooser.operator()(*outerTrackTSOS.freeState(), refSurface)
866 Chooser.operator()(*outerTrackTSOS.freeState(), refSurface))
868 std::cout<<
" --- Nlocal "<<Nl.
x()<<
" "<<Nl.
y()<<
" "<<Nl.
z()<<
" "
869 <<
" alfa "<<int(asin(Nl.
x())*57.29578)<<std::endl;
874 else if((distanceInOut <= distanceInIn) & (distanceInOut <= distanceOutIn) &
875 (distanceInOut <= distanceOutOut)){
876 if(debug_)
std::cout<<
" ----- In - Out -----"<<std::endl;
881 Nl = tpMuGlobal->normalVector();
884 extrapolationT = oppositeSmPr.propagate(innerTrackTSOS, refSurface);
888 std::cout<<
" !!!!!!!!! Catastrophe Out-In extrapolationT.isValid "
889 <<
"\a\a\a\a\a\a\a\a"<<extrapolationT.
isValid()
920 <<Chooser.operator()(*innerTrackTSOS.
freeState(), refSurface)
922 Chooser.operator()(*innerTrackTSOS.
freeState(), refSurface))
924 std::cout<<
" --- Nlocal "<<Nl.
x()<<
" "<<Nl.
y()<<
" "<<Nl.
z()<<
" "
925 <<
" alfa "<<int(asin(Nl.
x())*57.29578)<<std::endl;
929 else if((distanceOutOut <= distanceInOut) & (distanceOutOut <= distanceInIn) &
930 (distanceOutOut <= distanceOutIn)){
931 if(debug_)
std::cout<<
" ----- Out - Out -----"<<std::endl;
939 Nl = tpMuGlobal->normalVector();
942 extrapolationT = alongSmPr.propagate(outerTrackTSOS, refSurface);
946 std::cout<<
" !!!!!!!!! Catastrophe Out-Out extrapolationT.isValid "
947 <<
"\a\a\a\a\a\a\a\a"<<extrapolationT.
isValid()
966 (outerTrackTSOS.globalPosition()).y(),
967 (outerTrackTSOS.globalPosition()).z());
977 <<Chooser.operator()(*outerTrackTSOS.freeState(), refSurface)
979 Chooser.operator()(*outerTrackTSOS.freeState(), refSurface))
981 std::cout<<
" --- Nlocal "<<Nl.
x()<<
" "<<Nl.
y()<<
" "<<Nl.
z()<<
" "
982 <<
" alfa "<<int(asin(Nl.
x())*57.29578)<<std::endl;
983 std::cout<<
" Nornal "<<Nl.
x()<<
" "<<Nl.
y()<<
" "<<Nl.
z()<<
" "
984 <<
" alfa "<<int(asin(Nl.
x())*57.29578)<<std::endl;
989 std::cout<<
" ------- !!!!!!!!!!!!!!! No proper Out - In \a\a\a\a\a\a\a"<<std::endl;
995 if(tsosMuonIf == 0) {
if(
info) {
std::cout<<
"No tsosMuon !!!!!!"<<std::endl;
continue;}}
997 if(tsosMuonIf == 1) tsosMuon = muTT.innermostMeasurementState();
998 else tsosMuon = muTT.outermostMeasurementState();
1003 (GRm, GPm, Nl, Rt, Rm, Pm, LPRm, extrapolationT, tsosMuon);
1008 float RelMomResidual = (Pm.
mag() - Pt.mag()) / (Pt.mag() + 1.e-6);;
1011 Vm(0) = resR.
x(); Vm(1) = resR.
y(); Vm(2) = resR.
z();
1012 Vm(3) = resP0.
x(); Vm(4) = resP0.
y(); Vm(5) = resP0.
z();
1013 float Rmuon = Rm.
perp();
1014 float Zmuon = Rm.
z();
1015 float alfa_x = atan2(Nl.
x(),Nl.
y())*57.29578;
1018 std::cout<<
" Nx Ny Nz alfa_x "<<Nl.
x()<<
" "<<Nl.
y()<<
" "<<Nl.
z()<<
" "<<alfa_x<<std::endl;
1024 for(
int i=0;
i<=5;
i++) chi_d += Vm(
i)*Vm(
i)/Cm(
i,
i);
1030 bool ierrLoc = !
m.Invert();
1031 if (ierrLoc && debug_ &&
info) {
1032 std::cout<<
" ==== Error inverting Local covariance matrix ==== "<<std::endl;
1034 double chi_Loc = ROOT::Math::Similarity(Vml,
m);
1036 std::cout<<
" chi_Loc px/pz/err "<<chi_Loc<<
" "<<Vml(1)/
sqrt(Cml(1,1))<<std::endl;
1038 if(Pt.mag() < 15.)
continue;
1039 if(Pm.
mag() < 5.)
continue;
1083 if(Rmuon < 120. || Rmuon > 450.)
continue;
1084 if(Zmuon < -720. || Zmuon > 720.)
continue;
1085 MuSelect =
" Barrel+EndCaps";
1089 std::cout<<
" .............. passed all cuts"<<std::endl;
1097 CLHEP::HepSymMatrix covLoc(4,0);
1098 for(
int i=1;
i<=4;
i++)
1099 for(
int j=1;
j<=
i;
j++){
1106 CLHEP::HepMatrix rotLoc (3,3,0);
1119 CLHEP::HepVector posLoc(3);
1128 std::cout<<
" posLoc "<<posLoc.T()<<std::endl;
1129 std::cout<<
" rotLoc "<<rotLoc<<std::endl;
1133 histo->Fill(itMuon->track()->pt());
1136 histo2->Fill(Pt.mag());
1137 histo3->Fill((
PI/2.-itMuon->track()->outerTheta()));
1138 histo4->Fill(itMuon->track()->phi());
1139 histo5->Fill(Rmuon);
1140 histo6->Fill(Zmuon);
1141 histo7->Fill(RelMomResidual);
1143 histo8->Fill(chi_d);
1145 histo101->Fill(Zmuon, Rmuon);
1146 histo101->Fill(Rt0.
z(), Rt0.
perp());
1147 histo102->Fill(Rt0.
x(), Rt0.
y());
1148 histo102->Fill(Rm.
x(), Rm.
y());
1150 histo11->Fill(resR.
mag());
1151 if(fabs(Nl.
x()) < 0.98) histo12->Fill(resR.
x());
1152 if(fabs(Nl.
y()) < 0.98) histo13->Fill(resR.
y());
1153 if(fabs(Nl.
z()) < 0.98) histo14->Fill(resR.
z());
1154 histo15->Fill(resP.
x());
1155 histo16->Fill(resP.
y());
1156 histo17->Fill(resP.
z());
1158 if((fabs(Nl.
x()) < 0.98) && (fabs(Nl.
y()) < 0.98) &&(fabs(Nl.
z()) < 0.98))
1160 histo18->Fill(
sqrt(C0(0,0)));
1161 histo19->Fill(
sqrt(C1(0,0)));
1162 histo20->Fill(
sqrt(C1(0,0)+Ce(0,0)));
1164 if(fabs(Nl.
x()) < 0.98) histo21->Fill(Vm(0)/
sqrt(Cm(0,0)));
1165 if(fabs(Nl.
y()) < 0.98) histo22->Fill(Vm(1)/
sqrt(Cm(1,1)));
1166 if(fabs(Nl.
z()) < 0.98) histo23->Fill(Vm(2)/
sqrt(Cm(2,2)));
1167 histo24->Fill(Vm(3)/
sqrt(C1(3,3)+Ce(3,3)));
1168 histo25->Fill(Vm(4)/
sqrt(C1(4,4)+Ce(4,4)));
1169 histo26->Fill(Vm(5)/
sqrt(C1(5,5)+Ce(5,5)));
1170 histo27->Fill(Nl.
x());
1171 histo28->Fill(Nl.
y());
1172 histo29->Fill(lenghtTrack);
1173 histo30->Fill(lenghtMuon);
1174 histo31->Fill(chi_Loc);
1175 histo32->Fill(Vml(1)/
sqrt(Cml(1,1)));
1176 histo33->Fill(Vml(2)/
sqrt(Cml(2,2)));
1177 histo34->Fill(Vml(3)/
sqrt(Cml(3,3)));
1178 histo35->Fill(Vml(4)/
sqrt(Cml(4,4)));
1182 std::cout<<
" diag 0[ "<<C0(0,0)<<
" "<<C0(1,1)<<
" "<<C0(2,2)<<
" "<<C0(3,3)<<
" "
1183 <<C0(4,4)<<
" "<<C0(5,5)<<
" ]"<<std::endl;
1184 std::cout<<
" diag e[ "<<Ce(0,0)<<
" "<<Ce(1,1)<<
" "<<Ce(2,2)<<
" "<<Ce(3,3)<<
" "
1185 <<Ce(4,4)<<
" "<<Ce(5,5)<<
" ]"<<std::endl;
1186 std::cout<<
" diag 1[ "<<C1(0,0)<<
" "<<C1(1,1)<<
" "<<C1(2,2)<<
" "<<C1(3,3)<<
" "
1187 <<C1(4,4)<<
" "<<C1(5,5)<<
" ]"<<std::endl;
1189 <<
" Pm "<<Pm.
x()<<
" "<<Pm.
y()<<
" "<<Pm.
z()<<std::endl;
1190 std::cout<<
" Rt "<<Rt.x()<<
" "<<Rt.y()<<
" "<<Rt.z()
1191 <<
" Pt "<<Pt.x()<<
" "<<Pt.y()<<
" "<<Pt.z()<<std::endl;
1193 std::cout<<
" resR "<<resR.
x()<<
" "<<resR.
y()<<
" "<<resR.
z()
1194 <<
" resP "<<resP.
x()<<
" "<<resP.
y()<<
" "<<resP.
z()<<std::endl;
1195 std::cout<<
" Rm-t "<<(Rm-Rt).
x()<<
" "<<(Rm-Rt).y()<<
" "<<(Rm-Rt).z()
1196 <<
" Pm-t "<<(Pm-
Pt).
x()<<
" "<<(Pm-
Pt).y()<<
" "<<(Pm-
Pt).z()<<std::endl;
1199 <<
sqrt(Cm(3,3))<<
" "<<
sqrt(Cm(4,4))<<
" "<<
sqrt(Cm(5,5))<<std::endl;
1200 std::cout<<
" Pmuon Ptrack dP/Ptrack "<<itMuon->outerTrack()->p()<<
" "
1201 <<itMuon->track()->outerP()<<
" "
1202 <<(itMuon->outerTrack()->p() -
1203 itMuon->track()->outerP())/itMuon->track()->outerP()<<std::endl;
1206 std::cout<<
" diag [ "<<Cm(0,0)<<
" "<<Cm(1,1)<<
" "<<Cm(2,2)<<
" "<<Cm(3,3)<<
" "
1207 <<Cm(4,4)<<
" "<<Cm(5,5)<<
" ]"<<std::endl;
1211 for(
int i=0;
i<=5;
i++) Diag[
i] =
sqrt(Cm(
i,
i));
1212 for(
int i=0;
i<=5;
i++)
1213 for(
int j=0;
j<=5;
j++)
1214 Ro(
i,
j) = Cm(
i,
j)/Diag[
i]/Diag[
j];
1215 std::cout<<
" correlation matrix "<<std::endl;
1219 for(
int i=0;
i<=5;
i++)
1220 for(
int j=0;
j<=5;
j++)
1223 bool ierr = !CmI.Invert();
1224 if( ierr ) {
if(alarm || debug_)
1225 std::cout<<
" Error inverse covariance matrix !!!!!!!!!!!"<<std::endl;
1228 std::cout<<
" inverse cov matrix "<<std::endl;
1231 double chi = ROOT::Math::Similarity(Vm, CmI);
1232 std::cout<<
" chi chi_d "<<chi<<
" "<<chi_d<<std::endl;
1244 using namespace edm;
1245 using namespace reco;
1250 double PI = 3.1415927;
1253 cosmicMuonMode_ =
true;
1256 isolatedMuonMode_ = !cosmicMuonMode_;
1259 if (
info || debug_) {
1260 std::cout <<
"----- event " << N_event <<
" -- tracks "<<N_track<<
" ---";
1261 if (cosmicMuonMode_)
std::cout <<
" treated as CosmicMu ";
1262 if (isolatedMuonMode_)
std::cout <<
" treated as IsolatedMu ";
1271 if (collectionIsolated){
1274 iEvent.
getByLabel(
"ALCARECOMuAlCalIsolatedMu",
"GlobalMuon", gmuons);
1275 iEvent.
getByLabel(
"ALCARECOMuAlCalIsolatedMu",
"SelectedMuons", smuons);
1277 else if (collectionCosmic){
1280 iEvent.
getByLabel(
"ALCARECOMuAlGlobalCosmics",
"GlobalMuon", gmuons);
1281 iEvent.
getByLabel(
"ALCARECOMuAlGlobalCosmics",
"SelectedMuons", smuons);
1292 <<
" runN " << (int)iEvent.
run() <<std::endl;
1294 <<
" "<<gmuons->size() <<
" " << smuons->size() << std::endl;
1295 for (MuonCollection::const_iterator itMuon = smuons->begin();
1296 itMuon != smuons->end();
1298 std::cout <<
" is isolatValid Matches " << itMuon->isIsolationValid()
1299 <<
" " <<itMuon->isMatchesValid() << std::endl;
1303 if (isolatedMuonMode_) {
1304 if (
tracks->size() != 1)
return;
1305 if (
muons->size() != 1)
return;
1306 if (gmuons->size() != 1)
return;
1307 if (smuons->size() != 1)
return;
1310 if (cosmicMuonMode_){
1311 if (smuons->size() > 2)
return;
1312 if (
tracks->size() != smuons->size())
return;
1313 if (
muons->size() != smuons->size())
return;
1314 if (gmuons->size() != smuons->size())
return;
1327 if (watchTrackingGeometry_.check(iSetup) || !trackingGeometry_) {
1330 trackingGeometry_ = &*trackingGeometry;
1331 theTrackingGeometry = trackingGeometry;
1334 if (watchMagneticFieldRecord_.check(iSetup) || !magneticField_) {
1340 if (watchGlobalPositionRcd_.check(iSetup) || !globalPositionRcd_) {
1343 globalPositionRcd_ = &*globalPositionRcd;
1344 for (std::vector<AlignTransform>::const_iterator
i
1345 = globalPositionRcd_->m_align.begin();
1346 i != globalPositionRcd_->m_align.end(); ++
i){
1353 std::cout <<
"=== iteratorTrackerRcd " << iteratorTrackerRcd->rawId()<<
" ====\n"
1354 <<
" translation " << iteratorTrackerRcd->translation()<<
"\n"
1355 <<
" angles " << iteratorTrackerRcd->rotation().eulerAngles() << std::endl;
1356 std::cout << iteratorTrackerRcd->rotation() << std::endl;
1357 std::cout <<
"=== iteratorMuonRcd " << iteratorMuonRcd->rawId()<<
" ====\n"
1358 <<
" translation " << iteratorMuonRcd->translation()<<
"\n"
1359 <<
" angles " << iteratorMuonRcd->rotation().eulerAngles() << std::endl;
1360 std::cout << iteratorMuonRcd->rotation() << std::endl;
1384 std::cout<<
" ............... DEFINE FITTER ..................."<<std::endl;
1406 std::cout<<
" theTrackingGeometry.isValid() "<<theTrackingGeometry.isValid()<<std::endl;
1407 std::cout<<
"get also the MuonTransientTrackingRecHitBuilder" <<
"\n";
1408 std::cout<<
"get also the TransientTrackingRecHitBuilder" <<
"\n";
1410 defineFitter =
false;
1415 for(MuonCollection::const_iterator itMuon = smuons->begin();
1416 itMuon != smuons->end(); ++itMuon) {
1419 std::cout<<
" mu gM is GM Mu SaM tM "<<itMuon->isGlobalMuon()<<
" "
1420 <<itMuon->isMuon()<<
" "<<itMuon->isStandAloneMuon()
1421 <<
" "<<itMuon->isTrackerMuon()<<
" "
1426 TransientTrack muTT(itMuon->outerTrack(), magneticField_, trackingGeometry_);
1431 TransientTrack trackTT(itMuon->track(), magneticField_, trackingGeometry_);
1436 GlobalPoint pointTrackOut = outerTrackTSOS.globalPosition();
1437 float lenghtTrack = (pointTrackOut-pointTrackIn).
mag();
1438 GlobalPoint pointMuonIn = innerMuTSOS.globalPosition();
1440 float lenghtMuon = (pointMuonOut - pointMuonIn).
mag();
1441 GlobalVector momentumTrackOut = outerTrackTSOS.globalMomentum();
1443 float distanceInIn = (pointTrackIn - pointMuonIn).
mag();
1444 float distanceInOut = (pointTrackIn - pointMuonOut).
mag();
1445 float distanceOutIn = (pointTrackOut - pointMuonIn).
mag();
1446 float distanceOutOut = (pointTrackOut - pointMuonOut).
mag();
1449 std::cout<<
" pointTrackIn "<<pointTrackIn<<std::endl;
1450 std::cout<<
" Out "<<pointTrackOut<<
" lenght "<<lenghtTrack<<std::endl;
1451 std::cout<<
" point MuonIn "<<pointMuonIn<<std::endl;
1452 std::cout<<
" Out "<<pointMuonOut<<
" lenght "<<lenghtMuon<<std::endl;
1453 std::cout<<
" momeTrackIn Out "<<momentumTrackIn<<
" "<<momentumTrackOut<<std::endl;
1454 std::cout<<
" doi io ii oo "<<distanceOutIn<<
" "<<distanceInOut<<
" "
1455 <<distanceInIn<<
" "<<distanceOutOut<<std::endl;
1458 if(lenghtTrack < 90.)
continue;
1459 if(lenghtMuon < 300.)
continue;
1460 if(innerMuTSOS.globalMomentum().mag() < 5. || outerMuTSOS.
globalMomentum().
mag() < 5.)
continue;
1461 if(momentumTrackIn.
mag() < 15. || momentumTrackOut.
mag() < 15.)
continue;
1462 if(trackTT.charge() != muTT.charge())
continue;
1465 std::cout<<
" passed lenght momentum cuts"<<std::endl;
1477 if( isolatedMuonMode_ ){
1478 if(debug_)
std::cout<<
" ------ Isolated (out-in) ----- "<<std::endl;
1479 const Surface& refSurface = innerMuTSOS.surface();
1481 tpMuLocal(refSurface.
tangentPlane(innerMuTSOS.localPosition()));
1482 Nl = tpMuLocal->normalVector();
1484 tpMuGlobal(refSurface.
tangentPlane(innerMuTSOS.globalPosition()));
1487 const Plane* refPlane =
dynamic_cast<Plane*
>(surf);
1491 std::cout<<
" Nlocal "<<Nl.
x()<<
" "<<Nl.
y()<<
" "<<Nl.
z()<<
" "
1492 <<
" alfa "<<int(asin(Nl.
x())*57.29578)<<std::endl;
1493 std::cout<<
" global "<<Ng.
x()<<
" "<<Ng.
y()<<
" "<<Ng.
z()<<std::endl;
1494 std::cout<<
" lp "<<Nlp.
x()<<
" "<<Nlp.
y()<<
" "<<Nlp.
z()<<std::endl;
1504 extrapolationT = alongSmPr.propagate(outerTrackTSOS, refSurface);
1509 extrapolationT = alongSmPr.propagate(trackFittedTSOS, refSurface);
1512 if(!extrapolationT.
isValid()){
1514 std::cout<<
" !!!!!!!!! Catastrophe Out-In extrapolationT.isValid "
1527 (innerMuTSOS.globalPosition()).y(),
1528 (innerMuTSOS.globalPosition()).z());
1529 GPm = innerMuTSOS.globalMomentum();
1532 (outerTrackTSOS.globalPosition()).y(),
1533 (outerTrackTSOS.globalPosition()).z());
1535 innerMuTSOS.cartesianError().matrix());
1546 if( cosmicMuonMode_ ){
1548 if((distanceOutIn <= distanceInOut) & (distanceOutIn <= distanceInIn) &
1549 (distanceOutIn <= distanceOutOut)){
1550 if(debug_)
std::cout<<
" ----- Out - In -----"<<std::endl;
1552 const Surface& refSurface = innerMuTSOS.surface();
1554 tpMuGlobal(refSurface.
tangentPlane(innerMuTSOS.globalPosition()));
1555 Nl = tpMuGlobal->normalVector();
1560 extrapolationT = alongSmPr.propagate(outerTrackTSOS, refSurface);
1565 extrapolationT = alongSmPr.propagate(trackFittedTSOS, refSurface);
1568 if(!extrapolationT.
isValid()){
1570 std::cout<<
" !!!!!!!!! Catastrophe Out-In extrapolationT.isValid "
1576 std::cout<<
" extrapolationT.isValid "<<extrapolationT.
isValid()<<std::endl;
1586 (innerMuTSOS.globalPosition()).y(),
1587 (innerMuTSOS.globalPosition()).z());
1588 GPm = innerMuTSOS.globalMomentum();
1590 (outerTrackTSOS.globalPosition()).y(),
1591 (outerTrackTSOS.globalPosition()).z());
1593 innerMuTSOS.cartesianError().matrix());
1605 <<Chooser.operator()(*outerTrackTSOS.freeState(), refSurface)
1607 Chooser.operator()(*outerTrackTSOS.freeState(), refSurface))
1609 std::cout<<
" --- Nlocal "<<Nl.
x()<<
" "<<Nl.
y()<<
" "<<Nl.
z()<<
" "
1610 <<
" alfa "<<int(asin(Nl.
x())*57.29578)<<std::endl;
1615 else if((distanceInOut <= distanceInIn) & (distanceInOut <= distanceOutIn) &
1616 (distanceInOut <= distanceOutOut)){
1617 if(debug_)
std::cout<<
" ----- In - Out -----"<<std::endl;
1622 Nl = tpMuGlobal->normalVector();
1627 extrapolationT = oppositeSmPr.propagate(innerTrackTSOS, refSurface);
1632 extrapolationT = oppositeSmPr.propagate(trackFittedTSOS, refSurface);
1635 if(!extrapolationT.
isValid()){
1637 std::cout<<
" !!!!!!!!! Catastrophe Out-In extrapolationT.isValid "
1638 <<
"\a\a\a\a\a\a\a\a"<<extrapolationT.
isValid()
1643 std::cout<<
" extrapolationT.isValid "<<extrapolationT.
isValid()<<std::endl;
1672 <<Chooser.operator()(*innerTrackTSOS.
freeState(), refSurface)
1674 Chooser.operator()(*innerTrackTSOS.
freeState(), refSurface))
1676 std::cout<<
" --- Nlocal "<<Nl.
x()<<
" "<<Nl.
y()<<
" "<<Nl.
z()<<
" "
1677 <<
" alfa "<<int(asin(Nl.
x())*57.29578)<<std::endl;
1681 else if((distanceOutOut <= distanceInOut) & (distanceOutOut <= distanceInIn) &
1682 (distanceOutOut <= distanceOutIn)){
1683 if(debug_)
std::cout<<
" ----- Out - Out -----"<<std::endl;
1691 Nl = tpMuGlobal->normalVector();
1694 extrapolationT = alongSmPr.propagate(outerTrackTSOS, refSurface);
1696 if(!extrapolationT.
isValid()){
1698 std::cout<<
" !!!!!!!!! Catastrophe Out-Out extrapolationT.isValid "
1699 <<
"\a\a\a\a\a\a\a\a"<<extrapolationT.
isValid()
1704 std::cout<<
" extrapolationT.isValid "<<extrapolationT.
isValid()<<std::endl;
1718 (outerTrackTSOS.globalPosition()).y(),
1719 (outerTrackTSOS.globalPosition()).z());
1729 <<Chooser.operator()(*outerTrackTSOS.freeState(), refSurface)
1731 Chooser.operator()(*outerTrackTSOS.freeState(), refSurface))
1733 std::cout<<
" --- Nlocal "<<Nl.
x()<<
" "<<Nl.
y()<<
" "<<Nl.
z()<<
" "
1734 <<
" alfa "<<int(asin(Nl.
x())*57.29578)<<std::endl;
1735 std::cout<<
" Nornal "<<Nl.
x()<<
" "<<Nl.
y()<<
" "<<Nl.
z()<<
" "
1736 <<
" alfa "<<int(asin(Nl.
x())*57.29578)<<std::endl;
1741 std::cout<<
" ------- !!!!!!!!!!!!!!! No proper Out - In \a\a\a\a\a\a\a"<<std::endl;
1747 if(tsosMuonIf == 0) {
if(
info) {
std::cout<<
"No tsosMuon !!!!!!"<<std::endl;
continue;}}
1749 if(tsosMuonIf == 1) tsosMuon = muTT.innermostMeasurementState();
1750 else tsosMuon = muTT.outermostMeasurementState();
1755 (GRm, GPm, Nl, Rt, Rm, Pm, LPRm, extrapolationT, tsosMuon);
1758 if(!trackFittedTSOS.
isValid()){
1759 if(
info)
std::cout<<
" ================= trackFittedTSOS notValid !!!!!!!! "<<std::endl;
1761 if(debug_) this->debugTrajectorySOS(
" trackFittedTSOS ", trackFittedTSOS);
1765 if(!muonFittedTSOS.
isValid()){
1766 if(
info)
std::cout<<
" ================= muonFittedTSOS notValid !!!!!!!! "<<std::endl;
1768 if(debug_) this->debugTrajectorySOS(
" muonFittedTSOS ", muonFittedTSOS);
1781 float RelMomResidual = (Pm.
mag() - Pt.mag()) / (Pt.mag() + 1.e-6);;
1784 Vm(0) = resR.
x(); Vm(1) = resR.
y(); Vm(2) = resR.
z();
1785 Vm(3) = resP0.
x(); Vm(4) = resP0.
y(); Vm(5) = resP0.
z();
1786 float Rmuon = Rm.
perp();
1787 float Zmuon = Rm.
z();
1788 float alfa_x = atan2(Nl.
x(),Nl.
y())*57.29578;
1791 std::cout<<
" Nx Ny Nz alfa_x "<<Nl.
x()<<
" "<<Nl.
y()<<
" "<<Nl.
z()<<
" "<<alfa_x<<std::endl;
1797 for(
int i=0;
i<=5;
i++) chi_d += Vm(
i)*Vm(
i)/Cm(
i,
i);
1803 bool ierrLoc = !
m.Invert();
1804 if (ierrLoc && debug_ &&
info) {
1805 std::cout<<
" ==== Error inverting Local covariance matrix ==== "<<std::endl;
1807 double chi_Loc = ROOT::Math::Similarity(Vml,
m);
1809 std::cout<<
" chi_Loc px/pz/err "<<chi_Loc<<
" "<<Vml(1)/
sqrt(Cml(1,1))<<std::endl;
1811 if(Pt.mag() < 15.)
continue;
1812 if(Pm.
mag() < 5.)
continue;
1827 if(fabs(resR.
x()) > 20.)
continue;
1828 if(fabs(resR.
y()) > 20.)
continue;
1829 if(fabs(resR.
z()) > 20.)
continue;
1830 if(fabs(resR.
mag()) > 30.)
continue;
1831 if(fabs(resP.
x()) > 0.06)
continue;
1832 if(fabs(resP.
y()) > 0.06)
continue;
1833 if(fabs(resP.
z()) > 0.06)
continue;
1834 if(chi_d > 40.)
continue;
1854 if(Rmuon < 120. || Rmuon > 450.)
continue;
1855 if(Zmuon < -720. || Zmuon > 720.)
continue;
1856 MuSelect =
" Barrel+EndCaps";
1859 std::cout<<
" .............. passed all cuts"<<std::endl;
1867 CLHEP::HepSymMatrix covLoc(4,0);
1868 for(
int i=1;
i<=4;
i++)
1869 for(
int j=1;
j<=
i;
j++){
1876 CLHEP::HepMatrix rotLoc (3,3,0);
1889 CLHEP::HepVector posLoc(3);
1898 std::cout<<
" posLoc "<<posLoc.T()<<std::endl;
1899 std::cout<<
" rotLoc "<<rotLoc<<std::endl;
1903 histo->Fill(itMuon->track()->pt());
1906 histo2->Fill(Pt.mag());
1907 histo3->Fill((
PI/2.-itMuon->track()->outerTheta()));
1908 histo4->Fill(itMuon->track()->phi());
1909 histo5->Fill(Rmuon);
1910 histo6->Fill(Zmuon);
1911 histo7->Fill(RelMomResidual);
1913 histo8->Fill(chi_d);
1915 histo101->Fill(Zmuon, Rmuon);
1916 histo101->Fill(Rt0.
z(), Rt0.
perp());
1917 histo102->Fill(Rt0.
x(), Rt0.
y());
1918 histo102->Fill(Rm.
x(), Rm.
y());
1920 histo11->Fill(resR.
mag());
1921 if(fabs(Nl.
x()) < 0.98) histo12->Fill(resR.
x());
1922 if(fabs(Nl.
y()) < 0.98) histo13->Fill(resR.
y());
1923 if(fabs(Nl.
z()) < 0.98) histo14->Fill(resR.
z());
1924 histo15->Fill(resP.
x());
1925 histo16->Fill(resP.
y());
1926 histo17->Fill(resP.
z());
1928 if((fabs(Nl.
x()) < 0.98) && (fabs(Nl.
y()) < 0.98) &&(fabs(Nl.
z()) < 0.98))
1930 histo18->Fill(
sqrt(C0(0,0)));
1931 histo19->Fill(
sqrt(C1(0,0)));
1932 histo20->Fill(
sqrt(C1(0,0)+Ce(0,0)));
1934 if(fabs(Nl.
x()) < 0.98) histo21->Fill(Vm(0)/
sqrt(Cm(0,0)));
1935 if(fabs(Nl.
y()) < 0.98) histo22->Fill(Vm(1)/
sqrt(Cm(1,1)));
1936 if(fabs(Nl.
z()) < 0.98) histo23->Fill(Vm(2)/
sqrt(Cm(2,2)));
1937 histo24->Fill(Vm(3)/
sqrt(C1(3,3)+Ce(3,3)));
1938 histo25->Fill(Vm(4)/
sqrt(C1(4,4)+Ce(4,4)));
1939 histo26->Fill(Vm(5)/
sqrt(C1(5,5)+Ce(5,5)));
1940 histo27->Fill(Nl.
x());
1941 histo28->Fill(Nl.
y());
1942 histo29->Fill(lenghtTrack);
1943 histo30->Fill(lenghtMuon);
1944 histo31->Fill(chi_Loc);
1945 histo32->Fill(Vml(1)/
sqrt(Cml(1,1)));
1946 histo33->Fill(Vml(2)/
sqrt(Cml(2,2)));
1947 histo34->Fill(Vml(3)/
sqrt(Cml(3,3)));
1948 histo35->Fill(Vml(4)/
sqrt(Cml(4,4)));
1952 std::cout<<
" diag 0[ "<<C0(0,0)<<
" "<<C0(1,1)<<
" "<<C0(2,2)<<
" "<<C0(3,3)<<
" "
1953 <<C0(4,4)<<
" "<<C0(5,5)<<
" ]"<<std::endl;
1954 std::cout<<
" diag e[ "<<Ce(0,0)<<
" "<<Ce(1,1)<<
" "<<Ce(2,2)<<
" "<<Ce(3,3)<<
" "
1955 <<Ce(4,4)<<
" "<<Ce(5,5)<<
" ]"<<std::endl;
1956 std::cout<<
" diag 1[ "<<C1(0,0)<<
" "<<C1(1,1)<<
" "<<C1(2,2)<<
" "<<C1(3,3)<<
" "
1957 <<C1(4,4)<<
" "<<C1(5,5)<<
" ]"<<std::endl;
1959 <<
" Pm "<<Pm.
x()<<
" "<<Pm.
y()<<
" "<<Pm.
z()<<std::endl;
1960 std::cout<<
" Rt "<<Rt.x()<<
" "<<Rt.y()<<
" "<<Rt.z()
1961 <<
" Pt "<<Pt.x()<<
" "<<Pt.y()<<
" "<<Pt.z()<<std::endl;
1963 std::cout<<
" resR "<<resR.
x()<<
" "<<resR.
y()<<
" "<<resR.
z()
1964 <<
" resP "<<resP.
x()<<
" "<<resP.
y()<<
" "<<resP.
z()<<std::endl;
1965 std::cout<<
" Rm-t "<<(Rm-Rt).
x()<<
" "<<(Rm-Rt).y()<<
" "<<(Rm-Rt).z()
1966 <<
" Pm-t "<<(Pm-
Pt).
x()<<
" "<<(Pm-
Pt).y()<<
" "<<(Pm-
Pt).z()<<std::endl;
1969 <<
sqrt(Cm(3,3))<<
" "<<
sqrt(Cm(4,4))<<
" "<<
sqrt(Cm(5,5))<<std::endl;
1970 std::cout<<
" Pmuon Ptrack dP/Ptrack "<<itMuon->outerTrack()->p()<<
" "
1971 <<itMuon->track()->outerP()<<
" "
1972 <<(itMuon->outerTrack()->p() -
1973 itMuon->track()->outerP())/itMuon->track()->outerP()<<std::endl;
1976 std::cout<<
" diag [ "<<Cm(0,0)<<
" "<<Cm(1,1)<<
" "<<Cm(2,2)<<
" "<<Cm(3,3)<<
" "
1977 <<Cm(4,4)<<
" "<<Cm(5,5)<<
" ]"<<std::endl;
1981 for(
int i=0;
i<=5;
i++) Diag[
i] =
sqrt(Cm(
i,
i));
1982 for(
int i=0;
i<=5;
i++)
1983 for(
int j=0;
j<=5;
j++)
1984 Ro(
i,
j) = Cm(
i,
j)/Diag[
i]/Diag[
j];
1985 std::cout<<
" correlation matrix "<<std::endl;
1989 for(
int i=0;
i<=5;
i++)
1990 for(
int j=0;
j<=5;
j++)
1993 bool ierr = !CmI.Invert();
1994 if( ierr ) {
if(alarm || debug_)
1995 std::cout<<
" Error inverse covariance matrix !!!!!!!!!!!"<<std::endl;
1998 std::cout<<
" inverse cov matrix "<<std::endl;
2001 double chi = ROOT::Math::Similarity(Vm, CmI);
2002 std::cout<<
" chi chi_d "<<chi<<
" "<<chi_d<<std::endl;
2022 R_m(0) = Rm.
x(); R_m(1) = Rm.
y(); R_m(2) = Rm.
z();
2023 R_t(0) = Rt.
x(); R_t(1) = Rt.
y(); R_t(2) = Rt.
z();
2024 P_t(0) = Pt.
x(); P_t(1) = Pt.
y(); P_t(2) = Pt.
z();
2025 Norm(0) = Nl.
x(); Norm(1) = Nl.
y(); Norm(2) = Nl.
z();
2027 for(
int i=0;
i<=2;
i++){
2028 if(Cm(
i,
i) > 1.
e-20)
2030 else Wi(
i) = 1.e-10;
2031 dR(
i) = R_m(
i) - R_t(
i);
2034 float PtN = P_t(0)*Norm(0) + P_t(1)*Norm(1) + P_t(2)*Norm(2);
2036 Jac(0,0) = 1. - P_t(0)*Norm(0)/PtN;
2037 Jac(0,1) = - P_t(0)*Norm(1)/PtN;
2038 Jac(0,2) = - P_t(0)*Norm(2)/PtN;
2040 Jac(1,0) = - P_t(1)*Norm(0)/PtN;
2041 Jac(1,1) = 1. - P_t(1)*Norm(1)/PtN;
2042 Jac(1,2) = - P_t(1)*Norm(2)/PtN;
2044 Jac(2,0) = - P_t(2)*Norm(0)/PtN;
2045 Jac(2,1) = - P_t(2)*Norm(1)/PtN;
2046 Jac(2,2) = 1. - P_t(2)*Norm(2)/PtN;
2050 for(
int i=0;
i<=2;
i++)
2051 for(
int j=0;
j<=2;
j++){
2055 for(
int k=0;
k<=2;
k++){
2058 for(
int i=0;
i<=2;
i++)
2059 for(
int j=0;
j<=2;
j++){
2064 for(
int i=0;
i<=2;
i++)
2065 for(
int k=0;
k<=2;
k++) Gtr(
i) +=
dR(
k)*Wi(
k)*Jac(
k,
i);
2066 for(
int i=0;
i<=2;
i++) Gfr(
i) += Gtr(
i);
2076 std::cout<<
" Jacobian dr/ddx "<<std::endl;
2106 CLHEP::HepSymMatrix
w(Nd,0);
2107 for (
int i=1;
i <= Nd;
i++)
2108 for (
int j=1;
j <= Nd;
j++){
2109 if(
j <=
i )
w(
i,
j) = GCov(
i-1,
j-1);
2112 if((
i ==
j) && (
i<=3) && (GCov(
i-1,
j-1) < 1.
e-20))
w(
i,
j) = 1.e20;
2113 if(
i !=
j)
w(
i,
j) = 0.;
2119 CLHEP::HepVector V(Nd), Rt(3),
Pt(3), Rm(3), Pm(3), Norm(3);
2120 Rt(1) = GRt.
x(); Rt(2) = GRt.
y(); Rt(3) = GRt.
z();
2121 Pt(1) = GPt.
x();
Pt(2) = GPt.
y();
Pt(3) = GPt.
z();
2122 Rm(1) = GRm.
x(); Rm(2) = GRm.
y(); Rm(3) = GRm.
z();
2123 Pm(1) = GPm.
x(); Pm(2) = GPm.
y(); Pm(3) = GPm.
z();
2124 Norm(1) = GNorm.
x(); Norm(2) = GNorm.
y(); Norm(3) = GNorm.
z();
2126 V = dsum(Rm - Rt, Pm -
Pt) ;
2129 double PmN = CLHEP_dot(Pm, Norm);
2131 CLHEP::HepMatrix Jac(Nd,Nd,0);
2132 for (
int i=1;
i <= 3;
i++)
2133 for (
int j=1;
j <= 3;
j++){
2134 Jac(
i,
j) = Pm(
i)*Norm(
j) / PmN;
2135 if(
i ==
j ) Jac(
i,
j) -= 1.;
2149 CLHEP::HepVector dsda(3);
2150 dsda(1) = (Norm(2)*Rm(3) - Norm(3)*Rm(2)) / PmN;
2151 dsda(2) = (Norm(3)*Rm(1) - Norm(1)*Rm(3)) / PmN;
2152 dsda(3) = (Norm(1)*Rm(2) - Norm(2)*Rm(1)) / PmN;
2155 Jac(1,4) = Pm(1)*dsda(1);
2156 Jac(2,4) = -Rm(3) + Pm(2)*dsda(1);
2157 Jac(3,4) = Rm(2) + Pm(3)*dsda(1);
2159 Jac(1,5) = Rm(3) + Pm(1)*dsda(2);
2160 Jac(2,5) = Pm(2)*dsda(2);
2161 Jac(3,5) = -Rm(1) + Pm(3)*dsda(2);
2163 Jac(1,6) = -Rm(2) + Pm(1)*dsda(3);
2164 Jac(2,6) = Rm(1) + Pm(2)*dsda(3);
2165 Jac(3,6) = Pm(3)*dsda(3);
2167 CLHEP::HepSymMatrix W(Nd,0);
2169 W = w.inverse(ierr);
2170 if(ierr != 0) {
if(alarm)
2171 std::cout<<
" gradientGlobal: inversion of matrix w fail "<<std::endl;
2175 CLHEP::HepMatrix W_Jac(Nd,Nd,0);
2176 W_Jac = Jac.T() * W;
2178 CLHEP::HepVector grad3(Nd);
2181 CLHEP::HepMatrix hess3(Nd,Nd);
2182 hess3 = Jac.T() * W * Jac;
2188 CLHEP::HepVector d3I = CLHEP::solve(Hess, -Grad);
2190 CLHEP::HepMatrix Errd3I = Hess.inverse(iEr3I);
2191 if( iEr3I != 0) {
if(alarm)
2192 std::cout<<
" gradientGlobal error inverse Hess matrix !!!!!!!!!!!"<<std::endl;
2196 std::cout<<
" dG "<<d3I(1)<<
" "<<d3I(2)<<
" "<<d3I(3)<<
" "<<d3I(4)<<
" "
2197 <<d3I(5)<<
" "<<d3I(6)<<std::endl;;
2199 <<
" "<<
sqrt(Errd3I(4,4))<<
" "<<
sqrt(Errd3I(5,5))<<
" "<<
sqrt(Errd3I(6,6))
2203 #ifdef CHECK_OF_DERIVATIVES
2206 CLHEP::HepVector
d(3,0),
a(3,0);
2207 CLHEP::HepMatrix
T(3,3,1);
2209 CLHEP::HepMatrix Ti = T.T();
2212 double A = CLHEP_dot(Ti*Pm, Norm);
2213 double B = CLHEP_dot((Rt -Ti*Rm + Ti*
d), Norm);
2216 CLHEP::HepVector r0(3,0), p0(3,0);
2217 r0 = Ti*Rm - Ti*d + s0*(Ti*Pm) - Rt;
2220 double delta = 0.0001;
2229 A = CLHEP_dot(Ti*Pm, Norm);
2230 B = CLHEP_dot((Rt -Ti*Rm + Ti*d), Norm);
2233 CLHEP::HepVector
r(3,0),
p(3,0);
2234 r = Ti*Rm - Ti*d + s*(Ti*Pm) - Rt;
2237 std::cout<<
" s0 s num dsda("<<ii<<
") "<<s0<<
" "<<s<<
" "
2238 <<(s-s0)/delta<<
" "<<dsda(ii)<<endl;
2240 std::cout<<
" -- An d(r,p)/d("<<ii<<
") "<<Jac(1,ii)<<
" "<<Jac(2,ii)<<
" "
2241 <<Jac(3,ii)<<
" "<<Jac(4,ii)<<
" "<<Jac(5,ii)<<
" "
2242 <<Jac(6,ii)<<std::endl;
2243 std::cout<<
" Nu d(r,p)/d("<<ii<<
") "<<(
r(1)-r0(1))/delta<<
" "
2244 <<(
r(2)-r0(2))/delta<<
" "<<(
r(3)-r0(3))/delta<<
" "
2245 <<(
p(1)-p0(1))/delta<<
" "<<(
p(2)-p0(2))/delta<<
" "
2246 <<(
p(3)-p0(3))/delta<<std::endl;
2248 std::cout<<
" -- An d(r,p)/a("<<ii<<
") "<<Jac(1,ii+3)<<
" "<<Jac(2,ii+3)<<
" "
2249 <<Jac(3,ii+3)<<
" "<<Jac(4,ii+3)<<
" "<<Jac(5,ii+3)<<
" "
2250 <<Jac(6,ii+3)<<std::endl;
2251 std::cout<<
" Nu d(r,p)/a("<<ii<<
") "<<(
r(1)-r0(1))/delta<<
" "
2252 <<(
r(2)-r0(2))/delta<<
" "<<(
r(3)-r0(3))/delta<<
" "
2253 <<(
p(1)-p0(1))/delta<<
" "<<(
p(2)-p0(2))/delta<<
" "
2254 <<(
p(3)-p0(3))/delta<<std::endl;
2267 CLHEP::HepSymMatrix& covLoc,
2268 CLHEP::HepMatrix& rotLoc,
2269 CLHEP::HepVector& R0,
2281 std::cout<<
" gradientLocal "<<std::endl;
2300 CLHEP::HepVector Rt(3),
Pt(3), Rm(3), Pm(3), Norm(3);
2301 Rt(1) = GRt.
x(); Rt(2) = GRt.
y(); Rt(3) = GRt.
z();
2302 Pt(1) = GPt.
x();
Pt(2) = GPt.
y();
Pt(3) = GPt.
z();
2303 Rm(1) = GRm.
x(); Rm(2) = GRm.
y(); Rm(3) = GRm.
z();
2304 Pm(1) = GPm.
x(); Pm(2) = GPm.
y(); Pm(3) = GPm.
z();
2305 Norm(1) = GNorm.
x(); Norm(2) = GNorm.
y(); Norm(3) = GNorm.
z();
2307 CLHEP::HepVector V(4), Rml(3), Pml(3), Rtl(3), Ptl(3);
2315 Rml = rotLoc * (Rm - R0);
2316 Rtl = rotLoc * (Rt - R0);
2320 V(1) = LPRm(0) - Ptl(1)/Ptl(3);
2321 V(2) = LPRm(1) - Ptl(2)/Ptl(3);
2322 V(3) = LPRm(2) - Rtl(1);
2323 V(4) = LPRm(3) - Rtl(2);
2338 CLHEP::HepSymMatrix W = covLoc;
2342 if(ierr != 0) {
if(alarm)
2343 std::cout<<
" gradientLocal: inversion of matrix W fail "<<std::endl;
2355 CLHEP::HepMatrix JacToLoc(4,6,0);
2356 for(
int i=1;
i<=2;
i++)
2357 for(
int j=1;
j<=3;
j++){
2358 JacToLoc(
i,
j+3) = (rotLoc(
i,
j) - rotLoc(3,
j)*Pml(
i)/Pml(3))/Pml(3);
2359 JacToLoc(
i+2,
j) = rotLoc(
i,
j);
2364 double PmN = CLHEP_dot(Pm, Norm);
2366 CLHEP::HepMatrix Jac(6,6,0);
2367 for (
int i=1;
i <= 3;
i++)
2368 for (
int j=1;
j <= 3;
j++){
2369 Jac(
i,
j) = Pm(
i)*Norm(
j) / PmN;
2370 if(
i ==
j ) Jac(
i,
j) -= 1.;
2384 CLHEP::HepVector dsda(3);
2385 dsda(1) = (Norm(2)*Rm(3) - Norm(3)*Rm(2)) / PmN;
2386 dsda(2) = (Norm(3)*Rm(1) - Norm(1)*Rm(3)) / PmN;
2387 dsda(3) = (Norm(1)*Rm(2) - Norm(2)*Rm(1)) / PmN;
2390 Jac(1,4) = Pm(1)*dsda(1);
2391 Jac(2,4) = -Rm(3) + Pm(2)*dsda(1);
2392 Jac(3,4) = Rm(2) + Pm(3)*dsda(1);
2394 Jac(1,5) = Rm(3) + Pm(1)*dsda(2);
2395 Jac(2,5) = Pm(2)*dsda(2);
2396 Jac(3,5) = -Rm(1) + Pm(3)*dsda(2);
2398 Jac(1,6) = -Rm(2) + Pm(1)*dsda(3);
2399 Jac(2,6) = Rm(1) + Pm(2)*dsda(3);
2400 Jac(3,6) = Pm(3)*dsda(3);
2403 CLHEP::HepMatrix JacCorLoc(4,6,0);
2404 JacCorLoc = JacToLoc * Jac;
2407 CLHEP::HepMatrix W_Jac(6,4,0);
2408 W_Jac = JacCorLoc.T() * W;
2410 CLHEP::HepVector gradL(6);
2413 CLHEP::HepMatrix hessL(6,6);
2414 hessL = JacCorLoc.T() * W * JacCorLoc;
2419 CLHEP::HepVector dLI = CLHEP::solve(HessL, -GradL);
2421 CLHEP::HepMatrix ErrdLI = HessL.inverse(iErI);
2422 if( iErI != 0) {
if(alarm)
2423 std::cout<<
" gradLocal Error inverse Hess matrix !!!!!!!!!!!"<<std::endl;
2427 std::cout<<
" dL "<<dLI(1)<<
" "<<dLI(2)<<
" "<<dLI(3)<<
" "<<dLI(4)<<
" "
2428 <<dLI(5)<<
" "<<dLI(6)<<std::endl;;
2430 <<
" "<<
sqrt(ErrdLI(4,4))<<
" "<<
sqrt(ErrdLI(5,5))<<
" "<<
sqrt(ErrdLI(6,6))
2444 if(GNorm.
z() > 0.95)
2445 std::cout<<
" Ecap1 N "<<GNorm<<std::endl;
2446 else if(GNorm.
z() < -0.95)
2447 std::cout<<
" Ecap2 N "<<GNorm<<std::endl;
2449 std::cout<<
" Barrel N "<<GNorm<<std::endl;
2450 std::cout<<
" JacCLo(i,"<<i<<
") = {"<<JacCorLoc(1,i)<<
" "<<JacCorLoc(2,i)<<
" "
2451 <<JacCorLoc(3,i)<<
" "<<JacCorLoc(4,i)<<
"}"<<std::endl;
2452 std::cout<<
" rotLoc "<<rotLoc<<std::endl;
2454 std::cout<<
" Pm,l "<<Pm.T()<<
" "<<Pml(1)/Pml(3)<<
" "<<Pml(2)/Pml(3)<<std::endl;
2455 std::cout<<
" Pt,l "<<Pt.T()<<
" "<<Ptl(1)/Ptl(3)<<
" "<<Ptl(2)/Ptl(3)<<std::endl;
2457 std::cout<<
" Cov \n"<<covLoc<<std::endl;
2458 std::cout<<
" W*Cov "<<W*covLoc<<std::endl;
2462 std::cout<<
" JacToLoc "<<JacToLoc<<std::endl;
2466 #ifdef CHECK_OF_JACOBIAN_CARTESIAN_TO_LOCAL
2468 CLHEP::HepVector V0(4,0);
2469 V0(1) = Pml(1)/Pml(3) - Ptl(1)/Ptl(3);
2470 V0(2) = Pml(2)/Pml(3) - Ptl(2)/Ptl(3);
2471 V0(3) = Rml(1) - Rtl(1);
2472 V0(4) = Rml(2) - Rtl(2);
2473 int ii = 3;
float delta = 0.01;
2474 CLHEP::HepVector V1(4,0);
2475 if(ii <= 3) {Rm(ii) +=
delta; Rml = rotLoc * (Rm - R0);}
2476 else {Pm(ii-3) +=
delta; Pml = rotLoc * Pm;}
2479 V1(1) = Pml(1)/Pml(3) - Ptl(1)/Ptl(3);
2480 V1(2) = Pml(2)/Pml(3) - Ptl(2)/Ptl(3);
2481 V1(3) = Rml(1) - Rtl(1);
2482 V1(4) = Rml(2) - Rtl(2);
2484 if(GNorm.
z() > 0.95)
2485 std::cout<<
" Ecap1 N "<<GNorm<<std::endl;
2486 else if(GNorm.
z() < -0.95)
2487 std::cout<<
" Ecap2 N "<<GNorm<<std::endl;
2489 std::cout<<
" Barrel N "<<GNorm<<std::endl;
2490 std::cout<<
" dldc Num (i,"<<ii<<
") "<<(V1(1)-V0(1))/delta<<
" "<<(V1(2)-V0(2))/delta<<
" "
2491 <<(V1(3)-V0(3))/delta<<
" "<<(V1(4)-V0(4))/delta<<std::endl;
2492 std::cout<<
" dldc Ana (i,"<<ii<<
") "<<JacToLoc(1,ii)<<
" "<<JacToLoc(2,ii)<<
" "
2493 <<JacToLoc(3,ii)<<
" "<<JacToLoc(4,ii)<<std::endl;
2508 CLHEP::HepVector
d(3,0),
a(3,0), Norm(3), Rm0(3), Pm0(3), Rm1(3), Pm1(3),
2511 d(1)=0.0;
d(2)=0.0;
d(3)=0.0;
a(1)=0.0000;
a(2)=0.0000;
a(3)=0.0000;
2523 MuGlShift =
d; MuGlAngle =
a;
2525 if((
d(1) == 0.) & (
d(2) == 0.) & (
d(3) == 0.) &
2526 (
a(1) == 0.) & (
a(2) == 0.) & (
a(3) == 0.)){
2530 std::cout<<
" ...... without misalignment "<<std::endl;
2534 Rm0(1) = GRm.
x(); Rm0(2) = GRm.
y(); Rm0(3) = GRm.
z();
2535 Pm0(1) = GPm.
x(); Pm0(2) = GPm.
y(); Pm0(3) = GPm.
z();
2536 Norm(1) = Nl.
x(); Norm(2) = Nl.
y(); Norm(3) = Nl.
z();
2538 CLHEP::HepMatrix
T(3,3,1);
2548 T(1,2) =
c1 * s3 + s1 * s2 * c3;
2549 T(1,3) = s1 * s3 -
c1 * s2 * c3;
2551 T(2,2) =
c1 * c3 - s1 * s2 * s3;
2552 T(2,3) = s1 * c3 +
c1 * s2 * s3;
2559 CLHEP::HepMatrix Ti = T.T();
2560 CLHEP::HepVector di = -Ti *
d;
2562 CLHEP::HepVector ex0(3,0), ey0(3,0), ez0(3,0), ex(3,0), ey(3,0), ez(3,0);
2563 ex0(1) = 1.; ey0(2) = 1.; ez0(3) = 1.;
2564 ex = Ti*ex0; ey = Ti*ey0; ez = Ti*ez0;
2566 CLHEP::HepVector TiN = Ti * Norm;
2571 double si = CLHEP_dot((Ti*Rm0 - Rm0 + di), TiN) / CLHEP_dot(Pm0, TiN);
2572 Rm1(1) = CLHEP_dot(ex, Rm0 + si*Pm0 - di);
2573 Rm1(2) = CLHEP_dot(ey, Rm0 + si*Pm0 - di);
2574 Rm1(3) = CLHEP_dot(ez, Rm0 + si*Pm0 - di);
2579 Pm =
GlobalVector(CLHEP_dot(Pm0,ex), CLHEP_dot(Pm0, ey), CLHEP_dot(Pm0,ez));
2584 std::cout<<
" T*Pm0 "<<Pm1.T()<<std::endl;
2588 CLHEP::HepVector Rml = Rm1(1)*ex + Rm1(2)*ey + Rm1(3)*ez + di;
2590 CLHEP::HepVector Rt0(3);
2591 Rt0(1)=Rt.
x(); Rt0(2)=Rt.
y(); Rt0(3)=Rt.
z();
2594 double sl = CLHEP_dot(T*(Rt0 - Rml), T*Norm) / CLHEP_dot(Ti * Pm1, Norm);
2595 CLHEP::HepVector Rl = Rml + sl*(Ti*Pm1);
2600 double A = CLHEP_dot(Ti*Pm1, Norm);
2601 double B = CLHEP_dot(Rt0, Norm) - CLHEP_dot(Ti*Rm1, Norm)
2602 + CLHEP_dot(Ti*d, Norm);
2604 CLHEP::HepVector Dr = Ti*Rm1 - Ti*d + s*(Ti*Pm1) - Rm0;
2605 CLHEP::HepVector Dp = Ti*Pm1 - Pm0;
2607 CLHEP::HepVector TiR = Ti * Rm0 + di;
2608 CLHEP::HepVector Ri = T * TiR +
d;
2610 std::cout<<
" --TTi-0 "<<(Ri-Rm0).
T()<<std::endl;
2620 std::cout<<
" -- si sl s "<<si<<
" "<<sl<<
" "<<s<<std::endl;
2623 std::cout<<
" -- Rml-(Rm0+si*Pm0) "<<(Rml - Rm0 - si*Pm0).
T()<<std::endl;
2631 std::cout<<
" --Rl-0 "<<(Rl-Rm0).
T()<<std::endl;
2647 CLHEP::HepVector
d(3,0),
a(3,0), Norm(3), Rm0(3), Pm0(3), Rm1(3), Pm1(3),
2650 d(1)=0.0;
d(2)=0.0;
d(3)=0.0;
a(1)=0.0000;
a(2)=0.0000;
a(3)=0.0000;
2664 MuGlShift =
d; MuGlAngle =
a;
2666 if((
d(1) == 0.) & (
d(2) == 0.) & (
d(3) == 0.) &
2667 (
a(1) == 0.) & (
a(2) == 0.) & (
a(3) == 0.)){
2676 std::cout<<
" ...... without misalignment "<<std::endl;
2680 Rm0(1) = GRm.
x(); Rm0(2) = GRm.
y(); Rm0(3) = GRm.
z();
2681 Pm0(1) = GPm.
x(); Pm0(2) = GPm.
y(); Pm0(3) = GPm.
z();
2682 Norm(1) = Nl.
x(); Norm(2) = Nl.
y(); Norm(3) = Nl.
z();
2684 CLHEP::HepMatrix
T(3,3,1);
2694 T(1,2) =
c1 * s3 + s1 * s2 * c3;
2695 T(1,3) = s1 * s3 -
c1 * s2 * c3;
2697 T(2,2) =
c1 * c3 - s1 * s2 * s3;
2698 T(2,3) = s1 * c3 +
c1 * s2 * s3;
2706 CLHEP::HepMatrix Ti = T.T();
2707 CLHEP::HepVector di = -Ti *
d;
2709 CLHEP::HepVector ex0(3,0), ey0(3,0), ez0(3,0), ex(3,0), ey(3,0), ez(3,0);
2710 ex0(1) = 1.; ey0(2) = 1.; ez0(3) = 1.;
2711 ex = Ti*ex0; ey = Ti*ey0; ez = Ti*ez0;
2713 CLHEP::HepVector TiN = Ti * Norm;
2718 double si = CLHEP_dot((Ti*Rm0 - Rm0 + di), TiN) / CLHEP_dot(Pm0, TiN);
2719 Rm1(1) = CLHEP_dot(ex, Rm0 + si*Pm0 - di);
2720 Rm1(2) = CLHEP_dot(ey, Rm0 + si*Pm0 - di);
2721 Rm1(3) = CLHEP_dot(ez, Rm0 + si*Pm0 - di);
2727 Pm =
GlobalVector(CLHEP_dot(Pm0,ex), CLHEP_dot(Pm0, ey), CLHEP_dot(Pm0,ez));
2731 CLHEP::HepMatrix Tl(3,3,0);
2745 CLHEP::HepVector R0(3,0), newR0(3,0), newRl(3,0), newPl(3,0);
2750 newRl = Tl * (Rm1 - R0);
2753 Vm(0) = newPl(1)/newPl(3);
2754 Vm(1) = newPl(2)/newPl(3);
2758 #ifdef CHECK_DERIVATIVES_LOCAL_VS_ANGLES
2761 int ii = 2;
T(3,1) -=del;
T(1,3) +=del;
2764 CLHEP::HepVector Rm10 = Rm1, Pm10 = Pm1;;
2765 CLHEP::HepMatrix newTl = Tl*
T;
2768 ex = Ti*ex0; ey = Ti*ey0; ez = Ti*ez0;
2770 si = CLHEP_dot((Ti*Rm0 - Rm0 + di), TiN) / CLHEP_dot(Pm0, TiN);
2771 Rm1(1) = CLHEP_dot(ex, Rm0 + si*Pm0 - di);
2772 Rm1(2) = CLHEP_dot(ey, Rm0 + si*Pm0 - di);
2773 Rm1(3) = CLHEP_dot(ez, Rm0 + si*Pm0 - di);
2776 newRl = Tl * (Rm1 - R0);
2779 Vm(0) = newPl(1)/newPl(3);
2780 Vm(1) = newPl(2)/newPl(3);
2783 std::cout<<
" ========= dVm/da"<<ii<<
" "<<(Vm-Vm0)*(1./del)<<std::endl;
2789 std::cout<<
" ex "<<(Tl.T()*ex0).
T()<<std::endl;
2790 std::cout<<
" ey "<<(Tl.T()*ey0).
T()<<std::endl;
2791 std::cout<<
" ez "<<(Tl.T()*ez0).
T()<<std::endl;
2794 std::cout<<
" pxyz/p gl 0 "<<(Pm0/Pm0.norm()).
T()<<std::endl;
2795 std::cout<<
" pxyz/p loc0 "<<(Tl*Pm0/(Tl*Pm0).norm()).
T()<<std::endl;
2796 std::cout<<
" pxyz/p glob "<<(Pm1/Pm1.norm()).
T()<<std::endl;
2797 std::cout<<
" pxyz/p loc "<<(newPl/newPl.norm()).
T()<<std::endl;
2802 <<atan2(Pm0(2),Pm0(1))<<
" "<<atan2(Pm1(2),Pm1(1))<<
" "
2803 <<atan2((Tl*Pm0)(2),(Tl*Pm0)(1))<<
" "
2804 <<atan2(newPl(2),newPl(1))<<std::endl;
2805 std::cout<<
" ---- angl Gl Loc "<<atan2(Pm1(2),Pm1(1))-atan2(Pm0(2),Pm0(1))<<
" "
2806 <<atan2(newPl(2),newPl(1))-atan2((Tl*Pm0)(2),(Tl*Pm0)(1))<<
" "
2807 <<atan2(newPl(3),newPl(2))-atan2((Tl*Pm0)(3),(Tl*Pm0)(2))<<
" "
2808 <<atan2(newPl(1),newPl(3))-atan2((Tl*Pm0)(1),(Tl*Pm0)(3))<<
" "<<std::endl;
2812 CLHEP::HepMatrix newTl(3,3,0);
2813 CLHEP::HepVector R0(3,0), newRl(3,0), newPl(3,0);
2814 newTl = Tl * Ti.T();
2815 newR0 = Ti * R0 + di;
2826 CLHEP::HepVector Rvc(3,0), Pvc(3,0), Rvg(3,0), Pvg(3,0);
2827 Rvc(1) = Vm(2); Rvc(2) = Vm(3);
2829 sqrt(1 + Vm(0)*Vm(0) + Vm(1)*Vm(1));
2830 Pvc(1) = Pvc(3) * Vm(0);
2831 Pvc(2) = Pvc(3) * Vm(1);
2833 Rvg = newTl.T() * Rvc + newR0;
2834 Pvg = newTl.T() * Pvc;
2836 std::cout<<
" newPl "<<newPl.T()<<std::endl;
2847 std::cout<<
" T*Pm0 "<<Pm1.T()<<std::endl;
2851 CLHEP::HepVector Rml = Rm1(1)*ex + Rm1(2)*ey + Rm1(3)*ez + di;
2853 CLHEP::HepVector Rt0(3);
2854 Rt0(1)=Rt.
x(); Rt0(2)=Rt.
y(); Rt0(3)=Rt.
z();
2857 double sl = CLHEP_dot(T*(Rt0 - Rml), T*Norm) / CLHEP_dot(Ti * Pm1, Norm);
2858 CLHEP::HepVector Rl = Rml + sl*(Ti*Pm1);
2863 double A = CLHEP_dot(Ti*Pm1, Norm);
2864 double B = CLHEP_dot(Rt0, Norm) - CLHEP_dot(Ti*Rm1, Norm)
2865 + CLHEP_dot(Ti*d, Norm);
2867 CLHEP::HepVector Dr = Ti*Rm1 - Ti*d + s*(Ti*Pm1) - Rm0;
2868 CLHEP::HepVector Dp = Ti*Pm1 - Pm0;
2870 CLHEP::HepVector TiR = Ti * Rm0 + di;
2871 CLHEP::HepVector Ri = T * TiR +
d;
2873 std::cout<<
" --TTi-0 "<<(Ri-Rm0).
T()<<std::endl;
2883 std::cout<<
" -- si sl s "<<si<<
" "<<sl<<
" "<<s<<std::endl;
2886 std::cout<<
" -- Rml-(Rm0+si*Pm0) "<<(Rml - Rm0 - si*Pm0).
T()<<std::endl;
2894 std::cout<<
" --Rl-0 "<<(Rl-Rm0).
T()<<std::endl;
2910 bool smooth =
false;
2913 std::cout<<
" ......... start of trackFitter ......... "<<std::endl;
2915 this->debugTrackHit(
" Tracker track hits ", alongTr);
2916 this->debugTrackHit(
" Tracker TransientTrack hits ", alongTTr);
2920 DetId trackDetId =
DetId(alongTr->innerDetId());
2928 for(
unsigned int ihit = recHitAlong.
size()-1; ihit+1>0; ihit--){
2931 recHitAlong.
clear();
2934 std::cout<<
" ... Own recHit.size() "<<recHit.
size()<<
" "<<trackDetId.
rawId()<<std::endl;
2939 if((*i)->isValid()){
2947 <<
" ======> recHitMu "<<std::endl;
2955 std::cout<<
" ...along.... recHitMu.size() "<<recHitMu.size()<<std::endl;
2959 for(
unsigned int ihit = recHitMuAlong.size()-1; ihit+1>0; ihit--){
2960 recHitMu.push_back(recHitMuAlong[ihit]);
2962 recHitMuAlong.clear();
2965 std::cout<<
" ...opposite... recHitMu.size() "<<recHitMu.size()<<std::endl;
2978 firstTSOS.
surface(), &*magneticField_);
2985 std::vector<Trajectory> trajVec;
2986 if(direction ==
alongMomentum) trajVec = theFitter->fit(seedT, recHitMu, initialTSOS);
2987 else trajVec = theFitterOp->fit(seedT, recHitMu, initialTSOS);
2990 this->debugTrajectorySOSv(
" innermostTSOS of TransientTrack",
2992 this->debugTrajectorySOSv(
" outermostTSOS of TransientTrack",
2994 this->debugTrajectorySOS(
" initialTSOS for theFitter ", initialTSOS);
2995 std::cout<<
" . . . . . trajVec.size() "<<trajVec.size()<<std::endl;
2996 if(trajVec.size()) this->debugTrajectory(
" theFitter trajectory ", trajVec[0]);
3000 if(trajVec.size()) trackFittedTSOS = trajVec[0].lastMeasurement().updatedState();}
3002 std::vector<Trajectory> trajSVec;
3003 if (trajVec.size()){
3004 if(direction ==
alongMomentum) trajSVec = theSmoother->trajectories(*(trajVec.begin()));
3005 else trajSVec = theSmootherOp->trajectories(*(trajVec.begin()));
3007 if(info)
std::cout<<
" . . . . trajSVec.size() "<<trajSVec.size()<<std::endl;
3008 if(trajSVec.size()) this->debugTrajectorySOSv(
"smoothed geom InnermostState",
3009 trajSVec[0].geometricalInnermostState());
3010 if(trajSVec.size()) trackFittedTSOS = trajSVec[0].geometricalInnermostState();
3013 if(info) this->debugTrajectorySOSv(
" trackFittedTSOS ", trackFittedTSOS);
3024 bool smooth =
false;
3026 if(info)
std::cout<<
" ......... start of muonFitter ........"<<std::endl;
3028 this->debugTrackHit(
" Muon track hits ", alongTr);
3029 this->debugTrackHit(
" Muon TransientTrack hits ", alongTTr);
3033 DetId trackDetId =
DetId(alongTr->innerDetId());
3041 for(
unsigned int ihit = recHitAlong.
size()-1; ihit+1>0; ihit--){
3044 recHitAlong.
clear();
3047 std::cout<<
" ... Own recHit.size() DetId==Muon "<<recHit.
size()<<
" "<<trackDetId.
rawId()<<std::endl;
3052 std::cout<<
" ...along.... recHitMu.size() "<<recHitMu.size()<<std::endl;
3056 for(
unsigned int ihit = recHitMuAlong.size()-1; ihit+1>0; ihit--){
3057 recHitMu.push_back(recHitMuAlong[ihit]);
3059 recHitMuAlong.clear();
3062 std::cout<<
" ...opposite... recHitMu.size() "<<recHitMu.size()<<std::endl;
3075 firstTSOS.
surface(), &*magneticField_);
3082 std::vector<Trajectory> trajVec;
3083 if(direction ==
alongMomentum) trajVec = theFitter->fit(seedT, recHitMu, initialTSOS);
3084 else trajVec = theFitterOp->fit(seedT, recHitMu, initialTSOS);
3087 this->debugTrajectorySOSv(
" innermostTSOS of TransientTrack",
3089 this->debugTrajectorySOSv(
" outermostTSOS of TransientTrack",
3091 this->debugTrajectorySOS(
" initialTSOS for theFitter ", initialTSOS);
3092 std::cout<<
" . . . . . trajVec.size() "<<trajVec.size()<<std::endl;
3093 if(trajVec.size()) this->debugTrajectory(
" theFitter trajectory ", trajVec[0]);
3097 if(trajVec.size()) trackFittedTSOS = trajVec[0].lastMeasurement().updatedState();}
3099 std::vector<Trajectory> trajSVec;
3100 if (trajVec.size()){
3101 if(direction ==
alongMomentum) trajSVec = theSmoother->trajectories(*(trajVec.begin()));
3102 else trajSVec = theSmootherOp->trajectories(*(trajVec.begin()));
3104 if(info)
std::cout<<
" . . . . trajSVec.size() "<<trajSVec.size()<<std::endl;
3105 if(trajSVec.size()) this->debugTrajectorySOSv(
"smoothed geom InnermostState",
3106 trajSVec[0].geometricalInnermostState());
3107 if(trajSVec.size()) trackFittedTSOS = trajSVec[0].geometricalInnermostState();
3116 std::cout<<
" ------- "<<title<<
" --------"<<std::endl;
3120 std::cout<<
" Hit "<<nHit++<<
" DetId "<<(*i)->geographicalId().det();
3124 if(!(*i)->isValid())
std::cout<<
" not valid "<<std::endl;
3133 std::cout<<
" ------- "<<title<<
" --------"<<std::endl;
3137 std::cout<<
" Hit "<<nHit++<<
" DetId "<<(*i)->geographicalId().det();
3141 if(!(*i)->isValid())
std::cout<<
" not valid "<<std::endl;
3150 std::cout<<
" --- "<<title<<
" --- "<<std::endl;
3182 std::cout<<
" --- "<<title<<
" --- "<<std::endl;
3213 std::cout<<
"\n"<<
" ...... "<<title<<
" ...... "<<std::endl;
3214 if(!traj.
isValid()) {
std::cout<<
" Not valid !!!!!!!! "<<std::endl;
return;}
3217 else std::cout<<
" oppositeToMomentum <<<<"<<std::endl;
3222 std::cout<<
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . \n"<<std::endl;
3240 std::cout<<
" paramVector "<<paramVec.T()<<std::endl;
3242 CLHEP::Hep3Vector colX, colY, colZ;
3244 #ifdef NOT_EXACT_ROTATION_MATRIX
3245 colX = CLHEP::Hep3Vector( 1., -paramVec(6), paramVec(5));
3246 colY = CLHEP::Hep3Vector( paramVec(6), 1., -paramVec(4));
3247 colZ = CLHEP::Hep3Vector(-paramVec(5), paramVec(4), 1.);
3252 colX = CLHEP::Hep3Vector( c2 * c3, -c2 * s3, s2);
3253 colY = CLHEP::Hep3Vector(
c1 * s3 + s1 * s2 * c3,
c1 * c3 - s1 * s2 * s3, -s1 * c2);
3254 colZ = CLHEP::Hep3Vector(s1 * s3 -
c1 * s2 * c3, s1 * c3 +
c1 * s2 * s3,
c1 * c2);
3257 CLHEP::HepVector param0(6,0);
3263 iteratorTrackerRcd->rotation(),
3266 CLHEP::Hep3Vector posMuGlRcd = iteratorMuonRcd->translation();
3267 CLHEP::HepRotation rotMuGlRcd = iteratorMuonRcd->rotation();
3268 CLHEP::HepEulerAngles angMuGlRcd = iteratorMuonRcd->rotation().eulerAngles();
3270 std::cout<<
" Old muon Rcd Euler angles "<<angMuGlRcd.phi()<<
" "<<angMuGlRcd.theta()
3271 <<
" "<<angMuGlRcd.psi()<<std::endl;
3273 if((angMuGlRcd.phi() == 0.) && (angMuGlRcd.theta() == 0.) && (angMuGlRcd.psi() == 0.) &&
3274 (posMuGlRcd.x() == 0.) && (posMuGlRcd.y() == 0.) && (posMuGlRcd.z() == 0.)){
3275 std::cout<<
" New muon parameters are stored in Rcd"<<std::endl;
3286 else if((paramVec(1) == 0.) && (paramVec(2) == 0.) && (paramVec(3) == 0.) &&
3287 (paramVec(4) == 0.) && (paramVec(5) == 0.) && (paramVec(6) == 0.)){
3288 std::cout<<
" Old muon parameters are stored in Rcd"<<std::endl;
3291 iteratorMuonRcd->rotation(),
3296 std::cout<<
" New + Old muon parameters are stored in Rcd"<<std::endl;
3297 CLHEP::Hep3Vector posMuGlRcdThis = CLHEP::Hep3Vector(paramVec(1), paramVec(2), paramVec(3));
3298 CLHEP::HepRotation rotMuGlRcdThis = CLHEP::HepRotation(colX, colY, colZ);
3299 CLHEP::Hep3Vector posMuGlRcdNew = rotMuGlRcdThis * posMuGlRcd + posMuGlRcdThis;
3300 CLHEP::HepRotation rotMuGlRcdNew = rotMuGlRcdThis * rotMuGlRcd;
3310 iteratorEcalRcd->rotation(),
3314 iteratorHcalRcd->rotation(),
3326 <<
" " <<
tracker.rotation().eulerAngles() << std::endl;
3330 <<
" " << muon.
rotation().eulerAngles() << std::endl;
3331 std::cout <<
" rotations angles around x,y,z "
3333 <<
" " << -muon.
rotation().yx() <<
" )" << std::endl;
3337 <<
" " <<
ecal.rotation().eulerAngles() << std::endl;
3341 <<
" " <<
hcal.rotation().eulerAngles() << std::endl;
3344 std::cout <<
"Calo (" << calo.rawId() <<
") at " << calo.translation()
3345 <<
" " << calo.rotation().eulerAngles() << std::endl;
3346 std::cout << calo.rotation() << std::endl;
3349 globalPositions->
m_align.push_back(muon);
3352 globalPositions->
m_align.push_back(calo);
3354 std::cout <<
"Uploading to the database..." << std::endl;
3359 throw cms::Exception(
"NotAvailable") <<
"PoolDBOutputService not available";
3369 "GlobalPositionRcd");
const GlobalTrackingGeometry * trackingGeometry_
double CLHEP_dot(const CLHEP::HepVector &a, const CLHEP::HepVector &b)
edm::ESWatcher< GlobalPositionRcd > watchGlobalPositionRcd_
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
void debugTrajectorySOSv(const std::string, TrajectoryStateOnSurface)
KFTrajectorySmoother * theSmootherOp
void gradientGlobalAlg(GlobalVector &, GlobalVector &, GlobalVector &, GlobalVector &, AlgebraicSymMatrix66 &)
void gradientLocal(GlobalVector &, GlobalVector &, GlobalVector &, GlobalVector &, GlobalVector &, CLHEP::HepSymMatrix &, CLHEP::HepMatrix &, CLHEP::HepVector &, AlgebraicVector4 &)
TrackCharge charge() const
virtual ConstReferenceCountingPointer< TangentPlane > tangentPlane(const GlobalPoint &) const =0
const LocalTrajectoryParameters & localParameters() const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
#define DEFINE_FWK_MODULE(type)
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
GlobalVector normalVector() const
Sin< T >::type sin(const T &t)
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
KFTrajectoryFitter * theFitter
const CartesianTrajectoryError cartesianError() const
CLHEP::HepVector MuGlAngle
void misalignMuon(GlobalVector &, GlobalVector &, GlobalVector &, GlobalVector &, GlobalVector &, GlobalVector &)
int bunchCrossing() const
std::vector< AlignTransform >::const_iterator iteratorHcalRcd
std::vector< ConstRecHitPointer > RecHitContainer
GlobalPoint globalPosition() const
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
void gradientGlobal(GlobalVector &, GlobalVector &, GlobalVector &, GlobalVector &, GlobalVector &, AlgebraicSymMatrix66 &)
std::vector< AlignTransform > m_align
ROOT::Math::SVector< double, 6 > AlgebraicVector6
TrajectoryStateOnSurface innermostMeasurementState() const
PropagationDirection const & direction() const
uint32_t rawId() const
get the raw id
T x() const
Cartesian x coordinate.
AlgebraicVector5 vector() const
const SurfaceType & surface() const
virtual void beginJob() override
void debugTrackHit(const std::string, reco::TrackRef)
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
tuple SteppingHelixPropagator
edm::ESWatcher< GlobalTrackingGeometryRecord > watchTrackingGeometry_
TrajectoryMeasurement const & lastMeasurement() const
FreeTrajectoryState const * freeState(bool withErrors=true) const
Cos< T >::type cos(const T &t)
KFTrajectoryFitter * theFitterOp
ROOT::Math::SVector< double, 3 > AlgebraicVector3
std::vector< AlignTransform >::const_iterator iteratorMuonRcd
void analyzeTrackTrajectory(const edm::Event &, const edm::EventSetup &)
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
const AlgebraicSymMatrix55 & matrix() const
const MagneticField * magneticField_
const LocalTrajectoryError & localError() const
TrajectoryStateOnSurface outermostMeasurementState() const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
trackingRecHit_iterator recHitsEnd() const
last iterator to RecHits
const AlgebraicSymMatrix66 & matrix() const
void misalignMuonL(GlobalVector &, GlobalVector &, GlobalVector &, GlobalVector &, GlobalVector &, GlobalVector &, AlgebraicVector4 &, TrajectoryStateOnSurface &, TrajectoryStateOnSurface &)
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
GlobalTrackerMuonAlignment(const edm::ParameterSet &)
void writeGlPosRcd(CLHEP::HepVector &d3)
tuple GlobalTrackerMuonAlignment
std::vector< AlignTransform >::const_iterator iteratorEcalRcd
TrajectoryMeasurement const & firstMeasurement() const
void trackFitter(reco::TrackRef, reco::TransientTrack &, PropagationDirection, TrajectoryStateOnSurface &)
~GlobalTrackerMuonAlignment()
KFTrajectorySmoother * theSmoother
ROOT::Math::SVector< double, 5 > AlgebraicVector5
const GlobalTrajectoryParameters & globalParameters() const
const Alignments * globalPositionRcd_
virtual void endJob() override
const TransientTrackingRecHitBuilder * TTRHBuilder
edm::ESWatcher< IdealMagneticFieldRecord > watchMagneticFieldRecord_
GlobalVector globalMomentum() const
void debugTrajectory(const std::string, Trajectory &)
cond::Time_t currentTime() const
const RotationType & rotation() const
std::vector< AlignTransform >::const_iterator iteratorTrackerRcd
TrajectoryStateOnSurface const & updatedState() const
float pzSign() const
Sign of the z-component of the momentum in the local frame.
ROOT::Math::SVector< double, 4 > AlgebraicVector4
edm::ESWatcher< TrackingComponentsRecord > watchTrackingComponentsRecord_
const PositionType & position() const
void analyzeTrackTrack(const edm::Event &, const edm::EventSetup &)
trackingRecHit_iterator recHitsBegin() const
first iterator to RecHits
AlgebraicVector6 vector() const
void muonFitter(reco::TrackRef, reco::TransientTrack &, PropagationDirection, TrajectoryStateOnSurface &)
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepStd< double, 3, 3 > > AlgebraicMatrix33
MuonTransientTrackingRecHitBuilder * MuRHBuilder
Global3DVector GlobalVector
CLHEP::HepVector MuGlShift
tuple Chi2MeasurementEstimator
void debugTrajectorySOS(const std::string, TrajectoryStateOnSurface &)