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
TSGForRoadSearch Class Reference

#include <TSGForRoadSearch.h>

Inheritance diagram for TSGForRoadSearch:
TrackerSeedGenerator

Public Types

typedef std::vector
< TrajectorySeed
BTSeedCollection
 
typedef std::pair< const
Trajectory *, reco::TrackRef
TrackCand
 
- Public Types inherited from TrackerSeedGenerator
typedef std::vector
< TrajectorySeed
BTSeedCollection
 
typedef std::pair< const
Trajectory *, reco::TrackRef
TrackCand
 

Public Member Functions

void init (const MuonServiceProxy *service)
 initialize the service More...
 
void setEvent (const edm::Event &event)
 set the event: update the MeasurementTracker More...
 
void trackerSeeds (const TrackCand &, const TrackingRegion &, const TrackerTopology *, BTSeedCollection &)
 generated seed(s) for a track. the tracking region is not used. More...
 
 TSGForRoadSearch (const edm::ParameterSet &pset, edm::ConsumesCollector &IC)
 
virtual ~TSGForRoadSearch ()
 
- Public Member Functions inherited from TrackerSeedGenerator
const edm::EventgetEvent () const
 
 TrackerSeedGenerator ()
 
virtual ~TrackerSeedGenerator ()
 destructor More...
 

Private Member Functions

bool IPfts (const reco::Track &, FreeTrajectoryState &)
 get the FTS for a Track: adjusting the error matrix if requested More...
 
void makeSeeds_0 (const reco::Track &, std::vector< TrajectorySeed > &)
 oseed from inside-out: innermost Strip layer More...
 
void makeSeeds_1 (const reco::Track &, std::vector< TrajectorySeed > &)
 not implemented More...
 
void makeSeeds_2 (const reco::Track &, std::vector< TrajectorySeed > &)
 not implemented More...
 
void makeSeeds_3 (const reco::Track &, std::vector< TrajectorySeed > &)
 outside-in: outermost Strip layer More...
 
void makeSeeds_4 (const reco::Track &, std::vector< TrajectorySeed > &)
 inside-out: innermost Pixel/Strip layer More...
 
bool notAtIPtsos (TrajectoryStateOnSurface &state)
 make the adjustement away from PCA state if requested More...
 
void pushTrajectorySeed (const reco::Track &muon, std::vector< DetLayer::DetWithState > &compatible, PropagationDirection direction, std::vector< TrajectorySeed > &result) const
 add the seed(s) to the collection of seeds More...
 

Private Attributes

bool theAdjustAtIp
 adjust the state at IP or where it is defined for the seed More...
 
std::string theCategory
 
Chi2MeasurementEstimatortheChi2Estimator
 
edm::ParameterSet theConfig
 
bool theCopyMuonRecHit
 
MuonErrorMatrixtheErrorMatrixAdjuster
 
edm::ESHandle
< GeometricSearchTracker
theGeometricSearchTracker
 
bool theManySeeds
 
edm::ESHandle< MeasurementTrackertheMeasurementTracker
 
const MeasurementTrackerEventtheMeasurementTrackerEvent
 
edm::InputTag theMeasurementTrackerEventTag
 
edm::EDGetTokenT
< MeasurementTrackerEvent
theMeasurementTrackerEventToken
 
unsigned int theOption
 
edm::ESHandle< PropagatortheProp
 
std::string thePropagatorCompatibleName
 
std::string thePropagatorName
 
edm::ESHandle< PropagatorthePropCompatible
 
const MuonServiceProxytheProxyService
 
TrajectoryStateUpdatortheUpdator
 

Additional Inherited Members

- Protected Attributes inherited from TrackerSeedGenerator
const edm::EventtheEvent
 
const MuonServiceProxytheProxyService
 

Detailed Description

Description: this class generates hit-less TrajectorySeed from a given Track. the original error matrix of the Track is adjusted (configurable). this class is principally used for muon HLT. for options are available:

regular operation is one seed per track, but optionnaly, more than one seed can be madefor one track.

Author
Jean-Roch Vlimant

Definition at line 46 of file TSGForRoadSearch.h.

Member Typedef Documentation

Definition at line 49 of file TSGForRoadSearch.h.

Definition at line 50 of file TSGForRoadSearch.h.

Constructor & Destructor Documentation

TSGForRoadSearch::TSGForRoadSearch ( const edm::ParameterSet pset,
edm::ConsumesCollector IC 
)

Definition at line 28 of file TSGForRoadSearch.cc.

References Chi2MeasurementEstimator_cfi::Chi2MeasurementEstimator, edm::ConsumesCollector::consumes(), edm::ParameterSet::empty(), edm::ParameterSet::getParameter(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, theAdjustAtIp, theCategory, theChi2Estimator, theCopyMuonRecHit, theErrorMatrixAdjuster, theManySeeds, theMeasurementTrackerEvent, theMeasurementTrackerEventTag, theMeasurementTrackerEventToken, theOption, thePropagatorCompatibleName, thePropagatorName, and theUpdator.

28  {
29 
30  theOption = par.getParameter<unsigned int>("option");
31  theCopyMuonRecHit = par.getParameter<bool>("copyMuonRecHit");
32 
33  double Chi2 = par.getParameter<double>("maxChi2");
35 
36  thePropagatorName = par.getParameter<std::string>("propagatorName");
37  thePropagatorCompatibleName = par.getParameter<std::string>("propagatorCompatibleName");
38 
39  theCategory = "TSGForRoadSearch|TrackerSeedGenerator";
40 
41  theManySeeds = par.getParameter<bool>("manySeeds");
42  if (theManySeeds){ theUpdator = new KFUpdator();}
43  else{ theUpdator=0;}
44 
45  edm::ParameterSet errorMatrixPset = par.getParameter<edm::ParameterSet>("errorMatrixPset");
46  if (!errorMatrixPset.empty()){
47  theAdjustAtIp = errorMatrixPset.getParameter<bool>("atIP");
48  theErrorMatrixAdjuster = new MuonErrorMatrix(errorMatrixPset);}
49  else {
50  theAdjustAtIp =false;
52 
53  theMeasurementTrackerEventTag = par.getParameter<edm::InputTag>("MeasurementTrackerEvent");
55 
57 }
T getParameter(std::string const &) const
bool empty() const
Definition: ParameterSet.h:218
edm::InputTag theMeasurementTrackerEventTag
edm::EDGetTokenT< MeasurementTrackerEvent > theMeasurementTrackerEventToken
bool theAdjustAtIp
adjust the state at IP or where it is defined for the seed
std::string theCategory
T sqrt(T t)
Definition: SSEVec.h:18
Chi2MeasurementEstimator * theChi2Estimator
const MeasurementTrackerEvent * theMeasurementTrackerEvent
MuonErrorMatrix * theErrorMatrixAdjuster
std::string thePropagatorCompatibleName
std::string thePropagatorName
Definition: Chi2.h:17
unsigned int theOption
TrajectoryStateUpdator * theUpdator
TSGForRoadSearch::~TSGForRoadSearch ( )
virtual

Definition at line 59 of file TSGForRoadSearch.cc.

References theChi2Estimator, theErrorMatrixAdjuster, and theUpdator.

59  {
60  delete theChi2Estimator;
61  if (theUpdator) delete theUpdator;
63 }
Chi2MeasurementEstimator * theChi2Estimator
MuonErrorMatrix * theErrorMatrixAdjuster
TrajectoryStateUpdator * theUpdator

Member Function Documentation

void TSGForRoadSearch::init ( const MuonServiceProxy service)
virtual

initialize the service

Reimplemented from TrackerSeedGenerator.

Definition at line 66 of file TSGForRoadSearch.cc.

References theProxyService.

66  {
67  theProxyService = service;
68 }
const MuonServiceProxy * theProxyService
bool TSGForRoadSearch::IPfts ( const reco::Track muon,
FreeTrajectoryState fts 
)
private

get the FTS for a Track: adjusting the error matrix if requested

Definition at line 110 of file TSGForRoadSearch.cc.

References MuonErrorMatrix::adjust(), trajectoryStateTransform::initialFreeState(), LogDebug, MuonServiceProxy::magneticField(), theAdjustAtIp, theCategory, theErrorMatrixAdjuster, and theProxyService.

Referenced by makeSeeds_0(), makeSeeds_3(), and makeSeeds_4().

110  {
111 
113  LogDebug(theCategory)<<"pure L2 state: "<<fts;
114  if (fts.position().mag()==0 && fts.momentum().mag()==0){ edm::LogError(theCategory)<<"initial state of muon is (0,0,0)(0,0,0). no seed.";
115  return false;}
116 
117  //rescale the error at IP
119  LogDebug(theCategory)<<"after adjusting the error matrix: "<<fts;}
120 
121  return true;
122 }
#define LogDebug(id)
void adjust(FreeTrajectoryState &state)
adjust the error matrix on the state
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
bool theAdjustAtIp
adjust the state at IP or where it is defined for the seed
std::string theCategory
const MuonServiceProxy * theProxyService
MuonErrorMatrix * theErrorMatrixAdjuster
FreeTrajectoryState initialFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
void TSGForRoadSearch::makeSeeds_0 ( const reco::Track muon,
std::vector< TrajectorySeed > &  result 
)
private

oseed from inside-out: innermost Strip layer

Definition at line 127 of file TSGForRoadSearch.cc.

References alongMomentum, GeometricSearchDet::compatibleDetsV(), TrajectoryStateOnSurface::globalPosition(), SurfaceOrientation::inner, IPfts(), TrajectoryStateOnSurface::isValid(), LogDebug, notAtIPtsos(), GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, MuonServiceProxy::propagator(), pushTrajectorySeed(), DetLayer::subDetector(), GeomDetEnumerators::subDetGeom, GeomDetEnumerators::TEC, theCategory, theChi2Estimator, theGeometricSearchTracker, thePropagatorCompatibleName, thePropagatorName, theProxyService, GeomDetEnumerators::TIB, GeomDetEnumerators::TID, GeomDetEnumerators::TOB, z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by makeSeeds_4(), and trackerSeeds().

127  {
128  //get the state at IP
129  FreeTrajectoryState cIPFTS;
130  if (!IPfts(muon, cIPFTS)) return;
131 
132  //take state at inner surface and check the first part reached
133  const std::vector<const BarrelDetLayer*> & blc = theGeometricSearchTracker->tibLayers();
134  TrajectoryStateOnSurface inner = theProxyService->propagator(thePropagatorName)->propagate(cIPFTS,blc.front()->surface());
135  if ( !inner.isValid() ) {LogDebug(theCategory) <<"inner state is not valid. no seed."; return;}
136 
137  //rescale the error
138  if (!notAtIPtsos(inner)) return;
139 
140  double z = inner.globalPosition().z();
141 
142  const std::vector<const ForwardDetLayer*> &ptidc = theGeometricSearchTracker->posTidLayers();
143  const std::vector<const ForwardDetLayer*> &ptecc = theGeometricSearchTracker->posTecLayers();
144  const std::vector<const ForwardDetLayer*> &ntidc = theGeometricSearchTracker->negTidLayers();
145  const std::vector<const ForwardDetLayer*> &ntecc = theGeometricSearchTracker->negTecLayers();
146 
147  const DetLayer *inLayer = 0;
148  if( fabs(z) < ptidc.front()->surface().position().z() ) {
149  inLayer = blc.front();
150  } else if ( fabs(z) < ptecc.front()->surface().position().z() ) {
151  inLayer = ( z < 0 ) ? ntidc.front() : ptidc.front() ;
152  } else {
153  inLayer = ( z < 0 ) ? ntecc.front() : ptecc.front() ;
154  }
155 
156  //find out at least one compatible detector reached
157  std::vector< DetLayer::DetWithState > compatible;
158  compatible.reserve(10);
160 
161  //loop the parts until at least a compatible is found
162  while (compatible.size()==0) {
163  switch ( GeomDetEnumerators::subDetGeom[inLayer->subDetector()] ) {
168  LogDebug(theCategory)<<"from inside-out, trying TEC or TOB layers. no seed.";
169  return;
170  break;
172  inLayer = ( z < 0 ) ? ntidc.front() : ptidc.front() ;
173  break;
175  inLayer = ( z < 0 ) ? ntecc.front() : ptecc.front() ;
176  break;
177  default:
178  LogDebug(theCategory)<<"subdetectorid is not a tracker sub-dectector id. skipping.";
179  return;
180  }
182  }
183 
184  pushTrajectorySeed(muon,compatible,alongMomentum,result);
185 
186  return;
187 }
#define LogDebug(id)
edm::ESHandle< GeometricSearchTracker > theGeometricSearchTracker
bool IPfts(const reco::Track &, FreeTrajectoryState &)
get the FTS for a Track: adjusting the error matrix if requested
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
GlobalPoint globalPosition() const
tuple result
Definition: mps_fire.py:84
std::string theCategory
T z() const
Definition: PV3DBase.h:64
bool notAtIPtsos(TrajectoryStateOnSurface &state)
make the adjustement away from PCA state if requested
Chi2MeasurementEstimator * theChi2Estimator
const MuonServiceProxy * theProxyService
void pushTrajectorySeed(const reco::Track &muon, std::vector< DetLayer::DetWithState > &compatible, PropagationDirection direction, std::vector< TrajectorySeed > &result) const
add the seed(s) to the collection of seeds
std::string thePropagatorCompatibleName
std::string thePropagatorName
SubDetector subDetGeom[20]
virtual void compatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const
edm::ESHandle< Propagator > propagator(std::string propagatorName) const
get the propagator
void TSGForRoadSearch::makeSeeds_1 ( const reco::Track muon,
std::vector< TrajectorySeed > &  result 
)
private

not implemented

Definition at line 189 of file TSGForRoadSearch.cc.

References theCategory.

Referenced by trackerSeeds().

189  {
190  edm::LogError(theCategory)<<"option 1 of TSGForRoadSearch is not implemented yet. Please use 0,3 or 4. no seed.";
191  return;
192 }
std::string theCategory
void TSGForRoadSearch::makeSeeds_2 ( const reco::Track muon,
std::vector< TrajectorySeed > &  result 
)
private

not implemented

Definition at line 194 of file TSGForRoadSearch.cc.

References theCategory.

Referenced by trackerSeeds().

194  {
195  edm::LogError(theCategory)<<"option 2 of TSGForRoadSearch is not implemented yet. Please use 0,3 or 4. no seed.";
196  return;
197 }
std::string theCategory
void TSGForRoadSearch::makeSeeds_3 ( const reco::Track muon,
std::vector< TrajectorySeed > &  result 
)
private

outside-in: outermost Strip layer

Definition at line 202 of file TSGForRoadSearch.cc.

References GeometricSearchDet::compatibleDetsV(), IPfts(), LogDebug, LogTrace, notAtIPtsos(), oppositeToMomentum, SurfaceOrientation::outer, GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, GloballyPositioned< T >::position(), position, edm::ESHandle< class >::product(), MuonServiceProxy::propagator(), pushTrajectorySeed(), DetLayer::subDetector(), GeomDetEnumerators::subDetGeom, GeometricSearchDet::surface(), GeomDetEnumerators::TEC, theCategory, theChi2Estimator, theGeometricSearchTracker, thePropagatorCompatibleName, thePropagatorName, theProxyService, GeomDetEnumerators::TIB, GeomDetEnumerators::TID, GeomDetEnumerators::TOB, z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by trackerSeeds().

202  {
203  //get the state at IP
204  FreeTrajectoryState cIPFTS;
205  if (!IPfts(muon, cIPFTS)) return;
206 
207  //take state at outer surface and check the first part reached
208  const std::vector<const BarrelDetLayer*> &blc = theGeometricSearchTracker->tobLayers();
209 
210  // TrajectoryStateOnSurface outer = theProxyService->propagator(thePropagatorName)->propagate(cIPFTS,blc.back()->surface());
212  TrajectoryStateOnSurface outer = onBounds(cIPFTS);
213 
214  if ( !outer.isValid() ) {LogDebug(theCategory) <<"outer state is not valid. no seed."; return;}
215 
216  //rescale the error
217  if (!notAtIPtsos(outer)) return;
218 
219  double z = outer.globalPosition().z();
220 
221  const std::vector<const ForwardDetLayer*> &ptecc = theGeometricSearchTracker->posTecLayers();
222  const std::vector<const ForwardDetLayer*> &ntecc = theGeometricSearchTracker->negTecLayers();
223 
224  LogDebug(theCategory)<<"starting looking for a compatible layer from: "<<outer<<"\nz: "<<z<<"TEC1 z: "<<ptecc.front()->surface().position().z();
225 
226  unsigned int layerShift=0;
227  const DetLayer *inLayer = 0;
228  if (fabs(z) < ptecc.front()->surface().position().z() ){
229  inLayer = *(blc.rbegin()+layerShift);
230  LogTrace(theCategory)<<"choosing TOB layer with shift: "<<layerShift;
231  } else {
232  unsigned int tecIt=1;
233  for (; tecIt!=ptecc.size();tecIt++){
234  LogTrace(theCategory)<<"checking surface with shift: "<<tecIt
235  <<"z: "<<ptecc[tecIt]->surface().position().z();
236  if (fabs(z) < ptecc[tecIt]->surface().position().z())
237  {inLayer = ( z < 0 ) ? ntecc[tecIt-1] : ptecc[tecIt-1] ;
238  layerShift=tecIt-1;
239  LogTrace(theCategory)<<"choosing TEC layer with shift: "<<layerShift
240  <<" and z: "<<inLayer->surface().position().z();
241  break;}}
242  if (!inLayer) {inLayer = ( z < 0 ) ? ntecc.back() : ptecc.back();
243  LogTrace(theCategory)<<"choosing last TEC layer with z: "<<inLayer->surface().position().z();
244  }
245  }
246 
247  //find out at least one compatible detector reached
248  std::vector< DetLayer::DetWithState > compatible;
249  compatible.reserve(10);
251 
252  //loop the parts until at least a compatible is found
253  while (compatible.size()==0) {
254  switch ( GeomDetEnumerators::subDetGeom[inLayer->subDetector()] ) {
260  layerShift++;
261  if (layerShift>=blc.size()){
262  LogDebug(theCategory) <<"all barrel layers are exhausted to find starting state. no seed,";
263  return;}
264  inLayer = *(blc.rbegin()+layerShift);
265  break;
267  if (layerShift==0){
268  LogDebug(theCategory) <<"failed to get a compatible module on a TEC layer, using the last TOB layer.";
269  inLayer = *(blc.rbegin()+layerShift);
270  }
271  else{
272  layerShift--;
273  LogDebug(theCategory) <<"reaching more in with layer "<<layerShift<<" in TEC";
274  inLayer = ( z < 0 ) ? ntecc[layerShift] : ptecc[layerShift] ;
275  }
276  break;
277  default:
278  edm::LogError(theCategory)<<"subdetectorid is not a tracker sub-dectector id. skipping.";
279  return;
280  }
282  }
283 
285 
286  return;
287 }
#define LogDebug(id)
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
edm::ESHandle< GeometricSearchTracker > theGeometricSearchTracker
bool IPfts(const reco::Track &, FreeTrajectoryState &)
get the FTS for a Track: adjusting the error matrix if requested
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
tuple result
Definition: mps_fire.py:84
std::string theCategory
T z() const
Definition: PV3DBase.h:64
bool notAtIPtsos(TrajectoryStateOnSurface &state)
make the adjustement away from PCA state if requested
Chi2MeasurementEstimator * theChi2Estimator
#define LogTrace(id)
const MuonServiceProxy * theProxyService
void pushTrajectorySeed(const reco::Track &muon, std::vector< DetLayer::DetWithState > &compatible, PropagationDirection direction, std::vector< TrajectorySeed > &result) const
add the seed(s) to the collection of seeds
T const * product() const
Definition: ESHandle.h:86
std::string thePropagatorCompatibleName
static int position[264][3]
Definition: ReadPGInfo.cc:509
std::string thePropagatorName
SubDetector subDetGeom[20]
const PositionType & position() const
virtual void compatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const
edm::ESHandle< Propagator > propagator(std::string propagatorName) const
get the propagator
void TSGForRoadSearch::makeSeeds_4 ( const reco::Track muon,
std::vector< TrajectorySeed > &  result 
)
private

inside-out: innermost Pixel/Strip layer

Definition at line 293 of file TSGForRoadSearch.cc.

References alongMomentum, GeometricSearchDet::compatibleDetsV(), TrajectoryStateOnSurface::globalPosition(), SurfaceOrientation::inner, IPfts(), TrajectoryStateOnSurface::isValid(), LogDebug, makeSeeds_0(), notAtIPtsos(), GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, position, MuonServiceProxy::propagator(), pushTrajectorySeed(), GeomDetEnumerators::subDetGeom, GeomDetEnumerators::TEC, theCategory, theChi2Estimator, theGeometricSearchTracker, thePropagatorCompatibleName, thePropagatorName, theProxyService, GeomDetEnumerators::TIB, GeomDetEnumerators::TID, GeomDetEnumerators::TOB, z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by trackerSeeds().

293  {
294  //get the state at IP
295  FreeTrajectoryState cIPFTS;
296  if (!IPfts(muon, cIPFTS)) return;
297 
298  //take state at inner surface and check the first part reached
299  const std::vector<const BarrelDetLayer*> & blc = theGeometricSearchTracker->pixelBarrelLayers();
300  if (blc.empty()){edm::LogError(theCategory)<<"want to start from pixel layer, but no barrel exists. trying without pixel.";
301  makeSeeds_0(muon, result);
302  return;}
303 
304  TrajectoryStateOnSurface inner = theProxyService->propagator(thePropagatorName)->propagate(cIPFTS,blc.front()->surface());
305  if ( !inner.isValid() ) {LogDebug(theCategory) <<"inner state is not valid. no seed."; return;}
306 
307  //rescale the error
308  if (!notAtIPtsos(inner)) return;
309 
310  double z = inner.globalPosition().z();
311 
312  const std::vector<const ForwardDetLayer*> &ppxlc = theGeometricSearchTracker->posPixelForwardLayers();
313  const std::vector<const ForwardDetLayer*> &npxlc = theGeometricSearchTracker->negPixelForwardLayers();
314  const std::vector<const ForwardDetLayer*> &ptidc = theGeometricSearchTracker->posTidLayers();
315  const std::vector<const ForwardDetLayer*> &ptecc = theGeometricSearchTracker->posTecLayers();
316  const std::vector<const ForwardDetLayer*> &ntidc = theGeometricSearchTracker->negTidLayers();
317  const std::vector<const ForwardDetLayer*> &ntecc = theGeometricSearchTracker->negTecLayers();
318 
319  if ((ppxlc.empty() || npxlc.empty()) && (ptidc.empty() || ptecc.empty()) )
320  { edm::LogError(theCategory)<<"want to start from pixel layer, but no forward layer exists. trying without pixel.";
321  makeSeeds_0(muon, result);
322  return;}
323 
324  const DetLayer *inLayer = 0;
325  std::vector<const ForwardDetLayer*>::const_iterator layerIt ;
326 
327  double fz=fabs(z);
328 
329  //simple way of finding a first layer to try out
330  if (fz < fabs(((z>0)?ppxlc:npxlc).front()->surface().position().z())){
331  inLayer = blc.front();}
332  else if (fz < fabs(((z>0)?ppxlc:npxlc).back()->surface().position().z())){
333  layerIt = ((z>0)?ppxlc:npxlc).begin();
334  inLayer= *layerIt;}
335  else if (fz < fabs(((z>0)?ptidc:ntidc).front()->surface().position().z())){
336  layerIt = ((z>0)?ppxlc:npxlc).end()-1;
337  inLayer= *layerIt;}
338  else if (fz < fabs(((z>0)?ptecc:ntecc).front()->surface().position().z())){
339  layerIt = ((z>0)?ptidc:ntidc).begin();
340  inLayer= *layerIt;}
341  else if (fz < fabs(((z>0)?ptecc:ntecc).back()->surface().position().z())){
342  layerIt = ((z>0)?ptecc:ntecc).begin();
343  inLayer= *layerIt;}
344  else {
345  edm::LogWarning(theCategory)<<"the state is not consistent with any tracker layer:\n"
346  <<inner;
347  return;}
348 
349  //find out at least one compatible detector reached
350  std::vector< DetLayer::DetWithState > compatible;
351  compatible.reserve(10);
353 
354  //if none were found. you should do something more.
355  if (compatible.size()==0){
356  std::vector<const ForwardDetLayer*>::const_iterator pxlEnd = (z>0)? ppxlc.end() : npxlc.end();
357  std::vector<const ForwardDetLayer*>::const_iterator tidEnd = (z>0)? ptidc.end() : ntidc.end();
358  std::vector<const ForwardDetLayer*>::const_iterator tecEnd = (z>0)? ptecc.end() : ntecc.end();
359  std::vector<const ForwardDetLayer*>::const_iterator pxlBegin = (z>0)? ppxlc.begin() : npxlc.begin();
360  std::vector<const ForwardDetLayer*>::const_iterator tidBegin = (z>0)? ptidc.begin() : ntidc.begin();
361  std::vector<const ForwardDetLayer*>::const_iterator tecBegin = (z>0)? ptecc.begin() : ntecc.begin();
362 
363  //go to first disk if not already in a disk situation
364  if (!dynamic_cast<const ForwardDetLayer*>(inLayer)) layerIt =pxlBegin--;
365 
366  while (compatible.size()==0) {
367  switch ( GeomDetEnumerators::subDetGeom[(*layerIt)->subDetector()] ) {
369  {
370  layerIt++;
371  //if end of list reached. go to the first TID
372  if (layerIt==pxlEnd) layerIt=tidBegin;
373  break;
374  }
376  {
377  layerIt++;
378  //if end of list reached. go to the first TEC
379  if (layerIt==tidEnd) layerIt = tecBegin;
380  break;
381  }
383  {
384  layerIt++;
385  if (layerIt==tecEnd){
386  edm::LogWarning(theCategory)<<"ran out of layers to find a seed: no seed.";
387  return;}
388  }
389  case GeomDetEnumerators::PixelBarrel: { edm::LogError(theCategory)<<"this should not happen... ever. Please report. GeomDetEnumerators::PixelBarrel. no seed."; return;}
390  case GeomDetEnumerators::TIB: { edm::LogError(theCategory)<<"this should not happen... ever. Please report. GeomDetEnumerators::TIB. no seed."; return;}
391  case GeomDetEnumerators::TOB: { edm::LogError(theCategory)<<"this should not happen... ever. Please report. GeomDetEnumerators::TOB. no seed."; return;}
392  default: { edm::LogError(theCategory)<<"Subdetector id is not a tracker sub-detector id. no seed."; return;}
393  }//switch
394 
395  (*layerIt)->compatibleDetsV(inner,*theProxyService->propagator(thePropagatorCompatibleName),*theChi2Estimator,compatible);
396  }//while
397  }//if size==0
398 
399  pushTrajectorySeed(muon,compatible,alongMomentum,result);
400 
401  return;
402 }
#define LogDebug(id)
edm::ESHandle< GeometricSearchTracker > theGeometricSearchTracker
bool IPfts(const reco::Track &, FreeTrajectoryState &)
get the FTS for a Track: adjusting the error matrix if requested
GlobalPoint globalPosition() const
tuple result
Definition: mps_fire.py:84
std::string theCategory
T z() const
Definition: PV3DBase.h:64
bool notAtIPtsos(TrajectoryStateOnSurface &state)
make the adjustement away from PCA state if requested
Chi2MeasurementEstimator * theChi2Estimator
const MuonServiceProxy * theProxyService
void makeSeeds_0(const reco::Track &, std::vector< TrajectorySeed > &)
oseed from inside-out: innermost Strip layer
void pushTrajectorySeed(const reco::Track &muon, std::vector< DetLayer::DetWithState > &compatible, PropagationDirection direction, std::vector< TrajectorySeed > &result) const
add the seed(s) to the collection of seeds
std::string thePropagatorCompatibleName
static int position[264][3]
Definition: ReadPGInfo.cc:509
std::string thePropagatorName
SubDetector subDetGeom[20]
virtual void compatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const
edm::ESHandle< Propagator > propagator(std::string propagatorName) const
get the propagator
bool TSGForRoadSearch::notAtIPtsos ( TrajectoryStateOnSurface state)
private

make the adjustement away from PCA state if requested

Definition at line 101 of file TSGForRoadSearch.cc.

References MuonErrorMatrix::adjust(), LogDebug, theAdjustAtIp, theCategory, and theErrorMatrixAdjuster.

Referenced by makeSeeds_0(), makeSeeds_3(), and makeSeeds_4().

101  {
102  LogDebug(theCategory)<<"outer state: "<<state;
105  LogDebug(theCategory)<<"outer state after rescale: "<<state;
106  }
107  return true;
108 }
#define LogDebug(id)
void adjust(FreeTrajectoryState &state)
adjust the error matrix on the state
bool theAdjustAtIp
adjust the state at IP or where it is defined for the seed
std::string theCategory
MuonErrorMatrix * theErrorMatrixAdjuster
void TSGForRoadSearch::pushTrajectorySeed ( const reco::Track muon,
std::vector< DetLayer::DetWithState > &  compatible,
PropagationDirection  direction,
std::vector< TrajectorySeed > &  result 
) const
private

add the seed(s) to the collection of seeds

Definition at line 408 of file TSGForRoadSearch.cc.

References edm::OwnVector< T, P >::clear(), MeasurementDetWithData::fastMeasurements(), GeomDet::geographicalId(), MeasurementTrackerEvent::idToDet(), LogDebug, trajectoryStateTransform::persistentState(), MuonServiceProxy::propagator(), edm::OwnVector< T, P >::push_back(), DetId::rawId(), reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), reco::Track::recHitsSize(), theCategory, theChi2Estimator, theCopyMuonRecHit, theManySeeds, theMeasurementTrackerEvent, thePropagatorCompatibleName, theProxyService, theUpdator, tmp, and TrajectoryStateUpdator::update().

Referenced by makeSeeds_0(), makeSeeds_3(), and makeSeeds_4().

408  {
409 
410  if (compatible.empty()){
411  LogDebug(theCategory)<<"pushTrajectorySeed with no compatible module. 0 seed.";
412  return;}
413 
414  if (theManySeeds){
415 
416 
417  //finf out every compatible measurements
418  for (std::vector<DetLayer::DetWithState >::iterator DWSit = compatible.begin(); DWSit!=compatible.end();++DWSit){
419  bool aBareTS=false;
420  const GeomDet * gd = DWSit->first;
421  if (!gd){edm::LogError(theCategory)<<"GeomDet is not valid."; continue;}
423  std::vector<TrajectoryMeasurement> tmp = md.fastMeasurements(DWSit->second,DWSit->second,*theProxyService->propagator(thePropagatorCompatibleName),*theChi2Estimator);
424  //make a trajectory seed for each of them
425 
426  for (std::vector<TrajectoryMeasurement>::iterator Mit = tmp.begin(); Mit!=tmp.end();++Mit){
427  TrajectoryStateOnSurface predState(Mit->predictedState());
430  if (theCopyMuonRecHit){
431  LogDebug(theCategory)<<"copying ("<<muon.recHitsSize()<<") muon recHits";
432  //copy the muon rechit into the seed
433  for (trackingRecHit_iterator trit = muon.recHitsBegin(); trit!=muon.recHitsEnd();trit++) {
434  rhContainer.push_back( (*trit)->clone() ); }}
435 
436  if ( hit->isValid()) {
437  TrajectoryStateOnSurface upState(theUpdator->update(predState,*hit));
438 
440  LogDebug(theCategory)<<"state used to build a trajectory seed: \n"<<upState
441  <<"on detector: "<<gd->geographicalId().rawId();
442  //add the tracking rechit
443  if (theCopyMuonRecHit){
444  edm::LogError(theCategory)<<"not a bare seed and muon hits are copied. dumping the muon hits.";
445  rhContainer.clear();}
446  rhContainer.push_back(hit->hit()->clone());
447 
448  result.push_back(TrajectorySeed(PTSOD,rhContainer,direction));
449  }
450  else {
451  //rec hit is not valid. put a bare TrajectorySeed, only once !
452  if (!aBareTS){
453  aBareTS=true;
454 
456  LogDebug(theCategory)<<"state used to build a bare trajectory seed: \n"<<predState
457  <<"on detector: "<<gd->geographicalId().rawId();
458 
459  result.push_back(TrajectorySeed(PTSOD,rhContainer,direction));
460  }
461  }
462 
463  }
464 
465 
466  }
467  }
468  else{
469  //transform it into a PTrajectoryStateOnDet
470 
471  PTrajectoryStateOnDet const& PTSOD = trajectoryStateTransform::persistentState(compatible.front().second,compatible.front().first->geographicalId().rawId());
472  LogDebug(theCategory)<<"state used to build a bare trajectory seed: \n"<<compatible.front().second
473  <<"on detector: "<<compatible.front().first->geographicalId().rawId();
474 
476  if (theCopyMuonRecHit){
477  LogDebug(theCategory)<<"copying ("<<muon.recHitsSize()<<") muon recHits";
478  //copy the muon rechit into the seed
479  for (trackingRecHit_iterator trit = muon.recHitsBegin(); trit!=muon.recHitsEnd();trit++) {
480  rhContainer.push_back( (*trit)->clone() ); }}
481 
482  //add this seed to the list and return it
483  result.push_back(TrajectorySeed(PTSOD,rhContainer,direction));
484  }
485  return;
486 }
#define LogDebug(id)
MeasurementDetWithData idToDet(const DetId &id) const
Previous MeasurementDetSystem interface.
size_t recHitsSize() const
Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits)...
Definition: Track.h:119
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
tuple result
Definition: mps_fire.py:84
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
std::string theCategory
void push_back(D *&d)
Definition: OwnVector.h:290
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const =0
std::vector< TrajectoryMeasurement > fastMeasurements(const TrajectoryStateOnSurface &stateOnThisDet, const TrajectoryStateOnSurface &tsos2, const Propagator &prop, const MeasurementEstimator &est) const
void clear()
Definition: OwnVector.h:445
Chi2MeasurementEstimator * theChi2Estimator
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:79
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:104
const MuonServiceProxy * theProxyService
const MeasurementTrackerEvent * theMeasurementTrackerEvent
TrackingRecHit::ConstRecHitPointer ConstRecHitPointer
std::string thePropagatorCompatibleName
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
TrajectoryStateUpdator * theUpdator
edm::ESHandle< Propagator > propagator(std::string propagatorName) const
get the propagator
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:109
void TSGForRoadSearch::setEvent ( const edm::Event event)
virtual

set the event: update the MeasurementTracker

Reimplemented from TrackerSeedGenerator.

Definition at line 70 of file TSGForRoadSearch.cc.

References data, MuonServiceProxy::eventSetup(), edm::EventSetup::get(), edm::ESHandleBase::isValid(), theCategory, theGeometricSearchTracker, theManySeeds, theMeasurementTracker, theMeasurementTrackerEvent, theMeasurementTrackerEventToken, and theProxyService.

70  {
71  //get the measurementtracker
72  if (theManySeeds){
74  if (!theMeasurementTracker.isValid())/*abort*/{edm::LogError(theCategory)<<"measurement tracker geometry not found ";}
75  }
77 
79  event.getByToken(theMeasurementTrackerEventToken, data);
81 }
const edm::EventSetup & eventSetup() const
get the whole EventSetup
edm::ESHandle< GeometricSearchTracker > theGeometricSearchTracker
edm::ESHandle< MeasurementTracker > theMeasurementTracker
edm::EDGetTokenT< MeasurementTrackerEvent > theMeasurementTrackerEventToken
std::string theCategory
const MuonServiceProxy * theProxyService
const MeasurementTrackerEvent * theMeasurementTrackerEvent
const T & get() const
Definition: EventSetup.h:56
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
bool isValid() const
Definition: ESHandle.h:47
void TSGForRoadSearch::trackerSeeds ( const TrackCand ,
const TrackingRegion ,
const TrackerTopology ,
BTSeedCollection  
)
virtual

generated seed(s) for a track. the tracking region is not used.

Reimplemented from TrackerSeedGenerator.

Definition at line 85 of file TSGForRoadSearch.cc.

References makeSeeds_0(), makeSeeds_1(), makeSeeds_2(), makeSeeds_3(), makeSeeds_4(), and theOption.

86  {
87  switch (theOption){
88  case 0:
89  makeSeeds_0(*muonTrackCand.second,result);break;
90  case 1:
91  makeSeeds_1(*muonTrackCand.second,result);break;
92  case 2:
93  makeSeeds_2(*muonTrackCand.second,result);break;
94  case 3:
95  makeSeeds_3(*muonTrackCand.second,result);break;
96  case 4:
97  makeSeeds_4(*muonTrackCand.second,result);break;
98  }
99 }
void makeSeeds_2(const reco::Track &, std::vector< TrajectorySeed > &)
not implemented
tuple result
Definition: mps_fire.py:84
void makeSeeds_1(const reco::Track &, std::vector< TrajectorySeed > &)
not implemented
void makeSeeds_3(const reco::Track &, std::vector< TrajectorySeed > &)
outside-in: outermost Strip layer
void makeSeeds_0(const reco::Track &, std::vector< TrajectorySeed > &)
oseed from inside-out: innermost Strip layer
void makeSeeds_4(const reco::Track &, std::vector< TrajectorySeed > &)
inside-out: innermost Pixel/Strip layer
unsigned int theOption

Member Data Documentation

bool TSGForRoadSearch::theAdjustAtIp
private

adjust the state at IP or where it is defined for the seed

Definition at line 84 of file TSGForRoadSearch.h.

Referenced by IPfts(), notAtIPtsos(), and TSGForRoadSearch().

std::string TSGForRoadSearch::theCategory
private
Chi2MeasurementEstimator* TSGForRoadSearch::theChi2Estimator
private
edm::ParameterSet TSGForRoadSearch::theConfig
private

Definition at line 88 of file TSGForRoadSearch.h.

bool TSGForRoadSearch::theCopyMuonRecHit
private

Definition at line 101 of file TSGForRoadSearch.h.

Referenced by pushTrajectorySeed(), and TSGForRoadSearch().

MuonErrorMatrix* TSGForRoadSearch::theErrorMatrixAdjuster
private

Definition at line 110 of file TSGForRoadSearch.h.

Referenced by IPfts(), notAtIPtsos(), TSGForRoadSearch(), and ~TSGForRoadSearch().

edm::ESHandle<GeometricSearchTracker> TSGForRoadSearch::theGeometricSearchTracker
private

Definition at line 91 of file TSGForRoadSearch.h.

Referenced by makeSeeds_0(), makeSeeds_3(), makeSeeds_4(), and setEvent().

bool TSGForRoadSearch::theManySeeds
private

Definition at line 102 of file TSGForRoadSearch.h.

Referenced by pushTrajectorySeed(), setEvent(), and TSGForRoadSearch().

edm::ESHandle<MeasurementTracker> TSGForRoadSearch::theMeasurementTracker
private

Definition at line 90 of file TSGForRoadSearch.h.

Referenced by setEvent().

const MeasurementTrackerEvent* TSGForRoadSearch::theMeasurementTrackerEvent
private

Definition at line 95 of file TSGForRoadSearch.h.

Referenced by pushTrajectorySeed(), setEvent(), and TSGForRoadSearch().

edm::InputTag TSGForRoadSearch::theMeasurementTrackerEventTag
private

Definition at line 93 of file TSGForRoadSearch.h.

Referenced by TSGForRoadSearch().

edm::EDGetTokenT<MeasurementTrackerEvent> TSGForRoadSearch::theMeasurementTrackerEventToken
private

Definition at line 94 of file TSGForRoadSearch.h.

Referenced by setEvent(), and TSGForRoadSearch().

unsigned int TSGForRoadSearch::theOption
private

Definition at line 100 of file TSGForRoadSearch.h.

Referenced by trackerSeeds(), and TSGForRoadSearch().

edm::ESHandle<Propagator> TSGForRoadSearch::theProp
private

Definition at line 104 of file TSGForRoadSearch.h.

std::string TSGForRoadSearch::thePropagatorCompatibleName
private
std::string TSGForRoadSearch::thePropagatorName
private

Definition at line 103 of file TSGForRoadSearch.h.

Referenced by makeSeeds_0(), makeSeeds_3(), makeSeeds_4(), and TSGForRoadSearch().

edm::ESHandle<Propagator> TSGForRoadSearch::thePropCompatible
private

Definition at line 106 of file TSGForRoadSearch.h.

const MuonServiceProxy* TSGForRoadSearch::theProxyService
private
TrajectoryStateUpdator* TSGForRoadSearch::theUpdator
private

Definition at line 97 of file TSGForRoadSearch.h.

Referenced by pushTrajectorySeed(), TSGForRoadSearch(), and ~TSGForRoadSearch().