51 sigmaResAngle = pset.
getParameter<
double>(
"sigmaResAngle");
58 cout <<
"[DTSegment2DQuality] Constructor called " << endl;
87 cout <<
"[DTSegment2DQuality] hitsos created " << endl;
105 h2DHitEff_RPhi->ComputeEfficiency();
106 h2DHitEff_RZ->ComputeEfficiency();
107 h2DHitEff_RZ_W0->ComputeEfficiency();
108 h2DHitEff_RZ_W1->ComputeEfficiency();
109 h2DHitEff_RZ_W2->ComputeEfficiency();
131 event.getByLabel(simHitLabel, simHits);
134 map<DTSuperLayerId, PSimHitContainer > simHitsPerSl;
135 for(PSimHitContainer::const_iterator simHit = simHits->begin();
136 simHit != simHits->end(); simHit++){
140 simHitsPerSl[slId].push_back(*simHit);
145 event.getByLabel(segment2DLabel, segment2Ds);
148 if(
debug)
cout <<
"[DTSegment2DQuality]**Warning: no 2DSegments with label: " << segment2DLabel
149 <<
" in this event, skipping!" << endl;
155 for (slId = segment2Ds->id_begin();
156 slId != segment2Ds->id_end();
166 int nMuSimHit = muSimHitPerWire.size();
167 if(nMuSimHit == 0 || nMuSimHit == 1) {
168 if(
debug && nMuSimHit == 1)
169 cout <<
"[DTSegment2DQuality] Only " << nMuSimHit <<
" mu SimHit in this SL, skipping!" << endl;
173 cout <<
"=== SL " << (*slId) <<
" has " << nMuSimHit <<
" SimHits" << endl;
178 if(inAndOutSimHit.first ==inAndOutSimHit.second ) {
179 cout <<
"[DTHitQualityUtils]***Warning: outermost and innermost SimHit are the same!" << endl;
187 LocalVector simSegmLocalDir = dirAndPosSimSegm.first;
188 LocalPoint simSegmLocalPos = dirAndPosSimSegm.second;
190 cout<<
" Simulated segment: local direction "<<simSegmLocalDir<<endl
191 <<
" local position "<<simSegmLocalPos<<endl;
192 const DTSuperLayer* superLayer = dtGeom->superLayer(*slId);
197 float posSimSeg = simSegmLocalPos.
x();
199 float etaSimSeg = simSegmGlobalPos.
eta();
200 float phiSimSeg = simSegmGlobalPos.
phi();
205 bool recHitFound =
false;
207 int nsegm = distance(range.first, range.second);
209 cout <<
" Sl: " << *slId <<
" has " << nsegm
210 <<
" 2D segments" << endl;
219 bool bestRecHitFound =
false;
220 double deltaAlpha = 99999;
224 segment2D!=range.second;
227 if((*segment2D).dimension() != 2) {
228 if(
debug)
cout <<
"[DTSegment2DQuality]***Error: This is not 2D segment!!!" << endl;
232 LocalVector recSegDirection = (*segment2D).localDirection();
233 LocalPoint recSegPosition = (*segment2D).localPosition();
237 cout <<
" RecSegment direction: " << recSegDirection << endl
238 <<
" position : " << recSegPosition << endl
239 <<
" alpha : " << recSegAlpha << endl;
241 if(fabs(recSegAlpha - angleSimSeg) < deltaAlpha) {
242 deltaAlpha = fabs(recSegAlpha - angleSimSeg);
243 bestRecHit = &(*segment2D);
244 bestRecHitFound =
true;
248 if(bestRecHitFound) {
258 if(fabs(angleBestRHit - angleSimSeg) < 5*sigmaResAngle &&
259 fabs(bestRecHitLocalPos.
x() - posSimSeg) < 5*sigmaResPos) {
265 if((*slId).superlayer() == 1 || (*slId).superlayer() == 3) {
267 }
else if((*slId).superlayer() == 2) {
268 h2DHitRZ->
Fill(angleSimSeg,
271 bestRecHitLocalPos.
x(),
274 sqrt(bestRecHitLocalPosErr.
xx()),
275 sqrt(bestRecHitLocalDirErr.
xx())
277 if(
abs((*slId).wheel()) == 0)
279 else if(
abs((*slId).wheel()) == 1)
281 else if(
abs((*slId).wheel()) == 2)
284 hRes->
Fill(angleSimSeg,
287 bestRecHitLocalPos.
x(),
290 sqrt(bestRecHitLocalPosErr.
xx()),
291 sqrt(bestRecHitLocalDirErr.
xx())
298 if((*slId).superlayer() == 1 || (*slId).superlayer() == 3) {
299 hEff = h2DHitEff_RPhi;
300 }
else if((*slId).superlayer() == 2) {
301 h2DHitEff_RZ->
Fill(etaSimSeg, phiSimSeg, posSimSeg, angleSimSeg, recHitFound);
302 if(
abs((*slId).wheel()) == 0)
303 hEff = h2DHitEff_RZ_W0;
304 else if(
abs((*slId).wheel()) == 1)
305 hEff = h2DHitEff_RZ_W1;
306 else if(
abs((*slId).wheel()) == 2)
307 hEff = h2DHitEff_RZ_W2;
309 hEff->
Fill(etaSimSeg, phiSimSeg, posSimSeg, angleSimSeg, recHitFound);
T getParameter(std::string const &) const
virtual LocalError localPositionError() const
local position error in SL frame
T getUntrackedParameter(std::string const &, T const &) const
virtual ~DTSegment2DQuality()
Destructor.
std::pair< const_iterator, const_iterator > range
iterator range
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Geom::Phi< T > phi() const
virtual LocalError localDirectionError() const
the local direction error (xx,xy,yy) in SL frame: only xx is not 0.
DTSegment2DQuality(const edm::ParameterSet &pset)
Constructor.
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::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) ...
C::const_iterator const_iterator
constant access iterator type
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup)
Perform the real analysis.
void Fill(float angleSimSegment, float angleRecSegment, float posSimSegment, float posRecSegment, float etaSimSegment, float phiSimSegment, float sigmaPos, float sigmaAngle)
void setVerbose(unsigned level)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
static std::pair< double, double > findSegmentAlphaAndBeta(const LocalVector &direction)
Find the angles from a segment direction:
virtual LocalPoint localPosition() const
local position in SL frame
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 ob...
void Fill(float etaSimSegm, float phiSimSegm, float posSimSegm, float angleSimSegm, bool fillRecHit)
virtual LocalVector localDirection() const
the local direction in SL frame
std::vector< PSimHit > PSimHitContainer
static std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
void showDirStructure(void) const