13 std::sort(secTracks.begin(),secTracks.end(),
cmpTracks());
16 if( secTracks.size() != 0) {
34 track->momentum().y(),
35 track->momentum().z());
46 LogDebug(
"NuclearInteractionMaker") <<
"Vertex build from the end point of the primary track";
48 primTrack->outerPosition().y(),
49 primTrack->outerPosition().z()),
52 for(
unsigned short i=0;
i != secTracks.size();
i++) {
58 std::vector<reco::TransientTrack> transientTracks;
61 for(
unsigned short i=0;
i != secTracks.size();
i++ ) {
64 if( transientTracks.size() == 1 )
return false;
72 LogDebug(
"NuclearInteractionMaker") << exception.
what() <<
"\n";
77 LogDebug(
"NuclearInteractionMaker") << exception.
what() <<
"\n";
90 unsigned short maxHits = 0;
int indice=-1;
91 for(
unsigned short i=0;
i < secTracks.size();
i++) {
93 unsigned short nhits = secTracks[
i]->numberOfValidHits();
94 if( nhits > maxHits ) { maxHits =
nhits; indice=
i; }
98 if(indice == -1)
return false;
112 for(
unsigned short i=0;
i < secTracks.size();
i++) {
124 if( status ) {
return theApproach; }
141 const double& distOfClosestApp,
143 float TRACKER_RADIUS=129;
144 double pt2 = secTrack->pt();
145 double Dpt2 = secTrack->ptError();
146 double p1 = primTrack->p();
147 double Dp1 = primTrack->qoverpError()*p1*
p1;
148 double p2 = secTrack->p();
149 double Dp2 = secTrack->qoverpError()*p2*
p2;
151 std::cout <<
"2)" << secTrack->normalizedChi2() <<
" < " <<
chi2Cut_ <<
" " << (secTrack->normalizedChi2() <
chi2Cut_) <<
"\n";
152 std::cout <<
"3)" << crossPoint.
perp() <<
" < " << TRACKER_RADIUS <<
" " << (crossPoint.
perp() < TRACKER_RADIUS) <<
"\n";
154 std::cout <<
"5)" << (p2-2*Dp2) <<
" < " << (p1+2*Dp1) <<
" " << ((p2-2*Dp2) < (p1+2*Dp1))<<
"\n";
156 secTrack->normalizedChi2() <
chi2Cut_ &&
157 crossPoint.
perp() < TRACKER_RADIUS &&
159 (p2-2*Dp2) < (p1+2*Dp1))
return true;
172 float dist =
sqrt((crp.
x()-vtx.x())*(crp.
x()-vtx.x()) +
173 (crp.
y()-vtx.y())*(crp.
y()-vtx.y()) +
174 (crp.
z()-vtx.z())*(crp.
z()-vtx.z()));
191 std::vector<reco::TrackRef> allSecondary;
195 allSecondary.push_back( secTrack );
200 std::vector<reco::TrackRef>& tC)
const {
203 LogDebug(
"NuclearInteractionMaker") <<
"cleanTrackCollection number of input tracks : " << tC.size();
204 std::map<std::vector<reco::TrackRef>::const_iterator, std::vector<const TrackingRecHit*> > rh;
207 std::vector<bool> selected(tC.size(),
false);
209 for (std::vector<reco::TrackRef>::const_iterator track=tC.begin(); track!=tC.end(); track++){
216 rh[track].push_back(hit);
224 for (std::vector<reco::TrackRef>::const_iterator track=tC.begin(); track!=tC.end(); track++){
227 for (std::vector<reco::TrackRef>::const_iterator track2=tC.begin(); track2!=tC.end(); track2++){
229 if ((!selected[j])||(!selected[
i]))
continue;
232 std::vector<const TrackingRecHit*>& iHits = rh[track];
233 for (
unsigned ih=0; ih<iHits.size(); ++ih ) {
236 std::vector<const TrackingRecHit*>& jHits = rh[track2];
237 for (
unsigned ih2=0; ih2<jHits.size(); ++ih2 ) {
246 float fi=float(noverlap)/float((*track)->recHitsSize());
247 float fj=float(noverlap)/float((*track2)->recHitsSize());
255 if ((*track)->normalizedChi2() > (*track2)->normalizedChi2()){selected[
i]=
false;}
else{selected[
j]=
false;}
262 std::vector< reco::TrackRef > newTrackColl;
264 for (std::vector<reco::TrackRef>::const_iterator track=tC.begin(); track!=tC.end(); track++){
265 if( selected[i] ) newTrackColl.push_back( *track );
272 std::vector<reco::TrackRef>& tC)
const {
274 for(
size_t i=0;
i< tC.size(); ++
i) {
275 totalEnergy += tC[
i]->p();
277 if( totalEnergy > primTrack->p()+0.1*primTrack->p() ) {
virtual char const * what() const
void addSecondaryTrack(const reco::TrackRef &secTrack)
trackRef_iterator tracks_end() const
last iterator over tracks
double zError() const
error on z
bool isValid() const
Tells whether the vertex is valid.
reco::TransientTrack build(const reco::Track *p) const
virtual bool sharesInput(const TrackingRecHit *other, SharedInputType what) const
math::Error< dimension >::type Error
covariance error matrix (3x3)
void build(const reco::TrackRef &primaryTrack, std::vector< reco::TrackRef > &secondaryTrack)
const Point & position() const
position
const TransientTrackBuilder * theTransientTrackBuilder
virtual GlobalPoint crossingPoint() const
ClosestApproachInRPhi * closestApproach(const reco::TrackRef &primTrack, const reco::TrackRef &secTrack) const
virtual const char * what() const
virtual CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &) const
bool isCompatible(const reco::TrackRef &secTrack) const
void checkEnergy(const reco::TrackRef &primTrack, std::vector< reco::TrackRef > &tC) const
math::XYZPoint Point
point in the space
void FillVertexWithLastPrimHit(const reco::TrackRef &primTrack, const std::vector< reco::TrackRef > &secTracks)
void add(const TrackBaseRef &r, float w=1.0)
add a reference to a Track
double xError() const
error on x
virtual bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb)
XYZPointD XYZPoint
point in space with cartesian internal representation
static int position[264][3]
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
bool FillVertexWithCrossingPoint(const reco::TrackRef &primTrack, const std::vector< reco::TrackRef > &secTracks)
FreeTrajectoryState getTrajectory(const reco::TrackRef &track) const
bool isGoodSecondaryTrack(const reco::TrackRef &primTrack, const reco::TrackRef &secTrack) const
trackRef_iterator tracks_begin() const
first iterator over tracks
const MagneticField * theMagField
virtual float distance() const
void cleanTrackCollection(const reco::TrackRef &primTrack, std::vector< reco::TrackRef > &tC) const
double yError() const
error on y
size_t tracksSize() const
number of tracks
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
bool FillVertexWithAdaptVtxFitter(const reco::TrackRef &primTrack, const std::vector< reco::TrackRef > &secTracks)