CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
DTSegment4DQuality Class Reference

#include <DTSegment4DQuality.h>

Inheritance diagram for DTSegment4DQuality:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
 Perform the real analysis. More...
 
virtual void beginRun (const edm::Run &iRun, const edm::EventSetup &setup)
 
 DTSegment4DQuality (const edm::ParameterSet &pset)
 Constructor. More...
 
void endJob ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
 
virtual ~DTSegment4DQuality ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

DQMStoredbe_
 
bool debug
 
bool doall
 
HRes4DHith4DHit
 
HRes4DHith4DHit_W0
 
HRes4DHith4DHit_W1
 
HRes4DHith4DHit_W2
 
HRes4DHith4DHitWS [3][4]
 
HEff4DHithEff_All
 
HEff4DHithEff_W0
 
HEff4DHithEff_W1
 
HEff4DHithEff_W2
 
HEff4DHithEffWS [3][4]
 
bool local
 
std::string rootFileName
 
edm::InputTag segment4DLabel
 
edm::EDGetTokenT
< DTRecSegment4DCollection
segment4DToken_
 
double sigmaResAlpha
 
double sigmaResBeta
 
double sigmaResX
 
double sigmaResY
 
edm::InputTag simHitLabel
 
edm::EDGetTokenT
< edm::PSimHitContainer
simHitToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Basic analyzer class which accesses 4D DTSegments and plots resolution comparing reconstructed and simulated quantities

Only true 4D segments are considered. Station 4 segments are not looked at. FIXME: Add flag to consider also segments with only phi view? Possible bias?

Residual/pull plots are filled for the reco segment with alpha closest to the simulated muon direction (defined from muon simhits in the chamber).

Efficiencies are defined as reconstructed 4D segments with alpha, beta, x, y, within 5 sigma relative to the sim muon, with sigmas specified in the config. Note that loss of even only one of the two views is considered as inefficiency!

Author
S. Bolognesi and G. Cerminara - INFN Torino

Definition at line 43 of file DTSegment4DQuality.h.

Constructor & Destructor Documentation

DTSegment4DQuality::DTSegment4DQuality ( const edm::ParameterSet pset)

Constructor.

Definition at line 47 of file DTSegment4DQuality.cc.

References debug, DTHitQualityUtils::debug, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and dtT0Analyzer_cfg::rootFileName.

47  {
48  // Get the debug parameter for verbose output
49  debug = pset.getUntrackedParameter<bool>("debug");
51 
52  rootFileName = pset.getUntrackedParameter<string>("rootFileName");
53  // the name of the simhit collection
54  simHitLabel = pset.getUntrackedParameter<InputTag>("simHitLabel");
55  simHitToken_ = consumes<PSimHitContainer>(pset.getUntrackedParameter<InputTag>("simHitLabel"));
56  // the name of the 2D rec hit collection
57  segment4DLabel = pset.getUntrackedParameter<InputTag>("segment4DLabel");
58  segment4DToken_ = consumes<DTRecSegment4DCollection>(pset.getUntrackedParameter<InputTag>("segment4DLabel"));
59 
60 
61  //sigma resolution on position
62  sigmaResX = pset.getParameter<double>("sigmaResX");
63  sigmaResY = pset.getParameter<double>("sigmaResY");
64  //sigma resolution on angle
65  sigmaResAlpha = pset.getParameter<double>("sigmaResAlpha");
66  sigmaResBeta = pset.getParameter<double>("sigmaResBeta");
67  doall = pset.getUntrackedParameter<bool>("doall", false);
68  local = pset.getUntrackedParameter<bool>("local", false);
69 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< DTRecSegment4DCollection > segment4DToken_
edm::InputTag segment4DLabel
edm::InputTag simHitLabel
edm::EDGetTokenT< edm::PSimHitContainer > simHitToken_
DTSegment4DQuality::~DTSegment4DQuality ( )
virtual

Destructor.

Definition at line 115 of file DTSegment4DQuality.cc.

115  {
116 
117 }

Member Function Documentation

void DTSegment4DQuality::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
virtual

Perform the real analysis.

Implements edm::EDAnalyzer.

Definition at line 147 of file DTSegment4DQuality.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, debug, HLT_25ns14e33_v1_cff::distance, alignCSCRings::e, geometryDiff::epsilon, PV3DBase< T, PVType, FrameType >::eta(), HRes4DHit::Fill(), HEff4DHit::Fill(), DTHitQualityUtils::findMuSimSegment(), DTHitQualityUtils::findMuSimSegmentDirAndPos(), DTHitQualityUtils::findSegmentAlphaAndBeta(), edm::EventSetup::get(), timingPdfMaker::histo, edm::HandleBase::isValid(), DTRecSegment4D::localDirection(), DTRecSegment2D::localDirection(), DTRecSegment4D::localDirectionError(), DTRecSegment2D::localDirectionError(), DTRecSegment4D::localPosition(), DTRecSegment2D::localPosition(), DTRecSegment4D::localPositionError(), DTRecSegment2D::localPositionError(), DTHitQualityUtils::mapMuSimHitsPerWire(), DTHitQualityUtils::mapSimHitsPerWire(), PV3DBase< T, PVType, FrameType >::phi(), DTRecSegment4D::phiSegment(), DTRecSegment2D::recHits(), DTHitQualityUtils::sigmaAngle(), trackerHits::simHits, mathSSE::sqrt(), DTChamberId::station(), relativeConstraints::station, DTSLRecSegment2D::superLayerId(), DTRecSegment2D::t0(), PV3DBase< T, PVType, FrameType >::theta(), GeomDet::toGlobal(), GeomDet::toLocal(), DTChamberId::wheel(), PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), PV3DBase< T, PVType, FrameType >::y(), LocalError::yy(), PV3DBase< T, PVType, FrameType >::z(), and DTRecSegment4D::zSegment().

147  {
148  //theFile->cd();
149 
150  const float epsilon=5e-5; // numerical accuracy on angles [rad}
151 
152  // Get the DT Geometry
153  ESHandle<DTGeometry> dtGeom;
154  eventSetup.get<MuonGeometryRecord>().get(dtGeom);
155 
156  // Get the SimHit collection from the event
158  event.getByToken(simHitToken_, simHits); //FIXME: second string to be removed
159 
160  //Map simHits by chamber
161  map<DTChamberId, PSimHitContainer > simHitsPerCh;
162  for(PSimHitContainer::const_iterator simHit = simHits->begin();
163  simHit != simHits->end(); simHit++){
164 
165  // Consider only muon simhits; the others are not considered elsewhere in this class!
166  if (abs((*simHit).particleType())==13) {
167  // Create the id of the chamber (the simHits in the DT known their wireId)
168  DTChamberId chamberId = (((DTWireId(simHit->detUnitId())).layerId()).superlayerId()).chamberId();
169  // Fill the map
170  simHitsPerCh[chamberId].push_back(*simHit);
171  }
172  }
173 
174  // Get the 4D rechits from the event
176  event.getByToken(segment4DToken_, segment4Ds);
177 
178  if(!segment4Ds.isValid()) {
179  if(debug) cout << "[DTSegment4DQuality]**Warning: no 4D Segments with label: " <<segment4DLabel
180  << " in this event, skipping!" << endl;
181  return;
182  }
183 
184  // Loop over all chambers containing a (muon) simhit
185  for (map<DTChamberId, PSimHitContainer>::const_iterator simHitsInChamber = simHitsPerCh.begin(); simHitsInChamber != simHitsPerCh.end(); ++simHitsInChamber) {
186 
187  DTChamberId chamberId = simHitsInChamber->first;
188  int station = chamberId.station();
189  if (station == 4 && !(local) ) continue; //use DTSegment2DSLPhiQuality to analyze MB4 performaces in DQM
190  int wheel = chamberId.wheel();
191 
192  //------------------------- simHits ---------------------------//
193  //Get simHits of this chamber
194  const PSimHitContainer& simHits = simHitsInChamber->second;
195 
196  // Map simhits per wire
197  map<DTWireId, PSimHitContainer > simHitsPerWire = DTHitQualityUtils::mapSimHitsPerWire(simHits);
198  map<DTWireId, const PSimHit*> muSimHitPerWire = DTHitQualityUtils::mapMuSimHitsPerWire(simHitsPerWire);
199  int nMuSimHit = muSimHitPerWire.size();
200  if(nMuSimHit <2) { // Skip chamber with less than 2 cells with mu hits
201  continue;
202  }
203  if(debug)
204  cout << "=== Chamber " << chamberId << " has " << nMuSimHit << " SimHits" << endl;
205 
206  //Find outer and inner mu SimHit to build a segment
207  pair<const PSimHit*, const PSimHit*> inAndOutSimHit = DTHitQualityUtils::findMuSimSegment(muSimHitPerWire);
208 
209  // Consider only sim segments crossing at least 2 SLs
210  if ((DTWireId(inAndOutSimHit.first->detUnitId())).superlayer() == (DTWireId(inAndOutSimHit.second->detUnitId())).superLayer()) continue;
211 
212  //Find direction and position of the sim Segment in Chamber RF
213  pair<LocalVector, LocalPoint> dirAndPosSimSegm = DTHitQualityUtils::findMuSimSegmentDirAndPos(inAndOutSimHit,
214  chamberId,&(*dtGeom));
215 
216  LocalVector simSegmLocalDir = dirAndPosSimSegm.first;
217  LocalPoint simSegmLocalPos = dirAndPosSimSegm.second;
218  const DTChamber* chamber = dtGeom->chamber(chamberId);
219  GlobalPoint simSegmGlobalPos = chamber->toGlobal(simSegmLocalPos);
220  GlobalVector simSegmGlobalDir = chamber->toGlobal(simSegmLocalDir);
221 
222  //phi and theta angle of simulated segment in Chamber RF
223  float alphaSimSeg = DTHitQualityUtils::findSegmentAlphaAndBeta(simSegmLocalDir).first;
224  float betaSimSeg = DTHitQualityUtils::findSegmentAlphaAndBeta(simSegmLocalDir).second;
225  //x,y position of simulated segment in Chamber RF
226  float xSimSeg = simSegmLocalPos.x();
227  float ySimSeg = simSegmLocalPos.y();
228  //Position (in eta,phi coordinates) in lobal RF
229  float etaSimSeg = simSegmGlobalPos.eta();
230  float phiSimSeg = simSegmGlobalPos.phi();
231 
232  double count_seg = 0;
233 
234  if(debug)
235  cout<<" Simulated segment: local direction "<<simSegmLocalDir<<endl
236  <<" local position "<<simSegmLocalPos<<endl
237  <<" alpha "<<alphaSimSeg<<endl
238  <<" beta "<<betaSimSeg<<endl;
239 
240  //---------------------------- recHits --------------------------//
241  // Get the range of rechit for the corresponding chamberId
242  bool recHitFound = false;
243  DTRecSegment4DCollection::range range = segment4Ds->get(chamberId);
244  int nsegm = distance(range.first, range.second);
245  if(debug)
246  cout << " Chamber: " << chamberId << " has " << nsegm
247  << " 4D segments" << endl;
248 
249  if (nsegm!=0) {
250  // Find the best RecHit: look for the 4D RecHit with the phi angle closest
251  // to that of segment made of SimHits.
252  // RecHits must have delta alpha and delta position within 5 sigma of
253  // the residual distribution (we are looking for residuals of segments
254  // usefull to the track fit) for efficency purpose
255  const DTRecSegment4D* bestRecHit = 0;
256  double deltaAlpha = 99999;
257  double deltaBeta = 99999;
258 
259  // Loop over the recHits of this chamberId
260  for (DTRecSegment4DCollection::const_iterator segment4D = range.first;
261  segment4D!=range.second;
262  ++segment4D){
263 
264  // Consider only segments with both projections
265  if(station!=4 && (*segment4D).dimension() != 4) {
266  continue;
267  }
268  // Segment Local Direction and position (in Chamber RF)
269  LocalVector recSegDirection = (*segment4D).localDirection();
270  LocalPoint recSegPosition = (*segment4D).localPosition();
271 
272  pair<double, double> ab = DTHitQualityUtils::findSegmentAlphaAndBeta(recSegDirection);
273  float recSegAlpha = ab.first;
274  float recSegBeta = ab.second;
275 
276  if(debug)
277  cout << &(*segment4D)
278  << " RecSegment direction: " << recSegDirection << endl
279  << " position : " << (*segment4D).localPosition() << endl
280  << " alpha : " << recSegAlpha << endl
281  << " beta : " << recSegBeta << endl
282  << " nhits : " << (*segment4D).phiSegment()->recHits().size() << " " << (((*segment4D).zSegment()!=0)?(*segment4D).zSegment()->recHits().size():0)
283  << endl;
284 
285 
286  float dAlphaRecSim=fabs(recSegAlpha - alphaSimSeg);
287  float dBetaRecSim =fabs(recSegBeta - betaSimSeg);
288 
289 
290  if ((fabs(recSegPosition.x()-simSegmLocalPos.x())<4) // require rec and sim segments to be ~in the same cell in x
291  && ((fabs(recSegPosition.y()-simSegmLocalPos.y())<4)||(*segment4D).dimension()<4)) { // ~in the same cell in y, if segment has the theta view
292  ++count_seg;
293 
294  if (fabs(dAlphaRecSim-deltaAlpha) < epsilon) { // Numerically equivalent alphas, choose based on beta
295  if (dBetaRecSim < deltaBeta) {
296  deltaAlpha = dAlphaRecSim;
297  deltaBeta = dBetaRecSim;
298  bestRecHit = &(*segment4D);
299  }
300 
301  } else if (dAlphaRecSim < deltaAlpha) {
302  deltaAlpha = dAlphaRecSim;
303  deltaBeta = dBetaRecSim;
304  bestRecHit = &(*segment4D);
305  }
306  }
307 
308  } // End of Loop over all 4D RecHits
309 
310  if(bestRecHit) {
311  if (debug) cout << endl << "Chosen: " << bestRecHit << endl;
312  // Best rechit direction and position in Chamber RF
313  LocalPoint bestRecHitLocalPos = bestRecHit->localPosition();
314  LocalVector bestRecHitLocalDir = bestRecHit->localDirection();
315  // Errors on x and y
316  LocalError bestRecHitLocalPosErr = bestRecHit->localPositionError();
317  LocalError bestRecHitLocalDirErr = bestRecHit->localDirectionError();
318 
319  pair<double, double> ab = DTHitQualityUtils::findSegmentAlphaAndBeta(bestRecHitLocalDir);
320  float alphaBestRHit = ab.first;
321  float betaBestRHit = ab.second;
322  // Errors on alpha and beta
323 
324  // Get position and direction using the rx projection (so in SL
325  // reference frame). Note that x (and y) are swapped wrt to Chamber
326  // frame
327  //if (bestRecHit->hasZed() ) {
328  const DTSLRecSegment2D * zedRecSeg = bestRecHit->zSegment();
329  LocalPoint bestRecHitLocalPosRZ;
330  LocalVector bestRecHitLocalDirRZ;
331  LocalError bestRecHitLocalPosErrRZ;
332  LocalError bestRecHitLocalDirErrRZ;
333  LocalPoint simSegLocalPosRZ; // FIXME: this is not set for segments with only the phi view.
334  float alphaBestRHitRZ = 0; // angle measured in the RZ SL, in its own frame
335  float alphaSimSegRZ = betaSimSeg;
336  if (zedRecSeg) {
337  bestRecHitLocalPosRZ = zedRecSeg->localPosition();
338  bestRecHitLocalDirRZ = zedRecSeg->localDirection();
339  // Errors on x and y
340  bestRecHitLocalPosErrRZ = zedRecSeg->localPositionError();
341  bestRecHitLocalDirErrRZ = zedRecSeg->localDirectionError();
342 
343  // angle measured in the RZ SL, in its own frame
344  alphaBestRHitRZ = DTHitQualityUtils::findSegmentAlphaAndBeta(bestRecHitLocalDirRZ).first;
345 
346  // Get SimSeg position and Direction in rZ SL frame
347  const DTSuperLayer* sl = dtGeom->superLayer(zedRecSeg->superLayerId());
348  LocalPoint simSegLocalPosRZTmp = sl->toLocal(simSegmGlobalPos);
349  LocalVector simSegLocalDirRZ = sl->toLocal(simSegmGlobalDir);
350  simSegLocalPosRZ =
351  simSegLocalPosRZTmp + simSegLocalDirRZ*(-simSegLocalPosRZTmp.z()/(cos(simSegLocalDirRZ.theta())));
352  alphaSimSegRZ = DTHitQualityUtils::findSegmentAlphaAndBeta(simSegLocalDirRZ).first;
353 
354  if (debug) cout <<
355  "RZ SL: recPos " << bestRecHitLocalPosRZ <<
356  "recDir " << bestRecHitLocalDirRZ <<
357  "recAlpha " << alphaBestRHitRZ << endl <<
358  "RZ SL: simPos " << simSegLocalPosRZ <<
359  "simDir " << simSegLocalDirRZ <<
360  "simAlpha " << alphaSimSegRZ << endl ;
361  }
362 
363  // get nhits and t0
364  const DTChamberRecSegment2D* phiSeg = bestRecHit->phiSegment();
365 
366  float t0phi = -999;
367  float t0theta = -999;
368  int nHitPhi=0;
369  int nHitTheta=0;
370 
371  if (phiSeg) {
372  t0phi = phiSeg->t0();
373  nHitPhi = phiSeg->recHits().size();
374  }
375 
376  if (zedRecSeg) {
377  t0theta = zedRecSeg->t0();
378  nHitTheta = zedRecSeg->recHits().size();
379  }
380 
381  // Nominal cuts for efficiency - consider all matched segments for the time being
382 // if(fabs(alphaBestRHit - alphaSimSeg) < 5*sigmaResAlpha &&
383 // fabs(betaBestRHit - betaSimSeg) < 5*sigmaResBeta &&
384 // fabs(bestRecHitLocalPos.x() - xSimSeg) < 5*sigmaResX &&
385 // fabs(bestRecHitLocalPos.y() - ySimSeg) < 5*sigmaResY) {
386 // recHitFound = true;
387 // }
388  recHitFound = true;
389 
390  // Mirror alpha in phi SLs so that + and - wheels can be plotted together
391  if (mirrorMinusWheels && wheel<0){
392  alphaSimSeg*=-1.;
393  alphaBestRHit*=-1.;
394  // Note: local X (xSimSeg, bestRecHitLocalPos.x() would have to be mirrored as well;
395  // but at the moment there is no plot of dependency vs X, except for efficiency.
396  }
397 
398  // Fill Residual histos
399  HRes4DHit *histo=0;
400 
401  if(wheel == 0)
402  histo = h4DHit_W0;
403  else if(abs(wheel) == 1)
404  histo = h4DHit_W1;
405  else if(abs(wheel) == 2)
406  histo = h4DHit_W2;
407 
408  float sigmaAlphaBestRhit = sqrt(DTHitQualityUtils::sigmaAngle(alphaBestRHit,bestRecHitLocalDirErr.xx()));
409  float sigmaBetaBestRhit = sqrt(DTHitQualityUtils::sigmaAngle(betaBestRHit,bestRecHitLocalDirErr.yy())); // FIXME this misses the contribution from uncertainty in extrapolation!
410  float sigmaAlphaBestRhitRZ = sqrt(DTHitQualityUtils::sigmaAngle(alphaBestRHitRZ,bestRecHitLocalDirErrRZ.xx()));
411 
412  histo->Fill(alphaSimSeg,
413  alphaBestRHit,
414  betaSimSeg,
415  betaBestRHit,
416  xSimSeg,
417  bestRecHitLocalPos.x(),
418  ySimSeg,
419  bestRecHitLocalPos.y(),
420  etaSimSeg,
421  phiSimSeg,
422  bestRecHitLocalPosRZ.x(),
423  simSegLocalPosRZ.x(),
424  alphaBestRHitRZ,
425  alphaSimSegRZ,
426  sigmaAlphaBestRhit,
427  sigmaBetaBestRhit,
428  sqrt(bestRecHitLocalPosErr.xx()),
429  sqrt(bestRecHitLocalPosErr.yy()),
430  sigmaAlphaBestRhitRZ,
431  sqrt(bestRecHitLocalPosErrRZ.xx()),
432  nHitPhi,nHitTheta,t0phi,t0theta
433  );
434 
435  h4DHit->Fill(alphaSimSeg,
436  alphaBestRHit,
437  betaSimSeg,
438  betaBestRHit,
439  xSimSeg,
440  bestRecHitLocalPos.x(),
441  ySimSeg,
442  bestRecHitLocalPos.y(),
443  etaSimSeg,
444  phiSimSeg,
445  bestRecHitLocalPosRZ.x(),
446  simSegLocalPosRZ.x(),
447  alphaBestRHitRZ,
448  alphaSimSegRZ,
449  sigmaAlphaBestRhit,
450  sigmaBetaBestRhit,
451  sqrt(bestRecHitLocalPosErr.xx()),
452  sqrt(bestRecHitLocalPosErr.yy()),
453  sigmaAlphaBestRhitRZ,
454  sqrt(bestRecHitLocalPosErrRZ.xx()),
455  nHitPhi,nHitTheta,t0phi,t0theta
456  );
457 
458  if (local) h4DHitWS[abs(wheel)][station-1]->Fill(alphaSimSeg,
459  alphaBestRHit,
460  betaSimSeg,
461  betaBestRHit,
462  xSimSeg,
463  bestRecHitLocalPos.x(),
464  ySimSeg,
465  bestRecHitLocalPos.y(),
466  etaSimSeg,
467  phiSimSeg,
468  bestRecHitLocalPosRZ.x(),
469  simSegLocalPosRZ.x(),
470  alphaBestRHitRZ,
471  alphaSimSegRZ,
472  sigmaAlphaBestRhit,
473  sigmaBetaBestRhit,
474  sqrt(bestRecHitLocalPosErr.xx()),
475  sqrt(bestRecHitLocalPosErr.yy()),
476  sigmaAlphaBestRhitRZ,
477  sqrt(bestRecHitLocalPosErrRZ.xx()),
478  nHitPhi,nHitTheta,t0phi,t0theta
479  );
480 
481  } //end of if(bestRecHit)
482 
483  } //end of if(nsegm!=0)
484 
485  // Fill Efficiency plot
486  if(doall){
487  HEff4DHit *heff = 0;
488 
489  if(wheel == 0)
490  heff = hEff_W0;
491  else if(abs(wheel) == 1)
492  heff = hEff_W1;
493  else if(abs(wheel) == 2)
494  heff = hEff_W2;
495  heff->Fill(etaSimSeg, phiSimSeg, xSimSeg, ySimSeg, alphaSimSeg, betaSimSeg, recHitFound,count_seg);
496  hEff_All->Fill(etaSimSeg, phiSimSeg, xSimSeg, ySimSeg, alphaSimSeg, betaSimSeg, recHitFound,count_seg);
497  if (local) hEffWS[abs(wheel)][station-1]->Fill(etaSimSeg, phiSimSeg, xSimSeg, ySimSeg, alphaSimSeg, betaSimSeg, recHitFound,count_seg);
498 
499  }
500  } // End of loop over chambers
501  }
virtual LocalError localPositionError() const
local position error in SL frame
float xx() const
Definition: LocalError.h:24
void Fill(float etaSimSegm, float phiSimSegm, float xSimSegm, float ySimSegm, float alphaSimSegm, float betaSimSegm, bool fillRecHit, int nSeg)
Definition: Histograms.h:1058
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
static double sigmaAngle(double Angle, double sigma2TanAngle)
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:67
virtual LocalError localDirectionError() const
the local direction error (xx,xy,yy) in SL frame: only xx is not 0.
edm::EDGetTokenT< DTRecSegment4DCollection > segment4DToken_
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
Definition: PV3DBase.h:75
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.
edm::InputTag segment4DLabel
HRes4DHit * h4DHitWS[3][4]
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, int nHitsPhi, int nHitsTheta, float t0Phi, float t0Theta)
Definition: Histograms.h:834
float yy() const
Definition: LocalError.h:26
virtual std::vector< const TrackingRecHit * > recHits() const
Access to component RecHits (if any)
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
A set of histograms for efficiency 4D RecHits.
Definition: Histograms.h:1006
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isValid() const
Definition: HandleBase.h:75
virtual LocalPoint localPosition() const
Local position in Chamber frame.
static std::pair< double, double > findSegmentAlphaAndBeta(const LocalVector &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...
const T & get() const
Definition: EventSetup.h:56
tuple simHits
Definition: trackerHits.py:16
HEff4DHit * hEffWS[3][4]
T eta() const
Definition: PV3DBase.h:76
virtual LocalVector localDirection() const
the local direction in SL frame
tuple cout
Definition: gather_cfg.py:121
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)
int station() const
Return the station number.
Definition: DTChamberId.h:51
edm::EDGetTokenT< edm::PSimHitContainer > simHitToken_
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
T x() const
Definition: PV3DBase.h:62
virtual LocalError localDirectionError() const
Local direction error in the Chamber frame.
void DTSegment4DQuality::beginRun ( const edm::Run iRun,
const edm::EventSetup setup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 71 of file DTSegment4DQuality.cc.

References dbe_, debug, mergeVDriftHistosByStation::name, cppFunctionSkipper::operator, alignCSCRings::s, and w.

71  {
72 
73  // get hold of back-end interface
74  dbe_ = 0;
76  if ( dbe_ ) {
77  if (debug) {
78  dbe_->setVerbose(1);
79  } else {
80  dbe_->setVerbose(0);
81  }
82  }
83  if ( dbe_ ) {
84  if ( debug ) dbe_->showDirStructure();
85  }
86 
87  h4DHit= new HRes4DHit ("All",dbe_,doall,local);
88  h4DHit_W0= new HRes4DHit ("W0",dbe_,doall,local);
89  h4DHit_W1= new HRes4DHit ("W1",dbe_,doall,local);
90  h4DHit_W2= new HRes4DHit ("W2",dbe_,doall,local);
91 
92  if(doall) {
93  hEff_All= new HEff4DHit ("All",dbe_);
94  hEff_W0= new HEff4DHit ("W0",dbe_);
95  hEff_W1= new HEff4DHit ("W1",dbe_);
96  hEff_W2= new HEff4DHit ("W2",dbe_);
97  }
98 
99  if (local) {
100  // Plots with finer granularity, not to be included in DQM
101  TString name="W";
102  for (long w=0;w<=2;++w) {
103  for (long s=1;s<=4;++s){
104  // FIXME station 4 is not filled
105  TString nameWS=(name+w+"_St"+s);
106  h4DHitWS[w][s-1] = new HRes4DHit(nameWS.Data(),dbe_,doall,local);
107  hEffWS[w][s-1] = new HEff4DHit (nameWS.Data(),dbe_);
108  }
109  }
110  }
111 };
const double w
Definition: UKUtility.cc:23
HRes4DHit * h4DHitWS[3][4]
A set of histograms for efficiency 4D RecHits.
Definition: Histograms.h:1006
HEff4DHit * hEffWS[3][4]
void DTSegment4DQuality::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 122 of file DTSegment4DQuality.cc.

122  {
123  // Write the histos to file
124  //theFile->cd();
125 
126  //h4DHit->Write();
127  //h4DHit_W0->Write();
128  //h4DHit_W1->Write();
129  //h4DHit_W2->Write();
130 
131  if(doall){
136  }
137  //hEff_All->Write();
138  //hEff_W0->Write();
139  //hEff_W1->Write();
140  //hEff_W2->Write();
141  //if ( rootFileName.size() != 0 && dbe_ ) dbe_->save(rootFileName);
142 
143  //theFile->Close();
144 }
void ComputeEfficiency()
Definition: Histograms.h:1087
void DTSegment4DQuality::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 118 of file DTSegment4DQuality.cc.

119  {
120 }

Member Data Documentation

DQMStore* DTSegment4DQuality::dbe_
private

Definition at line 97 of file DTSegment4DQuality.h.

bool DTSegment4DQuality::debug
private

Definition at line 70 of file DTSegment4DQuality.h.

bool DTSegment4DQuality::doall
private

Definition at line 98 of file DTSegment4DQuality.h.

HRes4DHit* DTSegment4DQuality::h4DHit
private

Definition at line 85 of file DTSegment4DQuality.h.

HRes4DHit* DTSegment4DQuality::h4DHit_W0
private

Definition at line 86 of file DTSegment4DQuality.h.

HRes4DHit* DTSegment4DQuality::h4DHit_W1
private

Definition at line 87 of file DTSegment4DQuality.h.

HRes4DHit* DTSegment4DQuality::h4DHit_W2
private

Definition at line 88 of file DTSegment4DQuality.h.

HRes4DHit* DTSegment4DQuality::h4DHitWS[3][4]
private

Definition at line 89 of file DTSegment4DQuality.h.

HEff4DHit* DTSegment4DQuality::hEff_All
private

Definition at line 91 of file DTSegment4DQuality.h.

HEff4DHit* DTSegment4DQuality::hEff_W0
private

Definition at line 92 of file DTSegment4DQuality.h.

HEff4DHit* DTSegment4DQuality::hEff_W1
private

Definition at line 93 of file DTSegment4DQuality.h.

HEff4DHit* DTSegment4DQuality::hEff_W2
private

Definition at line 94 of file DTSegment4DQuality.h.

HEff4DHit* DTSegment4DQuality::hEffWS[3][4]
private

Definition at line 95 of file DTSegment4DQuality.h.

bool DTSegment4DQuality::local
private

Definition at line 99 of file DTSegment4DQuality.h.

std::string DTSegment4DQuality::rootFileName
private

Definition at line 72 of file DTSegment4DQuality.h.

edm::InputTag DTSegment4DQuality::segment4DLabel
private

Definition at line 75 of file DTSegment4DQuality.h.

edm::EDGetTokenT<DTRecSegment4DCollection> DTSegment4DQuality::segment4DToken_
private

Definition at line 77 of file DTSegment4DQuality.h.

double DTSegment4DQuality::sigmaResAlpha
private

Definition at line 82 of file DTSegment4DQuality.h.

double DTSegment4DQuality::sigmaResBeta
private

Definition at line 83 of file DTSegment4DQuality.h.

double DTSegment4DQuality::sigmaResX
private

Definition at line 79 of file DTSegment4DQuality.h.

double DTSegment4DQuality::sigmaResY
private

Definition at line 80 of file DTSegment4DQuality.h.

edm::InputTag DTSegment4DQuality::simHitLabel
private

Definition at line 74 of file DTSegment4DQuality.h.

edm::EDGetTokenT<edm::PSimHitContainer> DTSegment4DQuality::simHitToken_
private

Definition at line 76 of file DTSegment4DQuality.h.