12 inline double sqr(
double a) {
return a *
a; }
18 conf.getParameter<edm::
ParameterSet>(
"OrderedHitsFactoryPSet"), iC)),
22 theClusterCheck(conf.getParameter<edm::
ParameterSet>(
"ClusterCheckPSet"), iC),
23 theSilentOnClusterCheck(conf.getParameter<edm::
ParameterSet>(
"ClusterCheckPSet")
24 .getUntrackedParameter<bool>(
"silentClusterCheck",
false)),
25 _vtxMinDoF(conf.getParameter<double>(
"vtxMinDoF")),
26 _maxDZSigmas(conf.getParameter<double>(
"maxDZSigmas")),
27 _maxNumSelVtx(conf.getParameter<uint32_t>(
"maxNumSelVtx")),
28 _applyTkVtxConstraint(conf.getParameter<bool>(
"applyTkVtxConstraint")),
30 _primaryVtxInputTag(conf.getParameter<edm::
InputTag>(
"primaryVerticesTag")),
31 _beamSpotInputTag(conf.getParameter<edm::
InputTag>(
"beamSpotInputTag")) {
53 edm::LogError(
"TooManyClusters") <<
"Found too many clusters (" << clustsOrZero <<
"), bailing out.\n";
69 <<
"Error! Can't get the product primary Vertex Collection " <<
_primaryVtxInputTag <<
"\n";
84 ss <<
"\n++++++++++++++++++\n";
96 seedCollection =
nullptr;
105 <<
" could not find track collecion in PhotonConversionTrajectorySeedProducerFromSingleLegAlgo";
109 size_t idx = 0,
sel = 0;
120 std::vector<reco::Vertex> selectedPriVtxCompatibleWithTrack;
122 selectedPriVtxCompatibleWithTrack.push_back(*(
vertexHandle->begin()));
133 edm::LogInfo(
"debugTrajSeedFromSingleLeg") <<
"Inspected " <<
sel <<
" tracks over " << idx
139 const reco::Track& tk, std::vector<reco::Vertex>& selectedPriVtxCompatibleWithTrack) {
140 std::vector<std::pair<double, short> > idx;
153 double _dz = tk.
dz(vtx.position());
154 double _dzError = tk.
dzError();
156 double cotTheta = tk.
pz() / tk.
pt();
157 double dx = vtx.position().x();
158 double dy = vtx.position().y();
159 double sx2 = vtx.covariance(0, 0);
160 double sy2 = vtx.covariance(1, 1);
162 double sxy2 =
sqr(cosPhi * cotTheta) * sx2 +
sqr(sinPhi * cotTheta) * sy2 +
163 sqr(cotTheta * (-dx * sinPhi + dy * cosPhi)) * sphi2 +
164 sqr((1 + cotTheta * cotTheta) * (dx * cosPhi + dy * sinPhi)) * stheta2;
167 _dzError * _dzError + vtx.covariance(2, 2) +
171 ss <<
" primary vtx " << vtx.position() <<
" \tk vz " << tk.
vz() <<
" vx " << tk.
vx() <<
" vy " << tk.
vy()
172 <<
" pz/pt " << tk.
pz() / tk.
pt() <<
" \t dz " << _dz <<
" \t " << _dzError <<
" sxy2 " << sxy2
173 <<
" \t dz/dzErr " << _dz / _dzError << std::endl;
179 idx.push_back(std::pair<double, short>(fabs(_dz), count));
183 ss <<
"no vertex selected " << std::endl;
189 idx.begin(), idx.end(), [](std::pair<double, short>
a, std::pair<double, short>
b) {
return a.first <
b.first; });
192 selectedPriVtxCompatibleWithTrack.push_back((*vertexHandle)[idx[
i].
second]);
194 ss <<
"selected vtx dz " << idx[0].first <<
" position" << idx[0].second << std::endl;
202 const reco::Track& tk,
const std::vector<reco::Vertex>& selectedPriVtxCompatibleWithTrack) {
203 bool foundAtLeastASeedCand =
false;
204 for (
auto const& vtx : selectedPriVtxCompatibleWithTrack) {
211 ss <<
"[PrintRegion] " << region.
print() << std::endl;
218 if (
inspectTrack(&tk, region, primaryVertexPoint) and !foundAtLeastASeedCand) {
219 foundAtLeastASeedCand =
true;
304 float originRBound = 3;
305 float originZBound = 3.;
321 GlobalVector originBounds(originRBound, originRBound, originZBound);
323 GlobalPoint pvtxPoint(primaryVertexPoint.x(), primaryVertexPoint.y(), primaryVertexPoint.z());
328 ss <<
"\nConversion Point " << originPos <<
" " << originPos.
perp() <<
"\n";
333 unsigned int nHitss = hitss.
size();
339 ss <<
"\n nHitss " << nHitss <<
"\n";
346 for (
unsigned int iHits = 0; iHits < nHitss; ++iHits) {
348 ss <<
"\n iHits " << iHits <<
"\n";
edm::EDGetTokenT< reco::BeamSpot > token_bs
void setData(const reco::Track *track, const math::XYZVector &refPoint=math::XYZVector(0, 0, 0))
PhotonConversionTrajectorySeedProducerFromSingleLegAlgo(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
IdealHelixParameters _IdealHelixParameters
std::unique_ptr< SeedForPhotonConversion1Leg > theSeedCreator
void setMagnField(const MagneticField *magnField)
void find(const edm::Event &event, const edm::EventSetup &setup, TrajectorySeedCollection &output)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
constexpr bool isNotFinite(T x)
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
ClusterChecker theClusterCheck
Global3DPoint GlobalPoint
edm::InputTag _primaryVtxInputTag
std::vector< Track > TrackCollection
collection of Tracks
std::vector< Vertex > VertexCollection
collection of Vertex objects
virtual unsigned int size() const =0
TrajectorySeedCollection * seedCollection
double px() const
x coordinate of momentum vector
Log< level::Error, false > LogError
math::XYZVector GetMomentumAtTangentPoint() const
bool getData(T &iHolder) const
U second(std::pair< T, U > const &p)
const edm::EventSetup * myEsetup
math::XYZVector GetTangentPoint() const
edm::EDGetTokenT< reco::TrackCollection > token_refitter
std::vector< TrajectorySeed > TrajectorySeedCollection
const MagneticField * magField
edm::InputTag _beamSpotInputTag
CovarianceMatrix covariance() const
return track covariance matrix
double pt() const
track transverse momentum
size_t tooManyClusters(const edm::Event &e) const
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< reco::VertexCollection > token_vertex
void print(std::stringstream &ss, const SiStripCluster &clus)
bool inspectTrack(const reco::Track *track, const TrackingRegion ®ion, math::XYZPoint &primaryVertexPoint)
~PhotonConversionTrajectorySeedProducerFromSingleLegAlgo()
double pz() const
z coordinate of momentum vector
std::unique_ptr< GlobalTrackingRegionProducerFromBeamSpot > theRegionProducer
bool _applyTkVtxConstraint
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
double dzError() const
error on dz
Log< level::Info, false > LogInfo
double vz() const
z coordinate of the reference point on track
void loopOnPriVtx(const reco::Track &tk, const std::vector< reco::Vertex > &selectedPriVtxCompatibleWithTrack)
const edm::Event * myEvent
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
T getParameter(std::string const &) const
bool rejectTrack(const reco::Track &track)
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > token_magField
virtual std::string print() const
edm::Handle< reco::VertexCollection > vertexHandle
double vy() const
y coordinate of the reference point on track
std::unique_ptr< CombinedHitPairGeneratorForPhotonConversion > theHitsGenerator
bool theSilentOnClusterCheck
Regions::const_iterator IR
edm::Handle< reco::BeamSpot > recoBeamSpotHandle
edm::Handle< reco::TrackCollection > trackCollectionH
int charge() const
track electric charge
bool selectPriVtxCompatibleWithTrack(const reco::Track &tk, std::vector< reco::Vertex > &selectedPriVtxCompatibleWithTrack)
double py() const
y coordinate of momentum vector
double vx() const
x coordinate of the reference point on track
double thetaError() const
error on theta