125 using namespace reco;
131 matchedrecHitsToken_(
145 produces<ConvBremSeedCollection>();
149 LogDebug(
"ConvBremSeedProducerProducer") <<
"START event: " <<
iEvent.id().event() <<
" in run " <<
iEvent.id().run();
167 const auto& PfRTkColl = *thePfRecTrackCollection;
170 auto output = std::make_unique<ConvBremSeedCollection>();
173 vector<pair<TrajectorySeed, pair<GlobalVector, float> > > unclean;
175 vector<vector<long int> > tripl;
181 for (
unsigned int ipft = 0; ipft < PfRTkColl.size(); ipft++) {
183 LogDebug(
"ConvBremSeedProducerProducer") <<
"NEW GsfPFRecTRACK ";
188 auto const& gsfRecHits = *pft->gsfTrackRef();
189 float pfoutenergy =
sqrt((pfmass * pfmass) + pft->gsfTrackRef()->outerMomentum().Mag2());
191 pft->gsfTrackRef()->outerMomentum().y(),
192 pft->gsfTrackRef()->outerMomentum().z(),
195 pft->gsfTrackRef()->outerPosition().y(),
196 pft->gsfTrackRef()->outerPosition().z(),
202 gc.push_back(
GoodCluster(theOutParticle, PPP, 0.5));
204 vector<PFBrem> brem = (*pft).PFRecBrem();
205 vector<PFBrem>::iterator
ib = brem.begin();
206 vector<PFBrem>::iterator ib_end = brem.end();
207 LogDebug(
"ConvBremSeedProducerProducer") <<
"NUMBER OF BREMS " << brem.size();
210 for (;
ib != ib_end; ++
ib) {
213 pft->trajectoryPoint(
ib->indTrajPoint()).
position().y(),
214 pft->trajectoryPoint(
ib->indTrajPoint()).
position().z(),
220 if ((
pos.Rho() > 5) && (fabs(
ib->SigmaDeltaP() /
ib->DeltaP()) > 3))
222 if (fabs(
ib->DeltaP()) < 3)
225 vector<vector<long int> > Idd;
236 if (!(cyliter->sensitive()))
248 if (&(*tkLayer) ==
nullptr)
253 vector<long int>
temp;
257 for (
auto i = compat.begin();
i != compat.end();
i++) {
258 long int detid =
i->first->geographicalId().rawId();
264 long int DetID = (DetMatch !=
rphirecHits->end()) ? detid : 0;
266 if ((MDetMatch !=
matchedrecHits->end()) && !MDetMatch->empty()) {
267 long int pii = MDetMatch->begin()->monoId();
269 DetID = (CDetMatch !=
rphirecHits->end()) ? pii : 0;
272 temp.push_back(DetID);
276 long int DetID = (DetMatch !=
pixelHits->end()) ? detid : 0;
277 temp.push_back(DetID);
288 for (
unsigned int i = 0;
i < Idd.size() - 2;
i++) {
289 for (
unsigned int i1 = 0;
i1 < Idd[
i].size();
i1++) {
290 for (
unsigned int i2 = 0;
i2 < Idd[
i + 1].size();
i2++) {
291 for (
unsigned int i3 = 0;
i3 < Idd[
i + 2].size();
i3++) {
292 if ((Idd[
i][
i1] != 0) && (Idd[
i + 1][
i2] != 0) && (Idd[
i + 2][
i3] != 0)) {
293 vector<long int>
tmp;
294 tmp.push_back(Idd[
i][
i1]);
295 tmp.push_back(Idd[
i + 1][
i2]);
296 tmp.push_back(Idd[
i + 2][
i3]);
299 for (
unsigned int iv = 0;
iv < tripl.size();
iv++) {
300 if ((tripl[
iv][0] ==
tmp[0]) && (tripl[
iv][1] ==
tmp[1]) && (tripl[
iv][2] ==
tmp[2]))
304 tripl.push_back(
tmp);
313 float sineta_brem = sinh(eta_br);
317 float nomField = bfield->nominalValue();
321 for (
unsigned int i = 0;
i < tripl.size();
i++) {
327 auto DetSet1 = *DetMatch1;
328 auto DetSet2 = *DetMatch2;
329 auto DetSet3 = *DetMatch3;
331 for (
auto it1 = DetSet1.begin(); it1 != DetSet1.end(); ++it1) {
336 for (
auto it2 = DetSet2.begin(); it2 != DetSet2.end(); ++it2) {
340 for (
auto it3 = DetSet3.begin(); it3 != DetSet3.end(); ++it3) {
345 FastHelix helix(gp3, gp2, gp1, nomField, &*bfield);
348 float ene =
sqrt(gv_corr.mag2() + (pfmass * pfmass));
356 int bgc =
GoodCluster(theOutParticle, PPP, 0.3,
true);
361 if (tak1 + tak2 + tak3 > 2)
367 for (
unsigned int igcc = 0; igcc < gc.size(); igcc++) {
388 for (
int ih = 0; ih < 3; ih++) {
393 if (!
state.isValid()) {
413 for (
unsigned int iu = 0; iu < unclean.size(); iu++) {
419 LogDebug(
"ConvBremSeedProducerProducer") <<
"END";
459 LogDebug(
"FastTracker") <<
"Barrel DetLayer dump: ";
460 for (
auto bl = barrelLayers.begin(); bl != barrelLayers.end(); ++bl) {
461 LogDebug(
"FastTracker") <<
"radius " << (**bl).specificSurface().radius();
465 LogDebug(
"FastTracker") <<
"Positive Forward DetLayer dump: ";
466 for (
auto fl = posForwardLayers.begin(); fl != posForwardLayers.end(); ++fl) {
467 LogDebug(
"FastTracker") <<
"Z pos " << (**fl).surface().position().z() <<
" radii " 468 << (**fl).specificSurface().innerRadius() <<
", " << (**fl).specificSurface().outerRadius();
471 const float rTolerance = 1.5;
472 const float zTolerance = 3.;
474 LogDebug(
"FastTracker") <<
"Dump of TrackerInteractionGeometry cylinders:";
479 LogDebug(
"FastTracker") <<
"Famos Layer no " <<
i->layerNumber() <<
" is sensitive? " <<
i->sensitive() <<
" pos " 480 <<
i->surface().position();
484 if (cyl !=
nullptr) {
485 LogDebug(
"FastTracker") <<
" cylinder radius " << cyl->radius();
488 for (
auto bl = barrelLayers.begin(); bl != barrelLayers.end(); ++bl) {
489 if (fabs(cyl->radius() - (**bl).specificSurface().radius()) < rTolerance) {
492 LogDebug(
"FastTracker") <<
"Corresponding DetLayer found with radius " << (**bl).specificSurface().radius();
498 LogError(
"FastTracker") <<
"FAILED to find a corresponding DetLayer!";
501 LogDebug(
"FastTracker") <<
" disk radii " << disk->innerRadius() <<
", " << disk->outerRadius();
505 for (
auto fl = posForwardLayers.begin(); fl != posForwardLayers.end(); ++fl) {
506 if (fabs(disk->position().z() - (**fl).surface().position().z()) < zTolerance) {
509 LogDebug(
"FastTracker") <<
"Corresponding DetLayer found with Z pos " << (**fl).surface().position().z()
510 <<
" and radii " << (**fl).specificSurface().innerRadius() <<
", " 511 << (**fl).specificSurface().outerRadius();
516 LogError(
"FastTracker") <<
"FAILED to find a corresponding DetLayer!";
522 if (zpos > 0 || !
layer.forward())
534 auto plane =
layer->surface().tangentPlane(
pos);
540 bool istaken =
false;
542 if (istaken || !
hit->isValid())
549 vector<bool> goodseed;
551 if (unclean.size() < 2) {
552 for (
unsigned int i = 0;
i < unclean.size();
i++)
553 goodseed.push_back(
true);
555 for (
unsigned int i = 0;
i < unclean.size();
i++)
556 goodseed.push_back(
true);
558 for (
unsigned int iu = 0; iu < unclean.size() - 1; iu++) {
561 for (
unsigned int iu2 = iu + 1; iu2 < unclean.size(); iu2++) {
568 unsigned int shar = 0;
569 for (
auto const& sh : unclean[iu].
first.recHits()) {
570 for (
auto const& sh2 : unclean[iu2].
first.recHits()) {
577 if (unclean[iu].
second.first.perp() < unclean[iu2].second.first.perp())
578 goodseed[iu] =
false;
580 goodseed[iu2] =
false;
600 for (
unsigned int i = 0;
i < pfc.size();
i++) {
606 float tmp_dr =
sqrt(
pow(tmp_phi, 2) +
pow(tmp_eta, 2));
607 bool isBet = (tmp_dr <
dr);
609 isBet = (tmp_phi <
df);
610 if ((isBet) && (tmp_ep > minep) && (tmp_ep < 10)) {
617 bool isBad = (
dr > 0.1);
619 isBad = ((
df > 0.25) || (de > 0.5));
const MagneticField * magfield_
const GeometricSearchTracker * geomSearchTracker_
const TransientTrackingRecHitBuilder * hitBuilder_
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_
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 edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > matchedrecHitsToken_
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)
const edm::EDGetTokenT< SiPixelRecHitCollection > pixelHitsToken_
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 edm::EDGetTokenT< reco::PFClusterCollection > pfToken_
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_
const edm::EDGetTokenT< SiStripRecHit2DCollection > rphirecHitsToken_
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)
const edm::EDGetTokenT< reco::GsfPFRecTrackCollection > thePfRecTrackToken_
math::XYZTLorentzVector XYZTLorentzVector
const XYZTLorentzVector & vertex() const
the vertex fourvector