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 47 of file DynamicTruncation.h.

Member Typedef Documentation

Definition at line 52 of file DynamicTruncation.h.

Definition at line 51 of file DynamicTruncation.h.

Constructor & Destructor Documentation

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

Definition at line 37 of file DynamicTruncation.cc.

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

37  {
38  propagator = theService.propagator("SmartPropagatorAny");
39  propagatorPF = theService.propagator("SmartPropagatorAny");
40  propagatorCompatibleDet = theService.propagator("SmartPropagatorAny");
41  theG = theService.trackingGeometry();
42  theService.eventSetup().get<TransientRecHitRecord>().get("MuonRecHitBuilder",theMuonRecHitBuilder);
43  theService.eventSetup().get<TrackingComponentsRecord>().get("KFUpdator",updatorHandle);
44  theService.eventSetup().get<MuonGeometryRecord>().get(cscGeom);
45  theService.eventSetup().get<MuonRecoGeometryRecord>().get(navMuon);
46  theService.eventSetup().get<IdealMagneticFieldRecord>().get(magfield);
47  navigation = new DirectMuonNavigation(theService.detLayerGeometry());
49  thrManager = new ThrParameters(&theService.eventSetup());
51  if (useDBforThr) dytThresholds = thrManager->getInitialThresholds();
52  doUpdateOfKFStates = true;
53 }
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 55 of file DynamicTruncation.cc.

55  {
56  delete navigation;
57  delete thrManager;
58  delete getSegs;
59 }
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 400 of file DynamicTruncation.cc.

References DTRecSegment4D::chamberId(), and MAX_THR.

401  {
402  double initThr = MAX_THR;
403  if (bestDTEstimator == MAX_THR && bestCSCEstimator == MAX_THR) return false;
404  if (bestDTEstimator <= bestCSCEstimator) {
405  // Get threshold for the chamber
406  if (useDBforThr) getThresholdFromDB(initThr, DetId(bestDTSeg.chamberId()));
407  else getThresholdFromCFG(initThr, DetId(bestDTSeg.chamberId()));
408  if (DYTselector == 0 || (DYTselector == 1 && bestDTEstimator < initThr) ||
409  (DYTselector == 2 && incompLayers < 2 && bestDTEstimator < initThr)) {
410  useSegment(bestDTSeg, tsosDT);
411  return true;
412  }
413  } else {
414  // Get threshold for the chamber
415  if (useDBforThr) getThresholdFromDB(initThr, DetId(bestCSCSeg.cscDetId()));
416  else getThresholdFromCFG(initThr, DetId(bestCSCSeg.cscDetId()));
417  if (DYTselector == 0 || (DYTselector == 1 && bestCSCEstimator < initThr) ||
418  (DYTselector == 2 && incompLayers < 2 && bestCSCEstimator < initThr)) {
419  useSegment(bestCSCSeg, tsosCSC);
420  return true;
421  }
422  }
423  return false;
424 }
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 249 of file DynamicTruncation.cc.

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

249  {
250  MuonPatternRecoDumper dumper;
251  MeasurementEstimator *theEstimator = new Chi2MeasurementEstimator(1000, 1000);
252  vector<const DetLayer *> navLayers;
254  unsigned int ilayerCorrected = 0;
255  for ( unsigned int ilayer=0; ilayer<navLayers.size(); ilayer++ ) {
256  // Skip RPC layers
257  if (navLayers[ilayer]->subDetector() != GeomDetEnumerators::DT &&
258  navLayers[ilayer]->subDetector() != GeomDetEnumerators::CSC) continue;
259  ilayerCorrected++;
260  vector<DetLayer::DetWithState> comps = navLayers[ilayer]->compatibleDets(currentState, *propagatorCompatibleDet, *theEstimator);
261  //cout << comps.size() << " compatible Dets with " << navLayers[ilayer]->subDetector() << " Layer " << ilayer << " "
262  //<< dumper.dumpLayer(navLayers[ilayer]);
263  if (comps.size() > 0) {
264  for ( unsigned int icomp=0; icomp<comps.size(); icomp++ ) {
265  DetId id(comps[icomp].first->geographicalId().rawId());
266  detMap[ilayerCorrected].push_back(id);
267  }
268  }
269  }
270  if (theEstimator) delete theEstimator;
271 }
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
bool first
Definition: L1TdeRCT.cc:75
Definition: DetId.h:18
void DynamicTruncation::correctThrByPtAndEta ( double &  thr)
private

Definition at line 442 of file DynamicTruncation.cc.

442  {
443 
445  // This section will be implemented //
446  // after the release of APEs //
448 
449 }
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 224 of file DynamicTruncation.cc.

References DTRecSegment4D::chamberId().

226  {
227  if (chosenLayer) {
228  nStationsUsed++;
229  incompConLay = 0;
230  if (bestDTEstimator <= bestCSCEstimator) {
231  estimatorMap[st] = bestDTEstimator;
232  DetId id(bestDTSeg.chamberId());
233  idChamberMap[st] = id;
234  } else {
235  DetId id(bestCSCSeg.cscDetId());
236  idChamberMap[st] = id;
237  estimatorMap[st] = bestCSCEstimator;
238  }
239  usedStationMap[st] = true;
240  } else {
241  incompConLay++;
242  estimatorMap[st] = -1;
243  usedStationMap[st] = false;
244  }
245 }
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 275 of file DynamicTruncation.cc.

References MuonSubdetId::CSC, MuonSubdetId::DT, j, gen::k, python.multivaluedict::map(), and tmp.

277  {
278  for (map<int, vector<DetId> >::iterator it=compatibleIds.begin(); it!=compatibleIds.end(); ++it) {
279  vector<DetId> ids = compatibleIds[it->first];
280  for (unsigned j = 0; j < ids.size(); j++) {
281  if (ids[j].subdetId() == MuonSubdetId::CSC) {
282  CSCDetId ch(ids[j]);
283  vector<CSCSegment> tmp = getSegs->getCSCSegmentsInChamber(ch);
284  for (unsigned int k = 0; k < tmp.size(); k++) cscSegMap[it->first].push_back(tmp[k]);
285  }
286  if (ids[j].subdetId() == MuonSubdetId::DT) {
287  DTChamberId ch(ids[j]);
288  vector<DTRecSegment4D> tmp = getSegs->getDTSegmentsInChamber(ch);
289  for (unsigned int k = 0; k < tmp.size(); k++) dtSegMap[it->first].push_back(tmp[k]);
290  }
291  }
292  }
293 }
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
int k[5][pyjets_maxn]
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 131 of file DynamicTruncation.cc.

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

Referenced by GlobalMuonRefitter::refit().

131  {
132  result.clear();
133  prelFitMeas.clear();
134 
135  // Get APE maps
138 
139  // Get Last tracker TSOS (updated)
140  vector<TrajectoryMeasurement> muonMeasurements = traj.measurements();
141  TrajectoryMeasurement lastTKm = muonMeasurements.front();
142  for (vector<TrajectoryMeasurement>::const_iterator imT = muonMeasurements.begin(); imT != muonMeasurements.end(); imT++ ) {
143  if ( !(*imT).recHit()->isValid() ) continue;
144  const TransientTrackingRecHit* hit = &(*(*imT).recHit());
145  if (hit->geographicalId().det() == DetId::Tracker) {
146  result.push_back((*imT).recHit());
147  if (!(*imT).forwardPredictedState().isValid()) continue;
148  if ((*imT).forwardPredictedState().globalPosition().mag() >
149  lastTKm.forwardPredictedState().globalPosition().mag()) lastTKm = *imT;
150  }
151  }
153  update(currentState, lastTKm.recHit());
154 
156  update(prelFitState, lastTKm.recHit());
158 
159  // Run the DYT
160  filteringAlgo();
161 
162  return result;
163 }
ConstRecHitPointer const & recHit() const
TrajectoryStateOnSurface currentState
GlobalPoint globalPosition() const
ThrParameters * thrManager
TrajectoryStateOnSurface prelFitState
DataContainer const & measurements() const
Definition: Trajectory.h:203
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 167 of file DynamicTruncation.cc.

References python.multivaluedict::map(), and MAX_THR.

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

72  {
77  return dytInfo;
78  }
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 453 of file DynamicTruncation.cc.

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

453  {
454  if (id.subdetId() == MuonSubdetId::DT) {
455  thr = Thrs[0];
456  }
457  if (id.subdetId() == MuonSubdetId::CSC) {
458  thr = Thrs[1];
459  }
460 }
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 428 of file DynamicTruncation.cc.

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

428  {
429  vector<DYTThrObject::DytThrStruct> thrvector = dytThresholds->thrsVec;
430  for (vector<DYTThrObject::DytThrStruct>::const_iterator it = thrvector.begin(); it != thrvector.end(); it++) {
432  if (obj.id == id) {
433  thr = obj.thr;
434  break;
435  }
436  }
438 }
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 355 of file DynamicTruncation.cc.

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

356  {
357  for (map<int, vector<DetId> >::iterator it=compatibleIds.begin(); it!=compatibleIds.end(); ++it) {
358  DTRecSegment4D bestDTSeg;
359  CSCSegment bestCSCSeg;
360  double bestDTEstimator = MAX_THR;
361  double bestCSCEstimator = MAX_THR;
362  double initThr = MAX_THR;
363  vector<DTRecSegment4D> dtSegs = dtSegMap[it->first];
364  vector<CSCSegment> cscSegs = cscSegMap[it->first];
365 
366  // DT case: find the most compatible segment
367  TrajectoryStateOnSurface tsosDTlayer;
368  testDTstation(prelFitState, dtSegs, bestDTEstimator, bestDTSeg, tsosDTlayer);
369 
370  // CSC case: find the most compatible segment
371  TrajectoryStateOnSurface tsosCSClayer;
372  testCSCstation(prelFitState, cscSegs, bestCSCEstimator, bestCSCSeg, tsosCSClayer);
373 
374  // Decide whether to keep the layer or not
375  if (bestDTEstimator == MAX_THR && bestCSCEstimator == MAX_THR) continue;
376  if (bestDTEstimator <= bestCSCEstimator) {
377  getThresholdFromCFG(initThr, DetId(bestDTSeg.chamberId()));
378  if (bestDTEstimator >= initThr) continue;
379  prelFitMeas.push_back(theMuonRecHitBuilder->build(&bestDTSeg));
380  prelFitState = updatorHandle->update(tsosDTlayer, *theMuonRecHitBuilder->build(&bestDTSeg));
381  } else {
382  getThresholdFromCFG(initThr, DetId(bestCSCSeg.cscDetId()));
383  if (bestCSCEstimator >= initThr) continue;
384  prelFitMeas.push_back(theMuonRecHitBuilder->build(&bestCSCSeg));
385  prelFitState = updatorHandle->update(tsosCSClayer, *theMuonRecHitBuilder->build(&bestCSCSeg));
386  }
387  }
388  prelFitMeas.pop_back();
389  for (ConstRecHitContainer::const_iterator imrh = prelFitMeas.end(); imrh != prelFitMeas.begin(); imrh-- ) {
390  DetId id = (*imrh)->geographicalId();
391  TrajectoryStateOnSurface tmp = propagatorPF->propagate(prelFitState, theG->idToDet(id)->surface());
392  if (tmp.isValid()) prelFitState = tmp;
393  }
396 }
edm::ESHandle< Propagator > propagatorPF
T perp() const
Definition: PV3DBase.h:72
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 58 of file DynamicTruncation.h.

References getSegs, and ChamberSegmentUtility::initCSU().

Referenced by GlobalMuonRefitter::refit().

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

Definition at line 98 of file DynamicTruncation.cc.

References edm::hlt::Exception.

Referenced by GlobalMuonRefitter::refit().

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

Definition at line 115 of file DynamicTruncation.cc.

References edm::hlt::Exception, i, and MAX_THR.

Referenced by GlobalMuonRefitter::refit().

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

Definition at line 111 of file DynamicTruncation.cc.

Referenced by GlobalMuonRefitter::refit().

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

Definition at line 107 of file DynamicTruncation.cc.

Referenced by GlobalMuonRefitter::refit().

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

Definition at line 464 of file DynamicTruncation.cc.

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

464  {
465  unsigned int i=0;
466  unsigned int j=0;
467  ConstRecHitContainer::size_type n = recHits.size();
468  for(i=1; i<n; ++i)
469  for(j=n-1; j>=i; --j)
470  if(recHits[j-1]->globalPosition().mag() > recHits[j]->globalPosition().mag()) swap (recHits[j-1],recHits[j]);
471 }
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 210 of file DynamicTruncation.cc.

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

210  {
211  if (det.subdetId() == MuonSubdetId::CSC) {
212  CSCDetId ch(det);
213  return ch.station();
214  }
215  if (det.subdetId() == MuonSubdetId::DT) {
216  DTChamberId ch(det);
217  return ch.station();
218  }
219  return 0;
220 }
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 318 of file DynamicTruncation.cc.

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

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

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

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

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

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.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(), relval_steps.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().

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

Definition at line 80 of file DynamicTruncation.cc.

References TrajectoryStateOnSurface::isValid(), python.multivaluedict::sort(), GeomDet::surface(), groupFilesInBlocks::temp, and TrajectoryStateOnSurface::update().

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

References DTRecSegment4D::recHits(), python.multivaluedict::sort(), TrajectoryStateOnSurface::surface(), groupFilesInBlocks::temp, and TrajectoryStateOnSurface::update().

66  {
67  ConstRecHitContainer tmprecHits;
68  vector<const TrackingRecHit*> DTrh = bestDTSeg.recHits();
69  for (vector<const TrackingRecHit*>::iterator it = DTrh.begin(); it != DTrh.end(); it++) {
70  tmprecHits.push_back(theMuonRecHitBuilder->build(*it));
71  }
72  sort(tmprecHits);
73  for (ConstRecHitContainer::const_iterator it = tmprecHits.begin(); it != tmprecHits.end(); ++it) {
74  DTLayerId layid((*it)->det()->geographicalId());
75  TrajectoryStateOnSurface temp = propagator->propagate(tsos, theG->idToDet(layid)->surface());
76  if (temp.isValid()) tsos = updatorHandle->update(temp, **it);
77  }
78 }
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 339 of file DynamicTruncation.cc.

References query::result.

339  {
340  result.push_back(theMuonRecHitBuilder->build(&bestDTSeg));
342  else currentState = tsosDT;
343 }
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 347 of file DynamicTruncation.cc.

References query::result.

347  {
348  result.push_back(theMuonRecHitBuilder->build(&bestCSCSeg));
350  else currentState = tsosCSC;
351 }
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 123 of file DynamicTruncation.h.

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

Definition at line 110 of file DynamicTruncation.h.

TrajectoryStateOnSurface DynamicTruncation::currentState
private

Definition at line 119 of file DynamicTruncation.h.

bool DynamicTruncation::doUpdateOfKFStates
private

Definition at line 129 of file DynamicTruncation.h.

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

Definition at line 122 of file DynamicTruncation.h.

reco::DYTInfo DynamicTruncation::dytInfo
private

Definition at line 121 of file DynamicTruncation.h.

Referenced by getDYTInfo().

int DynamicTruncation::DYTselector
private

Definition at line 105 of file DynamicTruncation.h.

const DYTThrObject* DynamicTruncation::dytThresholds
private

Definition at line 125 of file DynamicTruncation.h.

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

Definition at line 116 of file DynamicTruncation.h.

Referenced by getDYTInfo().

ChamberSegmentUtility* DynamicTruncation::getSegs
private

Definition at line 126 of file DynamicTruncation.h.

Referenced by setProd().

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

Definition at line 118 of file DynamicTruncation.h.

Referenced by getDYTInfo().

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

Definition at line 115 of file DynamicTruncation.h.

double DynamicTruncation::muonETAest
private

Definition at line 124 of file DynamicTruncation.h.

double DynamicTruncation::muonPTest
private

Definition at line 124 of file DynamicTruncation.h.

DirectMuonNavigation* DynamicTruncation::navigation
private

Definition at line 114 of file DynamicTruncation.h.

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

Definition at line 113 of file DynamicTruncation.h.

int DynamicTruncation::nStationsUsed
private

Definition at line 104 of file DynamicTruncation.h.

Referenced by getDYTInfo().

ConstRecHitContainer DynamicTruncation::prelFitMeas
private

Definition at line 101 of file DynamicTruncation.h.

TrajectoryStateOnSurface DynamicTruncation::prelFitState
private

Definition at line 120 of file DynamicTruncation.h.

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

Definition at line 106 of file DynamicTruncation.h.

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

Definition at line 108 of file DynamicTruncation.h.

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

Definition at line 107 of file DynamicTruncation.h.

ConstRecHitContainer DynamicTruncation::result
private

Definition at line 101 of file DynamicTruncation.h.

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

Definition at line 109 of file DynamicTruncation.h.

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

Definition at line 111 of file DynamicTruncation.h.

ThrParameters* DynamicTruncation::thrManager
private

Definition at line 127 of file DynamicTruncation.h.

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

Definition at line 103 of file DynamicTruncation.h.

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

Definition at line 112 of file DynamicTruncation.h.

bool DynamicTruncation::useAPE
private

Definition at line 102 of file DynamicTruncation.h.

bool DynamicTruncation::useDBforThr
private

Definition at line 128 of file DynamicTruncation.h.

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

Definition at line 117 of file DynamicTruncation.h.

Referenced by getDYTInfo().