51 for (
unsigned i=0;
i<seedingAlgo.size(); ++
i )
52 produces<TrajectorySeedCollection>(seedingAlgo[
i]);
56 if (
pTMin.size() != seedingAlgo.size() )
58 <<
" WARNING : pTMin does not have the proper size "
61 for (
unsigned i=0; i<
pTMin.size(); ++
i )
68 <<
" WARNING : minRecHits does not have the proper size "
72 for (
unsigned ialgo=0; ialgo<
minRecHits.size(); ++ialgo )
77 if (
maxD0.size() != seedingAlgo.size() )
79 <<
" WARNING : maxD0 does not have the proper size "
83 if (
maxZ0.size() != seedingAlgo.size() )
85 <<
" WARNING : maxZ0 does not have the proper size "
96 if ( numberOfHits.size() != seedingAlgo.size() )
98 <<
" WARNING : numberOfHits does not have the proper size "
110 for(std::vector<std::string>::const_iterator it=layerList.begin(); it < layerList.end(); ++it) {
111 std::vector<LayerSpec> tempResult;
114 while (pos != std::string::npos) {
119 layerSpec.
name = line.substr(0, pos);;
122 if (layerSpec.
name.substr(0,4)==
"BPix" ) {
125 layerSpec.
idLayer = std::atoi(layerSpec.
name.substr(4,1).c_str());
128 <<
"Bad data naming in IterativeInitialStep_cff.py iterativeInitialSeeds.layerList" << std::endl
129 <<
"Layers: " << layerSpec.
name <<
", number needs to be in range 1-3" << std::endl;
133 else if (layerSpec.
name.substr(0,4)==
"FPix" ) {
135 if(layerSpec.
name.substr(layerSpec.
name.size()-3)==
"pos")
139 layerSpec.
idLayer = std::atoi(layerSpec.
name.substr(4,1).c_str());
142 <<
"Bad data naming in IterativeInitialStep_cff.py iterativeInitialSeeds.layerList" << std::endl
143 <<
"Layers: " << layerSpec.
name <<
", number needs to be in range 1-2" << std::endl;
147 else if (layerSpec.
name.substr(0,3)==
"TIB" || layerSpec.
name.substr(0,4)==
"MTIB") {
150 layerSpec.
idLayer = std::atoi(layerSpec.
name.substr(layerSpec.
name.find(
'B')+1,1).c_str());
153 <<
"Bad data naming in IterativeInitialStep_cff.py iterativeInitialSeeds.layerList" << std::endl
154 <<
"Layers: " << layerSpec.
name <<
", number needs to be in range 1-4" << std::endl;
158 else if (layerSpec.
name.substr(0,3)==
"TID" || layerSpec.
name.substr(0,4)==
"MTID") {
160 if(layerSpec.
name.substr(layerSpec.
name.size()-3)==
"pos")
164 layerSpec.
idLayer = std::atoi(layerSpec.
name.substr(layerSpec.
name.find(
'D')+1,1).c_str());
167 <<
"Bad data naming in IterativeInitialStep_cff.py iterativeInitialSeeds.layerList" << std::endl
168 <<
"Layers: " << layerSpec.
name <<
", number needs to be in range 1-3" << std::endl;
172 else if (layerSpec.
name.substr(0,3)==
"TOB" ) {
175 layerSpec.
idLayer = std::atoi(layerSpec.
name.substr(3,1).c_str());
178 <<
"Bad data naming in IterativeInitialStep_cff.py iterativeInitialSeeds.layerList" << std::endl
179 <<
"Layers: " << layerSpec.
name <<
", number needs to be in range 1-6" << std::endl;
183 else if (layerSpec.
name.substr(0,3)==
"TEC" || layerSpec.
name.substr(0,4)==
"MTEC") {
185 if(layerSpec.
name.substr(layerSpec.
name.size()-3)==
"pos")
189 layerSpec.
idLayer = std::atoi(layerSpec.
name.substr(layerSpec.
name.find(
'C')+1,1).c_str());
192 <<
"Bad data naming in IterativeInitialStep_cff.py iterativeInitialSeeds.layerList" << std::endl
193 <<
"Layers: " << layerSpec.
name <<
", number needs to be in range 1-9" << std::endl;
198 <<
"Bad data naming in IterativeInitialStep_cff.py iterativeInitialSeeds.layerList" << std::endl
199 <<
"Layer: " << layerSpec.
name <<
", shouldn't exist" << std::endl
200 <<
"Case sensitive names: BPix FPix TIB MTIB TID MTID TOB TEC MTEC" << std::endl;
203 tempResult.push_back(layerSpec);
204 line=line.substr(pos+1,std::string::npos);
219 conf.
getParameter<std::vector<unsigned int> >(
"firstHitSubDetectorNumber");
222 <<
" WARNING : firstHitSubDetectorNumber does not have the proper size "
225 std::vector<unsigned int> firstSubDets =
226 conf.
getParameter<std::vector<unsigned int> >(
"firstHitSubDetectors");
236 if ( firstSubDets.size() != check1 )
238 <<
" WARNING : firstHitSubDetectors does not have the proper size (should be " << check1 <<
")"
243 conf.
getParameter<std::vector<unsigned int> >(
"secondHitSubDetectorNumber");
246 <<
" WARNING : secondHitSubDetectorNumber does not have the proper size "
249 std::vector<unsigned int> secondSubDets =
250 conf.
getParameter<std::vector<unsigned int> >(
"secondHitSubDetectors");
260 if ( secondSubDets.size() != check2 )
262 <<
" WARNING : secondHitSubDetectors does not have the proper size (should be " << check2 <<
")"
266 conf.
getParameter<std::vector<unsigned int> >(
"thirdHitSubDetectorNumber");
269 <<
" WARNING : thirdHitSubDetectorNumber does not have the proper size "
272 std::vector<unsigned int> thirdSubDets =
273 conf.
getParameter<std::vector<unsigned int> >(
"thirdHitSubDetectors");
283 if ( thirdSubDets.size() != check3 )
285 <<
" WARNING : thirdHitSubDetectors does not have the proper size (should be " << check3 <<
")"
292 <<
" WARNING : originRadius does not have the proper size "
298 <<
" WARNING : originHalfLength does not have the proper size "
304 <<
" WARNING : originpTMin does not have the proper size "
310 <<
" WARNING : primaryVertices does not have the proper size "
316 <<
" WARNING : zVertexConstraint does not have the proper size "
326 for (
unsigned ialgo=0; ialgo<seedingAlgo.size(); ++ialgo ) {
339 std::cout <<
"TrajectorySeedProducer destructed" << std::endl;
377 std::cout <<
"################################################################" << std::endl;
378 std::cout <<
" TrajectorySeedProducer produce init " << std::endl;
387 unsigned nSimTracks = 0;
388 unsigned nTracksWithHits = 0;
389 unsigned nTracksWithPT = 0;
390 unsigned nTracksWithD0Z0 = 0;
395 std::vector<TrajectorySeedCollection*>
397 for (
unsigned ialgo=0; ialgo<
seedingAlgo.size(); ++ialgo ) {
412 x0 = BSPosition_.X();
413 y0 = BSPosition_.Y();
414 z0 = BSPosition_.Z();
424 std::cout <<
" Step A: SimTracks found " << theSimTracks->size() << std::endl;
433 std::cout <<
" Step B: Full GS RecHits found " << theGSRecHits->size() << std::endl;
435 if(theGSRecHits->size() == 0) {
436 for (
unsigned ialgo=0; ialgo<
seedingAlgo.size(); ++ialgo ) {
437 std::auto_ptr<TrajectorySeedCollection>
p(output[ialgo]);
444 vertices = std::vector<const reco::VertexCollection*>
446 for (
unsigned ialgo=0; ialgo<
seedingAlgo.size(); ++ialgo ) {
451 if (!isVertexCollection )
continue;
456 std::cout <<
" Step C: Loop over the RecHits, track by track " << std::endl;
460 const std::vector<unsigned> theSimTrackIds = theGSRecHits->ids();
463 for (
unsigned tkId=0; tkId != theSimTrackIds.size(); ++tkId ) {
466 std::cout <<
"Track number " << tkId << std::endl;
470 unsigned simTrackId = theSimTrackIds[tkId];
471 const SimTrack& theSimTrack = (*theSimTracks)[simTrackId];
474 <<
" eta " << theSimTrack.
momentum().Eta()
475 <<
" pdg ID " << theSimTrack.
type()
483 int vertexIndex = theSimTrack.
vertIndex();
484 const SimVertex& theSimVertex = (*theSimVtx)[vertexIndex];
486 std::cout <<
" o SimTrack " << theSimTrack << std::endl;
487 std::cout <<
" o SimVertex " << theSimVertex << std::endl;
501 theParticle.
setCharge((*theSimTracks)[simTrackId].charge());
512 unsigned numberOfRecHits = 0;
514 for ( iterRecHit = theRecHitRangeIteratorBegin;
515 iterRecHit != theRecHitRangeIteratorEnd;
517 previousHit = currentHit;
525 for (
unsigned int ialgo = 0; ialgo <
seedingAlgo.size(); ++ialgo ) {
532 std::cout <<
"The number of RecHits = " << numberOfRecHits << std::endl;
534 if ( numberOfRecHits <
minRecHits[ialgo] )
continue;
538 if ( theSimTrack.
momentum().Perp2() <
pTMin[ialgo] )
continue;
546 std::vector<TrackerRecHit >
553 bool compatible =
false;
555 for ( iterRecHit1 = theRecHitRangeIteratorBegin; iterRecHit1 != theRecHitRangeIteratorEnd; ++iterRecHit1) {
560 std::cout <<
"The first hit subDetId = " << theSeedHits0.
subDetId() << std::endl;
564 bool isInside =
true;
572 if ( isInside )
continue;
586 if ( !isOndet )
continue;
590 std::cout <<
"Apparently the first hit is on the requested detector! " << std::endl;
592 for ( iterRecHit2 = iterRecHit1+1; iterRecHit2 != theRecHitRangeIteratorEnd; ++iterRecHit2) {
596 std::cout <<
"The second hit subDetId = " << theSeedHits1.
subDetId() << std::endl;
606 if ( isInside )
continue;
610 isOndet = theSeedHits[0].isOnRequestedDet(
theLayersInSets, theSeedHits[1]);
613 if ( !isOndet )
break;
619 std::cout <<
"Apparently the second hit is on the requested detector! " << std::endl;
635 std::cout <<
"Algo" <<
seedingAlgo[0] <<
"\t Are the two hits compatible with the PV? " << compatible << std::endl;
638 if ( !compatible )
continue;
649 for ( iterRecHit3 = iterRecHit2+1; iterRecHit3 != theRecHitRangeIteratorEnd; ++iterRecHit3) {
654 std::cout <<
"The third hit subDetId = " << theSeedHits2.
subDetId() << std::endl;
664 if ( isInside )
continue;
668 isOndet = theSeedHits[0].isOnRequestedDet(
theLayersInSets, theSeedHits[1], theSeedHits[2]);
672 if ( !isOndet )
continue;
680 std::cout <<
"Apparently the third hit is on the requested detector! " << std::endl;
683 if ( compatible )
break;
687 if ( compatible )
break;
691 if ( compatible )
break;
697 if ( !compatible )
continue;
700 std::cout <<
"@@@ There is at least a compatible seed" << std::endl;
702 std::cout <<
"@@@ There is no compatible seed" << std::endl;
707 std::cout <<
"Preparing to create the TrajectorySeed" << std::endl;
712 for (
unsigned ih=0; ih<theSeedHits.size(); ++ih ) {
717 std::cout <<
"with " << recHits.
size() <<
" hits." << std::endl;
723 (*theSimVtx)[vertexIndex].
position().
y(),
724 (*theSimVtx)[vertexIndex].
position().
z());
727 GlobalVector momentum( (*theSimTracks)[simTrackId].momentum().
x() ,
728 (*theSimTracks)[simTrackId].momentum().
y() ,
729 (*theSimTracks)[simTrackId].momentum().
z() );
731 float charge = (*theSimTracks)[simTrackId].charge();
740 if(theSeedHits0.
subDetId() !=1 || theSeedHits0.
subDetId() !=2) errorMatrix = errorMatrix * 0.0000001;
745 std::cout <<
"TrajectorySeedProducer: SimTrack parameters " << std::endl;
746 std::cout <<
"\t\t pT = " << (*theSimTracks)[simTrackId].momentum().Pt() << std::endl;
747 std::cout <<
"\t\t eta = " << (*theSimTracks)[simTrackId].momentum().Eta() << std::endl;
748 std::cout <<
"\t\t phi = " << (*theSimTracks)[simTrackId].momentum().Phi() << std::endl;
749 std::cout <<
"TrajectorySeedProducer: AlgebraicSymMatrix " << errorMatrix << std::endl;
755 std::cout <<
"TrajectorySeedProducer: FTS momentum " << initialFTS.
momentum() << std::endl;
764 if (!initialTSOS.
isValid())
continue;
774 std::cout <<
"TrajectorySeedProducer: TSOS surface side " << initialTSOS.
surfaceSide() << std::endl;
782 std::cout <<
"Trajectory seed created ! " << std::endl;
790 for (
unsigned ialgo=0; ialgo<
seedingAlgo.size(); ++ialgo ) {
791 std::auto_ptr<TrajectorySeedCollection>
p(output[ialgo]);
813 float localErrors[15];
815 for (
int i=0;
i<dim; ++
i) {
816 for (
int j=0;
j<=
i; ++
j) {
817 localErrors[k++] =
m(
i,
j);
820 int surfaceSide =
static_cast<int>(ts.
surfaceSide());
832 unsigned algo)
const {
840 std::cout <<
"ThePos1 = " << thePos1 << std::endl;
841 std::cout <<
"ThePos2 = " << thePos2 << std::endl;
859 if ( !intersect )
return false;
862 std::cout <<
"MyPart R = " << myPart.
R() <<
"\t Z = " << myPart.
Z()
863 <<
"\t pT = " << myPart.Pt() << std::endl;
868 if ( myPart.Pt() <
originpTMin[algo] )
return false;
875 if (!theVertices)
return true;
876 unsigned nVertices = theVertices->size();
880 + (thePos1.Y()-
y0)*(thePos1.Y()-
y0) );
882 + (thePos2.Y()-
y0)*(thePos2.Y()-
y0) );
884 for (
unsigned iv=0; iv<nVertices; ++iv ) {
886 double zV = (*theVertices)[iv].z();
888 double checkRZ1 = forward ?
891 double checkRZ2 = forward ?
897 bool compat = forward ?
898 checkRZmin < R1 && R1 < checkRZmax :
899 checkRZmin < thePos1.Z()-zV && thePos1.Z()-zV < checkRZmax;
901 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
std::vector< std::vector< LayerSpec > > theLayersInSets
TrajectorySeedProducer(const edm::ParameterSet &conf)
const LocalTrajectoryParameters & localParameters() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
std::vector< double > pTMin
Geom::Phi< T > phi() const
std::vector< edm::EDGetTokenT< reco::VertexCollection > > recoVertexToken
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< double > originpTMin
const Plane & surface() const
The nominal surface of the GeomDet.
GlobalPoint globalPosition() const
The global position.
edm::EDGetTokenT< SiTrackerGSMatchedRecHit2DCollection > recHitToken
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
Abs< T >::type abs(const T &t)
const AlgebraicSymMatrix55 & matrix() const
const math::XYZTLorentzVectorD & position() const
const LocalTrajectoryError & localError() const
const TrackerGeometry * theGeometry
edm::EDGetTokenT< edm::SimVertexContainer > simVertexToken
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 ?
edm::EDGetTokenT< edm::SimTrackContainer > simTrackToken
virtual TrackingRecHit const * hit() const
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
std::vector< double > maxZ0
unsigned int subDetId() const
The subdet Id.
std::vector< std::string > seedingAlgo
std::vector< edm::InputTag > primaryVertices
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken
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
virtual const TrackerGeomDet * idToDet(DetId) const
const MagneticField * theMagField