CMS 3D CMS Logo

Public Member Functions | Private Attributes

HLTMuonPointingFilter Class Reference

#include <HLTMuonPointingFilter.h>

Inheritance diagram for HLTMuonPointingFilter:
HLTFilter edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual bool filter (edm::Event &, const edm::EventSetup &)
 HLTMuonPointingFilter (const edm::ParameterSet &)
 Constructor.
 ~HLTMuonPointingFilter ()
 Destructor.

Private Attributes

unsigned long long m_cacheRecordId
Cylinder::CylinderPointer theCyl
double theMaxZ
Plane::PlanePointer theNegPlane
Plane::PlanePointer thePosPlane
PropagatorthePropagator
std::string thePropagatorName
double theRadius
std::string theSTAMuonLabel

Detailed Description

HLTFilter to select muons that points to a cylinder of configurable radius and lenght.

Date:
2009/10/05 10:40:17
Revision:
1.3
Author:
Stefano Lacaprara - INFN Legnaro <stefano.lacaprara@pd.infn.it>

Definition at line 30 of file HLTMuonPointingFilter.h.


Constructor & Destructor Documentation

HLTMuonPointingFilter::HLTMuonPointingFilter ( const edm::ParameterSet pset)

Constructor.

Definition at line 37 of file HLTMuonPointingFilter.cc.

References newFWLiteAna::build, edm::ParameterSet::getParameter(), LogDebug, theCyl, theMaxZ, theNegPlane, thePosPlane, thePropagator, thePropagatorName, theRadius, and theSTAMuonLabel.

                                                                       : m_cacheRecordId(0) {

  // the name of the STA rec hits collection
  theSTAMuonLabel = pset.getParameter<string>("SALabel");

  thePropagatorName = pset.getParameter<std::string>("PropagatorName");
  thePropagator = 0;

  theRadius = pset.getParameter<double>("radius"); // cyl's radius (cm)
  theMaxZ = pset.getParameter<double>("maxZ"); // cyl's half lenght (cm)


  // Get a surface (here a cylinder of radius 1290mm) ECAL
  Cylinder::PositionType pos0;
  Cylinder::RotationType rot0;
  theCyl = Cylinder::build(pos0, rot0, theRadius);
    
  Plane::PositionType posPos(0,0,theMaxZ);
  Plane::PositionType posNeg(0,0,-theMaxZ);

  thePosPlane = Plane::build(posPos,rot0);
  theNegPlane = Plane::build(posNeg,rot0);

  LogDebug("HLTMuonPointing") << " SALabel : " << theSTAMuonLabel 
    << " Radius : " << theRadius
    << " Half lenght : " << theMaxZ;
}
HLTMuonPointingFilter::~HLTMuonPointingFilter ( )

Destructor.

Definition at line 66 of file HLTMuonPointingFilter.cc.

                                              {
}

Member Function Documentation

bool HLTMuonPointingFilter::filter ( edm::Event event,
const edm::EventSetup eventSetup 
) [virtual]

Implements HLTFilter.

Definition at line 70 of file HLTMuonPointingFilter.cc.

References accept(), anyDirection, edm::eventsetup::EventSetupRecord::cacheIdentifier(), TrajectoryStateOnSurface::freeState(), edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::get(), TrajectoryStateOnSurface::globalPosition(), reco::TransientTrack::innermostMeasurementState(), TrajectoryStateOnSurface::isValid(), LogDebug, m_cacheRecordId, PV3DBase< T, PVType, FrameType >::perp(), Propagator::propagate(), Propagator::setPropagationDirection(), muonTagProbeFilters_cff::staTracks, theCyl, theMaxZ, theNegPlane, thePosPlane, thePropagator, thePropagatorName, theRadius, theSTAMuonLabel, and PV3DBase< T, PVType, FrameType >::z().

                                                                                   {
  bool accept = false;

  const TrackingComponentsRecord & tkRec = eventSetup.get<TrackingComponentsRecord>();
  if (not thePropagator or tkRec.cacheIdentifier() != m_cacheRecordId) {
    ESHandle<Propagator> prop;
    tkRec.get(thePropagatorName, prop);
    thePropagator = prop->clone();
    thePropagator->setPropagationDirection(anyDirection);
    m_cacheRecordId = tkRec.cacheIdentifier();
  }

  ESHandle<MagneticField> theMGField;
  eventSetup.get<IdealMagneticFieldRecord>().get(theMGField);

  ESHandle<GlobalTrackingGeometry> theTrackingGeometry;
  eventSetup.get<GlobalTrackingGeometryRecord>().get(theTrackingGeometry);

  // Get the RecTrack collection from the event
  Handle<reco::TrackCollection> staTracks;
  event.getByLabel(theSTAMuonLabel, staTracks);

  reco::TrackCollection::const_iterator staTrack;

  for (staTrack = staTracks->begin(); staTrack != staTracks->end(); ++staTrack){
    reco::TransientTrack track(*staTrack,&*theMGField,theTrackingGeometry);

    TrajectoryStateOnSurface innerTSOS = track.innermostMeasurementState();

    LogDebug("HLTMuonPointing") << " InnerTSOS " << innerTSOS;

    TrajectoryStateOnSurface tsosAtCyl =
      thePropagator->propagate(*innerTSOS.freeState(), *theCyl);

    if ( tsosAtCyl.isValid() ) {
      LogDebug("HLTMuonPointing") << " extrap TSOS " << tsosAtCyl;
      if (fabs(tsosAtCyl.globalPosition().z())<theMaxZ ) {
        accept=true;
        return accept;
      }
      else { 
        LogDebug("HLTMuonPointing") << " extrap TSOS z too big " << tsosAtCyl.globalPosition().z();
        TrajectoryStateOnSurface tsosAtPlane;
        if (tsosAtCyl.globalPosition().z()>0)
          tsosAtPlane=thePropagator->propagate(*innerTSOS.freeState(), *thePosPlane);
        else
          tsosAtPlane=thePropagator->propagate(*innerTSOS.freeState(), *theNegPlane);

        if (tsosAtPlane.isValid()){
          if (tsosAtPlane.globalPosition().perp()< theRadius){
            accept=true;
            return accept;
          }
        }
        else
          LogDebug("HLTMuonPointing") << " extrap to plane failed ";
      }
    } else {
      LogDebug("HLTMuonPointing") << " extrap to cyl failed ";
    }

  }

  return accept;


}

Member Data Documentation

unsigned long long HLTMuonPointingFilter::m_cacheRecordId [private]

Definition at line 53 of file HLTMuonPointingFilter.h.

Referenced by filter().

Definition at line 49 of file HLTMuonPointingFilter.h.

Referenced by filter(), and HLTMuonPointingFilter().

Definition at line 47 of file HLTMuonPointingFilter.h.

Referenced by filter(), and HLTMuonPointingFilter().

Definition at line 50 of file HLTMuonPointingFilter.h.

Referenced by filter(), and HLTMuonPointingFilter().

Definition at line 50 of file HLTMuonPointingFilter.h.

Referenced by filter(), and HLTMuonPointingFilter().

Definition at line 52 of file HLTMuonPointingFilter.h.

Referenced by filter(), and HLTMuonPointingFilter().

Definition at line 45 of file HLTMuonPointingFilter.h.

Referenced by filter(), and HLTMuonPointingFilter().

Definition at line 46 of file HLTMuonPointingFilter.h.

Referenced by filter(), and HLTMuonPointingFilter().

Definition at line 44 of file HLTMuonPointingFilter.h.

Referenced by filter(), and HLTMuonPointingFilter().