120 using namespace reco;
135 produces<ConvBremSeedCollection>();
139 LogDebug(
"ConvBremSeedProducerProducer") <<
"START event: " << iEvent.
id().
event() <<
" in run " << iEvent.
id().
run();
141 constexpr
float pfmass = 0.0005;
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();
257 auto DetMatch = (rphirecHits.
product())->
find((detid));
258 auto MDetMatch = (matchedrecHits.
product())->
find((detid));
260 long int DetID = (DetMatch != rphirecHits->end()) ? detid : 0;
262 if ((MDetMatch != matchedrecHits->end()) && !MDetMatch->empty()) {
263 long int pii = MDetMatch->begin()->monoId();
264 auto CDetMatch = (rphirecHits.
product())->
find((pii));
265 DetID = (CDetMatch != rphirecHits->end()) ? pii : 0;
268 temp.push_back(DetID);
271 auto DetMatch = (pixelHits.
product())->
find((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++) {
318 auto DetMatch1 = (rphirecHits.
product())->
find(tripl[
i][0]);
319 auto DetMatch2 = (rphirecHits.
product())->
find(tripl[i][1]);
320 auto DetMatch3 = (rphirecHits.
product())->
find(tripl[i][2]);
321 if ((DetMatch1 == rphirecHits->end()) || (DetMatch2 == rphirecHits->end()) || (DetMatch3 == rphirecHits->end()))
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++) {
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())
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));
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
const MagneticField * magfield_
EventNumber_t event() const
const GeometricSearchTracker * geomSearchTracker_
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
const TransientTrackingRecHitBuilder * hitBuilder_
ConvBremSeedProducer(const edm::ParameterSet &)
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
virtual ConstReferenceCountingPointer< TangentPlane > tangentPlane(const GlobalPoint &) const =0
std::vector< ForwardDetLayer const * > const & posForwardLayers() const
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > hitBuilderToken_
unsigned int layerNumber() const
Returns the layer number.
bool forward() const
Is the layer forward ?
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
#define DEFINE_FWK_MODULE(type)
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)
std::list< TrackerLayer >::const_iterator cylinderEnd() const
Returns the last pointer in the cylinder list.
int getSuccess() const
Has propagation been performed and was barrel or endcap reached ?
TrajectoryStateOnSurface makeTrajectoryState(const DetLayer *layer, const ParticlePropagator &pp, const MagneticField *field) const
Log< level::Error, false > LogError
RawParticle const & particle() const
The particle being propagated.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const Plane & surface() const
The nominal surface of the GeomDet.
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
constexpr std::array< uint8_t, layerIndexSize > layer
const KFUpdator * kfUpdator_
const TrackerInteractionGeometry * geometry_
const MagneticFieldMap * fieldMap_
bool getData(T &iHolder) const
U second(std::pair< T, U > const &p)
bool isGsfTrack(const reco::Track &, const TrackingRecHit *)
const XYZTLorentzVector & momentum() const
the momentum fourvector
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
GlobalVector momentum() const
double Y() const
y of vertex
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
double Py() const
y of the momentum
double Z() const
z of vertex
auto recHits() const
Access to reconstructed hits on the track.
void setPropagationConditions(const TrackerLayer &, bool firstLoop=true)
double Pz() const
z of the momentum
double charge() const
get the MEASURED charge
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_beginRun_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
const TrackerGeomDet * idToDet(DetId) const override
bool propagateToEcalEntrance(bool first=true)
std::vector< const DetLayer * > layerMap_
GlobalPoint position() const
std::vector< ConstRecHitPointer > ConstRecHitContainer
const XYZTLorentzVector & vertex() const
the vertex fourvector
std::vector< bool > sharedHits(const std::vector< std::pair< TrajectorySeed, std::pair< GlobalVector, float > > > &)
T const * product() const
const edm::ESGetToken< MagneticFieldMap, MagneticFieldMapRecord > magFieldMapToken_
XYZVectorD XYZVector
spatial vector with cartesian internal representation
const DetLayer * detLayer(const TrackerLayer &layer, float zpos) const
T getParameter(std::string const &) const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
std::list< TrackerLayer >::const_iterator cylinderBegin() const
Returns the first pointer in the cylinder list.
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
double X() const
x of vertex
void endRun(const edm::Run &, const edm::EventSetup &) override
double getMagneticField() const
Get the magnetic field.
std::vector< const DetLayer * > theLayerMap
static int position[264][3]
double Px() const
x of the momentum
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
GlobalTrajectoryParameters stateAtVertex() const
int GoodCluster(const BaseParticlePropagator &bpg, const reco::PFClusterCollection &pfc, float minep, bool sec=false)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
const TrackerGeometry * tracker_
TrackCharge charge() const
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)
tuple AnalyticalPropagator
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
math::XYZTLorentzVector XYZTLorentzVector
std::vector< BarrelDetLayer const * > const & barrelLayers() const