77 hRes_S1RPhi=
new HRes1DHit(
"S1RPhi",dbe_,
true,local);
78 hRes_S1RPhi_W0=
new HRes1DHit(
"S1RPhi_W0",dbe_,
true,local);
79 hRes_S1RPhi_W1=
new HRes1DHit(
"S1RPhi_W1",dbe_,
true,local);
80 hRes_S1RPhi_W2=
new HRes1DHit(
"S1RPhi_W2",dbe_,
true,local);
81 hRes_S1RZ=
new HRes1DHit(
"S1RZ",dbe_,
true,local);
82 hRes_S1RZ_W0=
new HRes1DHit(
"S1RZ_W0",dbe_,
true,local);
83 hRes_S1RZ_W1=
new HRes1DHit(
"S1RZ_W1",dbe_,
true,local);
84 hRes_S1RZ_W2=
new HRes1DHit(
"S1RZ_W2",dbe_,
true,local);
85 hEff_S1RPhi=
new HEff1DHit(
"S1RPhi",dbe_);
87 hEff_S1RZ_W0=
new HEff1DHit(
"S1RZ_W0",dbe_);
88 hEff_S1RZ_W1=
new HEff1DHit(
"S1RZ_W1",dbe_);
89 hEff_S1RZ_W2=
new HEff1DHit(
"S1RZ_W2",dbe_);
92 hRes_S2RPhi=
new HRes1DHit(
"S2RPhi",dbe_,
true,local);
93 hRes_S2RPhi_W0=
new HRes1DHit(
"S2RPhi_W0",dbe_,
true,local);
94 hRes_S2RPhi_W1=
new HRes1DHit(
"S2RPhi_W1",dbe_,
true,local);
95 hRes_S2RPhi_W2=
new HRes1DHit(
"S2RPhi_W2",dbe_,
true,local);
96 hRes_S2RZ=
new HRes1DHit(
"S2RZ",dbe_,
true,local);
97 hRes_S2RZ_W0=
new HRes1DHit(
"S2RZ_W0",dbe_,
true,local);
98 hRes_S2RZ_W1=
new HRes1DHit(
"S2RZ_W1",dbe_,
true,local);
99 hRes_S2RZ_W2=
new HRes1DHit(
"S2RZ_W2",dbe_,
true,local);
100 hEff_S2RPhi=
new HEff1DHit(
"S2RPhi",dbe_);
101 hEff_S2RZ_W0=
new HEff1DHit(
"S2RZ_W0",dbe_);
102 hEff_S2RZ_W1=
new HEff1DHit(
"S2RZ_W1",dbe_);
103 hEff_S2RZ_W2=
new HEff1DHit(
"S2RZ_W2",dbe_);
107 hRes_S3RPhi=
new HRes1DHit(
"S3RPhi",dbe_,doall,local);
108 hRes_S3RPhi_W0=
new HRes1DHit(
"S3RPhi_W0",dbe_,doall,local);
109 hRes_S3RPhi_W1=
new HRes1DHit(
"S3RPhi_W1",dbe_,doall,local);
110 hRes_S3RPhi_W2=
new HRes1DHit(
"S3RPhi_W2",dbe_,doall,local);
111 hRes_S3RZ=
new HRes1DHit(
"S3RZ",dbe_,doall,local);
112 hRes_S3RZ_W0=
new HRes1DHit(
"S3RZ_W0",dbe_,doall,local);
113 hRes_S3RZ_W1=
new HRes1DHit(
"S3RZ_W1",dbe_,doall,local);
114 hRes_S3RZ_W2=
new HRes1DHit(
"S3RZ_W2",dbe_,doall,local);
118 TString name1=
"RPhi_W";
119 TString name2=
"RZ_W";
120 for (
long w=0;
w<=2;++
w) {
121 for (
long s=1;
s<=4;++
s){
122 hRes_S3RPhiWS[
w][
s-1] =
new HRes1DHit((
"S3"+name1+
w+
"_St"+
s).
Data(),dbe_,doall,local);
126 hRes_S3RZWS[
w][
s-1] =
new HRes1DHit((
"S3"+name2+
w+
"_St"+
s).
Data(),dbe_,doall,local);
136 hEff_S3RPhi=
new HEff1DHit(
"S3RPhi",dbe_);
138 hEff_S3RZ_W0=
new HEff1DHit(
"S3RZ_W0",dbe_);
139 hEff_S3RZ_W1=
new HEff1DHit(
"S3RZ_W1",dbe_);
140 hEff_S3RZ_W2=
new HEff1DHit(
"S3RZ_W2",dbe_);
160 hEff_S1RPhi->ComputeEfficiency();
161 hEff_S1RZ->ComputeEfficiency();
162 hEff_S1RZ_W0->ComputeEfficiency();
163 hEff_S1RZ_W1->ComputeEfficiency();
164 hEff_S1RZ_W2->ComputeEfficiency();
167 hEff_S2RPhi->ComputeEfficiency();
168 hEff_S2RZ->ComputeEfficiency();
169 hEff_S2RZ_W0->ComputeEfficiency();
170 hEff_S2RZ_W1->ComputeEfficiency();
171 hEff_S2RZ_W2->ComputeEfficiency();
174 hEff_S3RPhi->ComputeEfficiency();
175 hEff_S3RZ->ComputeEfficiency();
176 hEff_S3RZ_W0->ComputeEfficiency();
177 hEff_S3RZ_W1->ComputeEfficiency();
178 hEff_S3RZ_W2->ComputeEfficiency();
186 cout <<
"--- [DTRecHitQuality] Analysing Event: #Run: " <<
event.id().run()
187 <<
" #Event: " <<
event.id().event() << endl;
195 event.getByLabel(simHitLabel, simHits);
198 map<DTWireId, PSimHitContainer > simHitsPerWire =
205 if(doStep1 && doall) {
207 cout <<
" -- DTRecHit S1: begin analysis:" << endl;
210 event.getByLabel(recHitLabel, dtRecHits);
213 if(
debug)
cout <<
"[DTRecHitQuality]**Warning: no 1DRechits with label: " << recHitLabel <<
" in this event, skipping!" << endl;
218 map<DTWireId,vector<DTRecHit1DPair> > recHitsPerWire =
219 map1DRecHitsPerWire(dtRecHits.
product());
227 if(doStep2 && doall) {
229 cout <<
" -- DTRecHit S2: begin analysis:" << endl;
233 event.getByLabel(segment2DLabel, segment2Ds);
236 if(
debug)
cout <<
"[DTRecHitQuality]**Warning: no 2DSegments with label: " << segment2DLabel
237 <<
" in this event, skipping!" << endl;
242 map<DTWireId,vector<DTRecHit1D> > recHitsPerWire =
243 map1DRecHitsPerWire(segment2Ds.
product());
253 cout <<
" -- DTRecHit S3: begin analysis:" << endl;
257 event.getByLabel(segment4DLabel, segment4Ds);
260 if(
debug)
cout <<
"[DTRecHitQuality]**Warning: no 4D Segments with label: " << segment4DLabel
261 <<
" in this event, skipping!" << endl;
266 map<DTWireId,vector<DTRecHit1D> > recHitsPerWire =
267 map1DRecHitsPerWire(segment4Ds.
product());
277 map<DTWireId, vector<DTRecHit1DPair> >
279 map<DTWireId, vector<DTRecHit1DPair> >
ret;
282 rechit != dt1DRecHitPairs->end(); rechit++) {
283 ret[(*rechit).wireId()].push_back(*rechit);
291 map<DTWireId, vector<DTRecHit1D> >
293 map<DTWireId, vector<DTRecHit1D> >
ret;
297 segment != segment2Ds->end();
299 vector<DTRecHit1D> component1DHits= (*segment).specificRecHits();
301 for(vector<DTRecHit1D>::const_iterator
hit = component1DHits.begin();
302 hit != component1DHits.end();
304 ret[(*hit).wireId()].push_back(*
hit);
313 map<DTWireId, std::vector<DTRecHit1D> >
315 map<DTWireId, vector<DTRecHit1D> >
ret;
318 segment != segment4Ds->end();
321 vector<const TrackingRecHit*> segment2Ds = (*segment).recHits();
323 for(vector<const TrackingRecHit*>::const_iterator segment2D = segment2Ds.begin();
324 segment2D != segment2Ds.end();
327 vector<const TrackingRecHit*> hits = (*segment2D)->recHits();
329 for(vector<const TrackingRecHit*>::const_iterator
hit = hits.begin();
330 hit != hits.end();
hit++) {
332 ret[hit1D->
wireId()].push_back(*hit1D);
347 float xEntry = entryP.
x()-xwire;
348 float xExit = exitP.
x()-xwire;
350 return fabs(xEntry - (entryP.
z()*(xExit-xEntry))/(exitP.
z()-entryP.
z()));
359 float theta=(exitP.
x()-entryP.
x())/(exitP.
z()-entryP.
z());
370 return (entryP.
y()+exitP.
y())/2.+wireLenght;
375 template <
typename type>
379 const vector<type>& recHits,
380 const float simHitDist) {
382 const type* theBestRecHit = 0;
384 for(
typename vector<type>::const_iterator recHit = recHits.begin();
385 recHit != recHits.end();
387 float distTmp = recHitDistFromWire(*recHit, layer);
388 if(fabs(distTmp-simHitDist) < res) {
389 res = fabs(distTmp-simHitDist);
390 theBestRecHit = &(*recHit);
394 return theBestRecHit;
415 template <
typename type>
421 for(
map<
DTWireId, vector<PSimHit> >::const_iterator wireAndSHits = simHitsPerWire.begin();
422 wireAndSHits != simHitsPerWire.end();
424 DTWireId wireId = (*wireAndSHits).first;
425 vector<PSimHit> simHitsInCell = (*wireAndSHits).second;
434 cout <<
" No mu SimHit in channel: " << wireId <<
", skipping! " << endl;
439 float simHitWireDist = simHitDistFromWire(layer, wireId, *muSimHit);
441 if(simHitWireDist>2.1) {
443 cout <<
" [DTRecHitQuality]###Warning: The mu SimHit in out of the cell, skipping!" << endl;
449 float simHitTheta = simHitImpactAngle(layer, wireId, *muSimHit);
452 float simHitFEDist = simHitDistFromFE(layer, wireId, *muSimHit);
454 bool recHitReconstructed =
false;
457 if(recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
460 cout <<
" No RecHit found at Step: " << step <<
" in cell: " << wireId << endl;
462 recHitReconstructed =
true;
464 vector<type> recHits = recHitsPerWire[wireId];
466 cout <<
" " << recHits.size() <<
" RecHits, Step " << step <<
" in channel: " << wireId << endl;
469 const type* theBestRecHit = findBestRecHit(layer, wireId, recHits, simHitWireDist);
472 float recHitWireDist = recHitDistFromWire(*theBestRecHit, layer);
474 cout <<
" SimHit distance from wire: " << simHitWireDist << endl
475 <<
" SimHit distance from FE: " << simHitFEDist << endl
476 <<
" SimHit distance angle " << simHitTheta << endl
477 <<
" RecHit distance from wire: " << recHitWireDist << endl;
478 float recHitErr = recHitPositionError(*theBestRecHit);
487 hResTot = hRes_S1RPhi;
488 if(wireId.
wheel() == 0)
489 hRes = hRes_S1RPhi_W0;
491 hRes = hRes_S1RPhi_W1;
493 hRes = hRes_S1RPhi_W2;
496 if(wireId.
wheel() == 0)
504 }
else if(step == 2) {
508 if(wireId.
wheel() == 0)
509 hRes = hRes_S2RPhi_W0;
511 hRes = hRes_S2RPhi_W1;
513 hRes = hRes_S2RPhi_W2;
516 if(wireId.
wheel() == 0)
524 }
else if(step == 3) {
527 hResTot = hRes_S3RPhi;
528 if(wireId.
wheel() == 0)
529 hRes = hRes_S3RPhi_W0;
531 hRes = hRes_S3RPhi_W1;
533 hRes = hRes_S3RPhi_W2;
534 if (local) hRes_S3RPhiWS[
abs(wireId.
wheel())][wireId.
station()-1]->
Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.
eta(),simHitGlobalPos.
phi(),recHitErr,wireId.
station());
538 if(wireId.
wheel() == 0)
545 if (local) hRes_S3RZWS[
abs(wireId.
wheel())][wireId.
station()-1]->
Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.
eta(),simHitGlobalPos.
phi(),recHitErr,wireId.
station());
549 hRes->
Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.
eta(),
550 simHitGlobalPos.
phi(),recHitErr,wireId.
station());
552 hResTot->
Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.
eta(),
553 simHitGlobalPos.
phi(),recHitErr,wireId.
station());
564 if (local) hEff_S1RPhiWS[
abs(wireId.
wheel())][wireId.
station()-1]->
Fill(simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
567 if(wireId.
wheel() == 0)
573 if (local) hEff_S1RZWS[
abs(wireId.
wheel())][wireId.
station()-1]->
Fill(simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
576 }
else if(step == 2) {
582 if(wireId.
wheel() == 0)
590 }
else if(step == 3) {
594 if (local) hEff_S3RPhiWS[
abs(wireId.
wheel())][wireId.
station()-1]->
Fill(simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
597 if(wireId.
wheel() == 0)
603 if (local) hEff_S3RZWS[
abs(wireId.
wheel())][wireId.
station()-1]->
Fill(simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
608 hEff->
Fill(simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
610 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.