Perform the real analysis.
101 map<DTSuperLayerId, PSimHitContainer> simHitsPerSl;
102 for (
const auto &
simHit : *simHits) {
106 simHitsPerSl[slId].push_back(
simHit);
113 if (not segment2Ds.
isValid()) {
116 <<
" in this event, skipping !" << endl;
123 for (slId = segment2Ds->id_begin(); slId != segment2Ds->id_end(); ++slId) {
131 int nMuSimHit = muSimHitPerWire.size();
132 if (nMuSimHit == 0
or nMuSimHit == 1) {
133 if (
debug_ and nMuSimHit == 1) {
134 cout <<
"[DTSegment2DQuality] Only " << nMuSimHit <<
" mu SimHit in this SL, skipping !" << endl;
139 cout <<
"=== SL " << (*slId) <<
" has " << nMuSimHit <<
" SimHits" << endl;
145 if (inAndOutSimHit.first == inAndOutSimHit.second) {
146 cout <<
"[DTHitQualityUtils]***Warning: outermost and innermost SimHit " 153 pair<LocalVector, LocalPoint> dirAndPosSimSegm =
156 LocalVector simSegmLocalDir = dirAndPosSimSegm.first;
157 LocalPoint simSegmLocalPos = dirAndPosSimSegm.second;
159 cout <<
" Simulated segment: local direction " << simSegmLocalDir << endl
160 <<
" local position " << simSegmLocalPos << endl;
167 float posSimSeg = simSegmLocalPos.
x();
169 float etaSimSeg = simSegmGlobalPos.
eta();
170 float phiSimSeg = simSegmGlobalPos.
phi();
174 bool recHitFound =
false;
176 int nsegm =
distance(range.first, range.second);
178 cout <<
" Sl: " << *slId <<
" has " << nsegm <<
" 2D segments" << endl;
188 bool bestRecHitFound =
false;
189 double deltaAlpha = 99999;
194 if ((*segment2D).dimension() != 2) {
196 cout <<
"[DTSegment2DQuality]***Error: This is not 2D segment !!!" << endl;
201 LocalVector recSegDirection = (*segment2D).localDirection();
202 LocalPoint recSegPosition = (*segment2D).localPosition();
206 cout <<
" RecSegment direction: " << recSegDirection << endl
207 <<
" position : " << recSegPosition << endl
208 <<
" alpha : " << recSegAlpha << endl;
211 if (fabs(recSegAlpha - angleSimSeg) < deltaAlpha) {
212 deltaAlpha = fabs(recSegAlpha - angleSimSeg);
213 bestRecHit = &(*segment2D);
214 bestRecHitFound =
true;
218 if (bestRecHitFound) {
229 fabs(bestRecHitLocalPos.
x() - posSimSeg) < 5 *
sigmaResPos_) {
235 if ((*slId).superlayer() == 1
or (*slId).superlayer() == 3) {
237 }
else if ((*slId).superlayer() == 2) {
241 bestRecHitLocalPos.
x(),
244 sqrt(bestRecHitLocalPosErr.
xx()),
245 sqrt(bestRecHitLocalDirErr.
xx()));
246 if (
abs((*slId).wheel()) == 0) {
248 }
else if (
abs((*slId).wheel()) == 1) {
250 }
else if (
abs((*slId).wheel()) == 2) {
254 hRes->
fill(angleSimSeg,
257 bestRecHitLocalPos.
x(),
260 sqrt(bestRecHitLocalPosErr.
xx()),
261 sqrt(bestRecHitLocalDirErr.
xx()));
267 if ((*slId).superlayer() == 1
or (*slId).superlayer() == 3) {
269 }
else if ((*slId).superlayer() == 2) {
270 histograms.h2DHitEff_RZ->fill(etaSimSeg, phiSimSeg, posSimSeg, angleSimSeg, recHitFound);
271 if (
abs((*slId).wheel()) == 0) {
273 }
else if (
abs((*slId).wheel()) == 1) {
275 }
else if (
abs((*slId).wheel()) == 2) {
279 hEff->
fill(etaSimSeg, phiSimSeg, posSimSeg, angleSimSeg, recHitFound);
std::pair< double, double > findSegmentAlphaAndBeta(const LocalVector &direction)
LocalError localPositionError() const override
local position error in SL frame
void fill(float angleSimSegment, float angleRecSegment, float posSimSegment, float posRecSegment, float etaSimSegment, float phiSimSegment, float sigmaPos, float sigmaAngle)
std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
std::pair< const_iterator, const_iterator > range
iterator range
edm::EDGetTokenT< edm::PSimHitContainer > simHitToken_
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
void fill(float etaSimSegm, float phiSimSegm, float posSimSegm, float angleSimSegm, bool fillRecHit)
Geom::Phi< T > phi() const
C::const_iterator const_iterator
constant access iterator type
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
std::map< DTWireId, const PSimHit * > mapMuSimHitsPerWire(const std::map< DTWireId, edm::PSimHitContainer > &simHitWireMap)
Create a map between the Mu SimHits and corresponding MuBarWireId ;.
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< DTRecSegment2DCollection > segment2DToken_
std::pair< const PSimHit *, const PSimHit * > findMuSimSegment(const std::map< DTWireId, const PSimHit * > &mapWireAndMuSimHit)
LocalPoint localPosition() const override
local position in SL frame
std::pair< LocalVector, LocalPoint > findMuSimSegmentDirAndPos(const std::pair< const PSimHit *, const PSimHit * > &inAndOutSimHit, const DetId detId, const DTGeometry *muonGeom)
LocalVector localDirection() const override
the local direction in SL frame
std::vector< PSimHit > PSimHitContainer
LocalError localDirectionError() const override
the local direction error (xx,xy,yy) in SL frame: only xx is not 0.
edm::InputTag segment2DLabel_
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return a DTSuperLayer given its id.