56 sigmaResAlpha = pset.
getParameter<
double>(
"sigmaResAlpha");
57 sigmaResBeta = pset.
getParameter<
double>(
"sigmaResBeta");
77 if (
debug ) dbe_->showDirStructure();
80 h4DHit=
new HRes4DHit (
"All",dbe_,doall,local);
81 h4DHit_W0=
new HRes4DHit (
"W0",dbe_,doall,local);
82 h4DHit_W1=
new HRes4DHit (
"W1",dbe_,doall,local);
83 h4DHit_W2=
new HRes4DHit (
"W2",dbe_,doall,local);
113 hEff_All->ComputeEfficiency();
114 hEff_W0->ComputeEfficiency();
115 hEff_W1->ComputeEfficiency();
116 hEff_W2->ComputeEfficiency();
137 event.getByLabel(simHitLabel, simHits);
140 map<DTChamberId, PSimHitContainer > simHitsPerCh;
141 for(PSimHitContainer::const_iterator simHit = simHits->begin();
142 simHit != simHits->end(); simHit++){
144 DTChamberId chamberId = (((
DTWireId(simHit->detUnitId())).layerId()).superlayerId()).chamberId();
146 simHitsPerCh[chamberId].push_back(*simHit);
151 event.getByLabel(segment4DLabel, segment4Ds);
154 if(
debug)
cout <<
"[DTSegment4DQuality]**Warning: no 4D Segments with label: " <<segment4DLabel
155 <<
" in this event, skipping!" << endl;
161 for (chamberId = segment4Ds->id_begin();
162 chamberId != segment4Ds->id_end();
165 if((*chamberId).station() == 4)
175 int nMuSimHit = muSimHitPerWire.size();
176 if(nMuSimHit == 0 || nMuSimHit == 1) {
177 if(
debug && nMuSimHit == 1)
178 cout <<
"[DTSegment4DQuality] Only " << nMuSimHit <<
" mu SimHit in this chamber, skipping!" << endl;
182 cout <<
"=== Chamber " << (*chamberId) <<
" has " << nMuSimHit <<
" SimHits" << endl;
189 (*chamberId),&(*dtGeom));
191 LocalVector simSegmLocalDir = dirAndPosSimSegm.first;
192 LocalPoint simSegmLocalPos = dirAndPosSimSegm.second;
193 const DTChamber* chamber = dtGeom->chamber(*chamberId);
201 float xSimSeg = simSegmLocalPos.
x();
202 float ySimSeg = simSegmLocalPos.
y();
204 float etaSimSeg = simSegmGlobalPos.
eta();
205 float phiSimSeg = simSegmGlobalPos.
phi();
208 cout<<
" Simulated segment: local direction "<<simSegmLocalDir<<endl
209 <<
" local position "<<simSegmLocalPos<<endl
210 <<
" alpha "<<alphaSimSeg<<endl
211 <<
" beta "<<betaSimSeg<<endl;
215 bool recHitFound =
false;
217 int nsegm = distance(range.first, range.second);
219 cout <<
" Chamber: " << *chamberId <<
" has " << nsegm
220 <<
" 4D segments" << endl;
229 bool bestRecHitFound =
false;
230 double deltaAlpha = 99999;
234 segment4D!=range.second;
237 if((*segment4D).dimension() != 4) {
238 if(
debug)
cout <<
"[DTSegment4DQuality]***Error: This is not 4D segment!!!" << endl;
242 LocalVector recSegDirection = (*segment4D).localDirection();
247 cout <<
" RecSegment direction: " << recSegDirection << endl
248 <<
" position : " << (*segment4D).localPosition() << endl
249 <<
" alpha : " << recSegAlpha << endl
252 if(fabs(recSegAlpha - alphaSimSeg) < deltaAlpha) {
253 deltaAlpha = fabs(recSegAlpha - alphaSimSeg);
254 bestRecHit = &(*segment4D);
255 bestRecHitFound =
true;
259 if(bestRecHitFound) {
289 simSegLocalPosRZTmp + simSegLocalDirRZ*(-simSegLocalPosRZTmp.
z()/(
cos(simSegLocalDirRZ.
theta())));
293 "RZ SL: recPos " << bestRecHitLocalPosRZ <<
294 "recDir " << bestRecHitLocalDirRZ <<
295 "recAlpha " << alphaBestRHitRZ << endl <<
296 "RZ SL: simPos " << simSegLocalPosRZ <<
297 "simDir " << simSegLocalDirRZ <<
298 "simAlpha " << alphaSimSegRZ << endl ;
302 if(fabs(alphaBestRHit - alphaSimSeg) < 5*sigmaResAlpha &&
303 fabs(betaBestRHit - betaSimSeg) < 5*sigmaResBeta &&
304 fabs(bestRecHitLocalPos.
x() - xSimSeg) < 5*sigmaResX &&
305 fabs(bestRecHitLocalPos.
y() - ySimSeg) < 5*sigmaResY) {
312 if((*chamberId).wheel() == 0)
314 else if(
abs((*chamberId).wheel()) == 1)
316 else if(
abs((*chamberId).wheel()) == 2)
319 histo->
Fill(alphaSimSeg,
324 bestRecHitLocalPos.
x(),
326 bestRecHitLocalPos.
y(),
329 bestRecHitLocalPosRZ.
x(),
330 simSegLocalPosRZ.
x(),
333 sqrt(bestRecHitLocalDirErr.
xx()),
334 sqrt(bestRecHitLocalDirErr.
yy()),
335 sqrt(bestRecHitLocalPosErr.
xx()),
336 sqrt(bestRecHitLocalPosErr.
yy()),
337 sqrt(bestRecHitLocalDirErrRZ.
xx()),
338 sqrt(bestRecHitLocalPosErrRZ.
xx())
341 h4DHit->Fill(alphaSimSeg,
346 bestRecHitLocalPos.
x(),
348 bestRecHitLocalPos.
y(),
351 bestRecHitLocalPosRZ.
x(),
352 simSegLocalPosRZ.
x(),
355 sqrt(bestRecHitLocalDirErr.
xx()),
356 sqrt(bestRecHitLocalDirErr.
yy()),
357 sqrt(bestRecHitLocalPosErr.
xx()),
358 sqrt(bestRecHitLocalPosErr.
yy()),
359 sqrt(bestRecHitLocalDirErrRZ.
xx()),
360 sqrt(bestRecHitLocalPosErrRZ.
xx())
369 if((*chamberId).wheel() == 0)
371 else if(
abs((*chamberId).wheel()) == 1)
373 else if(
abs((*chamberId).wheel()) == 2)
375 heff->
Fill(etaSimSeg, phiSimSeg, xSimSeg, ySimSeg, alphaSimSeg, betaSimSeg, recHitFound);
376 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.
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
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.