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 "
108 conf.
getParameter<std::vector<unsigned int> >(
"firstHitSubDetectorNumber");
111 <<
" WARNING : firstHitSubDetectorNumber does not have the proper size "
114 std::vector<unsigned int> firstSubDets =
115 conf.
getParameter<std::vector<unsigned int> >(
"firstHitSubDetectors");
125 if ( firstSubDets.size() != check1 )
127 <<
" WARNING : firstHitSubDetectors does not have the proper size (should be " << check1 <<
")"
132 conf.
getParameter<std::vector<unsigned int> >(
"secondHitSubDetectorNumber");
135 <<
" WARNING : secondHitSubDetectorNumber does not have the proper size "
138 std::vector<unsigned int> secondSubDets =
139 conf.
getParameter<std::vector<unsigned int> >(
"secondHitSubDetectors");
149 if ( secondSubDets.size() != check2 )
151 <<
" WARNING : secondHitSubDetectors does not have the proper size (should be " << check2 <<
")"
155 conf.
getParameter<std::vector<unsigned int> >(
"thirdHitSubDetectorNumber");
158 <<
" WARNING : thirdHitSubDetectorNumber does not have the proper size "
161 std::vector<unsigned int> thirdSubDets =
162 conf.
getParameter<std::vector<unsigned int> >(
"thirdHitSubDetectors");
172 if ( thirdSubDets.size() != check3 )
174 <<
" WARNING : thirdHitSubDetectors does not have the proper size (should be " << check3 <<
")"
180 <<
" WARNING : originRadius does not have the proper size "
186 <<
" WARNING : originHalfLength does not have the proper size "
192 <<
" WARNING : originpTMin does not have the proper size "
198 <<
" WARNING : primaryVertices does not have the proper size "
204 <<
" WARNING : zVertexConstraint does not have the proper size "
218 std::cout <<
"TrajectorySeedProducer destructed" << std::endl;
256 std::cout <<
"################################################################" << std::endl;
257 std::cout <<
" TrajectorySeedProducer produce init " << std::endl;
262 unsigned nSimTracks = 0;
263 unsigned nTracksWithHits = 0;
264 unsigned nTracksWithPT = 0;
265 unsigned nTracksWithD0Z0 = 0;
270 std::vector<TrajectorySeedCollection*>
272 for (
unsigned ialgo=0; ialgo<
seedingAlgo.size(); ++ialgo ) {
287 x0 = BSPosition_.X();
288 y0 = BSPosition_.Y();
289 z0 = BSPosition_.Z();
299 std::cout <<
" Step A: SimTracks found " << theSimTracks->size() << std::endl;
308 std::cout <<
" Step B: Full GS RecHits found " << theGSRecHits->size() << std::endl;
310 if(theGSRecHits->size() == 0) {
311 for (
unsigned ialgo=0; ialgo<
seedingAlgo.size(); ++ialgo ) {
312 std::auto_ptr<TrajectorySeedCollection>
p(output[ialgo]);
319 vertices = std::vector<const reco::VertexCollection*>
321 for (
unsigned ialgo=0; ialgo<
seedingAlgo.size(); ++ialgo ) {
327 if (!isVertexCollection )
continue;
332 std::cout <<
" Step C: Loop over the RecHits, track by track " << std::endl;
336 const std::vector<unsigned> theSimTrackIds = theGSRecHits->ids();
339 for (
unsigned tkId=0; tkId != theSimTrackIds.size(); ++tkId ) {
342 std::cout <<
"Track number " << tkId << std::endl;
346 unsigned simTrackId = theSimTrackIds[tkId];
347 const SimTrack& theSimTrack = (*theSimTracks)[simTrackId];
350 <<
" eta " << theSimTrack.
momentum().Eta()
355 int vertexIndex = theSimTrack.
vertIndex();
356 const SimVertex& theSimVertex = (*theSimVtx)[vertexIndex];
358 std::cout <<
" o SimTrack " << theSimTrack << std::endl;
359 std::cout <<
" o SimVertex " << theSimVertex << std::endl;
384 unsigned numberOfRecHits = 0;
386 for ( iterRecHit = theRecHitRangeIteratorBegin;
387 iterRecHit != theRecHitRangeIteratorEnd;
389 previousHit = currentHit;
397 for (
unsigned int ialgo = 0; ialgo <
seedingAlgo.size(); ++ialgo ) {
405 std::cout <<
"The number of RecHits = " << numberOfRecHits << std::endl;
407 if ( numberOfRecHits <
minRecHits[ialgo] )
continue;
411 if ( theSimTrack.
momentum().Perp2() <
pTMin[ialgo] )
continue;
419 std::vector<TrackerRecHit >
425 bool compatible =
false;
426 for ( iterRecHit1 = theRecHitRangeIteratorBegin; iterRecHit1 != theRecHitRangeIteratorEnd; ++iterRecHit1) {
430 std::cout <<
"The first hit subDetId = " << theSeedHits0.
subDetId() << std::endl;
436 if ( isInside )
continue;
442 if ( !isOndet )
continue;
445 std::cout <<
"Apparently the first hit is on the requested detector! " << std::endl;
447 for ( iterRecHit2 = iterRecHit1+1; iterRecHit2 != theRecHitRangeIteratorEnd; ++iterRecHit2) {
451 std::cout <<
"The second hit subDetId = " << theSeedHits1.
subDetId() << std::endl;
457 if ( isInside )
continue;
461 if ( !isOndet )
break;
467 std::cout <<
"Apparently the second hit is on the requested detector! " << std::endl;
483 std::cout <<
"Algo" <<
seedingAlgo[0] <<
"\t Are the two hits compatible with the PV? " << compatible << std::endl;
490 compatible = compatible && theSeedHits[0].makesAPairWith3rd(theSeedHits[1]);
503 compatible = compatible && theSeedHits[0].makesAPairWith(theSeedHits[1]);
515 if ( !compatible )
continue;
526 for ( iterRecHit3 = iterRecHit2+1; iterRecHit3 != theRecHitRangeIteratorEnd; ++iterRecHit3) {
530 std::cout <<
"The third hit subDetId = " << theSeedHits2.
subDetId() << std::endl;
536 if ( isInside )
continue;
541 if ( !isOndet )
continue;
547 compatible = compatible && theSeedHits[0].makesATripletWith(theSeedHits[1],theSeedHits[2]);
551 std::cout <<
"Apparently the third hit is on the requested detector! " << std::endl;
554 if ( compatible )
break;
558 if ( compatible )
break;
562 if ( compatible )
break;
568 if ( !compatible )
continue;
571 std::cout <<
"Preparing to create the TrajectorySeed" << std::endl;
576 for (
unsigned ih=0; ih<theSeedHits.size(); ++ih ) {
581 std::cout <<
"with " << recHits.
size() <<
" hits." << std::endl;
587 (*theSimVtx)[vertexIndex].
position().
y(),
588 (*theSimVtx)[vertexIndex].
position().
z());
591 GlobalVector momentum( (*theSimTracks)[simTrackId].momentum().
x() ,
592 (*theSimTracks)[simTrackId].momentum().
y() ,
593 (*theSimTracks)[simTrackId].momentum().
z() );
595 float charge = (*theSimTracks)[simTrackId].charge();
604 if(theSeedHits0.
subDetId() !=1 || theSeedHits0.
subDetId() !=2) errorMatrix = errorMatrix * 0.0000001;
609 std::cout <<
"TrajectorySeedProducer: SimTrack parameters " << std::endl;
610 std::cout <<
"\t\t pT = " << (*theSimTracks)[simTrackId].momentum().Pt() << std::endl;
611 std::cout <<
"\t\t eta = " << (*theSimTracks)[simTrackId].momentum().Eta() << std::endl;
612 std::cout <<
"\t\t phi = " << (*theSimTracks)[simTrackId].momentum().Phi() << std::endl;
613 std::cout <<
"TrajectorySeedProducer: AlgebraicSymMatrix " << errorMatrix << std::endl;
619 std::cout <<
"TrajectorySeedProducer: FTS momentum " << initialFTS.
momentum() << std::endl;
628 if (!initialTSOS.
isValid())
continue;
638 std::cout <<
"TrajectorySeedProducer: TSOS surface side " << initialTSOS.
surfaceSide() << std::endl;
646 std::cout <<
"Trajectory seed created ! " << std::endl;
654 for (
unsigned ialgo=0; ialgo<
seedingAlgo.size(); ++ialgo ) {
655 std::auto_ptr<TrajectorySeedCollection>
p(output[ialgo]);
676 float localErrors[15];
678 for (
int i=0;
i<dim; ++
i) {
679 for (
int j=0;
j<=
i; ++
j) {
680 localErrors[k++] =
m(
i,
j);
683 int surfaceSide =
static_cast<int>(ts.
surfaceSide());
695 unsigned algo)
const {
703 std::cout <<
"ThePos1 = " << thePos1 << std::endl;
704 std::cout <<
"ThePos2 = " << thePos2 << std::endl;
722 if ( !intersect )
return false;
725 std::cout <<
"MyPart R = " << myPart.
R() <<
"\t Z = " << myPart.
Z()
726 <<
"\t pT = " << myPart.Pt() << std::endl;
738 if (!theVertices)
return true;
739 unsigned nVertices = theVertices->size();
743 + (thePos1.Y()-
y0)*(thePos1.Y()-
y0) );
745 + (thePos2.Y()-
y0)*(thePos2.Y()-
y0) );
747 for (
unsigned iv=0; iv<nVertices; ++iv ) {
749 double zV = (*theVertices)[iv].z();
751 double checkRZ1 = forward ?
754 double checkRZ2 = forward ?
760 bool compat = forward ?
761 checkRZmin < R1 && R1 < checkRZmax :
762 checkRZmin < thePos1.Z()-zV && thePos1.Z()-zV < checkRZmax;
764 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
TrajectorySeedProducer(const edm::ParameterSet &conf)
const LocalTrajectoryParameters & localParameters() const
virtual void beginRun(edm::Run &run, const edm::EventSetup &es)
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
std::vector< double > pTMin
Geom::Phi< T > phi() const
bool propagateToBeamCylinder(const XYZTLorentzVector &v, double radius=0.)
virtual void produce(edm::Event &e, const edm::EventSetup &es)
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< double > originpTMin
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
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
virtual TrajectoryStateOnSurface propagate(const TrajectoryStateOnSurface &tsos, const Plane &plane) const
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
unsigned int layerNumber() const
The Layer Number.
edm::InputTag theBeamSpot
static bool intersect(Range &range, const Range &second)
ESHandle< TrackerGeometry > geometry
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
const BoundPlane & surface() const
The nominal surface of the GeomDet.
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