79 hRes_S1RPhi=
new HRes1DHit(
"S1RPhi",dbe_,
true,local);
80 hRes_S1RPhi_W0=
new HRes1DHit(
"S1RPhi_W0",dbe_,
true,local);
81 hRes_S1RPhi_W1=
new HRes1DHit(
"S1RPhi_W1",dbe_,
true,local);
82 hRes_S1RPhi_W2=
new HRes1DHit(
"S1RPhi_W2",dbe_,
true,local);
83 hRes_S1RZ=
new HRes1DHit(
"S1RZ",dbe_,
true,local);
84 hRes_S1RZ_W0=
new HRes1DHit(
"S1RZ_W0",dbe_,
true,local);
85 hRes_S1RZ_W1=
new HRes1DHit(
"S1RZ_W1",dbe_,
true,local);
86 hRes_S1RZ_W2=
new HRes1DHit(
"S1RZ_W2",dbe_,
true,local);
87 hEff_S1RPhi=
new HEff1DHit(
"S1RPhi",dbe_);
89 hEff_S1RZ_W0=
new HEff1DHit(
"S1RZ_W0",dbe_);
90 hEff_S1RZ_W1=
new HEff1DHit(
"S1RZ_W1",dbe_);
91 hEff_S1RZ_W2=
new HEff1DHit(
"S1RZ_W2",dbe_);
94 hRes_S2RPhi=
new HRes1DHit(
"S2RPhi",dbe_,
true,local);
95 hRes_S2RPhi_W0=
new HRes1DHit(
"S2RPhi_W0",dbe_,
true,local);
96 hRes_S2RPhi_W1=
new HRes1DHit(
"S2RPhi_W1",dbe_,
true,local);
97 hRes_S2RPhi_W2=
new HRes1DHit(
"S2RPhi_W2",dbe_,
true,local);
98 hRes_S2RZ=
new HRes1DHit(
"S2RZ",dbe_,
true,local);
99 hRes_S2RZ_W0=
new HRes1DHit(
"S2RZ_W0",dbe_,
true,local);
100 hRes_S2RZ_W1=
new HRes1DHit(
"S2RZ_W1",dbe_,
true,local);
101 hRes_S2RZ_W2=
new HRes1DHit(
"S2RZ_W2",dbe_,
true,local);
102 hEff_S2RPhi=
new HEff1DHit(
"S2RPhi",dbe_);
103 hEff_S2RZ_W0=
new HEff1DHit(
"S2RZ_W0",dbe_);
104 hEff_S2RZ_W1=
new HEff1DHit(
"S2RZ_W1",dbe_);
105 hEff_S2RZ_W2=
new HEff1DHit(
"S2RZ_W2",dbe_);
109 hRes_S3RPhi=
new HRes1DHit(
"S3RPhi",dbe_,doall,local);
110 hRes_S3RPhi_W0=
new HRes1DHit(
"S3RPhi_W0",dbe_,doall,local);
111 hRes_S3RPhi_W1=
new HRes1DHit(
"S3RPhi_W1",dbe_,doall,local);
112 hRes_S3RPhi_W2=
new HRes1DHit(
"S3RPhi_W2",dbe_,doall,local);
113 hRes_S3RZ=
new HRes1DHit(
"S3RZ",dbe_,doall,local);
114 hRes_S3RZ_W0=
new HRes1DHit(
"S3RZ_W0",dbe_,doall,local);
115 hRes_S3RZ_W1=
new HRes1DHit(
"S3RZ_W1",dbe_,doall,local);
116 hRes_S3RZ_W2=
new HRes1DHit(
"S3RZ_W2",dbe_,doall,local);
118 hEff_S3RPhi=
new HEff1DHit(
"S3RPhi",dbe_);
120 hEff_S3RZ_W0=
new HEff1DHit(
"S3RZ_W0",dbe_);
121 hEff_S3RZ_W1=
new HEff1DHit(
"S3RZ_W1",dbe_);
122 hEff_S3RZ_W2=
new HEff1DHit(
"S3RZ_W2",dbe_);
142 hEff_S1RPhi->ComputeEfficiency();
143 hEff_S1RZ->ComputeEfficiency();
144 hEff_S1RZ_W0->ComputeEfficiency();
145 hEff_S1RZ_W1->ComputeEfficiency();
146 hEff_S1RZ_W2->ComputeEfficiency();
149 hEff_S2RPhi->ComputeEfficiency();
150 hEff_S2RZ->ComputeEfficiency();
151 hEff_S2RZ_W0->ComputeEfficiency();
152 hEff_S2RZ_W1->ComputeEfficiency();
153 hEff_S2RZ_W2->ComputeEfficiency();
156 hEff_S3RPhi->ComputeEfficiency();
157 hEff_S3RZ->ComputeEfficiency();
158 hEff_S3RZ_W0->ComputeEfficiency();
159 hEff_S3RZ_W1->ComputeEfficiency();
160 hEff_S3RZ_W2->ComputeEfficiency();
213 cout <<
"--- [DTRecHitQuality] Analysing Event: #Run: " <<
event.id().run()
214 <<
" #Event: " <<
event.id().event() << endl;
222 event.getByLabel(simHitLabel, simHits);
225 map<DTWireId, PSimHitContainer > simHitsPerWire =
232 if(doStep1 && doall) {
234 cout <<
" -- DTRecHit S1: begin analysis:" << endl;
237 event.getByLabel(recHitLabel, dtRecHits);
240 if(
debug)
cout <<
"[DTRecHitQuality]**Warning: no 1DRechits with label: " << recHitLabel <<
" in this event, skipping!" << endl;
245 map<DTWireId,vector<DTRecHit1DPair> > recHitsPerWire =
246 map1DRecHitsPerWire(dtRecHits.
product());
254 if(doStep2 && doall) {
256 cout <<
" -- DTRecHit S2: begin analysis:" << endl;
260 event.getByLabel(segment2DLabel, segment2Ds);
263 if(
debug)
cout <<
"[DTRecHitQuality]**Warning: no 2DSegments with label: " << segment2DLabel
264 <<
" in this event, skipping!" << endl;
269 map<DTWireId,vector<DTRecHit1D> > recHitsPerWire =
270 map1DRecHitsPerWire(segment2Ds.
product());
280 cout <<
" -- DTRecHit S3: begin analysis:" << endl;
284 event.getByLabel(segment4DLabel, segment4Ds);
287 if(
debug)
cout <<
"[DTRecHitQuality]**Warning: no 4D Segments with label: " << segment4DLabel
288 <<
" in this event, skipping!" << endl;
293 map<DTWireId,vector<DTRecHit1D> > recHitsPerWire =
294 map1DRecHitsPerWire(segment4Ds.
product());
304 map<DTWireId, vector<DTRecHit1DPair> >
306 map<DTWireId, vector<DTRecHit1DPair> >
ret;
309 rechit != dt1DRecHitPairs->end(); rechit++) {
310 ret[(*rechit).wireId()].push_back(*rechit);
318 map<DTWireId, vector<DTRecHit1D> >
320 map<DTWireId, vector<DTRecHit1D> >
ret;
324 segment != segment2Ds->end();
326 vector<DTRecHit1D> component1DHits= (*segment).specificRecHits();
328 for(vector<DTRecHit1D>::const_iterator
hit = component1DHits.begin();
329 hit != component1DHits.end();
331 ret[(*hit).wireId()].push_back(*
hit);
340 map<DTWireId, std::vector<DTRecHit1D> >
342 map<DTWireId, vector<DTRecHit1D> >
ret;
345 segment != segment4Ds->end();
348 vector<const TrackingRecHit*> segment2Ds = (*segment).recHits();
350 for(vector<const TrackingRecHit*>::const_iterator segment2D = segment2Ds.begin();
351 segment2D != segment2Ds.end();
354 vector<const TrackingRecHit*> hits = (*segment2D)->recHits();
356 for(vector<const TrackingRecHit*>::const_iterator
hit = hits.begin();
357 hit != hits.end();
hit++) {
359 ret[hit1D->
wireId()].push_back(*hit1D);
374 float xEntry = entryP.
x()-xwire;
375 float xExit = exitP.
x()-xwire;
377 return fabs(xEntry - (entryP.
z()*(xExit-xEntry))/(exitP.
z()-entryP.
z()));
386 float theta=(exitP.
x()-entryP.
x())/(exitP.
z()-entryP.
z());
397 return (entryP.
y()+exitP.
y())/2.+wireLenght;
402 template <
typename type>
406 const vector<type>& recHits,
407 const float simHitDist) {
409 const type* theBestRecHit = 0;
411 for(
typename vector<type>::const_iterator recHit = recHits.begin();
412 recHit != recHits.end();
414 float distTmp = recHitDistFromWire(*recHit, layer);
415 if(fabs(distTmp-simHitDist) < res) {
416 res = fabs(distTmp-simHitDist);
417 theBestRecHit = &(*recHit);
421 return theBestRecHit;
442 template <
typename type>
448 for(
map<
DTWireId, vector<PSimHit> >::const_iterator wireAndSHits = simHitsPerWire.begin();
449 wireAndSHits != simHitsPerWire.end();
451 DTWireId wireId = (*wireAndSHits).first;
452 vector<PSimHit> simHitsInCell = (*wireAndSHits).second;
461 cout <<
" No mu SimHit in channel: " << wireId <<
", skipping! " << endl;
466 float simHitWireDist = simHitDistFromWire(layer, wireId, *muSimHit);
468 if(simHitWireDist>2.1) {
470 cout <<
" [DTRecHitQuality]###Warning: The mu SimHit in out of the cell, skipping!" << endl;
476 float simHitTheta = simHitImpactAngle(layer, wireId, *muSimHit);
479 float simHitFEDist = simHitDistFromFE(layer, wireId, *muSimHit);
481 bool recHitReconstructed =
false;
484 if(recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
487 cout <<
" No RecHit found at Step: " << step <<
" in cell: " << wireId << endl;
489 recHitReconstructed =
true;
491 vector<type> recHits = recHitsPerWire[wireId];
493 cout <<
" " << recHits.size() <<
" RecHits, Step " << step <<
" in channel: " << wireId << endl;
496 const type* theBestRecHit = findBestRecHit(layer, wireId, recHits, simHitWireDist);
499 float recHitWireDist = recHitDistFromWire(*theBestRecHit, layer);
501 cout <<
" SimHit distance from wire: " << simHitWireDist << endl
502 <<
" SimHit distance from FE: " << simHitFEDist << endl
503 <<
" SimHit distance angle " << simHitTheta << endl
504 <<
" RecHit distance from wire: " << recHitWireDist << endl;
505 float recHitErr = recHitPositionError(*theBestRecHit);
514 hResTot = hRes_S1RPhi;
515 if(wireId.
wheel() == 0)
516 hRes = hRes_S1RPhi_W0;
518 hRes = hRes_S1RPhi_W1;
520 hRes = hRes_S1RPhi_W2;
523 if(wireId.
wheel() == 0)
531 }
else if(step == 2) {
535 if(wireId.
wheel() == 0)
536 hRes = hRes_S2RPhi_W0;
538 hRes = hRes_S2RPhi_W1;
540 hRes = hRes_S2RPhi_W2;
543 if(wireId.
wheel() == 0)
551 }
else if(step == 3) {
554 hResTot = hRes_S3RPhi;
555 if(wireId.
wheel() == 0)
556 hRes = hRes_S3RPhi_W0;
558 hRes = hRes_S3RPhi_W1;
560 hRes = hRes_S3RPhi_W2;
563 if(wireId.
wheel() == 0)
573 hRes->
Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.
eta(),
574 simHitGlobalPos.
phi(),recHitErr,wireId.
station());
576 hResTot->
Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.
eta(),
577 simHitGlobalPos.
phi(),recHitErr,wireId.
station());
590 if(wireId.
wheel() == 0)
598 }
else if(step == 2) {
604 if(wireId.
wheel() == 0)
612 }
else if(step == 3) {
618 if(wireId.
wheel() == 0)
628 hEff->
Fill(simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
630 hEffTot->
Fill(simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
T getUntrackedParameter(std::string const &, T const &) const
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
void Fill(float distSimHit, float etaSimHit, float phiSimHit, bool fillRecHit)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Geom::Phi< T > phi() const
void Fill(float distSimHit, float thetaSimHit, float distFESimHit, float distRecHit, float etaSimHit, float phiSimHit, float errRecHit, int station)
Geom::Theta< T > theta() const
static const PSimHit * findMuSimHit(const edm::PSimHitContainer &hits)
Select the SimHit from a muon in a vector of SimHits.
const type * findBestRecHit(const DTLayer *layer, DTWireId wireId, const std::vector< type > &recHits, const float simHitDist)
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup)
Perform the real analysis.
virtual ~DTRecHitQuality()
Destructor.
float recHitPositionError(const DTRecHit1DPair &recHit)
virtual LocalError localPositionError() const
const DTLayer * layer(DTLayerId id) const
Return a layer given its id.
C::const_iterator const_iterator
constant access iterator type
const DTTopology & specificTopology() const
Local3DPoint exitPoint() const
Exit point in the local Det frame.
float simHitDistFromWire(const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
DTRecHitQuality(const edm::ParameterSet &pset)
Constructor.
Local3DPoint localPosition() const
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer)
int superLayer() const
Return the superlayer number.
std::map< DTWireId, std::vector< DTRecHit1DPair > > map1DRecHitsPerWire(const DTRecHitCollection *dt1DRecHitPairs)
A set of histograms of residuals and pulls for 1D 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
void compute(const DTGeometry *dtGeom, std::map< DTWireId, std::vector< PSimHit > > simHitsPerWire, std::map< DTWireId, std::vector< type > > recHitsPerWire, int step)
virtual LocalError localPositionError() const
Return the 3-dimensional error on the local position.
float simHitImpactAngle(const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
int wire() const
Return the wire number.
int superlayer() const
Return the superlayer number (deprecated method name)
float simHitDistFromFE(const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
T const * product() const
T const * product() const
static std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
int station() const
Return the station number.
int wheel() const
Return the wheel number.
Local3DPoint entryPoint() const
Entry point in the local Det frame.
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
virtual LocalPoint localPosition() const
DTWireId wireId() const
Return the wireId.