CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Attributes
GlobalMuonRefitter Class Reference

#include <GlobalMuonRefitter.h>

Public Types

typedef
MuonTransientTrackingRecHit::ConstMuonRecHitContainer 
ConstMuonRecHitContainer
 
typedef
MuonTransientTrackingRecHit::ConstMuonRecHitPointer 
ConstMuonRecHitPointer
 
typedef
TransientTrackingRecHit::ConstRecHitContainer 
ConstRecHitContainer
 
typedef
TransientTrackingRecHit::ConstRecHitPointer 
ConstRecHitPointer
 
typedef
MuonTransientTrackingRecHit::MuonRecHitContainer 
MuonRecHitContainer
 
typedef
MuonTransientTrackingRecHit::MuonRecHitPointer 
MuonRecHitPointer
 
typedef
TransientTrackingRecHit::RecHitContainer 
RecHitContainer
 
typedef
TransientTrackingRecHit::RecHitPointer 
RecHitPointer
 
enum  subDetector {
  PXB = 1, PXF = 2, TIB = 3, TID = 4,
  TOB = 5, TEC = 6
}
 
typedef std::vector< TrajectoryTC
 
typedef TC::const_iterator TI
 

Public Member Functions

const reco::DYTInfogetDYTInfo ()
 
ConstRecHitContainer getRidOfSelectStationHits (const ConstRecHitContainer &hits, const TrackerTopology *tTopo) const
 
 GlobalMuonRefitter (const edm::ParameterSet &, const MuonServiceProxy *, edm::ConsumesCollector &)
 constructor with Parameter Set and MuonServiceProxy More...
 
std::vector< Trajectoryrefit (const reco::Track &globalTrack, const int theMuonHitsOption, const TrackerTopology *tTopo) const
 build combined trajectory from sta Track and tracker RecHits More...
 
std::vector< Trajectoryrefit (const reco::Track &globalTrack, const reco::TransientTrack track, const TransientTrackingRecHit::ConstRecHitContainer &allRecHitsTemp, const int theMuonHitsOption, const TrackerTopology *tTopo) const
 build combined trajectory from subset of sta Track and tracker RecHits More...
 
virtual void setEvent (const edm::Event &)
 pass the Event to the algo at each event More...
 
void setServices (const edm::EventSetup &)
 set the services needed by the TrackTransformer More...
 
std::vector< Trajectorytransform (const reco::Track &newTrack, const reco::TransientTrack track, const TransientTrackingRecHit::ConstRecHitContainer &recHitsForReFit) const
 refit the track with a new set of RecHits More...
 
virtual ~GlobalMuonRefitter ()
 destructor More...
 

Protected Types

enum  RefitDirection { insideOut, outsideIn, undetermined }
 

Protected Member Functions

void checkMuonHits (const reco::Track &, ConstRecHitContainer &, std::map< DetId, int > &) const
 check muon RecHits, calculate chamber occupancy and select hits to be used in the final fit More...
 
RefitDirection checkRecHitsOrdering (const ConstRecHitContainer &) const
 
void getFirstHits (const reco::Track &, ConstRecHitContainer &, ConstRecHitContainer &) const
 get the RecHits in the tracker and the first muon chamber with hits More...
 
void printHits (const ConstRecHitContainer &) const
 print all RecHits of a trajectory More...
 
ConstRecHitContainer selectMuonHits (const Trajectory &, const std::map< DetId, int > &) const
 select muon hits compatible with trajectory; check hits in chambers with showers More...
 
const MuonServiceProxyservice () const
 

Protected Attributes

std::string theCategory
 
float thePtCut
 
bool theTkTrajsAvailableFlag
 

Private Attributes

edm::Handle
< DTRecSegment4DCollection
all4DSegments
 
edm::EDGetTokenT
< DTRecSegment4DCollection
all4DSegmentsToken
 
edm::Handle< CSCSegmentCollectionCSCSegments
 
edm::EDGetTokenT
< CSCSegmentCollection
CSCSegmentsToken
 
reco::DYTInfodytInfo
 
TkClonerImpl hitCloner
 
unsigned long long theCacheId_TRH
 
bool theCosmicFlag
 
float theCSCChi2Cut
 
edm::InputTag theCSCRecHitLabel
 
edm::Handle
< CSCRecHit2DCollection
theCSCRecHits
 
edm::EDGetTokenT
< CSCRecHit2DCollection
theCSCRecHitToken
 
float theDTChi2Cut
 
edm::InputTag theDTRecHitLabel
 
edm::Handle< DTRecHitCollectiontheDTRecHits
 
edm::EDGetTokenT
< DTRecHitCollection
theDTRecHitToken
 
int theDYTselector
 
std::vector< int > theDYTthrs
 
bool theDYTupdator
 
bool theDYTuseAPE
 
const edm::EventtheEvent
 
std::unique_ptr< TrajectoryFittertheFitter
 
std::string theFitterName
 
int theHitThreshold
 
int theMuonHitsOption
 
edm::ESHandle
< TransientTrackingRecHitBuilder
theMuonRecHitBuilder
 
std::string theMuonRecHitBuilderName
 
float theProbCut
 
std::string thePropagatorName
 
RefitDirection theRefitDirection
 
double theRescaleErrorFactor
 
float theRPCChi2Cut
 
bool theRPCInTheFit
 
const MuonServiceProxytheService
 
int theSkipStation
 
edm::ESHandle
< TransientTrackingRecHitBuilder
theTrackerRecHitBuilder
 
std::string theTrackerRecHitBuilderName
 
int theTrackerSkipSection
 
int theTrackerSkipSystem
 

Detailed Description

class to build muon trajectory

Author
N. Neumeister Purdue University
C. Liu Purdue University
A. Everett Purdue University

Definition at line 41 of file GlobalMuonRefitter.h.

Member Typedef Documentation

Definition at line 53 of file GlobalMuonRefitter.h.

Definition at line 51 of file GlobalMuonRefitter.h.

Definition at line 46 of file GlobalMuonRefitter.h.

Definition at line 48 of file GlobalMuonRefitter.h.

Definition at line 52 of file GlobalMuonRefitter.h.

Definition at line 50 of file GlobalMuonRefitter.h.

Definition at line 45 of file GlobalMuonRefitter.h.

Definition at line 47 of file GlobalMuonRefitter.h.

typedef std::vector<Trajectory> GlobalMuonRefitter::TC

Definition at line 55 of file GlobalMuonRefitter.h.

typedef TC::const_iterator GlobalMuonRefitter::TI

Definition at line 56 of file GlobalMuonRefitter.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

GlobalMuonRefitter::GlobalMuonRefitter ( const edm::ParameterSet par,
const MuonServiceProxy service,
edm::ConsumesCollector iC 
)

constructor with Parameter Set and MuonServiceProxy

Definition at line 67 of file GlobalMuonRefitter.cc.

References all4DSegmentsToken, edm::ConsumesCollector::consumes(), CSCSegmentsToken, dytInfo, edm::hlt::Exception, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), HLT_25ns14e33_v1_cff::InputTag, insideOut, outsideIn, theCacheId_TRH, theCategory, theCSCChi2Cut, theCSCRecHitLabel, theCSCRecHitToken, theDTChi2Cut, theDTRecHitLabel, theDTRecHitToken, theDYTselector, theDYTthrs, theDYTupdator, theDYTuseAPE, theFitterName, theHitThreshold, theMuonRecHitBuilderName, thePropagatorName, theRefitDirection, theRescaleErrorFactor, theRPCChi2Cut, theRPCInTheFit, theSkipStation, theTrackerRecHitBuilderName, theTrackerSkipSection, and theTrackerSkipSystem.

69  :
70  theCosmicFlag(par.getParameter<bool>("PropDirForCosmics")),
71  theDTRecHitLabel(par.getParameter<InputTag>("DTRecSegmentLabel")),
72  theCSCRecHitLabel(par.getParameter<InputTag>("CSCRecSegmentLabel")),
74 
75  theCategory = par.getUntrackedParameter<string>("Category", "Muon|RecoMuon|GlobalMuon|GlobalMuonRefitter");
76 
77  theHitThreshold = par.getParameter<int>("HitThreshold");
78  theDTChi2Cut = par.getParameter<double>("Chi2CutDT");
79  theCSCChi2Cut = par.getParameter<double>("Chi2CutCSC");
80  theRPCChi2Cut = par.getParameter<double>("Chi2CutRPC");
81 
82  // Refit direction
83  string refitDirectionName = par.getParameter<string>("RefitDirection");
84 
85  if (refitDirectionName == "insideOut" ) theRefitDirection = insideOut;
86  else if (refitDirectionName == "outsideIn" ) theRefitDirection = outsideIn;
87  else
88  throw cms::Exception("TrackTransformer constructor")
89  <<"Wrong refit direction chosen in TrackTransformer ParameterSet"
90  << "\n"
91  << "Possible choices are:"
92  << "\n"
93  << "RefitDirection = insideOut or RefitDirection = outsideIn";
94 
95  theFitterName = par.getParameter<string>("Fitter");
96  thePropagatorName = par.getParameter<string>("Propagator");
97 
98  theSkipStation = par.getParameter<int>("SkipStation");
99  theTrackerSkipSystem = par.getParameter<int>("TrackerSkipSystem");
100  theTrackerSkipSection = par.getParameter<int>("TrackerSkipSection");//layer, wheel, or disk depending on the system
101 
102  theTrackerRecHitBuilderName = par.getParameter<string>("TrackerRecHitBuilder");
103  theMuonRecHitBuilderName = par.getParameter<string>("MuonRecHitBuilder");
104 
105  theRPCInTheFit = par.getParameter<bool>("RefitRPCHits");
106 
107  theDYTthrs = par.getParameter< std::vector<int> >("DYTthrs");
108  theDYTselector = par.existsAs<int>("DYTselector")?par.getParameter<int>("DYTselector"):1;
109  theDYTupdator = par.existsAs<bool>("DYTupdator")?par.getParameter<bool>("DYTupdator"):false;
110  theDYTuseAPE = par.existsAs<bool>("DYTuseAPE")?par.getParameter<bool>("DYTuseAPE"):false;
111  dytInfo = new reco::DYTInfo();
112 
113  if (par.existsAs<double>("RescaleErrorFactor")) {
114  theRescaleErrorFactor = par.getParameter<double>("RescaleErrorFactor");
115  edm::LogWarning("GlobalMuonRefitter") << "using error rescale factor " << theRescaleErrorFactor;
116  }
117  else
118  theRescaleErrorFactor = 1000.;
119 
120  theCacheId_TRH = 0;
125 }
std::string theMuonRecHitBuilderName
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
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
const MuonServiceProxy * theService
RefitDirection theRefitDirection
std::string thePropagatorName
edm::EDGetTokenT< CSCSegmentCollection > CSCSegmentsToken
std::vector< int > theDYTthrs
edm::EDGetTokenT< DTRecHitCollection > theDTRecHitToken
edm::EDGetTokenT< CSCRecHit2DCollection > theCSCRecHitToken
edm::InputTag theDTRecHitLabel
edm::EDGetTokenT< DTRecSegment4DCollection > all4DSegmentsToken
reco::DYTInfo * dytInfo
unsigned long long theCacheId_TRH
std::string theTrackerRecHitBuilderName
const MuonServiceProxy * service() const
edm::InputTag theCSCRecHitLabel
GlobalMuonRefitter::~GlobalMuonRefitter ( )
virtual

destructor

Definition at line 131 of file GlobalMuonRefitter.cc.

References dytInfo.

131  {
132  delete dytInfo;
133 }
reco::DYTInfo * dytInfo

Member Function Documentation

void GlobalMuonRefitter::checkMuonHits ( const reco::Track muon,
ConstRecHitContainer all,
std::map< DetId, int > &  hitMap 
) const
protected

check muon RecHits, calculate chamber occupancy and select hits to be used in the final fit

Definition at line 291 of file GlobalMuonRefitter.cc.

References alongMomentum, CSCDetId::chamberId(), HLT_25ns14e33_v1_cff::coneSize, MuonSubdetId::CSC, MuonSubdetId::DT, LogTrace, mag(), DetId::Muon, DetId::rawId(), MuonSubdetId::RPC, theCategory, theCSCRecHits, and theDTRecHits.

Referenced by refit().

293  {
294 
295  LogTrace(theCategory) << " GlobalMuonRefitter::checkMuonHits " << endl;
296 
297  float coneSize = 20.0;
298 
299  // loop through all muon hits and calculate the maximum # of hits in each chamber
300  for (ConstRecHitContainer::const_iterator imrh = all.begin(); imrh != all.end(); imrh++ ) {
301 
302  if ( (*imrh != 0 ) && !(*imrh)->isValid() ) continue;
303 
304  int detRecHits = 0;
305  MuonRecHitContainer dRecHits;
306 
307  DetId id = (*imrh)->geographicalId();
308  DetId chamberId;
309 
310  // Skip tracker hits
311  if (id.det()!=DetId::Muon) continue;
312 
313  if ( id.subdetId() == MuonSubdetId::DT ) {
314  DTChamberId did(id.rawId());
315  chamberId=did;
316 
317  if ((*imrh)->recHits().size()>1) {
318  std::vector <const TrackingRecHit*> hits2d = (*imrh)->recHits();
319  for (std::vector <const TrackingRecHit*>::const_iterator hit2d = hits2d.begin(); hit2d!= hits2d.end(); hit2d++) {
320  if ((*imrh)->recHits().size()>1) {
321  std::vector <const TrackingRecHit*> hits1d = (*hit2d)->recHits();
322  for (std::vector <const TrackingRecHit*>::const_iterator hit1d = hits1d.begin(); hit1d!= hits1d.end(); hit1d++) {
323  DetId id1 = (*hit1d)->geographicalId();
324  DTLayerId lid(id1.rawId());
325  // Get the 1d DT RechHits from this layer
326  DTRecHitCollection::range dRecHits = theDTRecHits->get(lid);
327  int layerHits=0;
328  for (DTRecHitCollection::const_iterator ir = dRecHits.first; ir != dRecHits.second; ir++ ) {
329  double rhitDistance = fabs(ir->localPosition().x()-(**hit1d).localPosition().x());
330  if ( rhitDistance < coneSize ) layerHits++;
331  LogTrace(theCategory) << " " << (ir)->localPosition() << " " << (**hit1d).localPosition()
332  << " Distance: " << rhitDistance << " recHits: " << layerHits << " SL: " << lid.superLayer() << endl;
333  }
334  if (layerHits>detRecHits) detRecHits=layerHits;
335  }
336  }
337  }
338 
339  } else {
340  DTLayerId lid(id.rawId());
341 
342  // Get the 1d DT RechHits from this layer
343  DTRecHitCollection::range dRecHits = theDTRecHits->get(lid);
344 
345  for (DTRecHitCollection::const_iterator ir = dRecHits.first; ir != dRecHits.second; ir++ ) {
346  double rhitDistance = fabs(ir->localPosition().x()-(**imrh).localPosition().x());
347  if ( rhitDistance < coneSize ) detRecHits++;
348  LogTrace(theCategory) << " " << (ir)->localPosition() << " " << (**imrh).localPosition()
349  << " Distance: " << rhitDistance << " recHits: " << detRecHits << endl;
350  }
351  }
352  }// end of if DT
353  else if ( id.subdetId() == MuonSubdetId::CSC ) {
354  CSCDetId did(id.rawId());
355  chamberId=did.chamberId();
356 
357  if ((*imrh)->recHits().size()>1) {
358  std::vector <const TrackingRecHit*> hits2d = (*imrh)->recHits();
359  for (std::vector <const TrackingRecHit*>::const_iterator hit2d = hits2d.begin(); hit2d!= hits2d.end(); hit2d++) {
360  DetId id1 = (*hit2d)->geographicalId();
361  CSCDetId lid(id1.rawId());
362 
363  // Get the CSC Rechits from this layer
364  CSCRecHit2DCollection::range dRecHits = theCSCRecHits->get(lid);
365  int layerHits=0;
366 
367  for (CSCRecHit2DCollection::const_iterator ir = dRecHits.first; ir != dRecHits.second; ir++ ) {
368  double rhitDistance = (ir->localPosition()-(**hit2d).localPosition()).mag();
369  if ( rhitDistance < coneSize ) layerHits++;
370  LogTrace(theCategory) << ir->localPosition() << " " << (**hit2d).localPosition()
371  << " Distance: " << rhitDistance << " recHits: " << layerHits << endl;
372  }
373  if (layerHits>detRecHits) detRecHits=layerHits;
374  }
375  } else {
376  // Get the CSC Rechits from this layer
377  CSCRecHit2DCollection::range dRecHits = theCSCRecHits->get(did);
378 
379  for (CSCRecHit2DCollection::const_iterator ir = dRecHits.first; ir != dRecHits.second; ir++ ) {
380  double rhitDistance = (ir->localPosition()-(**imrh).localPosition()).mag();
381  if ( rhitDistance < coneSize ) detRecHits++;
382  LogTrace(theCategory) << ir->localPosition() << " " << (**imrh).localPosition()
383  << " Distance: " << rhitDistance << " recHits: " << detRecHits << endl;
384  }
385  }
386  }
387  else {
388  if ( id.subdetId() != MuonSubdetId::RPC ) LogError(theCategory)<<" Wrong Hit Type ";
389  continue;
390  }
391 
392  map<DetId,int>::iterator imap=hitMap.find(chamberId);
393  if (imap!=hitMap.end()) {
394  if (detRecHits>imap->second) imap->second=detRecHits;
395  } else hitMap[chamberId]=detRecHits;
396 
397  } // end of loop over muon rechits
398 
399  for (map<DetId,int>::iterator imap=hitMap.begin(); imap!=hitMap.end(); imap++ )
400  LogTrace(theCategory) << " Station " << imap->first.rawId() << ": " << imap->second <<endl;
401 
402  LogTrace(theCategory) << "CheckMuonHits: "<<all.size();
403 
404  // check order of muon measurements
405  if ( (all.size() > 1) &&
406  ( all.front()->globalPosition().mag() >
407  all.back()->globalPosition().mag() ) ) {
408  LogTrace(theCategory)<< "reverse order: ";
409  stable_sort(all.begin(),all.end(),RecHitLessByDet(alongMomentum));
410  }
411 }
edm::Handle< DTRecHitCollection > theDTRecHits
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
static const int CSC
Definition: MuonSubdetId.h:13
edm::Handle< CSCRecHit2DCollection > theCSCRecHits
#define LogTrace(id)
Definition: DetId.h:18
static const int RPC
Definition: MuonSubdetId.h:14
MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
static const int DT
Definition: MuonSubdetId.h:12
GlobalMuonRefitter::RefitDirection GlobalMuonRefitter::checkRecHitsOrdering ( const ConstRecHitContainer recHits) const
protected

Definition at line 565 of file GlobalMuonRefitter.cc.

References insideOut, outsideIn, theCategory, and undetermined.

Referenced by transform().

565  {
566 
567  if (!recHits.empty()){
568  ConstRecHitContainer::const_iterator frontHit = recHits.begin();
569  ConstRecHitContainer::const_iterator backHit = recHits.end() - 1;
570  while( !(*frontHit)->isValid() && frontHit != backHit) {frontHit++;}
571  while( !(*backHit)->isValid() && backHit != frontHit) {backHit--;}
572 
573  double rFirst = (*frontHit)->globalPosition().mag();
574  double rLast = (*backHit) ->globalPosition().mag();
575 
576  if(rFirst < rLast) return insideOut;
577  else if(rFirst > rLast) return outsideIn;
578  else {
579  LogError(theCategory) << "Impossible determine the rechits order" <<endl;
580  return undetermined;
581  }
582  } else {
583  LogError(theCategory) << "Impossible determine the rechits order" <<endl;
584  return undetermined;
585  }
586 }
const reco::DYTInfo* GlobalMuonRefitter::getDYTInfo ( )
inline

Definition at line 95 of file GlobalMuonRefitter.h.

References dytInfo.

95 {return dytInfo;}
reco::DYTInfo * dytInfo
void GlobalMuonRefitter::getFirstHits ( const reco::Track muon,
ConstRecHitContainer all,
ConstRecHitContainer first 
) const
protected

get the RecHits in the tracker and the first muon chamber with hits

Definition at line 417 of file GlobalMuonRefitter.cc.

References MuonSubdetId::CSC, CSCDetId, MuonSubdetId::DT, DTChamberId, i, LogTrace, DetId::Muon, DetId::rawId(), MuonSubdetId::RPC, RPCDetId, relativeConstraints::station, mergeVDriftHistosByStation::stations, and theCategory.

Referenced by refit().

419  {
420 
421  LogTrace(theCategory) << " GlobalMuonRefitter::getFirstHits\nall rechits length:" << all.size() << endl;
422  first.clear();
423 
424  int station_to_keep = 999;
425  vector<int> stations;
426  for (ConstRecHitContainer::const_iterator ihit = all.begin(); ihit != all.end(); ++ihit) {
427 
428  int station = 0;
429  bool use_it = true;
430  DetId id = (*ihit)->geographicalId();
431  unsigned raw_id = id.rawId();
432  if (!(*ihit)->isValid()) station = -1;
433  else {
434  if (id.det() == DetId::Muon) {
435  switch (id.subdetId()) {
436  case MuonSubdetId::DT: station = DTChamberId(raw_id).station(); break;
437  case MuonSubdetId::CSC: station = CSCDetId(raw_id).station(); break;
438  case MuonSubdetId::RPC: station = RPCDetId(raw_id).station(); use_it = false; break;
439  }
440  }
441  }
442 
443  if (use_it && station > 0 && station < station_to_keep) station_to_keep = station;
444  stations.push_back(station);
445 
446  LogTrace(theCategory) << "rawId: " << raw_id << " station = " << station << " station_to_keep is now " << station_to_keep;
447  }
448 
449  if (station_to_keep <= 0 || station_to_keep > 4 || stations.size() != all.size())
450  LogInfo(theCategory) << "failed to getFirstHits (all muon hits are outliers/bad ?)! station_to_keep = "
451  << station_to_keep << " stations.size " << stations.size() << " all.size " << all.size();
452 
453  for (unsigned i = 0; i < stations.size(); ++i)
454  if (stations[i] >= 0 && stations[i] <= station_to_keep) first.push_back(all[i]);
455 
456  return;
457 }
int i
Definition: DBlmapReader.cc:9
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
static const int CSC
Definition: MuonSubdetId.h:13
#define LogTrace(id)
Definition: DetId.h:18
static const int RPC
Definition: MuonSubdetId.h:14
static const int DT
Definition: MuonSubdetId.h:12
GlobalMuonRefitter::ConstRecHitContainer GlobalMuonRefitter::getRidOfSelectStationHits ( const ConstRecHitContainer hits,
const TrackerTopology tTopo 
) const

Definition at line 743 of file GlobalMuonRefitter.cc.

References MuonSubdetId::CSC, MuonSubdetId::DT, DetId::Muon, PXB, TrackerTopology::pxbLayer(), PXF, TrackerTopology::pxfDisk(), python.entryComment::results, MuonSubdetId::RPC, DTChamberId::station(), relativeConstraints::station, RPCDetId::station(), CSCDetId::station(), TEC, TrackerTopology::tecWheel(), theSkipStation, theTrackerSkipSection, theTrackerSkipSystem, TIB, TrackerTopology::tibLayer(), TID, TrackerTopology::tidWheel(), TOB, TrackerTopology::tobLayer(), and DetId::Tracker.

Referenced by refit().

745 {
747  ConstRecHitContainer::const_iterator it = hits.begin();
748  for (; it!=hits.end(); it++) {
749 
750  DetId id = (*it)->geographicalId();
751 
752  //Check that this is a Muon hit that we're toying with -- else pass on this because the hacker is a moron / not careful
753 
754  if (id.det() == DetId::Tracker && theTrackerSkipSystem > 0) {
755  int layer = -999;
756  int disk = -999;
757  int wheel = -999;
758  if ( id.subdetId() == theTrackerSkipSystem){
759  // continue; //caveat that just removes the whole system from refitting
760 
761  if (theTrackerSkipSystem == PXB) {
762 
763  layer = tTopo->pxbLayer(id);
764  }
765  if (theTrackerSkipSystem == TIB) {
766 
767  layer = tTopo->tibLayer(id);
768  }
769 
770  if (theTrackerSkipSystem == TOB) {
771 
772  layer = tTopo->tobLayer(id);
773  }
774  if (theTrackerSkipSystem == PXF) {
775 
776  disk = tTopo->pxfDisk(id);
777  }
778  if (theTrackerSkipSystem == TID) {
779 
780  wheel = tTopo->tidWheel(id);
781  }
782  if (theTrackerSkipSystem == TEC) {
783 
784  wheel = tTopo->tecWheel(id);
785  }
786  if (theTrackerSkipSection >= 0 && layer == theTrackerSkipSection) continue;
787  if (theTrackerSkipSection >= 0 && disk == theTrackerSkipSection) continue;
788  if (theTrackerSkipSection >= 0 && wheel == theTrackerSkipSection) continue;
789  }
790  }
791 
792  if (id.det() == DetId::Muon && theSkipStation) {
793  int station = -999;
794  //UNUSED: int wheel = -999;
795  if ( id.subdetId() == MuonSubdetId::DT ) {
796  DTChamberId did(id.rawId());
797  station = did.station();
798  //UNUSED: wheel = did.wheel();
799  } else if ( id.subdetId() == MuonSubdetId::CSC ) {
800  CSCDetId did(id.rawId());
801  station = did.station();
802  } else if ( id.subdetId() == MuonSubdetId::RPC ) {
803  RPCDetId rpcid(id.rawId());
804  station = rpcid.station();
805  }
806  if(station == theSkipStation) continue;
807  }
808  results.push_back(*it);
809  }
810  return results;
811 }
unsigned int tibLayer(const DetId &id) const
unsigned int pxfDisk(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
static const int CSC
Definition: MuonSubdetId.h:13
unsigned int pxbLayer(const DetId &id) const
Definition: DetId.h:18
static const int RPC
Definition: MuonSubdetId.h:14
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
static const int DT
Definition: MuonSubdetId.h:12
unsigned int tecWheel(const DetId &id) const
unsigned int tobLayer(const DetId &id) const
void GlobalMuonRefitter::printHits ( const ConstRecHitContainer hits) const
protected

print all RecHits of a trajectory

Definition at line 538 of file GlobalMuonRefitter.cc.

References LogTrace, mathSSE::sqrt(), theCategory, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by transform().

538  {
539 
540  LogTrace(theCategory) << "Used RecHits: " << hits.size();
541  for (ConstRecHitContainer::const_iterator ir = hits.begin(); ir != hits.end(); ir++ ) {
542  if ( !(*ir)->isValid() ) {
543  LogTrace(theCategory) << "invalid RecHit";
544  continue;
545  }
546 
547  const GlobalPoint& pos = (*ir)->globalPosition();
548 
550  << "r = " << sqrt(pos.x() * pos.x() + pos.y() * pos.y())
551  << " z = " << pos.z()
552  << " dimension = " << (*ir)->dimension()
553  << " det = " << (*ir)->det()->geographicalId().det()
554  << " subdet = " << (*ir)->det()->subDetector()
555  << " raw id = " << (*ir)->det()->geographicalId().rawId();
556  }
557 
558 }
T y() const
Definition: PV3DBase.h:63
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
#define LogTrace(id)
T x() const
Definition: PV3DBase.h:62
vector< Trajectory > GlobalMuonRefitter::refit ( const reco::Track globalTrack,
const int  theMuonHitsOption,
const TrackerTopology tTopo 
) const

build combined trajectory from sta Track and tracker RecHits

Definition at line 172 of file GlobalMuonRefitter.cc.

References LogTrace, DetId::Muon, edm::ESHandle< class >::product(), theCategory, theMuonRecHitBuilder, theRPCInTheFit, theService, theTrackerRecHitBuilder, and DetId::Tracker.

Referenced by GlobalTrajectoryBuilderBase::build(), and GlobalTrackQualityProducer::produce().

174  {
175  LogTrace(theCategory) << " *** GlobalMuonRefitter *** option " << theMuonHitsOption << endl;
176 
177  ConstRecHitContainer allRecHitsTemp; // all muon rechits temp
178 
179  reco::TransientTrack track(globalTrack,&*(theService->magneticField()),theService->trackingGeometry());
180 
181  auto tkbuilder = static_cast<TkTransientTrackingRecHitBuilder const *>(theTrackerRecHitBuilder.product());
182 
183  for (trackingRecHit_iterator hit = track.recHitsBegin(); hit != track.recHitsEnd(); ++hit)
184  if ((*hit)->isValid()) {
185  if ((*hit)->geographicalId().det() == DetId::Tracker)
186  allRecHitsTemp.push_back((**hit).cloneForFit(*tkbuilder->geometry()->idToDet( (**hit).geographicalId() ) ) );
187  else if ((*hit)->geographicalId().det() == DetId::Muon) {
188  if ((*hit)->geographicalId().subdetId() == 3 && !theRPCInTheFit) {
189  LogTrace(theCategory) << "RPC Rec Hit discarged";
190  continue;
191  }
192  allRecHitsTemp.push_back(theMuonRecHitBuilder->build(&**hit));
193  }
194  }
195  vector<Trajectory> refitted = refit(globalTrack,track,allRecHitsTemp,theMuonHitsOption, tTopo);
196  return refitted;
197 }
const MuonServiceProxy * theService
edm::ESHandle< TransientTrackingRecHitBuilder > theTrackerRecHitBuilder
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
#define LogTrace(id)
T const * product() const
Definition: ESHandle.h:86
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
std::vector< Trajectory > refit(const reco::Track &globalTrack, const int theMuonHitsOption, const TrackerTopology *tTopo) const
build combined trajectory from sta Track and tracker RecHits
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
vector< Trajectory > GlobalMuonRefitter::refit ( const reco::Track globalTrack,
const reco::TransientTrack  track,
const TransientTrackingRecHit::ConstRecHitContainer allRecHitsTemp,
const int  theMuonHitsOption,
const TrackerTopology tTopo 
) const

build combined trajectory from subset of sta Track and tracker RecHits

Definition at line 202 of file GlobalMuonRefitter.cc.

References all4DSegments, alongMomentum, checkMuonHits(), reco::DYTInfo::CopyFrom(), CSCSegments, dytInfo, DynamicTruncation::filter(), DynamicTruncation::getDYTInfo(), getFirstHits(), getRidOfSelectStationHits(), LogTrace, reco::TrackBase::pt(), selectMuonHits(), DynamicTruncation::setProd(), DynamicTruncation::setSelector(), DynamicTruncation::setThr(), DynamicTruncation::setUpdateState(), DynamicTruncation::setUseAPE(), theCategory, theDYTselector, theDYTthrs, theDYTupdator, theDYTuseAPE, theEvent, theService, and transform().

206  {
207 
208  // MuonHitsOption: 0 - tracker only
209  // 1 - include all muon hits
210  // 2 - include only first muon hit(s)
211  // 3 - include only selected muon hits
212  // 4 - redo pattern recognition with dynamic truncation
213 
214  vector<int> stationHits(4,0);
215  map<DetId, int> hitMap;
216 
217  ConstRecHitContainer allRecHits; // all muon rechits
218  ConstRecHitContainer fmsRecHits; // only first muon rechits
219  ConstRecHitContainer selectedRecHits; // selected muon rechits
220  ConstRecHitContainer DYTRecHits; // rec hits from dynamic truncation algorithm
221 
222  LogTrace(theCategory) << " *** GlobalMuonRefitter *** option " << theMuonHitsOption << endl;
223  LogTrace(theCategory) << " Track momentum before refit: " << globalTrack.pt() << endl;
224  LogTrace(theCategory) << " Hits size before : " << allRecHitsTemp.size() << endl;
225 
226  allRecHits = getRidOfSelectStationHits(allRecHitsTemp, tTopo);
227  // printHits(allRecHits);
228  LogTrace(theCategory) << " Hits size: " << allRecHits.size() << endl;
229 
230  vector <Trajectory> outputTraj;
231 
232  if ((theMuonHitsOption == 1) || (theMuonHitsOption == 3) || (theMuonHitsOption == 4) ) {
233  // refit the full track with all muon hits
234  vector <Trajectory> globalTraj = transform(globalTrack, track, allRecHits);
235 
236  if (!globalTraj.size()) {
237  LogTrace(theCategory) << "No trajectory from the TrackTransformer!" << endl;
238  return vector<Trajectory>();
239  }
240 
241  LogTrace(theCategory) << " Initial trajectory state: "
242  << globalTraj.front().lastMeasurement().updatedState().freeState()->parameters() << endl;
243 
244  if (theMuonHitsOption == 1 )
245  outputTraj.push_back(globalTraj.front());
246 
247  if (theMuonHitsOption == 3 ) {
248  checkMuonHits(globalTrack, allRecHits, hitMap);
249  selectedRecHits = selectMuonHits(globalTraj.front(),hitMap);
250  LogTrace(theCategory) << " Selected hits size: " << selectedRecHits.size() << endl;
251  outputTraj = transform(globalTrack, track, selectedRecHits);
252  }
253 
254  if (theMuonHitsOption == 4 ) {
255  //
256  // DYT 2.0
257  //
259  dytRefit.setProd(all4DSegments, CSCSegments);
260  dytRefit.setSelector(theDYTselector);
261  dytRefit.setThr(theDYTthrs);
262  dytRefit.setUpdateState(theDYTupdator);
263  dytRefit.setUseAPE(theDYTuseAPE);
264  DYTRecHits = dytRefit.filter(globalTraj.front());
265  dytInfo->CopyFrom(dytRefit.getDYTInfo());
266  if ((DYTRecHits.size() > 1) && (DYTRecHits.front()->globalPosition().mag() > DYTRecHits.back()->globalPosition().mag()))
267  stable_sort(DYTRecHits.begin(),DYTRecHits.end(),RecHitLessByDet(alongMomentum));
268  outputTraj = transform(globalTrack, track, DYTRecHits);
269  }
270 
271  } else if (theMuonHitsOption == 2 ) {
272  getFirstHits(globalTrack, allRecHits, fmsRecHits);
273  outputTraj = transform(globalTrack, track, fmsRecHits);
274  }
275 
276 
277  if (outputTraj.size()) {
278  LogTrace(theCategory) << "Refitted pt: " << outputTraj.front().firstMeasurement().updatedState().globalParameters().momentum().perp() << endl;
279  return outputTraj;
280  } else {
281  LogTrace(theCategory) << "No refitted Tracks... " << endl;
282  return vector<Trajectory>();
283  }
284 
285 }
const MuonServiceProxy * theService
edm::Handle< CSCSegmentCollection > CSCSegments
void CopyFrom(const DYTInfo &)
copy from another DYTInfo
Definition: DYTInfo.cc:15
void checkMuonHits(const reco::Track &, ConstRecHitContainer &, std::map< DetId, int > &) const
check muon RecHits, calculate chamber occupancy and select hits to be used in the final fit ...
std::vector< int > theDYTthrs
void getFirstHits(const reco::Track &, ConstRecHitContainer &, ConstRecHitContainer &) const
get the RecHits in the tracker and the first muon chamber with hits
const edm::Event * theEvent
edm::Handle< DTRecSegment4DCollection > all4DSegments
ConstRecHitContainer selectMuonHits(const Trajectory &, const std::map< DetId, int > &) const
select muon hits compatible with trajectory; check hits in chambers with showers
ConstRecHitContainer getRidOfSelectStationHits(const ConstRecHitContainer &hits, const TrackerTopology *tTopo) const
double pt() const
track transverse momentum
Definition: TrackBase.h:584
#define LogTrace(id)
reco::DYTInfo * dytInfo
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
std::vector< Trajectory > transform(const reco::Track &newTrack, const reco::TransientTrack track, const TransientTrackingRecHit::ConstRecHitContainer &recHitsForReFit) const
refit the track with a new set of RecHits
GlobalMuonRefitter::ConstRecHitContainer GlobalMuonRefitter::selectMuonHits ( const Trajectory traj,
const std::map< DetId, int > &  hitMap 
) const
protected

select muon hits compatible with trajectory; check hits in chambers with showers

Definition at line 465 of file GlobalMuonRefitter.cc.

References CSCDetId::chamberId(), TrackingRecHit::geographicalId(), keep, LogTrace, Trajectory::measurements(), DetId::Muon, theCategory, theCSCChi2Cut, theDTChi2Cut, theHitThreshold, theRPCChi2Cut, and dtDQMClient_cfg::threshold.

Referenced by refit().

466  {
467 
468  ConstRecHitContainer muonRecHits;
469  const double globalChi2Cut = 200.0;
470 
471  vector<TrajectoryMeasurement> muonMeasurements = traj.measurements();
472 
473  // loop through all muon hits and skip hits with bad chi2 in chambers with high occupancy
474  for (std::vector<TrajectoryMeasurement>::const_iterator im = muonMeasurements.begin(); im != muonMeasurements.end(); im++ ) {
475 
476  if ( !(*im).recHit()->isValid() ) continue;
477  if ( (*im).recHit()->det()->geographicalId().det() != DetId::Muon ) {
478  // if ( ( chi2ndf < globalChi2Cut ) )
479  muonRecHits.push_back((*im).recHit());
480  continue;
481  }
482  const MuonTransientTrackingRecHit* immrh = dynamic_cast<const MuonTransientTrackingRecHit*>((*im).recHit().get());
483 
484  DetId id = immrh->geographicalId();
485  DetId chamberId;
486  int threshold = 0;
487  double chi2Cut = 0.0;
488 
489  // get station of hit if it is in DT
490  if ( (*immrh).isDT() ) {
491  DTChamberId did(id.rawId());
492  chamberId = did;
493  threshold = theHitThreshold;
494  chi2Cut = theDTChi2Cut;
495  }
496  // get station of hit if it is in CSC
497  else if ( (*immrh).isCSC() ) {
498  CSCDetId did(id.rawId());
499  chamberId = did.chamberId();
500  threshold = theHitThreshold;
501  chi2Cut = theCSCChi2Cut;
502  }
503  // get station of hit if it is in RPC
504  else if ( (*immrh).isRPC() ) {
505  RPCDetId rpcid(id.rawId());
506  chamberId = rpcid;
507  threshold = theHitThreshold;
508  chi2Cut = theRPCChi2Cut;
509  } else
510  continue;
511 
512  double chi2ndf = (*im).estimate()/(*im).recHit()->dimension();
513 
514  bool keep = true;
515  map<DetId,int>::const_iterator imap=hitMap.find(chamberId);
516  if ( imap!=hitMap.end() )
517  if (imap->second>threshold) keep = false;
518 
519  if ( (keep || (chi2ndf<chi2Cut)) && (chi2ndf<globalChi2Cut) ) {
520  muonRecHits.push_back((*im).recHit());
521  } else {
523  << "Skip hit: " << id.rawId() << " chi2="
524  << chi2ndf << " ( threshold: " << chi2Cut << ") Det: "
525  << imap->second << endl;
526  }
527  }
528 
529  // check order of rechits
530  reverse(muonRecHits.begin(),muonRecHits.end());
531  return muonRecHits;
532 }
DataContainer const & measurements() const
Definition: Trajectory.h:203
const int keep
#define LogTrace(id)
Definition: DetId.h:18
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
DetId geographicalId() const
const MuonServiceProxy* GlobalMuonRefitter::service ( ) const
inlineprotected

Definition at line 118 of file GlobalMuonRefitter.h.

References theService.

118 { return theService; }
const MuonServiceProxy * theService
void GlobalMuonRefitter::setEvent ( const edm::Event event)
virtual

pass the Event to the algo at each event

Definition at line 139 of file GlobalMuonRefitter.cc.

References all4DSegments, all4DSegmentsToken, CSCSegments, CSCSegmentsToken, event(), theCSCRecHits, theCSCRecHitToken, theDTRecHits, theDTRecHitToken, and theEvent.

Referenced by GlobalTrackQualityProducer::produce(), and GlobalTrajectoryBuilderBase::setEvent().

139  {
140 
141  theEvent = &event;
142  event.getByToken(theDTRecHitToken, theDTRecHits);
143  event.getByToken(theCSCRecHitToken, theCSCRecHits);
144  event.getByToken(CSCSegmentsToken, CSCSegments);
145  event.getByToken(all4DSegmentsToken, all4DSegments);
146 }
edm::Handle< DTRecHitCollection > theDTRecHits
edm::Handle< CSCSegmentCollection > CSCSegments
edm::EDGetTokenT< CSCSegmentCollection > CSCSegmentsToken
const edm::Event * theEvent
edm::Handle< DTRecSegment4DCollection > all4DSegments
edm::Handle< CSCRecHit2DCollection > theCSCRecHits
edm::EDGetTokenT< DTRecHitCollection > theDTRecHitToken
edm::EDGetTokenT< CSCRecHit2DCollection > theCSCRecHitToken
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
edm::EDGetTokenT< DTRecSegment4DCollection > all4DSegmentsToken
void GlobalMuonRefitter::setServices ( const edm::EventSetup setup)

set the services needed by the TrackTransformer

Definition at line 149 of file GlobalMuonRefitter.cc.

References edm::EventSetup::get(), hitCloner, LogDebug, edm::ESHandle< class >::product(), theCacheId_TRH, theCategory, theFitter, theFitterName, theMuonRecHitBuilder, theMuonRecHitBuilderName, theService, theTrackerRecHitBuilder, and theTrackerRecHitBuilderName.

Referenced by GlobalTrackQualityProducer::produce(), and GlobalTrajectoryBuilderBase::setEvent().

149  {
150 
152  theService->eventSetup().get<TrajectoryFitter::Record>().get(theFitterName,aFitter);
153  theFitter = aFitter->clone();
154 
155 
156  // Transient Rechit Builders
157  unsigned long long newCacheId_TRH = setup.get<TransientRecHitRecord>().cacheIdentifier();
158  if ( newCacheId_TRH != theCacheId_TRH ) {
159  LogDebug(theCategory) << "TransientRecHitRecord changed!";
163  }
164  theFitter->setHitCloner(&hitCloner);
165 
166 }
#define LogDebug(id)
std::string theMuonRecHitBuilderName
const MuonServiceProxy * theService
edm::ESHandle< TransientTrackingRecHitBuilder > theTrackerRecHitBuilder
std::unique_ptr< TrajectoryFitter > theFitter
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
unsigned long long theCacheId_TRH
std::string theTrackerRecHitBuilderName
vector< Trajectory > GlobalMuonRefitter::transform ( const reco::Track newTrack,
const reco::TransientTrack  track,
const TransientTrackingRecHit::ConstRecHitContainer recHitsForReFit 
) const

refit the track with a new set of RecHits

Definition at line 592 of file GlobalMuonRefitter.cc.

References alongMomentum, PV3DBase< T, PVType, FrameType >::basicVector(), checkRecHitsOrdering(), Basic3DVector< T >::dot(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), reco::Track::innerDetId(), reco::TransientTrack::innermostMeasurementState(), insideOut, LogDebug, LogTrace, PV3DBase< T, PVType, FrameType >::mag(), oppositeToMomentum, reco::Track::outerDetId(), reco::TransientTrack::outermostMeasurementState(), outsideIn, printHits(), fileCollector::seed, theCategory, theCosmicFlag, theFitter, thePropagatorName, theRefitDirection, theRescaleErrorFactor, theService, and HLT_25ns14e33_v1_cff::trajectories.

Referenced by refit().

594  {
595 
596  TransientTrackingRecHit::ConstRecHitContainer recHitsForReFit = urecHitsForReFit;
597  LogTrace(theCategory) << "GlobalMuonRefitter::transform: " << recHitsForReFit.size() << " hits:";
598  printHits(recHitsForReFit);
599 
600  if(recHitsForReFit.size() < 2) return vector<Trajectory>();
601 
602  // Check the order of the rechits
603  RefitDirection recHitsOrder = checkRecHitsOrdering(recHitsForReFit);
604 
605  LogTrace(theCategory) << "checkRecHitsOrdering() returned " << recHitsOrder
606  << ", theRefitDirection is " << theRefitDirection
607  << " (insideOut == " << insideOut << ", outsideIn == " << outsideIn << ")";
608 
609  // Reverse the order in the case of inconsistency between the fit direction and the rechit order
610  if(theRefitDirection != recHitsOrder) reverse(recHitsForReFit.begin(),recHitsForReFit.end());
611 
612  // Even though we checked the rechits' ordering above, we may have
613  // already flipped them elsewhere (getFirstHits() is such a
614  // culprit). Use the global positions of the states and the desired
615  // refit direction to find the starting TSOS.
616  TrajectoryStateOnSurface firstTSOS, lastTSOS;
617  unsigned int innerId; //UNUSED: outerId;
618  bool order_swapped = track.outermostMeasurementState().globalPosition().mag() < track.innermostMeasurementState().globalPosition().mag();
619  bool inner_is_first;
620  LogTrace(theCategory) << "order swapped? " << order_swapped;
621 
622  // Fill the starting state, depending on the ordering above.
623  if ((theRefitDirection == insideOut && !order_swapped) || (theRefitDirection == outsideIn && order_swapped)) {
624  innerId = newTrack.innerDetId();
625  //UNUSED: outerId = newTrack.outerDetId();
626  firstTSOS = track.innermostMeasurementState();
627  lastTSOS = track.outermostMeasurementState();
628  inner_is_first = true;
629  }
630  else {
631  innerId = newTrack.outerDetId();
632  //UNUSED: outerId = newTrack.innerDetId();
633  firstTSOS = track.outermostMeasurementState();
634  lastTSOS = track.innermostMeasurementState();
635  inner_is_first = false;
636  }
637 
638  LogTrace(theCategory) << "firstTSOS: inner_is_first? " << inner_is_first
639  << " globalPosition is " << firstTSOS.globalPosition()
640  << " innerId is " << innerId;
641 
642  if(!firstTSOS.isValid()){
643  LogWarning(theCategory) << "Error wrong initial state!" << endl;
644  return vector<Trajectory>();
645  }
646 
647  firstTSOS.rescaleError(theRescaleErrorFactor);
648 
649  // This is the only way to get a TrajectorySeed with settable propagation direction
650  PTrajectoryStateOnDet garbage1;
652  PropagationDirection propDir =
653  (firstTSOS.globalPosition().basicVector().dot(firstTSOS.globalMomentum().basicVector())>0) ? alongMomentum : oppositeToMomentum;
654 
655  // These lines cause the code to ignore completely what was set
656  // above, and force propDir for tracks from collisions!
657 // if(propDir == alongMomentum && theRefitDirection == outsideIn) propDir=oppositeToMomentum;
658 // if(propDir == oppositeToMomentum && theRefitDirection == insideOut) propDir=alongMomentum;
659 
660  const TrajectoryStateOnSurface& tsosForDir = inner_is_first ? lastTSOS : firstTSOS;
661  propDir = (tsosForDir.globalPosition().basicVector().dot(tsosForDir.globalMomentum().basicVector())>0) ? alongMomentum : oppositeToMomentum;
662  LogTrace(theCategory) << "propDir based on firstTSOS x dot p is " << propDir
663  << " (alongMomentum == " << alongMomentum << ", oppositeToMomentum == " << oppositeToMomentum << ")";
664 
665  // Additional propagation diretcion determination logic for cosmic muons
666  if (theCosmicFlag) {
667  PropagationDirection propDir_first = (firstTSOS.globalPosition().basicVector().dot(firstTSOS.globalMomentum().basicVector()) > 0) ? alongMomentum : oppositeToMomentum;
668  PropagationDirection propDir_last = (lastTSOS .globalPosition().basicVector().dot(lastTSOS .globalMomentum().basicVector()) > 0) ? alongMomentum : oppositeToMomentum;
669  LogTrace(theCategory) << "propDir_first " << propDir_first << ", propdir_last " << propDir_last
670  << " : they " << (propDir_first == propDir_last ? "agree" : "disagree");
671 
672  int y_count = 0;
673  for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator it = recHitsForReFit.begin(); it != recHitsForReFit.end(); ++it) {
674  if ((*it)->globalPosition().y() > 0) ++y_count;
675  else --y_count;
676  }
677 
678  PropagationDirection propDir_ycount = alongMomentum;
679  if (y_count > 0) {
680  if (theRefitDirection == insideOut) propDir_ycount = oppositeToMomentum;
681  else if (theRefitDirection == outsideIn) propDir_ycount = alongMomentum;
682  }
683  else {
684  if (theRefitDirection == insideOut) propDir_ycount = alongMomentum;
685  else if (theRefitDirection == outsideIn) propDir_ycount = oppositeToMomentum;
686  }
687 
688  LogTrace(theCategory) << "y_count = " << y_count
689  << "; based on geometrically-outermost TSOS, propDir is " << propDir << ": "
690  << (propDir == propDir_ycount ? "agrees" : "disagrees")
691  << " with ycount determination";
692 
693  if (propDir_first != propDir_last) {
694  LogTrace(theCategory) << "since first/last disagreed, using y_count propDir";
695  propDir = propDir_ycount;
696  }
697  }
698 
699  TrajectorySeed seed(garbage1,garbage2,propDir);
700 
701  if(recHitsForReFit.front()->geographicalId() != DetId(innerId)){
702  LogDebug(theCategory)<<"Propagation occured"<<endl;
703  LogTrace(theCategory) << "propagating firstTSOS at " << firstTSOS.globalPosition()
704  << " to first rechit with surface pos " << recHitsForReFit.front()->det()->surface().toGlobal(LocalPoint(0,0,0));
705  firstTSOS = theService->propagator(thePropagatorName)->propagate(firstTSOS, recHitsForReFit.front()->det()->surface());
706  if(!firstTSOS.isValid()){
707  LogDebug(theCategory)<<"Propagation error!"<<endl;
708  return vector<Trajectory>();
709  }
710  }
711 
712 /*
713  cout << " GlobalMuonRefitter : theFitter " << propDir << endl;
714  cout << " First TSOS: "
715  << firstTSOS.globalPosition() << " p="
716  << firstTSOS.globalMomentum() << " = "
717  << firstTSOS.globalMomentum().mag() << endl;
718 
719  cout << " Starting seed: "
720  << " nHits= " << seed.nHits()
721  << " tsos: "
722  << seed.startingState().parameters().position() << " p="
723  << seed.startingState().parameters().momentum() << endl;
724 
725  cout << " RecHits: "
726  << recHitsForReFit.size() << endl;
727 */
728 
729  vector<Trajectory> trajectories = theFitter->fit(seed,recHitsForReFit,firstTSOS);
730 
731  if(trajectories.empty()){
732  LogDebug(theCategory) << "No Track refitted!" << endl;
733  return vector<Trajectory>();
734  }
735 
736  return trajectories;
737 }
#define LogDebug(id)
void printHits(const ConstRecHitContainer &) const
print all RecHits of a trajectory
const MuonServiceProxy * theService
RefitDirection theRefitDirection
std::string thePropagatorName
GlobalPoint globalPosition() const
PropagationDirection
std::unique_ptr< TrajectoryFitter > theFitter
TrajectoryStateOnSurface innermostMeasurementState() const
T mag() const
Definition: PV3DBase.h:67
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
Definition: Track.h:94
RefitDirection checkRecHitsOrdering(const ConstRecHitContainer &) const
TrajectoryStateOnSurface outermostMeasurementState() const
#define LogTrace(id)
std::vector< ConstRecHitPointer > ConstRecHitContainer
Definition: DetId.h:18
GlobalVector globalMomentum() const
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
Definition: Track.h:99
T dot(const Basic3DVector &rh) const
Scalar product, or &quot;dot&quot; product, with a vector of same type.

Member Data Documentation

edm::Handle<DTRecSegment4DCollection> GlobalMuonRefitter::all4DSegments
private

Definition at line 178 of file GlobalMuonRefitter.h.

Referenced by refit(), and setEvent().

edm::EDGetTokenT<DTRecSegment4DCollection> GlobalMuonRefitter::all4DSegmentsToken
private

Definition at line 176 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter(), and setEvent().

edm::Handle<CSCSegmentCollection> GlobalMuonRefitter::CSCSegments
private

Definition at line 177 of file GlobalMuonRefitter.h.

Referenced by refit(), and setEvent().

edm::EDGetTokenT<CSCSegmentCollection> GlobalMuonRefitter::CSCSegmentsToken
private

Definition at line 175 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter(), and setEvent().

reco::DYTInfo* GlobalMuonRefitter::dytInfo
private

Definition at line 160 of file GlobalMuonRefitter.h.

Referenced by getDYTInfo(), GlobalMuonRefitter(), refit(), and ~GlobalMuonRefitter().

TkClonerImpl GlobalMuonRefitter::hitCloner
private

Definition at line 167 of file GlobalMuonRefitter.h.

Referenced by setServices().

unsigned long long GlobalMuonRefitter::theCacheId_TRH
private

Definition at line 146 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter(), and setServices().

std::string GlobalMuonRefitter::theCategory
protected
bool GlobalMuonRefitter::theCosmicFlag
private

Definition at line 133 of file GlobalMuonRefitter.h.

Referenced by transform().

float GlobalMuonRefitter::theCSCChi2Cut
private

Definition at line 131 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter(), and selectMuonHits().

edm::InputTag GlobalMuonRefitter::theCSCRecHitLabel
private

Definition at line 136 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter().

edm::Handle<CSCRecHit2DCollection> GlobalMuonRefitter::theCSCRecHits
private

Definition at line 138 of file GlobalMuonRefitter.h.

Referenced by checkMuonHits(), and setEvent().

edm::EDGetTokenT<CSCRecHit2DCollection> GlobalMuonRefitter::theCSCRecHitToken
private

Definition at line 140 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter(), and setEvent().

float GlobalMuonRefitter::theDTChi2Cut
private

Definition at line 130 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter(), and selectMuonHits().

edm::InputTag GlobalMuonRefitter::theDTRecHitLabel
private

Definition at line 135 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter().

edm::Handle<DTRecHitCollection> GlobalMuonRefitter::theDTRecHits
private

Definition at line 137 of file GlobalMuonRefitter.h.

Referenced by checkMuonHits(), and setEvent().

edm::EDGetTokenT<DTRecHitCollection> GlobalMuonRefitter::theDTRecHitToken
private

Definition at line 139 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter(), and setEvent().

int GlobalMuonRefitter::theDYTselector
private

Definition at line 157 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter(), and refit().

std::vector<int> GlobalMuonRefitter::theDYTthrs
private

Definition at line 156 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter(), and refit().

bool GlobalMuonRefitter::theDYTupdator
private

Definition at line 158 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter(), and refit().

bool GlobalMuonRefitter::theDYTuseAPE
private

Definition at line 159 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter(), and refit().

const edm::Event* GlobalMuonRefitter::theEvent
private

Definition at line 173 of file GlobalMuonRefitter.h.

Referenced by refit(), and setEvent().

std::unique_ptr<TrajectoryFitter> GlobalMuonRefitter::theFitter
private

Definition at line 163 of file GlobalMuonRefitter.h.

Referenced by setServices(), and transform().

std::string GlobalMuonRefitter::theFitterName
private

Definition at line 162 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter(), and setServices().

int GlobalMuonRefitter::theHitThreshold
private

Definition at line 129 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter(), and selectMuonHits().

int GlobalMuonRefitter::theMuonHitsOption
private

Definition at line 127 of file GlobalMuonRefitter.h.

edm::ESHandle<TransientTrackingRecHitBuilder> GlobalMuonRefitter::theMuonRecHitBuilder
private

Definition at line 170 of file GlobalMuonRefitter.h.

Referenced by refit(), and setServices().

std::string GlobalMuonRefitter::theMuonRecHitBuilderName
private

Definition at line 169 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter(), and setServices().

float GlobalMuonRefitter::theProbCut
private

Definition at line 128 of file GlobalMuonRefitter.h.

std::string GlobalMuonRefitter::thePropagatorName
private

Definition at line 148 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter(), and transform().

float GlobalMuonRefitter::thePtCut
protected

Definition at line 123 of file GlobalMuonRefitter.h.

RefitDirection GlobalMuonRefitter::theRefitDirection
private

Definition at line 154 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter(), and transform().

double GlobalMuonRefitter::theRescaleErrorFactor
private

Definition at line 152 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter(), and transform().

float GlobalMuonRefitter::theRPCChi2Cut
private

Definition at line 132 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter(), and selectMuonHits().

bool GlobalMuonRefitter::theRPCInTheFit
private

Definition at line 150 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter(), and refit().

const MuonServiceProxy* GlobalMuonRefitter::theService
private

Definition at line 172 of file GlobalMuonRefitter.h.

Referenced by refit(), service(), setServices(), and transform().

int GlobalMuonRefitter::theSkipStation
private

Definition at line 142 of file GlobalMuonRefitter.h.

Referenced by getRidOfSelectStationHits(), and GlobalMuonRefitter().

bool GlobalMuonRefitter::theTkTrajsAvailableFlag
protected

Definition at line 122 of file GlobalMuonRefitter.h.

edm::ESHandle<TransientTrackingRecHitBuilder> GlobalMuonRefitter::theTrackerRecHitBuilder
private

Definition at line 166 of file GlobalMuonRefitter.h.

Referenced by refit(), and setServices().

std::string GlobalMuonRefitter::theTrackerRecHitBuilderName
private

Definition at line 165 of file GlobalMuonRefitter.h.

Referenced by GlobalMuonRefitter(), and setServices().

int GlobalMuonRefitter::theTrackerSkipSection
private

Definition at line 144 of file GlobalMuonRefitter.h.

Referenced by getRidOfSelectStationHits(), and GlobalMuonRefitter().

int GlobalMuonRefitter::theTrackerSkipSystem
private

Definition at line 143 of file GlobalMuonRefitter.h.

Referenced by getRidOfSelectStationHits(), and GlobalMuonRefitter().