55 theFile =
new TFile(rootFileName.c_str(),
"RECREATE");
112 hEff_S1RPhi->ComputeEfficiency();
113 hEff_S2RPhi->ComputeEfficiency();
114 hEff_S3RPhi->ComputeEfficiency();
116 hEff_S1RZ->ComputeEfficiency();
117 hEff_S2RZ->ComputeEfficiency();
118 hEff_S3RZ->ComputeEfficiency();
120 hEff_S1RZ_W0->ComputeEfficiency();
121 hEff_S2RZ_W0->ComputeEfficiency();
122 hEff_S3RZ_W0->ComputeEfficiency();
124 hEff_S1RZ_W1->ComputeEfficiency();
125 hEff_S2RZ_W1->ComputeEfficiency();
126 hEff_S3RZ_W1->ComputeEfficiency();
128 hEff_S1RZ_W2->ComputeEfficiency();
129 hEff_S2RZ_W2->ComputeEfficiency();
130 hEff_S3RZ_W2->ComputeEfficiency();
133 hRes_S1RPhi->Write();
134 hRes_S2RPhi->Write();
135 hRes_S3RPhi->Write();
141 hRes_S1RZ_W0->Write();
142 hRes_S2RZ_W0->Write();
143 hRes_S3RZ_W0->Write();
145 hRes_S1RZ_W1->Write();
146 hRes_S2RZ_W1->Write();
147 hRes_S3RZ_W1->Write();
149 hRes_S1RZ_W2->Write();
150 hRes_S2RZ_W2->Write();
151 hRes_S3RZ_W2->Write();
154 hEff_S1RPhi->Write();
155 hEff_S2RPhi->Write();
156 hEff_S3RPhi->Write();
162 hEff_S1RZ_W0->Write();
163 hEff_S2RZ_W0->Write();
164 hEff_S3RZ_W0->Write();
166 hEff_S1RZ_W1->Write();
167 hEff_S2RZ_W1->Write();
168 hEff_S3RZ_W1->Write();
170 hEff_S1RZ_W2->Write();
171 hEff_S2RZ_W2->Write();
172 hEff_S3RZ_W2->Write();
180 cout <<
"--- [DTRecHitQuality] Analysing Event: #Run: " <<
event.id().run()
181 <<
" #Event: " <<
event.id().event() << endl;
190 event.getByLabel(simHitLabel,
"MuonDTHits", simHits);
193 map<DTWireId, PSimHitContainer > simHitsPerWire =
203 cout <<
" -- DTRecHit S1: begin analysis:" << endl;
206 event.getByLabel(recHitLabel, dtRecHits);
209 map<DTWireId,vector<DTRecHit1DPair> > recHitsPerWire =
210 map1DRecHitsPerWire(dtRecHits.
product());
221 cout <<
" -- DTRecHit S2: begin analysis:" << endl;
225 event.getByLabel(segment2DLabel, segment2Ds);
228 map<DTWireId,vector<DTRecHit1D> > recHitsPerWire =
229 map1DRecHitsPerWire(segment2Ds.
product());
239 cout <<
" -- DTRecHit S3: begin analysis:" << endl;
243 event.getByLabel(segment4DLabel, segment4Ds);
246 map<DTWireId,vector<DTRecHit1D> > recHitsPerWire =
247 map1DRecHitsPerWire(segment4Ds.
product());
257 map<DTWireId, vector<DTRecHit1DPair> >
259 map<DTWireId, vector<DTRecHit1DPair> >
ret;
262 rechit != dt1DRecHitPairs->end(); rechit++) {
263 ret[(*rechit).wireId()].push_back(*rechit);
271 map<DTWireId, vector<DTRecHit1D> >
273 map<DTWireId, vector<DTRecHit1D> >
ret;
277 segment != segment2Ds->end();
279 vector<DTRecHit1D> component1DHits= (*segment).specificRecHits();
281 for(vector<DTRecHit1D>::const_iterator
hit = component1DHits.begin();
282 hit != component1DHits.end();
284 ret[(*hit).wireId()].push_back(*
hit);
293 map<DTWireId, std::vector<DTRecHit1D> >
295 map<DTWireId, vector<DTRecHit1D> >
ret;
298 segment != segment4Ds->end();
301 vector<const TrackingRecHit*> segment2Ds = (*segment).recHits();
303 for(vector<const TrackingRecHit*>::const_iterator segment2D = segment2Ds.begin();
304 segment2D != segment2Ds.end();
307 vector<const TrackingRecHit*> hits = (*segment2D)->recHits();
309 for(vector<const TrackingRecHit*>::const_iterator
hit = hits.begin();
310 hit != hits.end();
hit++) {
312 ret[hit1D->
wireId()].push_back(*hit1D);
327 float xEntry = entryP.
x()-xwire;
328 float xExit = exitP.
x()-xwire;
330 return fabs(xEntry - (entryP.
z()*(xExit-xEntry))/(exitP.
z()-entryP.
z()));
339 float theta=(exitP.
x()-entryP.
x())/(exitP.
z()-entryP.
z());
350 return (entryP.
y()+exitP.
y())/2.+wireLenght;
355 template <
typename type>
359 const vector<type>& recHits,
360 const float simHitDist) {
362 const type* theBestRecHit = 0;
364 for(
typename vector<type>::const_iterator recHit = recHits.begin();
365 recHit != recHits.end();
367 float distTmp = recHitDistFromWire(*recHit, layer);
368 if(fabs(distTmp-simHitDist) < res) {
369 res = fabs(distTmp-simHitDist);
370 theBestRecHit = &(*recHit);
374 return theBestRecHit;
395 template <
typename type>
401 for(
map<
DTWireId, vector<PSimHit> >::const_iterator wireAndSHits = simHitsPerWire.begin();
402 wireAndSHits != simHitsPerWire.end();
404 DTWireId wireId = (*wireAndSHits).first;
405 vector<PSimHit> simHitsInCell = (*wireAndSHits).second;
414 cout <<
" No mu SimHit in channel: " << wireId <<
", skipping! " << endl;
419 float simHitWireDist = simHitDistFromWire(layer, wireId, *muSimHit);
421 if(simHitWireDist>2.1) {
423 cout <<
" [DTRecHitQuality]###Warning: The mu SimHit in out of the cell, skipping!" << endl;
429 float simHitTheta = simHitImpactAngle(layer, wireId, *muSimHit);
432 float simHitFEDist = simHitDistFromFE(layer, wireId, *muSimHit);
434 bool recHitReconstructed =
false;
437 if(recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
440 cout <<
" No RecHit found at Step: " << step <<
" in cell: " << wireId << endl;
442 recHitReconstructed =
true;
444 vector<type> recHits = recHitsPerWire[wireId];
446 cout <<
" " << recHits.size() <<
" RecHits, Step " << step <<
" in channel: " << wireId << endl;
449 const type* theBestRecHit = findBestRecHit(layer, wireId, recHits, simHitWireDist);
452 float recHitWireDist = recHitDistFromWire(*theBestRecHit, layer);
454 cout <<
" SimHit distance from wire: " << simHitWireDist << endl
455 <<
" SimHit distance from FE: " << simHitFEDist << endl
456 <<
" SimHit distance angle " << simHitTheta << endl
457 <<
" RecHit distance from wire: " << recHitWireDist << endl;
458 float recHitErr = recHitPositionError(*theBestRecHit);
471 if(wireId.
wheel() == 0)
479 }
else if(step == 2) {
485 if(wireId.
wheel() == 0)
493 }
else if(step == 3) {
499 if(wireId.
wheel() == 0)
509 hRes->
Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.
eta(),
510 simHitGlobalPos.
phi(),recHitErr);
512 hResTot->
Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.
eta(),
513 simHitGlobalPos.
phi(),recHitErr);
527 if(wireId.
wheel() == 0)
535 }
else if(step == 2) {
541 if(wireId.
wheel() == 0)
549 }
else if(step == 3) {
555 if(wireId.
wheel() == 0)
565 hEff->
Fill(simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
567 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.
A set of histograms for efficiency 1D DT RecHits.
Geom::Phi< T > phi() 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)
Geom::Theta< T > theta() const
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup)
Perform the real analysis.
void Fill(float distSimHit, float thetaSimHit, float distFESimHit, float distRecHit, float etaSimHit, float phiSimHit, float errRecHit)
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 wheel() const
Return the wheel number.
const float cellLenght() const
Local3DPoint entryPoint() const
Entry point in the local Det frame.
virtual LocalPoint localPosition() const
DTWireId wireId() const
Return the wireId.