CMS 3D CMS Logo

BeamHaloPairGenerator.cc
Go to the documentation of this file.
3 
7 
8 
10  theSeedingLayerToken(iC.consumes<SeedingLayerSetsHits>(conf.getParameter<edm::InputTag>("LayerSrc")))
11 {
12  edm::LogInfo("CtfSpecialSeedGenerator|BeamHaloPairGenerator") << "Constructing BeamHaloPairGenerator";
13  theMaxTheta=conf.getParameter<double>("maxTheta");
14  theMaxTheta=fabs(sin(theMaxTheta));
15 }
16 
17 
19  const edm::Event& e,
20  const edm::EventSetup& es){
21  hitPairs.clear();
23  e.getByToken(theSeedingLayerToken, hlayers);
24  const SeedingLayerSetsHits& layers = *hlayers;
25  if(layers.numberOfLayersInSet() != 2)
26  throw cms::Exception("CtfSpecialSeedGenerator") << "You are using " << layers.numberOfLayersInSet() <<" layers in set instead of 2 ";
28  auto innerHits = region.hits(es, ls[0]);
29  auto outerHits = region.hits(es, ls[1]);
30 
31  for (auto iOuterHit = outerHits.begin(); iOuterHit != outerHits.end(); iOuterHit++){
32  for (auto iInnerHit = innerHits.begin(); iInnerHit != innerHits.end(); iInnerHit++){
33  //do something in there... if necessary
34  SeedingHitSet::ConstRecHitPointer crhpi = &(**iInnerHit);
35  SeedingHitSet::ConstRecHitPointer crhpo = &(**iOuterHit);
36  GlobalVector d=crhpo->globalPosition() - crhpi->globalPosition();
37  double ABSsinDtheta = fabs(sin(d.theta()));
38  LogDebug("BeamHaloPairGenerator")<<"position1: "<<crhpo->globalPosition()
39  <<" position2: "<<crhpi->globalPosition()
40  <<" |sin(Dtheta)|: "<< ABSsinDtheta <<((ABSsinDtheta>theMaxTheta)?" skip":" keep");
41 
42  if (ABSsinDtheta>theMaxTheta) {;continue;}
43 
44  hitPairs.push_back(OrderedHitPair(crhpi,
45  crhpo));
46  }
47  }
48  }
49  return hitPairs;
50 }
#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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
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
const OrderedSeedingHits & run(const TrackingRegion &region, const edm::Event &ev, const edm::EventSetup &es) override
def ls(path, rec=False)
Definition: eostools.py:348
virtual Hits hits(const edm::EventSetup &es, const SeedingLayerSetsHits::SeedingLayer &layer) const =0
get hits from layer compatible with region constraints
HLT enums.
SeedingHitSet::ConstRecHitPointer SeedingHit