6 #include "boost/intrusive_ptr.hpp" 15 template<
typename DataContainer>
16 unsigned short countTrailingValidHits(DataContainer
const & meas) {
18 for(
auto it=meas.rbegin(); it!=meas.rend(); ++it) {
20 if((*it).recHit()->isValid()) ++n;
31 if(theData.back().recHit()->isValid()) {
32 theNumberOfFoundHits--;
33 theChiSquared -= theData.back().estimate();
34 if(badForCCC(theData.back())) theNumberOfCCCBadHits_--;
35 if(
pixel(*(theData.back().recHit()))) theNumberOfFoundPixelHits--;
37 else if(lost(* (theData.back().recHit()) )) {
38 theNumberOfLostHits--;
40 else if(isBad(* (theData.back().recHit()) ) && theData.back().recHit()->geographicalId().det()==
DetId::Muon ) {
41 theChiSquaredBad -= theData.back().estimate();
45 theNumberOfTrailingFoundHits=countTrailingValidHits(theData);
56 push( tm, tm.estimate());
62 theData.push_back(tm); pushAux(chi2Increment);
66 theData.push_back(tm); pushAux(chi2Increment);
72 if ( tm.
recHit()->isValid()) {
73 theChiSquared += chi2Increment;
74 theNumberOfFoundHits++;
75 theNumberOfTrailingFoundHits++;
76 if (badForCCC(tm)) theNumberOfCCCBadHits_++;
77 if(
pixel(*(tm.
recHit()))) theNumberOfFoundPixelHits++;
80 else if (lost( *(tm.
recHit()) ) ) {
81 theNumberOfLostHits++;
82 theNumberOfTrailingFoundHits=0;
86 theChiSquaredBad += chi2Increment;
92 if ( !theDirectionValidity && theData.size() >= 2) {
94 theData.back().updatedState().globalPosition().perp2())
97 theDirectionValidity =
true;
108 for(
auto & rechit : transRecHits) {
109 if((rechit)->isValid())
111 else if( isBad(*rechit) && (rechit)->geographicalId().det()==
DetId::Muon )
112 dofBad += (rechit)->dimension();
120 int constr = bon ? 5 : 4;
127 int constr = bon ? 5 : 4;
128 return std::max(dofBad - constr, 1);
134 hits.reserve(foundHits());
135 for (
auto const & tm : theData)
136 if (tm.recHit()->isValid()) hits.push_back(tm.recHit());
141 if (theDirectionValidity)
return theDirection;
142 else throw cms::Exception(
"TrackingTools/PatternTools",
"Trajectory::direction() requested but not set");
146 if ( theData.empty())
147 throw cms::Exception(
"TrackingTools/PatternTools",
"Trajectory::check() - information requested from empty Trajectory");
152 if ( hit.
isValid())
return false;
168 if ( hit.
isValid())
return false;
191 if (thit->isPixel() || thit->isPhase2())
196 thit->firstClusterRef().stripCluster(),
204 if (ccc_threshold == theCCCThreshold_)
207 theCCCThreshold_ = ccc_threshold;
208 theNumberOfCCCBadHits_ = 0;
209 for (
auto const &
h : theData) {
211 theNumberOfCCCBadHits_++;
216 updateBadForCCC(ccc_threshold);
217 return theNumberOfCCCBadHits_;
226 && ( firstMeasurement().
updatedState().globalPosition().basicVector().
dot( firstMeasurement().
updatedState().globalMomentum().basicVector() ) *
227 lastMeasurement().
updatedState().globalPosition().basicVector().
dot( lastMeasurement().
updatedState().globalMomentum().basicVector() ) > 0 ) ) {
229 firstMeasurement().updatedState() : lastMeasurement().updatedState();
233 return closestMeasurement(
GlobalPoint(0.0,0.0,0.0)).updatedState();
248 edm::LogError(
"InvalidStateOnMeasurement")<<
"an updated state is not valid. result of LessMag comparator will be wrong.";
259 vector<TrajectoryMeasurement>::const_iterator iter = std::min_element(measurements().
begin(), measurements().
end(), LessMag(point) );
ConstRecHitPointer const & recHit() const
const LocalTrajectoryParameters & localParameters() const
void pushAux(double chi2Increment)
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Global3DPoint GlobalPoint
GlobalPoint globalPosition() const
bool badForCCC(const TrajectoryMeasurement &tm)
TrajectoryMeasurement const & closestMeasurement(GlobalPoint) const
TrajectoryStateOnSurface geometricalInnermostState() const
PropagationDirection const & direction() const
uint32_t rawId() const
get the raw id
void updateBadForCCC(float ccc_threshold)
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
void validRecHits(ConstRecHitContainer &cont) const
static bool pixel(const TrackingRecHit &hit)
bool isFast(TrackingRecHit const &hit)
virtual bool isPixel() const
int ndof(bool bon=true) const
virtual TrackingRecHit const * hit() const
ConstRecHitContainer RecHitContainer
static bool isBad(const TrackingRecHit &hit)
TrackingRecHit::ConstRecHitContainer ConstRecHitContainer
int numberOfCCCBadHits(float ccc_threshold)
T perp() const
Magnitude of transverse component.
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
bool isUndef(TrackingRecHit const &hit)
TrajectoryStateOnSurface const & updatedState() const
DetId geographicalId() const
uint32_t dimension(pat::CandKinResolution::Parametrization parametrization)
Returns the number of free parameters in a parametrization (3 or 4)
void push(const TrajectoryMeasurement &tm)
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
static bool lost(const TrackingRecHit &hit)