Perform the real analysis.
132 map<DTSuperLayerId, PSimHitContainer > simHitsPerSl;
133 for(PSimHitContainer::const_iterator simHit = simHits->begin();
134 simHit != simHits->end(); simHit++){
138 simHitsPerSl[slId].push_back(*simHit);
147 <<
" in this event, skipping!" << endl;
152 DTRecSegment2DCollection::id_iterator slId;
153 for (slId = segment2Ds->id_begin();
154 slId != segment2Ds->id_end();
164 int nMuSimHit = muSimHitPerWire.size();
165 if(nMuSimHit == 0 || nMuSimHit == 1) {
166 if(
debug && nMuSimHit == 1)
167 cout <<
"[DTSegment2DQuality] Only " << nMuSimHit <<
" mu SimHit in this SL, skipping!" << endl;
171 cout <<
"=== SL " << (*slId) <<
" has " << nMuSimHit <<
" SimHits" << endl;
176 if(inAndOutSimHit.first ==inAndOutSimHit.second ) {
177 cout <<
"[DTHitQualityUtils]***Warning: outermost and innermost SimHit are the same!" << endl;
185 LocalVector simSegmLocalDir = dirAndPosSimSegm.first;
186 LocalPoint simSegmLocalPos = dirAndPosSimSegm.second;
188 cout<<
" Simulated segment: local direction "<<simSegmLocalDir<<endl
189 <<
" local position "<<simSegmLocalPos<<endl;
190 const DTSuperLayer* superLayer = dtGeom->superLayer(*slId);
195 float posSimSeg = simSegmLocalPos.
x();
197 float etaSimSeg = simSegmGlobalPos.
eta();
198 float phiSimSeg = simSegmGlobalPos.
phi();
203 bool recHitFound =
false;
205 int nsegm = distance(range.first, range.second);
207 cout <<
" Sl: " << *slId <<
" has " << nsegm
208 <<
" 2D segments" << endl;
217 bool bestRecHitFound =
false;
218 double deltaAlpha = 99999;
222 segment2D!=range.second;
225 if((*segment2D).dimension() != 2) {
226 if(
debug)
cout <<
"[DTSegment2DQuality]***Error: This is not 2D segment!!!" << endl;
230 LocalVector recSegDirection = (*segment2D).localDirection();
231 LocalPoint recSegPosition = (*segment2D).localPosition();
235 cout <<
" RecSegment direction: " << recSegDirection << endl
236 <<
" position : " << recSegPosition << endl
237 <<
" alpha : " << recSegAlpha << endl;
239 if(fabs(recSegAlpha - angleSimSeg) < deltaAlpha) {
240 deltaAlpha = fabs(recSegAlpha - angleSimSeg);
241 bestRecHit = &(*segment2D);
242 bestRecHitFound =
true;
246 if(bestRecHitFound) {
257 fabs(bestRecHitLocalPos.
x() - posSimSeg) < 5*
sigmaResPos) {
263 if((*slId).superlayer() == 1 || (*slId).superlayer() == 3) {
265 }
else if((*slId).superlayer() == 2) {
269 bestRecHitLocalPos.
x(),
272 sqrt(bestRecHitLocalPosErr.
xx()),
273 sqrt(bestRecHitLocalDirErr.
xx())
275 if(
abs((*slId).wheel()) == 0)
277 else if(
abs((*slId).wheel()) == 1)
279 else if(
abs((*slId).wheel()) == 2)
282 hRes->
Fill(angleSimSeg,
285 bestRecHitLocalPos.
x(),
288 sqrt(bestRecHitLocalPosErr.
xx()),
289 sqrt(bestRecHitLocalDirErr.
xx())
296 if((*slId).superlayer() == 1 || (*slId).superlayer() == 3) {
298 }
else if((*slId).superlayer() == 2) {
299 h2DHitEff_RZ->
Fill(etaSimSeg, phiSimSeg, posSimSeg, angleSimSeg, recHitFound);
300 if(
abs((*slId).wheel()) == 0)
302 else if(
abs((*slId).wheel()) == 1)
304 else if(
abs((*slId).wheel()) == 2)
307 hEff->
Fill(etaSimSeg, phiSimSeg, posSimSeg, angleSimSeg, recHitFound);
virtual LocalError localPositionError() const
local position error in SL frame
std::pair< const_iterator, const_iterator > range
iterator range
edm::InputTag simHitLabel
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.
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) ...
void Fill(float angleSimSegment, float angleRecSegment, float posSimSegment, float posRecSegment, float etaSimSegment, float phiSimSegment, float sigmaPos, float sigmaAngle)
Abs< T >::type abs(const T &t)
HEff2DHit * h2DHitEff_RZ_W0
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...
HEff2DHit * h2DHitEff_RZ_W1
HEff2DHit * h2DHitEff_RPhi
void Fill(float etaSimSegm, float phiSimSegm, float posSimSegm, float angleSimSegm, bool fillRecHit)
edm::InputTag segment2DLabel
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)
HEff2DHit * h2DHitEff_RZ_W2