71 static const double positionTol = 1
e-3 ;
79 std::map<const reco::SiStripElectron*, bool> alreadySeen;
80 for (reco::SiStripElectronCollection::const_iterator strippyIter = siStripElectrons->begin(); strippyIter != siStripElectrons->end(); ++strippyIter) {
81 alreadySeen[&(*strippyIter)] =
false;
85 auto output = std::make_unique<reco::ElectronCollection>();
87 LogDebug(
"SiStripElectronAssociator") <<
" About to loop over tracks " << std::endl ;
88 LogDebug(
"SiStripElectronAssociator") <<
" Number of tracks in Associator " << tracks.
product()->size() ;
89 LogDebug(
"SiStripElectronAssociator") <<
" Number of SiStripElectron Candidates " << siStripElectrons->size();
93 int countSiElFit = 0 ;
94 for (
unsigned int i = 0;
i < tracks.
product()->size();
i++) {
102 if (trackPtr->
recHits().empty()) {
continue; }
105 uint32_t
id = (*trackPtr->
recHits().begin())->geographicalId().rawId();
108 LogDebug(
"SiStripElectronAssociator") <<
" New Track Candidate " <<
i 110 <<
" pos " << pos <<
"\n";
113 bool foundElectron =
false;
114 for (reco::SiStripElectronCollection::const_iterator strippyIter = siStripElectrons->begin(); strippyIter != siStripElectrons->end(); ++strippyIter) {
115 if (!alreadySeen[&(*strippyIter)]) {
117 bool hitInCommon =
false;
118 LogDebug(
"SiStripElectronAssociator") <<
" Looping over Mono hits " <<
"\n" ;
120 for (std::vector<SiStripRecHit2D>::const_iterator
hitIter = strippyIter->rphiRecHits().begin();
hitIter != strippyIter->rphiRecHits().end(); ++
hitIter) {
122 LogDebug(
"SiStripElectronAssociator") <<
" SiStripCand " 123 <<
" DetId " <<
hitIter->geographicalId().rawId()
124 <<
" localPos " <<
hitIter->localPosition()
125 <<
" deltasPos " << (
hitIter->localPosition() - pos).
mag() ;
127 if (
hitIter->geographicalId().rawId() ==
id &&
128 (
hitIter->localPosition() - pos).
mag() < positionTol ) {
130 LogDebug(
"SiStripElectronAssociator") <<
" hitInCommon True " <<
"\n" ;
133 LogDebug(
"SiStripElectronAssociator") <<
" hitInCommon False " <<
"\n" ;
138 LogDebug(
"SiStripElectronAssociator") <<
" Looping over Stereo hits " <<
"\n" ;
140 for (std::vector<SiStripRecHit2D>::const_iterator
hitIter = strippyIter->stereoRecHits().begin();
hitIter != strippyIter->stereoRecHits().end(); ++
hitIter) {
142 LogDebug(
"SiStripElectronAssociator") <<
" SiStripCand " 143 <<
" DetId " <<
hitIter->geographicalId().rawId()
144 <<
" localPos " <<
hitIter->localPosition()
145 <<
" deltasPos " << (
hitIter->localPosition() - pos).
mag() ;
147 if (
hitIter->geographicalId().rawId() ==
id &&
148 (
hitIter->localPosition() - pos).
mag() < positionTol) {
150 LogDebug(
"SiStripElectronAssociator") <<
" hitInCommon True " <<
"\n" ;
153 LogDebug(
"SiStripElectronAssociator") <<
" hitInCommon False " <<
"\n" ;
160 LogDebug(
"SiStripElectronAssociator") <<
" Hit in Common Found \n" ;
162 foundElectron =
true;
163 alreadySeen[&(*strippyIter)] =
true;
176 output->push_back(electron);
180 LogDebug(
"SiStripElectronAssociator") <<
"Hit in Common NOT found \n" ;
186 LogDebug(
"SiStripElectronAssociator") <<
"Done with this electron " <<
"\n\n\n";
189 LogDebug(
"SiStripElectronAssociator") <<
"Testing if foundElectron " << foundElectron << std::endl;
191 if (!foundElectron) {
193 <<
" Inconsistent track collection!";
196 LogDebug(
"SiStripElectronAssociator") <<
"At end of track loop \n" << std::endl;
201 LogDebug(
"SiStripElectronAssociator") <<
" Number of SiStripElectrons returned with a good fit " 202 << countSiElFit <<
"\n"<< std::endl ;
double p() const
momentum vector magnitude
edm::InputTag electronsLabel_
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
double px() const
x coordinate of momentum vector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
edm::EDGetTokenT< reco::TrackCollection > trackCollection_
auto recHits() const
Access to reconstructed hits on the track.
double pz() const
z coordinate of momentum vector
double vz() const
z coordinate of the reference point on track
T const * product() const
hitCont::const_iterator hitIter
XYZPointD XYZPoint
point in space with cartesian internal representation
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
double vy() const
y coordinate of the reference point on track
int charge() const
track electric charge
SiStripElectronAssociator(const edm::ParameterSet &)
void setSuperCluster(const reco::SuperClusterRef &r)
set refrence to Photon component
void setTrack(const reco::TrackRef &r)
set refrence to Track component
~SiStripElectronAssociator() override
void produce(edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< reco::SiStripElectronCollection > siStripElectronCollection_
double py() const
y coordinate of momentum vector
double vx() const
x coordinate of the reference point on track