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::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 TSGForOI (const edm::ParameterSet &iConfig)
 
virtual ~TSGForOI ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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 & itemsToGetFromEvent () 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::stream::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)
 Function used to calculate the dynamic error SF by analysing the L2. More...
 
void findSeedsOnLayer (const GeometricSearchDet &layer, const TrajectoryStateOnSurface &tsosAtIP, const Propagator &propagatorAlong, const Propagator &propagatorOpposite, const reco::TrackRef l2, std::unique_ptr< std::vector< TrajectorySeed > > &seeds)
 Function to find seeds on a given layer. More...
 
int makeSeedsFromHits (const GeometricSearchDet &layer, const TrajectoryStateOnSurface &state, std::vector< TrajectorySeed > &out, const Propagator &propagatorAlong, const MeasurementTrackerEvent &mte, double errorSF)
 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...
 
bool analysedL2_
 Counters and flags for the implementation. More...
 
Plane::PlanePointer dummyPlane_
 Surface used to make a TSOS at the PCA to the beamline. More...
 
edm::ESHandle< Chi2MeasurementEstimatorBaseestimator_
 
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...
 
bool foundHitlessSeed_
 
edm::ESHandle< GlobalTrackingGeometrygeometry_
 
unsigned int layerCount_
 
edm::ESHandle< MagneticFieldmagfield_
 
const double maxEtaForTOB_
 Maximum eta value to activate searching in the TOB. More...
 
edm::Handle< MeasurementTrackerEventmeasurementTracker_
 
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...
 
unsigned int numOfMaxSeeds_
 Maximum number of seeds for each L2. More...
 
unsigned int numSeedsMade_
 
edm::ESHandle< PropagatorpropagatorAlong_
 
edm::ESHandle< PropagatorpropagatorOpposite_
 
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...
 
std::string theCategory
 
const double tsosDiff_
 Distance of TSOSs to trigger using hits or not. More...
 
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::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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.

References edm::ParameterSet::getParameter(), numOfMaxSeeds_, numSeedsMade_, and theCategory.

15  :
16  src_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("src"))),
17  numOfLayersToTry_(iConfig.getParameter<int32_t>("layersToTry")),
18  numOfHitsToTry_(iConfig.getParameter<int32_t>("hitsToTry")),
19  fixedErrorRescalingForHits_(iConfig.getParameter<double>("fixedErrorRescaleFactorForHits")),
20  fixedErrorRescalingForHitless_(iConfig.getParameter<double>("fixedErrorRescaleFactorForHitless")),
21  adjustErrorsDynamicallyForHits_(iConfig.getParameter<bool>("adjustErrorsDynamicallyForHits")),
22  adjustErrorsDynamicallyForHitless_(iConfig.getParameter<bool>("adjustErrorsDynamicallyForHitless")),
23  estimatorName_(iConfig.getParameter<std::string>("estimator")),
24  minEtaForTEC_(iConfig.getParameter<double>("minEtaForTEC")),
25  maxEtaForTOB_(iConfig.getParameter<double>("maxEtaForTOB")),
26  useHitLessSeeds_(iConfig.getParameter<bool>("UseHitLessSeeds")),
27  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 {
43  numOfMaxSeeds_=iConfig.getParameter<uint32_t>("maxSeeds");
44  produces<std::vector<TrajectorySeed> >();
45  numSeedsMade_=0;
46  theCategory = "Muon|RecoMuon|TSGForOI";
47 }
const std::string estimatorName_
Estimator used to find dets and TrajectoryMeasurements.
Definition: TSGForOI.h:61
T getParameter(std::string const &) const
std::unique_ptr< TrajectoryStateUpdator > updator_
KFUpdator defined in constructor.
Definition: TSGForOI.h:80
const double tsosDiff_
Distance of TSOSs to trigger using hits or not.
Definition: TSGForOI.h:90
const double SF3_
Definition: TSGForOI.h:87
const double maxEtaForTOB_
Maximum eta value to activate searching in the TOB.
Definition: TSGForOI.h:67
unsigned int numSeedsMade_
Definition: TSGForOI.h:95
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 double eta2_
Definition: TSGForOI.h:86
static PlanePointer build(Args &&...args)
Definition: Plane.h:33
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:87
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:87
const bool adjustErrorsDynamicallyForHitless_
Definition: TSGForOI.h:58
unsigned int numOfMaxSeeds_
Maximum number of seeds for each L2.
Definition: TSGForOI.h:44
const double pT1_
pT, eta ranges and scale factor values
Definition: TSGForOI.h:85
const double SF4_
Definition: TSGForOI.h:87
const double pT2_
Definition: TSGForOI.h:85
const double eta1_
Definition: TSGForOI.h:86
const double pT3_
Definition: TSGForOI.h:85
std::string theCategory
Definition: TSGForOI.h:98
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
Plane::PlanePointer dummyPlane_
Surface used to make a TSOS at the PCA to the beamline.
Definition: TSGForOI.h:77
const edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrackerTag_
Definition: TSGForOI.h:82
const double SF2_
Definition: TSGForOI.h:87
const unsigned int numOfHitsToTry_
How many hits to try per layer.
Definition: TSGForOI.h:50
const double fixedErrorRescalingForHitless_
Definition: TSGForOI.h:54
TSGForOI::~TSGForOI ( )
virtual

Definition at line 50 of file TSGForOI.cc.

50  {
51 }

Member Function Documentation

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

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

Definition at line 216 of file TSGForOI.cc.

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

Referenced by findSeedsOnLayer().

216  {
217 
218  double theSF=1.0;
219  // L2 direction vs pT blowup - as was previously done:
220  // Split into 4 pT ranges: <pT1_, pT1_<pT2_, pT2_<pT3_, <pT4_: 13,30,70
221  // Split into 2 eta ranges for the middle two pT ranges: 1.0,1.4
222  double abseta = std::abs(track->eta());
223  if (track->pt()<=pT1_) theSF=SF1_;
224  if (track->pt()>pT1_ && track->pt()<=pT2_){
225  if (abseta<=eta1_) theSF=SF3_;
226  if (abseta>eta1_ && abseta<=eta2_) theSF=SF2_;
227  if (abseta>eta2_) theSF=SF3_;
228  }
229  if (track->pt()>pT2_ && track->pt()<=pT3_){
230  if (abseta<=eta1_) theSF=SF5_;
231  if (abseta>eta1_ && abseta<=eta2_) theSF=SF4_;
232  if (abseta>eta2_) theSF=SF5_;
233  }
234  if (track->pt()>pT3_) theSF=SF5_;
235 
236  LogTrace(theCategory) << "TSGForOI::calculateSFFromL2: SF has been calculated as: " << theSF;
237  return theSF;
238 }
const double SF3_
Definition: TSGForOI.h:87
const double eta2_
Definition: TSGForOI.h:86
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const double SF1_
Definition: TSGForOI.h:87
const double SF5_
Definition: TSGForOI.h:87
#define LogTrace(id)
const double pT1_
pT, eta ranges and scale factor values
Definition: TSGForOI.h:85
const double SF4_
Definition: TSGForOI.h:87
const double pT2_
Definition: TSGForOI.h:85
const double eta1_
Definition: TSGForOI.h:86
const double pT3_
Definition: TSGForOI.h:85
std::string theCategory
Definition: TSGForOI.h:98
const double SF2_
Definition: TSGForOI.h:87
void TSGForOI::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 303 of file TSGForOI.cc.

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

303  {
305  desc.add<edm::InputTag>("src",edm::InputTag("hltL2Muons","UpdatedAtVtx"));
306  desc.add<int>("layersToTry",1);
307  desc.add<double>("fixedErrorRescaleFactorForHitless",2.0);
308  desc.add<int>("hitsToTry",1);
309  desc.add<bool>("adjustErrorsDynamicallyForHits",false);
310  desc.add<bool>("adjustErrorsDynamicallyForHitless",false);
311  desc.add<edm::InputTag>("MeasurementTrackerEvent",edm::InputTag("hltSiStripClusters"));
312  desc.add<bool>("UseHitLessSeeds",true);
313  desc.add<bool>("UseStereoLayersInTEC",false);
314  desc.add<std::string>("estimator","hltESPChi2MeasurementEstimator100");
315  desc.add<double>("maxEtaForTOB",1.2);
316  desc.add<double>("minEtaForTEC",0.8);
317  desc.addUntracked<bool>("debug",true);
318  desc.add<double>("fixedErrorRescaleFactorForHits",2.0);
319  desc.add<unsigned int>("maxSeeds",1);
320  desc.add<double>("pT1",13.0);
321  desc.add<double>("pT2",30.0);
322  desc.add<double>("pT3",70.0);
323  desc.add<double>("eta1",1.0);
324  desc.add<double>("eta2",1.4);
325  desc.add<double>("SF1",3.0);
326  desc.add<double>("SF2",4.0);
327  desc.add<double>("SF3",5.0);
328  desc.add<double>("SF4",7.0);
329  desc.add<double>("SF5",10.0);
330  desc.add<double>("tsosDiff",0.03);
331  descriptions.add("TSGForOI",desc);
332 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void TSGForOI::findSeedsOnLayer ( const GeometricSearchDet layer,
const TrajectoryStateOnSurface tsosAtIP,
const Propagator propagatorAlong,
const Propagator propagatorOpposite,
const reco::TrackRef  l2,
std::unique_ptr< std::vector< TrajectorySeed > > &  seeds 
)
private

Function to find seeds on a given layer.

Definition at line 163 of file TSGForOI.cc.

References adjustErrorsDynamicallyForHitless_, adjustErrorsDynamicallyForHits_, analysedL2_, calculateSFFromL2(), GeometricSearchDet::compatibleDetsV(), estimator_, fixedErrorRescalingForHitless_, fixedErrorRescalingForHits_, foundHitlessSeed_, layerCount_, LogTrace, makeSeedsFromHits(), measurementTracker_, numOfLayersToTry_, numOfMaxSeeds_, numSeedsMade_, oppositeToMomentum, MillePedeFileConverter_cfg::out, trajectoryStateTransform::persistentState(), theCategory, and useHitLessSeeds_.

Referenced by produce().

168  {
169 
170  if (numSeedsMade_>numOfMaxSeeds_) return;
171  LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: numSeedsMade = " << numSeedsMade_ << " , layerCount = " << layerCount_ << endl;
172 
173  double errorSFHits_=1.0;
174  double errorSFHitless_=1.0;
177 
178  // Hitless:
180  LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: Start hitless" << endl;
181  std::vector< GeometricSearchDet::DetWithState > dets;
182  layer.compatibleDetsV(tsosAtIP, propagatorAlong, *estimator_, dets);
183  if (dets.size()>0) {
184  auto const& detOnLayer = dets.front().first;
185  auto const& tsosOnLayer = dets.front().second;
186  LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: tsosOnLayer " << tsosOnLayer << endl;
187  if (!tsosOnLayer.isValid()){
188  edm::LogInfo(theCategory) << "ERROR!: Hitless TSOS is not valid!";
189  }
190  else{
191  // calculate SF from L2 (only once -- if needed)
193  errorSFHitless_=calculateSFFromL2(l2);
194  analysedL2_=true;
195  }
196 
197  dets.front().second.rescaleError(errorSFHitless_);
198  PTrajectoryStateOnDet const& ptsod = trajectoryStateTransform::persistentState(tsosOnLayer,detOnLayer->geographicalId().rawId());
200  out->push_back(TrajectorySeed(ptsod,rHC,oppositeToMomentum));
201  LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: TSOD (Hitless) done " << endl;
202  foundHitlessSeed_=true;
203  }
204  numSeedsMade_=out->size();
205  }
206  }
207  // numSeedsMade_=out->size();
208 
209  // Hits:
210  if (layerCount_>numOfLayersToTry_) return;
211  LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: Start Hits" <<endl;
212  if (makeSeedsFromHits(layer, tsosAtIP, *out, propagatorAlong, *measurementTracker_, errorSFHits_)) ++layerCount_;
213  numSeedsMade_=out->size();
214 }
double calculateSFFromL2(const reco::TrackRef track)
Function used to calculate the dynamic error SF by analysing the L2.
Definition: TSGForOI.cc:216
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
unsigned int numSeedsMade_
Definition: TSGForOI.h:95
unsigned int layerCount_
Definition: TSGForOI.h:96
const double fixedErrorRescalingForHits_
How much to rescale errors from the L2 (fixed error vs pT, eta)
Definition: TSGForOI.h:53
bool foundHitlessSeed_
Definition: TSGForOI.h:94
const bool useHitLessSeeds_
Definition: TSGForOI.h:71
const unsigned int numOfLayersToTry_
How many layers to try.
Definition: TSGForOI.h:47
#define LogTrace(id)
const bool adjustErrorsDynamicallyForHitless_
Definition: TSGForOI.h:58
unsigned int numOfMaxSeeds_
Maximum number of seeds for each L2.
Definition: TSGForOI.h:44
std::string theCategory
Definition: TSGForOI.h:98
edm::ESHandle< Chi2MeasurementEstimatorBase > estimator_
Definition: TSGForOI.h:104
bool analysedL2_
Counters and flags for the implementation.
Definition: TSGForOI.h:93
const bool adjustErrorsDynamicallyForHits_
Whether or not to use an automatically calculated scale-factor value.
Definition: TSGForOI.h:57
virtual void compatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const
edm::Handle< MeasurementTrackerEvent > measurementTracker_
Definition: TSGForOI.h:103
const double fixedErrorRescalingForHitless_
Definition: TSGForOI.h:54
int makeSeedsFromHits(const GeometricSearchDet &layer, const TrajectoryStateOnSurface &state, std::vector< TrajectorySeed > &out, const Propagator &propagatorAlong, const MeasurementTrackerEvent &mte, double errorSF)
Function to find hits on layers and create seeds from updated TSOS.
Definition: TSGForOI.cc:241
int TSGForOI::makeSeedsFromHits ( const GeometricSearchDet layer,
const TrajectoryStateOnSurface state,
std::vector< TrajectorySeed > &  out,
const Propagator propagatorAlong,
const MeasurementTrackerEvent mte,
double  errorSF 
)
private

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

Definition at line 241 of file TSGForOI.cc.

References GeometricSearchDet::compatibleDetsV(), estimator_, 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, updator_, and useStereoLayersInTEC_.

Referenced by findSeedsOnLayer().

246  {
247 
248  // Error Rescaling:
249  TrajectoryStateOnSurface onLayer(tsosAtIP);
250  onLayer.rescaleError(errorSF);
251 
252  std::vector< GeometricSearchDet::DetWithState > dets;
253  layer.compatibleDetsV(onLayer, propagatorAlong, *estimator_, dets);
254 
255  // Find Measurements on each DetWithState:
256  LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: find measurements on each detWithState " << dets.size() << endl;
257  std::vector<TrajectoryMeasurement> meas;
258  for (std::vector<GeometricSearchDet::DetWithState>::iterator it=dets.begin(); it!=dets.end(); ++it) {
259  MeasurementDetWithData det = measurementTracker.idToDet(it->first->geographicalId());
260  if (det.isNull()) {
261  continue;
262  }
263  if (!it->second.isValid()) continue; //Skip if TSOS is not valid
264 
265  std::vector < TrajectoryMeasurement > mymeas = det.fastMeasurements(it->second, onLayer, propagatorAlong, *estimator_); //Second TSOS is not used
266  for (std::vector<TrajectoryMeasurement>::const_iterator it2 = mymeas.begin(), ed2 = mymeas.end(); it2 != ed2; ++it2) {
267  if (it2->recHit()->isValid()) meas.push_back(*it2); //Only save those which are valid
268  }
269  }
270 
271 
272  // Update TSOS using TMs after sorting, then create Trajectory Seed and put into vector:
273  LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: Update TSOS using TMs after sorting, then create Trajectory Seed, number of TM = " << meas.size() << endl;
274  unsigned int found = 0;
275  std::sort(meas.begin(), meas.end(), TrajMeasLessEstim());
276  for (std::vector<TrajectoryMeasurement>::const_iterator it=meas.begin(); it!=meas.end(); ++it) {
277  TrajectoryStateOnSurface updatedTSOS = updator_->update(it->forwardPredictedState(), *it->recHit());
278  LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: TSOS for TM " << found << endl;
279  if (not updatedTSOS.isValid()) continue;
280 
281  // CHECK if is StereoLayer:
282  if (useStereoLayersInTEC_) {
283  DetId detid = ((*it).recHit()->hit())->geographicalId();
284  if (detid.subdetId() == StripSubdetector::TEC) {
285  TECDetId myDet(detid.rawId());
286  if (!myDet.isStereo()) break; //try another Layer
287  }
288  }
289 
291  seedHits.push_back(*it->recHit()->hit());
292  PTrajectoryStateOnDet const& pstate = trajectoryStateTransform::persistentState(updatedTSOS, it->recHit()->geographicalId().rawId());
293  TrajectorySeed seed(pstate, std::move(seedHits), oppositeToMomentum);
294  LogTrace("TSGForOI") << "TSGForOI::findSeedsOnLayer: number of seedHits: " << seedHits.size() << endl;
295  out.push_back(seed);
296  found++;
297  if (found == numOfHitsToTry_) break;
298  }
299  return found;
300 }
std::unique_ptr< TrajectoryStateUpdator > updator_
KFUpdator defined in constructor.
Definition: TSGForOI.h:80
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
void push_back(D *&d)
Definition: OwnVector.h:290
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
edm::ESHandle< Chi2MeasurementEstimatorBase > estimator_
Definition: TSGForOI.h:104
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::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Definition at line 54 of file TSGForOI.cc.

References funct::abs(), alongMomentum, analysedL2_, dummyPlane_, estimator_, estimatorName_, PV3DBase< T, PVType, FrameType >::eta(), findSeedsOnLayer(), foundHitlessSeed_, geometry_, edm::EventSetup::get(), edm::Event::getByToken(), TrajectoryStateOnSurface::globalPosition(), trajectoryStateTransform::initialFreeState(), trajectoryStateTransform::innerStateOnSurface(), TrajectoryStateOnSurface::isValid(), layerCount_, LogTrace, magfield_, maxEtaForTOB_, measurementTracker_, measurementTrackerTag_, minEtaForTEC_, eostools::move(), numOfMaxSeeds_, numSeedsMade_, oppositeToMomentum, MillePedeFileConverter_cfg::out, PV3DBase< T, PVType, FrameType >::phi(), FreeTrajectoryState::position(), edm::ESHandle< T >::product(), gsfElectronCkfTrackCandidateMaker_cff::propagatorAlong, propagatorAlong_, gsfElectronCkfTrackCandidateMaker_cff::propagatorOpposite, propagatorOpposite_, edm::Event::put(), mps_fire::result, SetPropagationDirection(), mathSSE::sqrt(), src_, theCategory, tsosDiff_, and useHitLessSeeds_.

54  {
55  iSetup.get<IdealMagneticFieldRecord>().get(magfield_);
56  iSetup.get<TrackingComponentsRecord>().get("PropagatorWithMaterial", propagatorOpposite_);
57  iSetup.get<TrackingComponentsRecord>().get("PropagatorWithMaterial", propagatorAlong_);
62  iEvent.getByToken(src_, l2TrackCol);
63 
64  // The product:
65  std::unique_ptr<std::vector<TrajectorySeed> > result(new std::vector<TrajectorySeed>());
66 
67  // Get vector of Detector layers once:
68  std::vector<BarrelDetLayer const*> const& tob = measurementTracker_->geometricSearchTracker()->tobLayers();
69  std::vector<ForwardDetLayer const*> const& tecPositive = measurementTracker_->geometricSearchTracker()->posTecLayers();
70  std::vector<ForwardDetLayer const*> const& tecNegative = measurementTracker_->geometricSearchTracker()->negTecLayers();
71 
72  // Get the suitable propagators:
75 
76  edm::ESHandle<Propagator> SmartOpposite;
77  edm::ESHandle<Propagator> SHPOpposite;
78  iSetup.get<TrackingComponentsRecord>().get("hltESPSmartPropagatorAnyOpposite", SmartOpposite);
79  iSetup.get<TrackingComponentsRecord>().get("hltESPSteppingHelixPropagatorOpposite", SHPOpposite);
80 
81  // Loop over the L2's and make seeds for all of them:
82  LogTrace(theCategory) << "TSGForOI::produce: Number of L2's: " << l2TrackCol->size();
83  for (unsigned int l2TrackColIndex(0);l2TrackColIndex!=l2TrackCol->size();++l2TrackColIndex){
84  const reco::TrackRef l2(l2TrackCol, l2TrackColIndex);
85  std::unique_ptr<std::vector<TrajectorySeed> > out(new std::vector<TrajectorySeed>());
86  LogTrace("TSGForOI") << "TSGForOI::produce: L2 muon pT, eta, phi --> " << l2->pt() << " , " << l2->eta() << " , " << l2->phi() << endl;
87 
89  dummyPlane_->move(fts.position() - dummyPlane_->position());
91  LogTrace("TSGForOI") << "TSGForOI::produce: Created TSOSatIP: " << tsosAtIP << std::endl;
92 
93  // get the TSOS on the innermost layer of the L2.
95  LogTrace("TSGForOI") << "TSGForOI::produce: Created TSOSatMuonSystem: " << tsosAtMuonSystem <<endl;
96 
97  if (useHitLessSeeds_){ //
98  LogTrace("TSGForOI") << "TSGForOI::produce: Check the error of the L2 parameter and use hit seeds if big errors" << endl;
99  StateOnTrackerBound fromInside(propagatorAlong.get());
100  TrajectoryStateOnSurface outerTkStateInside = fromInside(fts);
101 
102  StateOnTrackerBound fromOutside(&*SmartOpposite);
103  TrajectoryStateOnSurface outerTkStateOutside = fromOutside(tsosAtMuonSystem);
104 
105  // for now only checking if the two positions (using updated and not-updated) agree withing certain extent,
106  // will probably have to design something fancier for the future.
107  auto dist=0.0;
108  if (outerTkStateInside.isValid() && outerTkStateOutside.isValid()){
109  float deta = outerTkStateInside.globalPosition().eta() - outerTkStateOutside.globalPosition().eta();
110  float dphi = outerTkStateInside.globalPosition().phi() - outerTkStateOutside.globalPosition().phi();
111  dist = sqrt(deta*deta+dphi*dphi);
112  }
113  if (dist>tsosDiff_){
114  ++numOfMaxSeeds_; // add a hit-based seed
115  }
116  }
117 
118  numSeedsMade_=0;
119  analysedL2_ = false;
120  foundHitlessSeed_ = false;
121 
122  // BARREL
123  if (std::abs(l2->eta()) < maxEtaForTOB_) {
124  layerCount_ = 0;
125  for (auto it=tob.rbegin(); it!=tob.rend(); ++it) { //This goes from outermost to innermost layer
126  LogTrace("TSGForOI") << "TSGForOI::produce: looping in TOB layer " << layerCount_ << endl;
127  findSeedsOnLayer(**it, tsosAtIP, *(propagatorAlong.get()), *(propagatorOpposite.get()), l2, out);
128  }
129  }
130 
131  // Reset Number of seeds if in overlap region:
132  if (std::abs(l2->eta())>minEtaForTEC_ && std::abs(l2->eta())<maxEtaForTOB_){
133  numSeedsMade_=0;
134  }
135 
136  // ENDCAP+
137  if (l2->eta() > minEtaForTEC_) {
138  layerCount_ = 0;
139  for (auto it=tecPositive.rbegin(); it!=tecPositive.rend(); ++it) {
140  LogTrace("TSGForOI") << "TSGForOI::produce: looping in TEC+ layer " << layerCount_ << endl;
141  findSeedsOnLayer(**it, tsosAtIP, *(propagatorAlong.get()), *(propagatorOpposite.get()), l2, out);
142  }
143  }
144 
145  // ENDCAP-
146  if (l2->eta() < -minEtaForTEC_) {
147  layerCount_ = 0;
148  for (auto it=tecNegative.rbegin(); it!=tecNegative.rend(); ++it) {
149  LogTrace("TSGForOI") << "TSGForOI::produce: looping in TEC- layer " << layerCount_ << endl;
150  findSeedsOnLayer(**it, tsosAtIP, *(propagatorAlong.get()), *(propagatorOpposite.get()), l2, out);
151  }
152  }
153 
154  for (std::vector<TrajectorySeed>::iterator it=out->begin(); it!=out->end(); ++it){
155  result->push_back(*it);
156  }
157  } //L2Collection
158  edm::LogInfo(theCategory) << "TSGForOI::produce: number of seeds made: " << result->size();
159 
160  iEvent.put(std::move(result));
161 }
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:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
edm::ESHandle< Propagator > propagatorAlong_
Definition: TSGForOI.h:100
const double tsosDiff_
Distance of TSOSs to trigger using hits or not.
Definition: TSGForOI.h:90
void findSeedsOnLayer(const GeometricSearchDet &layer, const TrajectoryStateOnSurface &tsosAtIP, const Propagator &propagatorAlong, const Propagator &propagatorOpposite, const reco::TrackRef l2, std::unique_ptr< std::vector< TrajectorySeed > > &seeds)
Function to find seeds on a given layer.
Definition: TSGForOI.cc:163
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
GlobalPoint globalPosition() const
edm::ESHandle< MagneticField > magfield_
Definition: TSGForOI.h:99
const double maxEtaForTOB_
Maximum eta value to activate searching in the TOB.
Definition: TSGForOI.h:67
std::unique_ptr< Propagator > SetPropagationDirection(Propagator const &iprop, PropagationDirection dir)
unsigned int numSeedsMade_
Definition: TSGForOI.h:95
const double minEtaForTEC_
Minimum eta value to activate searching in the TEC.
Definition: TSGForOI.h:64
unsigned int layerCount_
Definition: TSGForOI.h:96
bool foundHitlessSeed_
Definition: TSGForOI.h:94
T sqrt(T t)
Definition: SSEVec.h:18
const bool useHitLessSeeds_
Definition: TSGForOI.h:71
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define LogTrace(id)
unsigned int numOfMaxSeeds_
Maximum number of seeds for each L2.
Definition: TSGForOI.h:44
GlobalPoint position() const
const T & get() const
Definition: EventSetup.h:56
std::string theCategory
Definition: TSGForOI.h:98
const edm::EDGetTokenT< reco::TrackCollection > src_
Labels for input collections.
Definition: TSGForOI.h:41
edm::ESHandle< Chi2MeasurementEstimatorBase > estimator_
Definition: TSGForOI.h:104
bool analysedL2_
Counters and flags for the implementation.
Definition: TSGForOI.h:93
T eta() const
Definition: PV3DBase.h:76
Plane::PlanePointer dummyPlane_
Surface used to make a TSOS at the PCA to the beamline.
Definition: TSGForOI.h:77
edm::ESHandle< Propagator > propagatorOpposite_
Definition: TSGForOI.h:101
const edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrackerTag_
Definition: TSGForOI.h:82
edm::ESHandle< GlobalTrackingGeometry > geometry_
Definition: TSGForOI.h:102
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
edm::Handle< MeasurementTrackerEvent > measurementTracker_
Definition: TSGForOI.h:103
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().

bool TSGForOI::analysedL2_
private

Counters and flags for the implementation.

Definition at line 93 of file TSGForOI.h.

Referenced by findSeedsOnLayer(), and produce().

Plane::PlanePointer TSGForOI::dummyPlane_
private

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

Definition at line 77 of file TSGForOI.h.

Referenced by produce().

edm::ESHandle<Chi2MeasurementEstimatorBase> TSGForOI::estimator_
private

Definition at line 104 of file TSGForOI.h.

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

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 86 of file TSGForOI.h.

Referenced by calculateSFFromL2().

const double TSGForOI::eta2_
private

Definition at line 86 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().

bool TSGForOI::foundHitlessSeed_
private

Definition at line 94 of file TSGForOI.h.

Referenced by findSeedsOnLayer(), and produce().

edm::ESHandle<GlobalTrackingGeometry> TSGForOI::geometry_
private

Definition at line 102 of file TSGForOI.h.

Referenced by produce().

unsigned int TSGForOI::layerCount_
private

Definition at line 96 of file TSGForOI.h.

Referenced by findSeedsOnLayer(), and produce().

edm::ESHandle<MagneticField> TSGForOI::magfield_
private

Definition at line 99 of file TSGForOI.h.

Referenced by produce().

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().

edm::Handle<MeasurementTrackerEvent> TSGForOI::measurementTracker_
private

Definition at line 103 of file TSGForOI.h.

Referenced by findSeedsOnLayer(), and produce().

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

Definition at line 82 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().

unsigned int TSGForOI::numOfMaxSeeds_
private

Maximum number of seeds for each L2.

Definition at line 44 of file TSGForOI.h.

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

unsigned int TSGForOI::numSeedsMade_
private

Definition at line 95 of file TSGForOI.h.

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

edm::ESHandle<Propagator> TSGForOI::propagatorAlong_
private

Definition at line 100 of file TSGForOI.h.

Referenced by produce().

edm::ESHandle<Propagator> TSGForOI::propagatorOpposite_
private

Definition at line 101 of file TSGForOI.h.

Referenced by produce().

const double TSGForOI::pT1_
private

pT, eta ranges and scale factor values

Definition at line 85 of file TSGForOI.h.

Referenced by calculateSFFromL2().

const double TSGForOI::pT2_
private

Definition at line 85 of file TSGForOI.h.

Referenced by calculateSFFromL2().

const double TSGForOI::pT3_
private

Definition at line 85 of file TSGForOI.h.

Referenced by calculateSFFromL2().

const double TSGForOI::SF1_
private

Definition at line 87 of file TSGForOI.h.

Referenced by calculateSFFromL2().

const double TSGForOI::SF2_
private

Definition at line 87 of file TSGForOI.h.

Referenced by calculateSFFromL2().

const double TSGForOI::SF3_
private

Definition at line 87 of file TSGForOI.h.

Referenced by calculateSFFromL2().

const double TSGForOI::SF4_
private

Definition at line 87 of file TSGForOI.h.

Referenced by calculateSFFromL2().

const double TSGForOI::SF5_
private

Definition at line 87 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().

std::string TSGForOI::theCategory
private

Definition at line 98 of file TSGForOI.h.

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

const double TSGForOI::tsosDiff_
private

Distance of TSOSs to trigger using hits or not.

Definition at line 90 of file TSGForOI.h.

Referenced by produce().

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

KFUpdator defined in constructor.

Definition at line 80 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().