#include <RecoTracker/NuclearSeedGenerator/interface/NuclearTester.h>
Public Member Functions | |
const TMContainer & | back () const |
std::vector< int > | compatibleHits () const |
double | fwdEstimate () const |
double | fwdEstimate (const std::vector< TrajectoryMeasurement > &vecTM) const |
const TMPair & | goodTMPair () const |
std::vector< GlobalPoint > | HitPositions (const std::vector< TrajectoryMeasurement > &vecTM) const |
bool | isNuclearInteraction () |
std::vector< TM >::const_iterator | lastValidTM (const std::vector< TM > &vecTM) const |
double | meanHitDistance () const |
double | meanHitDistance (const std::vector< TrajectoryMeasurement > &vecTM) const |
unsigned int | nHitsChecked () const |
int | nuclearIndex () const |
NuclearTester (unsigned int max_hits, const MeasurementEstimator *est, const TrackerGeometry *track_geom) | |
void | push_back (const TM &init_tm, const TMContainer &vecTM) |
void | reset (unsigned int nMeasurements) |
Private Types | |
typedef TrajectoryMeasurement::ConstRecHitPointer | ConstRecHitPointer |
typedef TrajectoryMeasurement | TM |
typedef std::vector< TM > | TMContainer |
typedef std::pair < TrajectoryMeasurement, TMContainer > | TMPair |
typedef std::vector< TMPair > | TMPairVector |
Private Member Functions | |
bool | checkWithMultiplicity () |
Private Attributes | |
TMPairVector | allTM |
std::vector< int > | compatible_hits |
unsigned int | maxHits |
int | NuclearIndex |
const MeasurementEstimator * | theEstimator |
const TrackerGeometry * | trackerGeom |
Using the properties of all the compatible TMs of the TMs associated to a track, the method isNuclearInteraction return 1 in case the track has interacted nuclearly, 0 else.
Definition at line 16 of file NuclearTester.h.
typedef TrajectoryMeasurement::ConstRecHitPointer NuclearTester::ConstRecHitPointer [private] |
Definition at line 21 of file NuclearTester.h.
typedef TrajectoryMeasurement NuclearTester::TM [private] |
Definition at line 19 of file NuclearTester.h.
typedef std::vector<TM> NuclearTester::TMContainer [private] |
Definition at line 20 of file NuclearTester.h.
typedef std::pair<TrajectoryMeasurement, TMContainer > NuclearTester::TMPair [private] |
Definition at line 22 of file NuclearTester.h.
typedef std::vector< TMPair > NuclearTester::TMPairVector [private] |
Definition at line 23 of file NuclearTester.h.
NuclearTester::NuclearTester | ( | unsigned int | max_hits, | |
const MeasurementEstimator * | est, | |||
const TrackerGeometry * | track_geom | |||
) |
Definition at line 6 of file NuclearTester.cc.
References NuclearIndex.
00006 : 00007 maxHits(max_hits), theEstimator(est), trackerGeom(track_geom) { NuclearIndex=0; }
const TMContainer& NuclearTester::back | ( | void | ) | const [inline] |
Definition at line 43 of file NuclearTester.h.
References allTM.
Referenced by fwdEstimate(), meanHitDistance(), and NuclearInteractionFinder::run().
00043 { return allTM.back().second; }
bool NuclearTester::checkWithMultiplicity | ( | ) | [private] |
Definition at line 30 of file NuclearTester.cc.
References compatible_hits, and NuclearIndex.
Referenced by isNuclearInteraction().
00030 { 00031 //RQ: assume that the input vector of compatible hits has been filled from Outside to Inside the tracker ! 00032 00033 // find the first min nb of compatible TM : 00034 std::vector<int>::iterator min_it = min_element(compatible_hits.begin(), compatible_hits.end()); 00035 00036 // if the outermost hit has no compatible TM, min_it has to be recalculated : 00037 if(min_it == compatible_hits.begin() && *min_it!=0) return false; 00038 if(min_it == compatible_hits.begin() && *min_it==0) min_it=min_element(compatible_hits.begin()+1, compatible_hits.end()); 00039 00040 // this first min cannot be the innermost TM : 00041 if(min_it == compatible_hits.end()-1) return false; 00042 00043 // if the previous nb of compatible TM is > min+2 and if the next compatible TM is min+-1 -> NUCLEAR 00044 // example : Nhits = 5, 8, 2, 2, ... 00045 if((*(min_it-1) - *min_it) > 2 && (*(min_it+1) - *min_it) < 2 ) { 00046 NuclearIndex = min_it - compatible_hits.begin(); 00047 return true; 00048 } 00049 00050 // case of : Nhits = 5, 8, 3, 2, 2, ... 00051 if(min_it-1 != compatible_hits.begin()) //because min_it must be at least at the third position 00052 { 00053 if(min_it-1 != compatible_hits.begin() && (*(min_it-1) - *min_it) < 2 && (*(min_it-2) - *(min_it-1)) > 2 ) { 00054 NuclearIndex = min_it - 1 - compatible_hits.begin(); 00055 return true; 00056 } 00057 } 00058 00059 return false; 00060 }
std::vector<int> NuclearTester::compatibleHits | ( | ) | const [inline] |
Definition at line 61 of file NuclearTester.h.
References compatible_hits.
Referenced by NuclearInteractionFinder::run().
00061 { return compatible_hits; }
double NuclearTester::fwdEstimate | ( | ) | const [inline] |
Definition at line 47 of file NuclearTester.h.
References back().
00047 { return fwdEstimate( back() ); }
double NuclearTester::fwdEstimate | ( | const std::vector< TrajectoryMeasurement > & | vecTM | ) | const |
Definition at line 93 of file NuclearTester.cc.
References MeasurementEstimator::estimate(), TrackingRecHit::isValid(), edm::second(), and theEstimator.
Referenced by NuclearInteractionFinder::run().
00093 { 00094 if(vecTM.empty()) return 0; 00095 00096 const TransientTrackingRecHit* hit = vecTM.front().recHit().get(); 00097 if( hit->isValid() ) 00098 return theEstimator->estimate( vecTM.front().forwardPredictedState(), *hit ).second; 00099 else return -1; 00100 /* 00101 double meanEst=0; 00102 int goodTM=0; 00103 std::vector<TM>::const_iterator last; 00104 //std::vector<TM>::const_iterator last = this->lastValidTM(vecTM); 00105 if(vecTM.size() > 2) last = vecTM.begin()+2; 00106 else last = vecTM.end(); 00107 00108 for(std::vector<TrajectoryMeasurement>::const_iterator itm = vecTM.begin(); itm!=last; itm++) { 00109 meanEst += itm->estimate(); 00110 goodTM++; 00111 } 00112 return meanEst/goodTM; 00113 */ 00114 }
const TMPair& NuclearTester::goodTMPair | ( | ) | const [inline] |
Definition at line 57 of file NuclearTester.h.
References allTM, and nuclearIndex().
Referenced by NuclearInteractionFinder::run().
00057 { return *(allTM.begin()+nuclearIndex()-1); }
std::vector< GlobalPoint > NuclearTester::HitPositions | ( | const std::vector< TrajectoryMeasurement > & | vecTM | ) | const |
Definition at line 81 of file NuclearTester.cc.
References TrackerGeometry::idToDet(), prof2calltree::last, lastValidTM(), GeomDet::toGlobal(), and trackerGeom.
Referenced by meanHitDistance().
00081 { 00082 std::vector<GlobalPoint> gp; 00083 00084 std::vector<TM>::const_iterator last = this->lastValidTM(vecTM); 00085 00086 for(std::vector<TrajectoryMeasurement>::const_iterator itm = vecTM.begin(); itm!=last; itm++) { 00087 ConstRecHitPointer trh = itm->recHit(); 00088 if(trh->isValid()) gp.push_back(trackerGeom->idToDet(trh->geographicalId())->surface().toGlobal(trh->localPosition())); 00089 } 00090 return gp; 00091 }
bool NuclearTester::isNuclearInteraction | ( | ) |
Definition at line 10 of file NuclearTester.cc.
References allTM, checkWithMultiplicity(), compatible_hits, maxHits, nHitsChecked(), NuclearIndex, and true.
Referenced by NuclearInteractionFinder::run().
00010 { 00011 // TODO : if energy of primary track is below a threshold don't use checkWithMultiplicity but only checkwith compatible_hits.front 00012 00013 // 1. if momentum of the primary track is below 5 GeV and if the number of compatible hits >0 00014 // assume that a nuclear interaction occured at the end of the track 00015 if( allTM.front().first.updatedState().globalMomentum().mag() < 5.0 && compatible_hits.front()>0) { NuclearIndex=1; return true; } 00016 00017 // 2. else to use multiplicity we require at least 3 TM vectors to check if nuclear interactions occurs 00018 if(nHitsChecked()<3) return false; 00019 00020 // 2. check with multiplicity : 00021 if( checkWithMultiplicity() == true ) return true; 00022 else { 00023 // 3. last case : uncompleted track with at least 1 compatible hits in the last layer 00024 if( nHitsChecked() >= maxHits && compatible_hits.front()>0) {NuclearIndex=1; return true; } 00025 } 00026 00027 return false; 00028 }
std::vector< TrajectoryMeasurement >::const_iterator NuclearTester::lastValidTM | ( | const std::vector< TM > & | vecTM | ) | const |
Definition at line 116 of file NuclearTester.cc.
Referenced by HitPositions().
00116 { 00117 if (vecTM.empty()) return vecTM.end(); 00118 if (vecTM.front().recHit()->isValid()) 00119 return std::find_if( vecTM.begin(), vecTM.end(), RecHitIsInvalid()); 00120 else return vecTM.end(); 00121 }
double NuclearTester::meanHitDistance | ( | ) | const [inline] |
Definition at line 45 of file NuclearTester.h.
References back().
00045 { return meanHitDistance( back() ); }
double NuclearTester::meanHitDistance | ( | const std::vector< TrajectoryMeasurement > & | vecTM | ) | const |
Definition at line 63 of file NuclearTester.cc.
References dist(), HitPositions(), and muonGeometry::mag().
Referenced by NuclearInteractionFinder::run().
00063 { 00064 std::vector<GlobalPoint> vgp = this->HitPositions(vecTM); 00065 double mean_dist=0; 00066 int ncomb=0; 00067 if(vgp.size()<2) return 0; 00068 for(std::vector<GlobalPoint>::iterator itp = vgp.begin(); itp != vgp.end()-1; itp++) { 00069 for(std::vector<GlobalPoint>::iterator itq = itp+1; itq != vgp.end(); itq++) { 00070 double dist = ((*itp) - (*itq)).mag(); 00071 // to calculate mean distance between particles and not hits (to not take into account twice stereo hits) 00072 if(dist > 1E-12) { 00073 mean_dist += dist; 00074 ncomb++; 00075 } 00076 } 00077 } 00078 return mean_dist/ncomb; 00079 }
unsigned int NuclearTester::nHitsChecked | ( | ) | const [inline] |
Definition at line 59 of file NuclearTester.h.
References compatible_hits.
Referenced by isNuclearInteraction(), and NuclearInteractionFinder::run().
00059 { return compatible_hits.size(); }
int NuclearTester::nuclearIndex | ( | ) | const [inline] |
Definition at line 55 of file NuclearTester.h.
References NuclearIndex.
Referenced by goodTMPair(), and NuclearInteractionFinder::run().
00055 { return NuclearIndex; }
void NuclearTester::push_back | ( | const TM & | init_tm, | |
const TMContainer & | vecTM | |||
) | [inline] |
Definition at line 38 of file NuclearTester.h.
References allTM, and compatible_hits.
Referenced by NuclearInteractionFinder::run().
00038 { 00039 allTM.push_back(std::make_pair(init_tm, vecTM) ); 00040 compatible_hits.push_back(vecTM.size()); 00041 }
Definition at line 49 of file NuclearTester.h.
References allTM, compatible_hits, and maxHits.
Referenced by NuclearInteractionFinder::run().
00049 { 00050 allTM.clear(); 00051 compatible_hits.clear(); 00052 maxHits = (nMeasurements < maxHits) ? nMeasurements : maxHits; 00053 }
TMPairVector NuclearTester::allTM [private] |
Definition at line 66 of file NuclearTester.h.
Referenced by back(), goodTMPair(), isNuclearInteraction(), push_back(), and reset().
std::vector< int > NuclearTester::compatible_hits [private] |
Definition at line 67 of file NuclearTester.h.
Referenced by checkWithMultiplicity(), compatibleHits(), isNuclearInteraction(), nHitsChecked(), push_back(), and reset().
unsigned int NuclearTester::maxHits [private] |
int NuclearTester::NuclearIndex [private] |
Definition at line 68 of file NuclearTester.h.
Referenced by checkWithMultiplicity(), isNuclearInteraction(), nuclearIndex(), and NuclearTester().
const MeasurementEstimator* NuclearTester::theEstimator [private] |
const TrackerGeometry* NuclearTester::trackerGeom [private] |