CMS 3D CMS Logo

PropagateToMuonSetup.h
Go to the documentation of this file.
1 #ifndef MuonAnalysis_MuonAssociators_interface_PropagateToMuonSetup_h
2 #define MuonAnalysis_MuonAssociators_interface_PropagateToMuonSetup_h
3 
21 
22 template <edm::Transition Tr>
24 public:
26  ~PropagateToMuonSetupT() = default;
27 
30  PropagateToMuon init(const edm::EventSetup &iSetup) const;
32  desc.add<bool>("useSimpleGeometry", true);
33  desc.add<bool>("useStation2", true);
34  desc.add<bool>("fallbackToME1", false);
35  desc.add<bool>("cosmicPropagationHypothesis", false);
36  desc.add<bool>("useMB2InOverlap", false);
37  desc.add<std::string>("useTrack", "tracker");
38  desc.add<std::string>("useState", "atVertex");
39  desc.add<edm::ESInputTag>("propagatorAlong", edm::ESInputTag("", "hltESPSteppingHelixPropagatorAlong"));
40  desc.add<edm::ESInputTag>("propagatorAny", edm::ESInputTag("", "SteppingHelixPropagatorAny"));
41  desc.add<edm::ESInputTag>("propagatorOpposite", edm::ESInputTag("", "hltESPSteppingHelixPropagatorOpposite"));
42  }
43 
44 private:
46  const bool useSimpleGeometry_;
47 
49  const bool useMB2_;
50 
52  const bool fallbackToME1_;
53 
57 
59  const bool cosmicPropagation_;
60 
61  const bool useMB2InOverlap_;
62 
67 };
68 
69 template <edm::Transition Tr>
71  : useSimpleGeometry_(iConfig.getParameter<bool>("useSimpleGeometry")),
72  useMB2_(iConfig.getParameter<bool>("useStation2")),
73  fallbackToME1_(iConfig.getParameter<bool>("fallbackToME1")),
74  whichTrack_(None),
75  whichState_(AtVertex),
76  cosmicPropagation_(iConfig.getParameter<bool>("cosmicPropagationHypothesis")),
77  useMB2InOverlap_(iConfig.getParameter<bool>("useMB2InOverlap")),
78  magfieldToken_(iC.esConsumes<Tr>()),
79  propagatorToken_(iC.esConsumes<Tr>(iConfig.getParameter<edm::ESInputTag>("propagatorAlong"))),
80  propagatorAnyToken_(iC.esConsumes<Tr>(iConfig.getParameter<edm::ESInputTag>("propagatorAny"))),
81  propagatorOppositeToken_(iC.esConsumes<Tr>(iConfig.getParameter<edm::ESInputTag>("propagatorOpposite"))),
82  muonGeometryToken_(iC.esConsumes<Tr>()) {
83  std::string whichTrack = iConfig.getParameter<std::string>("useTrack");
84  if (whichTrack == "none") {
85  whichTrack_ = None;
86  } else if (whichTrack == "tracker") {
88  } else if (whichTrack == "muon") {
90  } else if (whichTrack == "global") {
92  } else
93  throw cms::Exception("Configuration") << "Parameter 'useTrack' must be 'none', 'tracker', 'muon', 'global'\n";
94  if (whichTrack_ != None) {
95  std::string whichState = iConfig.getParameter<std::string>("useState");
96  if (whichState == "atVertex") {
98  } else if (whichState == "innermost") {
100  } else if (whichState == "outermost") {
102  } else
103  throw cms::Exception("Configuration") << "Parameter 'useState' must be 'atVertex', 'innermost', "
104  "'outermost'\n";
105  }
107  throw cms::Exception("Configuration") << "When using 'cosmicPropagationHypothesis' useTrack must not be "
108  "'none', and the state must not be 'atVertex'\n";
109  }
110 }
111 
112 template <edm::Transition Tr>
114  auto const magfield = iSetup.getHandle(magfieldToken_);
115  auto const propagator = iSetup.getHandle(propagatorToken_);
116  auto const propagatorOpposite = iSetup.getHandle(propagatorOppositeToken_);
117  auto const propagatorAny = iSetup.getHandle(propagatorAnyToken_);
118  auto const muonGeometry = iSetup.getHandle(muonGeometryToken_);
119 
120  return PropagateToMuon(magfield,
121  propagator,
124  muonGeometry,
125  useSimpleGeometry_,
126  useMB2_,
127  fallbackToME1_,
128  whichTrack_,
129  whichState_,
130  cosmicPropagation_,
131  useMB2InOverlap_);
132 }
133 
135 
136 #endif
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const bool cosmicPropagation_
for cosmics, some things change: the along-opposite is not in-out, nor the innermost/outermost states...
const edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorToken_
Propagate an object (usually a track) to the second (default) or first muon station.
WhichTrack
const edm::ESGetToken< MuonDetLayerGeometry, MuonRecoGeometryRecord > muonGeometryToken_
WhichState
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfieldToken_
const bool useMB2_
Propagate to MB2 (default) instead of MB1.
Propagate an object (usually a track) to the second (default) or first muon station.
PropagateToMuon init(const edm::EventSetup &iSetup) const
const edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorOppositeToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
HLT enums.
const edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorAnyToken_
const bool fallbackToME1_
Fallback to ME1 if propagation to ME2 fails.
WhichTrack whichTrack_
Labels for input collections.
static void fillPSetDescription(edm::ParameterSetDescription &desc)
~PropagateToMuonSetupT()=default
const bool useSimpleGeometry_
Use simplified geometry (cylinders and disks, not individual chambers)
PropagateToMuonSetupT(const edm::ParameterSet &iConfig, edm::ConsumesCollector)