CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
BeamHaloPairGenerator.cc
Go to the documentation of this file.
3 
7 
9  : theSeedingLayerToken(iC.consumes<SeedingLayerSetsHits>(conf.getParameter<edm::InputTag>("LayerSrc"))) {
10  edm::LogInfo("CtfSpecialSeedGenerator|BeamHaloPairGenerator") << "Constructing BeamHaloPairGenerator";
11  theMaxTheta = conf.getParameter<double>("maxTheta");
12  theMaxTheta = fabs(sin(theMaxTheta));
13 }
14 
16  const edm::Event& e,
17  const edm::EventSetup& es) {
18  hitPairs.clear();
20  e.getByToken(theSeedingLayerToken, hlayers);
21  const SeedingLayerSetsHits& layers = *hlayers;
22  if (layers.numberOfLayersInSet() != 2)
23  throw cms::Exception("CtfSpecialSeedGenerator")
24  << "You are using " << layers.numberOfLayersInSet() << " layers in set instead of 2 ";
26  auto innerHits = region.hits(ls[0]);
27  auto outerHits = region.hits(ls[1]);
28 
29  for (auto iOuterHit = outerHits.begin(); iOuterHit != outerHits.end(); iOuterHit++) {
30  for (auto iInnerHit = innerHits.begin(); iInnerHit != innerHits.end(); iInnerHit++) {
31  //do something in there... if necessary
32  SeedingHitSet::ConstRecHitPointer crhpi = &(**iInnerHit);
33  SeedingHitSet::ConstRecHitPointer crhpo = &(**iOuterHit);
34  GlobalVector d = crhpo->globalPosition() - crhpi->globalPosition();
35  double ABSsinDtheta = fabs(sin(d.theta()));
36  LogDebug("BeamHaloPairGenerator")
37  << "position1: " << crhpo->globalPosition() << " position2: " << crhpi->globalPosition()
38  << " |sin(Dtheta)|: " << ABSsinDtheta << ((ABSsinDtheta > theMaxTheta) ? " skip" : " keep");
39 
40  if (ABSsinDtheta > theMaxTheta) {
41  continue;
42  }
43 
44  hitPairs.push_back(OrderedHitPair(crhpi, crhpo));
45  }
46  }
47  }
48  return hitPairs;
49 }
unsigned short numberOfLayersInSet() const
Get number of layers in each SeedingLayerSets.
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
def ls
Definition: eostools.py:349
virtual Hits hits(const SeedingLayerSetsHits::SeedingLayer &layer) const =0
get hits from layer compatible with region constraints
BeamHaloPairGenerator(const edm::ParameterSet &conf, edm::ConsumesCollector &iC)
edm::EDGetTokenT< SeedingLayerSetsHits > theSeedingLayerToken
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
tuple d
Definition: ztail.py:151
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:10
const OrderedSeedingHits & run(const TrackingRegion &region, const edm::Event &ev, const edm::EventSetup &es) override
Log< level::Info, false > LogInfo
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
BaseTrackerRecHit const * SeedingHit
#define LogDebug(id)