test
CMS 3D CMS Logo

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

#include <FixTrackHitPattern.h>

Classes

struct  Result
 

Public Member Functions

Result analyze (const edm::EventSetup &iSetup, const reco::Track &track)
 
 FixTrackHitPattern ()
 
 ~FixTrackHitPattern ()
 

Private Member Functions

void init (const edm::EventSetup &iSetup)
 

Private Attributes

edm::ESHandle
< TransientTrackBuilder
trkTool_
 

Detailed Description

Definition at line 52 of file FixTrackHitPattern.h.

Constructor & Destructor Documentation

FixTrackHitPattern::FixTrackHitPattern ( )
inline

Definition at line 61 of file FixTrackHitPattern.h.

61 {}
FixTrackHitPattern::~FixTrackHitPattern ( )
inline

Definition at line 63 of file FixTrackHitPattern.h.

63 {}

Member Function Documentation

FixTrackHitPattern::Result FixTrackHitPattern::analyze ( const edm::EventSetup iSetup,
const reco::Track track 
)

Definition at line 28 of file FixTrackHitPattern.cc.

References alongMomentum, AnalyticalPropagator_cfi::AnalyticalPropagator, GetTrackTrajInfo::analyze(), reco::HitPattern::appendHit(), counter, HLT_25ns10e33_v2_cff::estimator, TrajectoryStateOnSurface::freeTrajectoryState(), edm::EventSetup::get(), reco::HitPattern::getHitPattern(), reco::HitPattern::getHitType(), reco::HitPattern::getLayer(), reco::HitPattern::getSubStructure(), AnalysisDataFormats_SUSYBSMObjects::hp, FixTrackHitPattern::Result::innerHitPattern, MeasurementDet::isActive(), j, LogDebug, bookConverter::max, TrackingRecHit::missing_inner, TrackingRecHit::missing_outer, reco::HitPattern::numberOfHits(), oppositeToMomentum, FixTrackHitPattern::Result::outerHitPattern, HLT_25ns10e33_v2_cff::propagator, mps_fire::result, mps_update::status, and patCandidatesForDimuonsSequences_cff::tracker.

Referenced by CheckHitPattern::analyze().

29 {
30  // Recalculate the inner and outer missing hit patterns. See header file for detailed comments.
31 
32  Result result;
33 #if 0
34  using namespace std;
35 
36  // Initialise Tracker geometry info (not sufficient to do this only on first call).
38  iSetup.get<TrackerRecoGeometryRecord>().get( tracker );
39 
40  // This is also needed to extrapolate amongst the tracker layers.
42  iSetup.get<NavigationSchoolRecord>().get("SimpleNavigationSchool",theSchool);
43  // NavigationSetter junk(*theSchool); FIXME FIXME (or not...)
44 
45  // This is needed to determine which sensors are functioning.
47  iSetup.get<CkfComponentsRecord>().get(measTk);
48  // Don't do this. It tries getting the tracker clusters, which do not exist in AOD.
49  // Hopefully not needed if one simply wants to know which sensors are active.
50  // measTk->update(iEvent);
51 
52  // Get the magnetic field and use it to define a propagator for extrapolating the track trajectory.
54  iSetup.get<IdealMagneticFieldRecord>().get(magField);
56 
57  // This is used to check if a track is compatible with crossing a sensor.
58  // Use +3.0 rather than default -3.0 here, so hit defined as inside acceptance if
59  // no more than 3*sigma outside detector edge, as opposed to more than 3*sigma inside detector edge.
61 
62  // Get the track trajectory and detLayer at each valid hit on the track.
63  static GetTrackTrajInfo getTrackTrajInfo;
64  vector<GetTrackTrajInfo::Result> trkTrajInfo = getTrackTrajInfo.analyze(iSetup, track);
65  unsigned int nValidHits = trkTrajInfo.size();
66 
67  // Calculate the inner and outer hitPatterns on the track.
68  // i.e. The list of where the track should have had hits inside its innermost valid hit
69  // and outside its outmost valid hit.
70 
71  enum InnerOuter {INNER = 1, OUTER=2};
72  for (unsigned int inOut = INNER; inOut <= OUTER; inOut++) {
73 
74  // Get the track trajectory and detLayer at the inner/outermost valid hit.
75  unsigned int ihit = (inOut == INNER) ? 0 : nValidHits - 1;
76 
77  // Check that information about the track trajectory was available for this hit.
78  if (trkTrajInfo[ihit].valid) {
79  const DetLayer* detLayer = trkTrajInfo[ihit].detLayer;
80  const TrajectoryStateOnSurface& detTSOS = trkTrajInfo[ihit].detTSOS;
81  const FreeTrajectoryState* detFTS = detTSOS.freeTrajectoryState();
82 
83  // When getting inner hit pattern, must propagate track inwards from innermost layer with valid hit.
84  // When getting outer hit pattern, must propagate track outwards from outermost layer with valid hit.
85  const PropagationDirection direc = (inOut == INNER) ? oppositeToMomentum : alongMomentum;
86 
87  // Find all layers this track is compatible with in the desired direction, starting from this layer.
88  // Based on code in RecoTracker/TrackProducer/interface/TrackProducerBase.icc
89  // N.B. The following call uses code in RecoTracker/TkNavigation/src/SimpleBarrelNavigableLayer::compatibleLayers()
90  // and RecoTracker/TkNavigation/src/SimpleNavigableLayer::wellInside().
91  // These make some curious checks on the direction of the trajectory relative to its starting point,
92  // so care was required above when calculating detFTS.
93  vector<const DetLayer*> compLayers = detLayer->compatibleLayers(*detFTS, direc);
94  LogDebug("FTHP")<<"Number of inner/outer "<<inOut<<" layers intercepted by track = "<<compLayers.size()<<endl;
95 
96  int counter = 0;
97  reco::HitPattern newHitPattern;
98 
99  for(vector<const DetLayer *>::const_iterator it=compLayers.begin(); it!=compLayers.end();
100  ++it){
101  if ((*it)->basicComponents().empty()) {
102  //this should never happen. but better protect for it
103  edm::LogWarning("FixTrackHitPattern")<<"a detlayer with no components: I can not figure out a DetId from this layer. please investigate.";
104  continue;
105  }
106 
107  // Find the sensor in this layer which is closest to the track trajectory.
108  // And get the track trajectory at that sensor.
109  propagator.setPropagationDirection(direc);
110  vector< GeometricSearchDet::DetWithState > detWithState = (*it)->compatibleDets(detTSOS, propagator, estimator);
111  // Check that at least one sensor was compatible with the track trajectory.
112  if(detWithState.size() > 0) {
113  // Check that this sensor is functional
114  DetId id = detWithState.front().first->geographicalId();
115  const MeasurementDet* measDet = measTk->idToDet(id);
116  if(measDet->isActive()){
117  // Hence record that the track should have produced a hit here, but did not.
118  // Store the information in a HitPattern.
120  newHitPattern.appendHit(tmpHit);
121  counter++;
122  } else {
123  // Missing hit expected here, since sensor was not functioning.
124  }
125  }
126  }//end loop over compatible layers
127 
128  // Store this result.
129  if (inOut == INNER) {
130  result.innerHitPattern = newHitPattern;
131  } else {
132  result.outerHitPattern = newHitPattern;
133  }
134 
135  // Print result for debugging.
136  LogDebug("FTHP")<<"Number of missing hits "<<newHitPattern.numberOfHits(HitPattern::ALL_HITS)<<"/"<<counter<<endl;
137  for (int j = 0; j < std::max(newHitPattern.numberOfHits(HitPattern::ALL_HITS), counter); j++) {
138  uint32_t hp = newHitPattern.getHitPattern(j);
139  uint32_t subDet = newHitPattern.getSubStructure(hp);
140  uint32_t layer = newHitPattern.getLayer(hp);
141  uint32_t status = newHitPattern.getHitType(hp);
142  LogDebug("FTHP")<<" layer with no matched hit at counter="<<j<<" subdet="<<subDet<<" layer="<<layer<<" status="<<status<<endl;
143  }
144 
145  } else {
146  LogDebug("FTHP")<<"WARNING: could not calculate inner/outer hit pattern as trajectory info for inner/out hit missing"<<endl;
147  }
148 #endif
149  return result;
150 }
#define LogDebug(id)
static uint32_t getLayer(uint16_t pattern)
Definition: HitPattern.h:700
PropagationDirection
tuple result
Definition: mps_fire.py:83
static uint32_t getHitType(uint16_t pattern)
Definition: HitPattern.h:733
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
susybsm::HSCParticleRefProd hp
Definition: classes.h:27
int j
Definition: DBlmapReader.cc:9
bool appendHit(const TrackingRecHit &hit, const TrackerTopology &ttopo)
Definition: HitPattern.cc:189
static uint32_t getSubStructure(uint16_t pattern)
Definition: HitPattern.h:691
std::vector< Result > analyze(const edm::EventSetup &iSetup, const reco::Track &track)
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:56
virtual bool isActive(const MeasurementTrackerEvent &data) const =0
static std::atomic< unsigned int > counter
uint16_t getHitPattern(HitCategory category, int position) const
Definition: HitPattern.h:515
int numberOfHits(HitCategory category) const
Definition: HitPattern.h:807
tuple status
Definition: mps_update.py:57
void FixTrackHitPattern::init ( const edm::EventSetup iSetup)
private

Member Data Documentation

edm::ESHandle<TransientTrackBuilder> FixTrackHitPattern::trkTool_
private

Definition at line 74 of file FixTrackHitPattern.h.