test
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 419 of file DynamicTruncation.cc.

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

420  {
421  double initThr = MAX_THR;
422  if (bestDTEstimator == MAX_THR && bestCSCEstimator == MAX_THR) return false;
423  if (bestDTEstimator <= bestCSCEstimator) {
424  // Get threshold for the chamber
425  if (useDBforThr) getThresholdFromDB(initThr, DetId(bestDTSeg.chamberId()));
426  else getThresholdFromCFG(initThr, DetId(bestDTSeg.chamberId()));
427  if (DYTselector == 0 || (DYTselector == 1 && bestDTEstimator < initThr) ||
428  (DYTselector == 2 && incompLayers < 2 && bestDTEstimator < initThr)) {
429  useSegment(bestDTSeg, tsosDT);
430  return true;
431  }
432  } else {
433  // Get threshold for the chamber
434  if (useDBforThr) getThresholdFromDB(initThr, DetId(bestCSCSeg.cscDetId()));
435  else getThresholdFromCFG(initThr, DetId(bestCSCSeg.cscDetId()));
436  if (DYTselector == 0 || (DYTselector == 1 && bestCSCEstimator < initThr) ||
437  (DYTselector == 2 && incompLayers < 2 && bestCSCEstimator < initThr)) {
438  useSegment(bestCSCSeg, tsosCSC);
439  return true;
440  }
441  }
442  return false;
443 }
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 256 of file DynamicTruncation.cc.

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

256  {
257  MuonPatternRecoDumper dumper;
258  MeasurementEstimator *theEstimator = new Chi2MeasurementEstimator(1000, 1000);
259  vector<const DetLayer *> navLayers;
261  unsigned int ilayerCorrected = 0;
262  for ( unsigned int ilayer=0; ilayer<navLayers.size(); ilayer++ ) {
263  // Skip RPC layers
264  if (navLayers[ilayer]->subDetector() != GeomDetEnumerators::DT &&
265  navLayers[ilayer]->subDetector() != GeomDetEnumerators::CSC) continue;
266  ilayerCorrected++;
267  vector<DetLayer::DetWithState> comps = navLayers[ilayer]->compatibleDets(currentState, *propagatorCompatibleDet, *theEstimator);
268  //cout << comps.size() << " compatible Dets with " << navLayers[ilayer]->subDetector() << " Layer " << ilayer << " "
269  //<< dumper.dumpLayer(navLayers[ilayer]);
270  if (comps.size() > 0) {
271  for ( unsigned int icomp=0; icomp<comps.size(); icomp++ ) {
272  DetId id(comps[icomp].first->geographicalId().rawId());
273  detMap[ilayerCorrected].push_back(id);
274  }
275  }
276  }
277  if (theEstimator) delete theEstimator;
278 }
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 461 of file DynamicTruncation.cc.

461  {
462 
464  // This section will be implemented //
465  // after the release of APEs //
467 
468 }
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 231 of file DynamicTruncation.cc.

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

233  {
234  if (chosenLayer) {
235  nStationsUsed++;
236  incompConLay = 0;
237  if (bestDTEstimator <= bestCSCEstimator) {
238  estimatorMap[st] = bestDTEstimator;
239  DetId id(bestDTSeg.chamberId());
240  idChamberMap[st] = id;
241  } else {
242  DetId id(bestCSCSeg.cscDetId());
243  idChamberMap[st] = id;
244  estimatorMap[st] = bestCSCEstimator;
245  }
246  usedStationMap[st] = true;
247  } else {
248  incompConLay++;
249  estimatorMap[st] = -1;
250  usedStationMap[st] = false;
251  }
252 }
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 282 of file DynamicTruncation.cc.

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

284  {
285  for (map<int, vector<DetId> >::iterator it=compatibleIds.begin(); it!=compatibleIds.end(); ++it) {
286  vector<DetId> ids = compatibleIds[it->first];
287  for (unsigned j = 0; j < ids.size(); j++) {
288  if (ids[j].subdetId() == MuonSubdetId::CSC) {
289  CSCDetId ch(ids[j]);
290  vector<CSCSegment> tmp = getSegs->getCSCSegmentsInChamber(ch);
291  for (unsigned int k = 0; k < tmp.size(); k++) cscSegMap[it->first].push_back(tmp[k]);
292  }
293  if (ids[j].subdetId() == MuonSubdetId::DT) {
294  DTChamberId ch(ids[j]);
295  vector<DTRecSegment4D> tmp = getSegs->getDTSegmentsInChamber(ch);
296  for (unsigned int k = 0; k < tmp.size(); k++) dtSegMap[it->first].push_back(tmp[k]);
297  }
298  }
299  }
300 }
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 138 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().

138  {
139  result.clear();
140  prelFitMeas.clear();
141 
142  // Get APE maps
145 
146  // Get Last tracker TSOS (updated)
147  vector<TrajectoryMeasurement> muonMeasurements = traj.measurements();
148  TrajectoryMeasurement lastTKm = muonMeasurements.front();
149  for (vector<TrajectoryMeasurement>::const_iterator imT = muonMeasurements.begin(); imT != muonMeasurements.end(); imT++ ) {
150  if ( !(*imT).recHit()->isValid() ) continue;
151  const TransientTrackingRecHit* hit = &(*(*imT).recHit());
152  if (hit->geographicalId().det() == DetId::Tracker) {
153  result.push_back((*imT).recHit());
154  if (!(*imT).forwardPredictedState().isValid()) continue;
155  if ((*imT).forwardPredictedState().globalPosition().mag() >
156  lastTKm.forwardPredictedState().globalPosition().mag()) lastTKm = *imT;
157  }
158  }
160  update(currentState, lastTKm.recHit());
161 
163  update(prelFitState, lastTKm.recHit());
165 
166  // Run the DYT
167  filteringAlgo();
168 
169  return result;
170 }
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 174 of file DynamicTruncation.cc.

References MAX_THR.

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

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

472  {
473  if (id.subdetId() == MuonSubdetId::DT) {
474  thr = Thrs[0];
475  }
476  if (id.subdetId() == MuonSubdetId::CSC) {
477  thr = Thrs[1];
478  }
479 }
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 447 of file DynamicTruncation.cc.

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

447  {
448  vector<DYTThrObject::DytThrStruct> thrvector = dytThresholds->thrsVec;
449  for (vector<DYTThrObject::DytThrStruct>::const_iterator it = thrvector.begin(); it != thrvector.end(); it++) {
451  if (obj.id == id) {
452  thr = obj.thr;
453  break;
454  }
455  }
457 }
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 362 of file DynamicTruncation.cc.

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

363  {
364  for (map<int, vector<DetId> >::iterator it=compatibleIds.begin(); it!=compatibleIds.end(); ++it) {
365  DTRecSegment4D bestDTSeg;
366  CSCSegment bestCSCSeg;
367  double bestDTEstimator = MAX_THR;
368  double bestCSCEstimator = MAX_THR;
369  double initThr = MAX_THR;
370  vector<DTRecSegment4D> dtSegs = dtSegMap[it->first];
371  vector<CSCSegment> cscSegs = cscSegMap[it->first];
372 
373  // DT case: find the most compatible segment
374  TrajectoryStateOnSurface tsosDTlayer;
375  testDTstation(prelFitState, dtSegs, bestDTEstimator, bestDTSeg, tsosDTlayer);
376 
377  // CSC case: find the most compatible segment
378  TrajectoryStateOnSurface tsosCSClayer;
379  testCSCstation(prelFitState, cscSegs, bestCSCEstimator, bestCSCSeg, tsosCSClayer);
380 
381  // Decide whether to keep the layer or not
382  if (bestDTEstimator == MAX_THR && bestCSCEstimator == MAX_THR) continue;
383  if (bestDTEstimator <= bestCSCEstimator) {
384  getThresholdFromCFG(initThr, DetId(bestDTSeg.chamberId()));
385  if (bestDTEstimator >= initThr) continue;
386  prelFitMeas.push_back(theMuonRecHitBuilder->build(&bestDTSeg));
387  auto aSegRH = prelFitMeas.back();
388  auto uRes = updatorHandle->update(tsosDTlayer, *aSegRH);
389  if (uRes.isValid()){
390  prelFitState = uRes;
391  } else {
392  prelFitMeas.pop_back();
393  }
394  } else {
395  getThresholdFromCFG(initThr, DetId(bestCSCSeg.cscDetId()));
396  if (bestCSCEstimator >= initThr) continue;
397  prelFitMeas.push_back(theMuonRecHitBuilder->build(&bestCSCSeg));
398  auto aSegRH = prelFitMeas.back();
399  auto uRes = updatorHandle->update(tsosCSClayer, *aSegRH);
400  if (uRes.isValid()){
401  prelFitState = uRes;
402  } else {
403  prelFitMeas.pop_back();
404  }
405  }
406  }
407  if (!prelFitMeas.empty()) prelFitMeas.pop_back();
408  for (auto imrh = prelFitMeas.rbegin(); imrh != prelFitMeas.rend(); ++imrh) {
409  DetId id = (*imrh)->geographicalId();
410  TrajectoryStateOnSurface tmp = propagatorPF->propagate(prelFitState, theG->idToDet(id)->surface());
411  if (tmp.isValid()) prelFitState = tmp;
412  }
415 }
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 105 of file DynamicTruncation.cc.

References Exception.

Referenced by GlobalMuonRefitter::refit().

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

Definition at line 122 of file DynamicTruncation.cc.

References Exception, i, and MAX_THR.

Referenced by GlobalMuonRefitter::refit().

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

Definition at line 118 of file DynamicTruncation.cc.

Referenced by GlobalMuonRefitter::refit().

118  {
119  doUpdateOfKFStates = upState;
120 }
void DynamicTruncation::setUseAPE ( bool  useAPE_)

Definition at line 114 of file DynamicTruncation.cc.

Referenced by GlobalMuonRefitter::refit().

114  {
115  useAPE = useAPE_;
116 }
void DynamicTruncation::sort ( ConstRecHitContainer recHits)
private

Definition at line 483 of file DynamicTruncation.cc.

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

483  {
484  unsigned int i=0;
485  unsigned int j=0;
487  for(i=1; i<n; ++i)
488  for(j=n-1; j>=i; --j)
489  if(recHits[j-1]->globalPosition().mag() > recHits[j]->globalPosition().mag()) swap (recHits[j-1],recHits[j]);
490 }
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 217 of file DynamicTruncation.cc.

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

217  {
218  if (det.subdetId() == MuonSubdetId::CSC) {
219  CSCDetId ch(det);
220  return ch.station();
221  }
222  if (det.subdetId() == MuonSubdetId::DT) {
223  DTChamberId ch(det);
224  return ch.station();
225  }
226  return 0;
227 }
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 325 of file DynamicTruncation.cc.

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

326  {
327  if (segments.size() == 0) return;
328  for (unsigned int iSeg = 0; iSeg < segments.size(); iSeg++) {
329  CSCDetId chamber(segments[iSeg].cscDetId());
330  if (!propagator->propagate(startingState, theG->idToDet(chamber)->surface()).isValid()) continue;
331  tsoscsc = propagator->propagate(startingState, theG->idToDet(chamber)->surface());
332  //if (!tsoscsc.isValid()) continue;
333  LocalError apeLoc;
334  if (useAPE) apeLoc = ErrorFrameTransformer().transform(cscApeMap.find(chamber)->second, theG->idToDet(chamber)->surface());
335  StateSegmentMatcher estim(tsoscsc, segments[iSeg], apeLoc);
336  double estimator = estim.value();
337  //cout << "estimator CSC = " << estimator << endl;
338  if (estimator >= bestEstimator) continue;
339  bestEstimator = estimator;
340  bestSeg = segments[iSeg];
341  }
342 }
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 304 of file DynamicTruncation.cc.

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

305  {
306  if (segments.size() == 0) return;
307  for (unsigned int iSeg = 0; iSeg < segments.size(); iSeg++) {
308  DTChamberId chamber(segments[iSeg].chamberId());
309  if (!propagator->propagate(startingState, theG->idToDet(chamber)->surface()).isValid()) continue;
310  tsosdt = propagator->propagate(startingState, theG->idToDet(chamber)->surface());
311  //if (!tsosdt.isValid()) continue;
312  LocalError apeLoc;
313  if (useAPE) apeLoc = ErrorFrameTransformer().transform(dtApeMap.find(chamber)->second, theG->idToDet(chamber)->surface());
314  StateSegmentMatcher estim(tsosdt, segments[iSeg], apeLoc);
315  double estimator = estim.value();
316  //cout << "estimator DT = " << estimator << endl;
317  if (estimator >= bestEstimator) continue;
318  bestEstimator = estimator;
319  bestSeg = segments[iSeg];
320  }
321 }
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 84 of file DynamicTruncation.cc.

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

84  {
85  ConstRecHitContainer tmprecHits;
86  vector<CSCRecHit2D> CSCrh = bestCSCSeg.specificRecHits();
87  for (vector<CSCRecHit2D>::iterator it = CSCrh.begin(); it != CSCrh.end(); ++it) {
88  tmprecHits.push_back(theMuonRecHitBuilder->build(&*it));
89  }
90  sort(tmprecHits);
91  for (ConstRecHitContainer::const_iterator it = tmprecHits.begin(); it != tmprecHits.end(); ++it) {
92  const CSCLayer* cscLayer = cscGeom->layer((*it)->det()->geographicalId());
93  TrajectoryStateOnSurface temp = propagator->propagate(tsos, cscLayer->surface());
94  if (temp.isValid()) {
95  TrajectoryStateOnSurface tempTsos = updatorHandle->update(temp, **it);
96  if (tempTsos.isValid() ) tsos = tempTsos;
97  }
98  }
99 }
void sort(ConstRecHitContainer &)
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
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 TrajectoryStateOnSurface::isValid(), 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()) {
78  TrajectoryStateOnSurface tempTsos = updatorHandle->update(temp, **it);
79  if (tempTsos.isValid() ) tsos = tempTsos;
80  }
81  }
82 }
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 346 of file DynamicTruncation.cc.

References mps_fire::result.

346  {
347  result.push_back(theMuonRecHitBuilder->build(&bestDTSeg));
349  else currentState = tsosDT;
350 }
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 354 of file DynamicTruncation.cc.

References mps_fire::result.

354  {
355  result.push_back(theMuonRecHitBuilder->build(&bestCSCSeg));
357  else currentState = tsosCSC;
358 }
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().