CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
TSGForOI Class Reference

Create L3MuonTrajectorySeeds from L2 Muons updated at vertex in an outside in manner. More...

#include <TSGForOI.h>

Inheritance diagram for TSGForOI:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void produce (edm::StreamID sid, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
 
 TSGForOI (const edm::ParameterSet &iConfig)
 
 ~TSGForOI () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

double calculateSFFromL2 (const reco::TrackRef track) const
 Function used to calculate the dynamic error SF by analysing the L2. More...
 
void findSeedsOnLayer (const TrackerTopology *tTopo, const GeometricSearchDet &layer, const TrajectoryStateOnSurface &tsosAtIP, const Propagator &propagatorAlong, const Propagator &propagatorOpposite, const reco::TrackRef l2, edm::ESHandle< Chi2MeasurementEstimatorBase > &estimator_, edm::Handle< MeasurementTrackerEvent > &measurementTrackerH, unsigned int &numSeedsMade, unsigned int &numOfMaxSeeds, unsigned int &layerCount, bool &foundHitlessSeed, bool &analysedL2, std::unique_ptr< std::vector< TrajectorySeed > > &out) const
 Function to find seeds on a given layer. More...
 
int makeSeedsFromHits (const TrackerTopology *tTopo, const GeometricSearchDet &layer, const TrajectoryStateOnSurface &tsosAtIP, std::vector< TrajectorySeed > &out, const Propagator &propagatorAlong, const MeasurementTrackerEvent &measurementTracker, edm::ESHandle< Chi2MeasurementEstimatorBase > &estimator_, unsigned int &numSeedsMade, const double errorSF) const
 Function to find hits on layers and create seeds from updated TSOS. More...
 

Private Attributes

const bool adjustErrorsDynamicallyForHitless_
 
const bool adjustErrorsDynamicallyForHits_
 Whether or not to use an automatically calculated scale-factor value. More...
 
const std::string estimatorName_
 Estimator used to find dets and TrajectoryMeasurements. More...
 
const double eta1_
 
const double eta2_
 
const double fixedErrorRescalingForHitless_
 
const double fixedErrorRescalingForHits_
 How much to rescale errors from the L2 (fixed error vs pT, eta) More...
 
const double maxEtaForTOB_
 Maximum eta value to activate searching in the TOB. More...
 
const edm::EDGetTokenT< MeasurementTrackerEventmeasurementTrackerTag_
 
const double minEtaForTEC_
 Minimum eta value to activate searching in the TEC. More...
 
const unsigned int numOfHitsToTry_
 How many hits to try per layer. More...
 
const unsigned int numOfLayersToTry_
 How many layers to try. More...
 
const unsigned int numOfMaxSeedsParam_
 Maximum number of seeds for each L2. More...
 
const std::string propagatorName_
 Counters and flags for the implementation. More...
 
const double pT1_
 pT, eta ranges and scale factor values More...
 
const double pT2_
 
const double pT3_
 
const double SF1_
 
const double SF2_
 
const double SF3_
 
const double SF4_
 
const double SF5_
 
const edm::EDGetTokenT< reco::TrackCollectionsrc_
 Labels for input collections. More...
 
const std::string theCategory
 
const double tsosDiff_
 Distance of TSOSs to trigger using hits or not. More...
 
const std::unique_ptr< TrajectoryStateUpdatorupdator_
 KFUpdator defined in constructor. More...
 
const bool useHitLessSeeds_
 
const bool useStereoLayersInTEC_
 Switch ON to use Stereo layers instead of using every layer in TEC. More...
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Create L3MuonTrajectorySeeds from L2 Muons updated at vertex in an outside in manner.

Author
Benjamin Radburn-Smith, Santiago Folgueras

Definition at line 33 of file TSGForOI.h.

Constructor & Destructor Documentation

TSGForOI::TSGForOI ( const edm::ParameterSet iConfig)
explicit

Definition at line 15 of file TSGForOI.cc.

15  :
16  src_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("src"))),
17  numOfMaxSeedsParam_(iConfig.getParameter<uint32_t>("maxSeeds")),
18  numOfLayersToTry_(iConfig.getParameter<int32_t>("layersToTry")),
19  numOfHitsToTry_(iConfig.getParameter<int32_t>("hitsToTry")),
20  fixedErrorRescalingForHits_(iConfig.getParameter<double>("fixedErrorRescaleFactorForHits")),
21  fixedErrorRescalingForHitless_(iConfig.getParameter<double>("fixedErrorRescaleFactorForHitless")),
22  adjustErrorsDynamicallyForHits_(iConfig.getParameter<bool>("adjustErrorsDynamicallyForHits")),
23  adjustErrorsDynamicallyForHitless_(iConfig.getParameter<bool>("adjustErrorsDynamicallyForHitless")),
24  estimatorName_(iConfig.getParameter<std::string>("estimator")),
25  minEtaForTEC_(iConfig.getParameter<double>("minEtaForTEC")),
26  maxEtaForTOB_(iConfig.getParameter<double>("maxEtaForTOB")),
27  useHitLessSeeds_(iConfig.getParameter<bool>("UseHitLessSeeds")),
28  useStereoLayersInTEC_(iConfig.getParameter<bool>("UseStereoLayersInTEC")),
29  updator_(new KFUpdator()),
30  measurementTrackerTag_(consumes<MeasurementTrackerEvent>(iConfig.getParameter<edm::InputTag>("MeasurementTrackerEvent"))),
31  pT1_(iConfig.getParameter<double>("pT1")),
32  pT2_(iConfig.getParameter<double>("pT2")),
33  pT3_(iConfig.getParameter<double>("pT3")),
34  eta1_(iConfig.getParameter<double>("eta1")),
35  eta2_(iConfig.getParameter<double>("eta2")),
36  SF1_(iConfig.getParameter<double>("SF1")),
37  SF2_(iConfig.getParameter<double>("SF2")),
38  SF3_(iConfig.getParameter<double>("SF3")),
39  SF4_(iConfig.getParameter<double>("SF4")),
40  SF5_(iConfig.getParameter<double>("SF5")),
41  tsosDiff_(iConfig.getParameter<double>("tsosDiff")),
42  propagatorName_(iConfig.getParameter<std::string>("propagatorName")),
43  theCategory(string("Muon|RecoMuon|TSGForOI"))
44 {
45  produces<std::vector<TrajectorySeed> >();
46 }
const std::string estimatorName_
Estimator used to find dets and TrajectoryMeasurements.
Definition: TSGForOI.h:61
T getParameter(std::string const &) const
const double tsosDiff_
Distance of TSOSs to trigger using hits or not.
Definition: TSGForOI.h:87
const std::string propagatorName_
Counters and flags for the implementation.
Definition: TSGForOI.h:90
const double SF3_
Definition: TSGForOI.h:84
const double maxEtaForTOB_
Maximum eta value to activate searching in the TOB.
Definition: TSGForOI.h:67
const double minEtaForTEC_
Minimum eta value to activate searching in the TEC.
Definition: TSGForOI.h:64
const double fixedErrorRescalingForHits_
How much to rescale errors from the L2 (fixed error vs pT, eta)
Definition: TSGForOI.h:53
const std::unique_ptr< TrajectoryStateUpdator > updator_
KFUpdator defined in constructor.
Definition: TSGForOI.h:77
const double eta2_
Definition: TSGForOI.h:83
const bool useHitLessSeeds_
Definition: TSGForOI.h:71
const unsigned int numOfLayersToTry_
How many layers to try.
Definition: TSGForOI.h:47
const double SF1_
Definition: TSGForOI.h:84
const bool useStereoLayersInTEC_
Switch ON to use Stereo layers instead of using every layer in TEC.
Definition: TSGForOI.h:74
const double SF5_
Definition: TSGForOI.h:84
const bool adjustErrorsDynamicallyForHitless_
Definition: TSGForOI.h:58
const double pT1_
pT, eta ranges and scale factor values
Definition: TSGForOI.h:82
const double SF4_
Definition: TSGForOI.h:84
const double pT2_
Definition: TSGForOI.h:82
const double eta1_
Definition: TSGForOI.h:83
const double pT3_
Definition: TSGForOI.h:82
const edm::EDGetTokenT< reco::TrackCollection > src_
Labels for input collections.
Definition: TSGForOI.h:41
const bool adjustErrorsDynamicallyForHits_
Whether or not to use an automatically calculated scale-factor value.
Definition: TSGForOI.h:57
const edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrackerTag_
Definition: TSGForOI.h:79
const unsigned int numOfMaxSeedsParam_
Maximum number of seeds for each L2.
Definition: TSGForOI.h:44
const std::string theCategory
Definition: TSGForOI.h:91
const double SF2_
Definition: TSGForOI.h:84
const unsigned int numOfHitsToTry_
How many hits to try per layer.
Definition: TSGForOI.h:50
const double fixedErrorRescalingForHitless_
Definition: TSGForOI.h:54
TSGForOI::~TSGForOI ( )
override

Definition at line 49 of file TSGForOI.cc.

49  {
50 }

Member Function Documentation

double TSGForOI::calculateSFFromL2 ( const reco::TrackRef  track) const
private

Function used to calculate the dynamic error SF by analysing the L2.

Definition at line 256 of file TSGForOI.cc.

References funct::abs(), eta1_, eta2_, LogTrace, pT1_, pT2_, pT3_, SF1_, SF2_, SF3_, SF4_, SF5_, and theCategory.

Referenced by findSeedsOnLayer().

256  {
257 
258  double theSF=1.0;
259  // L2 direction vs pT blowup - as was previously done:
260  // Split into 4 pT ranges: <pT1_, pT1_<pT2_, pT2_<pT3_, <pT4_: 13,30,70
261  // Split into 2 eta ranges for the middle two pT ranges: 1.0,1.4
262  double abseta = std::abs(track->eta());
263  if (track->pt()<=pT1_) theSF=SF1_;
264  if (track->pt()>pT1_ && track->pt()<=pT2_){
265  if (abseta<=eta1_) theSF=SF3_;
266  if (abseta>eta1_ && abseta<=eta2_) theSF=SF2_;
267  if (abseta>eta2_) theSF=SF3_;
268  }
269  if (track->pt()>pT2_ && track->pt()<=pT3_){
270  if (abseta<=eta1_) theSF=SF5_;
271  if (abseta>eta1_ && abseta<=eta2_) theSF=SF4_;
272  if (abseta>eta2_) theSF=SF5_;
273  }
274  if (track->pt()>pT3_) theSF=SF5_;
275 
276  LogTrace(theCategory) << "TSGForOI::calculateSFFromL2: SF has been calculated as: " << theSF;
277  return theSF;
278 }
const double SF3_
Definition: TSGForOI.h:84
const double eta2_
Definition: TSGForOI.h:83
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const double SF1_
Definition: TSGForOI.h:84
const double SF5_
Definition: TSGForOI.h:84
#define LogTrace(id)
const double pT1_
pT, eta ranges and scale factor values
Definition: TSGForOI.h:82
const double SF4_
Definition: TSGForOI.h:84
const double pT2_
Definition: TSGForOI.h:82
const double eta1_
Definition: TSGForOI.h:83
const double pT3_
Definition: TSGForOI.h:82
const std::string theCategory
Definition: TSGForOI.h:91
const double SF2_
Definition: TSGForOI.h:84
void TSGForOI::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 347 of file TSGForOI.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), DEFINE_FWK_MODULE, and AlCaHLTBitMon_QueryRunRegistry::string.

347  {
349  desc.add<edm::InputTag>("src",edm::InputTag("hltL2Muons","UpdatedAtVtx"));
350  desc.add<int>("layersToTry",1);
351  desc.add<double>("fixedErrorRescaleFactorForHitless",2.0);
352  desc.add<int>("hitsToTry",1);
353  desc.add<bool>("adjustErrorsDynamicallyForHits",false);
354  desc.add<bool>("adjustErrorsDynamicallyForHitless",false);
355  desc.add<edm::InputTag>("MeasurementTrackerEvent",edm::InputTag("hltSiStripClusters"));
356  desc.add<bool>("UseHitLessSeeds",true);
357  desc.add<bool>("UseStereoLayersInTEC",false);
358  desc.add<std::string>("estimator","hltESPChi2MeasurementEstimator100");
359  desc.add<double>("maxEtaForTOB",1.2);
360  desc.add<double>("minEtaForTEC",0.8);
361  desc.addUntracked<bool>("debug",true);
362  desc.add<double>("fixedErrorRescaleFactorForHits",2.0);
363  desc.add<unsigned int>("maxSeeds",1);
364  desc.add<double>("pT1",13.0);
365  desc.add<double>("pT2",30.0);
366  desc.add<double>("pT3",70.0);
367  desc.add<double>("eta1",1.0);
368  desc.add<double>("eta2",1.4);
369  desc.add<double>("SF1",3.0);
370  desc.add<double>("SF2",4.0);
371  desc.add<double>("SF3",5.0);
372  desc.add<double>("SF4",7.0);
373  desc.add<double>("SF5",10.0);
374  desc.add<double>("tsosDiff",0.03);
375  desc.add<std::string>("propagatorName","PropagatorWithMaterial");
376  descriptions.add("TSGForOI",desc);
377 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void TSGForOI::findSeedsOnLayer ( const TrackerTopology tTopo,
const GeometricSearchDet layer,
const TrajectoryStateOnSurface tsosAtIP,
const Propagator propagatorAlong,
const Propagator propagatorOpposite,
const reco::TrackRef  l2,
edm::ESHandle< Chi2MeasurementEstimatorBase > &  estimator_,
edm::Handle< MeasurementTrackerEvent > &  measurementTrackerH,
unsigned int &  numSeedsMade,
unsigned int &  numOfMaxSeeds,
unsigned int &  layerCount,
bool &  foundHitlessSeed,
bool &  analysedL2,
std::unique_ptr< std::vector< TrajectorySeed > > &  out 
) const
private

Function to find seeds on a given layer.

Definition at line 195 of file TSGForOI.cc.

References adjustErrorsDynamicallyForHitless_, adjustErrorsDynamicallyForHits_, calculateSFFromL2(), GeometricSearchDet::compatibleDetsV(), fixedErrorRescalingForHitless_, fixedErrorRescalingForHits_, LogTrace, makeSeedsFromHits(), numOfLayersToTry_, oppositeToMomentum, MillePedeFileConverter_cfg::out, trajectoryStateTransform::persistentState(), theCategory, and useHitLessSeeds_.

Referenced by produce().

209  {
210 
211  if (numSeedsMade>numOfMaxSeeds) return;
212  LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: numSeedsMade = " << numSeedsMade << " , layerCount = " << layerCount << endl;
213 
214  double errorSFHits=1.0;
215  double errorSFHitless=1.0;
217  else errorSFHits = calculateSFFromL2(l2);
219 
220  // Hitless: TO Be discarded from here at some point.
221  if (useHitLessSeeds_ && !foundHitlessSeed) {
222  LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: Start hitless" << endl;
223  std::vector< GeometricSearchDet::DetWithState > dets;
224  layer.compatibleDetsV(tsosAtIP, propagatorAlong, *estimatorH, dets);
225  if (!dets.empty()) {
226  auto const& detOnLayer = dets.front().first;
227  auto const& tsosOnLayer = dets.front().second;
228  LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: tsosOnLayer " << tsosOnLayer << endl;
229  if (!tsosOnLayer.isValid()){
230  edm::LogInfo(theCategory) << "ERROR!: Hitless TSOS is not valid!";
231  }
232  else{
233  // calculate SF from L2 (only once -- if needed)
234  if (!analysedL2 && adjustErrorsDynamicallyForHitless_) {
235  errorSFHitless=calculateSFFromL2(l2);
236  analysedL2=true;
237  }
238 
239  dets.front().second.rescaleError(errorSFHitless);
240  PTrajectoryStateOnDet const& ptsod = trajectoryStateTransform::persistentState(tsosOnLayer,detOnLayer->geographicalId().rawId());
242  out->push_back(TrajectorySeed(ptsod,rHC,oppositeToMomentum));
243  LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: TSOD (Hitless) done " << endl;
244  foundHitlessSeed=true;
245  numSeedsMade++;
246  }
247  }
248  }
249 
250  // Hits:
251  if (layerCount>numOfLayersToTry_) return;
252  LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: Start Hits" <<endl;
253  if (makeSeedsFromHits(tTopo, layer, tsosAtIP, *out, propagatorAlong, *measurementTrackerH, estimatorH, numSeedsMade, errorSFHits)) ++layerCount;
254 }
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
const double fixedErrorRescalingForHits_
How much to rescale errors from the L2 (fixed error vs pT, eta)
Definition: TSGForOI.h:53
const bool useHitLessSeeds_
Definition: TSGForOI.h:71
const unsigned int numOfLayersToTry_
How many layers to try.
Definition: TSGForOI.h:47
double calculateSFFromL2(const reco::TrackRef track) const
Function used to calculate the dynamic error SF by analysing the L2.
Definition: TSGForOI.cc:256
#define LogTrace(id)
const bool adjustErrorsDynamicallyForHitless_
Definition: TSGForOI.h:58
int makeSeedsFromHits(const TrackerTopology *tTopo, const GeometricSearchDet &layer, const TrajectoryStateOnSurface &tsosAtIP, std::vector< TrajectorySeed > &out, const Propagator &propagatorAlong, const MeasurementTrackerEvent &measurementTracker, edm::ESHandle< Chi2MeasurementEstimatorBase > &estimator_, unsigned int &numSeedsMade, const double errorSF) const
Function to find hits on layers and create seeds from updated TSOS.
Definition: TSGForOI.cc:281
const bool adjustErrorsDynamicallyForHits_
Whether or not to use an automatically calculated scale-factor value.
Definition: TSGForOI.h:57
const std::string theCategory
Definition: TSGForOI.h:91
virtual void compatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const
const double fixedErrorRescalingForHitless_
Definition: TSGForOI.h:54
int TSGForOI::makeSeedsFromHits ( const TrackerTopology tTopo,
const GeometricSearchDet layer,
const TrajectoryStateOnSurface tsosAtIP,
std::vector< TrajectorySeed > &  out,
const Propagator propagatorAlong,
const MeasurementTrackerEvent measurementTracker,
edm::ESHandle< Chi2MeasurementEstimatorBase > &  estimator_,
unsigned int &  numSeedsMade,
const double  errorSF 
) const
private

Function to find hits on layers and create seeds from updated TSOS.

Definition at line 281 of file TSGForOI.cc.

References GeometricSearchDet::compatibleDetsV(), MeasurementDetWithData::fastMeasurements(), runEdmFileComparison::found, MeasurementDetWithData::isNull(), TrajectoryStateOnSurface::isValid(), LogTrace, eostools::move(), numOfHitsToTry_, oppositeToMomentum, trajectoryStateTransform::persistentState(), edm::OwnVector< T, P >::push_back(), DetId::rawId(), TrajectoryStateOnSurface::rescaleError(), SurveyInfoScenario_cff::seed, edm::OwnVector< T, P >::size(), DetId::subdetId(), StripSubdetector::TEC, TrackerTopology::tecIsStereo(), updator_, and useStereoLayersInTEC_.

Referenced by findSeedsOnLayer().

290  {
291 
292  // Error Rescaling:
293  TrajectoryStateOnSurface onLayer(tsosAtIP);
294  onLayer.rescaleError(errorSF);
295 
296  std::vector< GeometricSearchDet::DetWithState > dets;
297  layer.compatibleDetsV(onLayer, propagatorAlong, *estimatorH, dets);
298 
299  // Find Measurements on each DetWithState:
300  LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: find measurements on each detWithState " << dets.size() << endl;
301  std::vector<TrajectoryMeasurement> meas;
302  for (std::vector<GeometricSearchDet::DetWithState>::iterator it=dets.begin(); it!=dets.end(); ++it) {
303  MeasurementDetWithData det = measurementTracker.idToDet(it->first->geographicalId());
304  if (det.isNull()) {
305  continue;
306  }
307  if (!it->second.isValid()) continue; //Skip if TSOS is not valid
308 
309  std::vector < TrajectoryMeasurement > mymeas = det.fastMeasurements(it->second, onLayer, propagatorAlong, *estimatorH); //Second TSOS is not used
310  for (std::vector<TrajectoryMeasurement>::const_iterator it2 = mymeas.begin(), ed2 = mymeas.end(); it2 != ed2; ++it2) {
311  if (it2->recHit()->isValid()) meas.push_back(*it2); //Only save those which are valid
312  }
313  }
314 
315 
316  // Update TSOS using TMs after sorting, then create Trajectory Seed and put into vector:
317  LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: Update TSOS using TMs after sorting, then create Trajectory Seed, number of TM = " << meas.size() << endl;
318  unsigned int found = 0;
319  std::sort(meas.begin(), meas.end(), TrajMeasLessEstim());
320  for (std::vector<TrajectoryMeasurement>::const_iterator it=meas.begin(); it!=meas.end(); ++it) {
321  TrajectoryStateOnSurface updatedTSOS = updator_->update(it->forwardPredictedState(), *it->recHit());
322  LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: TSOS for TM " << found << endl;
323  if (not updatedTSOS.isValid()) continue;
324 
325  // CHECK if is StereoLayer:
326  if (useStereoLayersInTEC_) {
327  DetId detid = ((*it).recHit()->hit())->geographicalId();
328  if (detid.subdetId() == StripSubdetector::TEC) {
329  if (!tTopo->tecIsStereo(detid.rawId())) break; // try another layer
330  }
331  }
332 
334  seedHits.push_back(*it->recHit()->hit());
335  PTrajectoryStateOnDet const& pstate = trajectoryStateTransform::persistentState(updatedTSOS, it->recHit()->geographicalId().rawId());
336  TrajectorySeed seed(pstate, std::move(seedHits), oppositeToMomentum);
337  LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: number of seedHits: " << seedHits.size() << endl;
338  out.push_back(seed);
339  found++;
340  numSeedsMade++;
341  if (found == numOfHitsToTry_) break;
342  }
343  return found;
344 }
size_type size() const
Definition: OwnVector.h:264
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
bool tecIsStereo(const DetId &id) const
void push_back(D *&d)
Definition: OwnVector.h:290
const std::unique_ptr< TrajectoryStateUpdator > updator_
KFUpdator defined in constructor.
Definition: TSGForOI.h:77
std::vector< TrajectoryMeasurement > fastMeasurements(const TrajectoryStateOnSurface &stateOnThisDet, const TrajectoryStateOnSurface &tsos2, const Propagator &prop, const MeasurementEstimator &est) const
const bool useStereoLayersInTEC_
Switch ON to use Stereo layers instead of using every layer in TEC.
Definition: TSGForOI.h:74
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
#define LogTrace(id)
Definition: DetId.h:18
virtual void compatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const
def move(src, dest)
Definition: eostools.py:510
const unsigned int numOfHitsToTry_
How many hits to try per layer.
Definition: TSGForOI.h:50
void TSGForOI::produce ( edm::StreamID  sid,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
override

Init variables

Surface used to make a TSOS at the PCA to the beamline

Read ESHandles

Read L2 track collection

Definition at line 53 of file TSGForOI.cc.

References funct::abs(), alongMomentum, Plane::build(), estimatorName_, PV3DBase< T, PVType, FrameType >::eta(), findSeedsOnLayer(), edm::EventSetup::get(), edm::Event::getByToken(), TrajectoryStateOnSurface::globalPosition(), trajectoryStateTransform::initialFreeState(), trajectoryStateTransform::innerStateOnSurface(), TrackerGeometry::isThere(), TrajectoryStateOnSurface::isValid(), LogTrace, maxEtaForTOB_, measurementTrackerTag_, minEtaForTEC_, eostools::move(), numOfMaxSeedsParam_, oppositeToMomentum, MillePedeFileConverter_cfg::out, GeomDetEnumerators::P2OTEC, PV3DBase< T, PVType, FrameType >::phi(), FreeTrajectoryState::position(), edm::ESHandle< T >::product(), gsfElectronCkfTrackCandidateMaker_cff::propagatorAlong, propagatorName_, gsfElectronCkfTrackCandidateMaker_cff::propagatorOpposite, edm::Event::put(), mps_fire::result, SetPropagationDirection(), mathSSE::sqrt(), src_, theCategory, tsosDiff_, and useHitLessSeeds_.

53  {
55  unsigned int numOfMaxSeeds = numOfMaxSeedsParam_;
56  unsigned int numSeedsMade=0;
57  bool analysedL2 = false;
58  bool foundHitlessSeed = false;
59  unsigned int layerCount = 0;
60 
61 
64 
66  edm::Handle<MeasurementTrackerEvent> measurementTrackerH;
69  edm::ESHandle<Propagator> propagatorAlongH;
70  edm::ESHandle<Propagator> propagatorOppositeH;
71  edm::ESHandle<TrackerGeometry> tmpTkGeometryH;
73 
74  iSetup.get<IdealMagneticFieldRecord>().get(magfieldH);
75  iSetup.get<TrackingComponentsRecord>().get(propagatorName_, propagatorOppositeH);
76  iSetup.get<TrackingComponentsRecord>().get(propagatorName_, propagatorAlongH);
77  iSetup.get<GlobalTrackingGeometryRecord>().get(geometryH);
78  iSetup.get<TrackerDigiGeometryRecord>().get(tmpTkGeometryH);
79  iSetup.get<TrackingComponentsRecord>().get(estimatorName_,estimatorH);
80  iEvent.getByToken(measurementTrackerTag_, measurementTrackerH);
81 
84  iEvent.getByToken(src_, l2TrackCol);
85 
86  // The product:
87  std::unique_ptr<std::vector<TrajectorySeed> > result(new std::vector<TrajectorySeed>());
88 
89  // Get vector of Detector layers once:
90  std::vector<BarrelDetLayer const*> const& tob = measurementTrackerH->geometricSearchTracker()->tobLayers();
91  std::vector<ForwardDetLayer const*> const& tecPositive = tmpTkGeometryH->isThere(GeomDetEnumerators::P2OTEC) ?
92  measurementTrackerH->geometricSearchTracker()->posTidLayers() :
93  measurementTrackerH->geometricSearchTracker()->posTecLayers();
94  std::vector<ForwardDetLayer const*> const& tecNegative = tmpTkGeometryH->isThere(GeomDetEnumerators::P2OTEC) ?
95  measurementTrackerH->geometricSearchTracker()->negTidLayers() :
96  measurementTrackerH->geometricSearchTracker()->negTecLayers();
97  edm::ESHandle<TrackerTopology> tTopo_handle;
98  iSetup.get<TrackerTopologyRcd>().get(tTopo_handle);
99  const TrackerTopology* tTopo = tTopo_handle.product();
100 
101  // Get the suitable propagators:
102  std::unique_ptr<Propagator> propagatorAlong = SetPropagationDirection(*propagatorAlongH,alongMomentum);
103  std::unique_ptr<Propagator> propagatorOpposite = SetPropagationDirection(*propagatorOppositeH,oppositeToMomentum);
104 
105  edm::ESHandle<Propagator> SmartOpposite;
106  edm::ESHandle<Propagator> SHPOpposite;
107  iSetup.get<TrackingComponentsRecord>().get("hltESPSmartPropagatorAnyOpposite", SmartOpposite);
108  iSetup.get<TrackingComponentsRecord>().get("hltESPSteppingHelixPropagatorOpposite", SHPOpposite);
109 
110  // Loop over the L2's and make seeds for all of them:
111  LogTrace(theCategory) << "TSGForOI::produce: Number of L2's: " << l2TrackCol->size();
112  for (unsigned int l2TrackColIndex(0);l2TrackColIndex!=l2TrackCol->size();++l2TrackColIndex){
113  const reco::TrackRef l2(l2TrackCol, l2TrackColIndex);
114  std::unique_ptr<std::vector<TrajectorySeed> > out(new std::vector<TrajectorySeed>());
115  LogTrace("TSGForOI") << "TSGForOI::produce: L2 muon pT, eta, phi --> " << l2->pt() << " , " << l2->eta() << " , " << l2->phi() << endl;
116 
118  dummyPlane->move(fts.position() - dummyPlane->position());
119  TrajectoryStateOnSurface tsosAtIP = TrajectoryStateOnSurface(fts, *dummyPlane);
120  LogTrace("TSGForOI") << "TSGForOI::produce: Created TSOSatIP: " << tsosAtIP << std::endl;
121 
122  // get the TSOS on the innermost layer of the L2.
123  TrajectoryStateOnSurface tsosAtMuonSystem = trajectoryStateTransform::innerStateOnSurface(*l2, *geometryH, magfieldH.product());
124  LogTrace("TSGForOI") << "TSGForOI::produce: Created TSOSatMuonSystem: " << tsosAtMuonSystem <<endl;
125 
126  if (useHitLessSeeds_){
127  LogTrace("TSGForOI") << "TSGForOI::produce: Check the error of the L2 parameter and use hit seeds if big errors" << endl;
128  StateOnTrackerBound fromInside(propagatorAlong.get());
129  TrajectoryStateOnSurface outerTkStateInside = fromInside(fts);
130 
131  StateOnTrackerBound fromOutside(&*SmartOpposite);
132  TrajectoryStateOnSurface outerTkStateOutside = fromOutside(tsosAtMuonSystem);
133 
134  // for now only checking if the two positions (using updated and not-updated) agree withing certain extent,
135  // will probably have to design something fancier for the future.
136  auto dist=0.0;
137  if (outerTkStateInside.isValid() && outerTkStateOutside.isValid()){
138  float deta = outerTkStateInside.globalPosition().eta() - outerTkStateOutside.globalPosition().eta();
139  float dphi = outerTkStateInside.globalPosition().phi() - outerTkStateOutside.globalPosition().phi();
140  dist = sqrt(deta*deta+dphi*dphi);
141  }
142  if (dist>tsosDiff_){
143  ++numOfMaxSeeds; // add a hit-based seed
144  }
145  }
146 
147  numSeedsMade=0;
148  analysedL2 = false;
149  foundHitlessSeed = false;
150 
151  // BARREL
152  if (std::abs(l2->eta()) < maxEtaForTOB_) {
153  layerCount = 0;
154  for (auto it=tob.rbegin(); it!=tob.rend(); ++it) { //This goes from outermost to innermost layer
155  LogTrace("TSGForOI") << "TSGForOI::produce: looping in TOB layer " << layerCount << endl;
156  findSeedsOnLayer(tTopo, **it, tsosAtIP, *(propagatorAlong.get()), *(propagatorOpposite.get()), l2,
157  estimatorH, measurementTrackerH, numSeedsMade, numOfMaxSeeds, layerCount, foundHitlessSeed, analysedL2, out);
158  }
159  }
160 
161  // Reset Number of seeds if in overlap region:
162  if (std::abs(l2->eta())>minEtaForTEC_ && std::abs(l2->eta())<maxEtaForTOB_){
163  numSeedsMade=0;
164  }
165 
166  // ENDCAP+
167  if (l2->eta() > minEtaForTEC_) {
168  layerCount = 0;
169  for (auto it=tecPositive.rbegin(); it!=tecPositive.rend(); ++it) {
170  LogTrace("TSGForOI") << "TSGForOI::produce: looping in TEC+ layer " << layerCount << endl;
171  findSeedsOnLayer(tTopo, **it, tsosAtIP, *(propagatorAlong.get()), *(propagatorOpposite.get()), l2,
172  estimatorH, measurementTrackerH, numSeedsMade, numOfMaxSeeds, layerCount, foundHitlessSeed, analysedL2, out);
173  }
174  }
175 
176  // ENDCAP-
177  if (l2->eta() < -minEtaForTEC_) {
178  layerCount = 0;
179  for (auto it=tecNegative.rbegin(); it!=tecNegative.rend(); ++it) {
180  LogTrace("TSGForOI") << "TSGForOI::produce: looping in TEC- layer " << layerCount << endl;
181  findSeedsOnLayer(tTopo, **it, tsosAtIP, *(propagatorAlong.get()), *(propagatorOpposite.get()), l2,
182  estimatorH, measurementTrackerH, numSeedsMade, numOfMaxSeeds, layerCount, foundHitlessSeed, analysedL2, out);
183  }
184  }
185 
186  for (std::vector<TrajectorySeed>::iterator it=out->begin(); it!=out->end(); ++it){
187  result->push_back(*it);
188  }
189  } //L2Collection
190  edm::LogInfo(theCategory) << "TSGForOI::produce: number of seeds made: " << result->size();
191 
192  iEvent.put(std::move(result));
193 }
const std::string estimatorName_
Estimator used to find dets and TrajectoryMeasurements.
Definition: TSGForOI.h:61
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
const double tsosDiff_
Distance of TSOSs to trigger using hits or not.
Definition: TSGForOI.h:87
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
const std::string propagatorName_
Counters and flags for the implementation.
Definition: TSGForOI.h:90
GlobalPoint globalPosition() const
const double maxEtaForTOB_
Maximum eta value to activate searching in the TOB.
Definition: TSGForOI.h:67
bool isThere(GeomDetEnumerators::SubDetector subdet) const
std::unique_ptr< Propagator > SetPropagationDirection(Propagator const &iprop, PropagationDirection dir)
const double minEtaForTEC_
Minimum eta value to activate searching in the TEC.
Definition: TSGForOI.h:64
T sqrt(T t)
Definition: SSEVec.h:18
static PlanePointer build(Args &&...args)
Definition: Plane.h:33
const bool useHitLessSeeds_
Definition: TSGForOI.h:71
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void findSeedsOnLayer(const TrackerTopology *tTopo, const GeometricSearchDet &layer, const TrajectoryStateOnSurface &tsosAtIP, const Propagator &propagatorAlong, const Propagator &propagatorOpposite, const reco::TrackRef l2, edm::ESHandle< Chi2MeasurementEstimatorBase > &estimator_, edm::Handle< MeasurementTrackerEvent > &measurementTrackerH, unsigned int &numSeedsMade, unsigned int &numOfMaxSeeds, unsigned int &layerCount, bool &foundHitlessSeed, bool &analysedL2, std::unique_ptr< std::vector< TrajectorySeed > > &out) const
Function to find seeds on a given layer.
Definition: TSGForOI.cc:195
#define LogTrace(id)
GlobalPoint position() const
const T & get() const
Definition: EventSetup.h:55
const edm::EDGetTokenT< reco::TrackCollection > src_
Labels for input collections.
Definition: TSGForOI.h:41
T eta() const
Definition: PV3DBase.h:76
const edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrackerTag_
Definition: TSGForOI.h:79
const unsigned int numOfMaxSeedsParam_
Maximum number of seeds for each L2.
Definition: TSGForOI.h:44
const std::string theCategory
Definition: TSGForOI.h:91
FreeTrajectoryState initialFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:510
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)

Member Data Documentation

const bool TSGForOI::adjustErrorsDynamicallyForHitless_
private

Definition at line 58 of file TSGForOI.h.

Referenced by findSeedsOnLayer().

const bool TSGForOI::adjustErrorsDynamicallyForHits_
private

Whether or not to use an automatically calculated scale-factor value.

Definition at line 57 of file TSGForOI.h.

Referenced by findSeedsOnLayer().

const std::string TSGForOI::estimatorName_
private

Estimator used to find dets and TrajectoryMeasurements.

Definition at line 61 of file TSGForOI.h.

Referenced by produce().

const double TSGForOI::eta1_
private

Definition at line 83 of file TSGForOI.h.

Referenced by calculateSFFromL2().

const double TSGForOI::eta2_
private

Definition at line 83 of file TSGForOI.h.

Referenced by calculateSFFromL2().

const double TSGForOI::fixedErrorRescalingForHitless_
private

Definition at line 54 of file TSGForOI.h.

Referenced by findSeedsOnLayer().

const double TSGForOI::fixedErrorRescalingForHits_
private

How much to rescale errors from the L2 (fixed error vs pT, eta)

Definition at line 53 of file TSGForOI.h.

Referenced by findSeedsOnLayer().

const double TSGForOI::maxEtaForTOB_
private

Maximum eta value to activate searching in the TOB.

Definition at line 67 of file TSGForOI.h.

Referenced by produce().

const edm::EDGetTokenT<MeasurementTrackerEvent> TSGForOI::measurementTrackerTag_
private

Definition at line 79 of file TSGForOI.h.

Referenced by produce().

const double TSGForOI::minEtaForTEC_
private

Minimum eta value to activate searching in the TEC.

Definition at line 64 of file TSGForOI.h.

Referenced by produce().

const unsigned int TSGForOI::numOfHitsToTry_
private

How many hits to try per layer.

Definition at line 50 of file TSGForOI.h.

Referenced by makeSeedsFromHits().

const unsigned int TSGForOI::numOfLayersToTry_
private

How many layers to try.

Definition at line 47 of file TSGForOI.h.

Referenced by findSeedsOnLayer().

const unsigned int TSGForOI::numOfMaxSeedsParam_
private

Maximum number of seeds for each L2.

Definition at line 44 of file TSGForOI.h.

Referenced by produce().

const std::string TSGForOI::propagatorName_
private

Counters and flags for the implementation.

Definition at line 90 of file TSGForOI.h.

Referenced by produce().

const double TSGForOI::pT1_
private

pT, eta ranges and scale factor values

Definition at line 82 of file TSGForOI.h.

Referenced by calculateSFFromL2().

const double TSGForOI::pT2_
private

Definition at line 82 of file TSGForOI.h.

Referenced by calculateSFFromL2().

const double TSGForOI::pT3_
private

Definition at line 82 of file TSGForOI.h.

Referenced by calculateSFFromL2().

const double TSGForOI::SF1_
private

Definition at line 84 of file TSGForOI.h.

Referenced by calculateSFFromL2().

const double TSGForOI::SF2_
private

Definition at line 84 of file TSGForOI.h.

Referenced by calculateSFFromL2().

const double TSGForOI::SF3_
private

Definition at line 84 of file TSGForOI.h.

Referenced by calculateSFFromL2().

const double TSGForOI::SF4_
private

Definition at line 84 of file TSGForOI.h.

Referenced by calculateSFFromL2().

const double TSGForOI::SF5_
private

Definition at line 84 of file TSGForOI.h.

Referenced by calculateSFFromL2().

const edm::EDGetTokenT<reco::TrackCollection> TSGForOI::src_
private

Labels for input collections.

Definition at line 41 of file TSGForOI.h.

Referenced by produce().

const std::string TSGForOI::theCategory
private

Definition at line 91 of file TSGForOI.h.

Referenced by calculateSFFromL2(), findSeedsOnLayer(), and produce().

const double TSGForOI::tsosDiff_
private

Distance of TSOSs to trigger using hits or not.

Definition at line 87 of file TSGForOI.h.

Referenced by produce().

const std::unique_ptr<TrajectoryStateUpdator> TSGForOI::updator_
private

KFUpdator defined in constructor.

Definition at line 77 of file TSGForOI.h.

Referenced by makeSeedsFromHits().

const bool TSGForOI::useHitLessSeeds_
private

Switch ON (True) : use additional hits for seeds depending on the L2 properties (ignores numOfMaxSeeds_) Switch OFF (False): the numOfMaxSeeds_ defines if we will use hitless (numOfMaxSeeds_==1) or hitless+hits (numOfMaxSeeds_>1)

Definition at line 71 of file TSGForOI.h.

Referenced by findSeedsOnLayer(), and produce().

const bool TSGForOI::useStereoLayersInTEC_
private

Switch ON to use Stereo layers instead of using every layer in TEC.

Definition at line 74 of file TSGForOI.h.

Referenced by makeSeedsFromHits().