54 sigmaResAlpha = pset.
getParameter<
double>(
"sigmaResAlpha");
55 sigmaResBeta = pset.
getParameter<
double>(
"sigmaResBeta");
75 if (
debug ) dbe_->showDirStructure();
78 h4DHit=
new HRes4DHit (
"All",dbe_,doall,local);
79 h4DHit_W0=
new HRes4DHit (
"W0",dbe_,doall,local);
80 h4DHit_W1=
new HRes4DHit (
"W1",dbe_,doall,local);
81 h4DHit_W2=
new HRes4DHit (
"W2",dbe_,doall,local);
93 for (
long w=0;
w<=2;++
w) {
94 for (
long s=1;
s<=4;++
s){
96 TString nameWS=(name+
w+
"_St"+
s);
99 dbe_->setCurrentFolder(
"DT/4DSegments/");
100 hHitMult[
w][
s-1] = dbe_->book2D(
"4D_" +nameWS+
"_hNHits",
"NHits",12,0,12, 6,0,6);
101 ht0[
w][
s-1] = dbe_->book2D(
"4D_" +nameWS+
"_ht0",
"t0",200,-25,25,200,-25,25);
127 hEff_All->ComputeEfficiency();
128 hEff_W0->ComputeEfficiency();
129 hEff_W1->ComputeEfficiency();
130 hEff_W2->ComputeEfficiency();
151 event.getByLabel(simHitLabel, simHits);
154 map<DTChamberId, PSimHitContainer > simHitsPerCh;
155 for(PSimHitContainer::const_iterator simHit = simHits->begin();
156 simHit != simHits->end(); simHit++){
158 DTChamberId chamberId = (((
DTWireId(simHit->detUnitId())).layerId()).superlayerId()).chamberId();
160 simHitsPerCh[chamberId].push_back(*simHit);
165 event.getByLabel(segment4DLabel, segment4Ds);
168 if(
debug)
cout <<
"[DTSegment4DQuality]**Warning: no 4D Segments with label: " <<segment4DLabel
169 <<
" in this event, skipping!" << endl;
174 DTRecSegment4DCollection::id_iterator chamberId;
175 for (chamberId = segment4Ds->id_begin();
176 chamberId != segment4Ds->id_end();
179 if((*chamberId).station() == 4)
189 int nMuSimHit = muSimHitPerWire.size();
190 if(nMuSimHit == 0 || nMuSimHit == 1) {
191 if(
debug && nMuSimHit == 1)
192 cout <<
"[DTSegment4DQuality] Only " << nMuSimHit <<
" mu SimHit in this chamber, skipping!" << endl;
196 cout <<
"=== Chamber " << (*chamberId) <<
" has " << nMuSimHit <<
" SimHits" << endl;
203 (*chamberId),&(*dtGeom));
205 LocalVector simSegmLocalDir = dirAndPosSimSegm.first;
206 LocalPoint simSegmLocalPos = dirAndPosSimSegm.second;
207 const DTChamber* chamber = dtGeom->chamber(*chamberId);
215 float xSimSeg = simSegmLocalPos.
x();
216 float ySimSeg = simSegmLocalPos.
y();
218 float etaSimSeg = simSegmGlobalPos.
eta();
219 float phiSimSeg = simSegmGlobalPos.
phi();
222 cout<<
" Simulated segment: local direction "<<simSegmLocalDir<<endl
223 <<
" local position "<<simSegmLocalPos<<endl
224 <<
" alpha "<<alphaSimSeg<<endl
225 <<
" beta "<<betaSimSeg<<endl;
229 bool recHitFound =
false;
231 int nsegm = distance(range.first, range.second);
233 cout <<
" Chamber: " << *chamberId <<
" has " << nsegm
234 <<
" 4D segments" << endl;
243 bool bestRecHitFound =
false;
244 double deltaAlpha = 99999;
248 segment4D!=range.second;
260 t0phi = phiSeg->
t0();
261 nHitPhi = phiSeg->
recHits().size();
266 nHitZ = zSeg->
recHits().size();
269 hHitMult[
abs((*chamberId).wheel())][(*chamberId).station()-1]->Fill(nHitPhi,nHitZ);
270 ht0[
abs((*chamberId).wheel())][(*chamberId).station()-1]->Fill(t0phi,t0z);
277 if((*segment4D).dimension() != 4) {
278 if(
debug)
cout <<
"[DTSegment4DQuality]***Error: This is not 4D segment!!!" << endl;
282 LocalVector recSegDirection = (*segment4D).localDirection();
287 cout <<
" RecSegment direction: " << recSegDirection << endl
288 <<
" position : " << (*segment4D).localPosition() << endl
289 <<
" alpha : " << recSegAlpha << endl
292 if(fabs(recSegAlpha - alphaSimSeg) < deltaAlpha) {
293 deltaAlpha = fabs(recSegAlpha - alphaSimSeg);
294 bestRecHit = &(*segment4D);
295 bestRecHitFound =
true;
299 if(bestRecHitFound) {
329 simSegLocalPosRZTmp + simSegLocalDirRZ*(-simSegLocalPosRZTmp.
z()/(
cos(simSegLocalDirRZ.
theta())));
333 "RZ SL: recPos " << bestRecHitLocalPosRZ <<
334 "recDir " << bestRecHitLocalDirRZ <<
335 "recAlpha " << alphaBestRHitRZ << endl <<
336 "RZ SL: simPos " << simSegLocalPosRZ <<
337 "simDir " << simSegLocalDirRZ <<
338 "simAlpha " << alphaSimSegRZ << endl ;
342 if(fabs(alphaBestRHit - alphaSimSeg) < 5*sigmaResAlpha &&
343 fabs(betaBestRHit - betaSimSeg) < 5*sigmaResBeta &&
344 fabs(bestRecHitLocalPos.
x() - xSimSeg) < 5*sigmaResX &&
345 fabs(bestRecHitLocalPos.
y() - ySimSeg) < 5*sigmaResY) {
352 if((*chamberId).wheel() == 0)
354 else if(
abs((*chamberId).wheel()) == 1)
356 else if(
abs((*chamberId).wheel()) == 2)
359 histo->
Fill(alphaSimSeg,
364 bestRecHitLocalPos.
x(),
366 bestRecHitLocalPos.
y(),
369 bestRecHitLocalPosRZ.
x(),
370 simSegLocalPosRZ.
x(),
373 sqrt(bestRecHitLocalDirErr.
xx()),
374 sqrt(bestRecHitLocalDirErr.
yy()),
375 sqrt(bestRecHitLocalPosErr.
xx()),
376 sqrt(bestRecHitLocalPosErr.
yy()),
377 sqrt(bestRecHitLocalDirErrRZ.
xx()),
378 sqrt(bestRecHitLocalPosErrRZ.
xx())
381 h4DHit->Fill(alphaSimSeg,
386 bestRecHitLocalPos.
x(),
388 bestRecHitLocalPos.
y(),
391 bestRecHitLocalPosRZ.
x(),
392 simSegLocalPosRZ.
x(),
395 sqrt(bestRecHitLocalDirErr.
xx()),
396 sqrt(bestRecHitLocalDirErr.
yy()),
397 sqrt(bestRecHitLocalPosErr.
xx()),
398 sqrt(bestRecHitLocalPosErr.
yy()),
399 sqrt(bestRecHitLocalDirErrRZ.
xx()),
400 sqrt(bestRecHitLocalPosErrRZ.
xx())
403 if (local) h4DHitWS[
abs((*chamberId).wheel())][(*chamberId).station()-1]->Fill(alphaSimSeg,
408 bestRecHitLocalPos.
x(),
410 bestRecHitLocalPos.
y(),
413 bestRecHitLocalPosRZ.
x(),
414 simSegLocalPosRZ.
x(),
417 sqrt(bestRecHitLocalDirErr.
xx()),
418 sqrt(bestRecHitLocalDirErr.
yy()),
419 sqrt(bestRecHitLocalPosErr.
xx()),
420 sqrt(bestRecHitLocalPosErr.
yy()),
421 sqrt(bestRecHitLocalDirErrRZ.
xx()),
422 sqrt(bestRecHitLocalPosErrRZ.
xx())
434 if((*chamberId).wheel() == 0)
436 else if(
abs((*chamberId).wheel()) == 1)
438 else if(
abs((*chamberId).wheel()) == 2)
440 heff->
Fill(etaSimSeg, phiSimSeg, xSimSeg, ySimSeg, alphaSimSeg, betaSimSeg, recHitFound);
441 hEff_All->Fill(etaSimSeg, phiSimSeg, xSimSeg, ySimSeg, alphaSimSeg, betaSimSeg, recHitFound);
442 if (local) hEffWS[
abs((*chamberId).wheel())][(*chamberId).station()-1]->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.
DTSegment4DQuality(const edm::ParameterSet &pset)
Constructor.
virtual std::vector< const TrackingRecHit * > recHits() const
Access to component RecHits (if any)
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)
Abs< T >::type abs(const T &t)
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)
double t0() const
Get the segment t0 (if recomputed, 0 is returned otherwise)
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.