120 using namespace reco;
135 produces<ConvBremSeedCollection>();
139 LogDebug(
"ConvBremSeedProducerProducer") <<
"START event: " <<
iEvent.id().event() <<
" in run " <<
iEvent.id().run();
166 auto output = std::make_unique<ConvBremSeedCollection>();
169 vector<pair<TrajectorySeed, pair<GlobalVector, float> > > unclean;
171 vector<vector<long int> > tripl;
177 for (
unsigned int ipft = 0; ipft < PfRTkColl.size(); ipft++) {
179 LogDebug(
"ConvBremSeedProducerProducer") <<
"NEW GsfPFRecTRACK ";
184 auto const& gsfRecHits = *pft->gsfTrackRef();
185 float pfoutenergy =
sqrt((pfmass * pfmass) + pft->gsfTrackRef()->outerMomentum().Mag2());
187 pft->gsfTrackRef()->outerMomentum().y(),
188 pft->gsfTrackRef()->outerMomentum().z(),
191 pft->gsfTrackRef()->outerPosition().y(),
192 pft->gsfTrackRef()->outerPosition().z(),
198 gc.push_back(
GoodCluster(theOutParticle, PPP, 0.5));
200 vector<PFBrem> brem = (*pft).PFRecBrem();
201 vector<PFBrem>::iterator
ib = brem.begin();
202 vector<PFBrem>::iterator ib_end = brem.end();
203 LogDebug(
"ConvBremSeedProducerProducer") <<
"NUMBER OF BREMS " << brem.size();
206 for (;
ib != ib_end; ++
ib) {
209 pft->trajectoryPoint(
ib->indTrajPoint()).
position().y(),
210 pft->trajectoryPoint(
ib->indTrajPoint()).
position().z(),
216 if ((
pos.Rho() > 5) && (fabs(
ib->SigmaDeltaP() /
ib->DeltaP()) > 3))
218 if (fabs(
ib->DeltaP()) < 3)
221 vector<vector<long int> > Idd;
232 if (!(cyliter->sensitive()))
244 if (&(*tkLayer) ==
nullptr)
249 vector<long int>
temp;
253 for (
auto i = compat.begin();
i != compat.end();
i++) {
254 long int detid =
i->first->geographicalId().rawId();
260 long int DetID = (DetMatch !=
rphirecHits->end()) ? detid : 0;
262 if ((MDetMatch !=
matchedrecHits->end()) && !MDetMatch->empty()) {
263 long int pii = MDetMatch->begin()->monoId();
265 DetID = (CDetMatch !=
rphirecHits->end()) ? pii : 0;
268 temp.push_back(DetID);
272 long int DetID = (DetMatch !=
pixelHits->end()) ? detid : 0;
273 temp.push_back(DetID);
284 for (
unsigned int i = 0;
i < Idd.size() - 2;
i++) {
285 for (
unsigned int i1 = 0;
i1 < Idd[
i].size();
i1++) {
286 for (
unsigned int i2 = 0;
i2 < Idd[
i + 1].size();
i2++) {
287 for (
unsigned int i3 = 0;
i3 < Idd[
i + 2].size();
i3++) {
288 if ((Idd[
i][
i1] != 0) && (Idd[
i + 1][
i2] != 0) && (Idd[
i + 2][
i3] != 0)) {
289 vector<long int>
tmp;
290 tmp.push_back(Idd[
i][
i1]);
291 tmp.push_back(Idd[
i + 1][
i2]);
292 tmp.push_back(Idd[
i + 2][
i3]);
295 for (
unsigned int iv = 0;
iv < tripl.size();
iv++) {
296 if ((tripl[
iv][0] ==
tmp[0]) && (tripl[
iv][1] ==
tmp[1]) && (tripl[
iv][2] ==
tmp[2]))
300 tripl.push_back(
tmp);
309 float sineta_brem = sinh(eta_br);
313 float nomField = bfield->nominalValue();
317 for (
unsigned int i = 0;
i < tripl.size();
i++) {
323 auto DetSet1 = *DetMatch1;
324 auto DetSet2 = *DetMatch2;
325 auto DetSet3 = *DetMatch3;
327 for (
auto it1 = DetSet1.begin(); it1 != DetSet1.end(); ++it1) {
332 for (
auto it2 = DetSet2.begin(); it2 != DetSet2.end(); ++it2) {
336 for (
auto it3 = DetSet3.begin(); it3 != DetSet3.end(); ++it3) {
341 FastHelix helix(gp3, gp2, gp1, nomField, &*bfield);
344 float ene =
sqrt(gv_corr.mag2() + (pfmass * pfmass));
352 int bgc =
GoodCluster(theOutParticle, PPP, 0.3,
true);
357 if (tak1 + tak2 + tak3 > 2)
363 for (
unsigned int igcc = 0; igcc < gc.size(); igcc++) {
384 for (
int ih = 0; ih < 3; ih++) {
389 if (!
state.isValid()) {
409 for (
unsigned int iu = 0; iu < unclean.size(); iu++) {
415 LogDebug(
"ConvBremSeedProducerProducer") <<
"END";
455 LogDebug(
"FastTracker") <<
"Barrel DetLayer dump: ";
456 for (
auto bl = barrelLayers.begin(); bl != barrelLayers.end(); ++bl) {
457 LogDebug(
"FastTracker") <<
"radius " << (**bl).specificSurface().radius();
461 LogDebug(
"FastTracker") <<
"Positive Forward DetLayer dump: ";
462 for (
auto fl = posForwardLayers.begin(); fl != posForwardLayers.end(); ++fl) {
463 LogDebug(
"FastTracker") <<
"Z pos " << (**fl).surface().position().z() <<
" radii " 464 << (**fl).specificSurface().innerRadius() <<
", " << (**fl).specificSurface().outerRadius();
467 const float rTolerance = 1.5;
468 const float zTolerance = 3.;
470 LogDebug(
"FastTracker") <<
"Dump of TrackerInteractionGeometry cylinders:";
475 LogDebug(
"FastTracker") <<
"Famos Layer no " <<
i->layerNumber() <<
" is sensitive? " <<
i->sensitive() <<
" pos " 476 <<
i->surface().position();
480 if (cyl !=
nullptr) {
481 LogDebug(
"FastTracker") <<
" cylinder radius " << cyl->radius();
484 for (
auto bl = barrelLayers.begin(); bl != barrelLayers.end(); ++bl) {
485 if (fabs(cyl->radius() - (**bl).specificSurface().radius()) < rTolerance) {
488 LogDebug(
"FastTracker") <<
"Corresponding DetLayer found with radius " << (**bl).specificSurface().radius();
494 LogError(
"FastTracker") <<
"FAILED to find a corresponding DetLayer!";
497 LogDebug(
"FastTracker") <<
" disk radii " << disk->innerRadius() <<
", " << disk->outerRadius();
501 for (
auto fl = posForwardLayers.begin(); fl != posForwardLayers.end(); ++fl) {
502 if (fabs(disk->position().z() - (**fl).surface().position().z()) < zTolerance) {
505 LogDebug(
"FastTracker") <<
"Corresponding DetLayer found with Z pos " << (**fl).surface().position().z()
506 <<
" and radii " << (**fl).specificSurface().innerRadius() <<
", " 507 << (**fl).specificSurface().outerRadius();
512 LogError(
"FastTracker") <<
"FAILED to find a corresponding DetLayer!";
518 if (zpos > 0 || !
layer.forward())
530 auto plane =
layer->surface().tangentPlane(
pos);
536 bool istaken =
false;
538 if (istaken || !
hit->isValid())
545 vector<bool> goodseed;
547 if (unclean.size() < 2) {
548 for (
unsigned int i = 0;
i < unclean.size();
i++)
549 goodseed.push_back(
true);
551 for (
unsigned int i = 0;
i < unclean.size();
i++)
552 goodseed.push_back(
true);
554 for (
unsigned int iu = 0; iu < unclean.size() - 1; iu++) {
557 for (
unsigned int iu2 = iu + 1; iu2 < unclean.size(); iu2++) {
564 unsigned int shar = 0;
565 for (
auto const& sh : unclean[iu].
first.recHits()) {
566 for (
auto const& sh2 : unclean[iu2].
first.recHits()) {
573 if (unclean[iu].
second.first.perp() < unclean[iu2].second.first.perp())
574 goodseed[iu] =
false;
576 goodseed[iu2] =
false;
596 for (
unsigned int i = 0;
i < pfc.size();
i++) {
602 float tmp_dr =
sqrt(
pow(tmp_phi, 2) +
pow(tmp_eta, 2));
603 bool isBet = (tmp_dr <
dr);
605 isBet = (tmp_phi <
df);
606 if ((isBet) && (tmp_ep > minep) && (tmp_ep < 10)) {
613 bool isBad = (
dr > 0.1);
615 isBad = ((
df > 0.25) || (de > 0.5));
const MagneticField * magfield_
const GeometricSearchTracker * geomSearchTracker_
const TransientTrackingRecHitBuilder * hitBuilder_
T getParameter(std::string const &) const
ConvBremSeedProducer(const edm::ParameterSet &)
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerToken_
GlobalTrajectoryParameters stateAtVertex() const
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
TrajectoryStateOnSurface makeTrajectoryState(const DetLayer *layer, const ParticlePropagator &pp, const MagneticField *field) const
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > hitBuilderToken_
GlobalPoint position() const
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
double Z() const
z of vertex
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
const edm::ESGetToken< TrackerInteractionGeometry, TrackerInteractionGeometryRecord > geometryToken_
T const * product() const
Global3DPoint GlobalPoint
const PropagatorWithMaterial * propagator_
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
const XYZTLorentzVector & momentum() const
the momentum fourvector
TrackCharge charge() const
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const KFUpdator * kfUpdator_
const TrackerInteractionGeometry * geometry_
const MagneticFieldMap * fieldMap_
U second(std::pair< T, U > const &p)
GlobalVector momentum() const
bool isGsfTrack(const reco::Track &, const TrackingRecHit *)
auto recHits() const
Access to reconstructed hits on the track.
math::XYZVector B_
B field.
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
std::vector< GsfPFRecTrack > GsfPFRecTrackCollection
collection of GsfPFRecTrack objects
void produce(edm::Event &, const edm::EventSetup &) override
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void setPropagationConditions(const TrackerLayer &, bool firstLoop=true)
RawParticle const & particle() const
The particle being propagated.
std::list< TrackerLayer >::const_iterator cylinderEnd() const
Returns the last pointer in the cylinder list.
#define DEFINE_FWK_MODULE(type)
std::vector< ForwardDetLayer const * > const & posForwardLayers() const
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_beginRun_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
const TrackerGeomDet * idToDet(DetId) const override
bool propagateToEcalEntrance(bool first=true)
std::vector< const DetLayer * > layerMap_
std::vector< ConstRecHitPointer > ConstRecHitContainer
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
std::vector< bool > sharedHits(const std::vector< std::pair< TrajectorySeed, std::pair< GlobalVector, float > > > &)
const Plane & surface() const
The nominal surface of the GeomDet.
std::list< TrackerLayer >::const_iterator cylinderBegin() const
Returns the first pointer in the cylinder list.
int getSuccess() const
Has propagation been performed and was barrel or endcap reached ?
const edm::ESGetToken< MagneticFieldMap, MagneticFieldMapRecord > magFieldMapToken_
XYZVectorD XYZVector
spatial vector with cartesian internal representation
std::vector< BarrelDetLayer const * > const & barrelLayers() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
void beginRun(const edm::Run &, const edm::EventSetup &) override
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
void endRun(const edm::Run &, const edm::EventSetup &) override
const DetLayer * detLayer(const TrackerLayer &layer, float zpos) const
std::vector< const DetLayer * > theLayerMap
static int position[264][3]
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
double getMagneticField() const
Get the magnetic field.
int GoodCluster(const BaseParticlePropagator &bpg, const reco::PFClusterCollection &pfc, float minep, bool sec=false)
const TrackerGeometry * tracker_
void initializeLayerMap()
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
const edm::ESGetToken< GeometricSearchTracker, TrackerRecoGeometryRecord > geomSearchTrackerToken_
Power< A, B >::type pow(const A &a, const B &b)
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
math::XYZTLorentzVector XYZTLorentzVector
const XYZTLorentzVector & vertex() const
the vertex fourvector