CMS 3D CMS Logo

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