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")),
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"))
44 produces<std::vector<TrajectorySeed> >();
65 std::unique_ptr<std::vector<TrajectorySeed> >
result(
new std::vector<TrajectorySeed>());
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();
83 for (
unsigned int l2TrackColIndex(0);l2TrackColIndex!=l2TrackCol->size();++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;
91 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: Created TSOSatIP: " << tsosAtIP << std::endl;
95 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: Created TSOSatMuonSystem: " << tsosAtMuonSystem <<endl;
98 LogTrace(
"TSGForOI") <<
"TSGForOI::produce: Check the error of the L2 parameter and use hit seeds if big errors" << endl;
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);
125 for (
auto it=tob.rbegin(); it!=tob.rend(); ++it) {
127 findSeedsOnLayer(**it, tsosAtIP, *(propagatorAlong.get()), *(propagatorOpposite.get()), l2, out);
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);
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);
154 for (std::vector<TrajectorySeed>::iterator it=out->begin(); it!=out->end(); ++it){
155 result->push_back(*it);
168 std::unique_ptr<std::vector<TrajectorySeed> >&
out) {
173 double errorSFHits_=1.0;
174 double errorSFHitless_=1.0;
180 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: Start hitless" << endl;
181 std::vector< GeometricSearchDet::DetWithState > dets;
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()){
197 dets.front().second.rescaleError(errorSFHitless_);
201 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: TSOD (Hitless) done " << endl;
211 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: Start Hits" <<endl;
222 double abseta =
std::abs(track->eta());
224 if (track->pt()>
pT1_ && track->pt()<=
pT2_){
229 if (track->pt()>
pT2_ && track->pt()<=
pT3_){
236 LogTrace(
theCategory) <<
"TSGForOI::calculateSFFromL2: SF has been calculated as: " << theSF;
243 std::vector<TrajectorySeed> &
out,
246 const double errorSF) {
252 std::vector< GeometricSearchDet::DetWithState > dets;
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) {
263 if (!it->second.isValid())
continue;
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);
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;
276 for (std::vector<TrajectoryMeasurement>::const_iterator it=meas.begin(); it!=meas.end(); ++it) {
278 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: TSOS for TM " << found << endl;
279 if (not updatedTSOS.
isValid())
continue;
283 DetId detid = ((*it).recHit()->hit())->geographicalId();
286 if (!myDet.isStereo())
break;
291 seedHits.
push_back(*it->recHit()->hit());
294 LogTrace(
"TSGForOI") <<
"TSGForOI::findSeedsOnLayer: number of seedHits: " << seedHits.
size() << endl;
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);
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);
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);
double calculateSFFromL2(const reco::TrackRef track)
Function used to calculate the dynamic error SF by analysing the L2.
const std::string estimatorName_
Estimator used to find dets and TrajectoryMeasurements.
TkRotation< Scalar > RotationType
void rescaleError(double factor)
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
std::unique_ptr< TrajectoryStateUpdator > updator_
KFUpdator defined in constructor.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
edm::ESHandle< Propagator > propagatorAlong_
const double tsosDiff_
Distance of TSOSs to trigger using hits or not.
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.
Geom::Phi< T > phi() const
std::vector< Track > TrackCollection
collection of Tracks
GlobalPoint globalPosition() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::ESHandle< MagneticField > magfield_
const double maxEtaForTOB_
Maximum eta value to activate searching in the TOB.
uint32_t rawId() const
get the raw id
Point3DBase< Scalar, GlobalTag > PositionType
std::unique_ptr< Propagator > SetPropagationDirection(Propagator const &iprop, PropagationDirection dir)
unsigned int numSeedsMade_
const double minEtaForTEC_
Minimum eta value to activate searching in the TEC.
const double fixedErrorRescalingForHits_
How much to rescale errors from the L2 (fixed error vs pT, eta)
std::vector< TrajectoryMeasurement > fastMeasurements(const TrajectoryStateOnSurface &stateOnThisDet, const TrajectoryStateOnSurface &tsos2, const Propagator &prop, const MeasurementEstimator &est) const
const bool useHitLessSeeds_
const unsigned int numOfLayersToTry_
How many layers to try.
Abs< T >::type abs(const T &t)
const bool useStereoLayersInTEC_
Switch ON to use Stereo layers instead of using every layer in TEC.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
Create L3MuonTrajectorySeeds from L2 Muons updated at vertex in an outside in manner.
const bool adjustErrorsDynamicallyForHitless_
unsigned int numOfMaxSeeds_
Maximum number of seeds for each L2.
const double pT1_
pT, eta ranges and scale factor values
GlobalPoint position() const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const edm::EDGetTokenT< reco::TrackCollection > src_
Labels for input collections.
edm::ESHandle< Chi2MeasurementEstimatorBase > estimator_
bool analysedL2_
Counters and flags for the implementation.
const bool adjustErrorsDynamicallyForHits_
Whether or not to use an automatically calculated scale-factor value.
Plane::PlanePointer dummyPlane_
Surface used to make a TSOS at the PCA to the beamline.
edm::ESHandle< Propagator > propagatorOpposite_
TSGForOI(const edm::ParameterSet &iConfig)
const edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrackerTag_
edm::ESHandle< GlobalTrackingGeometry > geometry_
T const * product() const
virtual void compatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const
edm::Handle< MeasurementTrackerEvent > measurementTracker_
const unsigned int numOfHitsToTry_
How many hits to try per layer.
const double fixedErrorRescalingForHitless_
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.