From 55963f80b8535b86e0e011a6c6c218faf7ffcfd1 Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Wed, 10 Jun 2020 23:50:13 +0200 Subject: [PATCH 1/2] some buildfile related fixups --- CondCore/ESSources/bin/BuildFile.xml | 1 - .../CTPPSFastTrackingProducer/BuildFile.xml | 13 -- .../interface/CTPPSFastTrackingProducer.h | 143 ------------------ .../plugins/CTPPSFastTrackingProducer.cc | 116 +++++++++++++- .../L1CaloTriggerProducer/BuildFile.xml | 20 --- Utilities/ReleaseScripts/scripts/git-publish | 2 +- 6 files changed, 112 insertions(+), 183 deletions(-) delete mode 100644 CondCore/ESSources/bin/BuildFile.xml delete mode 100644 FastSimulation/CTPPSFastTrackingProducer/BuildFile.xml delete mode 100644 FastSimulation/CTPPSFastTrackingProducer/interface/CTPPSFastTrackingProducer.h delete mode 100644 FastSimulation/L1CaloTriggerProducer/BuildFile.xml diff --git a/CondCore/ESSources/bin/BuildFile.xml b/CondCore/ESSources/bin/BuildFile.xml deleted file mode 100644 index eb1f2027eea38..0000000000000 --- a/CondCore/ESSources/bin/BuildFile.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/FastSimulation/CTPPSFastTrackingProducer/BuildFile.xml b/FastSimulation/CTPPSFastTrackingProducer/BuildFile.xml deleted file mode 100644 index c40f3f3f82514..0000000000000 --- a/FastSimulation/CTPPSFastTrackingProducer/BuildFile.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/FastSimulation/CTPPSFastTrackingProducer/interface/CTPPSFastTrackingProducer.h b/FastSimulation/CTPPSFastTrackingProducer/interface/CTPPSFastTrackingProducer.h deleted file mode 100644 index 2b319ee00ba30..0000000000000 --- a/FastSimulation/CTPPSFastTrackingProducer/interface/CTPPSFastTrackingProducer.h +++ /dev/null @@ -1,143 +0,0 @@ -#ifndef FastSimulation_CTPPSFastTrackingProducer_h -#define FastSimulation_CTPPSFastTrackingProducer_h - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/StreamID.h" - -#include "FWCore/Framework/interface/ConsumesCollector.h" - -#include "FastSimDataFormats/CTPPSFastSim/interface/CTPPSFastRecHit.h" -#include "FastSimDataFormats/CTPPSFastSim/interface/CTPPSFastRecHitContainer.h" -#include "DataFormats/Common/interface/Handle.h" - -#include "FastSimDataFormats/CTPPSFastSim/interface/CTPPSFastTrack.h" -#include "FastSimDataFormats/CTPPSFastSim/interface/CTPPSFastTrackContainer.h" - -#include "FastSimulation/CTPPSFastGeometry/interface/CTPPSTrkDetector.h" -#include "FastSimulation/CTPPSFastGeometry/interface/CTPPSToFDetector.h" - -#include "FWCore/ParameterSet/interface/FileInPath.h" -#include "Utilities/PPS/interface/PPSUnitConversion.h" - -#include "Utilities/PPS/interface/PPSUtilities.h" - -//C++ library -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "DataFormats/Math/interface/Vector.h" -#include "DataFormats/Math/interface/Vector3D.h" -#include "DataFormats/Math/interface/Point3D.h" - -// -// class declaration -// -class H_BeamParticle; -class H_RecRPObject; -class H_BeamLine; - -class CTPPSFastTrackingProducer : public edm::stream::EDProducer<> { -public: - explicit CTPPSFastTrackingProducer(const edm::ParameterSet&); - ~CTPPSFastTrackingProducer() override; - -private: - void beginStream(edm::StreamID) override; - void produce(edm::Event&, const edm::EventSetup&) override; - void endStream() override; - //this function will only be called once per event - virtual void beginEvent(edm::Event& event, const edm::EventSetup& eventSetup); - virtual void endEvent(edm::Event& event, const edm::EventSetup& eventSetup); - - // ----------member data --------------------------- - - typedef std::vector CTPPSFastRecHitContainer; - edm::EDGetTokenT _recHitToken; - void ReadRecHits(edm::Handle&); - void FastReco(int Direction, H_RecRPObject* station); - void Reconstruction(); - void ReconstructArm( - H_RecRPObject* pps_station, double x1, double y1, double x2, double y2, double& tx, double& ty, double& eloss); - void MatchCellId(int cellId, std::vector vrecCellId, std::vector vrecTof, bool& match, double& recTof); - bool SearchTrack(int, - int, - int Direction, - double& xi, - double& t, - double& partP, - double& pt, - double& thx, - double& thy, - double& x0, - double& y0, - double& xt, - double& yt, - double& X1d, - double& Y1d, - double& X2d, - double& Y2d); - void TrackerStationClear(); - void TrackerStationStarting(); - void ProjectToToF(const double x1, const double y1, const double x2, const double y2, double& xt, double& yt) { - xt = ((fz_timing - fz_tracker2) * (x2 - x1) / (fz_tracker2 - fz_tracker1)) + x2; - yt = ((fz_timing - fz_tracker2) * (y2 - y1) / (fz_tracker2 - fz_tracker1)) + y2; - }; - // Hector objects - bool SetBeamLine(); - - std::map m_beamPart; - std::unique_ptr m_beamlineCTPPS1; - std::unique_ptr m_beamlineCTPPS2; - std::unique_ptr pps_stationF; - std::unique_ptr pps_stationB; - - std::string beam1filename; - std::string beam2filename; - - // Defaults - double lengthctpps; - bool m_verbosity; - double fBeamEnergy; - double fBeamMomentum; - bool fCrossAngleCorr; - double fCrossingAngleBeam1; - double fCrossingAngleBeam2; - //////////////////////////////////////////////// - std::unique_ptr TrkStation_F; // auxiliary object with the tracker geometry - std::unique_ptr TrkStation_B; - std::unique_ptr det1F; - std::unique_ptr det1B; - std::unique_ptr det2F; - std::unique_ptr det2B; - std::unique_ptr detToF_F; - std::unique_ptr detToF_B; - - std::vector theCTPPSFastTrack; - - CTPPSFastTrack track; - - std::vector recCellId_F, recCellId_B; - std::vector recTof_F, recTof_B; - - double fz_tracker1, fz_tracker2, fz_timing; - double fTrackerWidth, fTrackerHeight, fTrackerInsertion, fBeamXRMS_Trk1, fBeamXRMS_Trk2, fTrk1XOffset, fTrk2XOffset; - std::vector fToFCellWidth; - double fToFCellHeight, fToFPitchX, fToFPitchY; - int fToFNCellX, fToFNCellY; - double fToFInsertion, fBeamXRMS_ToF, fToFXOffset, fTimeSigma, fImpParcut; -}; -#endif diff --git a/FastSimulation/CTPPSFastTrackingProducer/plugins/CTPPSFastTrackingProducer.cc b/FastSimulation/CTPPSFastTrackingProducer/plugins/CTPPSFastTrackingProducer.cc index c7db749ad318e..9984f2b3f430f 100644 --- a/FastSimulation/CTPPSFastTrackingProducer/plugins/CTPPSFastTrackingProducer.cc +++ b/FastSimulation/CTPPSFastTrackingProducer/plugins/CTPPSFastTrackingProducer.cc @@ -16,18 +16,124 @@ Description: [one line class summary] // // -// system include files -#include - -// user include files -#include "FastSimulation/CTPPSFastTrackingProducer/interface/CTPPSFastTrackingProducer.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Math/interface/Vector.h" +#include "DataFormats/Math/interface/Vector3D.h" +#include "DataFormats/Math/interface/Point3D.h" +#include "FastSimDataFormats/CTPPSFastSim/interface/CTPPSFastRecHit.h" +#include "FastSimDataFormats/CTPPSFastSim/interface/CTPPSFastRecHitContainer.h" +#include "FastSimDataFormats/CTPPSFastSim/interface/CTPPSFastTrack.h" +#include "FastSimDataFormats/CTPPSFastSim/interface/CTPPSFastTrackContainer.h" +#include "FastSimulation/CTPPSFastGeometry/interface/CTPPSToFDetector.h" +#include "FastSimulation/CTPPSFastGeometry/interface/CTPPSTrkDetector.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/ParameterSet/interface/FileInPath.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/StreamID.h" +#include "Utilities/PPS/interface/PPSUnitConversion.h" #include "Utilities/PPS/interface/PPSUtilities.h" + #include "TLorentzVector.h" + // hector includes #include "H_Parameters.h" #include "H_BeamLine.h" #include "H_RecRPObject.h" #include "H_BeamParticle.h" + +class CTPPSFastTrackingProducer : public edm::stream::EDProducer<> { +public: + explicit CTPPSFastTrackingProducer(const edm::ParameterSet&); + ~CTPPSFastTrackingProducer() override; + +private: + void beginStream(edm::StreamID) override; + void produce(edm::Event&, const edm::EventSetup&) override; + void endStream() override; + //this function will only be called once per event + virtual void beginEvent(edm::Event& event, const edm::EventSetup& eventSetup); + virtual void endEvent(edm::Event& event, const edm::EventSetup& eventSetup); + + // ----------member data --------------------------- + + typedef std::vector CTPPSFastRecHitContainer; + edm::EDGetTokenT _recHitToken; + void ReadRecHits(edm::Handle&); + void FastReco(int Direction, H_RecRPObject* station); + void Reconstruction(); + void ReconstructArm( + H_RecRPObject* pps_station, double x1, double y1, double x2, double y2, double& tx, double& ty, double& eloss); + void MatchCellId(int cellId, std::vector vrecCellId, std::vector vrecTof, bool& match, double& recTof); + bool SearchTrack(int, + int, + int Direction, + double& xi, + double& t, + double& partP, + double& pt, + double& thx, + double& thy, + double& x0, + double& y0, + double& xt, + double& yt, + double& X1d, + double& Y1d, + double& X2d, + double& Y2d); + void TrackerStationClear(); + void TrackerStationStarting(); + void ProjectToToF(const double x1, const double y1, const double x2, const double y2, double& xt, double& yt) { + xt = ((fz_timing - fz_tracker2) * (x2 - x1) / (fz_tracker2 - fz_tracker1)) + x2; + yt = ((fz_timing - fz_tracker2) * (y2 - y1) / (fz_tracker2 - fz_tracker1)) + y2; + }; + // Hector objects + bool SetBeamLine(); + + std::map m_beamPart; + std::unique_ptr m_beamlineCTPPS1; + std::unique_ptr m_beamlineCTPPS2; + std::unique_ptr pps_stationF; + std::unique_ptr pps_stationB; + + std::string beam1filename; + std::string beam2filename; + + // Defaults + double lengthctpps; + bool m_verbosity; + double fBeamEnergy; + double fBeamMomentum; + bool fCrossAngleCorr; + double fCrossingAngleBeam1; + double fCrossingAngleBeam2; + //////////////////////////////////////////////// + std::unique_ptr TrkStation_F; // auxiliary object with the tracker geometry + std::unique_ptr TrkStation_B; + std::unique_ptr det1F; + std::unique_ptr det1B; + std::unique_ptr det2F; + std::unique_ptr det2B; + std::unique_ptr detToF_F; + std::unique_ptr detToF_B; + + std::vector theCTPPSFastTrack; + + CTPPSFastTrack track; + + std::vector recCellId_F, recCellId_B; + std::vector recTof_F, recTof_B; + + double fz_tracker1, fz_tracker2, fz_timing; + double fTrackerWidth, fTrackerHeight, fTrackerInsertion, fBeamXRMS_Trk1, fBeamXRMS_Trk2, fTrk1XOffset, fTrk2XOffset; + std::vector fToFCellWidth; + double fToFCellHeight, fToFPitchX, fToFPitchY; + int fToFNCellX, fToFNCellY; + double fToFInsertion, fBeamXRMS_ToF, fToFXOffset, fTimeSigma, fImpParcut; +}; ////////////////////// // constructors and destructor // diff --git a/FastSimulation/L1CaloTriggerProducer/BuildFile.xml b/FastSimulation/L1CaloTriggerProducer/BuildFile.xml deleted file mode 100644 index c0b11f4c7a801..0000000000000 --- a/FastSimulation/L1CaloTriggerProducer/BuildFile.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/Utilities/ReleaseScripts/scripts/git-publish b/Utilities/ReleaseScripts/scripts/git-publish index e8f5dd658ba14..1aded34ab031e 100755 --- a/Utilities/ReleaseScripts/scripts/git-publish +++ b/Utilities/ReleaseScripts/scripts/git-publish @@ -455,7 +455,7 @@ CMSSW_CATEGORIES={"Operations": ["Configuration/Applications", "FastSimulation/Configuration", "FastSimulation/EgammaElectronAlgos", "FastSimulation/Event", "FastSimulation/EventProducer", "FastSimulation/ForwardDetectors", "FastSimulation/HighLevelTrigger", - "FastSimulation/L1CaloTriggerProducer", "FastSimulation/MaterialEffects", + "FastSimulation/MaterialEffects", "FastSimulation/MuonSimHitProducer", "FastSimulation/Muons", "FastSimulation/Particle", "FastSimulation/ParticleDecay", "FastSimulation/ParticleFlow", "FastSimulation/ParticlePropagator", From 9934e5d48cecbdc21c70d0a1e43fdd47cd337611 Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Mon, 15 Jun 2020 03:00:08 +0200 Subject: [PATCH 2/2] implement review comments --- .../plugins/CTPPSFastTrackingProducer.cc | 27 +--- .../CTPPSRecHitProducer/BuildFile.xml | 11 -- .../interface/MuonSimHitProducer.h | 106 --------------- .../{ => plugins}/BuildFile.xml | 4 +- .../{src => plugins}/MuonSimHitProducer.cc | 128 ++++++++++-------- 5 files changed, 77 insertions(+), 199 deletions(-) delete mode 100644 FastSimulation/CTPPSRecHitProducer/BuildFile.xml delete mode 100644 FastSimulation/MuonSimHitProducer/interface/MuonSimHitProducer.h rename FastSimulation/MuonSimHitProducer/{ => plugins}/BuildFile.xml (88%) rename FastSimulation/MuonSimHitProducer/{src => plugins}/MuonSimHitProducer.cc (92%) diff --git a/FastSimulation/CTPPSFastTrackingProducer/plugins/CTPPSFastTrackingProducer.cc b/FastSimulation/CTPPSFastTrackingProducer/plugins/CTPPSFastTrackingProducer.cc index 9984f2b3f430f..b9182dee29fb5 100644 --- a/FastSimulation/CTPPSFastTrackingProducer/plugins/CTPPSFastTrackingProducer.cc +++ b/FastSimulation/CTPPSFastTrackingProducer/plugins/CTPPSFastTrackingProducer.cc @@ -47,15 +47,9 @@ Description: [one line class summary] class CTPPSFastTrackingProducer : public edm::stream::EDProducer<> { public: explicit CTPPSFastTrackingProducer(const edm::ParameterSet&); - ~CTPPSFastTrackingProducer() override; private: - void beginStream(edm::StreamID) override; void produce(edm::Event&, const edm::EventSetup&) override; - void endStream() override; - //this function will only be called once per event - virtual void beginEvent(edm::Event& event, const edm::EventSetup& eventSetup); - virtual void endEvent(edm::Event& event, const edm::EventSetup& eventSetup); // ----------member data --------------------------- @@ -93,7 +87,6 @@ class CTPPSFastTrackingProducer : public edm::stream::EDProducer<> { // Hector objects bool SetBeamLine(); - std::map m_beamPart; std::unique_ptr m_beamlineCTPPS1; std::unique_ptr m_beamlineCTPPS2; std::unique_ptr pps_stationF; @@ -213,11 +206,7 @@ CTPPSFastTrackingProducer::CTPPSFastTrackingProducer(const edm::ParameterSet& iC fToFNCellX, fToFNCellY, vToFCellWidth, fToFCellHeight, fToFPitchX, fToFPitchY, pos_tof, fTimeSigma)); // } -CTPPSFastTrackingProducer::~CTPPSFastTrackingProducer() { - for (std::map::iterator it = m_beamPart.begin(); it != m_beamPart.end(); ++it) { - delete (*it).second; - } -} + // ------------ method called to produce the data ------------ void CTPPSFastTrackingProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; @@ -241,13 +230,6 @@ void CTPPSFastTrackingProducer::produce(edm::Event& iEvent, const edm::EventSetu iEvent.put(std::move(output_tracks), "CTPPSFastTrack"); } //end -void CTPPSFastTrackingProducer::beginEvent(edm::Event& event, const edm::EventSetup& eventSetup) { - TrackerStationStarting(); -} -//////////////////// -void CTPPSFastTrackingProducer::endEvent(edm::Event& event, const edm::EventSetup& eventSetup) { - TrackerStationClear(); -} ///////////////////////// void CTPPSFastTrackingProducer::TrackerStationClear() { @@ -525,13 +507,6 @@ void CTPPSFastTrackingProducer::FastReco(int Direction, H_RecRPObject* station) } } //end FastReco -// ------------ method called once each stream before processing any runs, lumis or events ------------ - -void CTPPSFastTrackingProducer::beginStream(edm::StreamID) {} - -// ------------ method called once each stream after processing all runs, lumis and events ------------ - -void CTPPSFastTrackingProducer::endStream() {} bool CTPPSFastTrackingProducer::SetBeamLine() { edm::FileInPath b1(beam1filename.c_str()); edm::FileInPath b2(beam2filename.c_str()); diff --git a/FastSimulation/CTPPSRecHitProducer/BuildFile.xml b/FastSimulation/CTPPSRecHitProducer/BuildFile.xml deleted file mode 100644 index 2ccee5e7ba018..0000000000000 --- a/FastSimulation/CTPPSRecHitProducer/BuildFile.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/FastSimulation/MuonSimHitProducer/interface/MuonSimHitProducer.h b/FastSimulation/MuonSimHitProducer/interface/MuonSimHitProducer.h deleted file mode 100644 index 589c69d498adb..0000000000000 --- a/FastSimulation/MuonSimHitProducer/interface/MuonSimHitProducer.h +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef FastSimulation_MuonSimHitProducer_MuonSimHitProducer_h -#define FastSimulation_MuonSimHitProducer_MuonSimHitProducer_h - -// -// Package: MuonSimHitProducer -// Class: MuonSimHitProducer -// -/**\class MuonSimHitProducer MuonSimHitProducer.cc FastSimulation/MuonSimHitProducer/src/MuonSimHitProducer.cc - - Description: - - Implementation: - -*/ -// -// Author: Martijn Mulders -// Created: Wed July 11 12:37:24 CET 2007 -// $Id: MuonSimHitProducer.h,v 1.10 2010/05/13 15:23:21 aperrott Exp $ -// - -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimator.h" -#include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h" - -// FastSimulation headers -class MagneticField; -class TrackerGeometry; -class DTGeometry; -class CSCGeometry; -class RPCGeometry; -class MuonServiceProxy; -class MaterialEffects; -class TrajectoryStateOnSurface; -class Propagator; -class RandomEngineAndDistribution; -class SimTrack; -class SimVertex; -/* -namespace reco { - class Muon; -} -*/ - -namespace edm { - class ParameterSet; - class Event; - class EventSetup; -} // namespace edm - -// -// class declaration -// - -class MuonSimHitProducer : public edm::stream::EDProducer<> { -public: - explicit MuonSimHitProducer(const edm::ParameterSet&); - ~MuonSimHitProducer() override; - -private: - MuonServiceProxy* theService; - Chi2MeasurementEstimator theEstimator; - - const MagneticField* magfield; - const DTGeometry* dtGeom; - const CSCGeometry* cscGeom; - const RPCGeometry* rpcGeom; - const Propagator* propagatorWithMaterial; - Propagator* propagatorWithoutMaterial; - - MaterialEffects* theMaterialEffects; - - void beginRun(edm::Run const& run, const edm::EventSetup& es) override; - void produce(edm::Event&, const edm::EventSetup&) override; - void readParameters(const edm::ParameterSet&, const edm::ParameterSet&, const edm::ParameterSet&); - - // Parameters to emulate the muonSimHit association inefficiency due to delta's - double kDT; - double fDT; - double kCSC; - double fCSC; - - /// Simulate material effects in iron (dE/dx, multiple scattering) - void applyMaterialEffects(TrajectoryStateOnSurface& tsosWithdEdx, - TrajectoryStateOnSurface& tsos, - double radPath, - RandomEngineAndDistribution const*, - HepPDT::ParticleDataTable const&); - - // ----------- parameters ---------------------------- - bool fullPattern_; - bool doL1_, doL3_, doGL_; - - // tags - edm::InputTag simMuonLabel; - edm::InputTag simVertexLabel; - - // tokens - edm::EDGetTokenT > simMuonToken; - edm::EDGetTokenT > simVertexToken; -}; - -#endif diff --git a/FastSimulation/MuonSimHitProducer/BuildFile.xml b/FastSimulation/MuonSimHitProducer/plugins/BuildFile.xml similarity index 88% rename from FastSimulation/MuonSimHitProducer/BuildFile.xml rename to FastSimulation/MuonSimHitProducer/plugins/BuildFile.xml index 03a01b128fa5b..a2b6c314bfd6d 100644 --- a/FastSimulation/MuonSimHitProducer/BuildFile.xml +++ b/FastSimulation/MuonSimHitProducer/plugins/BuildFile.xml @@ -20,4 +20,6 @@ - + + + diff --git a/FastSimulation/MuonSimHitProducer/src/MuonSimHitProducer.cc b/FastSimulation/MuonSimHitProducer/plugins/MuonSimHitProducer.cc similarity index 92% rename from FastSimulation/MuonSimHitProducer/src/MuonSimHitProducer.cc rename to FastSimulation/MuonSimHitProducer/plugins/MuonSimHitProducer.cc index fa8c89c9e835a..37a4dd4d24eb6 100644 --- a/FastSimulation/MuonSimHitProducer/src/MuonSimHitProducer.cc +++ b/FastSimulation/MuonSimHitProducer/plugins/MuonSimHitProducer.cc @@ -20,54 +20,80 @@ // // -// CMSSW headers -#include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -// Fast Simulation headers -#include "FastSimulation/Utilities/interface/RandomEngineAndDistribution.h" -#include "FastSimulation/MuonSimHitProducer/interface/MuonSimHitProducer.h" +#include "DataFormats/GeometrySurface/interface/PlaneBuilder.h" +#include "DataFormats/GeometrySurface/interface/TangentPlane.h" +#include "DataFormats/MuonDetId/interface/DTWireId.h" +#include "FastSimulation/MaterialEffects/interface/EnergyLossSimulator.h" #include "FastSimulation/MaterialEffects/interface/MaterialEffects.h" #include "FastSimulation/MaterialEffects/interface/MultipleScatteringSimulator.h" -#include "FastSimulation/MaterialEffects/interface/EnergyLossSimulator.h" -#include "FastSimulation/ParticlePropagator/interface/ParticlePropagator.h" #include "FastSimulation/MaterialEffects/interface/MuonBremsstrahlungSimulator.h" - -// SimTrack -#include "SimDataFormats/Track/interface/SimTrack.h" -#include "SimDataFormats/Vertex/interface/SimVertex.h" -#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" - -// STL headers -#include -#include - -// RecoMuon headers -#include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h" -#include "RecoMuon/Navigation/interface/DirectMuonNavigation.h" -#include "RecoMuon/MeasurementDet/interface/MuonDetLayerMeasurements.h" -#include "RecoMuon/TrackingTools/interface/MuonPatternRecoDumper.h" - -// Tracking Tools -#include "TrackingTools/GeomPropagators/interface/HelixArbitraryPlaneCrossing.h" -#include "TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixPropagator.h" - -// Data Formats -#include "DataFormats/MuonDetId/interface/DTWireId.h" -#include "DataFormats/GeometrySurface/interface/PlaneBuilder.h" -#include "DataFormats/GeometrySurface/interface/TangentPlane.h" - -//////////////////////////////////////////////////////////////////////////// -// Geometry, Magnetic Field -#include "Geometry/DTGeometry/interface/DTGeometry.h" +#include "FastSimulation/ParticlePropagator/interface/ParticlePropagator.h" +#include "FastSimulation/Utilities/interface/RandomEngineAndDistribution.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "Geometry/CSCGeometry/interface/CSCGeometry.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" #include "Geometry/RPCGeometry/interface/RPCGeometry.h" #include "Geometry/Records/interface/MuonGeometryRecord.h" #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" - -////////////////////// Now find detector IDs: - -// #include "TrackingTools/TrackAssociator/interface/TrackDetectorAssociator.h" +#include "RecoMuon/MeasurementDet/interface/MuonDetLayerMeasurements.h" +#include "RecoMuon/Navigation/interface/DirectMuonNavigation.h" +#include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h" +#include "RecoMuon/TrackingTools/interface/MuonPatternRecoDumper.h" +#include "SimDataFormats/Track/interface/SimTrack.h" +#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" +#include "SimDataFormats/Vertex/interface/SimVertex.h" +#include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h" +#include "TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixPropagator.h" +#include "TrackingTools/GeomPropagators/interface/HelixArbitraryPlaneCrossing.h" +#include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimator.h" + +class MuonSimHitProducer : public edm::stream::EDProducer<> { +public: + explicit MuonSimHitProducer(const edm::ParameterSet&); + +private: + MuonServiceProxy* theService; + Chi2MeasurementEstimator theEstimator; + + const MagneticField* magfield; + const DTGeometry* dtGeom; + const CSCGeometry* cscGeom; + const RPCGeometry* rpcGeom; + const Propagator* propagatorWithMaterial; + std::unique_ptr propagatorWithoutMaterial; + + std::unique_ptr theMaterialEffects; + + void beginRun(edm::Run const& run, const edm::EventSetup& es) override; + void produce(edm::Event&, const edm::EventSetup&) override; + void readParameters(const edm::ParameterSet&, const edm::ParameterSet&, const edm::ParameterSet&); + + // Parameters to emulate the muonSimHit association inefficiency due to delta's + double kDT; + double fDT; + double kCSC; + double fCSC; + + /// Simulate material effects in iron (dE/dx, multiple scattering) + void applyMaterialEffects(TrajectoryStateOnSurface& tsosWithdEdx, + TrajectoryStateOnSurface& tsos, + double radPath, + RandomEngineAndDistribution const*, + HepPDT::ParticleDataTable const&); + + // ----------- parameters ---------------------------- + bool fullPattern_; + bool doL1_, doL3_, doGL_; + + // tags + edm::InputTag simMuonLabel; + edm::InputTag simVertexLabel; + + // tokens + edm::EDGetTokenT > simMuonToken; + edm::EDGetTokenT > simVertexToken; +}; //for debug only //#define FAMOS_DEBUG @@ -121,19 +147,10 @@ void MuonSimHitProducer::beginRun(edm::Run const& run, const edm::EventSetup& es // A few propagators propagatorWithMaterial = &(*(theService->propagator("SteppingHelixPropagatorAny"))); - propagatorWithoutMaterial = propagatorWithMaterial->clone(); - SteppingHelixPropagator* SHpropagator = dynamic_cast(propagatorWithoutMaterial); // Beuark! - SHpropagator->setMaterialMode(true); // switches OFF material effects; -} - -MuonSimHitProducer::~MuonSimHitProducer() { - // do anything here that needs to be done at destruction time - // (e.g. close files, deallocate resources etc.) - - if (theMaterialEffects) - delete theMaterialEffects; - if (propagatorWithoutMaterial) - delete propagatorWithoutMaterial; + propagatorWithoutMaterial.reset(propagatorWithMaterial->clone()); + SteppingHelixPropagator* SHpropagator = + dynamic_cast(propagatorWithoutMaterial.get()); // Beuark! + SHpropagator->setMaterialMode(true); // switches OFF material effects; } // @@ -532,7 +549,7 @@ void MuonSimHitProducer::readParameters(const edm::ParameterSet& fastMuons, if (matEff.getParameter("PairProduction") || matEff.getParameter("Bremsstrahlung") || matEff.getParameter("MuonBremsstrahlung") || matEff.getParameter("EnergyLoss") || matEff.getParameter("MultipleScattering")) - theMaterialEffects = new MaterialEffects(matEff); + theMaterialEffects = std::make_unique(matEff); } void MuonSimHitProducer::applyMaterialEffects(TrajectoryStateOnSurface& tsosWithdEdx, @@ -615,4 +632,5 @@ void MuonSimHitProducer::applyMaterialEffects(TrajectoryStateOnSurface& tsosWith } //define this as a plug-in +#include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(MuonSimHitProducer);