CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
DTSegment4DQuality Class Reference

#include <DTSegment4DQuality.h>

Inheritance diagram for DTSegment4DQuality:
DQMGlobalEDAnalyzer< Histograms > edm::global::EDAnalyzer< edm::RunCache< Histograms > > edm::global::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 DTSegment4DQuality (const edm::ParameterSet &pset)
 Constructor. More...
 
- Public Member Functions inherited from edm::global::EDAnalyzer< edm::RunCache< Histograms > >
 EDAnalyzer ()=default
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void bookHistograms (DQMStore::ConcurrentBooker &, edm::Run const &, edm::EventSetup const &, Histograms &) const override
 Book the DQM plots. More...
 
void dqmAnalyze (edm::Event const &, edm::EventSetup const &, Histograms const &) const override
 Perform the real analysis. More...
 

Private Attributes

bool debug_
 
bool doall_
 
bool local_
 
edm::InputTag segment4DLabel_
 
edm::EDGetTokenT< DTRecSegment4DCollectionsegment4DToken_
 
double sigmaResAlpha_
 
double sigmaResBeta_
 
double sigmaResX_
 
double sigmaResY_
 
edm::InputTag simHitLabel_
 
edm::EDGetTokenT< edm::PSimHitContainersimHitToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 54 of file DTSegment4DQuality.cc.

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

54  {
55  // Get the debug parameter for verbose output
56  debug_ = pset.getUntrackedParameter<bool>("debug");
58 
59  // the name of the simhit collection
60  simHitLabel_ = pset.getUntrackedParameter<InputTag>("simHitLabel");
61  simHitToken_ = consumes<PSimHitContainer>(pset.getUntrackedParameter<InputTag>("simHitLabel"));
62  // the name of the 2D rec hit collection
63  segment4DLabel_ = pset.getUntrackedParameter<InputTag>("segment4DLabel");
64  segment4DToken_ = consumes<DTRecSegment4DCollection>(pset.getUntrackedParameter<InputTag>("segment4DLabel"));
65 
66  // sigma resolution on position
67  sigmaResX_ = pset.getParameter<double>("sigmaResX");
68  sigmaResY_ = pset.getParameter<double>("sigmaResY");
69  // sigma resolution on angle
70  sigmaResAlpha_ = pset.getParameter<double>("sigmaResAlpha");
71  sigmaResBeta_ = pset.getParameter<double>("sigmaResBeta");
72  doall_ = pset.getUntrackedParameter<bool>("doall", false);
73  local_ = pset.getUntrackedParameter<bool>("local", false);
74 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag segment4DLabel_
edm::InputTag simHitLabel_
edm::EDGetTokenT< DTRecSegment4DCollection > segment4DToken_
edm::EDGetTokenT< edm::PSimHitContainer > simHitToken_

Member Function Documentation

void DTSegment4DQuality::bookHistograms ( DQMStore::ConcurrentBooker booker,
edm::Run const &  run,
edm::EventSetup const &  setup,
Histograms histograms 
) const
overrideprivatevirtual

Book the DQM plots.

Implements DQMGlobalEDAnalyzer< Histograms >.

Definition at line 76 of file DTSegment4DQuality.cc.

References Histograms::h4DHit, Histograms::h4DHit_W0, Histograms::h4DHit_W1, Histograms::h4DHit_W2, Histograms::h4DHitWS, Histograms::hEff_All, Histograms::hEff_W0, Histograms::hEff_W1, Histograms::hEff_W2, Histograms::hEffWS, dataset::name, alignCSCRings::s, and w.

76  {
77  histograms.h4DHit = new HRes4DHit("All", booker, doall_, local_);
78  histograms.h4DHit_W0 = new HRes4DHit("W0", booker, doall_, local_);
79  histograms.h4DHit_W1 = new HRes4DHit("W1", booker, doall_, local_);
80  histograms.h4DHit_W2 = new HRes4DHit("W2", booker, doall_, local_);
81 
82  if (doall_) {
83  histograms.hEff_All = new HEff4DHit("All", booker);
84  histograms.hEff_W0 = new HEff4DHit("W0", booker);
85  histograms.hEff_W1 = new HEff4DHit("W1", booker);
86  histograms.hEff_W2 = new HEff4DHit("W2", booker);
87  }
88 
89  if (local_) {
90  // Plots with finer granularity, not to be included in DQM
91  TString name ="W";
92  for (long w = 0;w<= 2;++w) {
93  for (long s = 1;s<= 4;++s) {
94  // FIXME station 4 is not filled
95  TString nameWS =(name+w+"_St"+s);
96  histograms.h4DHitWS[w][s-1] = new HRes4DHit(nameWS.Data(), booker, doall_, local_);
97  histograms.hEffWS[w][s-1] = new HEff4DHit(nameWS.Data(), booker);
98  }
99  }
100  }
101 };
HEff4DHit * hEff_W1
HRes4DHit * h4DHitWS[3][4]
const double w
Definition: UKUtility.cc:23
HEff4DHit * hEff_All
HRes4DHit * h4DHit_W2
HEff4DHit * hEff_W2
A set of histograms for efficiency 4D RecHits (producer)
Definition: Histograms.h:699
HRes4DHit * h4DHit_W1
HEff4DHit * hEffWS[3][4]
HRes4DHit * h4DHit
HRes4DHit * h4DHit_W0
HEff4DHit * hEff_W0
void DTSegment4DQuality::dqmAnalyze ( edm::Event const &  event,
edm::EventSetup const &  setup,
Histograms const &  histograms 
) const
overrideprivate

Perform the real analysis.

Definition at line 104 of file DTSegment4DQuality.cc.

References funct::abs(), relativeConstraints::chamber, DTGeometry::chamber(), funct::cos(), gather_cfg::cout, DEFINE_FWK_MODULE, SoftLeptonByDistance_cfi::distance, MillePedeFileConverter_cfg::e, geometryDiff::epsilon, PV3DBase< T, PVType, FrameType >::eta(), HRes4DHit::fill(), HEff4DHit::fill(), DTHitQualityUtils::findMuSimSegment(), DTHitQualityUtils::findMuSimSegmentDirAndPos(), DTHitQualityUtils::findSegmentAlphaAndBeta(), edm::EventSetup::get(), Histograms::h4DHit, Histograms::h4DHit_W0, Histograms::h4DHit_W1, Histograms::h4DHit_W2, Histograms::h4DHitWS, Histograms::hEff_All, Histograms::hEff_W0, Histograms::hEff_W1, Histograms::hEff_W2, Histograms::hEffWS, trackerHits::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(), rpcPointValidation_cfi::simHit, trackerHits::simHits, mathSSE::sqrt(), DTChamberId::station(), relativeConstraints::station, DTGeometry::superLayer(), DTSLRecSegment2D::superLayerId(), DTRecSegment2D::t0(), PV3DBase< T, PVType, FrameType >::theta(), GeomDet::toGlobal(), GeomDet::toLocal(), DTChamberId::wheel(), makeMuonMisalignmentScenario::wheel, PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), PV3DBase< T, PVType, FrameType >::y(), LocalError::yy(), PV3DBase< T, PVType, FrameType >::z(), and DTRecSegment4D::zSegment().

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

Member Data Documentation

bool DTSegment4DQuality::debug_
private

Definition at line 74 of file DTSegment4DQuality.h.

bool DTSegment4DQuality::doall_
private

Definition at line 70 of file DTSegment4DQuality.h.

bool DTSegment4DQuality::local_
private

Definition at line 71 of file DTSegment4DQuality.h.

edm::InputTag DTSegment4DQuality::segment4DLabel_
private

Definition at line 58 of file DTSegment4DQuality.h.

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

Definition at line 60 of file DTSegment4DQuality.h.

double DTSegment4DQuality::sigmaResAlpha_
private

Definition at line 67 of file DTSegment4DQuality.h.

double DTSegment4DQuality::sigmaResBeta_
private

Definition at line 68 of file DTSegment4DQuality.h.

double DTSegment4DQuality::sigmaResX_
private

Definition at line 63 of file DTSegment4DQuality.h.

double DTSegment4DQuality::sigmaResY_
private

Definition at line 64 of file DTSegment4DQuality.h.

edm::InputTag DTSegment4DQuality::simHitLabel_
private

Definition at line 57 of file DTSegment4DQuality.h.

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

Definition at line 59 of file DTSegment4DQuality.h.