CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
MuonReSeeder Class Reference
Inheritance diagram for MuonReSeeder:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 MuonReSeeder (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
virtual ~MuonReSeeder ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

bool debug_
 Dump deug information. More...
 
bool insideOut_
 Do inside-out. More...
 
int layersToKeep_
 How many hits to keep from the muon trajectory. More...
 
TrackTransformer refitter_
 Track Transformer. More...
 
StringCutObjectSelector< reco::Muonselector_
 Muon selection. More...
 
edm::EDGetTokenT< edm::View< reco::Muon > > src_
 Labels for input collections. More...
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 31 of file MuonReSeeder.cc.

Constructor & Destructor Documentation

MuonReSeeder::MuonReSeeder ( const edm::ParameterSet iConfig)
explicit

Definition at line 59 of file MuonReSeeder.cc.

59  :
61  selector_(iConfig.existsAs<std::string>("cut") ? iConfig.getParameter<std::string>("cut") : "", true),
62  layersToKeep_(iConfig.getParameter<int32_t>("layersToKeep")),
63  insideOut_(iConfig.getParameter<bool>("insideOut")),
64  debug_(iConfig.getUntrackedParameter<bool>("debug",false)),
65  refitter_(iConfig)
66 {
67  produces<std::vector<TrajectorySeed> >();
68 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
TrackTransformer refitter_
Track Transformer.
Definition: MuonReSeeder.cc:55
StringCutObjectSelector< reco::Muon > selector_
Muon selection.
Definition: MuonReSeeder.cc:43
bool debug_
Dump deug information.
Definition: MuonReSeeder.cc:52
int layersToKeep_
How many hits to keep from the muon trajectory.
Definition: MuonReSeeder.cc:46
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
bool insideOut_
Do inside-out.
Definition: MuonReSeeder.cc:49
edm::EDGetTokenT< edm::View< reco::Muon > > src_
Labels for input collections.
Definition: MuonReSeeder.cc:40
virtual MuonReSeeder::~MuonReSeeder ( )
inlinevirtual

Definition at line 34 of file MuonReSeeder.cc.

References iEvent, and produce().

34 { }

Member Function Documentation

void MuonReSeeder::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Definition at line 71 of file MuonReSeeder.cc.

References funct::abs(), alongMomentum, gather_cfg::cout, debug_, DEFINE_FWK_MODULE, end, reco::LeafCandidate::eta(), edm::OwnVector< T, P >::front(), TrackingRecHit::geographicalId(), edm::EventSetup::get(), edm::Event::getByToken(), TrajectoryStateOnSurface::globalPosition(), TrackingRecHit::hit(), mps_fire::i, insideOut_, edm::Ref< C, T, F >::isNull(), TrajectoryStateOnSurface::isValid(), TrackingRecHit::isValid(), TrackerTopology::layer(), layersToKeep_, eostools::move(), RPCpg::mu, oppositeToMomentum, MillePedeFileConverter_cfg::out, PV3DBase< T, PVType, FrameType >::perp(), trajectoryStateTransform::persistentState(), reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), edm::OwnVector< T, P >::push_back(), edm::Event::put(), DetId::rawId(), TrajectoryMeasurement::recHit(), refitter_, SurveyInfoScenario_cff::seed, selector_, TrackTransformer::setServices(), TrackRefitter_38T_cff::src, src_, DetId::subdetId(), reco::Muon::track(), TrackTransformer::transform(), TrajectoryMeasurement::updatedState(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by ~MuonReSeeder().

71  {
72  using namespace edm;
73  using namespace std;
74 
75  refitter_.setServices(iSetup);
76 
78  iEvent.getByToken(src_, src);
79 
80  //Retrieve tracker topology from geometry
82  iSetup.get<TrackerTopologyRcd>().get(tTopo);
83 
84  auto out = std::make_unique<std::vector<TrajectorySeed>>();
85  unsigned int nsrc = src->size();
86  out->reserve(nsrc);
87 
88  for (View<reco::Muon>::const_iterator it = src->begin(), ed = src->end(); it != ed; ++it) {
89  const reco::Muon &mu = *it;
90  if (mu.track().isNull() || !selector_(mu)) continue;
91  std::vector<Trajectory> traj = refitter_.transform(*mu.track());
92  if (traj.size() != 1) continue;
94  const std::vector<TrajectoryMeasurement> & tms = traj.front().measurements();
96  bool fromInside = (insideOut_ == (traj.front().direction() == alongMomentum));
97  if (debug_) {
98  std::cout << "Considering muon of pt " << mu.pt() << ", eta = " << mu.eta() << ", phi = " << mu.phi() << std::endl;
99  std::cout << "Trajectory is " << (traj.front().direction() == alongMomentum ? "along" : "opposite") << " to momentum, so will start from " << (fromInside ? "inside" : "outside") << std::endl;
100  }
101  const TrajectoryMeasurement & tin = (fromInside ? tms.front() : tms.back());
102  const TrajectoryMeasurement & tou = (fromInside ? tms.front() : tms.back());
103  if (debug_) {
104  std::cout << "IN state: subdetector = " << tin.recHit()->geographicalId().subdetId() << std::endl;
105  std::cout << " global pos Rho " << tin.updatedState().globalPosition().perp() << ", Z " << tin.updatedState().globalPosition().z() << std::endl;
106  std::cout << "OU state: subdetector = " << tou.recHit()->geographicalId().subdetId() << std::endl;
107  std::cout << " global pos Rho " << tou.updatedState().globalPosition().perp() << ", Z " << tou.updatedState().globalPosition().z() << std::endl;
108  }
109  int lastSubdet = 0, lastLayer = -1;
110  for (int i = (fromInside ? 0 : tms.size()-1),
111  end = (fromInside ? tms.size() : -1),
112  step = (fromInside ? +1 : -1),
113  taken = 0; (end-i)*step > 0; i += step) {
114  const TrackingRecHit *lastHit = hit;
115  hit = tms[i].recHit()->hit();
116  if (debug_) std::cout << " considering hit " << i << ": rechit on " << (hit ? hit->geographicalId().rawId() : -1) << std::endl;
117  if (!hit) continue;
118  int subdet = hit->geographicalId().subdetId();
119  int lay = tTopo->layer(hit->geographicalId());
120  if (subdet != lastSubdet || lay != lastLayer) {
121  // I'm on a new layer
122  if (lastHit != 0 && taken == layersToKeep_) {
123  // I've had enough layers, I can stop here
124  hit = lastHit;
125  break;
126  }
127  lastSubdet = subdet; lastLayer = lay;
128  taken++;
129  }
130  seedHits.push_back(*hit);
131  tsos = tms[i].updatedState().isValid() ? tms[i].updatedState() :
132  (abs(i-end) < abs(i) ? tms[i].forwardPredictedState() : tms[i].backwardPredictedState());
133  if (debug_) {
134  std::cout << " hit : subdetector = " << tms[i].recHit()->geographicalId().subdetId() << std::endl;
135  if (hit->isValid()) {
136  std::cout << " global pos Rho " << tms[i].recHit()->globalPosition().perp() << ", Z " << tms[i].recHit()->globalPosition().z() << std::endl;
137  } else {
138  std::cout << " invalid tracking rec hit, so no global position" << std::endl;
139  }
140  std::cout << " state: global pos Rho " << tsos.globalPosition().perp() << ", Z " << tsos.globalPosition().z() << std::endl;
141  }
142  }
143  if (!tsos.isValid()) continue;
146  out->push_back(seed);
147  }
148 
149  iEvent.put(std::move(out));
150 }
virtual double pt() const final
transverse momentum
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
TrackTransformer refitter_
Track Transformer.
Definition: MuonReSeeder.cc:55
T perp() const
Definition: PV3DBase.h:72
void setServices(const edm::EventSetup &) override
set the services needed by the TrackTransformer
ConstRecHitPointer const & recHit() const
virtual double eta() const final
momentum pseudorapidity
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
StringCutObjectSelector< reco::Muon > selector_
Muon selection.
Definition: MuonReSeeder.cc:43
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
virtual TrackRef track() const
reference to a Track
Definition: Muon.h:49
GlobalPoint globalPosition() const
bool debug_
Dump deug information.
Definition: MuonReSeeder.cc:52
int layersToKeep_
How many hits to keep from the muon trajectory.
Definition: MuonReSeeder.cc:46
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
virtual double phi() const final
momentum azimuthal angle
void push_back(D *&d)
Definition: OwnVector.h:290
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const int mu
Definition: Constants.h:22
#define end
Definition: vmac.h:37
bool insideOut_
Do inside-out.
Definition: MuonReSeeder.cc:49
edm::EDGetTokenT< edm::View< reco::Muon > > src_
Labels for input collections.
Definition: MuonReSeeder.cc:40
std::vector< Trajectory > transform(const reco::Track &) const override
Convert a reco::Track into Trajectory.
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
bool isNull() const
Checks for null.
Definition: Ref.h:250
virtual TrackingRecHit const * hit() const
const T & get() const
Definition: EventSetup.h:55
bool isValid() const
unsigned int layer(const DetId &id) const
HLT enums.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
TrajectoryStateOnSurface const & updatedState() const
step
DetId geographicalId() const
reference front()
Definition: OwnVector.h:423
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

bool MuonReSeeder::debug_
private

Dump deug information.

Definition at line 52 of file MuonReSeeder.cc.

Referenced by produce().

bool MuonReSeeder::insideOut_
private

Do inside-out.

Definition at line 49 of file MuonReSeeder.cc.

Referenced by produce().

int MuonReSeeder::layersToKeep_
private

How many hits to keep from the muon trajectory.

Definition at line 46 of file MuonReSeeder.cc.

Referenced by produce().

TrackTransformer MuonReSeeder::refitter_
private

Track Transformer.

Definition at line 55 of file MuonReSeeder.cc.

Referenced by produce().

StringCutObjectSelector<reco::Muon> MuonReSeeder::selector_
private

Muon selection.

Definition at line 43 of file MuonReSeeder.cc.

Referenced by produce().

edm::EDGetTokenT<edm::View<reco::Muon> > MuonReSeeder::src_
private

Labels for input collections.

Definition at line 40 of file MuonReSeeder.cc.

Referenced by produce().