#include <FastPixelHitMatcher.h>
Public Types | |
typedef TransientTrackingRecHit::ConstRecHitPointer | ConstRecHitPointer |
typedef TransientTrackingRecHit::RecHitContainer | RecHitContainer |
typedef TransientTrackingRecHit::RecHitPointer | RecHitPointer |
Public Member Functions | |
bool | checkRZCompatibility (double zCluster, double rCluster, double zVertex, float rzMin, float rzMax, GlobalPoint &theHit, bool forward) |
std::vector< std::pair < ConstRecHitPointer, ConstRecHitPointer > > | compatibleHits (const GlobalPoint &xmeas, const GlobalPoint &vprim, float energy, std::vector< TrackerRecHit > &theHits) |
FastPixelHitMatcher (float, float, float, float, float, float, float, float, float, float, float, float, bool) | |
double | getVertex () |
bool | isASeed (const ParticlePropagator &myElec, const ParticlePropagator &myPosi, const GlobalPoint &theVertex, double rCluster, double zCluster, const TrackerRecHit &hit1, const TrackerRecHit &hit2) |
bool | propagateToLayer (ParticlePropagator &myPart, const GlobalPoint &theVertex, GlobalPoint &theHit, double phimin, double phimax, unsigned layer) |
void | set1stLayer (float ephimin, float ephimax, float pphimin, float pphimax) |
void | set1stLayerZRange (double zmin1, double zmax1) |
void | set2ndLayer (float phimin, float phimax) |
void | setES (const MagneticFieldMap *aFieldMap, const TrackerGeometry *aTrackerGeometry, const GeometricSearchTracker *geomSearchTracker, const TrackerInteractionGeometry *interactionGeometry) |
double | zVertex (double zCluster, double rCluster, GlobalPoint &theHit) |
virtual | ~FastPixelHitMatcher () |
Private Attributes | |
const TrackerInteractionGeometry * | _theGeometry |
float | ephi1max |
float | ephi1min |
RecHitContainer | hitsInTrack |
float | phi2max |
float | phi2min |
float | pphi1max |
float | pphi1min |
float | r2maxF |
float | r2minF |
float | rMaxI |
float | rMinI |
bool | searchInTIDTEC |
const MagneticFieldMap * | theFieldMap |
const GeometricSearchTracker * | theGeomSearchTracker |
const MagneticField * | theMagneticField |
std::vector< const TrackerLayer * > | thePixelLayers |
const TrackerGeometry * | theTrackerGeometry |
double | vertex |
float | z1max |
float | z1min |
float | z2maxB |
float | z2minB |
Description: central class for finding compatible hits
Implementation: <Notes on="" implementation>="">
Description: Class to match an ECAL cluster to the pixel hits. Two compatible hits in the pixel layers are required.
Implementation: future redesign
Definition at line 38 of file FastPixelHitMatcher.h.
Definition at line 42 of file FastPixelHitMatcher.h.
Definition at line 44 of file FastPixelHitMatcher.h.
Definition at line 43 of file FastPixelHitMatcher.h.
FastPixelHitMatcher::FastPixelHitMatcher | ( | float | ephi1min, |
float | ephi1max, | ||
float | pphi1min, | ||
float | pphi1max, | ||
float | phi2min, | ||
float | phi2max, | ||
float | z2minB, | ||
float | z2maxB, | ||
float | r2minF, | ||
float | r2maxF, | ||
float | rMinI, | ||
float | rMaxI, | ||
bool | searchInTIDTEC | ||
) |
Definition at line 30 of file FastPixelHitMatcher.cc.
: ephi1min(ephi1min), ephi1max(ephi1max), pphi1min(pphi1min), pphi1max(pphi1max), phi2min(phi2min), phi2max(phi2max), z2minB(z2minB), z2maxB(z2maxB), r2minF(r2minF), r2maxF(r2maxF), rMinI(rMinI), rMaxI(rMaxI), searchInTIDTEC(searchInTIDTEC), theTrackerGeometry(0), theMagneticField(0), theGeomSearchTracker(0), _theGeometry(0), thePixelLayers(50,static_cast<TrackerLayer*>(0)), vertex(0.) {}
FastPixelHitMatcher::~FastPixelHitMatcher | ( | ) | [virtual] |
Definition at line 51 of file FastPixelHitMatcher.cc.
{ }
bool FastPixelHitMatcher::checkRZCompatibility | ( | double | zCluster, |
double | rCluster, | ||
double | zVertex, | ||
float | rzMin, | ||
float | rzMax, | ||
GlobalPoint & | theHit, | ||
bool | forward | ||
) |
Definition at line 321 of file FastPixelHitMatcher.cc.
References PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::z(), and zVertex().
Referenced by isASeed().
{ // The hit position double zHit = theHit.z(); double rHit = theHit.perp(); // Compute the intersection of a line joining the cluster position // and the predicted z origin (zVertex) with the layer hit // (returns R for a forward layer, and Z for a barrel layer) double checkRZ = forward ? (zHit-zVertex)/(zCluster-zVertex) * rCluster : zVertex + rHit * (zCluster-zVertex)/rCluster; // This value is then compared to check with the actual hit position // (in R for a forward layer, in Z for a barrel layer) return forward ? checkRZ+rzMin < rHit && rHit < checkRZ+rzMax : checkRZ+rzMin < zHit && zHit < checkRZ+rzMax; }
std::vector< std::pair< FastPixelHitMatcher::ConstRecHitPointer, FastPixelHitMatcher::ConstRecHitPointer > > FastPixelHitMatcher::compatibleHits | ( | const GlobalPoint & | xmeas, |
const GlobalPoint & | vprim, | ||
float | energy, | ||
std::vector< TrackerRecHit > & | theHits | ||
) |
Definition at line 81 of file FastPixelHitMatcher.cc.
References newFWLiteAna::build, gather_cfg::cout, isASeed(), PV3DBase< T, PVType, FrameType >::mag(), PV3DBase< T, PVType, FrameType >::perp(), ParticlePropagator::propagateToNominalVertex(), query::result, theFieldMap, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by FastElectronSeedGenerator::addASeedToThisCluster().
{ std::vector< std::pair<FastPixelHitMatcher::ConstRecHitPointer, FastPixelHitMatcher::ConstRecHitPointer> > result; #ifdef FAMOS_DEBUG std::cout << "[FastPixelHitMatcher::compatibleHits] entering .. " << std::endl; #endif double zCluster = thePos.z(); double rCluster = thePos.perp(); // The cluster inferred energy-momentum double theLength = thePos.mag(); XYZTLorentzVector theMom(thePos.x(), thePos.y(), thePos.z(), theLength); theMom *= energy / theLength; XYZTLorentzVector theVert(thePos.x(),thePos.y(),thePos.z(),0.); XYZTLorentzVector theNominalVertex(theVertex.x(), theVertex.y(), theVertex.z(), 0.); // The corresponding RawParticles (to be propagated for e- and e+ ParticlePropagator myElec(theMom,theVert,-1.,theFieldMap); ParticlePropagator myPosi(theMom,theVert,+1.,theFieldMap); #ifdef FAMOS_DEBUG std::cout << "elec/posi before propagation " << std::endl << myElec << std::endl << myPosi << std::endl; #endif // Propagate the e- and the e+ hypothesis to the nominal vertex // by modifying the pT direction in an appropriate manner. myElec.propagateToNominalVertex(theNominalVertex); myPosi.propagateToNominalVertex(theNominalVertex); #ifdef FAMOS_DEBUG std::cout << "elec/posi after propagation " << std::endl << myElec << std::endl << myPosi << std::endl; #endif // Look for an appropriate see in the pixel detector bool thereIsASeed = false; unsigned nHits = theHits.size(); for ( unsigned firstHit=0; firstHit<nHits-1; ++firstHit ) { for ( unsigned secondHit=firstHit+1; secondHit<nHits; ++secondHit ) { // Is there a seed associated to this pair of Pixel hits? thereIsASeed = isASeed(myElec,myPosi,theVertex, rCluster,zCluster, theHits[firstHit], theHits[secondHit]); #ifdef FAMOS_DEBUG std::cout << "Is there a seed with hits " << firstHit << " & "<< secondHit << "? " << thereIsASeed << std::endl; #endif if ( !thereIsASeed ) continue; ConstRecHitPointer theFirstHit = GenericTransientTrackingRecHit::build(theHits[firstHit].geomDet(), theHits[firstHit].hit()); ConstRecHitPointer theSecondHit = GenericTransientTrackingRecHit::build(theHits[secondHit].geomDet(), theHits[secondHit].hit()); result.push_back(std::pair< FastPixelHitMatcher::ConstRecHitPointer, FastPixelHitMatcher::ConstRecHitPointer>(theFirstHit,theSecondHit)); } } return result; }
double FastPixelHitMatcher::getVertex | ( | ) | [inline] |
Definition at line 62 of file FastPixelHitMatcher.h.
References vertex.
Referenced by FastElectronSeedGenerator::addASeedToThisCluster().
{ return vertex; }
bool FastPixelHitMatcher::isASeed | ( | const ParticlePropagator & | myElec, |
const ParticlePropagator & | myPosi, | ||
const GlobalPoint & | theVertex, | ||
double | rCluster, | ||
double | zCluster, | ||
const TrackerRecHit & | hit1, | ||
const TrackerRecHit & | hit2 | ||
) |
Definition at line 151 of file FastPixelHitMatcher.cc.
References checkRZCompatibility(), gather_cfg::cout, TrackerRecHit::cylinderNumber(), ephi1max, ephi1min, TrackerRecHit::globalPosition(), TrackerRecHit::isOnTheSameLayer(), phi2max, phi2min, pphi1max, pphi1min, propagateToLayer(), r2maxF, r2minF, rMaxI, rMinI, TrackerRecHit::subDetId(), vertex, z1max, z1min, z2maxB, z2minB, and zVertex().
Referenced by compatibleHits().
{ // Check that the two hits are not on the same layer if ( hit2.isOnTheSameLayer(hit1) ) return false; #ifdef FAMOS_DEBUG std::cout << "isASeed: The two hits are not on the same layer - OK " << std::endl; #endif // Check that the first hit is on PXB or PXD if ( hit1.subDetId() > 2 ) return false; #ifdef FAMOS_DEBUG std::cout << "isASeed: The first hits is on the pixel detector " << std::endl; #endif // Impose the track to originate from zVertex = 0. and check the // compatibility with the first hit (beam spot constraint) GlobalPoint firstHit = hit1.globalPosition(); bool rzok = checkRZCompatibility(zCluster, rCluster, 0., z1min, z1max, firstHit, hit1.subDetId()>1); #ifdef FAMOS_DEBUG std::cout << "isASeed: rzok (1) = " << rzok << std::endl; #endif if ( !rzok ) return false; // Refine the Z vertex by imposing the track to pass through the first RecHit, // and check the compatibility with the second rechit GlobalPoint secondHit = hit2.globalPosition(); rzok = false; // The orgin Z vertex for thet track passing through the first rechit vertex = zVertex(zCluster, rCluster, firstHit); // Compute R (forward) or Z (barrel) predicted for the second hit and check compatibility if ( hit2.subDetId() == 1 ) { rzok = checkRZCompatibility(zCluster, rCluster, vertex, z2minB, z2maxB, secondHit, false); } else if ( hit2.subDetId() == 2 ) { rzok = checkRZCompatibility(zCluster, rCluster, vertex, r2minF, r2maxF, secondHit, true); } else { rzok = checkRZCompatibility(zCluster, rCluster, vertex, rMinI, rMaxI, secondHit, true); } #ifdef FAMOS_DEBUG std::cout << "isASeed: rzok (2) = " << rzok << std::endl; #endif if ( !rzok ) return false; // Propagate the inferred electron (positron) to the first layer, // check the compatibility with the first hit, and propagate back // to the nominal vertex with the hit constraint ParticlePropagator elec(myElec); ParticlePropagator posi(myPosi); #ifdef FAMOS_DEBUG std::cout << "isASeed: elec1 to be propagated to first layer" << std::endl; #endif bool elec1 = propagateToLayer(elec,theVertex,firstHit, ephi1min,ephi1max,hit1.cylinderNumber()); #ifdef FAMOS_DEBUG std::cout << "isASeed: posi1 to be propagated to first layer" << std::endl; #endif bool posi1 = propagateToLayer(posi,theVertex,firstHit, pphi1min,pphi1max,hit1.cylinderNumber()); #ifdef FAMOS_DEBUG std::cout << "isASeed: elec1 / posi1 " << elec1 << " " << posi1 << std::endl; #endif // Neither the electron not the positron hypothesis work... if ( !elec1 && !posi1 ) return false; // Otherwise, propagate to the second layer, check the compatibility // with the second hit and propagate back to the nominal vertex with // the hit constraint #ifdef FAMOS_DEBUG std::cout << "isASeed: elec2 to be propagated to second layer" << std::endl; #endif bool elec2 = elec1 && propagateToLayer(elec,theVertex,secondHit, phi2min,phi2max,hit2.cylinderNumber()); #ifdef FAMOS_DEBUG std::cout << "isASeed: posi2 to be propagated to second layer" << std::endl; #endif bool posi2 = posi1 && propagateToLayer(posi,theVertex,secondHit, phi2min,phi2max,hit2.cylinderNumber()); #ifdef FAMOS_DEBUG std::cout << "isASeed: elec2 / posi2 " << elec2 << " " << posi2 << std::endl; #endif if ( !elec2 && !posi2 ) return false; return true; }
bool FastPixelHitMatcher::propagateToLayer | ( | ParticlePropagator & | myPart, |
const GlobalPoint & | theVertex, | ||
GlobalPoint & | theHit, | ||
double | phimin, | ||
double | phimax, | ||
unsigned | layer | ||
) |
Definition at line 248 of file FastPixelHitMatcher.cc.
References gather_cfg::cout, M_PI, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), BaseParticlePropagator::propagate(), ParticlePropagator::propagateToNominalVertex(), BaseParticlePropagator::setPropagationConditions(), RawParticle::setVertex(), summarizeEdmComparisonLogfiles::success, thePixelLayers, vertex, RawParticle::vertex(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by isASeed().
{ // Set the z position of the particle to the predicted one XYZTLorentzVector theNominalVertex(theVertex.x(), theVertex.y(), vertex, 0.); myPart.setVertex(theNominalVertex); #ifdef FAMOS_DEBUG std::cout << "propagateToLayer: propagateToLayer: Before propagation (0) " << myPart << std::endl; #endif // Propagate the inferred electron (positron) to the first layer // Use the radius (barrel) or the z (forward) of the hit instead // of the inaccurate layer radius and z. double rCyl = thePixelLayers[layer]->forward() ? 999. : theHit.perp(); double zCyl = thePixelLayers[layer]->forward() ? fabs(theHit.z()) : 999.; BaseParticlePropagator* myBasePart = (BaseParticlePropagator*)(&myPart); myBasePart->setPropagationConditions(rCyl,zCyl); // myPart.setPropagationConditions(*(thePixelLayers[layer])); // bool success = myPart.propagateToBoundSurface(*(thePixelLayers[layer])); bool success = myPart.propagate(); #ifdef FAMOS_DEBUG std::cout << "propagateToLayer: Success ? " << success << std::endl; std::cout << "propagateToLayer: After propagation (1) " << myPart << std::endl; std::cout << "propagateToLayer: The hit " << theHit << std::endl; #endif // Check that propagated particle is within the proper phi range. if ( success ) { double dphi = myPart.vertex().phi() - theHit.phi(); if ( dphi < -M_PI ) dphi = dphi + 2.*M_PI; else if ( dphi > M_PI ) dphi = dphi - 2.*M_PI; #ifdef FAMOS_DEBUG std::cout << "propagateToLayer: Phi range ? " << phimin << " < " << dphi << " < " << phimax << std::endl; #endif if ( dphi < phimin || dphi > phimax ) success = false; } // Impose the track to go through the hit and propagate back to // the nominal vertex if ( success ) { myPart.setVertex( XYZTLorentzVector(theHit.x(), theHit.y(), theHit.z(), 0.) ); myPart.propagateToNominalVertex(theNominalVertex); #ifdef FAMOS_DEBUG std::cout << "propagateToLayer: After propagation (2) " << myPart << std::endl; #endif } return success; }
void FastPixelHitMatcher::set1stLayer | ( | float | ephimin, |
float | ephimax, | ||
float | pphimin, | ||
float | pphimax | ||
) | [inline] |
void FastPixelHitMatcher::set1stLayerZRange | ( | double | zmin1, |
double | zmax1 | ||
) | [inline] |
Definition at line 105 of file FastPixelHitMatcher.h.
Referenced by FastElectronSeedGenerator::run().
void FastPixelHitMatcher::set2ndLayer | ( | float | phimin, |
float | phimax | ||
) | [inline] |
void FastPixelHitMatcher::setES | ( | const MagneticFieldMap * | aFieldMap, |
const TrackerGeometry * | aTrackerGeometry, | ||
const GeometricSearchTracker * | geomSearchTracker, | ||
const TrackerInteractionGeometry * | interactionGeometry | ||
) |
Definition at line 54 of file FastPixelHitMatcher.cc.
References _theGeometry, TrackerInteractionGeometry::cylinderBegin(), TrackerInteractionGeometry::cylinderEnd(), theFieldMap, theGeomSearchTracker, thePixelLayers, and theTrackerGeometry.
Referenced by FastElectronSeedGenerator::setupES().
{ // initialize the tracker geometry and the magnetic field map theTrackerGeometry = aTrackerGeometry; //theMagneticField = aMagField; theGeomSearchTracker = geomSearchTracker; _theGeometry = interactionGeometry; theFieldMap = aFieldMap; // Initialize (if not already done) the simplified magnetic field geometry // MagneticFieldMap::instance( theMagneticField, _theGeometry ); // The pixel layers in the simplified geometry unsigned layer = 1; std::list<TrackerLayer>::const_iterator cyliter = _theGeometry->cylinderBegin(); for ( ; cyliter != _theGeometry->cylinderEnd() ; ++cyliter ) { if ( layer != cyliter->layerNumber() ) continue; thePixelLayers[layer++] = &(*cyliter); } }
double FastPixelHitMatcher::zVertex | ( | double | zCluster, |
double | rCluster, | ||
GlobalPoint & | theHit | ||
) |
Definition at line 307 of file FastPixelHitMatcher.cc.
References PV3DBase< T, PVType, FrameType >::perp(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by checkRZCompatibility(), and isASeed().
const TrackerInteractionGeometry* FastPixelHitMatcher::_theGeometry [private] |
Definition at line 126 of file FastPixelHitMatcher.h.
Referenced by setES().
float FastPixelHitMatcher::ephi1max [private] |
Definition at line 114 of file FastPixelHitMatcher.h.
Referenced by isASeed(), and set1stLayer().
float FastPixelHitMatcher::ephi1min [private] |
Definition at line 114 of file FastPixelHitMatcher.h.
Referenced by isASeed(), and set1stLayer().
Definition at line 112 of file FastPixelHitMatcher.h.
float FastPixelHitMatcher::phi2max [private] |
Definition at line 116 of file FastPixelHitMatcher.h.
Referenced by isASeed(), and set2ndLayer().
float FastPixelHitMatcher::phi2min [private] |
Definition at line 116 of file FastPixelHitMatcher.h.
Referenced by isASeed(), and set2ndLayer().
float FastPixelHitMatcher::pphi1max [private] |
Definition at line 115 of file FastPixelHitMatcher.h.
Referenced by isASeed(), and set1stLayer().
float FastPixelHitMatcher::pphi1min [private] |
Definition at line 115 of file FastPixelHitMatcher.h.
Referenced by isASeed(), and set1stLayer().
float FastPixelHitMatcher::r2maxF [private] |
Definition at line 119 of file FastPixelHitMatcher.h.
Referenced by isASeed().
float FastPixelHitMatcher::r2minF [private] |
Definition at line 119 of file FastPixelHitMatcher.h.
Referenced by isASeed().
float FastPixelHitMatcher::rMaxI [private] |
Definition at line 120 of file FastPixelHitMatcher.h.
Referenced by isASeed().
float FastPixelHitMatcher::rMinI [private] |
Definition at line 120 of file FastPixelHitMatcher.h.
Referenced by isASeed().
bool FastPixelHitMatcher::searchInTIDTEC [private] |
Definition at line 121 of file FastPixelHitMatcher.h.
const MagneticFieldMap* FastPixelHitMatcher::theFieldMap [private] |
Definition at line 127 of file FastPixelHitMatcher.h.
Referenced by compatibleHits(), and setES().
const GeometricSearchTracker* FastPixelHitMatcher::theGeomSearchTracker [private] |
Definition at line 125 of file FastPixelHitMatcher.h.
Referenced by setES().
const MagneticField* FastPixelHitMatcher::theMagneticField [private] |
Definition at line 124 of file FastPixelHitMatcher.h.
std::vector<const TrackerLayer*> FastPixelHitMatcher::thePixelLayers [private] |
Definition at line 128 of file FastPixelHitMatcher.h.
Referenced by propagateToLayer(), and setES().
const TrackerGeometry* FastPixelHitMatcher::theTrackerGeometry [private] |
Definition at line 123 of file FastPixelHitMatcher.h.
Referenced by setES().
double FastPixelHitMatcher::vertex [private] |
Definition at line 129 of file FastPixelHitMatcher.h.
Referenced by getVertex(), isASeed(), and propagateToLayer().
float FastPixelHitMatcher::z1max [private] |
Definition at line 117 of file FastPixelHitMatcher.h.
Referenced by isASeed(), and set1stLayerZRange().
float FastPixelHitMatcher::z1min [private] |
Definition at line 117 of file FastPixelHitMatcher.h.
Referenced by isASeed(), and set1stLayerZRange().
float FastPixelHitMatcher::z2maxB [private] |
Definition at line 118 of file FastPixelHitMatcher.h.
Referenced by isASeed().
float FastPixelHitMatcher::z2minB [private] |
Definition at line 118 of file FastPixelHitMatcher.h.
Referenced by isASeed().