39 debug_ =
pset.getUntrackedParameter<
bool>(
"debug");
53 doall_ =
pset.getUntrackedParameter<
bool>(
"doall",
false);
54 local_ =
pset.getUntrackedParameter<
bool>(
"local",
false);
64 histograms.h2DHitEff_SuperPhi = std::make_unique<HEff2DHit>(
"SuperPhi", booker);
80 map<DTChamberId, PSimHitContainer> simHitsPerCh;
85 simHitsPerCh[chamberId].push_back(
simHit);
94 cout <<
"[DTSegment2DSLPhiQuality]**Warning: no 4D Segments with label: " <<
segment4DLabel_
95 <<
" in this event, skipping!" << endl;
102 for (chamberId = segment4Ds->id_begin(); chamberId != segment4Ds->id_end(); ++chamberId) {
110 int nMuSimHit = muSimHitPerWire.size();
111 if (nMuSimHit == 0 || nMuSimHit == 1) {
112 if (
debug_ && nMuSimHit == 1) {
113 cout <<
"[DTSegment2DSLPhiQuality] Only " << nMuSimHit <<
" mu SimHit in this chamber, skipping!" << endl;
118 cout <<
"=== Chamber " << (*chamberId) <<
" has " << nMuSimHit <<
" SimHits" << endl;
125 pair<LocalVector, LocalPoint> dirAndPosSimSegm =
128 LocalVector simSegmLocalDir = dirAndPosSimSegm.first;
129 LocalPoint simSegmLocalPos = dirAndPosSimSegm.second;
135 float posSimSeg = simSegmLocalPos.
x();
137 float etaSimSeg = simSegmGlobalPos.
eta();
138 float phiSimSeg = simSegmGlobalPos.
phi();
141 cout <<
" Simulated segment: local direction " << simSegmLocalDir << endl
142 <<
" local position " << simSegmLocalPos << endl
143 <<
" angle " << angleSimSeg << endl;
148 bool recHitFound =
false;
152 cout <<
" Chamber: " << *chamberId <<
" has " << nsegm <<
" 4D segments" << endl;
162 bool bestRecHitFound =
false;
163 double deltaAlpha = 99999;
168 if ((*segment4D).dimension() != 4) {
170 cout <<
"[DTSegment2DSLPhiQuality]***Error: This is not 4D "
179 if ((*phiSegment2D).dimension() != 2) {
181 cout <<
"[DTSegment2DQuality]***Error: This is not 2D segment!!!" << endl;
187 LocalVector recSegDirection = (*phiSegment2D).localDirection();
191 cout <<
" RecSegment direction: " << recSegDirection << endl
192 <<
" position : " << (*phiSegment2D).localPosition() << endl
193 <<
" alpha : " << recSegAlpha << endl;
196 if (fabs(recSegAlpha - angleSimSeg) < deltaAlpha) {
197 deltaAlpha = fabs(recSegAlpha - angleSimSeg);
198 bestRecHit = &(*phiSegment2D);
199 bestRecHitFound =
true;
203 if (bestRecHitFound) {
213 fabs(bestRecHitLocalPos.
x() - posSimSeg) < 5 *
sigmaResPos_) {
221 bestRecHitLocalPos.
x(),
224 sqrt(bestRecHitLocalPosErr.
xx()),
225 sqrt(bestRecHitLocalDirErr.
xx()));
231 histograms.h2DHitEff_SuperPhi->fill(etaSimSeg, phiSimSeg, posSimSeg, angleSimSeg, recHitFound);