56 for (
unsigned i=0;
i<seedingAlgo.size(); ++
i )
57 produces<TrajectorySeedCollection>(seedingAlgo[
i]);
61 if (
pTMin.size() != seedingAlgo.size() )
63 <<
" WARNING : pTMin does not have the proper size "
66 for (
unsigned i=0; i<
pTMin.size(); ++
i )
73 <<
" WARNING : minRecHits does not have the proper size "
77 for (
unsigned ialgo=0; ialgo<
minRecHits.size(); ++ialgo )
82 if (
maxD0.size() != seedingAlgo.size() )
84 <<
" WARNING : maxD0 does not have the proper size "
88 if (
maxZ0.size() != seedingAlgo.size() )
90 <<
" WARNING : maxZ0 does not have the proper size "
101 if ( numberOfHits.size() != seedingAlgo.size() )
103 <<
" WARNING : numberOfHits does not have the proper size "
117 conf.
getParameter<std::vector<unsigned int> >(
"firstHitSubDetectorNumber");
120 <<
" WARNING : firstHitSubDetectorNumber does not have the proper size "
123 std::vector<unsigned int> firstSubDets =
124 conf.
getParameter<std::vector<unsigned int> >(
"firstHitSubDetectors");
134 if ( firstSubDets.size() != check1 )
136 <<
" WARNING : firstHitSubDetectors does not have the proper size (should be " << check1 <<
")"
141 conf.
getParameter<std::vector<unsigned int> >(
"secondHitSubDetectorNumber");
144 <<
" WARNING : secondHitSubDetectorNumber does not have the proper size "
147 std::vector<unsigned int> secondSubDets =
148 conf.
getParameter<std::vector<unsigned int> >(
"secondHitSubDetectors");
158 if ( secondSubDets.size() != check2 )
160 <<
" WARNING : secondHitSubDetectors does not have the proper size (should be " << check2 <<
")"
164 conf.
getParameter<std::vector<unsigned int> >(
"thirdHitSubDetectorNumber");
167 <<
" WARNING : thirdHitSubDetectorNumber does not have the proper size "
170 std::vector<unsigned int> thirdSubDets =
171 conf.
getParameter<std::vector<unsigned int> >(
"thirdHitSubDetectors");
181 if ( thirdSubDets.size() != check3 )
183 <<
" WARNING : thirdHitSubDetectors does not have the proper size (should be " << check3 <<
")"
189 <<
" WARNING : originRadius does not have the proper size "
195 <<
" WARNING : originHalfLength does not have the proper size "
201 <<
" WARNING : originpTMin does not have the proper size "
207 <<
" WARNING : primaryVertices does not have the proper size "
213 <<
" WARNING : zVertexConstraint does not have the proper size "
227 std::cout <<
"TrajectorySeedProducer destructed" << std::endl;
265 std::cout <<
"################################################################" << std::endl;
266 std::cout <<
" TrajectorySeedProducer produce init " << std::endl;
275 unsigned nSimTracks = 0;
276 unsigned nTracksWithHits = 0;
277 unsigned nTracksWithPT = 0;
278 unsigned nTracksWithD0Z0 = 0;
283 std::vector<TrajectorySeedCollection*>
285 for (
unsigned ialgo=0; ialgo<
seedingAlgo.size(); ++ialgo ) {
300 x0 = BSPosition_.X();
301 y0 = BSPosition_.Y();
302 z0 = BSPosition_.Z();
312 std::cout <<
" Step A: SimTracks found " << theSimTracks->size() << std::endl;
321 std::cout <<
" Step B: Full GS RecHits found " << theGSRecHits->size() << std::endl;
323 if(theGSRecHits->size() == 0) {
324 for (
unsigned ialgo=0; ialgo<
seedingAlgo.size(); ++ialgo ) {
325 std::auto_ptr<TrajectorySeedCollection>
p(output[ialgo]);
332 vertices = std::vector<const reco::VertexCollection*>
334 for (
unsigned ialgo=0; ialgo<
seedingAlgo.size(); ++ialgo ) {
340 if (!isVertexCollection )
continue;
345 std::cout <<
" Step C: Loop over the RecHits, track by track " << std::endl;
349 const std::vector<unsigned> theSimTrackIds = theGSRecHits->ids();
352 for (
unsigned tkId=0; tkId != theSimTrackIds.size(); ++tkId ) {
355 std::cout <<
"Track number " << tkId << std::endl;
359 unsigned simTrackId = theSimTrackIds[tkId];
360 const SimTrack& theSimTrack = (*theSimTracks)[simTrackId];
363 <<
" eta " << theSimTrack.
momentum().Eta()
364 <<
" pdg ID " << theSimTrack.
type()
372 int vertexIndex = theSimTrack.
vertIndex();
373 const SimVertex& theSimVertex = (*theSimVtx)[vertexIndex];
375 std::cout <<
" o SimTrack " << theSimTrack << std::endl;
376 std::cout <<
" o SimVertex " << theSimVertex << std::endl;
401 unsigned numberOfRecHits = 0;
403 for ( iterRecHit = theRecHitRangeIteratorBegin;
404 iterRecHit != theRecHitRangeIteratorEnd;
406 previousHit = currentHit;
414 for (
unsigned int ialgo = 0; ialgo <
seedingAlgo.size(); ++ialgo ) {
422 std::cout <<
"The number of RecHits = " << numberOfRecHits << std::endl;
424 if ( numberOfRecHits <
minRecHits[ialgo] )
continue;
428 if ( theSimTrack.
momentum().Perp2() <
pTMin[ialgo] )
continue;
436 std::vector<TrackerRecHit >
442 bool compatible =
false;
443 for ( iterRecHit1 = theRecHitRangeIteratorBegin; iterRecHit1 != theRecHitRangeIteratorEnd; ++iterRecHit1) {
447 std::cout <<
"The first hit subDetId = " << theSeedHits0.
subDetId() << std::endl;
452 bool isInside =
true;
459 if ( isInside )
continue;
472 if ( !isOndet )
continue;
476 std::cout <<
"Apparently the first hit is on the requested detector! " << std::endl;
478 for ( iterRecHit2 = iterRecHit1+1; iterRecHit2 != theRecHitRangeIteratorEnd; ++iterRecHit2) {
482 std::cout <<
"The second hit subDetId = " << theSeedHits1.
subDetId() << std::endl;
492 if ( isInside )
continue;
499 if ( !isOndet )
break;
506 std::cout <<
"Apparently the second hit is on the requested detector! " << std::endl;
522 std::cout <<
"Algo" <<
seedingAlgo[0] <<
"\t Are the two hits compatible with the PV? " << compatible << std::endl;
530 compatible = compatible && theSeedHits[0].makesAPairWith3rd(theSeedHits[1]);
532 compatible = compatible && theSeedHits[0].makesAPairWith(theSeedHits[1]);
545 if ( !compatible )
continue;
556 for ( iterRecHit3 = iterRecHit2+1; iterRecHit3 != theRecHitRangeIteratorEnd; ++iterRecHit3) {
560 std::cout <<
"The third hit subDetId = " << theSeedHits2.
subDetId() << std::endl;
570 if ( isInside )
continue;
578 if ( !isOndet )
continue;
585 if (!
selectMuons) compatible = compatible && theSeedHits[0].makesATripletWith(theSeedHits[1],theSeedHits[2]);
589 std::cout <<
"Apparently the third hit is on the requested detector! " << std::endl;
592 if ( compatible )
break;
596 if ( compatible )
break;
600 if ( compatible )
break;
606 if ( !compatible )
continue;
609 std::cout <<
"@@@ There is at least a compatible seed" << std::endl;
611 std::cout <<
"@@@ There is no compatible seed" << std::endl;
616 std::cout <<
"Preparing to create the TrajectorySeed" << std::endl;
621 for (
unsigned ih=0; ih<theSeedHits.size(); ++ih ) {
626 std::cout <<
"with " << recHits.
size() <<
" hits." << std::endl;
632 (*theSimVtx)[vertexIndex].
position().
y(),
633 (*theSimVtx)[vertexIndex].
position().
z());
636 GlobalVector momentum( (*theSimTracks)[simTrackId].momentum().
x() ,
637 (*theSimTracks)[simTrackId].momentum().
y() ,
638 (*theSimTracks)[simTrackId].momentum().
z() );
640 float charge = (*theSimTracks)[simTrackId].charge();
649 if(theSeedHits0.
subDetId() !=1 || theSeedHits0.
subDetId() !=2) errorMatrix = errorMatrix * 0.0000001;
654 std::cout <<
"TrajectorySeedProducer: SimTrack parameters " << std::endl;
655 std::cout <<
"\t\t pT = " << (*theSimTracks)[simTrackId].momentum().Pt() << std::endl;
656 std::cout <<
"\t\t eta = " << (*theSimTracks)[simTrackId].momentum().Eta() << std::endl;
657 std::cout <<
"\t\t phi = " << (*theSimTracks)[simTrackId].momentum().Phi() << std::endl;
658 std::cout <<
"TrajectorySeedProducer: AlgebraicSymMatrix " << errorMatrix << std::endl;
664 std::cout <<
"TrajectorySeedProducer: FTS momentum " << initialFTS.
momentum() << std::endl;
673 if (!initialTSOS.
isValid())
continue;
683 std::cout <<
"TrajectorySeedProducer: TSOS surface side " << initialTSOS.
surfaceSide() << std::endl;
691 std::cout <<
"Trajectory seed created ! " << std::endl;
699 for (
unsigned ialgo=0; ialgo<
seedingAlgo.size(); ++ialgo ) {
700 std::auto_ptr<TrajectorySeedCollection>
p(output[ialgo]);
721 float localErrors[15];
723 for (
int i=0;
i<dim; ++
i) {
724 for (
int j=0;
j<=
i; ++
j) {
725 localErrors[k++] =
m(
i,
j);
728 int surfaceSide =
static_cast<int>(ts.
surfaceSide());
740 unsigned algo)
const {
748 std::cout <<
"ThePos1 = " << thePos1 << std::endl;
749 std::cout <<
"ThePos2 = " << thePos2 << std::endl;
767 if ( !intersect )
return false;
770 std::cout <<
"MyPart R = " << myPart.
R() <<
"\t Z = " << myPart.
Z()
771 <<
"\t pT = " << myPart.Pt() << std::endl;
776 if ( myPart.Pt() <
originpTMin[algo] )
return false;
783 if (!theVertices)
return true;
784 unsigned nVertices = theVertices->size();
788 + (thePos1.Y()-
y0)*(thePos1.Y()-
y0) );
790 + (thePos2.Y()-
y0)*(thePos2.Y()-
y0) );
792 for (
unsigned iv=0; iv<nVertices; ++iv ) {
794 double zV = (*theVertices)[iv].z();
796 double checkRZ1 = forward ?
799 double checkRZ2 = forward ?
805 bool compat = forward ?
806 checkRZmin < R1 && R1 < checkRZmax :
807 checkRZmin < thePos1.Z()-zV && thePos1.Z()-zV < checkRZmax;
809 if ( compat )
return compat;
bool compatibleWithBeamAxis(GlobalPoint &gpos1, GlobalPoint &gpos2, double error, bool forward, unsigned algo) const
void setCharge(float q)
set the MEASURED charge
T getParameter(std::string const &) const
std::vector< unsigned > minRecHits
std::pair< const_iterator, const_iterator > range
iterator range
double zImpactParameter(double x0=0, double y0=0.) const
Longitudinal impact parameter.
std::vector< unsigned int > firstHitSubDetectorNumber
virtual void beginRun(edm::Run const &run, const edm::EventSetup &es) override
TrajectorySeedProducer(const edm::ParameterSet &conf)
const LocalTrajectoryParameters & localParameters() const
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
std::vector< double > pTMin
Geom::Phi< T > phi() const
bool propagateToBeamCylinder(const XYZTLorentzVector &v, double radius=0.)
std::vector< Vertex > VertexCollection
collection of Vertex objects
std::vector< double > originRadius
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const MagneticFieldMap * theFieldMap
void stateOnDet(const TrajectoryStateOnSurface &ts, unsigned int detid, PTrajectoryStateOnDet &pts) const
A mere copy (without memory leak) of an existing tracking method.
std::vector< std::string > layerList
std::vector< double > originpTMin
const Plane & surface() const
The nominal surface of the GeomDet.
GlobalPoint globalPosition() const
The global position.
LocalError positionError() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
static int position[TOTALCHAMBERS][3]
edm::InputTag hitProducer
bool isOnTheSameLayer(const TrackerRecHit &other) const
Check if two hits are on the same layer of the same subdetector.
std::vector< unsigned int > numberOfHits
uint32_t rawId() const
get the raw id
LocalVector localMomentum() const
PropagatorWithMaterial * thePropagator
double R() const
vertex radius
static const double pts[33]
unsigned int absMinRecHits
C::const_iterator const_iterator
constant access iterator type
std::vector< std::vector< unsigned int > > secondHitSubDetectors
virtual void produce(edm::Event &e, const edm::EventSetup &es) override
std::vector< TrajectorySeed > TrajectorySeedCollection
const T & max(const T &a, const T &b)
std::vector< std::vector< unsigned int > > thirdHitSubDetectors
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
std::vector< double > zVertexConstraint
SurfaceSide surfaceSide() const
Position relative to material, defined relative to momentum vector.
virtual ~TrajectorySeedProducer()
double Z() const
z of vertex
const AlgebraicSymMatrix55 & matrix() const
const math::XYZTLorentzVectorD & position() const
const LocalTrajectoryError & localError() const
const TrackerGeometry * theGeometry
virtual const GeomDet * idToDet(DetId) const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
GlobalVector momentum() const
std::vector< unsigned int > thirdHitSubDetectorNumber
virtual TrackingRecHit * clone() const =0
int vertIndex() const
index of the vertex in the Event container (-1 if no vertex)
bool isForward() const
Is it a forward hit ?
XYZPointD XYZPoint
point in space with cartesian internal representation
std::vector< unsigned int > secondHitSubDetectorNumber
T const * product() const
unsigned int layerNumber() const
The Layer Number.
edm::InputTag theBeamSpot
ESHandle< TrackerGeometry > geometry
int type() const
particle type (HEP PDT convension)
bool isOnRequestedDet(const std::vector< unsigned int > &whichDet, const std::string &seedingAlgo) const
Check if the hit is on one of the requested detector.
GlobalVector globalMomentum() const
std::vector< const reco::VertexCollection * > vertices
std::vector< double > originHalfLength
const math::XYZTLorentzVectorD & momentum() const
particle info...
std::vector< double > maxZ0
unsigned int subDetId() const
The subdet Id.
std::vector< std::string > seedingAlgo
std::vector< edm::InputTag > primaryVertices
std::vector< std::vector< unsigned int > > firstHitSubDetectors
std::vector< double > maxD0
DetId geographicalId() const
double xyImpactParameter(double x0=0., double y0=0.) const
Transverse impact parameter.
math::XYZTLorentzVector XYZTLorentzVector
const MagneticField * theMagField