40 debug_ =
pset.getUntrackedParameter<
bool>(
"debug");
44 simHitLabel_ =
pset.getUntrackedParameter<
InputTag>(
"simHitLabel");
45 simHitToken_ = consumes<PSimHitContainer>(
pset.getUntrackedParameter<
InputTag>(
"simHitLabel"));
47 segment4DLabel_ =
pset.getUntrackedParameter<
InputTag>(
"segment4DLabel");
48 segment4DToken_ = consumes<DTRecSegment4DCollection>(
pset.getUntrackedParameter<
InputTag>(
"segment4DLabel"));
51 sigmaResPos_ =
pset.getParameter<
double>(
"sigmaResPos");
53 sigmaResAngle_ =
pset.getParameter<
double>(
"sigmaResAngle");
54 doall_ =
pset.getUntrackedParameter<
bool>(
"doall",
false);
55 local_ =
pset.getUntrackedParameter<
bool>(
"local",
false);
63 histograms.h2DHitSuperPhi = std::make_unique<HRes2DHit>(
"SuperPhi", booker, doall_, local_);
65 histograms.h2DHitEff_SuperPhi = std::make_unique<HEff2DHit>(
"SuperPhi", booker);
79 event.getByToken(simHitToken_,
simHits);
82 map<DTChamberId, PSimHitContainer> simHitsPerCh;
87 simHitsPerCh[chamberId].push_back(
simHit);
92 event.getByToken(segment4DToken_, segment4Ds);
96 cout <<
"[DTSegment2DSLPhiQuality]**Warning: no 4D Segments with label: " << segment4DLabel_
97 <<
" in this event, skipping!" << endl;
104 for (chamberId = segment4Ds->id_begin(); chamberId != segment4Ds->id_end(); ++chamberId) {
112 int nMuSimHit = muSimHitPerWire.size();
113 if (nMuSimHit == 0 || nMuSimHit == 1) {
114 if (debug_ && nMuSimHit == 1) {
115 cout <<
"[DTSegment2DSLPhiQuality] Only " << nMuSimHit <<
" mu SimHit in this chamber, skipping!" << endl;
120 cout <<
"=== Chamber " << (*chamberId) <<
" has " << nMuSimHit <<
" SimHits" << endl;
127 pair<LocalVector, LocalPoint> dirAndPosSimSegm =
130 LocalVector simSegmLocalDir = dirAndPosSimSegm.first;
131 LocalPoint simSegmLocalPos = dirAndPosSimSegm.second;
137 float posSimSeg = simSegmLocalPos.
x();
139 float etaSimSeg = simSegmGlobalPos.
eta();
140 float phiSimSeg = simSegmGlobalPos.
phi();
143 cout <<
" Simulated segment: local direction " << simSegmLocalDir << endl
144 <<
" local position " << simSegmLocalPos << endl
145 <<
" angle " << angleSimSeg << endl;
150 bool recHitFound =
false;
154 cout <<
" Chamber: " << *chamberId <<
" has " << nsegm <<
" 4D segments" << endl;
164 bool bestRecHitFound =
false;
165 double deltaAlpha = 99999;
170 if ((*segment4D).dimension() != 4) {
172 cout <<
"[DTSegment2DSLPhiQuality]***Error: This is not 4D "
181 if ((*phiSegment2D).dimension() != 2) {
183 cout <<
"[DTSegment2DQuality]***Error: This is not 2D segment!!!" << endl;
189 LocalVector recSegDirection = (*phiSegment2D).localDirection();
193 cout <<
" RecSegment direction: " << recSegDirection << endl
194 <<
" position : " << (*phiSegment2D).localPosition() << endl
195 <<
" alpha : " << recSegAlpha << endl;
198 if (fabs(recSegAlpha - angleSimSeg) < deltaAlpha) {
199 deltaAlpha = fabs(recSegAlpha - angleSimSeg);
200 bestRecHit = &(*phiSegment2D);
201 bestRecHitFound =
true;
205 if (bestRecHitFound) {
214 if (fabs(angleBestRHit - angleSimSeg) < 5 * sigmaResAngle_ &&
215 fabs(bestRecHitLocalPos.
x() - posSimSeg) < 5 * sigmaResPos_) {
223 bestRecHitLocalPos.
x(),
226 sqrt(bestRecHitLocalPosErr.
xx()),
227 sqrt(bestRecHitLocalDirErr.
xx()));
233 histograms.h2DHitEff_SuperPhi->fill(etaSimSeg, phiSimSeg, posSimSeg, angleSimSeg, recHitFound);