40 bool mirrorMinusWheels =
true;
126 TString name1=
"RPhi_W";
127 TString name2=
"RZ_W";
128 for (
long w=0;
w<=2;++
w) {
129 for (
long s=1;
s<=4;++
s){
130 hRes_S3RPhiWS[
w][
s-1] =
new HRes1DHit((
"S3"+name1+
w+
"_St"+
s).Data(),
dbe_,doall,local);
134 hRes_S3RZWS[
w][
s-1] =
new HRes1DHit((
"S3"+name2+
w+
"_St"+
s).Data(),
dbe_,doall,local);
168 hEff_S1RPhi->ComputeEfficiency();
169 hEff_S1RZ->ComputeEfficiency();
170 hEff_S1RZ_W0->ComputeEfficiency();
171 hEff_S1RZ_W1->ComputeEfficiency();
172 hEff_S1RZ_W2->ComputeEfficiency();
175 hEff_S2RPhi->ComputeEfficiency();
176 hEff_S2RZ->ComputeEfficiency();
177 hEff_S2RZ_W0->ComputeEfficiency();
178 hEff_S2RZ_W1->ComputeEfficiency();
179 hEff_S2RZ_W2->ComputeEfficiency();
182 hEff_S3RPhi->ComputeEfficiency();
183 hEff_S3RZ->ComputeEfficiency();
184 hEff_S3RZ_W0->ComputeEfficiency();
185 hEff_S3RZ_W1->ComputeEfficiency();
186 hEff_S3RZ_W2->ComputeEfficiency();
194 cout <<
"--- [DTRecHitQuality] Analysing Event: #Run: " <<
event.id().run()
195 <<
" #Event: " <<
event.id().event() << endl;
203 event.getByToken(simHitToken_, simHits);
206 map<DTWireId, PSimHitContainer > simHitsPerWire =
213 if(doStep1 && doall) {
215 cout <<
" -- DTRecHit S1: begin analysis:" << endl;
218 event.getByToken(recHitToken_, dtRecHits);
221 if(
debug)
cout <<
"[DTRecHitQuality]**Warning: no 1DRechits with label: " << recHitLabel <<
" in this event, skipping!" << endl;
226 map<DTWireId,vector<DTRecHit1DPair> > recHitsPerWire =
227 map1DRecHitsPerWire(dtRecHits.
product());
235 if(doStep2 && doall) {
237 cout <<
" -- DTRecHit S2: begin analysis:" << endl;
241 event.getByToken(segment2DToken_, segment2Ds);
244 if(
debug)
cout <<
"[DTRecHitQuality]**Warning: no 2DSegments with label: " << segment2DLabel
245 <<
" in this event, skipping!" << endl;
250 map<DTWireId,vector<DTRecHit1D> > recHitsPerWire =
251 map1DRecHitsPerWire(segment2Ds.
product());
261 cout <<
" -- DTRecHit S3: begin analysis:" << endl;
265 event.getByToken(segment4DToken_, segment4Ds);
268 if(
debug)
cout <<
"[DTRecHitQuality]**Warning: no 4D Segments with label: " << segment4DLabel
269 <<
" in this event, skipping!" << endl;
274 map<DTWireId,vector<DTRecHit1D> > recHitsPerWire =
275 map1DRecHitsPerWire(segment4Ds.
product());
285 map<DTWireId, vector<DTRecHit1DPair> >
287 map<DTWireId, vector<DTRecHit1DPair> >
ret;
290 rechit != dt1DRecHitPairs->end(); rechit++) {
291 ret[(*rechit).wireId()].push_back(*rechit);
299 map<DTWireId, vector<DTRecHit1D> >
301 map<DTWireId, vector<DTRecHit1D> >
ret;
305 segment != segment2Ds->end();
307 vector<DTRecHit1D> component1DHits= (*segment).specificRecHits();
309 for(vector<DTRecHit1D>::const_iterator
hit = component1DHits.begin();
310 hit != component1DHits.end();
312 ret[(*hit).wireId()].push_back(*
hit);
321 map<DTWireId, std::vector<DTRecHit1D> >
323 map<DTWireId, vector<DTRecHit1D> >
ret;
326 segment != segment4Ds->end();
329 vector<const TrackingRecHit*> segment2Ds = (*segment).recHits();
331 for(vector<const TrackingRecHit*>::const_iterator segment2D = segment2Ds.begin();
332 segment2D != segment2Ds.end();
335 vector<const TrackingRecHit*> hits = (*segment2D)->recHits();
337 for(vector<const TrackingRecHit*>::const_iterator
hit = hits.begin();
338 hit != hits.end();
hit++) {
340 ret[hit1D->
wireId()].push_back(*hit1D);
355 float xEntry = entryP.
x()-xwire;
356 float xExit = exitP.
x()-xwire;
358 return fabs(xEntry - (entryP.
z()*(xExit-xEntry))/(exitP.
z()-entryP.
z()));
367 float theta=(exitP.
x()-entryP.
x())/(exitP.
z()-entryP.
z());
381 return (entryP.
y()+exitP.
y())/2.+wireLenght;
386 template <
typename type>
391 const float simHitDist) {
393 const type* theBestRecHit = 0;
395 for(
typename vector<type>::const_iterator recHit = recHits.begin();
396 recHit != recHits.end();
398 float distTmp = recHitDistFromWire(*recHit, layer);
399 if(fabs(distTmp-simHitDist) < res) {
400 res = fabs(distTmp-simHitDist);
401 theBestRecHit = &(*recHit);
405 return theBestRecHit;
426 template <
typename type>
428 const std::map<
DTWireId, std::vector<PSimHit> >& simHitsPerWire,
429 const std::map<
DTWireId, std::vector<type> >& recHitsPerWire,
432 for(map<
DTWireId, vector<PSimHit> >::const_iterator wireAndSHits = simHitsPerWire.begin();
433 wireAndSHits != simHitsPerWire.end();
435 DTWireId wireId = (*wireAndSHits).first;
436 int wheel = wireId.
wheel();
439 vector<PSimHit> simHitsInCell = (*wireAndSHits).second;
448 cout <<
" No mu SimHit in channel: " << wireId <<
", skipping! " << endl;
453 float simHitWireDist = simHitDistFromWire(layer, wireId, *muSimHit);
455 if(simHitWireDist>2.1) {
457 cout <<
" [DTRecHitQuality]###Warning: The mu SimHit in out of the cell, skipping!" << endl;
463 float simHitTheta = simHitImpactAngle(layer, wireId, *muSimHit);
466 float simHitFEDist = simHitDistFromFE(layer, wireId, *muSimHit);
468 bool recHitReconstructed =
false;
471 if(recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
474 cout <<
" No RecHit found at Step: " << step <<
" in cell: " << wireId << endl;
476 recHitReconstructed =
true;
478 vector<type>
recHits = recHitsPerWire.at(wireId);
480 cout <<
" " << recHits.size() <<
" RecHits, Step " << step <<
" in channel: " << wireId << endl;
483 const type* theBestRecHit = findBestRecHit(layer, wireId, recHits, simHitWireDist);
486 float recHitWireDist = recHitDistFromWire(*theBestRecHit, layer);
488 cout <<
" SimHit distance from wire: " << simHitWireDist << endl
489 <<
" SimHit distance from FE: " << simHitFEDist << endl
490 <<
" SimHit angle in layer RF: " << simHitTheta << endl
491 <<
" RecHit distance from wire: " << recHitWireDist << endl;
492 float recHitErr = recHitPositionError(*theBestRecHit);
497 if (mirrorMinusWheels && wheel<0 && sl!=2){
507 hResTot = hRes_S1RPhi;
509 hRes = hRes_S1RPhi_W0;
511 hRes = hRes_S1RPhi_W1;
513 hRes = hRes_S1RPhi_W2;
524 }
else if(step == 2) {
529 hRes = hRes_S2RPhi_W0;
531 hRes = hRes_S2RPhi_W1;
533 hRes = hRes_S2RPhi_W2;
544 }
else if(step == 3) {
547 hResTot = hRes_S3RPhi;
549 hRes = hRes_S3RPhi_W0;
551 hRes = hRes_S3RPhi_W1;
553 hRes = hRes_S3RPhi_W2;
554 if (local) hRes_S3RPhiWS[
abs(wheel)][wireId.
station()-1]->
Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.
eta(),simHitGlobalPos.
phi(),recHitErr,wireId.
station());
565 if (local) hRes_S3RZWS[
abs(wheel)][wireId.
station()-1]->
Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.
eta(),simHitGlobalPos.
phi(),recHitErr,wireId.
station());
569 hRes->
Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.
eta(),
570 simHitGlobalPos.
phi(),recHitErr,wireId.
station());
572 hResTot->
Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.
eta(),
573 simHitGlobalPos.
phi(),recHitErr,wireId.
station());
584 if (local) hEff_S1RPhiWS[
abs(wheel)][wireId.
station()-1]->
Fill(simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
593 if (local) hEff_S1RZWS[
abs(wheel)][wireId.
station()-1]->
Fill(simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
596 }
else if(step == 2) {
610 }
else if(step == 3) {
614 if (local) hEff_S3RPhiWS[
abs(wheel)][wireId.
station()-1]->
Fill(simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
623 if (local) hEff_S3RZWS[
abs(wheel)][wireId.
station()-1]->
Fill(simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
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)
tuple ret
prodAgent to be discontinued
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.
void compute(const DTGeometry *dtGeom, const std::map< DTWireId, std::vector< PSimHit > > &simHitsPerWire, const std::map< DTWireId, std::vector< type > > &recHitsPerWire, int step)
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.
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)
Abs< T >::type abs(const T &t)
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
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.
float simHitDistFromFE(const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
T const * product() const
T const * product() const
virtual void beginRun(const edm::Run &iRun, const edm::EventSetup &setup)
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.