From 233abdec44ee94ce9036e6b731235593aa82e0bc Mon Sep 17 00:00:00 2001 From: Sunanda Date: Mon, 24 Oct 2022 06:01:00 +0200 Subject: [PATCH] Use tokens rather than labels in accessing collections in Alignment/CommonAlignmentProducer Code check Make changes as suggested Code check --- .../AlignmentMuonHIPTrajectorySelector.cc | 31 +- .../plugins/GlobalTrackerMuonAlignment.cc | 1294 +++++++++-------- .../python/GlobalTrackerMuonAlignment_cfi.py | 12 - .../GlobalTrackerMuonAlignment_test_cfg.py | 41 +- 4 files changed, 733 insertions(+), 645 deletions(-) delete mode 100644 Alignment/CommonAlignmentProducer/python/GlobalTrackerMuonAlignment_cfi.py diff --git a/Alignment/CommonAlignmentProducer/plugins/AlignmentMuonHIPTrajectorySelector.cc b/Alignment/CommonAlignmentProducer/plugins/AlignmentMuonHIPTrajectorySelector.cc index 60298e34112bf..5e1cb6c4e3616 100644 --- a/Alignment/CommonAlignmentProducer/plugins/AlignmentMuonHIPTrajectorySelector.cc +++ b/Alignment/CommonAlignmentProducer/plugins/AlignmentMuonHIPTrajectorySelector.cc @@ -28,6 +28,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -54,19 +55,22 @@ class AlignmentMuonHIPTrajectorySelector : public edm::stream::EDProducer<> { public: explicit AlignmentMuonHIPTrajectorySelector(const edm::ParameterSet&); - ~AlignmentMuonHIPTrajectorySelector() override; + ~AlignmentMuonHIPTrajectorySelector() override = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: void produce(edm::Event&, const edm::EventSetup&) override; // ---------- member data -------------------------------- - edm::InputTag m_input; - double m_minPt; - double m_maxTrackerForwardRedChi2; - int m_minTrackerDOF; - double m_maxMuonResidual; - - bool m_hists; + const edm::InputTag m_input; + const double m_minPt; + const double m_maxTrackerForwardRedChi2; + const int m_minTrackerDOF; + const double m_maxMuonResidual; + + const bool m_hists; + const edm::EDGetTokenT mapToken_; TH1F *m_pt, *m_tracker_forwardredchi2, *m_tracker_dof; TH1F *m_resid_before, *m_resid_after; }; @@ -89,6 +93,7 @@ AlignmentMuonHIPTrajectorySelector::AlignmentMuonHIPTrajectorySelector(const edm m_minTrackerDOF(iConfig.getParameter("minTrackerDOF")), m_maxMuonResidual(iConfig.getParameter("maxMuonResidual")), m_hists(iConfig.getParameter("hists")), + mapToken_(consumes(m_input)), m_pt(nullptr), m_tracker_forwardredchi2(nullptr), m_tracker_dof(nullptr) { @@ -105,17 +110,19 @@ AlignmentMuonHIPTrajectorySelector::AlignmentMuonHIPTrajectorySelector(const edm } } -AlignmentMuonHIPTrajectorySelector::~AlignmentMuonHIPTrajectorySelector() {} - // // member functions // +void AlignmentMuonHIPTrajectorySelector::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setUnknown(); + descriptions.addDefault(desc); +} // ------------ method called to produce the data ------------ void AlignmentMuonHIPTrajectorySelector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { // input - edm::Handle originalTrajTrackMap; - iEvent.getByLabel(m_input, originalTrajTrackMap); + const edm::Handle& originalTrajTrackMap = iEvent.getHandle(mapToken_); // output auto newTrajTrackMap = std::make_unique(); diff --git a/Alignment/CommonAlignmentProducer/plugins/GlobalTrackerMuonAlignment.cc b/Alignment/CommonAlignmentProducer/plugins/GlobalTrackerMuonAlignment.cc index e5fada252c6bb..0bd1fc4e2ecbb 100644 --- a/Alignment/CommonAlignmentProducer/plugins/GlobalTrackerMuonAlignment.cc +++ b/Alignment/CommonAlignmentProducer/plugins/GlobalTrackerMuonAlignment.cc @@ -39,6 +39,7 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ServiceRegistry/interface/Service.h" //#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" @@ -108,7 +109,8 @@ using namespace reco; class GlobalTrackerMuonAlignment : public edm::one::EDAnalyzer<> { public: explicit GlobalTrackerMuonAlignment(const edm::ParameterSet&); - ~GlobalTrackerMuonAlignment() override; + ~GlobalTrackerMuonAlignment() override = default; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); void analyzeTrackTrack(const edm::Event&, const edm::EventSetup&); void analyzeTrackTrajectory(const edm::Event&, const edm::EventSetup&); @@ -154,27 +156,40 @@ class GlobalTrackerMuonAlignment : public edm::one::EDAnalyzer<> { void endJob() override; // ----------member data --------------------------- - edm::ESGetToken m_TkGeometryToken; - edm::ESGetToken m_MagFieldToken; - edm::ESGetToken m_globalPosToken; - edm::ESGetToken m_propToken; - edm::ESGetToken m_ttrhBuilderToken; - - edm::InputTag trackTags_; // used to select what tracks to read from configuration file - edm::InputTag muonTags_; // used to select what standalone muons - edm::InputTag gmuonTags_; // used to select what global muons - edm::InputTag smuonTags_; // used to select what selected muons - string propagator_; // name of the propagator + const edm::ESGetToken m_TkGeometryToken; + const edm::ESGetToken m_MagFieldToken; + const edm::ESGetToken m_globalPosToken; + const edm::ESGetToken m_propToken; + const edm::ESGetToken m_ttrhBuilderToken; + + const edm::InputTag trackTags_; // used to select what tracks to read from configuration file + const edm::InputTag muonTags_; // used to select what standalone muons + const edm::InputTag gmuonTags_; // used to select what global muons + const edm::InputTag smuonTags_; // used to select what selected muons + const std::string propagator_; // name of the propagator bool cosmicMuonMode_; bool isolatedMuonMode_; bool collectionCosmic; // if true, read muon collection expected for CosmicMu bool collectionIsolated; // IsolateMu bool refitMuon_; // if true, refit stand alone muon track bool refitTrack_; // tracker track - string rootOutFile_; - string txtOutFile_; - bool writeDB_; // write results to DB - bool debug_; // run in debugging mode + const std::string rootOutFile_; + const std::string txtOutFile_; + const bool writeDB_; // write results to DB + const bool debug_; // run in debugging mode + + const edm::EDGetTokenT trackIsolateToken_; + const edm::EDGetTokenT muonIsolateToken_; + const edm::EDGetTokenT gmuonIsolateToken_; + const edm::EDGetTokenT smuonIsolateToken_; + const edm::EDGetTokenT trackCosmicToken_; + const edm::EDGetTokenT muonCosmicToken_; + const edm::EDGetTokenT gmuonCosmicToken_; + const edm::EDGetTokenT smuonCosmicToken_; + const edm::EDGetTokenT trackToken_; + const edm::EDGetTokenT muonToken_; + const edm::EDGetTokenT gmuonToken_; + const edm::EDGetTokenT smuonToken_; edm::ESWatcher watchTrackingGeometry_; edm::ESHandle theTrackingGeometry; @@ -291,6 +306,22 @@ GlobalTrackerMuonAlignment::GlobalTrackerMuonAlignment(const edm::ParameterSet& txtOutFile_(iConfig.getUntrackedParameter("txtOutFile")), writeDB_(iConfig.getUntrackedParameter("writeDB")), debug_(iConfig.getUntrackedParameter("debug")), + trackIsolateToken_(consumes(edm::InputTag("ALCARECOMuAlCalIsolatedMu", "TrackerOnly"))), + muonIsolateToken_(consumes(edm::InputTag("ALCARECOMuAlCalIsolatedMu", "StandAlone"))), + gmuonIsolateToken_(consumes(edm::InputTag("ALCARECOMuAlCalIsolatedMu", "GlobalMuon"))), + smuonIsolateToken_(consumes(edm::InputTag("ALCARECOMuAlCalIsolatedMu", "SelectedMuons"))), + trackCosmicToken_( + consumes(edm::InputTag("ALCARECOMuAlCOMMuGlobalCosmicsMu", "TrackerOnly"))), + muonCosmicToken_( + consumes(edm::InputTag("ALCARECOMuAlCOMMuGlobalCosmicsMu", "StandAlone"))), + gmuonCosmicToken_( + consumes(edm::InputTag("ALCARECOMuAlCOMMuGlobalCosmicsMu", "GlobalMuon"))), + smuonCosmicToken_( + consumes(edm::InputTag("ALCARECOMuAlCOMMuGlobalCosmicsMu", "SelectedMuons"))), + trackToken_(consumes(trackTags_)), + muonToken_(consumes(muonTags_)), + gmuonToken_(consumes(gmuonTags_)), + smuonToken_(consumes(smuonTags_)), defineFitter(true) { #ifdef NO_FALSE_FALSE_MODE if (cosmicMuonMode_ == false && isolatedMuonMode_ == false) { @@ -304,11 +335,23 @@ GlobalTrackerMuonAlignment::GlobalTrackerMuonAlignment(const edm::ParameterSet& } } -GlobalTrackerMuonAlignment::~GlobalTrackerMuonAlignment() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) +void GlobalTrackerMuonAlignment::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("propagator", "SteppingHelixPropagator"); + desc.add("tracks", edm::InputTag("ALCARECOMuAlGlobalCosmics:TrackerOnly")); + desc.add("muons", edm::InputTag("ALCARECOMuAlGlobalCosmics:StandAlone")); + desc.add("gmuons", edm::InputTag("ALCARECOMuAlGlobalCosmics:GlobalMuon")); + desc.add("smuons", edm::InputTag("ALCARECOMuAlGlobalCosmics:SelectedMuons")); + desc.add("isolated", false); + desc.add("cosmics", false); + desc.add("refitmuon", false); + desc.add("refittrack", false); + desc.addUntracked("rootOutFile", "outfile.root"); + desc.addUntracked("txtOutFile", "outglobal.txt"); + desc.addUntracked("writeDB", false); + desc.addUntracked("debug", false); + descriptions.add("globalTrackerMuonAlignment", desc); } - // // member functions // @@ -380,7 +423,7 @@ void GlobalTrackerMuonAlignment::endJob() { bool ierr = !InfI.Invert(); if (ierr) { if (alarm) - std::cout << " Error inverse Inf matrix !!!!!!!!!!!" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Error inverse Inf matrix !!!!!!!!!!!"; } for (int i = 0; i <= 2; i++) @@ -394,7 +437,7 @@ void GlobalTrackerMuonAlignment::endJob() { CLHEP::HepMatrix Errd3 = Hess.inverse(iEr3); if (iEr3 != 0) { if (alarm) - std::cout << " endJob Error inverse Hess matrix !!!!!!!!!!!" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " endJob Error inverse Hess matrix !!!!!!!!!!!"; } // end of Global CLHEP @@ -404,41 +447,46 @@ void GlobalTrackerMuonAlignment::endJob() { CLHEP::HepMatrix ErrdLI = HessL.inverse(iErI); if (iErI != 0) { if (alarm) - std::cout << " endJob Error inverse HessL matrix !!!!!!!!!!!" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " endJob Error inverse HessL matrix !!!!!!!!!!!"; } // end of Local CLHEP // printout of final parameters - std::cout << " ---- " << N_event << " event " << N_track << " tracks " << MuSelect << " ---- " << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " ---- " << N_event << " event " << N_track << " tracks " << MuSelect << " ---- "; if (collectionIsolated) - std::cout << " ALCARECOMuAlCalIsolatedMu " << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " ALCARECOMuAlCalIsolatedMu"; else if (collectionCosmic) - std::cout << " ALCARECOMuAlGlobalCosmics " << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " ALCARECOMuAlGlobalCosmics"; else - std::cout << smuonTags_ << std::endl; - std::cout << " Similated shifts[cm] " << MuGlShift(1) << " " << MuGlShift(2) << " " << MuGlShift(3) << " " - << " angles[rad] " << MuGlAngle(1) << " " << MuGlAngle(2) << " " << MuGlAngle(3) << " " << std::endl; - std::cout << " d " << -d << std::endl; - ; - std::cout << " +- " << sqrt(InfI(0, 0)) << " " << sqrt(InfI(1, 1)) << " " << sqrt(InfI(2, 2)) << std::endl; - std::cout << " dG " << d3(1) << " " << d3(2) << " " << d3(3) << " " << d3(4) << " " << d3(5) << " " << d3(6) - << std::endl; - ; - std::cout << " +- " << sqrt(Errd3(1, 1)) << " " << sqrt(Errd3(2, 2)) << " " << sqrt(Errd3(3, 3)) << " " - << sqrt(Errd3(4, 4)) << " " << sqrt(Errd3(5, 5)) << " " << sqrt(Errd3(6, 6)) << std::endl; - std::cout << " dL " << dLI(1) << " " << dLI(2) << " " << dLI(3) << " " << dLI(4) << " " << dLI(5) << " " << dLI(6) - << std::endl; - ; - std::cout << " +- " << sqrt(ErrdLI(1, 1)) << " " << sqrt(ErrdLI(2, 2)) << " " << sqrt(ErrdLI(3, 3)) << " " - << sqrt(ErrdLI(4, 4)) << " " << sqrt(ErrdLI(5, 5)) << " " << sqrt(ErrdLI(6, 6)) << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << smuonTags_; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " Similated shifts[cm] " << MuGlShift(1) << " " << MuGlShift(2) << " " << MuGlShift(3) << " " + << " angles[rad] " << MuGlAngle(1) << " " << MuGlAngle(2) << " " << MuGlAngle(3) << " "; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " d " << -d; + + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " +- " << std::sqrt(InfI(0, 0)) << " " << std::sqrt(InfI(1, 1)) << " " << std::sqrt(InfI(2, 2)); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " dG " << d3(1) << " " << d3(2) << " " << d3(3) << " " << d3(4) << " " << d3(5) << " " << d3(6); + + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " +- " << std::sqrt(Errd3(1, 1)) << " " << std::sqrt(Errd3(2, 2)) << " " << std::sqrt(Errd3(3, 3)) << " " + << std::sqrt(Errd3(4, 4)) << " " << std::sqrt(Errd3(5, 5)) << " " << std::sqrt(Errd3(6, 6)); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " dL " << dLI(1) << " " << dLI(2) << " " << dLI(3) << " " << dLI(4) << " " << dLI(5) << " " << dLI(6); + + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " +- " << std::sqrt(ErrdLI(1, 1)) << " " << std::sqrt(ErrdLI(2, 2)) << " " << std::sqrt(ErrdLI(3, 3)) << " " + << std::sqrt(ErrdLI(4, 4)) << " " << std::sqrt(ErrdLI(5, 5)) << " " << std::sqrt(ErrdLI(6, 6)); // what do we write to DB CLHEP::HepVector vectorToDb(6, 0), vectorErrToDb(6, 0); //vectorToDb = d3; - //for(unsigned int i=1; i<=6; i++) vectorErrToDb(i) = sqrt(Errd3(i,i)); + //for(unsigned int i=1; i<=6; i++) vectorErrToDb(i) = std::sqrt(Errd3(i,i)); vectorToDb = -dLI; for (unsigned int i = 1; i <= 6; i++) - vectorErrToDb(i) = sqrt(ErrdLI(i, i)); + vectorErrToDb(i) = std::sqrt(ErrdLI(i, i)); // write histograms to root file file->Write(); @@ -447,7 +495,7 @@ void GlobalTrackerMuonAlignment::endJob() { // write global parameters to text file OutGlobalTxt.open(txtOutFile_.c_str(), ios::out); if (!OutGlobalTxt.is_open()) - std::cout << " outglobal.txt is not open !!!!!" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " outglobal.txt is not open !!!!!"; else { OutGlobalTxt << vectorToDb(1) << " " << vectorToDb(2) << " " << vectorToDb(3) << " " << vectorToDb(4) << " " << vectorToDb(5) << " " << vectorToDb(6) << " muon Global.\n"; @@ -462,12 +510,12 @@ void GlobalTrackerMuonAlignment::endJob() { else OutGlobalTxt << smuonTags_ << ".\n"; OutGlobalTxt.close(); - std::cout << " Write to the file outglobal.txt done " << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Write to the file outglobal.txt done "; } // write new GlobalPositionRcd to DB if (debug_) - std::cout << " writeBD_ " << writeDB_ << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " writeBD_ " << writeDB_; if (writeDB_) GlobalTrackerMuonAlignment::writeGlPosRcd(vectorToDb); } @@ -592,43 +640,38 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack(const edm::Event& iEvent, con N_event++; if (info || debug_) { - std::cout << "----- event " << N_event << " -- tracks " << N_track << " ---"; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << "----- event " << N_event << " -- tracks " << N_track << " ---"; if (cosmicMuonMode_) - std::cout << " treated as CosmicMu "; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " treated as CosmicMu "; if (isolatedMuonMode_) - std::cout << " treated as IsolatedMu "; - std::cout << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " treated as IsolatedMu "; + edm::LogVerbatim("GlobalTrackerMuonAlignment"); } - Handle tracks; - Handle muons; - Handle gmuons; - Handle smuons; - - if (collectionIsolated) { - iEvent.getByLabel("ALCARECOMuAlCalIsolatedMu", "TrackerOnly", tracks); - iEvent.getByLabel("ALCARECOMuAlCalIsolatedMu", "StandAlone", muons); - iEvent.getByLabel("ALCARECOMuAlCalIsolatedMu", "GlobalMuon", gmuons); - iEvent.getByLabel("ALCARECOMuAlCalIsolatedMu", "SelectedMuons", smuons); - } else if (collectionCosmic) { - iEvent.getByLabel("ALCARECOMuAlGlobalCosmics", "TrackerOnly", tracks); - iEvent.getByLabel("ALCARECOMuAlGlobalCosmics", "StandAlone", muons); - iEvent.getByLabel("ALCARECOMuAlGlobalCosmics", "GlobalMuon", gmuons); - iEvent.getByLabel("ALCARECOMuAlGlobalCosmics", "SelectedMuons", smuons); - } else { - iEvent.getByLabel(trackTags_, tracks); - iEvent.getByLabel(muonTags_, muons); - iEvent.getByLabel(gmuonTags_, gmuons); - iEvent.getByLabel(smuonTags_, smuons); - } + const edm::Handle& tracks = + ((collectionIsolated) + ? iEvent.getHandle(trackIsolateToken_) + : ((collectionCosmic) ? iEvent.getHandle(trackCosmicToken_) : iEvent.getHandle(trackToken_))); + const edm::Handle& muons = + ((collectionIsolated) ? iEvent.getHandle(muonIsolateToken_) + : ((collectionCosmic) ? iEvent.getHandle(muonCosmicToken_) : iEvent.getHandle(muonToken_))); + const edm::Handle& gmuons = + ((collectionIsolated) + ? iEvent.getHandle(gmuonIsolateToken_) + : ((collectionCosmic) ? iEvent.getHandle(gmuonCosmicToken_) : iEvent.getHandle(gmuonToken_))); + const edm::Handle& smuons = + ((collectionIsolated) + ? iEvent.getHandle(smuonIsolateToken_) + : ((collectionCosmic) ? iEvent.getHandle(smuonCosmicToken_) : iEvent.getHandle(smuonToken_))); if (debug_) { - std::cout << " ievBunch " << iEvent.bunchCrossing() << " runN " << (int)iEvent.run() << std::endl; - std::cout << " N tracks s/amu gmu selmu " << tracks->size() << " " << muons->size() << " " << gmuons->size() << " " - << smuons->size() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " ievBunch " << iEvent.bunchCrossing() << " runN " << (int)iEvent.run(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " N tracks s/amu gmu selmu " << tracks->size() << " " + << muons->size() << " " << gmuons->size() << " " << smuons->size(); for (MuonCollection::const_iterator itMuon = smuons->begin(); itMuon != smuons->end(); ++itMuon) { - std::cout << " is isolatValid Matches " << itMuon->isIsolationValid() << " " << itMuon->isMatchesValid() - << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " is isolatValid Matches " << itMuon->isIsolationValid() << " " << itMuon->isMatchesValid(); } } @@ -690,10 +733,10 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack(const edm::Event& iEvent, con iteratorHcalRcd = i; } if (true || debug_) { - std::cout << "=== iteratorMuonRcd " << iteratorMuonRcd->rawId() << " ====\n" - << " translation " << iteratorMuonRcd->translation() << "\n" - << " angles " << iteratorMuonRcd->rotation().eulerAngles() << std::endl; - std::cout << iteratorMuonRcd->rotation() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << "=== iteratorMuonRcd " << iteratorMuonRcd->rawId() << " ====\n" + << " translation " << iteratorMuonRcd->translation() << "\n" + << " angles " << iteratorMuonRcd->rotation().eulerAngles(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << iteratorMuonRcd->rotation(); } } // end of GlobalPositionRcd @@ -717,8 +760,9 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack(const edm::Event& iEvent, con //itMuon --> Jim's globalMuon for (MuonCollection::const_iterator itMuon = smuons->begin(); itMuon != smuons->end(); ++itMuon) { if (debug_) { - std::cout << " mu gM is GM Mu SaM tM " << itMuon->isGlobalMuon() << " " << itMuon->isMuon() << " " - << itMuon->isStandAloneMuon() << " " << itMuon->isTrackerMuon() << " " << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " mu gM is GM Mu SaM tM " << itMuon->isGlobalMuon() << " " << itMuon->isMuon() << " " + << itMuon->isStandAloneMuon() << " " << itMuon->isTrackerMuon() << " "; } // get information about the innermost muon hit ------------------------- @@ -745,13 +789,14 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack(const edm::Event& iEvent, con float distanceOutOut = (pointTrackOut - pointMuonOut).mag(); if (debug_) { - std::cout << " pointTrackIn " << pointTrackIn << std::endl; - std::cout << " Out " << pointTrackOut << " lenght " << lenghtTrack << std::endl; - std::cout << " point MuonIn " << pointMuonIn << std::endl; - std::cout << " Out " << pointMuonOut << " lenght " << lenghtMuon << std::endl; - std::cout << " momeTrackIn Out " << momentumTrackIn << " " << momentumTrackOut << std::endl; - std::cout << " doi io ii oo " << distanceOutIn << " " << distanceInOut << " " << distanceInIn << " " - << distanceOutOut << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " pointTrackIn " << pointTrackIn; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Out " << pointTrackOut << " lenght " << lenghtTrack; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " point MuonIn " << pointMuonIn; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Out " << pointMuonOut << " lenght " << lenghtMuon; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " momeTrackIn Out " << momentumTrackIn << " " << momentumTrackOut; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " doi io ii oo " << distanceOutIn << " " << distanceInOut << " " << distanceInIn << " " << distanceOutOut; } if (lenghtTrack < 90.) @@ -764,7 +809,7 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack(const edm::Event& iEvent, con continue; if (debug_) - std::cout << " passed lenght momentum cuts" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " passed lenght momentum cuts"; GlobalVector GRm, GPm, Nl, Rm, Pm, Rt, Pt, Rt0; AlgebraicSymMatrix66 Cm, C0, Ce, C1; @@ -783,13 +828,13 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack(const edm::Event& iEvent, con GlobalVector Nlp = refPlane->normalVector(); if (debug_) { - std::cout << " Nlocal " << Nl.x() << " " << Nl.y() << " " << Nl.z() << " " - << " alfa " << int(asin(Nl.x()) * 57.29578) << std::endl; - std::cout << " global " << Ng.x() << " " << Ng.y() << " " << Ng.z() << std::endl; - std::cout << " lp " << Nlp.x() << " " << Nlp.y() << " " << Nlp.z() << std::endl; - //std::cout<<" Nlocal Nglobal "<(asin(Nl.x()) * 57.29578); } // extrapolation to innermost muon hit @@ -798,9 +843,9 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack(const edm::Event& iEvent, con if (!extrapolationT.isValid()) { if (false & alarm) - std::cout << " !!!!!!!!! Catastrophe Out-In extrapolationT.isValid " - //<<"\a\a\a\a\a\a\a\a"< tpMuGlobal(refSurface.tangentPlane(innerMuTSOS.globalPosition())); @@ -840,13 +885,13 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack(const edm::Event& iEvent, con if (!extrapolationT.isValid()) { if (false & alarm) - std::cout << " !!!!!!!!! Catastrophe Out-In extrapolationT.isValid " - //<<"\a\a\a\a\a\a\a\a"<propDir "<propagationDirection()<propDir " << propagator->propagationDirection(); PropagationDirectionChooser Chooser; - std::cout << " propDirCh " << Chooser.operator()(*outerTrackTSOS.freeState(), refSurface) << " Ch == along " - << (alongMomentum == Chooser.operator()(*outerTrackTSOS.freeState(), refSurface)) << std::endl; - std::cout << " --- Nlocal " << Nl.x() << " " << Nl.y() << " " << Nl.z() << " " - << " alfa " << int(asin(Nl.x()) * 57.29578) << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " propDirCh " << Chooser.operator()(*outerTrackTSOS.freeState(), refSurface) << " Ch == along " + << (alongMomentum == Chooser.operator()(*outerTrackTSOS.freeState(), refSurface)); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " --- Nlocal " << Nl.x() << " " << Nl.y() << " " << Nl.z() << " " + << " alfa " << int(asin(Nl.x()) * 57.29578); } } // enf of ---- Out - In ----- else if ((distanceInOut <= distanceInIn) & (distanceInOut <= distanceOutIn) & (distanceInOut <= distanceOutOut)) { // ----- In - Out ------ if (debug_) - std::cout << " ----- In - Out -----" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " ----- In - Out -----"; const Surface& refSurface = outerMuTSOS.surface(); ConstReferenceCountingPointer tpMuGlobal(refSurface.tangentPlane(outerMuTSOS.globalPosition())); @@ -890,12 +937,12 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack(const edm::Event& iEvent, con if (!extrapolationT.isValid()) { if (false & alarm) - std::cout << " !!!!!!!!! Catastrophe Out-In extrapolationT.isValid " - << "\a\a\a\a\a\a\a\a" << extrapolationT.isValid() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " !!!!!!!!! Catastrophe Out-In extrapolationT.isValid " + << "\a\a\a\a\a\a\a\a" << extrapolationT.isValid(); continue; } if (debug_) - std::cout << " extrapolationT.isValid " << extrapolationT.isValid() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " extrapolationT.isValid " << extrapolationT.isValid(); tsosMuonIf = 2; Rt = GlobalVector((extrapolationT.globalPosition()).x(), @@ -916,20 +963,21 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack(const edm::Event& iEvent, con C1 = AlgebraicSymMatrix66(outerMuTSOS.cartesianError().matrix()); if (false & debug_) { - //std::cout<<" ->propDir "<propagationDirection()<propDir " << propagator->propagationDirection(); PropagationDirectionChooser Chooser; - std::cout << " propDirCh " << Chooser.operator()(*innerTrackTSOS.freeState(), refSurface) - << " Ch == oppisite " - << (oppositeToMomentum == Chooser.operator()(*innerTrackTSOS.freeState(), refSurface)) << std::endl; - std::cout << " --- Nlocal " << Nl.x() << " " << Nl.y() << " " << Nl.z() << " " - << " alfa " << int(asin(Nl.x()) * 57.29578) << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " propDirCh " << Chooser.operator()(*innerTrackTSOS.freeState(), refSurface) << " Ch == oppisite " + << (oppositeToMomentum == Chooser.operator()(*innerTrackTSOS.freeState(), refSurface)); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " --- Nlocal " << Nl.x() << " " << Nl.y() << " " << Nl.z() << " " + << " alfa " << int(asin(Nl.x()) * 57.29578); } } // enf of ---- In - Out ----- else if ((distanceOutOut <= distanceInOut) & (distanceOutOut <= distanceInIn) & (distanceOutOut <= distanceOutIn)) { // ----- Out - Out ------ if (debug_) - std::cout << " ----- Out - Out -----" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " ----- Out - Out -----"; // reject: momentum of track has opposite direction to muon track continue; @@ -943,12 +991,12 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack(const edm::Event& iEvent, con if (!extrapolationT.isValid()) { if (alarm) - std::cout << " !!!!!!!!! Catastrophe Out-Out extrapolationT.isValid " - << "\a\a\a\a\a\a\a\a" << extrapolationT.isValid() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " !!!!!!!!! Catastrophe Out-Out extrapolationT.isValid " + << "\a\a\a\a\a\a\a\a" << extrapolationT.isValid(); continue; } if (debug_) - std::cout << " extrapolationT.isValid " << extrapolationT.isValid() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " extrapolationT.isValid " << extrapolationT.isValid(); tsosMuonIf = 2; Rt = GlobalVector((extrapolationT.globalPosition()).x(), @@ -970,17 +1018,21 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack(const edm::Event& iEvent, con if (debug_) { PropagationDirectionChooser Chooser; - std::cout << " propDirCh " << Chooser.operator()(*outerTrackTSOS.freeState(), refSurface) << " Ch == along " - << (alongMomentum == Chooser.operator()(*outerTrackTSOS.freeState(), refSurface)) << std::endl; - std::cout << " --- Nlocal " << Nl.x() << " " << Nl.y() << " " << Nl.z() << " " - << " alfa " << int(asin(Nl.x()) * 57.29578) << std::endl; - std::cout << " Nornal " << Nl.x() << " " << Nl.y() << " " << Nl.z() << " " - << " alfa " << int(asin(Nl.x()) * 57.29578) << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " propDirCh " << Chooser.operator()(*outerTrackTSOS.freeState(), refSurface) << " Ch == along " + << (alongMomentum == Chooser.operator()(*outerTrackTSOS.freeState(), refSurface)); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " --- Nlocal " << Nl.x() << " " << Nl.y() << " " << Nl.z() << " " + << " alfa " << int(asin(Nl.x()) * 57.29578); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " Nornal " << Nl.x() << " " << Nl.y() << " " << Nl.z() << " " + << " alfa " << int(asin(Nl.x()) * 57.29578); } } // enf of ---- Out - Out ----- else { if (alarm) - std::cout << " ------- !!!!!!!!!!!!!!! No proper Out - In \a\a\a\a\a\a\a" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " ------- !!!!!!!!!!!!!!! No proper Out - In \a\a\a\a\a\a\a"; continue; } @@ -988,7 +1040,7 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack(const edm::Event& iEvent, con if (tsosMuonIf == 0) { if (info) { - std::cout << "No tsosMuon !!!!!!" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << "No tsosMuon !!!!!!"; continue; } } @@ -1020,9 +1072,10 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack(const edm::Event& iEvent, con float alfa_x = atan2(Nl.x(), Nl.y()) * 57.29578; if (debug_) { - std::cout << " Nx Ny Nz alfa_x " << Nl.x() << " " << Nl.y() << " " << Nl.z() << " " << alfa_x << std::endl; - //std::cout<<" Rm "<Fill(resP.z()); if ((fabs(Nl.x()) < 0.98) && (fabs(Nl.y()) < 0.98) && (fabs(Nl.z()) < 0.98)) { - histo18->Fill(sqrt(C0(0, 0))); - histo19->Fill(sqrt(C1(0, 0))); - histo20->Fill(sqrt(C1(0, 0) + Ce(0, 0))); + histo18->Fill(std::sqrt(C0(0, 0))); + histo19->Fill(std::sqrt(C1(0, 0))); + histo20->Fill(std::sqrt(C1(0, 0) + Ce(0, 0))); } if (fabs(Nl.x()) < 0.98) - histo21->Fill(Vm(0) / sqrt(Cm(0, 0))); + histo21->Fill(Vm(0) / std::sqrt(Cm(0, 0))); if (fabs(Nl.y()) < 0.98) - histo22->Fill(Vm(1) / sqrt(Cm(1, 1))); + histo22->Fill(Vm(1) / std::sqrt(Cm(1, 1))); if (fabs(Nl.z()) < 0.98) - histo23->Fill(Vm(2) / sqrt(Cm(2, 2))); - histo24->Fill(Vm(3) / sqrt(C1(3, 3) + Ce(3, 3))); - histo25->Fill(Vm(4) / sqrt(C1(4, 4) + Ce(4, 4))); - histo26->Fill(Vm(5) / sqrt(C1(5, 5) + Ce(5, 5))); + histo23->Fill(Vm(2) / std::sqrt(Cm(2, 2))); + histo24->Fill(Vm(3) / std::sqrt(C1(3, 3) + Ce(3, 3))); + histo25->Fill(Vm(4) / std::sqrt(C1(4, 4) + Ce(4, 4))); + histo26->Fill(Vm(5) / std::sqrt(C1(5, 5) + Ce(5, 5))); histo27->Fill(Nl.x()); histo28->Fill(Nl.y()); histo29->Fill(lenghtTrack); histo30->Fill(lenghtMuon); histo31->Fill(chi_Loc); - histo32->Fill(Vml(1) / sqrt(Cml(1, 1))); - histo33->Fill(Vml(2) / sqrt(Cml(2, 2))); - histo34->Fill(Vml(3) / sqrt(Cml(3, 3))); - histo35->Fill(Vml(4) / sqrt(Cml(4, 4))); + histo32->Fill(Vml(1) / std::sqrt(Cml(1, 1))); + histo33->Fill(Vml(2) / std::sqrt(Cml(2, 2))); + histo34->Fill(Vml(3) / std::sqrt(Cml(3, 3))); + histo35->Fill(Vml(4) / std::sqrt(Cml(4, 4))); if (debug_) { //--------------------------------- debug print ---------- - std::cout << " diag 0[ " << C0(0, 0) << " " << C0(1, 1) << " " << C0(2, 2) << " " << C0(3, 3) << " " << C0(4, 4) - << " " << C0(5, 5) << " ]" << std::endl; - std::cout << " diag e[ " << Ce(0, 0) << " " << Ce(1, 1) << " " << Ce(2, 2) << " " << Ce(3, 3) << " " << Ce(4, 4) - << " " << Ce(5, 5) << " ]" << std::endl; - std::cout << " diag 1[ " << C1(0, 0) << " " << C1(1, 1) << " " << C1(2, 2) << " " << C1(3, 3) << " " << C1(4, 4) - << " " << C1(5, 5) << " ]" << std::endl; - std::cout << " Rm " << Rm.x() << " " << Rm.y() << " " << Rm.z() << " Pm " << Pm.x() << " " << Pm.y() << " " - << Pm.z() << std::endl; - std::cout << " Rt " << Rt.x() << " " << Rt.y() << " " << Rt.z() << " Pt " << Pt.x() << " " << Pt.y() << " " - << Pt.z() << std::endl; - std::cout << " Nl*(Rm-Rt) " << Nl.dot(Rm - Rt) << std::endl; - std::cout << " resR " << resR.x() << " " << resR.y() << " " << resR.z() << " resP " << resP.x() << " " << resP.y() - << " " << resP.z() << std::endl; - std::cout << " Rm-t " << (Rm - Rt).x() << " " << (Rm - Rt).y() << " " << (Rm - Rt).z() << " Pm-t " - << (Pm - Pt).x() << " " << (Pm - Pt).y() << " " << (Pm - Pt).z() << std::endl; - std::cout << " Vm " << Vm << std::endl; - std::cout << " +- " << sqrt(Cm(0, 0)) << " " << sqrt(Cm(1, 1)) << " " << sqrt(Cm(2, 2)) << " " << sqrt(Cm(3, 3)) - << " " << sqrt(Cm(4, 4)) << " " << sqrt(Cm(5, 5)) << std::endl; - std::cout << " Pmuon Ptrack dP/Ptrack " << itMuon->outerTrack()->p() << " " << itMuon->track()->outerP() << " " - << (itMuon->outerTrack()->p() - itMuon->track()->outerP()) / itMuon->track()->outerP() << std::endl; - std::cout << " cov matrix " << std::endl; - std::cout << Cm << std::endl; - std::cout << " diag [ " << Cm(0, 0) << " " << Cm(1, 1) << " " << Cm(2, 2) << " " << Cm(3, 3) << " " << Cm(4, 4) - << " " << Cm(5, 5) << " ]" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " diag 0[ " << C0(0, 0) << " " << C0(1, 1) << " " << C0(2, 2) + << " " << C0(3, 3) << " " << C0(4, 4) << " " << C0(5, 5) << " ]"; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " diag e[ " << Ce(0, 0) << " " << Ce(1, 1) << " " << Ce(2, 2) + << " " << Ce(3, 3) << " " << Ce(4, 4) << " " << Ce(5, 5) << " ]"; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " diag 1[ " << C1(0, 0) << " " << C1(1, 1) << " " << C1(2, 2) + << " " << C1(3, 3) << " " << C1(4, 4) << " " << C1(5, 5) << " ]"; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Rm " << Rm.x() << " " << Rm.y() << " " << Rm.z() << " Pm " + << Pm.x() << " " << Pm.y() << " " << Pm.z(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Rt " << Rt.x() << " " << Rt.y() << " " << Rt.z() << " Pt " + << Pt.x() << " " << Pt.y() << " " << Pt.z(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Nl*(Rm-Rt) " << Nl.dot(Rm - Rt); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " resR " << resR.x() << " " << resR.y() << " " << resR.z() + << " resP " << resP.x() << " " << resP.y() << " " << resP.z(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " Rm-t " << (Rm - Rt).x() << " " << (Rm - Rt).y() << " " << (Rm - Rt).z() << " Pm-t " << (Pm - Pt).x() + << " " << (Pm - Pt).y() << " " << (Pm - Pt).z(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Vm " << Vm; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " +- " << std::sqrt(Cm(0, 0)) << " " << std::sqrt(Cm(1, 1)) << " " << std::sqrt(Cm(2, 2)) << " " + << std::sqrt(Cm(3, 3)) << " " << std::sqrt(Cm(4, 4)) << " " << std::sqrt(Cm(5, 5)); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " Pmuon Ptrack dP/Ptrack " << itMuon->outerTrack()->p() << " " << itMuon->track()->outerP() << " " + << (itMuon->outerTrack()->p() - itMuon->track()->outerP()) / itMuon->track()->outerP(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " cov matrix "; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << Cm; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " diag [ " << Cm(0, 0) << " " << Cm(1, 1) << " " << Cm(2, 2) + << " " << Cm(3, 3) << " " << Cm(4, 4) << " " << Cm(5, 5) << " ]"; AlgebraicSymMatrix66 Ro; double Diag[6]; for (int i = 0; i <= 5; i++) - Diag[i] = sqrt(Cm(i, i)); + Diag[i] = std::sqrt(Cm(i, i)); for (int i = 0; i <= 5; i++) for (int j = 0; j <= 5; j++) Ro(i, j) = Cm(i, j) / Diag[i] / Diag[j]; - std::cout << " correlation matrix " << std::endl; - std::cout << Ro << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " correlation matrix "; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << Ro; AlgebraicSymMatrix66 CmI; for (int i = 0; i <= 5; i++) @@ -1235,14 +1292,14 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack(const edm::Event& iEvent, con bool ierr = !CmI.Invert(); if (ierr) { if (alarm || debug_) - std::cout << " Error inverse covariance matrix !!!!!!!!!!!" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Error inverse covariance matrix !!!!!!!!!!!"; continue; } - std::cout << " inverse cov matrix " << std::endl; - std::cout << Cm << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " inverse cov matrix "; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << Cm; double chi = ROOT::Math::Similarity(Vm, CmI); - std::cout << " chi chi_d " << chi << " " << chi_d << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " chi chi_d " << chi << " " << chi_d; } // end of debug_ printout -------------------------------------------- } // end loop on selected muons, i.e. Jim's globalMuon @@ -1267,43 +1324,38 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent N_event++; if (info || debug_) { - std::cout << "----- event " << N_event << " -- tracks " << N_track << " ---"; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << "----- event " << N_event << " -- tracks " << N_track << " ---"; if (cosmicMuonMode_) - std::cout << " treated as CosmicMu "; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " treated as CosmicMu "; if (isolatedMuonMode_) - std::cout << " treated as IsolatedMu "; - std::cout << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " treated as IsolatedMu "; + edm::LogVerbatim("GlobalTrackerMuonAlignment"); } - Handle tracks; - Handle muons; - Handle gmuons; - Handle smuons; - - if (collectionIsolated) { - iEvent.getByLabel("ALCARECOMuAlCalIsolatedMu", "TrackerOnly", tracks); - iEvent.getByLabel("ALCARECOMuAlCalIsolatedMu", "StandAlone", muons); - iEvent.getByLabel("ALCARECOMuAlCalIsolatedMu", "GlobalMuon", gmuons); - iEvent.getByLabel("ALCARECOMuAlCalIsolatedMu", "SelectedMuons", smuons); - } else if (collectionCosmic) { - iEvent.getByLabel("ALCARECOMuAlGlobalCosmics", "TrackerOnly", tracks); - iEvent.getByLabel("ALCARECOMuAlGlobalCosmics", "StandAlone", muons); - iEvent.getByLabel("ALCARECOMuAlGlobalCosmics", "GlobalMuon", gmuons); - iEvent.getByLabel("ALCARECOMuAlGlobalCosmics", "SelectedMuons", smuons); - } else { - iEvent.getByLabel(trackTags_, tracks); - iEvent.getByLabel(muonTags_, muons); - iEvent.getByLabel(gmuonTags_, gmuons); - iEvent.getByLabel(smuonTags_, smuons); - } + const edm::Handle& tracks = + ((collectionIsolated) + ? iEvent.getHandle(trackIsolateToken_) + : ((collectionCosmic) ? iEvent.getHandle(trackCosmicToken_) : iEvent.getHandle(trackToken_))); + const edm::Handle& muons = + ((collectionIsolated) ? iEvent.getHandle(muonIsolateToken_) + : ((collectionCosmic) ? iEvent.getHandle(muonCosmicToken_) : iEvent.getHandle(muonToken_))); + const edm::Handle& gmuons = + ((collectionIsolated) + ? iEvent.getHandle(gmuonIsolateToken_) + : ((collectionCosmic) ? iEvent.getHandle(gmuonCosmicToken_) : iEvent.getHandle(gmuonToken_))); + const edm::Handle& smuons = + ((collectionIsolated) + ? iEvent.getHandle(smuonIsolateToken_) + : ((collectionCosmic) ? iEvent.getHandle(smuonCosmicToken_) : iEvent.getHandle(smuonToken_))); if (debug_) { - std::cout << " ievBunch " << iEvent.bunchCrossing() << " runN " << (int)iEvent.run() << std::endl; - std::cout << " N tracks s/amu gmu selmu " << tracks->size() << " " << muons->size() << " " << gmuons->size() << " " - << smuons->size() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " ievBunch " << iEvent.bunchCrossing() << " runN " << (int)iEvent.run(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " N tracks s/amu gmu selmu " << tracks->size() << " " + << muons->size() << " " << gmuons->size() << " " << smuons->size(); for (MuonCollection::const_iterator itMuon = smuons->begin(); itMuon != smuons->end(); ++itMuon) { - std::cout << " is isolatValid Matches " << itMuon->isIsolationValid() << " " << itMuon->isMatchesValid() - << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " is isolatValid Matches " << itMuon->isIsolationValid() << " " << itMuon->isMatchesValid(); } } @@ -1366,14 +1418,15 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent iteratorHcalRcd = i; } if (debug_) { - std::cout << "=== iteratorTrackerRcd " << iteratorTrackerRcd->rawId() << " ====\n" - << " translation " << iteratorTrackerRcd->translation() << "\n" - << " angles " << iteratorTrackerRcd->rotation().eulerAngles() << std::endl; - std::cout << iteratorTrackerRcd->rotation() << std::endl; - std::cout << "=== iteratorMuonRcd " << iteratorMuonRcd->rawId() << " ====\n" - << " translation " << iteratorMuonRcd->translation() << "\n" - << " angles " << iteratorMuonRcd->rotation().eulerAngles() << std::endl; - std::cout << iteratorMuonRcd->rotation() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << "=== iteratorTrackerRcd " << iteratorTrackerRcd->rawId() << " ====\n" + << " translation " << iteratorTrackerRcd->translation() << "\n" + << " angles " << iteratorTrackerRcd->rotation().eulerAngles(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << iteratorTrackerRcd->rotation(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << "=== iteratorMuonRcd " << iteratorMuonRcd->rawId() << " ====\n" + << " translation " << iteratorMuonRcd->translation() << "\n" + << " angles " << iteratorMuonRcd->rotation().eulerAngles(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << iteratorMuonRcd->rotation(); } } // end of GlobalPositionRcd @@ -1395,7 +1448,7 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent if (defineFitter) { if (debug_) - std::cout << " ............... DEFINE FITTER ..................." << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " ............... DEFINE FITTER ..................."; KFUpdator* theUpdator = new KFUpdator(); //Chi2MeasurementEstimator* theEstimator = new Chi2MeasurementEstimator(30); Chi2MeasurementEstimator* theEstimator = new Chi2MeasurementEstimator(100000, 100000); @@ -1408,11 +1461,12 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent this->TTRHBuilder = &(*builder); this->MuRHBuilder = new MuonTransientTrackingRecHitBuilder(theTrackingGeometry); if (debug_) { - std::cout << " theTrackingGeometry.isValid() " << theTrackingGeometry.isValid() << std::endl; - std::cout << "get also the MuonTransientTrackingRecHitBuilder" - << "\n"; - std::cout << "get also the TransientTrackingRecHitBuilder" - << "\n"; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " theTrackingGeometry.isValid() " << theTrackingGeometry.isValid(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << "get also the MuonTransientTrackingRecHitBuilder" + << "\n"; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << "get also the TransientTrackingRecHitBuilder" + << "\n"; } defineFitter = false; } @@ -1421,8 +1475,9 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent //itMuon --> Jim's globalMuon for (MuonCollection::const_iterator itMuon = smuons->begin(); itMuon != smuons->end(); ++itMuon) { if (debug_) { - std::cout << " mu gM is GM Mu SaM tM " << itMuon->isGlobalMuon() << " " << itMuon->isMuon() << " " - << itMuon->isStandAloneMuon() << " " << itMuon->isTrackerMuon() << " " << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " mu gM is GM Mu SaM tM " << itMuon->isGlobalMuon() << " " << itMuon->isMuon() << " " + << itMuon->isStandAloneMuon() << " " << itMuon->isTrackerMuon() << " "; } // get information about the innermost muon hit ------------------------- @@ -1449,13 +1504,14 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent float distanceOutOut = (pointTrackOut - pointMuonOut).mag(); if (debug_) { - std::cout << " pointTrackIn " << pointTrackIn << std::endl; - std::cout << " Out " << pointTrackOut << " lenght " << lenghtTrack << std::endl; - std::cout << " point MuonIn " << pointMuonIn << std::endl; - std::cout << " Out " << pointMuonOut << " lenght " << lenghtMuon << std::endl; - std::cout << " momeTrackIn Out " << momentumTrackIn << " " << momentumTrackOut << std::endl; - std::cout << " doi io ii oo " << distanceOutIn << " " << distanceInOut << " " << distanceInIn << " " - << distanceOutOut << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " pointTrackIn " << pointTrackIn; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Out " << pointTrackOut << " lenght " << lenghtTrack; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " point MuonIn " << pointMuonIn; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Out " << pointMuonOut << " lenght " << lenghtMuon; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " momeTrackIn Out " << momentumTrackIn << " " << momentumTrackOut; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " doi io ii oo " << distanceOutIn << " " << distanceInOut << " " << distanceInIn << " " << distanceOutOut; } if (lenghtTrack < 90.) @@ -1470,7 +1526,7 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent continue; if (debug_) - std::cout << " passed lenght momentum cuts" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " passed lenght momentum cuts"; GlobalVector GRm, GPm, Nl, Rm, Pm, Rt, Pt, Rt0; AlgebraicSymMatrix66 Cm, C0, Ce, C1; @@ -1484,7 +1540,7 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent if (isolatedMuonMode_) { //------------------------------- Isolated Muon --- Out-In -- if (debug_) - std::cout << " ------ Isolated (out-in) ----- " << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " ------ Isolated (out-in) ----- "; const Surface& refSurface = innerMuTSOS.surface(); ConstReferenceCountingPointer tpMuLocal(refSurface.tangentPlane(innerMuTSOS.localPosition())); Nl = tpMuLocal->normalVector(); @@ -1495,13 +1551,13 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent GlobalVector Nlp = refPlane->normalVector(); if (debug_) { - std::cout << " Nlocal " << Nl.x() << " " << Nl.y() << " " << Nl.z() << " " - << " alfa " << int(asin(Nl.x()) * 57.29578) << std::endl; - std::cout << " global " << Ng.x() << " " << Ng.y() << " " << Ng.z() << std::endl; - std::cout << " lp " << Nlp.x() << " " << Nlp.y() << " " << Nlp.z() << std::endl; - //std::cout<<" Nlocal Nglobal "<(asin(Nl.x()) * 57.29578); } // extrapolation to innermost muon hit @@ -1517,9 +1573,9 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent if (!extrapolationT.isValid()) { if (false & alarm) - std::cout << " !!!!!!!!! Catastrophe Out-In extrapolationT.isValid " - //<<"\a\a\a\a\a\a\a\a"< tpMuGlobal(refSurface.tangentPlane(innerMuTSOS.globalPosition())); @@ -1569,13 +1625,13 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent if (!extrapolationT.isValid()) { if (false & alarm) - std::cout << " !!!!!!!!! Catastrophe Out-In extrapolationT.isValid " - //<<"\a\a\a\a\a\a\a\a"<outerTrack(), muTT, oppositeToMomentum, muonFittedTSOS); if (false & debug_) { - //std::cout<<" ->propDir "<propagationDirection()<propDir " << propagator->propagationDirection(); PropagationDirectionChooser Chooser; - std::cout << " propDirCh " << Chooser.operator()(*outerTrackTSOS.freeState(), refSurface) << " Ch == along " - << (alongMomentum == Chooser.operator()(*outerTrackTSOS.freeState(), refSurface)) << std::endl; - std::cout << " --- Nlocal " << Nl.x() << " " << Nl.y() << " " << Nl.z() << " " - << " alfa " << int(asin(Nl.x()) * 57.29578) << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " propDirCh " << Chooser.operator()(*outerTrackTSOS.freeState(), refSurface) << " Ch == along " + << (alongMomentum == Chooser.operator()(*outerTrackTSOS.freeState(), refSurface)); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " --- Nlocal " << Nl.x() << " " << Nl.y() << " " << Nl.z() << " " + << " alfa " << int(asin(Nl.x()) * 57.29578); } } // enf of ---- Out - In ----- else if ((distanceInOut <= distanceInIn) & (distanceInOut <= distanceOutIn) & (distanceInOut <= distanceOutOut)) { // ----- In - Out ------ if (debug_) - std::cout << " ----- In - Out -----" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " ----- In - Out -----"; const Surface& refSurface = outerMuTSOS.surface(); ConstReferenceCountingPointer tpMuGlobal(refSurface.tangentPlane(outerMuTSOS.globalPosition())); @@ -1629,12 +1687,12 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent if (!extrapolationT.isValid()) { if (false & alarm) - std::cout << " !!!!!!!!! Catastrophe Out-In extrapolationT.isValid " - << "\a\a\a\a\a\a\a\a" << extrapolationT.isValid() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " !!!!!!!!! Catastrophe Out-In extrapolationT.isValid " + << "\a\a\a\a\a\a\a\a" << extrapolationT.isValid(); continue; } if (debug_) - std::cout << " extrapolationT.isValid " << extrapolationT.isValid() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " extrapolationT.isValid " << extrapolationT.isValid(); tsosMuonIf = 2; Rt = GlobalVector((extrapolationT.globalPosition()).x(), @@ -1658,20 +1716,21 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent GlobalTrackerMuonAlignment::muonFitter(itMuon->outerTrack(), muTT, alongMomentum, muonFittedTSOS); if (false & debug_) { - //std::cout<<" ->propDir "<propagationDirection()<propDir " << propagator->propagationDirection(); PropagationDirectionChooser Chooser; - std::cout << " propDirCh " << Chooser.operator()(*innerTrackTSOS.freeState(), refSurface) - << " Ch == oppisite " - << (oppositeToMomentum == Chooser.operator()(*innerTrackTSOS.freeState(), refSurface)) << std::endl; - std::cout << " --- Nlocal " << Nl.x() << " " << Nl.y() << " " << Nl.z() << " " - << " alfa " << int(asin(Nl.x()) * 57.29578) << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " propDirCh " << Chooser.operator()(*innerTrackTSOS.freeState(), refSurface) << " Ch == oppisite " + << (oppositeToMomentum == Chooser.operator()(*innerTrackTSOS.freeState(), refSurface)); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " --- Nlocal " << Nl.x() << " " << Nl.y() << " " << Nl.z() << " " + << " alfa " << int(asin(Nl.x()) * 57.29578); } } // enf of ---- In - Out ----- else if ((distanceOutOut <= distanceInOut) & (distanceOutOut <= distanceInIn) & (distanceOutOut <= distanceOutIn)) { // ----- Out - Out ------ if (debug_) - std::cout << " ----- Out - Out -----" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " ----- Out - Out -----"; // reject: momentum of track has opposite direction to muon track continue; @@ -1685,12 +1744,12 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent if (!extrapolationT.isValid()) { if (alarm) - std::cout << " !!!!!!!!! Catastrophe Out-Out extrapolationT.isValid " - << "\a\a\a\a\a\a\a\a" << extrapolationT.isValid() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " !!!!!!!!! Catastrophe Out-Out extrapolationT.isValid " + << "\a\a\a\a\a\a\a\a" << extrapolationT.isValid(); continue; } if (debug_) - std::cout << " extrapolationT.isValid " << extrapolationT.isValid() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " extrapolationT.isValid " << extrapolationT.isValid(); tsosMuonIf = 2; Rt = GlobalVector((extrapolationT.globalPosition()).x(), @@ -1712,17 +1771,21 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent if (debug_) { PropagationDirectionChooser Chooser; - std::cout << " propDirCh " << Chooser.operator()(*outerTrackTSOS.freeState(), refSurface) << " Ch == along " - << (alongMomentum == Chooser.operator()(*outerTrackTSOS.freeState(), refSurface)) << std::endl; - std::cout << " --- Nlocal " << Nl.x() << " " << Nl.y() << " " << Nl.z() << " " - << " alfa " << int(asin(Nl.x()) * 57.29578) << std::endl; - std::cout << " Nornal " << Nl.x() << " " << Nl.y() << " " << Nl.z() << " " - << " alfa " << int(asin(Nl.x()) * 57.29578) << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " propDirCh " << Chooser.operator()(*outerTrackTSOS.freeState(), refSurface) << " Ch == along " + << (alongMomentum == Chooser.operator()(*outerTrackTSOS.freeState(), refSurface)); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " --- Nlocal " << Nl.x() << " " << Nl.y() << " " << Nl.z() << " " + << " alfa " << int(asin(Nl.x()) * 57.29578); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " Nornal " << Nl.x() << " " << Nl.y() << " " << Nl.z() << " " + << " alfa " << int(asin(Nl.x()) * 57.29578); } } // enf of ---- Out - Out ----- else { if (alarm) - std::cout << " ------- !!!!!!!!!!!!!!! No proper Out - In \a\a\a\a\a\a\a" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " ------- !!!!!!!!!!!!!!! No proper Out - In \a\a\a\a\a\a\a"; continue; } @@ -1730,7 +1793,7 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent if (tsosMuonIf == 0) { if (info) { - std::cout << "No tsosMuon !!!!!!" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << "No tsosMuon !!!!!!"; continue; } } @@ -1747,7 +1810,7 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent if (refitTrack_) { if (!trackFittedTSOS.isValid()) { if (info) - std::cout << " ================= trackFittedTSOS notValid !!!!!!!! " << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " ================= trackFittedTSOS notValid !!!!!!!! "; continue; } if (debug_) @@ -1757,7 +1820,7 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent if (refitMuon_) { if (!muonFittedTSOS.isValid()) { if (info) - std::cout << " ================= muonFittedTSOS notValid !!!!!!!! " << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " ================= muonFittedTSOS notValid !!!!!!!! "; continue; } if (debug_) @@ -1789,9 +1852,10 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent float alfa_x = atan2(Nl.x(), Nl.y()) * 57.29578; if (debug_) { - std::cout << " Nx Ny Nz alfa_x " << Nl.x() << " " << Nl.y() << " " << Nl.z() << " " << alfa_x << std::endl; - //std::cout<<" Rm "<Fill(resP.z()); if ((fabs(Nl.x()) < 0.98) && (fabs(Nl.y()) < 0.98) && (fabs(Nl.z()) < 0.98)) { - histo18->Fill(sqrt(C0(0, 0))); - histo19->Fill(sqrt(C1(0, 0))); - histo20->Fill(sqrt(C1(0, 0) + Ce(0, 0))); + histo18->Fill(std::sqrt(C0(0, 0))); + histo19->Fill(std::sqrt(C1(0, 0))); + histo20->Fill(std::sqrt(C1(0, 0) + Ce(0, 0))); } if (fabs(Nl.x()) < 0.98) - histo21->Fill(Vm(0) / sqrt(Cm(0, 0))); + histo21->Fill(Vm(0) / std::sqrt(Cm(0, 0))); if (fabs(Nl.y()) < 0.98) - histo22->Fill(Vm(1) / sqrt(Cm(1, 1))); + histo22->Fill(Vm(1) / std::sqrt(Cm(1, 1))); if (fabs(Nl.z()) < 0.98) - histo23->Fill(Vm(2) / sqrt(Cm(2, 2))); - histo24->Fill(Vm(3) / sqrt(C1(3, 3) + Ce(3, 3))); - histo25->Fill(Vm(4) / sqrt(C1(4, 4) + Ce(4, 4))); - histo26->Fill(Vm(5) / sqrt(C1(5, 5) + Ce(5, 5))); + histo23->Fill(Vm(2) / std::sqrt(Cm(2, 2))); + histo24->Fill(Vm(3) / std::sqrt(C1(3, 3) + Ce(3, 3))); + histo25->Fill(Vm(4) / std::sqrt(C1(4, 4) + Ce(4, 4))); + histo26->Fill(Vm(5) / std::sqrt(C1(5, 5) + Ce(5, 5))); histo27->Fill(Nl.x()); histo28->Fill(Nl.y()); histo29->Fill(lenghtTrack); histo30->Fill(lenghtMuon); histo31->Fill(chi_Loc); - histo32->Fill(Vml(1) / sqrt(Cml(1, 1))); - histo33->Fill(Vml(2) / sqrt(Cml(2, 2))); - histo34->Fill(Vml(3) / sqrt(Cml(3, 3))); - histo35->Fill(Vml(4) / sqrt(Cml(4, 4))); + histo32->Fill(Vml(1) / std::sqrt(Cml(1, 1))); + histo33->Fill(Vml(2) / std::sqrt(Cml(2, 2))); + histo34->Fill(Vml(3) / std::sqrt(Cml(3, 3))); + histo35->Fill(Vml(4) / std::sqrt(Cml(4, 4))); if (debug_) { //--------------------------------- debug print ---------- - std::cout << " diag 0[ " << C0(0, 0) << " " << C0(1, 1) << " " << C0(2, 2) << " " << C0(3, 3) << " " << C0(4, 4) - << " " << C0(5, 5) << " ]" << std::endl; - std::cout << " diag e[ " << Ce(0, 0) << " " << Ce(1, 1) << " " << Ce(2, 2) << " " << Ce(3, 3) << " " << Ce(4, 4) - << " " << Ce(5, 5) << " ]" << std::endl; - std::cout << " diag 1[ " << C1(0, 0) << " " << C1(1, 1) << " " << C1(2, 2) << " " << C1(3, 3) << " " << C1(4, 4) - << " " << C1(5, 5) << " ]" << std::endl; - std::cout << " Rm " << Rm.x() << " " << Rm.y() << " " << Rm.z() << " Pm " << Pm.x() << " " << Pm.y() << " " - << Pm.z() << std::endl; - std::cout << " Rt " << Rt.x() << " " << Rt.y() << " " << Rt.z() << " Pt " << Pt.x() << " " << Pt.y() << " " - << Pt.z() << std::endl; - std::cout << " Nl*(Rm-Rt) " << Nl.dot(Rm - Rt) << std::endl; - std::cout << " resR " << resR.x() << " " << resR.y() << " " << resR.z() << " resP " << resP.x() << " " << resP.y() - << " " << resP.z() << std::endl; - std::cout << " Rm-t " << (Rm - Rt).x() << " " << (Rm - Rt).y() << " " << (Rm - Rt).z() << " Pm-t " - << (Pm - Pt).x() << " " << (Pm - Pt).y() << " " << (Pm - Pt).z() << std::endl; - std::cout << " Vm " << Vm << std::endl; - std::cout << " +- " << sqrt(Cm(0, 0)) << " " << sqrt(Cm(1, 1)) << " " << sqrt(Cm(2, 2)) << " " << sqrt(Cm(3, 3)) - << " " << sqrt(Cm(4, 4)) << " " << sqrt(Cm(5, 5)) << std::endl; - std::cout << " Pmuon Ptrack dP/Ptrack " << itMuon->outerTrack()->p() << " " << itMuon->track()->outerP() << " " - << (itMuon->outerTrack()->p() - itMuon->track()->outerP()) / itMuon->track()->outerP() << std::endl; - std::cout << " cov matrix " << std::endl; - std::cout << Cm << std::endl; - std::cout << " diag [ " << Cm(0, 0) << " " << Cm(1, 1) << " " << Cm(2, 2) << " " << Cm(3, 3) << " " << Cm(4, 4) - << " " << Cm(5, 5) << " ]" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " diag 0[ " << C0(0, 0) << " " << C0(1, 1) << " " << C0(2, 2) + << " " << C0(3, 3) << " " << C0(4, 4) << " " << C0(5, 5) << " ]"; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " diag e[ " << Ce(0, 0) << " " << Ce(1, 1) << " " << Ce(2, 2) + << " " << Ce(3, 3) << " " << Ce(4, 4) << " " << Ce(5, 5) << " ]"; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " diag 1[ " << C1(0, 0) << " " << C1(1, 1) << " " << C1(2, 2) + << " " << C1(3, 3) << " " << C1(4, 4) << " " << C1(5, 5) << " ]"; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Rm " << Rm.x() << " " << Rm.y() << " " << Rm.z() << " Pm " + << Pm.x() << " " << Pm.y() << " " << Pm.z(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Rt " << Rt.x() << " " << Rt.y() << " " << Rt.z() << " Pt " + << Pt.x() << " " << Pt.y() << " " << Pt.z(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Nl*(Rm-Rt) " << Nl.dot(Rm - Rt); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " resR " << resR.x() << " " << resR.y() << " " << resR.z() + << " resP " << resP.x() << " " << resP.y() << " " << resP.z(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " Rm-t " << (Rm - Rt).x() << " " << (Rm - Rt).y() << " " << (Rm - Rt).z() << " Pm-t " << (Pm - Pt).x() + << " " << (Pm - Pt).y() << " " << (Pm - Pt).z(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Vm " << Vm; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " +- " << std::sqrt(Cm(0, 0)) << " " << std::sqrt(Cm(1, 1)) << " " << std::sqrt(Cm(2, 2)) << " " + << std::sqrt(Cm(3, 3)) << " " << std::sqrt(Cm(4, 4)) << " " << std::sqrt(Cm(5, 5)); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " Pmuon Ptrack dP/Ptrack " << itMuon->outerTrack()->p() << " " << itMuon->track()->outerP() << " " + << (itMuon->outerTrack()->p() - itMuon->track()->outerP()) / itMuon->track()->outerP(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " cov matrix "; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << Cm; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " diag [ " << Cm(0, 0) << " " << Cm(1, 1) << " " << Cm(2, 2) + << " " << Cm(3, 3) << " " << Cm(4, 4) << " " << Cm(5, 5) << " ]"; AlgebraicSymMatrix66 Ro; double Diag[6]; for (int i = 0; i <= 5; i++) - Diag[i] = sqrt(Cm(i, i)); + Diag[i] = std::sqrt(Cm(i, i)); for (int i = 0; i <= 5; i++) for (int j = 0; j <= 5; j++) Ro(i, j) = Cm(i, j) / Diag[i] / Diag[j]; - std::cout << " correlation matrix " << std::endl; - std::cout << Ro << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " correlation matrix "; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << Ro; AlgebraicSymMatrix66 CmI; for (int i = 0; i <= 5; i++) @@ -2010,14 +2078,14 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent bool ierr = !CmI.Invert(); if (ierr) { if (alarm || debug_) - std::cout << " Error inverse covariance matrix !!!!!!!!!!!" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Error inverse covariance matrix !!!!!!!!!!!"; continue; } - std::cout << " inverse cov matrix " << std::endl; - std::cout << Cm << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " inverse cov matrix "; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << Cm; double chi = ROOT::Math::Similarity(Vm, CmI); - std::cout << " chi chi_d " << chi << " " << chi_d << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " chi chi_d " << chi << " " << chi_d; } // end of debug_ printout -------------------------------------------- } // end loop on selected muons, i.e. Jim's globalMuon @@ -2075,7 +2143,7 @@ void GlobalTrackerMuonAlignment::gradientGlobalAlg( if (j < i) continue; Itr(i, j) = 0.; - //std::cout<<" ij "< 0.95) - std::cout << " Ecap1 N " << GNorm << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Ecap1 N " << GNorm; else if (GNorm.z() < -0.95) - std::cout << " Ecap2 N " << GNorm << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Ecap2 N " << GNorm; else - std::cout << " Barrel N " << GNorm << std::endl; - std::cout << " JacCLo(i," << i << ") = {" << JacCorLoc(1, i) << " " << JacCorLoc(2, i) << " " << JacCorLoc(3, i) - << " " << JacCorLoc(4, i) << "}" << std::endl; - std::cout << " rotLoc " << rotLoc << std::endl; - std::cout << " position " << R0 << std::endl; - std::cout << " Pm,l " << Pm.T() << " " << Pml(1) / Pml(3) << " " << Pml(2) / Pml(3) << std::endl; - std::cout << " Pt,l " << Pt.T() << " " << Ptl(1) / Ptl(3) << " " << Ptl(2) / Ptl(3) << std::endl; - std::cout << " V " << V.T() << std::endl; - std::cout << " Cov \n" << covLoc << std::endl; - std::cout << " W*Cov " << W * covLoc << std::endl; - //std::cout<<" JacCarToLoc = drldrc \n"<< - //JacobianCartesianToLocal::JacobianCartesianToLocal - //(refSurface, tsosTrack.localParameters()).jacobian()< 0.95) - std::cout << " Ecap1 N " << GNorm << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Ecap1 N " << GNorm; else if (GNorm.z() < -0.95) - std::cout << " Ecap2 N " << GNorm << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Ecap2 N " << GNorm; else - std::cout << " Barrel N " << GNorm << std::endl; - std::cout << " dldc Num (i," << ii << ") " << (V1(1) - V0(1)) / delta << " " << (V1(2) - V0(2)) / delta << " " - << (V1(3) - V0(3)) / delta << " " << (V1(4) - V0(4)) / delta << std::endl; - std::cout << " dldc Ana (i," << ii << ") " << JacToLoc(1, ii) << " " << JacToLoc(2, ii) << " " << JacToLoc(3, ii) - << " " << JacToLoc(4, ii) << std::endl; - //float dtxdpx = (rotLoc(1,1) - rotLoc(3,1)*Pml(1)/Pml(3))/Pml(3); - //float dtydpx = (rotLoc(2,1) - rotLoc(3,2)*Pml(2)/Pml(3))/Pml(3); - //std::cout<<" dtx/dpx dty/ "<debugTrackHit(" Tracker track hits ", alongTr); this->debugTrackHit(" Tracker TransientTrack hits ", alongTTr); @@ -3017,7 +3101,8 @@ void GlobalTrackerMuonAlignment::trackFitter(reco::TrackRef alongTr, recHitAlong.clear(); } if (info) - std::cout << " ... Own recHit.size() " << recHit.size() << " " << trackDetId.rawId() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " ... Own recHit.size() " << recHit.size() << " " << trackDetId.rawId(); //MuonTransientTrackingRecHitBuilder::ConstRecHitContainer recHitTrack; TransientTrackingRecHit::RecHitContainer recHitTrack; @@ -3025,8 +3110,8 @@ void GlobalTrackerMuonAlignment::trackFitter(reco::TrackRef alongTr, recHitTrack.push_back(TTRHBuilder->build(hit)); if (info) - std::cout << " ... recHitTrack.size() " << recHit.size() << " " << trackDetId.rawId() << " ======> recHitMu " - << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " ... recHitTrack.size() " << recHit.size() << " " << trackDetId.rawId() << " ======> recHitMu "; MuonTransientTrackingRecHitBuilder::ConstRecHitContainer recHitMu = recHitTrack; /* @@ -3034,7 +3119,7 @@ void GlobalTrackerMuonAlignment::trackFitter(reco::TrackRef alongTr, MuRHBuilder->build(alongTTr.recHits().begin(), alongTTr.recHits().end()); */ if (info) - std::cout << " ...along.... recHitMu.size() " << recHitMu.size() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " ...along.... recHitMu.size() " << recHitMu.size(); if (direction != alongMomentum) { MuonTransientTrackingRecHitBuilder::ConstRecHitContainer recHitMuAlong = recHitMu; recHitMu.clear(); @@ -3044,7 +3129,7 @@ void GlobalTrackerMuonAlignment::trackFitter(reco::TrackRef alongTr, recHitMuAlong.clear(); } if (info) - std::cout << " ...opposite... recHitMu.size() " << recHitMu.size() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " ...opposite... recHitMu.size() " << recHitMu.size(); TrajectoryStateOnSurface firstTSOS; if (direction == alongMomentum) @@ -3075,7 +3160,7 @@ void GlobalTrackerMuonAlignment::trackFitter(reco::TrackRef alongTr, this->debugTrajectorySOSv(" innermostTSOS of TransientTrack", alongTTr.innermostMeasurementState()); this->debugTrajectorySOSv(" outermostTSOS of TransientTrack", alongTTr.outermostMeasurementState()); this->debugTrajectorySOS(" initialTSOS for theFitter ", initialTSOS); - std::cout << " . . . . . trajVec.size() " << trajVec.size() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " . . . . . trajVec.size() " << trajVec.size(); if (!trajVec.empty()) this->debugTrajectory(" theFitter trajectory ", trajVec[0]); } @@ -3092,7 +3177,7 @@ void GlobalTrackerMuonAlignment::trackFitter(reco::TrackRef alongTr, trajSVec = theSmootherOp->trajectories(*(trajVec.begin())); } if (info) - std::cout << " . . . . trajSVec.size() " << trajSVec.size() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " . . . . trajSVec.size() " << trajSVec.size(); if (!trajSVec.empty()) this->debugTrajectorySOSv("smoothed geom InnermostState", trajSVec[0].geometricalInnermostState()); if (!trajSVec.empty()) @@ -3113,7 +3198,7 @@ void GlobalTrackerMuonAlignment::muonFitter(reco::TrackRef alongTr, bool smooth = false; if (info) - std::cout << " ......... start of muonFitter ........" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " ......... start of muonFitter ........"; if (false && info) { this->debugTrackHit(" Muon track hits ", alongTr); this->debugTrackHit(" Muon TransientTrack hits ", alongTTr); @@ -3132,12 +3217,13 @@ void GlobalTrackerMuonAlignment::muonFitter(reco::TrackRef alongTr, recHitAlong.clear(); } if (info) - std::cout << " ... Own recHit.size() DetId==Muon " << recHit.size() << " " << trackDetId.rawId() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " ... Own recHit.size() DetId==Muon " << recHit.size() << " " << trackDetId.rawId(); MuonTransientTrackingRecHitBuilder::ConstRecHitContainer recHitMu = MuRHBuilder->build(alongTTr.recHitsBegin(), alongTTr.recHitsEnd()); if (info) - std::cout << " ...along.... recHitMu.size() " << recHitMu.size() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " ...along.... recHitMu.size() " << recHitMu.size(); if (direction != alongMomentum) { MuonTransientTrackingRecHitBuilder::ConstRecHitContainer recHitMuAlong = recHitMu; recHitMu.clear(); @@ -3147,7 +3233,7 @@ void GlobalTrackerMuonAlignment::muonFitter(reco::TrackRef alongTr, recHitMuAlong.clear(); } if (info) - std::cout << " ...opposite... recHitMu.size() " << recHitMu.size() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " ...opposite... recHitMu.size() " << recHitMu.size(); TrajectoryStateOnSurface firstTSOS; if (direction == alongMomentum) @@ -3178,7 +3264,7 @@ void GlobalTrackerMuonAlignment::muonFitter(reco::TrackRef alongTr, this->debugTrajectorySOSv(" innermostTSOS of TransientTrack", alongTTr.innermostMeasurementState()); this->debugTrajectorySOSv(" outermostTSOS of TransientTrack", alongTTr.outermostMeasurementState()); this->debugTrajectorySOS(" initialTSOS for theFitter ", initialTSOS); - std::cout << " . . . . . trajVec.size() " << trajVec.size() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " . . . . . trajVec.size() " << trajVec.size(); if (!trajVec.empty()) this->debugTrajectory(" theFitter trajectory ", trajVec[0]); } @@ -3195,7 +3281,7 @@ void GlobalTrackerMuonAlignment::muonFitter(reco::TrackRef alongTr, trajSVec = theSmootherOp->trajectories(*(trajVec.begin())); } if (info) - std::cout << " . . . . trajSVec.size() " << trajSVec.size() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " . . . . trajSVec.size() " << trajSVec.size(); if (!trajSVec.empty()) this->debugTrajectorySOSv("smoothed geom InnermostState", trajSVec[0].geometricalInnermostState()); if (!trajSVec.empty()) @@ -3206,112 +3292,118 @@ void GlobalTrackerMuonAlignment::muonFitter(reco::TrackRef alongTr, // ---- debug printout of hits from TransientTrack ------ void GlobalTrackerMuonAlignment::debugTrackHit(const std::string title, TransientTrack& alongTr) { - std::cout << " ------- " << title << " --------" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " ------- " << title << " --------"; int nHit = 1; for (trackingRecHit_iterator i = alongTr.recHitsBegin(); i != alongTr.recHitsEnd(); i++) { - std::cout << " Hit " << nHit++ << " DetId " << (*i)->geographicalId().det(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Hit " << nHit++ << " DetId " << (*i)->geographicalId().det(); if ((*i)->geographicalId().det() == DetId::Tracker) - std::cout << " Tracker "; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Tracker "; else if ((*i)->geographicalId().det() == DetId::Muon) - std::cout << " Muon "; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Muon "; else - std::cout << " Unknown "; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Unknown "; if (!(*i)->isValid()) - std::cout << " not valid " << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " not valid "; else - std::cout << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment"); } } // ---- debug printout of hits from TrackRef ------ void GlobalTrackerMuonAlignment::debugTrackHit(const std::string title, reco::TrackRef alongTr) { - std::cout << " ------- " << title << " --------" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " ------- " << title << " --------"; int nHit = 1; for (auto const& hit : alongTr->recHits()) { - std::cout << " Hit " << nHit++ << " DetId " << hit->geographicalId().det(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Hit " << nHit++ << " DetId " << hit->geographicalId().det(); if (hit->geographicalId().det() == DetId::Tracker) - std::cout << " Tracker "; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Tracker "; else if (hit->geographicalId().det() == DetId::Muon) - std::cout << " Muon "; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Muon "; else - std::cout << " Unknown "; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Unknown "; if (!hit->isValid()) - std::cout << " not valid " << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " not valid "; else - std::cout << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment"); } } // ---- debug printout TrajectoryStateOnSurface ------ void GlobalTrackerMuonAlignment::debugTrajectorySOS(const std::string title, TrajectoryStateOnSurface& trajSOS) { - std::cout << " --- " << title << " --- " << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " --- " << title << " --- "; if (!trajSOS.isValid()) { - std::cout << " Not valid !!!! " << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Not valid !!!! "; return; } - std::cout << " R |p| " << trajSOS.globalPosition().perp() << " " << trajSOS.globalMomentum().mag() << " charge " - << trajSOS.charge() << std::endl; - std::cout << " x p " << trajSOS.globalParameters().vector()(0) << " " << trajSOS.globalParameters().vector()(1) - << " " << trajSOS.globalParameters().vector()(2) << " " << trajSOS.globalParameters().vector()(3) << " " - << trajSOS.globalParameters().vector()(4) << " " << trajSOS.globalParameters().vector()(5) << std::endl; - std::cout << " +/- " << sqrt(trajSOS.cartesianError().matrix()(0, 0)) << " " - << sqrt(trajSOS.cartesianError().matrix()(1, 1)) << " " << sqrt(trajSOS.cartesianError().matrix()(2, 2)) - << " " << sqrt(trajSOS.cartesianError().matrix()(3, 3)) << " " - << sqrt(trajSOS.cartesianError().matrix()(4, 4)) << " " << sqrt(trajSOS.cartesianError().matrix()(5, 5)) - << std::endl; - std::cout << " q/p dxy/dz xy " << trajSOS.localParameters().vector()(0) << " " - << trajSOS.localParameters().vector()(1) << " " << trajSOS.localParameters().vector()(2) << " " - << trajSOS.localParameters().vector()(3) << " " << trajSOS.localParameters().vector()(4) << std::endl; - std::cout << " +/- error " << sqrt(trajSOS.localError().matrix()(0, 0)) << " " - << sqrt(trajSOS.localError().matrix()(1, 1)) << " " << sqrt(trajSOS.localError().matrix()(2, 2)) << " " - << sqrt(trajSOS.localError().matrix()(3, 3)) << " " << sqrt(trajSOS.localError().matrix()(4, 4)) << " " - << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " R |p| " << trajSOS.globalPosition().perp() << " " + << trajSOS.globalMomentum().mag() << " charge " << trajSOS.charge(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " x p " << trajSOS.globalParameters().vector()(0) << " " << trajSOS.globalParameters().vector()(1) << " " + << trajSOS.globalParameters().vector()(2) << " " << trajSOS.globalParameters().vector()(3) << " " + << trajSOS.globalParameters().vector()(4) << " " << trajSOS.globalParameters().vector()(5); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " +/- " << std::sqrt(trajSOS.cartesianError().matrix()(0, 0)) << " " + << std::sqrt(trajSOS.cartesianError().matrix()(1, 1)) << " " << std::sqrt(trajSOS.cartesianError().matrix()(2, 2)) + << " " << std::sqrt(trajSOS.cartesianError().matrix()(3, 3)) << " " + << std::sqrt(trajSOS.cartesianError().matrix()(4, 4)) << " " + << std::sqrt(trajSOS.cartesianError().matrix()(5, 5)); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " q/p dxy/dz xy " << trajSOS.localParameters().vector()(0) << " " << trajSOS.localParameters().vector()(1) + << " " << trajSOS.localParameters().vector()(2) << " " << trajSOS.localParameters().vector()(3) << " " + << trajSOS.localParameters().vector()(4); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " +/- error " << std::sqrt(trajSOS.localError().matrix()(0, 0)) << " " + << std::sqrt(trajSOS.localError().matrix()(1, 1)) << " " << std::sqrt(trajSOS.localError().matrix()(2, 2)) << " " + << std::sqrt(trajSOS.localError().matrix()(3, 3)) << " " << std::sqrt(trajSOS.localError().matrix()(4, 4)) << " "; } // ---- debug printout TrajectoryStateOnSurface ------ void GlobalTrackerMuonAlignment::debugTrajectorySOSv(const std::string title, TrajectoryStateOnSurface trajSOS) { - std::cout << " --- " << title << " --- " << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " --- " << title << " --- "; if (!trajSOS.isValid()) { - std::cout << " Not valid !!!! " << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Not valid !!!! "; return; } - std::cout << " R |p| " << trajSOS.globalPosition().perp() << " " << trajSOS.globalMomentum().mag() << " charge " - << trajSOS.charge() << std::endl; - std::cout << " x p " << trajSOS.globalParameters().vector()(0) << " " << trajSOS.globalParameters().vector()(1) - << " " << trajSOS.globalParameters().vector()(2) << " " << trajSOS.globalParameters().vector()(3) << " " - << trajSOS.globalParameters().vector()(4) << " " << trajSOS.globalParameters().vector()(5) << std::endl; - std::cout << " +/- " << sqrt(trajSOS.cartesianError().matrix()(0, 0)) << " " - << sqrt(trajSOS.cartesianError().matrix()(1, 1)) << " " << sqrt(trajSOS.cartesianError().matrix()(2, 2)) - << " " << sqrt(trajSOS.cartesianError().matrix()(3, 3)) << " " - << sqrt(trajSOS.cartesianError().matrix()(4, 4)) << " " << sqrt(trajSOS.cartesianError().matrix()(5, 5)) - << std::endl; - std::cout << " q/p dxy/dz xy " << trajSOS.localParameters().vector()(0) << " " - << trajSOS.localParameters().vector()(1) << " " << trajSOS.localParameters().vector()(2) << " " - << trajSOS.localParameters().vector()(3) << " " << trajSOS.localParameters().vector()(4) << std::endl; - std::cout << " +/- error " << sqrt(trajSOS.localError().matrix()(0, 0)) << " " - << sqrt(trajSOS.localError().matrix()(1, 1)) << " " << sqrt(trajSOS.localError().matrix()(2, 2)) << " " - << sqrt(trajSOS.localError().matrix()(3, 3)) << " " << sqrt(trajSOS.localError().matrix()(4, 4)) << " " - << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " R |p| " << trajSOS.globalPosition().perp() << " " + << trajSOS.globalMomentum().mag() << " charge " << trajSOS.charge(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " x p " << trajSOS.globalParameters().vector()(0) << " " << trajSOS.globalParameters().vector()(1) << " " + << trajSOS.globalParameters().vector()(2) << " " << trajSOS.globalParameters().vector()(3) << " " + << trajSOS.globalParameters().vector()(4) << " " << trajSOS.globalParameters().vector()(5); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " +/- " << std::sqrt(trajSOS.cartesianError().matrix()(0, 0)) << " " + << std::sqrt(trajSOS.cartesianError().matrix()(1, 1)) << " " << std::sqrt(trajSOS.cartesianError().matrix()(2, 2)) + << " " << std::sqrt(trajSOS.cartesianError().matrix()(3, 3)) << " " + << std::sqrt(trajSOS.cartesianError().matrix()(4, 4)) << " " + << std::sqrt(trajSOS.cartesianError().matrix()(5, 5)); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " q/p dxy/dz xy " << trajSOS.localParameters().vector()(0) << " " << trajSOS.localParameters().vector()(1) + << " " << trajSOS.localParameters().vector()(2) << " " << trajSOS.localParameters().vector()(3) << " " + << trajSOS.localParameters().vector()(4); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " +/- error " << std::sqrt(trajSOS.localError().matrix()(0, 0)) << " " + << std::sqrt(trajSOS.localError().matrix()(1, 1)) << " " << std::sqrt(trajSOS.localError().matrix()(2, 2)) << " " + << std::sqrt(trajSOS.localError().matrix()(3, 3)) << " " << std::sqrt(trajSOS.localError().matrix()(4, 4)) << " "; } // ---- debug printout Trajectory ------ void GlobalTrackerMuonAlignment::debugTrajectory(const std::string title, Trajectory& traj) { - std::cout << "\n" - << " ...... " << title << " ...... " << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << "\n" + << " ...... " << title << " ...... "; if (!traj.isValid()) { - std::cout << " Not valid !!!!!!!! " << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Not valid !!!!!!!! "; return; } - std::cout << " chi2/Nhit " << traj.chiSquared() << " / " << traj.foundHits(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " chi2/Nhit " << traj.chiSquared() << " / " << traj.foundHits(); if (traj.direction() == alongMomentum) - std::cout << " alongMomentum >>>>" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " alongMomentum >>>>"; else - std::cout << " oppositeToMomentum <<<<" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " oppositeToMomentum <<<<"; this->debugTrajectorySOSv(" firstMeasurementTSOS ", traj.firstMeasurement().updatedState()); //this->debugTrajectorySOSv(" firstMeasurementTSOS ",traj.firstMeasurement().predictedState()); this->debugTrajectorySOSv(" lastMeasurementTSOS ", traj.lastMeasurement().updatedState()); //this->debugTrajectorySOSv(" geom InnermostState", traj.geometricalInnermostState()); - std::cout << " . . . . . . . . . . . . . . . . . . . . . . . . . . . . \n" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " . . . . . . . . . . . . . . . . . . . . . . . . . . . . \n"; } // ---- write GlobalPositionRcd ------ @@ -3327,7 +3419,7 @@ void GlobalTrackerMuonAlignment::writeGlPosRcd(CLHEP::HepVector& paramVec) { //paramVec(1) = 0.; paramVec(2) = 0.; paramVec(3) = 1.; //1z //paramVec(4) = 0.0000; paramVec(5) = 0.0000; paramVec(6) = 0.0000; - std::cout << " paramVector " << paramVec.T() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " paramVector " << paramVec.T(); CLHEP::Hep3Vector colX, colY, colZ; @@ -3356,12 +3448,12 @@ void GlobalTrackerMuonAlignment::writeGlPosRcd(CLHEP::HepVector& paramVec) { CLHEP::HepRotation rotMuGlRcd = iteratorMuonRcd->rotation(); CLHEP::HepEulerAngles angMuGlRcd = iteratorMuonRcd->rotation().eulerAngles(); if (debug_) - std::cout << " Old muon Rcd Euler angles " << angMuGlRcd.phi() << " " << angMuGlRcd.theta() << " " - << angMuGlRcd.psi() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " Old muon Rcd Euler angles " << angMuGlRcd.phi() << " " << angMuGlRcd.theta() << " " << angMuGlRcd.psi(); AlignTransform muon; if ((angMuGlRcd.phi() == 0.) && (angMuGlRcd.theta() == 0.) && (angMuGlRcd.psi() == 0.) && (posMuGlRcd.x() == 0.) && (posMuGlRcd.y() == 0.) && (posMuGlRcd.z() == 0.)) { - std::cout << " New muon parameters are stored in Rcd" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " New muon parameters are stored in Rcd"; AlignTransform muonNew(AlignTransform::Translation(paramVec(1), paramVec(2), paramVec(3)), AlignTransform::Rotation(colX, colY, colZ), @@ -3369,12 +3461,12 @@ void GlobalTrackerMuonAlignment::writeGlPosRcd(CLHEP::HepVector& paramVec) { muon = muonNew; } else if ((paramVec(1) == 0.) && (paramVec(2) == 0.) && (paramVec(3) == 0.) && (paramVec(4) == 0.) && (paramVec(5) == 0.) && (paramVec(6) == 0.)) { - std::cout << " Old muon parameters are stored in Rcd" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " Old muon parameters are stored in Rcd"; AlignTransform muonNew(iteratorMuonRcd->translation(), iteratorMuonRcd->rotation(), DetId(DetId::Muon).rawId()); muon = muonNew; } else { - std::cout << " New + Old muon parameters are stored in Rcd" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << " New + Old muon parameters are stored in Rcd"; CLHEP::Hep3Vector posMuGlRcdThis = CLHEP::Hep3Vector(paramVec(1), paramVec(2), paramVec(3)); CLHEP::HepRotation rotMuGlRcdThis = CLHEP::HepRotation(colX, colY, colZ); CLHEP::Hep3Vector posMuGlRcdNew = rotMuGlRcdThis * posMuGlRcd + posMuGlRcdThis; @@ -3393,28 +3485,28 @@ void GlobalTrackerMuonAlignment::writeGlPosRcd(CLHEP::HepVector& paramVec) { AlignTransform::EulerAngles(param0(4), param0(5), param0(6)), DetId(DetId::Calo).rawId()); - std::cout << "Tracker (" << tracker.rawId() << ") at " << tracker.translation() << " " - << tracker.rotation().eulerAngles() << std::endl; - std::cout << tracker.rotation() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << "Tracker (" << tracker.rawId() << ") at " << tracker.translation() << " " << tracker.rotation().eulerAngles(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << tracker.rotation(); - std::cout << "Muon (" << muon.rawId() << ") at " << muon.translation() << " " << muon.rotation().eulerAngles() - << std::endl; - std::cout << " rotations angles around x,y,z " - << " ( " << -muon.rotation().zy() << " " << muon.rotation().zx() << " " << -muon.rotation().yx() << " )" - << std::endl; - std::cout << muon.rotation() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << "Muon (" << muon.rawId() << ") at " << muon.translation() << " " << muon.rotation().eulerAngles(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << " rotations angles around x,y,z " + << " ( " << -muon.rotation().zy() << " " << muon.rotation().zx() << " " << -muon.rotation().yx() << " )"; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << muon.rotation(); - std::cout << "Ecal (" << ecal.rawId() << ") at " << ecal.translation() << " " << ecal.rotation().eulerAngles() - << std::endl; - std::cout << ecal.rotation() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << "Ecal (" << ecal.rawId() << ") at " << ecal.translation() << " " << ecal.rotation().eulerAngles(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << ecal.rotation(); - std::cout << "Hcal (" << hcal.rawId() << ") at " << hcal.translation() << " " << hcal.rotation().eulerAngles() - << std::endl; - std::cout << hcal.rotation() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << "Hcal (" << hcal.rawId() << ") at " << hcal.translation() << " " << hcal.rotation().eulerAngles(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << hcal.rotation(); - std::cout << "Calo (" << calo.rawId() << ") at " << calo.translation() << " " << calo.rotation().eulerAngles() - << std::endl; - std::cout << calo.rotation() << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") + << "Calo (" << calo.rawId() << ") at " << calo.translation() << " " << calo.rotation().eulerAngles(); + edm::LogVerbatim("GlobalTrackerMuonAlignment") << calo.rotation(); globalPositions.m_align.push_back(tracker); globalPositions.m_align.push_back(muon); @@ -3422,7 +3514,7 @@ void GlobalTrackerMuonAlignment::writeGlPosRcd(CLHEP::HepVector& paramVec) { globalPositions.m_align.push_back(hcal); globalPositions.m_align.push_back(calo); - std::cout << "Uploading to the database..." << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << "Uploading to the database..."; edm::Service poolDbService; @@ -3435,7 +3527,7 @@ void GlobalTrackerMuonAlignment::writeGlPosRcd(CLHEP::HepVector& paramVec) { // poolDbService->appendOneIOV(globalPositions, poolDbService->currentTime(), "GlobalPositionRcd"); // } poolDbService->writeOneIOV(globalPositions, poolDbService->currentTime(), "GlobalPositionRcd"); - std::cout << "done!" << std::endl; + edm::LogVerbatim("GlobalTrackerMuonAlignment") << "done!"; return; } diff --git a/Alignment/CommonAlignmentProducer/python/GlobalTrackerMuonAlignment_cfi.py b/Alignment/CommonAlignmentProducer/python/GlobalTrackerMuonAlignment_cfi.py deleted file mode 100644 index fbfe817118328..0000000000000 --- a/Alignment/CommonAlignmentProducer/python/GlobalTrackerMuonAlignment_cfi.py +++ /dev/null @@ -1,12 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -GlobalTrackerMuonAlignment = cms.EDAnalyzer('GlobalTrackerMuonAlignment', - isolated = cms.bool(False), - cosmics = cms.bool(False), - refitmuon = cms.bool(False), - refittrack = cms.bool(False), - rootOutFile = cms.untracked.string('outfile.root'), - txtOutFile = cms.untracked.string('outglobal.txt'), - writeDB = cms.untracked.bool(False), - debug = cms.untracked.bool(False) -) diff --git a/Alignment/CommonAlignmentProducer/test/GlobalTrackerMuonAlignment_test_cfg.py b/Alignment/CommonAlignmentProducer/test/GlobalTrackerMuonAlignment_test_cfg.py index 04aa152b7df6b..ddac62cc2d4ed 100644 --- a/Alignment/CommonAlignmentProducer/test/GlobalTrackerMuonAlignment_test_cfg.py +++ b/Alignment/CommonAlignmentProducer/test/GlobalTrackerMuonAlignment_test_cfg.py @@ -21,35 +21,35 @@ #process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(2000)) #process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(100000)) -process.load("Alignment.CommonAlignmentProducer.GlobalTrackerMuonAlignment_cfi") +process.load("Alignment.CommonAlignmentProducer.globalTrackerMuonAlignment_cfi") ### debug isolated/cosmic refit -#process.GlobalTrackerMuonAlignment.debug = cms.untracked.bool(True) -process.GlobalTrackerMuonAlignment.cosmics = cms.bool(True) -#process.GlobalTrackerMuonAlignment.isolated = cms.bool(True) -process.GlobalTrackerMuonAlignment.writeDB = cms.untracked.bool(True) -process.GlobalTrackerMuonAlignment.refitmuon = cms.bool(True) -process.GlobalTrackerMuonAlignment.refittrack = cms.bool(True) +#process.globalTrackerMuonAlignment.debug = True +process.globalTrackerMuonAlignment.cosmics = True +#process.globalTrackerMuonAlignment.isolated = True +process.globalTrackerMuonAlignment.writeDB = True +process.globalTrackerMuonAlignment.refitmuon = True +process.globalTrackerMuonAlignment.refittrack = True # cosmic muon -process.GlobalTrackerMuonAlignment.tracks = cms.InputTag("ALCARECOMuAlGlobalCosmics:TrackerOnly") -process.GlobalTrackerMuonAlignment.muons = cms.InputTag("ALCARECOMuAlGlobalCosmics:StandAlone") -process.GlobalTrackerMuonAlignment.gmuons = cms.InputTag("ALCARECOMuAlGlobalCosmics:GlobalMuon") -process.GlobalTrackerMuonAlignment.smuons = cms.InputTag("ALCARECOMuAlGlobalCosmics:SelectedMuons") +process.globalTrackerMuonAlignment.tracks = cms.InputTag("ALCARECOMuAlGlobalCosmics:TrackerOnly") +process.globalTrackerMuonAlignment.muons = cms.InputTag("ALCARECOMuAlGlobalCosmics:StandAlone") +process.globalTrackerMuonAlignment.gmuons = cms.InputTag("ALCARECOMuAlGlobalCosmics:GlobalMuon") +process.globalTrackerMuonAlignment.smuons = cms.InputTag("ALCARECOMuAlGlobalCosmics:SelectedMuons") # isolated muon -#process.GlobalTrackerMuonAlignment.tracks = cms.InputTag("ALCARECOMuAlCalIsolatedMu:TrackerOnly") -#process.GlobalTrackerMuonAlignment.muons = cms.InputTag("ALCARECOMuAlCalIsolatedMu:StandAlone") -#process.GlobalTrackerMuonAlignment.gmuons = cms.InputTag("ALCARECOMuAlCalIsolatedMu:GlobalMuon") -#process.GlobalTrackerMuonAlignment.smuons = cms.InputTag("ALCARECOMuAlCalIsolatedMu:SelectedMuons") +#process.globalTrackerMuonAlignment.tracks = cms.InputTag("ALCARECOMuAlCalIsolatedMu:TrackerOnly") +#process.globalTrackerMuonAlignment.muons = cms.InputTag("ALCARECOMuAlCalIsolatedMu:StandAlone") +#process.globalTrackerMuonAlignment.gmuons = cms.InputTag("ALCARECOMuAlCalIsolatedMu:GlobalMuon") +#process.globalTrackerMuonAlignment.smuons = cms.InputTag("ALCARECOMuAlCalIsolatedMu:SelectedMuons") -process.GlobalTrackerMuonAlignment.Propagator = cms.string("SteppingHelixPropagator") +process.globalTrackerMuonAlignment.propagator = "SteppingHelixPropagator" # propagator really not used now process.load("TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagator_cfi") -process.p = cms.Path(process.GlobalTrackerMuonAlignment) +process.p = cms.Path(process.globalTrackerMuonAlignment) #process.dump=cms.EDAnalyzer('EventContentAnalyzer') -#process.p = cms.Path(process.GlobalTrackerMuonAlignment*process.dump) +#process.p = cms.Path(process.globalTrackerMuonAlignment*process.dump) # initialize magnetic field process.load("Configuration.StandardSequences.MagneticField_cff") @@ -98,8 +98,9 @@ #process.GlobalTag.globaltag = 'GR10_P_V3COS::All' ### write global Rcd to DB +from CondCore.CondDB.CondDB_cfi import * process.PoolDBOutputService = cms.Service("PoolDBOutputService", - process.CondDBSetup, + #process.CondDB, ### Writing to oracle needs the following shell variable setting (in zsh): ### export CORAL_AUTH_PATH=/afs/cern.ch/cms/DB/conddb ### string connect = "oracle://cms_orcoff_int2r/CMS_COND_ALIGNMENT" @@ -111,7 +112,7 @@ tag = cms.string('IdealGeometry') )) ) -process.CondDBSetup.DBParameters.messageLevel = 2 +process.CondDB.DBParameters.messageLevel = 2 ### read GlobalPositionRcd #process.GlobalTag.toGet = cms.VPSet(