CMS 3D CMS Logo

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

#include <PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h>

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup)
 
TrajectorySeedCollectiongetTrajectorySeedCollection ()
 
 PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo (const edm::ParameterSet &, edm::ConsumesCollector &&iC)
 
 ~PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo ()
 

Private Types

typedef Regions::const_iterator IR
 
typedef std::vector< std::unique_ptr< TrackingRegion > > Regions
 

Private Member Functions

bool inspect (const TrackingRegion &region)
 
void loop ()
 

Private Attributes

const edm::ParameterSet _conf
 
const edm::EventSetupmyEsetup
 
const edm::EventmyEvent
 
PrintRecoObjects po
 
reco::Vertex primaryVertex
 
edm::ParameterSet QuadCutPSet
 
Regions regions
 
TrajectorySeedCollectionseedCollection
 
std::stringstream ss
 
ClusterChecker theClusterCheck
 
std::unique_ptr< CombinedHitQuadrupletGeneratorForPhotonConversiontheHitsGenerator
 
std::unique_ptr< GlobalTrackingRegionProducerFromBeamSpottheRegionProducer
 
std::unique_ptr< SeedForPhotonConversionFromQuadrupletstheSeedCreator
 
bool theSilentOnClusterCheck
 
edm::EDGetTokenT< reco::VertexCollectiontoken_vertex
 
reco::VertexCollection vertexCollection
 
edm::Handle< reco::VertexCollectionvertexHandle
 

Detailed Description

Definition at line 27 of file PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h.

Member Typedef Documentation

◆ IR

typedef Regions::const_iterator PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::IR
private

◆ Regions

Constructor & Destructor Documentation

◆ PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo()

PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo ( const edm::ParameterSet conf,
edm::ConsumesCollector &&  iC 
)

Definition at line 21 of file PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.cc.

References _conf, edm::ParameterSet::getParameter(), and token_vertex.

23  : _conf(conf),
24  seedCollection(nullptr),
25  theClusterCheck(conf.getParameter<edm::ParameterSet>("ClusterCheckPSet"), iC),
26  QuadCutPSet(conf.getParameter<edm::ParameterSet>("QuadCutPSet")),
28  .getUntrackedParameter<bool>("silentClusterCheck", false)),
30  conf.getParameter<edm::ParameterSet>("OrderedHitsFactoryPSet"), iC)),
33  iC,
34  conf.getParameter<edm::ParameterSet>("SeedComparitorPSet"))),
36  new GlobalTrackingRegionProducerFromBeamSpot(conf.getParameter<edm::ParameterSet>("RegionFactoryPSet"), iC)) {
38 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
std::unique_ptr< CombinedHitQuadrupletGeneratorForPhotonConversion > theHitsGenerator
T getUntrackedParameter(std::string const &, T const &) const

◆ ~PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo()

PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::~PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo ( )

Definition at line 40 of file PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.cc.

40  {
41 }

Member Function Documentation

◆ analyze()

void PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::analyze ( const edm::Event event,
const edm::EventSetup setup 
)

Definition at line 43 of file PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.cc.

References _conf, gather_cfg::cout, edmPickEvents::event, edm::ParameterSet::getParameter(), edm::HandleBase::isValid(), loop(), myEsetup, myEvent, po, PrintRecoObjects::print(), regions, seedCollection, singleTopDQM_cfi::setup, ss, theClusterCheck, theRegionProducer, theSilentOnClusterCheck, token_vertex, ClusterChecker::tooManyClusters(), and vertexHandle.

44  {
45  myEsetup = &setup;
46  myEvent = &event;
47 
48  if (seedCollection != nullptr)
49  delete seedCollection;
50 
52 
53  size_t clustsOrZero = theClusterCheck.tooManyClusters(event);
54  if (clustsOrZero) {
56  edm::LogError("TooManyClusters") << "Found too many clusters (" << clustsOrZero << "), bailing out.\n";
57  return;
58  }
59 
60  // Why is the regions variable (and theRegionProducer) needed at all?
61  regions = theRegionProducer->regions(event, setup);
62 
63  event.getByToken(token_vertex, vertexHandle);
64  if (!vertexHandle.isValid()) {
65  edm::LogError("PhotonConversionFinderFromTracks")
66  << "Error! Can't get the product primary Vertex Collection "
67  << _conf.getParameter<edm::InputTag>("primaryVerticesTag") << "\n";
68  return;
69  }
70 
71  //Do the analysis
72  loop();
73 
74 #ifdef mydebug_knuenz
75  std::cout << "Running PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo" << std::endl;
76 #endif
77 
78 #ifdef debugTSPFSLA
79  std::stringstream ss;
80  ss.str("");
81  ss << "\n++++++++++++++++++\n";
82  ss << "seed collection size " << seedCollection->size();
83  for (auto const& tjS : *seedCollection) {
84  po.print(ss, tjS);
85  }
86  edm::LogInfo("debugTrajSeedFromQuadruplets") << ss.str();
87  //-------------------------------------------------
88 #endif
89 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
size_t tooManyClusters(const edm::Event &e) const
Log< level::Error, false > LogError
std::vector< TrajectorySeed > TrajectorySeedCollection
void print(std::stringstream &ss, const SiStripCluster &clus)
Log< level::Info, false > LogInfo
bool isValid() const
Definition: HandleBase.h:70
Definition: event.py:1

◆ getTrajectorySeedCollection()

TrajectorySeedCollection* PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::getTrajectorySeedCollection ( )
inline

◆ inspect()

bool PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::inspect ( const TrackingRegion region)
private

Definition at line 116 of file PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.cc.

References cppFunctionSkipper::exception, myEsetup, myEvent, phits, QuadCutPSet, nano_mu_digi_cff::region, seedCollection, OrderedSeedingHits::size(), ss, theHitsGenerator, theSeedCreator, and cms::Exception::what().

Referenced by loop().

116  {
117  const OrderedSeedingHits& hitss = theHitsGenerator->run(region, *myEvent, *myEsetup);
118 
119  unsigned int nHitss = hitss.size();
120 
121 #ifdef debugTSPFSLA
122  ss << "\n nHitss " << nHitss << "\n";
123 #endif
124 
125  // don't do multiple reserves in the case of multiple regions: it would make things even worse
126  // as it will cause N re-allocations instead of the normal log(N)/log(2)
127  if (seedCollection->empty())
128  seedCollection->reserve(nHitss / 2);
129 
130  unsigned int iHits = 0, jHits = 1;
131 
132  //
133  // Trivial arbitration
134  //
135  // Vector to store old quad values
136  std::vector<Quad> quadVector;
137 
138  for (; iHits < nHitss && jHits < nHitss; iHits += 2, jHits += 2) {
139 #ifdef debugTSPFSLA
140  // ss << "\n iHits " << iHits << " " << jHits << "\n";
141 #endif
142  //phits is the pair of hits for the positron
143  const SeedingHitSet& phits = hitss[iHits];
144  //mhits is the pair of hits for the electron
145  const SeedingHitSet& mhits = hitss[jHits];
146 
147  try {
148  //FIXME (modify the interface of the seed generator if needed)
149  //passing the region, that is centered around the primary vertex
150  theSeedCreator->trajectorySeed(
151  *seedCollection, phits, mhits, region, *myEvent, *myEsetup, ss, quadVector, QuadCutPSet);
152  } catch (cms::Exception& er) {
153  edm::LogError("SeedingConversion") << " Problem in the Quad Seed creator " << er.what() << std::endl;
154  } catch (std::exception& er) {
155  edm::LogError("SeedingConversion") << " Problem in the Quad Seed creator " << er.what() << std::endl;
156  }
157  }
158  quadVector.clear();
159  return true;
160 }
virtual unsigned int size() const =0
Log< level::Error, false > LogError
std::unique_ptr< CombinedHitQuadrupletGeneratorForPhotonConversion > theHitsGenerator
TupleMultiplicity< TrackerTraits > const *__restrict__ TrackingRecHitSoAConstView< TrackerTraits > TrackerTraits::tindex_type *__restrict__ double *__restrict__ phits
char const * what() const noexcept override
Definition: Exception.cc:107

◆ loop()

void PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::loop ( )
private

Definition at line 91 of file PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.cc.

References inspect(), reco::Vertex::position(), primaryVertex, ptMin, nano_mu_digi_cff::region, ss, vertexHandle, reco::Vertex::xError(), and reco::Vertex::zError().

Referenced by analyze().

91  {
92  ss.str("");
93 
94  float ptMin = 0.1;
95 
96  for (auto const& primaryVertex : *vertexHandle) {
97  //FIXME currnetly using the first primaryVertex, should loop on the promaryVertexes
99  ptMin,
101  primaryVertex.xError() * 10,
102  primaryVertex.zError() * 10,
103  true);
104 
105 #ifdef debugTSPFSLA
106  ss << "[PrintRegion] " << region.print() << std::endl;
107 #endif
108 
109  inspect(region);
110  }
111 #ifdef debugTSPFSLA
112  edm::LogInfo("debugTrajSeedFromQuadruplets") << ss.str();
113 #endif
114 }
const Point & position() const
position
Definition: Vertex.h:127
constexpr float ptMin
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
double zError() const
error on z
Definition: Vertex.h:141
double xError() const
error on x
Definition: Vertex.h:137
Log< level::Info, false > LogInfo

Member Data Documentation

◆ _conf

const edm::ParameterSet PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::_conf
private

◆ myEsetup

const edm::EventSetup* PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::myEsetup
private

Definition at line 70 of file PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h.

Referenced by analyze(), and inspect().

◆ myEvent

const edm::Event* PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::myEvent
private

Definition at line 71 of file PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h.

Referenced by analyze(), and inspect().

◆ po

PrintRecoObjects PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::po
private

Definition at line 73 of file PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h.

Referenced by analyze().

◆ primaryVertex

reco::Vertex PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::primaryVertex
private

Definition at line 67 of file PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h.

Referenced by loop().

◆ QuadCutPSet

edm::ParameterSet PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::QuadCutPSet
private

Definition at line 54 of file PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h.

Referenced by inspect().

◆ regions

Regions PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::regions
private

Definition at line 63 of file PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h.

Referenced by analyze().

◆ seedCollection

TrajectorySeedCollection* PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::seedCollection
private

◆ ss

std::stringstream PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::ss
private

◆ theClusterCheck

ClusterChecker PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::theClusterCheck
private

Definition at line 53 of file PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h.

Referenced by analyze().

◆ theHitsGenerator

std::unique_ptr<CombinedHitQuadrupletGeneratorForPhotonConversion> PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::theHitsGenerator
private

Definition at line 57 of file PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h.

Referenced by inspect().

◆ theRegionProducer

std::unique_ptr<GlobalTrackingRegionProducerFromBeamSpot> PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::theRegionProducer
private

Definition at line 59 of file PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h.

Referenced by analyze().

◆ theSeedCreator

std::unique_ptr<SeedForPhotonConversionFromQuadruplets> PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::theSeedCreator
private

Definition at line 58 of file PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h.

Referenced by inspect().

◆ theSilentOnClusterCheck

bool PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::theSilentOnClusterCheck
private

Definition at line 55 of file PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h.

Referenced by analyze().

◆ token_vertex

edm::EDGetTokenT<reco::VertexCollection> PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::token_vertex
private

◆ vertexCollection

reco::VertexCollection PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::vertexCollection
private

◆ vertexHandle

edm::Handle<reco::VertexCollection> PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::vertexHandle
private

Definition at line 65 of file PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h.

Referenced by analyze(), and loop().