2 #include "boost/intrusive_ptr.hpp"
19 if(theData.back().recHit()->isValid()) {
20 theNumberOfFoundHits--;
21 theChiSquared -= theData.back().estimate();
23 else if(lost(* (theData.back().recHit()) )) {
24 theNumberOfLostHits--;
26 else if(isBad(* (theData.back().recHit()) ) && theData.back().recHit()->geographicalId().det()==
DetId::Muon ) {
27 theChiSquaredBad -= theData.back().estimate();
41 theData.push_back(tm);
42 if ( tm.
recHit()->isValid()) {
43 theChiSquared += chi2Increment;
44 theNumberOfFoundHits++;
47 else if (lost( *(tm.
recHit()) ) ) {
48 theNumberOfLostHits++;
52 theChiSquaredBad += chi2Increment;
58 if ( !theDirectionValidity && theData.size() >= 2) {
59 if (theData[0].updatedState().globalPosition().perp() <
60 theData.back().updatedState().globalPosition().perp())
63 theDirectionValidity =
true;
69 recHitsV(hits,splitting);
80 for(Trajectory::RecHitContainer::const_iterator rechit = transRecHits.begin();
81 rechit != transRecHits.end(); ++rechit) {
82 if((*rechit)->isValid())
83 dof += (*rechit)->dimension();
84 else if( isBad(**rechit) && (*rechit)->geographicalId().det()==
DetId::Muon )
85 dofBad += (*rechit)->dimension();
93 int constr = bon ? 5 : 4;
100 int constr = bon ? 5 : 4;
101 return std::max(dofBad - constr, 1);
108 hits.reserve(theData.size());
110 for (Trajectory::DataContainer::const_iterator itm
111 = theData.begin(); itm != theData.end(); itm++){
112 hits.push_back((*itm).recHit());
115 for (Trajectory::DataContainer::const_iterator itm
116 = theData.begin(); itm != theData.end(); itm++){
123 if(
typeid(*(itm->recHit()->hit())) ==
typeid(SiStripMatchedRecHit2D)){
125 itm->updatedState().surface().toLocal(itm->recHit()->transientHits()[0]->globalPosition());
128 itm->updatedState().surface().toLocal(itm->recHit()->transientHits()[1]->globalPosition());
130 LocalVector Delta = secondLocalPos - firstLocalPos;
131 float scalar = Delta.
z() * (itm->updatedState().localDirection().z());
141 if(!itm->recHit()->transientHits()[0]->detUnit()->type().isEndcap()){
142 hitA = itm->recHit()->transientHits()[0]->transientHits()[0];
143 hitB = itm->recHit()->transientHits()[1]->transientHits()[0];
145 hitA = itm->recHit()->transientHits()[0];
146 hitB = itm->recHit()->transientHits()[1];
151 hits.push_back(hitA);
152 hits.push_back(hitB);
155 hits.push_back(hitB);
156 hits.push_back(hitA);
159 edm::LogError(
"Trajectory_recHitsV_UndefinedTrackDirection") <<
160 "Error in Trajectory::recHitsV: scalar = " << scalar <<
162 hits.push_back(hitA);
163 hits.push_back(hitB);
167 if(!itm->recHit()->transientHits()[0]->detUnit()->type().isEndcap()){
168 hits.push_back(itm->recHit()->transientHits()[0]->transientHits()[0]);
170 hits.push_back(itm->recHit()->transientHits()[0]);
173 }
else if(
typeid(*(itm->recHit()->hit())) ==
typeid(SiStripRecHit2D)){
175 if(!itm->recHit()->detUnit()->type().isEndcap()){
176 hits.push_back(itm->recHit()->transientHits()[0]);
178 hits.push_back(itm->recHit());
181 hits.push_back(itm->recHit());
188 hits.reserve(foundHits());
189 for (Trajectory::DataContainer::const_iterator itm
190 = theData.begin(); itm != theData.end(); itm++)
191 if ((*itm).recHit()->isValid()) hits.push_back((*itm).recHit());
196 if (theDirectionValidity)
return theDirection;
197 else throw cms::Exception(
"TrackingTools/PatternTools",
"Trajectory::direction() requested but not set");
201 if ( theData.empty())
202 throw cms::Exception(
"TrackingTools/PatternTools",
"Trajectory::check() - information requested from empty Trajectory");
207 if ( hit.
isValid())
return false;
223 if ( hit.
isValid())
return false;
237 if ( firstMeasurement().updatedState().globalMomentum().
perp() > 1.0
238 && ( firstMeasurement().updatedState().globalPosition().basicVector().
dot( firstMeasurement().updatedState().globalMomentum().basicVector() ) *
239 lastMeasurement().updatedState().globalPosition().basicVector().
dot( lastMeasurement().updatedState().globalMomentum().basicVector() ) > 0 ) ) {
240 return (firstMeasurement().updatedState().globalPosition().
mag() < lastMeasurement().updatedState().globalPosition().
mag() ) ?
241 firstMeasurement().updatedState() : lastMeasurement().updatedState();
245 return closestMeasurement(
GlobalPoint(0.0,0.0,0.0)).updatedState();
260 edm::LogError(
"InvalidStateOnMeasurement")<<
"an updated state is not valid. result of LessMag comparator will be wrong.";
271 vector<TrajectoryMeasurement>::const_iterator iter = std::min_element(measurements().
begin(), measurements().
end(), LessMag(point) );
281 std::reverse(theData.begin(), theData.end());
static bool lost(const TransientTrackingRecHit &hit)
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Global3DPoint GlobalPoint
GlobalPoint globalPosition() const
ConstRecHitPointer recHit() const
TrajectoryMeasurement const & closestMeasurement(GlobalPoint) const
TrajectoryStateOnSurface geometricalInnermostState() const
void recHitsV(ConstRecHitContainer &cont, bool splitting=false) const
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
ConstRecHitContainer recHits(bool splitting=false) const
PropagationDirection const & direction() const
uint32_t rawId() const
get the raw id
const T & max(const T &a, const T &b)
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
void validRecHits(ConstRecHitContainer &cont) const
TrajectoryStateOnSurface updatedState() const
int ndof(bool bon=true) const
static bool isBad(const TransientTrackingRecHit &hit)
ConstRecHitContainer RecHitContainer
T perp() const
Magnitude of transverse component.
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
DetId geographicalId() const
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
double scalar(const CLHEP::HepGenMatrix &m)
Return the matrix as a scalar. Raise an assertion if the matris is not .