#include <DTHitQualityUtils.h>
Public Member Functions | |
DTHitQualityUtils () | |
Constructor. | |
virtual | ~DTHitQualityUtils () |
Destructor. | |
Static Public Member Functions | |
static const PSimHit * | findMuSimHit (const edm::PSimHitContainer &hits) |
Select the SimHit from a muon in a vector of SimHits. | |
static std::pair< const PSimHit *, const PSimHit * > | findMuSimSegment (const std::map< DTWireId, const PSimHit * > &mapWireAndMuSimHit) |
Find Innermost and outermost SimHit from Mu in a SL (they identify a simulated segment) | |
static std::pair< LocalVector, LocalPoint > | findMuSimSegmentDirAndPos (const std::pair< const PSimHit *, const PSimHit * > &inAndOutSimHit, const DetId detId, const DTGeometry *muonGeom) |
Find direction and position of a segment (in local RF) from outer and inner mu SimHit in the RF of object Det. | |
static std::pair< double, double > | findSegmentAlphaAndBeta (const LocalVector &direction) |
Find the angles from a segment direction: | |
static std::map< DTWireId, const PSimHit * > | mapMuSimHitsPerWire (const std::map< DTWireId, edm::PSimHitContainer > &simHitWireMap) |
Create a map between the Mu SimHits and corresponding MuBarWireId ;. | |
static std::map< DTWireId, edm::PSimHitContainer > | mapSimHitsPerWire (const edm::PSimHitContainer &simhits) |
Static Public Attributes | |
static bool | debug |
Provide basic functionalities useful for MuScleFit
Define some basic tools and utilities for 1D DT Rec Hit and 2D, 4D DT Segment analysis
Definition at line 25 of file DTHitQualityUtils.h.
DTHitQualityUtils::DTHitQualityUtils | ( | ) |
Constructor.
Definition at line 25 of file DTHitQualityUtils.cc.
{
//DTHitQualityUtils::setDebug(debug);
}
DTHitQualityUtils::~DTHitQualityUtils | ( | ) | [virtual] |
const PSimHit * DTHitQualityUtils::findMuSimHit | ( | const edm::PSimHitContainer & | hits | ) | [static] |
Select the SimHit from a muon in a vector of SimHits.
Definition at line 69 of file DTHitQualityUtils.cc.
References abs, gather_cfg::cout, and debug.
Referenced by DTRecHitQuality::compute(), GlobalRecHitsAnalyzer::compute(), and GlobalRecHitsProducer::compute().
{ //PSimHitContainer muHits; vector<const PSimHit*> muHits; // Loop over simhits for (PSimHitContainer::const_iterator hit=hits.begin(); hit != hits.end(); hit++) { if (abs((*hit).particleType())==13) muHits.push_back(&(*hit)); } if (muHits.size()==0) return 0; //FIXME: Throw of exception??? else if (muHits.size()>1) if(debug) cout << "[DTHitQualityUtils]***WARNING: # muSimHits in a wire = " << muHits.size() << endl; return (muHits.front()); }
pair< const PSimHit *, const PSimHit * > DTHitQualityUtils::findMuSimSegment | ( | const std::map< DTWireId, const PSimHit * > & | mapWireAndMuSimHit | ) | [static] |
Find Innermost and outermost SimHit from Mu in a SL (they identify a simulated segment)
Definition at line 91 of file DTHitQualityUtils.cc.
References gather_cfg::cout, debug, and DTWireId::layerId().
Referenced by DTSegment4DQuality::analyze(), DTSegment2DQuality::analyze(), and DTSegment2DSLPhiQuality::analyze().
{ int outSL = 0; int inSL = 4; int outLayer = 0; int inLayer = 5; const PSimHit *inSimHit = 0; const PSimHit *outSimHit = 0; for(map<DTWireId, const PSimHit*>::const_iterator wireAndMuSimHit = mapWireAndMuSimHit.begin(); wireAndMuSimHit != mapWireAndMuSimHit.end(); wireAndMuSimHit++) { const DTWireId wireId = (*wireAndMuSimHit).first; const PSimHit *theMuHit = (*wireAndMuSimHit).second; int sl = ((wireId.layerId()).superlayerId()).superLayer(); int layer = (wireId.layerId()).layer(); if(sl == outSL) { if(layer > outLayer) { outLayer = layer; outSimHit = theMuHit; } } if(sl > outSL) { outSL = sl; outLayer = layer; outSimHit = theMuHit; } if(sl == inSL) { if(layer < inLayer) { inLayer = layer; inSimHit = theMuHit; } } if(sl < inSL) { inSL = sl; inLayer = layer; inSimHit = theMuHit; } } if(inSimHit != 0) { if(debug) cout << "Innermost SimHit on SL: " << inSL << " layer: " << inLayer << endl; } else { cout << "[DTHitQualityUtils]***Error: No Innermost SimHit found!!!" << endl; abort(); } if(outSimHit != 0) { if(debug) cout << "Outermost SimHit on SL: " << outSL << " layer: " << outLayer << endl; } else { cout << "[DTHitQualityUtils]***Error: No Outermost SimHit found!!!" << endl; abort(); } // //Check that outermost and innermost SimHit are not the same // if(outSimHit == inSimHit) { // cout << "[DTHitQualityUtils]***Warning: outermost and innermost SimHit are the same!" << endl; // abort(); // } return make_pair(inSimHit, outSimHit); }
pair< LocalVector, LocalPoint > DTHitQualityUtils::findMuSimSegmentDirAndPos | ( | const std::pair< const PSimHit *, const PSimHit * > & | inAndOutSimHit, |
const DetId | detId, | ||
const DTGeometry * | muonGeom | ||
) | [static] |
Find direction and position of a segment (in local RF) from outer and inner mu SimHit in the RF of object Det.
Definition at line 163 of file DTHitQualityUtils.cc.
References funct::cos(), PSimHit::detUnitId(), DTGeometry::idToDet(), DTGeometry::layer(), PSimHit::localPosition(), PV3DBase< T, PVType, FrameType >::mag(), PV3DBase< T, PVType, FrameType >::theta(), GeomDet::toGlobal(), toLocal(), Vector3DBase< T, FrameTag >::unit(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by DTSegment4DQuality::analyze(), DTSegment2DQuality::analyze(), and DTSegment2DSLPhiQuality::analyze().
{ //FIXME: What should happen if outSimHit = inSimHit???? Now, this case is not considered const PSimHit* innermostMuSimHit = inAndOutSimHit.first; const PSimHit* outermostMuSimHit = inAndOutSimHit.second; //Find simulated segment direction from SimHits position const DTLayer* layerIn = muonGeom->layer((DTWireId(innermostMuSimHit->detUnitId())).layerId()); const DTLayer* layerOut = muonGeom->layer((DTWireId(outermostMuSimHit->detUnitId())).layerId()); GlobalPoint inGlobalPos = layerIn->toGlobal(innermostMuSimHit->localPosition()); GlobalPoint outGlobalPos = layerOut->toGlobal(outermostMuSimHit->localPosition()); LocalVector simHitDirection = (muonGeom->idToDet(detId))->toLocal(inGlobalPos - outGlobalPos); simHitDirection = -simHitDirection.unit(); //SimHit position extrapolated at z=0 in the Det RF LocalPoint outLocalPos = (muonGeom->idToDet(detId))->toLocal(outGlobalPos); LocalPoint simSegLocalPosition = outLocalPos + simHitDirection*(-outLocalPos.z()/(simHitDirection.mag()*cos(simHitDirection.theta()))); return make_pair(simHitDirection, simSegLocalPosition); }
pair< double, double > DTHitQualityUtils::findSegmentAlphaAndBeta | ( | const LocalVector & | direction | ) | [static] |
Find the angles from a segment direction:
Definition at line 191 of file DTHitQualityUtils.cc.
References PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by DTSegment4DQuality::analyze(), DTSegment2DQuality::analyze(), and DTSegment2DSLPhiQuality::analyze().
map< DTWireId, const PSimHit * > DTHitQualityUtils::mapMuSimHitsPerWire | ( | const std::map< DTWireId, edm::PSimHitContainer > & | simHitWireMap | ) | [static] |
Create a map between the Mu SimHits and corresponding MuBarWireId ;.
Definition at line 50 of file DTHitQualityUtils.cc.
References runTheMatrix::ret.
Referenced by DTSegment4DQuality::analyze(), DTSegment2DQuality::analyze(), and DTSegment2DSLPhiQuality::analyze().
{ map<DTWireId, const PSimHit*> ret; for(map<DTWireId, PSimHitContainer>::const_iterator wireAndSimHit = simHitWireMap.begin(); wireAndSimHit != simHitWireMap.end(); wireAndSimHit++) { const PSimHit* muHit = findMuSimHit((*wireAndSimHit).second); if(muHit != 0) { ret[(*wireAndSimHit).first]=(muHit); } } return ret; }
map< DTWireId, PSimHitContainer > DTHitQualityUtils::mapSimHitsPerWire | ( | const edm::PSimHitContainer & | simhits | ) | [static] |
Operations Create a map between the SimHits in a chamber and the corrisponding MuBarWireId
Definition at line 36 of file DTHitQualityUtils.cc.
Referenced by DTSegment4DQuality::analyze(), DTSegment2DQuality::analyze(), DTRecHitQuality::analyze(), DTSegment2DSLPhiQuality::analyze(), GlobalRecHitsProducer::fillMuon(), and GlobalRecHitsAnalyzer::fillMuon().
{ map<DTWireId, PSimHitContainer > hitWireMapResult; for(PSimHitContainer::const_iterator simhit = simhits.begin(); simhit != simhits.end(); simhit++) { hitWireMapResult[DTWireId((*simhit).detUnitId())].push_back(*simhit); } return hitWireMapResult; }
bool DTHitQualityUtils::debug [static] |
Definition at line 51 of file DTHitQualityUtils.h.
Referenced by DTSegment2DQuality::DTSegment2DQuality(), DTSegment2DSLPhiQuality::DTSegment2DSLPhiQuality(), and DTSegment4DQuality::DTSegment4DQuality().