57 produces<ConvBremSeedCollection>();
72 LogDebug(
"ConvBremSeedProducerProducer")<<
"START event: "<<iEvent.
id().
event()
73 <<
" in run "<<iEvent.
id().
run();
99 thePfRecTrackCollection);
104 auto output = std::make_unique<ConvBremSeedCollection>();
108 vector<pair< TrajectorySeed , pair<GlobalVector,float> > > unclean;
110 vector< vector< long int > > tripl;
118 for(
unsigned int ipft=0;ipft<PfRTkColl.size();ipft++){
120 LogDebug(
"ConvBremSeedProducerProducer")<<
"NEW GsfPFRecTRACK ";
125 auto const & gsfRecHits = *pft->gsfTrackRef();
126 float pfoutenergy=
sqrt((pfmass*pfmass)+pft->gsfTrackRef()->outerMomentum().Mag2());
128 pft->gsfTrackRef()->outerMomentum().y(),
129 pft->gsfTrackRef()->outerMomentum().z(),
132 pft->gsfTrackRef()->outerPosition().y(),
133 pft->gsfTrackRef()->outerPosition().z(),
137 theOutParticle.
setCharge(pft->gsfTrackRef()->charge());
143 vector<PFBrem> brem =(*pft).PFRecBrem();
144 vector<PFBrem>::iterator
ib=brem.begin();
145 vector<PFBrem>::iterator ib_end=brem.end();
146 LogDebug(
"ConvBremSeedProducerProducer")<<
"NUMBER OF BREMS "<<brem.size();
149 for (;ib!=ib_end;++
ib){
154 pft->trajectoryPoint(ib->indTrajPoint()).
position().x(),
155 pft->trajectoryPoint(ib->indTrajPoint()).
position().y(),
156 pft->trajectoryPoint(ib->indTrajPoint()).
position().z(),
160 if (pos.Rho()>80)
continue;
161 if ((pos.Rho()>5)&&(fabs(ib->SigmaDeltaP()/ib->DeltaP())>3))
continue;
162 if (fabs(ib->DeltaP())<3)
continue;
164 vector< vector< long int > >Idd;
180 if (!(cyliter->sensitive()))
continue;
190 if (&(*tkLayer)==
nullptr)
continue;
193 std::vector<DetWithState> compat
195 vector <long int>
temp;
196 if (compat.empty())
continue;
198 for (std::vector<DetWithState>::const_iterator
i=compat.begin();
i!=compat.end();
i++) {
200 long int detid=
i->first->geographicalId().rawId();
209 long int DetID=(DetMatch != rphirecHits->
end())? detid:0;
211 if ((MDetMatch != matchedrecHits->
end()) && !MDetMatch->empty()) {
212 long int pii = MDetMatch->begin()->monoId();
214 DetID=(CDetMatch != rphirecHits->
end())? pii:0;
218 temp.push_back(DetID);
223 long int DetID=(DetMatch != pixelHits->
end())? detid:0;
224 temp.push_back(DetID);
233 if(Idd.size()<2)
continue;
236 for (
unsigned int i=0;
i<Idd.size()-2;
i++){
237 for (
unsigned int i1=0;i1<Idd[
i].size();i1++){
238 for (
unsigned int i2=0;i2<Idd[
i+1].size();i2++){
239 for (
unsigned int i3=0;i3<Idd[
i+2].size();i3++){
240 if ((Idd[
i][i1]!=0) &&(Idd[
i+1][i2]!=0) &&(Idd[
i+2][i3]!=0) ){
241 vector<long int >
tmp;
242 tmp.push_back(Idd[
i][i1]); tmp.push_back(Idd[
i+1][i2]); tmp.push_back(Idd[
i+2][i3]);
245 for (
unsigned int iv=0;iv<tripl.size();iv++){
246 if((tripl[iv][0]==tmp[0])&&(tripl[iv][1]==tmp[1])&&(tripl[iv][2]==tmp[2])) newTrip=
false;
251 tripl.push_back(tmp);
260 float sineta_brem =sinh(eta_br);
271 for (
unsigned int i=0;
i<tripl.size();
i++){
275 if ((DetMatch1 == rphirecHits->
end()) ||
276 (DetMatch2 == rphirecHits->
end()) ||
277 (DetMatch3 == rphirecHits->
end()) )
continue;
284 toGlobal(it1->localPosition());
290 toGlobal(it2->localPosition());
296 toGlobal(it3->localPosition());
300 FastHelix helix(gp3, gp2, gp1,nomField,&*bfield);
303 float ene=
sqrt(gv_corr.mag2()+(pfmass*pfmass));
317 if (gv.
perp()<0.5)
continue;
319 if (tak1+tak2+tak3>2)
continue;
321 if (bgc==-1)
continue;
323 for (
unsigned int igcc=0; igcc<gc.size(); igcc++){
325 if (bgc==gc[igcc]) clTak=
true;
335 glob_hits.clear(); loc_hits.
clear();
346 for (
int ih=0;ih<3;ih++){
365 make_pair(gv_corr,ch)));
375 for (
unsigned int iu=0; iu<unclean.size();iu++){
383 LogDebug(
"ConvBremSeedProducerProducer")<<
"END";
447 const std::vector< const BarrelDetLayer*>& barrelLayers =
449 LogDebug(
"FastTracker") <<
"Barrel DetLayer dump: ";
450 for (
auto bl=barrelLayers.begin();
451 bl != barrelLayers.end(); ++bl) {
452 LogDebug(
"FastTracker")<<
"radius " << (**bl).specificSurface().radius();
455 const std::vector< const ForwardDetLayer*>& posForwardLayers =
457 LogDebug(
"FastTracker") <<
"Positive Forward DetLayer dump: ";
458 for (
auto fl=posForwardLayers.begin();
459 fl != posForwardLayers.end(); ++fl) {
461 << (**fl).surface().position().z()
463 << (**fl).specificSurface().innerRadius()
465 << (**fl).specificSurface().outerRadius();
468 const float rTolerance = 1.5;
469 const float zTolerance = 3.;
471 LogDebug(
"FastTracker")<<
"Dump of TrackerInteractionGeometry cylinders:";
477 LogDebug(
"FastTracker") <<
"Famos Layer no " <<
i->layerNumber()
478 <<
" is sensitive? " <<
i->sensitive()
479 <<
" pos " <<
i->surface().position();
480 if (!
i->sensitive())
continue;
482 if (cyl !=
nullptr) {
484 LogDebug(
"FastTracker") <<
" cylinder radius " << cyl->radius();
488 bl=barrelLayers.begin(); bl != barrelLayers.end(); ++bl) {
490 if (fabs( cyl->radius() - (**bl).specificSurface().radius()) < rTolerance) {
494 LogDebug(
"FastTracker")<<
"Corresponding DetLayer found with radius " 495 << (**bl).specificSurface().radius();
501 LogError(
"FastTracker") <<
"FAILED to find a corresponding DetLayer!";
505 LogDebug(
"FastTracker") <<
" disk radii " << disk->innerRadius()
506 <<
", " << disk->outerRadius();
510 for (
auto fl=posForwardLayers.begin();
511 fl != posForwardLayers.end(); ++fl) {
512 if (fabs( disk->position().z() - (**fl).surface().position().z()) < zTolerance) {
515 LogDebug(
"FastTracker") <<
"Corresponding DetLayer found with Z pos " 516 << (**fl).surface().position().z()
518 << (**fl).specificSurface().innerRadius()
520 << (**fl).specificSurface().outerRadius();
525 LogError(
"FastTracker") <<
"FAILED to find a corresponding DetLayer!";
557 if (istaken)
continue;
558 if (!((*ib)->isValid()))
continue;
565 pair<GlobalVector,float> > >& unclean){
567 vector<bool> goodseed;
569 if (unclean.size()<2){
570 for (
unsigned int i=0;
i<unclean.size();
i++)
571 goodseed.push_back(
true);
574 for (
unsigned int i=0;
i<unclean.size();
i++)
575 goodseed.push_back(
true);
577 for (
unsigned int iu=0; iu<unclean.size()-1;iu++){
578 if (!goodseed[iu])
continue;
579 for (
unsigned int iu2=iu+1; iu2<unclean.size();iu2++){
580 if (!goodseed[iu])
continue;
581 if (!goodseed[iu2])
continue;
587 unsigned int shar =0;
588 for (;sh!=sh_end;++sh){
592 for (;sh2!=sh2_end;++sh2){
601 if (unclean[iu].
second.first.perp()<unclean[iu2].second.first.perp()) goodseed[iu]=
false;
602 else goodseed[iu2]=
false;
625 for (
unsigned int i =0;
i<pfc.size();
i++ ){
626 float tmp_ep=pfc[
i].energy()/bpg.
momentum().e();
630 float tmp_dr=
sqrt(
pow(tmp_phi,2)+
pow(tmp_eta,2));
631 bool isBet=(tmp_dr<
dr);
632 if (sec) isBet=(tmp_phi<df);
633 if ((isBet)&&(tmp_ep>minep)&&(tmp_ep<10)){
641 if (sec) isBad= ((df>0.25) || (de>0.5));
const MagneticField * magfield_
void setCharge(float q)
set the MEASURED charge
T getParameter(std::string const &) const
EventNumber_t event() const
const GeometricSearchTracker * geomSearchTracker_
const TransientTrackingRecHitBuilder * hitBuilder_
~ConvBremSeedProducer() override
ConvBremSeedProducer(const edm::ParameterSet &)
const_iterator end(bool update=false) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
virtual ConstReferenceCountingPointer< TangentPlane > tangentPlane(const GlobalPoint &) const =0
SiStripMatchedRecHit2DCollection::const_iterator MatDetMatch
std::vector< ForwardDetLayer const * > const & posForwardLayers() const
unsigned int layerNumber() const
Returns the layer number.
int nominalValue() const
The nominal field value for this map in kGauss.
bool forward() const
Is the layer forward ?
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
Global3DPoint GlobalPoint
const PropagatorWithMaterial * propagator_
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
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
data_type const * const_iterator
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
SiPixelRecHitCollection::const_iterator PiDetMatch
const KFUpdator * kfUpdator_
const TrackerInteractionGeometry * geometry_
const MagneticFieldMap * fieldMap_
U second(std::pair< T, U > const &p)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
bool isGsfTrack(const reco::Track &, const TrackingRecHit *)
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
const XYZTLorentzVector & momentum() const
the momentum fourvector
math::XYZVector B_
B field.
std::vector< GsfPFRecTrack > GsfPFRecTrackCollection
collection of GsfPFRecTrack objects
void produce(edm::Event &, const edm::EventSetup &) override
recHitContainer::const_iterator const_iterator
GlobalVector momentum() const
double Y() const
y of vertex
double Z() const
z of vertex
void setPropagationConditions(const TrackerLayer &, bool firstLoop=true)
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
double charge() const
get the MEASURED charge
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
bool propagateToEcalEntrance(bool first=true)
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
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 DetLayer * detLayer(const TrackerLayer &layer, float zpos) const
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< std::vector< double > > tmp
static int position[264][3]
SiStripRecHit2DCollection::const_iterator StDetMatch
const TrackerGeomDet * idToDet(DetId) const override
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)
const TrackerGeometry * tracker_
TrackCharge charge() const
void initializeLayerMap()
T const * product() const
Power< A, B >::type pow(const A &a, const B &b)
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
std::vector< BarrelDetLayer const * > const & barrelLayers() const
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.