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.
4 
6 using namespace ctfseeding;
7 
8 
10  edm::LogInfo("CtfSpecialSeedGenerator|BeamHaloPairGenerator") << "Constructing BeamHaloPairGenerator";
11  theMaxTheta=conf.getParameter<double>("maxTheta");
12  theMaxTheta=fabs(sin(theMaxTheta));
13 }
14 
15 
17  edm::ParameterSet leyerPSet = conf_.getParameter<edm::ParameterSet>("LayerPSet");
18  SeedingLayerSetsBuilder lsBuilder(leyerPSet);
19  SeedingLayerSets lss = lsBuilder.layers(es);
20  return lss;
21 }
22 
23 
25  const edm::Event& e,
26  const edm::EventSetup& es){
27  hitPairs.clear();
28  SeedingLayerSets lss = init(es);
29  SeedingLayerSets::const_iterator iLss;
30  for (iLss = lss.begin(); iLss != lss.end(); iLss++){
31  SeedingLayers ls = *iLss;
32  if (ls.size() != 2){
33  throw cms::Exception("CtfSpecialSeedGenerator") << "You are using " << ls.size() <<" layers in set instead of 2 ";
34  }
35  std::vector<SeedingHit> innerHits = region.hits(e, es, &ls[0]);
36  std::vector<SeedingHit> outerHits = region.hits(e, es, &ls[1]);
37  std::vector<SeedingHit>::const_iterator iOuterHit;
38  for (iOuterHit = outerHits.begin(); iOuterHit != outerHits.end(); iOuterHit++){
39  std::vector<SeedingHit>::const_iterator iInnerHit;
40  for (iInnerHit = innerHits.begin(); iInnerHit != innerHits.end(); iInnerHit++){
41  //do something in there... if necessary
42  const TransientTrackingRecHit::ConstRecHitPointer & crhpi = *iInnerHit;
43  const TransientTrackingRecHit::ConstRecHitPointer & crhpo = *iOuterHit;
44  GlobalVector d=crhpo->globalPosition() - crhpi->globalPosition();
45  double ABSsinDtheta = fabs(sin(d.theta()));
46  LogDebug("BeamHaloPairGenerator")<<"position1: "<<crhpo->globalPosition()
47  <<" position2: "<<crhpi->globalPosition()
48  <<" |sin(Dtheta)|: "<< ABSsinDtheta <<((ABSsinDtheta>theMaxTheta)?" skip":" keep");
49 
50  if (ABSsinDtheta>theMaxTheta) {;continue;}
51 
52  hitPairs.push_back(OrderedHitPair(*iInnerHit,
53  *iOuterHit));
54  }
55  }
56  }
57  return hitPairs;
58 }
#define LogDebug(id)
T getParameter(std::string const &) const
virtual Hits hits(const edm::Event &ev, const edm::EventSetup &es, const ctfseeding::SeedingLayer *layer) const =0
get hits from layer compatible with region constraints
virtual const OrderedSeedingHits & run(const TrackingRegion &region, const edm::Event &ev, const edm::EventSetup &es)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
BeamHaloPairGenerator(const edm::ParameterSet &conf)
ctfseeding::SeedingLayerSets init(const edm::EventSetup &es)
Geom::Theta< T > theta() const
Definition: PV3DBase.h:69
tuple conf
Definition: dbtoconf.py:185
TransientTrackingRecHit::ConstRecHitPointer SeedingHit
std::vector< SeedingLayer > SeedingLayers
std::vector< std::vector< SeedingLayer > > SeedingLayerSets