CMS 3D CMS Logo

PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.cc
Go to the documentation of this file.
2 #include "Quad.h"
4 // ClusterShapeIncludes:::
11 /*
12 To Do:
13 
14 assign the parameters to some data member to avoid search at every event
15 
16  */
17 
18 //#define debugTSPFSLA
19 //#define mydebug_knuenz
20 
22  const edm::ParameterSet& conf, edm::ConsumesCollector&& iC)
23  : _conf(conf),
24  seedCollection(nullptr),
25  theClusterCheck(conf.getParameter<edm::ParameterSet>("ClusterCheckPSet"), iC),
26  QuadCutPSet(conf.getParameter<edm::ParameterSet>("QuadCutPSet")),
27  theSilentOnClusterCheck(conf.getParameter<edm::ParameterSet>("ClusterCheckPSet")
28  .getUntrackedParameter<bool>("silentClusterCheck", false)),
30  conf.getParameter<edm::ParameterSet>("OrderedHitsFactoryPSet"), iC)),
31  theSeedCreator(
32  new SeedForPhotonConversionFromQuadruplets(conf.getParameter<edm::ParameterSet>("SeedCreatorPSet"),
33  iC,
34  conf.getParameter<edm::ParameterSet>("SeedComparitorPSet"))),
35  theRegionProducer(
36  new GlobalTrackingRegionProducerFromBeamSpot(conf.getParameter<edm::ParameterSet>("RegionFactoryPSet"), iC)) {
37  token_vertex = iC.consumes<reco::VertexCollection>(_conf.getParameter<edm::InputTag>("primaryVerticesTag"));
38 }
39 
41 }
42 
44  const edm::EventSetup& setup) {
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 }
90 
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 }
115 
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 }
SeedCreatorFactory.h
electrons_cff.bool
bool
Definition: electrons_cff.py:393
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::po
PrintRecoObjects po
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h:74
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::analyze
void analyze(const edm::Event &event, const edm::EventSetup &setup)
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.cc:43
funct::false
false
Definition: Factorize.h:29
TrajectorySeedCollection
std::vector< TrajectorySeed > TrajectorySeedCollection
Definition: TrajectorySeedCollection.h:6
Quad.h
PrintRecoObjects::print
void print(std::stringstream &ss, const SiStripCluster &clus)
Definition: PrintRecoObjects.cc:5
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::theHitsGenerator
std::unique_ptr< CombinedHitQuadrupletGeneratorForPhotonConversion > theHitsGenerator
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h:58
SeedingHitSet
Definition: SeedingHitSet.h:6
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::seedCollection
TrajectorySeedCollection * seedCollection
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h:53
PhotonConversionTrajectorySeedProducerFromQuadruplets_cfi.QuadCutPSet
QuadCutPSet
Definition: PhotonConversionTrajectorySeedProducerFromQuadruplets_cfi.py:43
edm
HLT enums.
Definition: AlignableModifier.h:19
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
gather_cfg.cout
cout
Definition: gather_cfg.py:144
ptMin
constexpr float ptMin
Definition: PhotonIDValueMapProducer.cc:155
reco::Vertex::position
const Point & position() const
position
Definition: Vertex.h:114
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::vertexHandle
edm::Handle< reco::VertexCollection > vertexHandle
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h:66
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
cms::Exception::what
char const * what() const noexcept override
Definition: Exception.cc:103
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::_conf
const edm::ParameterSet _conf
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h:51
GlobalTrackingRegion
Definition: GlobalTrackingRegion.h:13
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::~PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo
~PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo()
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.cc:40
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::theSeedCreator
std::unique_ptr< SeedForPhotonConversionFromQuadruplets > theSeedCreator
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h:59
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::regions
Regions regions
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h:64
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::myEsetup
const edm::EventSetup * myEsetup
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h:71
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::primaryVertex
reco::Vertex primaryVertex
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h:68
reco::Vertex::xError
double xError() const
error on x
Definition: Vertex.h:124
ElectronSeedTrackRefFix_cfi.seedCollection
seedCollection
Definition: ElectronSeedTrackRefFix_cfi.py:9
CombinedHitQuadrupletGeneratorForPhotonConversion
Definition: CombinedHitQuadrupletGeneratorForPhotonConversion.h:28
OrderedSeedingHits
Definition: OrderedSeedingHits.h:7
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::theRegionProducer
std::unique_ptr< GlobalTrackingRegionProducerFromBeamSpot > theRegionProducer
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h:60
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::loop
void loop()
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.cc:91
reco::Vertex::zError
double zError() const
error on z
Definition: Vertex.h:128
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.cc:21
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
edm::ParameterSet
Definition: ParameterSet.h:47
SeedComparitorFactory.h
ParameterSet
Definition: Functions.h:16
OrderedSeedingHits::size
virtual unsigned int size() const =0
edmPickEvents.event
event
Definition: edmPickEvents.py:273
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88338
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::QuadCutPSet
edm::ParameterSet QuadCutPSet
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h:55
edm::EventSetup
Definition: EventSetup.h:57
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
SeedComparitor.h
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::inspect
bool inspect(const TrackingRegion &region)
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.cc:116
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::token_vertex
edm::EDGetTokenT< reco::VertexCollection > token_vertex
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h:69
SeedCreator.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SeedForPhotonConversionFromQuadruplets
Definition: SeedForPhotonConversionFromQuadruplets.h:20
Exception.h
TrackingRegion
Definition: TrackingRegion.h:41
cms::Exception
Definition: Exception.h:70
TrackingRegion.h
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
ClusterChecker::tooManyClusters
size_t tooManyClusters(const edm::Event &e) const
Definition: ClusterChecker.cc:44
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::myEvent
const edm::Event * myEvent
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h:72
edm::InputTag
Definition: InputTag.h:15
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::theClusterCheck
ClusterChecker theClusterCheck
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h:54
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::ss
std::stringstream ss
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h:76
PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::theSilentOnClusterCheck
bool theSilentOnClusterCheck
Definition: PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.h:56
OrderedHitsGenerator.h
GlobalTrackingRegionProducerFromBeamSpot
Definition: GlobalTrackingRegionProducerFromBeamSpot.h:16