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 | Private Member Functions | Private Attributes
DynamicTruncation Class Reference

#include <DynamicTruncation.h>

Public Types

typedef
TransientTrackingRecHit::ConstRecHitContainer 
ConstRecHitContainer
 
typedef
TransientTrackingRecHit::ConstRecHitPointer 
ConstRecHitPointer
 

Public Member Functions

 DynamicTruncation (const edm::Event &, const MuonServiceProxy &)
 
TransientTrackingRecHit::ConstRecHitContainer filter (const Trajectory &)
 
reco::DYTInfo getDYTInfo ()
 
void setProd (const edm::Handle< DTRecSegment4DCollection > &DTSegProd, const edm::Handle< CSCSegmentCollection > &CSCSegProd)
 
void setSelector (int)
 
void setThr (const std::vector< int > &)
 
void setUpdateState (bool)
 
void setUseAPE (bool)
 
 ~DynamicTruncation ()
 

Private Member Functions

bool chooseLayers (int &, double const &, DTRecSegment4D const &, TrajectoryStateOnSurface const &, double const &, CSCSegment const &, TrajectoryStateOnSurface const &)
 
void compatibleDets (TrajectoryStateOnSurface &, std::map< int, std::vector< DetId > > &)
 
void correctThrByPtAndEta (double &)
 
void fillDYTInfos (int const &, bool const &, int &, double const &, double const &, DTRecSegment4D const &, CSCSegment const &)
 
void fillSegmentMaps (std::map< int, std::vector< DetId > > &, std::map< int, std::vector< DTRecSegment4D > > &, std::map< int, std::vector< CSCSegment > > &)
 
void filteringAlgo ()
 
void getThresholdFromCFG (double &, DetId const &)
 
void getThresholdFromDB (double &, DetId const &)
 
void preliminaryFit (std::map< int, std::vector< DetId > >, std::map< int, std::vector< DTRecSegment4D > >, std::map< int, std::vector< CSCSegment > >)
 
void sort (ConstRecHitContainer &)
 
int stationfromDet (DetId const &)
 
void testCSCstation (TrajectoryStateOnSurface &, std::vector< CSCSegment > const &, double &, CSCSegment &, TrajectoryStateOnSurface &)
 
void testDTstation (TrajectoryStateOnSurface &, std::vector< DTRecSegment4D > const &, double &, DTRecSegment4D &, TrajectoryStateOnSurface &)
 
void update (TrajectoryStateOnSurface &, ConstRecHitPointer)
 
void updateWithCSChits (TrajectoryStateOnSurface &, CSCSegment const &)
 
void updateWithDThits (TrajectoryStateOnSurface &, DTRecSegment4D const &)
 
void useSegment (DTRecSegment4D const &, TrajectoryStateOnSurface const &)
 
void useSegment (CSCSegment const &, TrajectoryStateOnSurface const &)
 

Private Attributes

std::map< CSCDetId, GlobalErrorcscApeMap
 
edm::ESHandle< CSCGeometrycscGeom
 
TrajectoryStateOnSurface currentState
 
bool doUpdateOfKFStates
 
std::map< DTChamberId,
GlobalError
dtApeMap
 
reco::DYTInfo dytInfo
 
int DYTselector
 
const DYTThrObjectdytThresholds
 
std::map< int, double > estimatorMap
 
ChamberSegmentUtilitygetSegs
 
std::map< int, DetIdidChamberMap
 
edm::ESHandle< MagneticFieldmagfield
 
double muonETAest
 
double muonPTest
 
DirectMuonNavigationnavigation
 
edm::ESHandle
< MuonDetLayerGeometry
navMuon
 
int nStationsUsed
 
ConstRecHitContainer prelFitMeas
 
TrajectoryStateOnSurface prelFitState
 
edm::ESHandle< Propagatorpropagator
 
edm::ESHandle< PropagatorpropagatorCompatibleDet
 
edm::ESHandle< PropagatorpropagatorPF
 
ConstRecHitContainer result
 
edm::ESHandle
< GlobalTrackingGeometry
theG
 
edm::ESHandle
< TransientTrackingRecHitBuilder
theMuonRecHitBuilder
 
ThrParametersthrManager
 
std::vector< int > Thrs
 
edm::ESHandle
< TrajectoryStateUpdator
updatorHandle
 
bool useAPE
 
bool useDBforThr
 
std::map< int, bool > usedStationMap
 

Detailed Description

Class: DynamicTruncation

Description: class for the dynamical stop of the KF according to the compatibility degree between the extrapolated track state and the reconstructed segment in the muon chambers

Authors : D. Pagano & G. Bruno - UCL Louvain

Definition at line 44 of file DynamicTruncation.h.

Member Typedef Documentation

Definition at line 49 of file DynamicTruncation.h.

Definition at line 48 of file DynamicTruncation.h.

Constructor & Destructor Documentation

DynamicTruncation::DynamicTruncation ( const edm::Event event,
const MuonServiceProxy theService 
)

Definition at line 38 of file DynamicTruncation.cc.

References ThrParameters::isValidThdDB(), HLT_ES_cff::magfield, and HLT_25ns10e33_v2_cff::propagator.

38  {
39  propagator = theService.propagator("SmartPropagatorAny");
40  propagatorPF = theService.propagator("SmartPropagatorAny");
41  propagatorCompatibleDet = theService.propagator("SmartPropagatorAny");
42  theG = theService.trackingGeometry();
43  theService.eventSetup().get<TransientRecHitRecord>().get("MuonRecHitBuilder",theMuonRecHitBuilder);
44  theService.eventSetup().get<TrackingComponentsRecord>().get("KFUpdator",updatorHandle);
45  theService.eventSetup().get<MuonGeometryRecord>().get(cscGeom);
46  theService.eventSetup().get<MuonRecoGeometryRecord>().get(navMuon);
47  theService.eventSetup().get<IdealMagneticFieldRecord>().get(magfield);
48  navigation = new DirectMuonNavigation(theService.detLayerGeometry());
50  thrManager = new ThrParameters(&theService.eventSetup());
52  if (useDBforThr) dytThresholds = thrManager->getInitialThresholds();
53  doUpdateOfKFStates = true;
54 }
DirectMuonNavigation * navigation
edm::ESHandle< Propagator > propagatorPF
edm::ESHandle< Propagator > propagatorCompatibleDet
ThrParameters * thrManager
edm::ESHandle< MuonDetLayerGeometry > navMuon
edm::ESHandle< TrajectoryStateUpdator > updatorHandle
const bool isValidThdDB()
Definition: ThrParameters.h:25
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
ChamberSegmentUtility * getSegs
const DYTThrObject * dytThresholds
edm::ESHandle< Propagator > propagator
const DYTThrObject * getInitialThresholds()
Definition: ThrParameters.h:28
edm::ESHandle< MagneticField > magfield
edm::ESHandle< GlobalTrackingGeometry > theG
edm::ESHandle< CSCGeometry > cscGeom
DynamicTruncation::~DynamicTruncation ( )

Definition at line 56 of file DynamicTruncation.cc.

56  {
57  delete navigation;
58  delete thrManager;
59  delete getSegs;
60 }
DirectMuonNavigation * navigation
ThrParameters * thrManager
ChamberSegmentUtility * getSegs

Member Function Documentation

bool DynamicTruncation::chooseLayers ( int &  incompLayers,
double const &  bestDTEstimator,
DTRecSegment4D const &  bestDTSeg,
TrajectoryStateOnSurface const &  tsosDT,
double const &  bestCSCEstimator,
CSCSegment const &  bestCSCSeg,
TrajectoryStateOnSurface const &  tsosCSC 
)
private

Definition at line 401 of file DynamicTruncation.cc.

References DTRecSegment4D::chamberId(), CSCSegment::cscDetId(), and MAX_THR.

402  {
403  double initThr = MAX_THR;
404  if (bestDTEstimator == MAX_THR && bestCSCEstimator == MAX_THR) return false;
405  if (bestDTEstimator <= bestCSCEstimator) {
406  // Get threshold for the chamber
407  if (useDBforThr) getThresholdFromDB(initThr, DetId(bestDTSeg.chamberId()));
408  else getThresholdFromCFG(initThr, DetId(bestDTSeg.chamberId()));
409  if (DYTselector == 0 || (DYTselector == 1 && bestDTEstimator < initThr) ||
410  (DYTselector == 2 && incompLayers < 2 && bestDTEstimator < initThr)) {
411  useSegment(bestDTSeg, tsosDT);
412  return true;
413  }
414  } else {
415  // Get threshold for the chamber
416  if (useDBforThr) getThresholdFromDB(initThr, DetId(bestCSCSeg.cscDetId()));
417  else getThresholdFromCFG(initThr, DetId(bestCSCSeg.cscDetId()));
418  if (DYTselector == 0 || (DYTselector == 1 && bestCSCEstimator < initThr) ||
419  (DYTselector == 2 && incompLayers < 2 && bestCSCEstimator < initThr)) {
420  useSegment(bestCSCSeg, tsosCSC);
421  return true;
422  }
423  }
424  return false;
425 }
void useSegment(DTRecSegment4D const &, TrajectoryStateOnSurface const &)
void getThresholdFromDB(double &, DetId const &)
#define MAX_THR
Definition: DetId.h:18
void getThresholdFromCFG(double &, DetId const &)
void DynamicTruncation::compatibleDets ( TrajectoryStateOnSurface tsos,
std::map< int, std::vector< DetId > > &  detMap 
)
private

Definition at line 250 of file DynamicTruncation.cc.

References alongMomentum, GeomDetEnumerators::CSC, GeomDetEnumerators::DT, and edm::first().

250  {
251  MuonPatternRecoDumper dumper;
252  MeasurementEstimator *theEstimator = new Chi2MeasurementEstimator(1000, 1000);
253  vector<const DetLayer *> navLayers;
255  unsigned int ilayerCorrected = 0;
256  for ( unsigned int ilayer=0; ilayer<navLayers.size(); ilayer++ ) {
257  // Skip RPC layers
258  if (navLayers[ilayer]->subDetector() != GeomDetEnumerators::DT &&
259  navLayers[ilayer]->subDetector() != GeomDetEnumerators::CSC) continue;
260  ilayerCorrected++;
261  vector<DetLayer::DetWithState> comps = navLayers[ilayer]->compatibleDets(currentState, *propagatorCompatibleDet, *theEstimator);
262  //cout << comps.size() << " compatible Dets with " << navLayers[ilayer]->subDetector() << " Layer " << ilayer << " "
263  //<< dumper.dumpLayer(navLayers[ilayer]);
264  if (comps.size() > 0) {
265  for ( unsigned int icomp=0; icomp<comps.size(); icomp++ ) {
266  DetId id(comps[icomp].first->geographicalId().rawId());
267  detMap[ilayerCorrected].push_back(id);
268  }
269  }
270  }
271  if (theEstimator) delete theEstimator;
272 }
DirectMuonNavigation * navigation
TrajectoryStateOnSurface currentState
edm::ESHandle< Propagator > propagatorCompatibleDet
std::vector< const DetLayer * > compatibleLayers(const FreeTrajectoryState &fts, PropagationDirection timeDirection) const
FreeTrajectoryState const * freeState(bool withErrors=true) const
Definition: DetId.h:18
void DynamicTruncation::correctThrByPtAndEta ( double &  thr)
private

Definition at line 443 of file DynamicTruncation.cc.

443  {
444 
446  // This section will be implemented //
447  // after the release of APEs //
449 
450 }
void DynamicTruncation::fillDYTInfos ( int const &  st,
bool const &  chosenLayer,
int &  incompConLay,
double const &  bestDTEstimator,
double const &  bestCSCEstimator,
DTRecSegment4D const &  bestDTSeg,
CSCSegment const &  bestCSCSeg 
)
private

Definition at line 225 of file DynamicTruncation.cc.

References DTRecSegment4D::chamberId(), and CSCSegment::cscDetId().

227  {
228  if (chosenLayer) {
229  nStationsUsed++;
230  incompConLay = 0;
231  if (bestDTEstimator <= bestCSCEstimator) {
232  estimatorMap[st] = bestDTEstimator;
233  DetId id(bestDTSeg.chamberId());
234  idChamberMap[st] = id;
235  } else {
236  DetId id(bestCSCSeg.cscDetId());
237  idChamberMap[st] = id;
238  estimatorMap[st] = bestCSCEstimator;
239  }
240  usedStationMap[st] = true;
241  } else {
242  incompConLay++;
243  estimatorMap[st] = -1;
244  usedStationMap[st] = false;
245  }
246 }
std::map< int, bool > usedStationMap
std::map< int, DetId > idChamberMap
Definition: DetId.h:18
std::map< int, double > estimatorMap
void DynamicTruncation::fillSegmentMaps ( std::map< int, std::vector< DetId > > &  compatibleIds,
std::map< int, std::vector< DTRecSegment4D > > &  dtSegMap,
std::map< int, std::vector< CSCSegment > > &  cscSegMap 
)
private

Definition at line 276 of file DynamicTruncation.cc.

References MuonSubdetId::CSC, MuonSubdetId::DT, j, relval_2017::k, and tmp.

278  {
279  for (map<int, vector<DetId> >::iterator it=compatibleIds.begin(); it!=compatibleIds.end(); ++it) {
280  vector<DetId> ids = compatibleIds[it->first];
281  for (unsigned j = 0; j < ids.size(); j++) {
282  if (ids[j].subdetId() == MuonSubdetId::CSC) {
283  CSCDetId ch(ids[j]);
284  vector<CSCSegment> tmp = getSegs->getCSCSegmentsInChamber(ch);
285  for (unsigned int k = 0; k < tmp.size(); k++) cscSegMap[it->first].push_back(tmp[k]);
286  }
287  if (ids[j].subdetId() == MuonSubdetId::DT) {
288  DTChamberId ch(ids[j]);
289  vector<DTRecSegment4D> tmp = getSegs->getDTSegmentsInChamber(ch);
290  for (unsigned int k = 0; k < tmp.size(); k++) dtSegMap[it->first].push_back(tmp[k]);
291  }
292  }
293  }
294 }
std::vector< DTRecSegment4D > getDTSegmentsInChamber(DTChamberId)
std::vector< CSCSegment > getCSCSegmentsInChamber(CSCDetId)
static const int CSC
Definition: MuonSubdetId.h:13
int j
Definition: DBlmapReader.cc:9
ChamberSegmentUtility * getSegs
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
static const int DT
Definition: MuonSubdetId.h:12
TransientTrackingRecHit::ConstRecHitContainer DynamicTruncation::filter ( const Trajectory traj)

Definition at line 132 of file DynamicTruncation.cc.

References DetId::det(), TrajectoryMeasurement::forwardPredictedState(), TrackingRecHit::geographicalId(), TrajectoryStateOnSurface::globalPosition(), PV3DBase< T, PVType, FrameType >::mag(), Trajectory::measurements(), TrajectoryMeasurement::recHit(), mps_fire::result, DetId::Tracker, and update.

Referenced by GlobalMuonRefitter::refit().

132  {
133  result.clear();
134  prelFitMeas.clear();
135 
136  // Get APE maps
139 
140  // Get Last tracker TSOS (updated)
141  vector<TrajectoryMeasurement> muonMeasurements = traj.measurements();
142  TrajectoryMeasurement lastTKm = muonMeasurements.front();
143  for (vector<TrajectoryMeasurement>::const_iterator imT = muonMeasurements.begin(); imT != muonMeasurements.end(); imT++ ) {
144  if ( !(*imT).recHit()->isValid() ) continue;
145  const TransientTrackingRecHit* hit = &(*(*imT).recHit());
146  if (hit->geographicalId().det() == DetId::Tracker) {
147  result.push_back((*imT).recHit());
148  if (!(*imT).forwardPredictedState().isValid()) continue;
149  if ((*imT).forwardPredictedState().globalPosition().mag() >
150  lastTKm.forwardPredictedState().globalPosition().mag()) lastTKm = *imT;
151  }
152  }
154  update(currentState, lastTKm.recHit());
155 
157  update(prelFitState, lastTKm.recHit());
159 
160  // Run the DYT
161  filteringAlgo();
162 
163  return result;
164 }
ConstRecHitPointer const & recHit() const
TrajectoryStateOnSurface currentState
GlobalPoint globalPosition() const
ThrParameters * thrManager
TrajectoryStateOnSurface prelFitState
DataContainer const & measurements() const
Definition: Trajectory.h:250
T mag() const
Definition: PV3DBase.h:67
ConstRecHitContainer result
ConstRecHitContainer prelFitMeas
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
std::map< DTChamberId, GlobalError > dtApeMap
void update(TrajectoryStateOnSurface &, ConstRecHitPointer)
const std::map< DTChamberId, GlobalError > & GetDTApeMap()
Definition: ThrParameters.h:26
const std::map< CSCDetId, GlobalError > & GetCSCApeMap()
Definition: ThrParameters.h:27
DetId geographicalId() const
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
std::map< CSCDetId, GlobalError > cscApeMap
void DynamicTruncation::filteringAlgo ( )
private

Definition at line 168 of file DynamicTruncation.cc.

References MAX_THR.

168  {
169  map<int, vector<DetId> > compatibleIds;
170  map<int, vector<DTRecSegment4D> > dtSegMap;
171  map<int, vector<CSCSegment> > cscSegMap;
172  int incompConLay = 0;
173  nStationsUsed = 0;
174 
175  // Get list of compatible layers
176  compatibleDets(currentState, compatibleIds);
177 
178  // Fill segment maps
179  fillSegmentMaps(compatibleIds, dtSegMap, cscSegMap);
180 
181  // Do a preliminary fit
182  if (useDBforThr) preliminaryFit(compatibleIds, dtSegMap, cscSegMap);
183 
184  // Loop on compatible layers
185  for (map<int, vector<DetId> >::iterator it=compatibleIds.begin(); it!=compatibleIds.end(); ++it) {
186  int stLayer = stationfromDet(it->second.front());
187  DTRecSegment4D bestDTSeg;
188  CSCSegment bestCSCSeg;
189  double bestDTEstimator = MAX_THR;
190  double bestCSCEstimator = MAX_THR;
191  vector<DTRecSegment4D> dtSegs = dtSegMap[it->first];
192  vector<CSCSegment> cscSegs = cscSegMap[it->first];
193 
194  // DT case: find the most compatible segment
195  TrajectoryStateOnSurface tsosDTlayer;
196  testDTstation(currentState, dtSegs, bestDTEstimator, bestDTSeg, tsosDTlayer);
197 
198  // CSC case: find the most compatible segment
199  TrajectoryStateOnSurface tsosCSClayer;
200  testCSCstation(currentState, cscSegs, bestCSCEstimator, bestCSCSeg, tsosCSClayer);
201 
202  // Decide whether to keep the layer or not
203  bool chosenLayer = chooseLayers(incompConLay, bestDTEstimator, bestDTSeg, tsosDTlayer, bestCSCEstimator, bestCSCSeg, tsosCSClayer);
204  fillDYTInfos(stLayer, chosenLayer, incompConLay, bestDTEstimator, bestCSCEstimator, bestDTSeg, bestCSCSeg);
205  }
206  //cout << "Number of used stations = " << nStationsUsed << endl;
207 }
void compatibleDets(TrajectoryStateOnSurface &, std::map< int, std::vector< DetId > > &)
TrajectoryStateOnSurface currentState
void fillSegmentMaps(std::map< int, std::vector< DetId > > &, std::map< int, std::vector< DTRecSegment4D > > &, std::map< int, std::vector< CSCSegment > > &)
void testDTstation(TrajectoryStateOnSurface &, std::vector< DTRecSegment4D > const &, double &, DTRecSegment4D &, TrajectoryStateOnSurface &)
void testCSCstation(TrajectoryStateOnSurface &, std::vector< CSCSegment > const &, double &, CSCSegment &, TrajectoryStateOnSurface &)
#define MAX_THR
void preliminaryFit(std::map< int, std::vector< DetId > >, std::map< int, std::vector< DTRecSegment4D > >, std::map< int, std::vector< CSCSegment > >)
void fillDYTInfos(int const &, bool const &, int &, double const &, double const &, DTRecSegment4D const &, CSCSegment const &)
bool chooseLayers(int &, double const &, DTRecSegment4D const &, TrajectoryStateOnSurface const &, double const &, CSCSegment const &, TrajectoryStateOnSurface const &)
int stationfromDet(DetId const &)
reco::DYTInfo DynamicTruncation::getDYTInfo ( )
inline

Definition at line 69 of file DynamicTruncation.h.

References dytInfo, estimatorMap, idChamberMap, nStationsUsed, reco::DYTInfo::setDYTEstimators(), reco::DYTInfo::setIdChambers(), reco::DYTInfo::setNStUsed(), reco::DYTInfo::setUsedStations(), and usedStationMap.

Referenced by GlobalMuonRefitter::refit().

69  {
74  return dytInfo;
75  }
void setUsedStations(const std::map< int, bool > &ustMap)
Definition: DYTInfo.h:37
std::map< int, bool > usedStationMap
void setDYTEstimators(const std::map< int, double > &dytEstMap)
Definition: DYTInfo.h:26
std::map< int, DetId > idChamberMap
void setNStUsed(int NStUsed)
Definition: DYTInfo.h:22
reco::DYTInfo dytInfo
void setIdChambers(const std::map< int, DetId > &IdChambersMap)
Definition: DYTInfo.h:46
std::map< int, double > estimatorMap
void DynamicTruncation::getThresholdFromCFG ( double &  thr,
DetId const &  id 
)
private

Definition at line 454 of file DynamicTruncation.cc.

References MuonSubdetId::CSC, and MuonSubdetId::DT.

454  {
455  if (id.subdetId() == MuonSubdetId::DT) {
456  thr = Thrs[0];
457  }
458  if (id.subdetId() == MuonSubdetId::CSC) {
459  thr = Thrs[1];
460  }
461 }
static const int CSC
Definition: MuonSubdetId.h:13
std::vector< int > Thrs
static const int DT
Definition: MuonSubdetId.h:12
void DynamicTruncation::getThresholdFromDB ( double &  thr,
DetId const &  id 
)
private

Definition at line 429 of file DynamicTruncation.cc.

References DYTThrObject::DytThrStruct::id, getGTfromDQMFile::obj, and DYTThrObject::DytThrStruct::thr.

429  {
430  vector<DYTThrObject::DytThrStruct> thrvector = dytThresholds->thrsVec;
431  for (vector<DYTThrObject::DytThrStruct>::const_iterator it = thrvector.begin(); it != thrvector.end(); it++) {
433  if (obj.id == id) {
434  thr = obj.thr;
435  break;
436  }
437  }
439 }
void correctThrByPtAndEta(double &)
std::vector< DytThrStruct > thrsVec
Definition: DYTThrObject.h:17
const DYTThrObject * dytThresholds
void DynamicTruncation::preliminaryFit ( std::map< int, std::vector< DetId > >  compatibleIds,
std::map< int, std::vector< DTRecSegment4D > >  dtSegMap,
std::map< int, std::vector< CSCSegment > >  cscSegMap 
)
private

Definition at line 356 of file DynamicTruncation.cc.

References DTRecSegment4D::chamberId(), CSCSegment::cscDetId(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::isValid(), MAX_THR, PV3DBase< T, PVType, FrameType >::perp(), and tmp.

357  {
358  for (map<int, vector<DetId> >::iterator it=compatibleIds.begin(); it!=compatibleIds.end(); ++it) {
359  DTRecSegment4D bestDTSeg;
360  CSCSegment bestCSCSeg;
361  double bestDTEstimator = MAX_THR;
362  double bestCSCEstimator = MAX_THR;
363  double initThr = MAX_THR;
364  vector<DTRecSegment4D> dtSegs = dtSegMap[it->first];
365  vector<CSCSegment> cscSegs = cscSegMap[it->first];
366 
367  // DT case: find the most compatible segment
368  TrajectoryStateOnSurface tsosDTlayer;
369  testDTstation(prelFitState, dtSegs, bestDTEstimator, bestDTSeg, tsosDTlayer);
370 
371  // CSC case: find the most compatible segment
372  TrajectoryStateOnSurface tsosCSClayer;
373  testCSCstation(prelFitState, cscSegs, bestCSCEstimator, bestCSCSeg, tsosCSClayer);
374 
375  // Decide whether to keep the layer or not
376  if (bestDTEstimator == MAX_THR && bestCSCEstimator == MAX_THR) continue;
377  if (bestDTEstimator <= bestCSCEstimator) {
378  getThresholdFromCFG(initThr, DetId(bestDTSeg.chamberId()));
379  if (bestDTEstimator >= initThr) continue;
380  prelFitMeas.push_back(theMuonRecHitBuilder->build(&bestDTSeg));
381  prelFitState = updatorHandle->update(tsosDTlayer, *theMuonRecHitBuilder->build(&bestDTSeg));
382  } else {
383  getThresholdFromCFG(initThr, DetId(bestCSCSeg.cscDetId()));
384  if (bestCSCEstimator >= initThr) continue;
385  prelFitMeas.push_back(theMuonRecHitBuilder->build(&bestCSCSeg));
386  prelFitState = updatorHandle->update(tsosCSClayer, *theMuonRecHitBuilder->build(&bestCSCSeg));
387  }
388  }
389  if (!prelFitMeas.empty()) prelFitMeas.pop_back();
390  for (auto imrh = prelFitMeas.rbegin(); imrh != prelFitMeas.rend(); ++imrh) {
391  DetId id = (*imrh)->geographicalId();
392  TrajectoryStateOnSurface tmp = propagatorPF->propagate(prelFitState, theG->idToDet(id)->surface());
393  if (tmp.isValid()) prelFitState = tmp;
394  }
397 }
edm::ESHandle< Propagator > propagatorPF
T perp() const
Definition: PV3DBase.h:72
CSCDetId cscDetId() const
Definition: CSCSegment.h:69
virtual DTChamberId chamberId() const
The (specific) DetId of the chamber on which the segment resides.
void testDTstation(TrajectoryStateOnSurface &, std::vector< DTRecSegment4D > const &, double &, DTRecSegment4D &, TrajectoryStateOnSurface &)
TrajectoryStateOnSurface prelFitState
void testCSCstation(TrajectoryStateOnSurface &, std::vector< CSCSegment > const &, double &, CSCSegment &, TrajectoryStateOnSurface &)
edm::ESHandle< TrajectoryStateUpdator > updatorHandle
ConstRecHitContainer prelFitMeas
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
#define MAX_THR
Definition: DetId.h:18
T eta() const
Definition: PV3DBase.h:76
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
GlobalVector globalMomentum() const
edm::ESHandle< GlobalTrackingGeometry > theG
void getThresholdFromCFG(double &, DetId const &)
void DynamicTruncation::setProd ( const edm::Handle< DTRecSegment4DCollection > &  DTSegProd,
const edm::Handle< CSCSegmentCollection > &  CSCSegProd 
)
inline

Definition at line 55 of file DynamicTruncation.h.

References getSegs, and ChamberSegmentUtility::initCSU().

Referenced by GlobalMuonRefitter::refit().

56  {
57  getSegs->initCSU(DTSegProd, CSCSegProd);
58  }
void initCSU(const edm::Handle< DTRecSegment4DCollection > &, const edm::Handle< CSCSegmentCollection > &)
ChamberSegmentUtility * getSegs
void DynamicTruncation::setSelector ( int  selector)

Definition at line 99 of file DynamicTruncation.cc.

References Exception.

Referenced by GlobalMuonRefitter::refit().

99  {
100  if (selector < 0 || selector > 2) throw cms::Exception("NotAvailable") << "DYT selector: wrong option!" << endl;
101  //if (selector == 0) cout << "[DYT disabled]\n";
102  //if (selector == 1) cout << "[use all compatible stations]\n";
103  //if (selector == 2) cout << "[stop at second consecutive incompatible station]\n";
104  DYTselector = selector;
105 
106 }
void DynamicTruncation::setThr ( const std::vector< int > &  thr)

Definition at line 116 of file DynamicTruncation.cc.

References Exception, i, and MAX_THR.

Referenced by GlobalMuonRefitter::refit().

116  {
117  if (thr.size() == 2) {
118  for (unsigned int i = 0; i < thr.size(); i++)
119  if (thr[i] >= 0) Thrs.push_back(thr[i]);
120  else Thrs.push_back(MAX_THR);
121  return;
122  }
123  throw cms::Exception("NotAvailable") << "WARNING: wrong size for the threshold vector!\nExpected size: 2\n Found size: " << thr.size();
124 }
int i
Definition: DBlmapReader.cc:9
#define MAX_THR
std::vector< int > Thrs
void DynamicTruncation::setUpdateState ( bool  upState)

Definition at line 112 of file DynamicTruncation.cc.

Referenced by GlobalMuonRefitter::refit().

112  {
113  doUpdateOfKFStates = upState;
114 }
void DynamicTruncation::setUseAPE ( bool  useAPE_)

Definition at line 108 of file DynamicTruncation.cc.

Referenced by GlobalMuonRefitter::refit().

108  {
109  useAPE = useAPE_;
110 }
void DynamicTruncation::sort ( ConstRecHitContainer recHits)
private

Definition at line 465 of file DynamicTruncation.cc.

References i, j, mag(), gen::n, and edm::swap().

465  {
466  unsigned int i=0;
467  unsigned int j=0;
469  for(i=1; i<n; ++i)
470  for(j=n-1; j>=i; --j)
471  if(recHits[j-1]->globalPosition().mag() > recHits[j]->globalPosition().mag()) swap (recHits[j-1],recHits[j]);
472 }
void swap(ora::Record &rh, ora::Record &lh)
Definition: Record.h:70
int i
Definition: DBlmapReader.cc:9
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
uint16_t size_type
int j
Definition: DBlmapReader.cc:9
int DynamicTruncation::stationfromDet ( DetId const &  det)
private

Definition at line 211 of file DynamicTruncation.cc.

References MuonSubdetId::CSC, MuonSubdetId::DT, DTChamberId::station(), CSCDetId::station(), and DetId::subdetId().

211  {
212  if (det.subdetId() == MuonSubdetId::CSC) {
213  CSCDetId ch(det);
214  return ch.station();
215  }
216  if (det.subdetId() == MuonSubdetId::DT) {
217  DTChamberId ch(det);
218  return ch.station();
219  }
220  return 0;
221 }
static const int CSC
Definition: MuonSubdetId.h:13
static const int DT
Definition: MuonSubdetId.h:12
void DynamicTruncation::testCSCstation ( TrajectoryStateOnSurface startingState,
std::vector< CSCSegment > const &  segments,
double &  bestEstimator,
CSCSegment bestSeg,
TrajectoryStateOnSurface tsoscsc 
)
private

Definition at line 319 of file DynamicTruncation.cc.

References HLT_25ns10e33_v2_cff::estimator, HLT_25ns10e33_v2_cff::propagator, TrajectoryStateOnSurface::surface(), ErrorFrameTransformer::transform(), and StateSegmentMatcher::value().

320  {
321  if (segments.size() == 0) return;
322  for (unsigned int iSeg = 0; iSeg < segments.size(); iSeg++) {
323  CSCDetId chamber(segments[iSeg].cscDetId());
324  if (!propagator->propagate(startingState, theG->idToDet(chamber)->surface()).isValid()) continue;
325  tsoscsc = propagator->propagate(startingState, theG->idToDet(chamber)->surface());
326  //if (!tsoscsc.isValid()) continue;
327  LocalError apeLoc;
328  if (useAPE) apeLoc = ErrorFrameTransformer().transform(cscApeMap.find(chamber)->second, theG->idToDet(chamber)->surface());
329  StateSegmentMatcher estim(tsoscsc, segments[iSeg], apeLoc);
330  double estimator = estim.value();
331  //cout << "estimator CSC = " << estimator << endl;
332  if (estimator >= bestEstimator) continue;
333  bestEstimator = estimator;
334  bestSeg = segments[iSeg];
335  }
336 }
static GlobalError transform(const LocalError &le, const Surface &surf)
edm::ESHandle< Propagator > propagator
std::map< CSCDetId, GlobalError > cscApeMap
edm::ESHandle< GlobalTrackingGeometry > theG
void DynamicTruncation::testDTstation ( TrajectoryStateOnSurface startingState,
std::vector< DTRecSegment4D > const &  segments,
double &  bestEstimator,
DTRecSegment4D bestSeg,
TrajectoryStateOnSurface tsosdt 
)
private

Definition at line 298 of file DynamicTruncation.cc.

References HLT_25ns10e33_v2_cff::estimator, HLT_25ns10e33_v2_cff::propagator, TrajectoryStateOnSurface::surface(), ErrorFrameTransformer::transform(), and StateSegmentMatcher::value().

299  {
300  if (segments.size() == 0) return;
301  for (unsigned int iSeg = 0; iSeg < segments.size(); iSeg++) {
302  DTChamberId chamber(segments[iSeg].chamberId());
303  if (!propagator->propagate(startingState, theG->idToDet(chamber)->surface()).isValid()) continue;
304  tsosdt = propagator->propagate(startingState, theG->idToDet(chamber)->surface());
305  //if (!tsosdt.isValid()) continue;
306  LocalError apeLoc;
307  if (useAPE) apeLoc = ErrorFrameTransformer().transform(dtApeMap.find(chamber)->second, theG->idToDet(chamber)->surface());
308  StateSegmentMatcher estim(tsosdt, segments[iSeg], apeLoc);
309  double estimator = estim.value();
310  //cout << "estimator DT = " << estimator << endl;
311  if (estimator >= bestEstimator) continue;
312  bestEstimator = estimator;
313  bestSeg = segments[iSeg];
314  }
315 }
static GlobalError transform(const LocalError &le, const Surface &surf)
std::map< DTChamberId, GlobalError > dtApeMap
edm::ESHandle< Propagator > propagator
edm::ESHandle< GlobalTrackingGeometry > theG
void DynamicTruncation::update ( TrajectoryStateOnSurface tsos,
ConstRecHitPointer  rechit 
)
private

Definition at line 62 of file DynamicTruncation.cc.

References TrajectoryStateOnSurface::isValid(), groupFilesInBlocks::temp, and TrajectoryStateOnSurface::update().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

62  {
63  TrajectoryStateOnSurface temp = updatorHandle->update(tsos, *rechit);
64  if (temp.isValid()) tsos = updatorHandle->update(tsos, *rechit);
65 }
edm::ESHandle< TrajectoryStateUpdator > updatorHandle
void DynamicTruncation::updateWithCSChits ( TrajectoryStateOnSurface tsos,
CSCSegment const &  bestCSCSeg 
)
private

Definition at line 81 of file DynamicTruncation.cc.

References TrajectoryStateOnSurface::isValid(), HLT_25ns10e33_v2_cff::propagator, CSCSegment::specificRecHits(), GeomDet::surface(), groupFilesInBlocks::temp, and TrajectoryStateOnSurface::update().

81  {
82  ConstRecHitContainer tmprecHits;
83  vector<CSCRecHit2D> CSCrh = bestCSCSeg.specificRecHits();
84  for (vector<CSCRecHit2D>::iterator it = CSCrh.begin(); it != CSCrh.end(); ++it) {
85  tmprecHits.push_back(theMuonRecHitBuilder->build(&*it));
86  }
87  sort(tmprecHits);
88  for (ConstRecHitContainer::const_iterator it = tmprecHits.begin(); it != tmprecHits.end(); ++it) {
89  const CSCLayer* cscLayer = cscGeom->layer((*it)->det()->geographicalId());
90  TrajectoryStateOnSurface temp = propagator->propagate(tsos, cscLayer->surface());
91  if (temp.isValid()) tsos = updatorHandle->update(temp, **it);
92  }
93 }
void sort(ConstRecHitContainer &)
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
edm::ESHandle< TrajectoryStateUpdator > updatorHandle
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
edm::ESHandle< Propagator > propagator
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
edm::ESHandle< CSCGeometry > cscGeom
void DynamicTruncation::updateWithDThits ( TrajectoryStateOnSurface tsos,
DTRecSegment4D const &  bestDTSeg 
)
private

Definition at line 67 of file DynamicTruncation.cc.

References HLT_25ns10e33_v2_cff::propagator, DTRecSegment4D::recHits(), TrajectoryStateOnSurface::surface(), groupFilesInBlocks::temp, and TrajectoryStateOnSurface::update().

67  {
68  ConstRecHitContainer tmprecHits;
69  vector<const TrackingRecHit*> DTrh = bestDTSeg.recHits();
70  for (vector<const TrackingRecHit*>::iterator it = DTrh.begin(); it != DTrh.end(); it++) {
71  tmprecHits.push_back(theMuonRecHitBuilder->build(*it));
72  }
73  sort(tmprecHits);
74  for (ConstRecHitContainer::const_iterator it = tmprecHits.begin(); it != tmprecHits.end(); ++it) {
75  DTLayerId layid((*it)->det()->geographicalId());
76  TrajectoryStateOnSurface temp = propagator->propagate(tsos, theG->idToDet(layid)->surface());
77  if (temp.isValid()) tsos = updatorHandle->update(temp, **it);
78  }
79 }
void sort(ConstRecHitContainer &)
edm::ESHandle< TrajectoryStateUpdator > updatorHandle
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
edm::ESHandle< Propagator > propagator
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
edm::ESHandle< GlobalTrackingGeometry > theG
void DynamicTruncation::useSegment ( DTRecSegment4D const &  bestDTSeg,
TrajectoryStateOnSurface const &  tsosDT 
)
private

Definition at line 340 of file DynamicTruncation.cc.

References mps_fire::result.

340  {
341  result.push_back(theMuonRecHitBuilder->build(&bestDTSeg));
343  else currentState = tsosDT;
344 }
TrajectoryStateOnSurface currentState
ConstRecHitContainer result
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
void updateWithDThits(TrajectoryStateOnSurface &, DTRecSegment4D const &)
void DynamicTruncation::useSegment ( CSCSegment const &  bestCSCSeg,
TrajectoryStateOnSurface const &  tsosCSC 
)
private

Definition at line 348 of file DynamicTruncation.cc.

References mps_fire::result.

348  {
349  result.push_back(theMuonRecHitBuilder->build(&bestCSCSeg));
351  else currentState = tsosCSC;
352 }
TrajectoryStateOnSurface currentState
void updateWithCSChits(TrajectoryStateOnSurface &, CSCSegment const &)
ConstRecHitContainer result
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder

Member Data Documentation

std::map<CSCDetId, GlobalError> DynamicTruncation::cscApeMap
private

Definition at line 120 of file DynamicTruncation.h.

edm::ESHandle<CSCGeometry> DynamicTruncation::cscGeom
private

Definition at line 107 of file DynamicTruncation.h.

TrajectoryStateOnSurface DynamicTruncation::currentState
private

Definition at line 116 of file DynamicTruncation.h.

bool DynamicTruncation::doUpdateOfKFStates
private

Definition at line 126 of file DynamicTruncation.h.

std::map<DTChamberId, GlobalError> DynamicTruncation::dtApeMap
private

Definition at line 119 of file DynamicTruncation.h.

reco::DYTInfo DynamicTruncation::dytInfo
private

Definition at line 118 of file DynamicTruncation.h.

Referenced by getDYTInfo().

int DynamicTruncation::DYTselector
private

Definition at line 102 of file DynamicTruncation.h.

const DYTThrObject* DynamicTruncation::dytThresholds
private

Definition at line 122 of file DynamicTruncation.h.

std::map<int, double> DynamicTruncation::estimatorMap
private

Definition at line 113 of file DynamicTruncation.h.

Referenced by getDYTInfo().

ChamberSegmentUtility* DynamicTruncation::getSegs
private

Definition at line 123 of file DynamicTruncation.h.

Referenced by setProd().

std::map<int, DetId> DynamicTruncation::idChamberMap
private

Definition at line 115 of file DynamicTruncation.h.

Referenced by getDYTInfo().

edm::ESHandle<MagneticField> DynamicTruncation::magfield
private

Definition at line 112 of file DynamicTruncation.h.

double DynamicTruncation::muonETAest
private

Definition at line 121 of file DynamicTruncation.h.

double DynamicTruncation::muonPTest
private

Definition at line 121 of file DynamicTruncation.h.

DirectMuonNavigation* DynamicTruncation::navigation
private

Definition at line 111 of file DynamicTruncation.h.

edm::ESHandle<MuonDetLayerGeometry> DynamicTruncation::navMuon
private

Definition at line 110 of file DynamicTruncation.h.

int DynamicTruncation::nStationsUsed
private

Definition at line 101 of file DynamicTruncation.h.

Referenced by getDYTInfo().

ConstRecHitContainer DynamicTruncation::prelFitMeas
private

Definition at line 98 of file DynamicTruncation.h.

TrajectoryStateOnSurface DynamicTruncation::prelFitState
private

Definition at line 117 of file DynamicTruncation.h.

edm::ESHandle<Propagator> DynamicTruncation::propagator
private

Definition at line 103 of file DynamicTruncation.h.

edm::ESHandle<Propagator> DynamicTruncation::propagatorCompatibleDet
private

Definition at line 105 of file DynamicTruncation.h.

edm::ESHandle<Propagator> DynamicTruncation::propagatorPF
private

Definition at line 104 of file DynamicTruncation.h.

ConstRecHitContainer DynamicTruncation::result
private

Definition at line 98 of file DynamicTruncation.h.

edm::ESHandle<GlobalTrackingGeometry> DynamicTruncation::theG
private

Definition at line 106 of file DynamicTruncation.h.

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

Definition at line 108 of file DynamicTruncation.h.

ThrParameters* DynamicTruncation::thrManager
private

Definition at line 124 of file DynamicTruncation.h.

std::vector<int> DynamicTruncation::Thrs
private

Definition at line 100 of file DynamicTruncation.h.

edm::ESHandle<TrajectoryStateUpdator> DynamicTruncation::updatorHandle
private

Definition at line 109 of file DynamicTruncation.h.

bool DynamicTruncation::useAPE
private

Definition at line 99 of file DynamicTruncation.h.

bool DynamicTruncation::useDBforThr
private

Definition at line 125 of file DynamicTruncation.h.

std::map<int, bool> DynamicTruncation::usedStationMap
private

Definition at line 114 of file DynamicTruncation.h.

Referenced by getDYTInfo().