CMS 3D CMS Logo

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

#include <CtfSpecialSeedGenerator.h>

Inheritance diagram for CtfSpecialSeedGenerator:
edm::stream::EDProducer<>

Public Types

typedef TrajectoryStateOnSurface TSOS
 
- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Public Member Functions

void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 CtfSpecialSeedGenerator (const edm::ParameterSet &conf)
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ~CtfSpecialSeedGenerator () override=default
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

bool buildSeeds (const edm::EventSetup &iSetup, const edm::Event &e, const OrderedSeedingHits &osh, const NavigationDirection &navdir, const PropagationDirection &dir, TrajectorySeedCollection &output)
 
bool postCheck (const TrajectorySeed &seed)
 
bool preliminaryCheck (const SeedingHitSet &shs, const edm::EventSetup &es)
 
bool run (const edm::EventSetup &c, const edm::Event &e, TrajectorySeedCollection &output)
 

Private Attributes

ClusterChecker check
 
edm::ParameterSet conf_
 
BoundPlane::BoundPlanePointer lowerScintillator
 
bool requireBOFF
 
edm::ESHandle< TransientTrackingRecHitBuildertheBuilder
 
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecordtheBuilderToken
 
std::vector< std::unique_ptr< OrderedHitsGenerator > > theGenerators
 
edm::ESHandle< MagneticFieldtheMagfield
 
int32_t theMaxSeeds
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordtheMFToken
 
std::vector< NavigationDirectiontheNavDirs
 
const edm::ESGetToken< Propagator, TrackingComponentsRecordthePropAlongToken
 
std::vector< PropagationDirectionthePropDirs
 
const edm::ESGetToken< Propagator, TrackingComponentsRecordthePropOppositeToken
 
std::unique_ptr< TrackingRegionProducertheRegionProducer
 
std::unique_ptr< SeedFromGenericPairOrTriplettheSeedBuilder
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtheTopoToken
 
edm::ESHandle< TrackerGeometrytheTracker
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtheTrackerToken
 
BoundPlane::BoundPlanePointer upperScintillator
 
bool useScintillatorsConstraint
 

Detailed Description

Definition at line 42 of file CtfSpecialSeedGenerator.h.

Member Typedef Documentation

◆ TSOS

Definition at line 44 of file CtfSpecialSeedGenerator.h.

Constructor & Destructor Documentation

◆ CtfSpecialSeedGenerator()

CtfSpecialSeedGenerator::CtfSpecialSeedGenerator ( const edm::ParameterSet conf)

Definition at line 16 of file CtfSpecialSeedGenerator.cc.

References conf_, beamerCreator::create(), get, edm::ParameterSet::getParameter(), AlCaHLTBitMon_QueryRunRegistry::string, theGenerators, theRegionProducer, and useScintillatorsConstraint.

17  : conf_(conf),
18  theMFToken(esConsumes<edm::Transition::BeginRun>()),
20  esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", conf_.getParameter<std::string>("TTRHBuilder")))),
21  theTrackerToken(esConsumes<edm::Transition::BeginRun>()),
22  thePropAlongToken(esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", "PropagatorWithMaterial"))),
24  esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", "PropagatorWithMaterialOpposite"))),
26  requireBOFF(conf.getParameter<bool>("requireBOFF")),
27  theMaxSeeds(conf.getParameter<int32_t>("maxSeeds")),
28  check(conf, consumesCollector())
29 
30 {
31  useScintillatorsConstraint = conf_.getParameter<bool>("UseScintillatorsConstraint");
32  edm::LogVerbatim("CtfSpecialSeedGenerator") << "Constructing CtfSpecialSeedGenerator";
33  produces<TrajectorySeedCollection>();
34 
35  edm::ParameterSet regfactoryPSet = conf_.getParameter<edm::ParameterSet>("RegionFactoryPSet");
36  std::string regfactoryName = regfactoryPSet.getParameter<std::string>("ComponentName");
37  theRegionProducer = std::unique_ptr<TrackingRegionProducer>{
38  TrackingRegionProducerFactory::get()->create(regfactoryName, regfactoryPSet, consumesCollector())};
39 
40  std::vector<edm::ParameterSet> pSets = conf_.getParameter<std::vector<edm::ParameterSet>>("OrderedHitsFactoryPSets");
41  std::vector<edm::ParameterSet>::const_iterator iPSet;
42  edm::ConsumesCollector iC = consumesCollector();
43  for (iPSet = pSets.begin(); iPSet != pSets.end(); iPSet++) {
44  std::string hitsfactoryName = iPSet->getParameter<std::string>("ComponentName");
45  theGenerators.emplace_back(OrderedHitsGeneratorFactory::get()->create(hitsfactoryName, *iPSet, iC));
46  }
47 }
Log< level::Info, true > LogVerbatim
std::unique_ptr< TrackingRegionProducer > theRegionProducer
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
def create(alignables, pedeDump, additionalData, outputFile, config)
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > theBuilderToken
const edm::ESGetToken< Propagator, TrackingComponentsRecord > thePropOppositeToken
const edm::ESGetToken< Propagator, TrackingComponentsRecord > thePropAlongToken
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > theTrackerToken
#define get
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > theTopoToken
std::vector< std::unique_ptr< OrderedHitsGenerator > > theGenerators
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > theMFToken

◆ ~CtfSpecialSeedGenerator()

CtfSpecialSeedGenerator::~CtfSpecialSeedGenerator ( )
overridedefault

Member Function Documentation

◆ beginRun()

void CtfSpecialSeedGenerator::beginRun ( edm::Run const &  ,
edm::EventSetup const &  iSetup 
)
override

Definition at line 51 of file CtfSpecialSeedGenerator.cc.

References alongMomentum, newFWLiteAna::build, CosmicGenFilterHelix_cfi::charges, conf_, edm::EventSetup::getHandle(), edm::ParameterSet::getParameter(), insideOut, lowerScintillator, oppositeToMomentum, outsideIn, AlCaHLTBitMon_ParallelJobs::p, edm::ESHandle< T >::product(), makeMuonMisalignmentScenario::rot, AlCaHLTBitMon_QueryRunRegistry::string, theBuilder, theBuilderToken, theMagfield, theMFToken, theNavDirs, thePropAlongToken, thePropDirs, thePropOppositeToken, theSeedBuilder, theTracker, theTrackerToken, upperScintillator, useScintillatorsConstraint, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

51  {
52  theMagfield = iSetup.getHandle(theMFToken);
53  theBuilder = iSetup.getHandle(theBuilderToken);
54  theTracker = iSetup.getHandle(theTrackerToken);
55 
56  edm::LogVerbatim("CtfSpecialSeedGenerator") << "Initializing...";
58  edm::ParameterSet upperScintPar = conf_.getParameter<edm::ParameterSet>("UpperScintillatorParameters");
59  edm::ParameterSet lowerScintPar = conf_.getParameter<edm::ParameterSet>("LowerScintillatorParameters");
60  RectangularPlaneBounds upperBounds(
61  upperScintPar.getParameter<double>("WidthInX"), upperScintPar.getParameter<double>("LenghtInZ"), 1);
62  GlobalPoint upperPosition(upperScintPar.getParameter<double>("GlobalX"),
63  upperScintPar.getParameter<double>("GlobalY"),
64  upperScintPar.getParameter<double>("GlobalZ"));
65  edm::LogVerbatim("CtfSpecialSeedGenerator") << "Upper Scintillator position x, y, z " << upperPosition.x() << ", "
66  << upperPosition.y() << ", " << upperPosition.z();
67  RectangularPlaneBounds lowerBounds(
68  lowerScintPar.getParameter<double>("WidthInX"), lowerScintPar.getParameter<double>("LenghtInZ"), 1);
69  GlobalPoint lowerPosition(lowerScintPar.getParameter<double>("GlobalX"),
70  lowerScintPar.getParameter<double>("GlobalY"),
71  lowerScintPar.getParameter<double>("GlobalZ"));
72  edm::LogVerbatim("CtfSpecialSeedGenerator") << "Lower Scintillator position x, y, z " << lowerPosition.x() << ", "
73  << lowerPosition.y() << ", " << lowerPosition.z();
74  TkRotation<float> rot(1, 0, 0, 0, 0, 1, 0, 1, 0);
75  upperScintillator = BoundPlane::build(upperPosition, rot, &upperBounds);
76  lowerScintillator = BoundPlane::build(lowerPosition, rot, &lowerBounds);
77  }
78 
79  edm::ESHandle<Propagator> propagatorAlongHandle = iSetup.getHandle(thePropAlongToken);
80  edm::ESHandle<Propagator> propagatorOppositeHandle = iSetup.getHandle(thePropOppositeToken);
81 
82  std::vector<edm::ParameterSet> pSets = conf_.getParameter<std::vector<edm::ParameterSet>>("OrderedHitsFactoryPSets");
83  std::vector<edm::ParameterSet>::const_iterator iPSet;
84  for (iPSet = pSets.begin(); iPSet != pSets.end(); iPSet++) {
85  std::string propagationDirection = iPSet->getParameter<std::string>("PropagationDirection");
86  if (propagationDirection == "alongMomentum")
87  thePropDirs.push_back(alongMomentum);
88  else
90  std::string navigationDirection = iPSet->getParameter<std::string>("NavigationDirection");
91  if (navigationDirection == "insideOut")
92  theNavDirs.push_back(insideOut);
93  else
94  theNavDirs.push_back(outsideIn);
95  edm::LogVerbatim("CtfSpecialSeedGenerator") << "hitsGenerator done";
96  }
97  bool setMomentum = conf_.getParameter<bool>("SetMomentum");
98  std::vector<int> charges;
99  if (setMomentum) {
100  charges = conf_.getParameter<std::vector<int>>("Charges");
101  }
102  theSeedBuilder = std::make_unique<SeedFromGenericPairOrTriplet>(theMagfield.product(),
105  propagatorAlongHandle.product(),
106  propagatorOppositeHandle.product(),
107  charges,
108  setMomentum,
109  conf_.getParameter<double>("ErrorRescaling"));
110  double p = 1;
111  if (setMomentum) {
112  p = conf_.getParameter<double>("SeedMomentum");
113  theSeedBuilder->setMomentumTo(p);
114  }
115 }
Log< level::Info, true > LogVerbatim
std::unique_ptr< SeedFromGenericPairOrTriplet > theSeedBuilder
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
BoundPlane::BoundPlanePointer lowerScintillator
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > theBuilderToken
const edm::ESGetToken< Propagator, TrackingComponentsRecord > thePropOppositeToken
BoundPlane::BoundPlanePointer upperScintillator
T const * product() const
Definition: ESHandle.h:86
const edm::ESGetToken< Propagator, TrackingComponentsRecord > thePropAlongToken
edm::ESHandle< MagneticField > theMagfield
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > theTrackerToken
edm::ESHandle< TrackerGeometry > theTracker
edm::ESHandle< TransientTrackingRecHitBuilder > theBuilder
charges
only generated particles of these IDs are considered
std::vector< NavigationDirection > theNavDirs
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > theMFToken
std::vector< PropagationDirection > thePropDirs

◆ buildSeeds()

bool CtfSpecialSeedGenerator::buildSeeds ( const edm::EventSetup iSetup,
const edm::Event e,
const OrderedSeedingHits osh,
const NavigationDirection navdir,
const PropagationDirection dir,
TrajectorySeedCollection output 
)
private

Definition at line 157 of file CtfSpecialSeedGenerator.cc.

References DeadROC_duringRun::dir, mps_fire::i, postCheck(), preliminaryCheck(), HLT_2024v14_cff::seeds, OrderedSeedingHits::size(), theMaxSeeds, and theSeedBuilder.

Referenced by run().

162  {
163  //SeedFromGenericPairOrTriplet seedBuilder(conf_, magfield.product(), tracker.product(), theBuilder.product());
164  edm::LogInfo("CtfSpecialSeedGenerator") << "osh.size() " << osh.size();
165  for (unsigned int i = 0; i < osh.size(); i++) {
166  const SeedingHitSet& shs = osh[i];
167  if (preliminaryCheck(shs, iSetup)) {
168  std::vector<TrajectorySeed*> seeds = theSeedBuilder->seed(shs, dir, navdir, iSetup);
169  for (std::vector<TrajectorySeed*>::const_iterator iSeed = seeds.begin(); iSeed != seeds.end(); iSeed++) {
170  if (!*iSeed) {
171  edm::LogError("CtfSpecialSeedGenerator") << "a seed pointer is null. skipping.";
172  continue;
173  }
174  if (postCheck(**iSeed)) {
175  output.push_back(**iSeed);
176  }
177  delete *iSeed;
178  edm::LogVerbatim("CtfSpecialSeedGenerator") << "Seed built";
179  }
180  }
181  }
182  if ((theMaxSeeds > 0) && (output.size() > size_t(theMaxSeeds))) {
183  edm::LogWarning("TooManySeeds") << "Too many seeds (" << output.size() << "), bailing out.\n";
184  output.clear();
185  return false;
186  }
187  return true;
188 }
Log< level::Info, true > LogVerbatim
std::unique_ptr< SeedFromGenericPairOrTriplet > theSeedBuilder
virtual unsigned int size() const =0
Log< level::Error, false > LogError
Log< level::Info, false > LogInfo
bool preliminaryCheck(const SeedingHitSet &shs, const edm::EventSetup &es)
bool postCheck(const TrajectorySeed &seed)
Definition: output.py:1
Log< level::Warning, false > LogWarning

◆ endRun()

void CtfSpecialSeedGenerator::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
override

Definition at line 49 of file CtfSpecialSeedGenerator.cc.

References theSeedBuilder.

49 { theSeedBuilder.reset(); }
std::unique_ptr< SeedFromGenericPairOrTriplet > theSeedBuilder

◆ fillDescriptions()

void CtfSpecialSeedGenerator::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 278 of file CtfSpecialSeedGenerator.cc.

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, ClusterChecker::fillDescriptions(), edm::ParameterSetDescription::setAllowAnything(), edm::ParameterDescriptionNode::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

278  {
280 
281  // Top-level parameters
282  desc.add<double>("SeedMomentum", 5.0);
283  desc.add<double>("ErrorRescaling", 50.0);
284  desc.add<bool>("UseScintillatorsConstraint", true);
285  desc.add<std::string>("TTRHBuilder", "WithTrackAngle");
286  desc.add<bool>("SeedsFromPositiveY", true);
287  desc.add<bool>("SeedsFromNegativeY", false);
288  desc.add<bool>("CheckHitsAreOnDifferentLayers", false);
289  desc.add<bool>("SetMomentum", true);
290  desc.add<bool>("requireBOFF", false);
291  desc.add<int32_t>("maxSeeds", 10000);
292 
293  // call the cluster checker to insert directly the configuration
295 
296  // Vector parameters
297  desc.add<std::vector<int>>("Charges", {-1});
298 
299  // RegionFactoryPSet (nested PSet)
300  {
301  edm::ParameterSetDescription ps_RegionFactoryPSet;
302  ps_RegionFactoryPSet.add<std::string>("ComponentName", "GlobalRegionProducer");
303 
304  edm::ParameterSetDescription ps_RegionPSet;
305  ps_RegionPSet.setAllowAnything();
306  ps_RegionFactoryPSet.add("RegionPSet", ps_RegionPSet)->setComment("");
307  desc.add<edm::ParameterSetDescription>("RegionFactoryPSet", ps_RegionFactoryPSet);
308  }
309 
310  // UpperScintillatorParameters (nested PSet)
311  {
312  edm::ParameterSetDescription ps_UpperScintillatorParameters;
313  ps_UpperScintillatorParameters.add<double>("LenghtInZ", 100.0);
314  ps_UpperScintillatorParameters.add<double>("GlobalX", 0.0);
315  ps_UpperScintillatorParameters.add<double>("GlobalY", 300.0);
316  ps_UpperScintillatorParameters.add<double>("GlobalZ", 50.0);
317  ps_UpperScintillatorParameters.add<double>("WidthInX", 100.0);
318  desc.add<edm::ParameterSetDescription>("UpperScintillatorParameters", ps_UpperScintillatorParameters);
319  }
320 
321  // LowerScintillatorParameters (nested PSet)
322  {
323  edm::ParameterSetDescription ps_LowerScintillatorParameters;
324  ps_LowerScintillatorParameters.add<double>("LenghtInZ", 100.0);
325  ps_LowerScintillatorParameters.add<double>("GlobalX", 0.0);
326  ps_LowerScintillatorParameters.add<double>("GlobalY", -100.0);
327  ps_LowerScintillatorParameters.add<double>("GlobalZ", 50.0);
328  ps_LowerScintillatorParameters.add<double>("WidthInX", 100.0);
329  desc.add<edm::ParameterSetDescription>("LowerScintillatorParameters", ps_LowerScintillatorParameters);
330  }
331 
332  // OrderedHitsFactoryPSets (VPSet)
333  {
334  edm::ParameterSetDescription ps_OrderedHitsFactoryPSet;
335  ps_OrderedHitsFactoryPSet.setAllowAnything();
336  std::vector<edm::ParameterSet> default_OrderedHitsFactoryPSet(1);
337 
338  // Add the VPSet (OrderedHitsFactoryPSets) to the top-level description
339  desc.addVPSet("OrderedHitsFactoryPSets", ps_OrderedHitsFactoryPSet, default_OrderedHitsFactoryPSet);
340  }
341 
342  // Add the top-level description to the descriptions
343  descriptions.addWithDefaultLabel(desc);
344 }
void setComment(std::string const &value)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
void setAllowAnything()
allow any parameter label/value pairs
static void fillDescriptions(edm::ParameterSetDescription &description)
ParameterDescriptionBase * add(U const &iLabel, T const &value)

◆ postCheck()

bool CtfSpecialSeedGenerator::postCheck ( const TrajectorySeed seed)
private

Definition at line 241 of file CtfSpecialSeedGenerator.cc.

References alongMomentum, PTrajectoryStateOnDet::detId(), TrajectoryStateOnSurface::freeState(), TrackerGeometry::idToDet(), lowerScintillator, oppositeToMomentum, StraightLinePlaneCrossing::position(), fileCollector::seed, GeomDet::surface(), theMagfield, theTracker, trajectoryStateTransform::transientState(), upperScintillator, and useScintillatorsConstraint.

Referenced by buildSeeds().

241  {
243  return true;
244 
245  PTrajectoryStateOnDet pstate = seed.startingState();
247  pstate, &(theTracker->idToDet(DetId(pstate.detId()))->surface()), &(*theMagfield));
248  const FreeTrajectoryState* state = theTSOS.freeState();
249  StraightLinePlaneCrossing planeCrossingLower(
251  StraightLinePlaneCrossing planeCrossingUpper(
253  std::pair<bool, StraightLinePlaneCrossing::PositionType> positionUpper =
254  planeCrossingUpper.position(*upperScintillator);
255  std::pair<bool, StraightLinePlaneCrossing::PositionType> positionLower =
256  planeCrossingLower.position(*lowerScintillator);
257  if (!(positionUpper.first && positionLower.first)) {
258  edm::LogVerbatim("CtfSpecialSeedGenerator::checkDirection") << "Scintillator plane not crossed";
259  return false;
260  }
261  LocalPoint positionUpperLocal = upperScintillator->toLocal((GlobalPoint)(positionUpper.second));
262  LocalPoint positionLowerLocal = lowerScintillator->toLocal((GlobalPoint)(positionLower.second));
263  if (upperScintillator->bounds().inside(positionUpperLocal) &&
264  lowerScintillator->bounds().inside(positionLowerLocal)) {
265  edm::LogVerbatim("CtfSpecialSeedGenerator::checkDirection")
266  << "position on Upper scintillator " << positionUpper.second;
267  edm::LogVerbatim("CtfSpecialSeedGenerator::checkDirection")
268  << "position on Lower scintillator " << positionLower.second;
269 
270  return true;
271  }
272  edm::LogVerbatim("CtfSpecialSeedGenerator::checkDirection")
273  << "scintillator not crossed in bounds: position on Upper scintillator " << positionUpper.second
274  << " position on Lower scintillator " << positionLower.second;
275  return false;
276 }
Log< level::Info, true > LogVerbatim
BoundPlane::BoundPlanePointer lowerScintillator
unsigned int detId() const
BoundPlane::BoundPlanePointer upperScintillator
const TrackerGeomDet * idToDet(DetId) const override
Definition: DetId.h:17
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
edm::ESHandle< MagneticField > theMagfield
edm::ESHandle< TrackerGeometry > theTracker
FreeTrajectoryState const * freeState(bool withErrors=true) const

◆ preliminaryCheck()

bool CtfSpecialSeedGenerator::preliminaryCheck ( const SeedingHitSet shs,
const edm::EventSetup es 
)
private

Definition at line 190 of file CtfSpecialSeedGenerator.cc.

References conf_, edm::EventSetup::getHandle(), edm::ParameterSet::getParameter(), nano_mu_digi_cff::layer, TrackerTopology::layer(), nHits, rpcPointValidation_cfi::recHit, SeedingHitSet::size(), theTopoToken, and PV3DBase< T, PVType, FrameType >::y().

Referenced by buildSeeds().

190  {
192 
193  std::vector<std::pair<unsigned int, unsigned int>> vSubdetLayer;
194  //std::vector<std::string> vSeedLayerNames;
195  bool checkHitsAtPositiveY = conf_.getParameter<bool>("SeedsFromPositiveY");
196  //***top-bottom
197  bool checkHitsAtNegativeY = conf_.getParameter<bool>("SeedsFromNegativeY");
198  //***
199  bool checkHitsOnDifferentLayers = conf_.getParameter<bool>("CheckHitsAreOnDifferentLayers");
200  unsigned int nHits = shs.size();
201  for (unsigned int iHit = 0; iHit < nHits; ++iHit) {
202  //hits for the seeds must be at positive y
203  auto trh = shs[iHit];
204  auto recHit = trh;
205  GlobalPoint hitPos = recHit->globalPosition();
206  //GlobalPoint point =
207  // theTracker->idToDet(iHits->geographicalId() )->surface().toGlobal(iHits->localPosition());
208  if (checkHitsAtPositiveY) {
209  if (hitPos.y() < 0)
210  return false;
211  }
212  //***top-bottom
213  if (checkHitsAtNegativeY) {
214  if (hitPos.y() > 0)
215  return false;
216  }
217  //***
218  //std::string name = iHits->seedinglayer().name();
219  //hits for the seeds must be in different layers
220  unsigned int subid = (*trh).geographicalId().subdetId();
221  unsigned int layer = tTopo->layer((*trh).geographicalId());
222  std::vector<std::pair<unsigned int, unsigned int>>::const_iterator iter;
223  //std::vector<std::string>::const_iterator iNames;
224  if (checkHitsOnDifferentLayers) {
225  for (iter = vSubdetLayer.begin(); iter != vSubdetLayer.end(); iter++) {
226  if (iter->first == subid && iter->second == layer)
227  return false;
228  }
229  /*
230  for (iNames = vSeedLayerNames.begin(); iNames != vSeedLayerNames.end(); iNames++){
231  if (*iNames == name) return false;
232  }
233  */
234  }
235  //vSeedLayerNames.push_back(iHits->seedinglayer().name());
236  vSubdetLayer.push_back(std::make_pair(subid, layer));
237  }
238  return true;
239 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
unsigned int layer(const DetId &id) const
T y() const
Definition: PV3DBase.h:60
unsigned int size() const
Definition: SeedingHitSet.h:52
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_t nHits
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > theTopoToken

◆ produce()

void CtfSpecialSeedGenerator::produce ( edm::Event e,
const edm::EventSetup c 
)
override

Definition at line 117 of file CtfSpecialSeedGenerator.cc.

References check, MillePedeFileConverter_cfg::e, MagneticField::inTesla(), PV3DBase< T, PVType, FrameType >::mag(), eostools::move(), convertSQLiteXML::ok, requireBOFF, run(), theMagfield, and ClusterChecker::tooManyClusters().

117  {
118  // get Inputs
119  auto output = std::make_unique<TrajectorySeedCollection>();
120 
121  //check on the number of clusters
122  if (!requireBOFF || (theMagfield->inTesla(GlobalPoint(0, 0, 0)).mag() == 0.00)) {
123  size_t clustsOrZero = check.tooManyClusters(e);
124  if (!clustsOrZero) {
125  bool ok = run(iSetup, e, *output);
126  if (!ok) {
127  } // nothing to do
128  } else
129  edm::LogError("TooManyClusters") << "Found too many clusters (" << clustsOrZero << "), bailing out.\n";
130  }
131 
132  edm::LogVerbatim("CtfSpecialSeedGenerator") << " number of seeds = " << output->size();
133  e.put(std::move(output));
134 }
Log< level::Info, true > LogVerbatim
size_t tooManyClusters(const edm::Event &e) const
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
bool run(const edm::EventSetup &c, const edm::Event &e, TrajectorySeedCollection &output)
Log< level::Error, false > LogError
T mag() const
Definition: PV3DBase.h:64
edm::ESHandle< MagneticField > theMagfield
Definition: output.py:1
def move(src, dest)
Definition: eostools.py:511

◆ run()

bool CtfSpecialSeedGenerator::run ( const edm::EventSetup c,
const edm::Event e,
TrajectorySeedCollection output 
)
private

Definition at line 136 of file CtfSpecialSeedGenerator.cc.

References buildSeeds(), MillePedeFileConverter_cfg::e, mps_fire::i, convertSQLiteXML::ok, convertSQLitetoXML_cfg::output, theGenerators, theNavDirs, thePropDirs, theRegionProducer, and theSeedBuilder.

Referenced by produce().

138  {
139  std::vector<std::unique_ptr<TrackingRegion>> regions = theRegionProducer->regions(e, iSetup);
140  bool ok = true;
141  for (auto iReg = regions.begin(); iReg != regions.end(); iReg++) {
142  if (!theSeedBuilder->momentumFromPSet())
143  theSeedBuilder->setMomentumTo((*iReg)->ptMin());
144  int i = 0;
145  for (auto iGen = theGenerators.begin(); iGen != theGenerators.end(); iGen++) {
146  ok = buildSeeds(iSetup, e, (*iGen)->run(**iReg, e, iSetup), theNavDirs[i], thePropDirs[i], output);
147  i++;
148  if (!ok)
149  break;
150  }
151  if (!ok)
152  break;
153  }
154  return ok;
155 }
std::unique_ptr< SeedFromGenericPairOrTriplet > theSeedBuilder
std::unique_ptr< TrackingRegionProducer > theRegionProducer
bool buildSeeds(const edm::EventSetup &iSetup, const edm::Event &e, const OrderedSeedingHits &osh, const NavigationDirection &navdir, const PropagationDirection &dir, TrajectorySeedCollection &output)
std::vector< NavigationDirection > theNavDirs
std::vector< std::unique_ptr< OrderedHitsGenerator > > theGenerators
std::vector< PropagationDirection > thePropDirs

Member Data Documentation

◆ check

ClusterChecker CtfSpecialSeedGenerator::check
private

Definition at line 102 of file CtfSpecialSeedGenerator.h.

Referenced by produce().

◆ conf_

edm::ParameterSet CtfSpecialSeedGenerator::conf_
private

Definition at line 72 of file CtfSpecialSeedGenerator.h.

Referenced by beginRun(), CtfSpecialSeedGenerator(), and preliminaryCheck().

◆ lowerScintillator

BoundPlane::BoundPlanePointer CtfSpecialSeedGenerator::lowerScintillator
private

Definition at line 99 of file CtfSpecialSeedGenerator.h.

Referenced by beginRun(), and postCheck().

◆ requireBOFF

bool CtfSpecialSeedGenerator::requireBOFF
private

Definition at line 100 of file CtfSpecialSeedGenerator.h.

Referenced by produce().

◆ theBuilder

edm::ESHandle<TransientTrackingRecHitBuilder> CtfSpecialSeedGenerator::theBuilder
private

Definition at line 83 of file CtfSpecialSeedGenerator.h.

Referenced by beginRun().

◆ theBuilderToken

const edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> CtfSpecialSeedGenerator::theBuilderToken
private

Definition at line 75 of file CtfSpecialSeedGenerator.h.

Referenced by beginRun().

◆ theGenerators

std::vector<std::unique_ptr<OrderedHitsGenerator> > CtfSpecialSeedGenerator::theGenerators
private

Definition at line 91 of file CtfSpecialSeedGenerator.h.

Referenced by CtfSpecialSeedGenerator(), and run().

◆ theMagfield

edm::ESHandle<MagneticField> CtfSpecialSeedGenerator::theMagfield
private

Definition at line 81 of file CtfSpecialSeedGenerator.h.

Referenced by beginRun(), postCheck(), and produce().

◆ theMaxSeeds

int32_t CtfSpecialSeedGenerator::theMaxSeeds
private

Definition at line 101 of file CtfSpecialSeedGenerator.h.

Referenced by buildSeeds().

◆ theMFToken

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> CtfSpecialSeedGenerator::theMFToken
private

Definition at line 74 of file CtfSpecialSeedGenerator.h.

Referenced by beginRun().

◆ theNavDirs

std::vector<NavigationDirection> CtfSpecialSeedGenerator::theNavDirs
private

Definition at line 93 of file CtfSpecialSeedGenerator.h.

Referenced by beginRun(), and run().

◆ thePropAlongToken

const edm::ESGetToken<Propagator, TrackingComponentsRecord> CtfSpecialSeedGenerator::thePropAlongToken
private

Definition at line 77 of file CtfSpecialSeedGenerator.h.

Referenced by beginRun().

◆ thePropDirs

std::vector<PropagationDirection> CtfSpecialSeedGenerator::thePropDirs
private

Definition at line 92 of file CtfSpecialSeedGenerator.h.

Referenced by beginRun(), and run().

◆ thePropOppositeToken

const edm::ESGetToken<Propagator, TrackingComponentsRecord> CtfSpecialSeedGenerator::thePropOppositeToken
private

Definition at line 78 of file CtfSpecialSeedGenerator.h.

Referenced by beginRun().

◆ theRegionProducer

std::unique_ptr<TrackingRegionProducer> CtfSpecialSeedGenerator::theRegionProducer
private

Definition at line 94 of file CtfSpecialSeedGenerator.h.

Referenced by CtfSpecialSeedGenerator(), and run().

◆ theSeedBuilder

std::unique_ptr<SeedFromGenericPairOrTriplet> CtfSpecialSeedGenerator::theSeedBuilder
private

Definition at line 96 of file CtfSpecialSeedGenerator.h.

Referenced by beginRun(), buildSeeds(), endRun(), and run().

◆ theTopoToken

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> CtfSpecialSeedGenerator::theTopoToken
private

Definition at line 79 of file CtfSpecialSeedGenerator.h.

Referenced by preliminaryCheck().

◆ theTracker

edm::ESHandle<TrackerGeometry> CtfSpecialSeedGenerator::theTracker
private

Definition at line 82 of file CtfSpecialSeedGenerator.h.

Referenced by beginRun(), and postCheck().

◆ theTrackerToken

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> CtfSpecialSeedGenerator::theTrackerToken
private

Definition at line 76 of file CtfSpecialSeedGenerator.h.

Referenced by beginRun().

◆ upperScintillator

BoundPlane::BoundPlanePointer CtfSpecialSeedGenerator::upperScintillator
private

Definition at line 98 of file CtfSpecialSeedGenerator.h.

Referenced by beginRun(), and postCheck().

◆ useScintillatorsConstraint

bool CtfSpecialSeedGenerator::useScintillatorsConstraint
private

Definition at line 97 of file CtfSpecialSeedGenerator.h.

Referenced by beginRun(), CtfSpecialSeedGenerator(), and postCheck().