CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTMuonPointingFilter.cc
Go to the documentation of this file.
1 
6 /* This Class Header */
8 
9 /* Collaborating Class Header */
19 
21 
29 
30 /* C++ Headers */
31 using namespace std;
32 using namespace edm;
33 
34 /* ====================================================================== */
35 
38  theSTAMuonToken( consumes<reco::TrackCollection>( pset.getParameter<edm::InputTag>("SALabel") ) ), // token to read the muons
39  thePropagatorName(pset.getParameter<std::string>("PropagatorName") ),
40  theRadius( pset.getParameter<double>("radius") ), // cyl's radius (cm)
41  theMaxZ( pset.getParameter<double>("maxZ") ), // cyl's half lenght (cm)
42  thePropagator(nullptr),
43  m_cacheRecordId(0)
44 {
45  // Get a surface (here a cylinder of radius 1290mm) ECAL
48  theCyl = Cylinder::build(theRadius, pos0, rot0);
49 
50  Plane::PositionType posPos(0,0,theMaxZ);
51  Plane::PositionType posNeg(0,0,-theMaxZ);
52 
53  thePosPlane = Plane::build(posPos,rot0);
54  theNegPlane = Plane::build(posNeg,rot0);
55 
56  LogDebug("HLTMuonPointing") << " SALabel : " << pset.getParameter<edm::InputTag>("SALabel")
57  << " Radius : " << theRadius
58  << " Half lenght : " << theMaxZ;
59 }
60 
63 }
64 
65 /* Operations */
67  bool accept = false;
68 
69  const TrackingComponentsRecord & tkRec = eventSetup.get<TrackingComponentsRecord>();
70  if (not thePropagator or tkRec.cacheIdentifier() != m_cacheRecordId) {
71  // delete the old propagator
72  delete thePropagator;
73 
74  // get the new propagator from the EventSetup and clone it (for thread safety)
75  ESHandle<Propagator> propagatorHandle;
76  tkRec.get(thePropagatorName, propagatorHandle);
77  thePropagator = propagatorHandle.product()->clone();
79  throw cms::Exception("Configuration") << "the propagator " << thePropagatorName << " should be configured with PropagationDirection = \"anyDirection\"" << std::endl;
81  }
82 
83  ESHandle<MagneticField> theMGField;
84  eventSetup.get<IdealMagneticFieldRecord>().get(theMGField);
85 
86  ESHandle<GlobalTrackingGeometry> theTrackingGeometry;
87  eventSetup.get<GlobalTrackingGeometryRecord>().get(theTrackingGeometry);
88 
89  // Get the RecTrack collection from the event
91  event.getByToken(theSTAMuonToken, staTracks);
92 
93  reco::TrackCollection::const_iterator staTrack;
94 
95  for (staTrack = staTracks->begin(); staTrack != staTracks->end(); ++staTrack){
96  reco::TransientTrack track(*staTrack,&*theMGField,theTrackingGeometry);
97 
99 
100  LogDebug("HLTMuonPointing") << " InnerTSOS " << innerTSOS;
101 
102  TrajectoryStateOnSurface tsosAtCyl =
103  thePropagator->propagate(*innerTSOS.freeState(), *theCyl);
104 
105  if ( tsosAtCyl.isValid() ) {
106  LogDebug("HLTMuonPointing") << " extrap TSOS " << tsosAtCyl;
107  if (fabs(tsosAtCyl.globalPosition().z())<theMaxZ ) {
108  accept=true;
109  return accept;
110  }
111  else {
112  LogDebug("HLTMuonPointing") << " extrap TSOS z too big " << tsosAtCyl.globalPosition().z();
113  TrajectoryStateOnSurface tsosAtPlane;
114  if (tsosAtCyl.globalPosition().z()>0)
115  tsosAtPlane=thePropagator->propagate(*innerTSOS.freeState(), *thePosPlane);
116  else
117  tsosAtPlane=thePropagator->propagate(*innerTSOS.freeState(), *theNegPlane);
118 
119  if (tsosAtPlane.isValid()){
120  if (tsosAtPlane.globalPosition().perp()< theRadius){
121  accept=true;
122  return accept;
123  }
124  }
125  else
126  LogDebug("HLTMuonPointing") << " extrap to plane failed ";
127  }
128  } else {
129  LogDebug("HLTMuonPointing") << " extrap to cyl failed ";
130  }
131 
132  }
133 
134  return accept;
135 }
136 
139 
140  desc.add<edm::InputTag>("SALabel", edm::InputTag("hltCosmicMuonBarrelOnly"));
141  desc.add<std::string>("PropagatorName", "SteppingHelixPropagatorAny");
142  desc.add<double>("radius", 90.0);
143  desc.add<double>("maxZ", 280.0);
144 
145  descriptions.add("hltMuonPointingFilter", desc);
146 }
147 
148 
149 // define this as a plug-in
#define LogDebug(id)
T getParameter(std::string const &) const
unsigned long long cacheIdentifier() const
virtual FreeTrajectoryState propagate(const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const final
Definition: Propagator.h:119
T perp() const
Definition: PV3DBase.h:72
virtual PropagationDirection propagationDirection() const
Definition: Propagator.h:155
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
HLTMuonPointingFilter(const edm::ParameterSet &)
Constructor.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
Plane::PlanePointer thePosPlane
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
GlobalPoint globalPosition() const
#define nullptr
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:24
Plane::PlanePointer theNegPlane
TrajectoryStateOnSurface innermostMeasurementState() const
virtual bool filter(edm::Event &, edm::EventSetup const &) override
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=0)
Definition: Cylinder.h:51
Cylinder::CylinderPointer theCyl
FreeTrajectoryState const * freeState(bool withErrors=true) const
T z() const
Definition: PV3DBase.h:64
void get(HolderT &iHolder) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
unsigned long long m_cacheRecordId
const edm::EDGetTokenT< reco::TrackCollection > theSTAMuonToken
~HLTMuonPointingFilter()
Destructor.
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const std::string thePropagatorName
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)