Perform the real analysis.
154 map<DTChamberId, PSimHitContainer > simHitsPerCh;
155 for(PSimHitContainer::const_iterator simHit = simHits->begin();
156 simHit != simHits->end(); simHit++){
158 DTChamberId chamberId = (((
DTWireId(simHit->detUnitId())).layerId()).superlayerId()).chamberId();
160 simHitsPerCh[chamberId].push_back(*simHit);
169 <<
" in this event, skipping!" << endl;
175 for (chamberId = segment4Ds->id_begin();
176 chamberId != segment4Ds->id_end();
179 if((*chamberId).station() == 4)
189 int nMuSimHit = muSimHitPerWire.size();
190 if(nMuSimHit == 0 || nMuSimHit == 1) {
191 if(
debug && nMuSimHit == 1)
192 cout <<
"[DTSegment4DQuality] Only " << nMuSimHit <<
" mu SimHit in this chamber, skipping!" << endl;
196 cout <<
"=== Chamber " << (*chamberId) <<
" has " << nMuSimHit <<
" SimHits" << endl;
203 (*chamberId),&(*dtGeom));
205 LocalVector simSegmLocalDir = dirAndPosSimSegm.first;
206 LocalPoint simSegmLocalPos = dirAndPosSimSegm.second;
207 const DTChamber* chamber = dtGeom->chamber(*chamberId);
215 float xSimSeg = simSegmLocalPos.
x();
216 float ySimSeg = simSegmLocalPos.
y();
218 float etaSimSeg = simSegmGlobalPos.
eta();
219 float phiSimSeg = simSegmGlobalPos.
phi();
222 cout<<
" Simulated segment: local direction "<<simSegmLocalDir<<endl
223 <<
" local position "<<simSegmLocalPos<<endl
224 <<
" alpha "<<alphaSimSeg<<endl
225 <<
" beta "<<betaSimSeg<<endl;
229 bool recHitFound =
false;
231 int nsegm = distance(range.first, range.second);
233 cout <<
" Chamber: " << *chamberId <<
" has " << nsegm
234 <<
" 4D segments" << endl;
243 bool bestRecHitFound =
false;
244 double deltaAlpha = 99999;
248 segment4D!=range.second;
260 t0phi = phiSeg->
t0();
261 nHitPhi = phiSeg->
recHits().size();
266 nHitZ = zSeg->
recHits().size();
269 hHitMult[
abs((*chamberId).wheel())][(*chamberId).station()-1]->
Fill(nHitPhi,nHitZ);
270 ht0[
abs((*chamberId).wheel())][(*chamberId).station()-1]->
Fill(t0phi,t0z);
277 if((*segment4D).dimension() != 4) {
278 if(
debug)
cout <<
"[DTSegment4DQuality]***Error: This is not 4D segment!!!" << endl;
282 LocalVector recSegDirection = (*segment4D).localDirection();
287 cout <<
" RecSegment direction: " << recSegDirection << endl
288 <<
" position : " << (*segment4D).localPosition() << endl
289 <<
" alpha : " << recSegAlpha << endl
292 if(fabs(recSegAlpha - alphaSimSeg) < deltaAlpha) {
293 deltaAlpha = fabs(recSegAlpha - alphaSimSeg);
294 bestRecHit = &(*segment4D);
295 bestRecHitFound =
true;
299 if(bestRecHitFound) {
329 simSegLocalPosRZTmp + simSegLocalDirRZ*(-simSegLocalPosRZTmp.
z()/(
cos(simSegLocalDirRZ.
theta())));
333 "RZ SL: recPos " << bestRecHitLocalPosRZ <<
334 "recDir " << bestRecHitLocalDirRZ <<
335 "recAlpha " << alphaBestRHitRZ << endl <<
336 "RZ SL: simPos " << simSegLocalPosRZ <<
337 "simDir " << simSegLocalDirRZ <<
338 "simAlpha " << alphaSimSegRZ << endl ;
344 fabs(bestRecHitLocalPos.
x() - xSimSeg) < 5*
sigmaResX &&
345 fabs(bestRecHitLocalPos.
y() - ySimSeg) < 5*
sigmaResY) {
352 if((*chamberId).wheel() == 0)
354 else if(
abs((*chamberId).wheel()) == 1)
356 else if(
abs((*chamberId).wheel()) == 2)
359 histo->
Fill(alphaSimSeg,
364 bestRecHitLocalPos.
x(),
366 bestRecHitLocalPos.
y(),
369 bestRecHitLocalPosRZ.
x(),
370 simSegLocalPosRZ.
x(),
373 sqrt(bestRecHitLocalDirErr.
xx()),
374 sqrt(bestRecHitLocalDirErr.
yy()),
375 sqrt(bestRecHitLocalPosErr.
xx()),
376 sqrt(bestRecHitLocalPosErr.
yy()),
377 sqrt(bestRecHitLocalDirErrRZ.
xx()),
378 sqrt(bestRecHitLocalPosErrRZ.
xx())
386 bestRecHitLocalPos.
x(),
388 bestRecHitLocalPos.
y(),
391 bestRecHitLocalPosRZ.
x(),
392 simSegLocalPosRZ.
x(),
395 sqrt(bestRecHitLocalDirErr.
xx()),
396 sqrt(bestRecHitLocalDirErr.
yy()),
397 sqrt(bestRecHitLocalPosErr.
xx()),
398 sqrt(bestRecHitLocalPosErr.
yy()),
399 sqrt(bestRecHitLocalDirErrRZ.
xx()),
400 sqrt(bestRecHitLocalPosErrRZ.
xx())
408 bestRecHitLocalPos.
x(),
410 bestRecHitLocalPos.
y(),
413 bestRecHitLocalPosRZ.
x(),
414 simSegLocalPosRZ.
x(),
417 sqrt(bestRecHitLocalDirErr.
xx()),
418 sqrt(bestRecHitLocalDirErr.
yy()),
419 sqrt(bestRecHitLocalPosErr.
xx()),
420 sqrt(bestRecHitLocalPosErr.
yy()),
421 sqrt(bestRecHitLocalDirErrRZ.
xx()),
422 sqrt(bestRecHitLocalPosErrRZ.
xx())
434 if((*chamberId).wheel() == 0)
436 else if(
abs((*chamberId).wheel()) == 1)
438 else if(
abs((*chamberId).wheel()) == 2)
440 heff->
Fill(etaSimSeg, phiSimSeg, xSimSeg, ySimSeg, alphaSimSeg, betaSimSeg, recHitFound);
441 hEff_All->
Fill(etaSimSeg, phiSimSeg, xSimSeg, ySimSeg, alphaSimSeg, betaSimSeg, recHitFound);
442 if (
local)
hEffWS[
abs((*chamberId).wheel())][(*chamberId).station()-1]->
Fill(etaSimSeg, phiSimSeg, xSimSeg, ySimSeg, alphaSimSeg, betaSimSeg, recHitFound);
virtual LocalError localPositionError() const
local position error in SL frame
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
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
virtual LocalError localDirectionError() const
the local direction error (xx,xy,yy) in SL frame: only xx is not 0.
static std::map< DTWireId, const PSimHit * > mapMuSimHitsPerWire(const std::map< DTWireId, edm::PSimHitContainer > &simHitWireMap)
Create a map between the Mu SimHits and corresponding MuBarWireId ;.
Geom::Theta< T > theta() const
virtual LocalError localPositionError() const
Local position error in Chamber frame.
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) ...
virtual LocalVector localDirection() const
Local direction in Chamber frame.
edm::InputTag segment4DLabel
C::const_iterator const_iterator
constant access iterator type
HRes4DHit * h4DHitWS[3][4]
virtual std::vector< const TrackingRecHit * > recHits() const
Access to component RecHits (if any)
void Fill(float simDirectionAlpha, float recDirectionAlpha, float simDirectionBeta, float recDirectionBeta, float simX, float recX, float simY, float recY, float simEta, float simPhi, float recYRZ, float simYRZ, float recBetaRZ, float simBetaRZ, float sigmaAlpha, float sigmaBeta, float sigmaX, float sigmaY, float sigmaBetaRZ, float sigmaYRZ)
Cos< T >::type cos(const T &t)
MonitorElement * hHitMult[3][4]
A set of histograms for efficiency 4D RecHits.
virtual LocalPoint localPosition() const
Local position in Chamber frame.
static std::pair< double, double > findSegmentAlphaAndBeta(const LocalVector &direction)
Find the angles from a segment direction:
DTSuperLayerId superLayerId() const
The id of the superlayer on which reside the segment.
virtual LocalPoint localPosition() const
local position in SL frame
const DTSLRecSegment2D * zSegment() const
The Z segment: 0 if not zed projection available.
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...
edm::InputTag simHitLabel
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)
double t0() const
Get the segment t0 (if recomputed, 0 is returned otherwise)
void Fill(float etaSimSegm, float phiSimSegm, float xSimSegm, float ySimSegm, float alphaSimSegm, float betaSimSegm, bool fillRecHit)
MonitorElement * ht0[3][4]
virtual LocalError localDirectionError() const
Local direction error in the Chamber frame.