55 sigmaResAlpha = pset.
getParameter<
double>(
"sigmaResAlpha");
56 sigmaResBeta = pset.
getParameter<
double>(
"sigmaResBeta");
87 hEff_All->ComputeEfficiency();
88 hEff_W0->ComputeEfficiency();
89 hEff_W1->ComputeEfficiency();
90 hEff_W2->ComputeEfficiency();
110 event.getByLabel(simHitLabel,
"MuonDTHits", simHits);
113 map<DTChamberId, PSimHitContainer > simHitsPerCh;
114 for(PSimHitContainer::const_iterator simHit = simHits->begin();
115 simHit != simHits->end(); simHit++){
117 DTChamberId chamberId = (((
DTWireId(simHit->detUnitId())).layerId()).superlayerId()).chamberId();
119 simHitsPerCh[chamberId].push_back(*simHit);
124 event.getByLabel(segment4DLabel, segment4Ds);
128 for (chamberId = segment4Ds->id_begin();
129 chamberId != segment4Ds->id_end();
132 if((*chamberId).station() == 4)
142 int nMuSimHit = muSimHitPerWire.size();
143 if(nMuSimHit == 0 || nMuSimHit == 1) {
144 if(
debug && nMuSimHit == 1)
145 cout <<
"[DTSegment4DQuality] Only " << nMuSimHit <<
" mu SimHit in this chamber, skipping!" << endl;
149 cout <<
"=== Chamber " << (*chamberId) <<
" has " << nMuSimHit <<
" SimHits" << endl;
156 (*chamberId),&(*dtGeom));
158 LocalVector simSegmLocalDir = dirAndPosSimSegm.first;
159 LocalPoint simSegmLocalPos = dirAndPosSimSegm.second;
160 const DTChamber* chamber = dtGeom->chamber(*chamberId);
168 float xSimSeg = simSegmLocalPos.
x();
169 float ySimSeg = simSegmLocalPos.
y();
171 float etaSimSeg = simSegmGlobalPos.
eta();
172 float phiSimSeg = simSegmGlobalPos.
phi();
175 cout<<
" Simulated segment: local direction "<<simSegmLocalDir<<endl
176 <<
" local position "<<simSegmLocalPos<<endl
177 <<
" alpha "<<alphaSimSeg<<endl
178 <<
" beta "<<betaSimSeg<<endl;
182 bool recHitFound =
false;
184 int nsegm = distance(range.first, range.second);
186 cout <<
" Chamber: " << *chamberId <<
" has " << nsegm
187 <<
" 4D segments" << endl;
196 bool bestRecHitFound =
false;
197 double deltaAlpha = 99999;
201 segment4D!=range.second;
204 if((*segment4D).dimension() != 4) {
205 if(
debug)
cout <<
"[DTSegment4DQuality]***Error: This is not 4D segment!!!" << endl;
209 LocalVector recSegDirection = (*segment4D).localDirection();
214 cout <<
" RecSegment direction: " << recSegDirection << endl
215 <<
" position : " << (*segment4D).localPosition() << endl
216 <<
" alpha : " << recSegAlpha << endl
219 if(fabs(recSegAlpha - alphaSimSeg) < deltaAlpha) {
220 deltaAlpha = fabs(recSegAlpha - alphaSimSeg);
221 bestRecHit = &(*segment4D);
222 bestRecHitFound =
true;
226 if(bestRecHitFound) {
256 simSegLocalPosRZTmp + simSegLocalDirRZ*(-simSegLocalPosRZTmp.
z()/(
cos(simSegLocalDirRZ.
theta())));
260 "RZ SL: recPos " << bestRecHitLocalPosRZ <<
261 "recDir " << bestRecHitLocalDirRZ <<
262 "recAlpha " << alphaBestRHitRZ << endl <<
263 "RZ SL: simPos " << simSegLocalPosRZ <<
264 "simDir " << simSegLocalDirRZ <<
265 "simAlpha " << alphaSimSegRZ << endl ;
269 if(fabs(alphaBestRHit - alphaSimSeg) < 5*sigmaResAlpha &&
270 fabs(betaBestRHit - betaSimSeg) < 5*sigmaResBeta &&
271 fabs(bestRecHitLocalPos.
x() - xSimSeg) < 5*sigmaResX &&
272 fabs(bestRecHitLocalPos.
y() - ySimSeg) < 5*sigmaResY) {
279 if((*chamberId).wheel() == 0)
281 else if(
abs((*chamberId).wheel()) == 1)
283 else if(
abs((*chamberId).wheel()) == 2)
286 histo->
Fill(alphaSimSeg,
291 bestRecHitLocalPos.
x(),
293 bestRecHitLocalPos.
y(),
296 bestRecHitLocalPosRZ.
x(),
297 simSegLocalPosRZ.
x(),
300 sqrt(bestRecHitLocalDirErr.
xx()),
301 sqrt(bestRecHitLocalDirErr.
yy()),
302 sqrt(bestRecHitLocalPosErr.
xx()),
303 sqrt(bestRecHitLocalPosErr.
yy()),
304 sqrt(bestRecHitLocalDirErrRZ.
xx()),
305 sqrt(bestRecHitLocalPosErrRZ.
xx())
308 h4DHit->Fill(alphaSimSeg,
313 bestRecHitLocalPos.
x(),
315 bestRecHitLocalPos.
y(),
318 bestRecHitLocalPosRZ.
x(),
319 simSegLocalPosRZ.
x(),
322 sqrt(bestRecHitLocalDirErr.
xx()),
323 sqrt(bestRecHitLocalDirErr.
yy()),
324 sqrt(bestRecHitLocalPosErr.
xx()),
325 sqrt(bestRecHitLocalPosErr.
yy()),
326 sqrt(bestRecHitLocalDirErrRZ.
xx()),
327 sqrt(bestRecHitLocalPosErrRZ.
xx())
335 if((*chamberId).wheel() == 0)
337 else if(
abs((*chamberId).wheel()) == 1)
339 else if(
abs((*chamberId).wheel()) == 2)
341 heff->
Fill(etaSimSeg, phiSimSeg, xSimSeg, ySimSeg, alphaSimSeg, betaSimSeg, recHitFound);
342 hEff_All->Fill(etaSimSeg, phiSimSeg, xSimSeg, ySimSeg, alphaSimSeg, betaSimSeg, recHitFound);
T getParameter(std::string const &) const
virtual LocalError localPositionError() const
local position error in SL frame
T getUntrackedParameter(std::string const &, T const &) const
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.
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup)
Perform the real analysis.
virtual LocalError localDirectionError() const
the local direction error (xx,xy,yy) in SL frame: only xx is not 0.
virtual ~DTSegment4DQuality()
Destructor.
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.
C::const_iterator const_iterator
constant access iterator type
DTSegment4DQuality(const edm::ParameterSet &pset)
Constructor.
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)
A set of histograms for efficiency 4D RecHits.
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
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...
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)
void Fill(float etaSimSegm, float phiSimSegm, float xSimSegm, float ySimSegm, float alphaSimSegm, float betaSimSegm, bool fillRecHit)
virtual LocalError localDirectionError() const
Local direction error in the Chamber frame.