ATLAS Offline Software
MuonHoughTransformTester.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "GaudiKernel/SystemOfUnits.h"
13 #include "GeoModelHelpers/throwExcept.h"
14 #include "TCanvas.h"
15 #include "TLine.h"
16 #include "TArrow.h"
17 #include "TMarker.h"
18 #include "TEllipse.h"
19 #include "TLatex.h"
20 
21 
22 
23 namespace MuonValR4 {
24 
25 
26 
28  ISvcLocator* pSvcLocator)
29  : AthHistogramAlgorithm(name, pSvcLocator) {}
30 
31 
34  ATH_CHECK(m_inSimHitKeys.initialize());
37  ATH_CHECK(m_spacePointKey.initialize());
38  m_tree.addBranch(std::make_shared<MuonVal::EventInfoBranch>(m_tree,0));
39  ATH_CHECK(m_tree.init(this));
40  ATH_CHECK(m_idHelperSvc.retrieve());
42  ATH_MSG_DEBUG("Succesfully initialised");
44  m_allCan = std::make_unique<TCanvas>("AllDisplays", "AllDisplays", 800, 600);
45  m_allCan->SaveAs(Form("%s[", m_allCanName.value().c_str()));
46  }
47  return StatusCode::SUCCESS;
48  }
49 
52  if (m_allCan) m_allCan->SaveAs(Form("%s]", m_allCanName.value().c_str()));
53  return StatusCode::SUCCESS;
54  }
55 
57  const Identifier& hitId) const {
58  const MuonGMR4::MuonReadoutElement* reElement = m_r4DetMgr->getReadoutElement(hitId);
59  //transform from local (w.r.t tube's frame) to global (ATLAS frame) and then to chamber's frame
60  const MuonGMR4::MuonChamber* muonChamber = reElement->getChamber();
62  const IdentifierHash trfHash = reElement->detectorType() == ActsTrk::DetectorType::Mdt ?
63  reElement->measurementHash(hitId) : reElement->layerHash(hitId);
64  return muonChamber->globalToLocalTrans(gctx) * reElement->localToGlobalTrans(gctx, trfHash);
65  }
66 
68 
69  const EventContext & ctx = Gaudi::Hive::currentContext();
71  ATH_CHECK(gctxHandle.isPresent());
72  const ActsGeometryContext& gctx{*gctxHandle};
73 
74  // retrieve the two input collections
75 
76  auto simHitCollections = m_inSimHitKeys.makeHandles(ctx);
77 
79  ATH_CHECK(readSegmentSeeds.isPresent());
80 
82  ATH_CHECK(readMuonSegments.isPresent());
83 
84  ATH_MSG_DEBUG("Succesfully retrieved input collections");
85 
86  std::set<const MuonR4::HoughSegmentSeed*> matchedSeeds{};
87  // map the drift circles to identifiers.
88  // The fast digi should only generate one circle per tube.
89  std::map<std::pair<const MuonGMR4::MuonChamber*, HepMC::ConstGenParticlePtr>, std::vector<const xAOD::MuonSimHit*>> simHitMap{};
90  for (auto & collection : simHitCollections){
91  ATH_CHECK(collection.isPresent());
92  for (const xAOD::MuonSimHit* simHit : *collection) {
93  const MuonGMR4::MuonReadoutElement* reElement = m_r4DetMgr->getReadoutElement(simHit->identify());
94  const MuonGMR4::MuonChamber* id{reElement->getChamber()};
95  auto genLink = simHit->genParticleLink();
96  HepMC::ConstGenParticlePtr genParticle = nullptr;
97  if (genLink.isValid()){
98  genParticle = genLink.cptr();
99  }
101  if (genParticle == nullptr) continue;
102  simHitMap[std::make_pair(id,genParticle)].push_back(simHit);
103  }
104  }
105 
106  std::map<const MuonGMR4::MuonChamber*, std::vector<MuonR4::HoughSegmentSeed>> houghPeakMap{};
107  for (const MuonR4::StationHoughSegmentSeeds & max : *readSegmentSeeds){
108  houghPeakMap.emplace(max.chamber(),max.getMaxima());
109  }
110 
111  for (auto & [stationAndParticle, hits] : simHitMap){
112  HepMC::ConstGenParticlePtr genParticlePtr = stationAndParticle.second;
113  const xAOD::MuonSimHit* simHit = hits.front();
114  const Identifier ID = simHit->identify();
116 
117  const Amg::Transform3D toChamber{toChamberTrf(gctx, ID)};
118  const Amg::Vector3D localPos{toChamber * xAOD::toEigen(simHit->localPosition())};
119  Amg::Vector3D chamberDir = toChamber.linear() * xAOD::toEigen(simHit->localDirection());
120 
122  const std::optional<double> lambda = Amg::intersect<3>(localPos, chamberDir, Amg::Vector3D::UnitZ(), 0.);
123  Amg::Vector3D chamberPos = localPos + (*lambda)*chamberDir;
124 
125  m_out_stationName = chamber->stationName();
126  m_out_stationEta = chamber->stationEta();
127  m_out_stationPhi = chamber->stationPhi();
129  m_out_gen_Eta = genParticlePtr->momentum().eta();
130  m_out_gen_Phi= genParticlePtr->momentum().phi();
131  m_out_gen_Pt= genParticlePtr->momentum().perp();
132  m_out_gen_nHits = hits.size();
133  unsigned int nMdt{0}, nRpc{0}, nTgc{0}, nMm{0}, nsTgc{0};
134  for (const xAOD::MuonSimHit* hit : hits){
135  nMdt += m_idHelperSvc->isMdt(hit->identify());
136  nRpc += m_idHelperSvc->isRpc(hit->identify());
137  nTgc += m_idHelperSvc->isTgc(hit->identify());
138  nMm += m_idHelperSvc->isMM(hit->identify());
139  nsTgc += m_idHelperSvc->issTgc(hit->identify());
140  }
141  m_out_gen_nRPCHits = nRpc;
142  m_out_gen_nMDTHits = nMdt;
143  m_out_gen_nTGCHits = nTgc;
144  m_out_gen_nMMits = nMm;
145  m_out_gen_nsTGCHits = nsTgc;
146 
147  m_out_gen_tantheta = (std::abs(chamberDir.z()) > 1.e-8 ? chamberDir.y()/chamberDir.z() : 1.e10);
148  m_out_gen_tanphi = (std::abs(chamberDir.z()) > 1.e-8 ? chamberDir.x()/chamberDir.z() : 1.e10);
149  m_out_gen_z0 = chamberPos.y();
150  m_out_gen_x0 = chamberPos.x();
151 
152  const std::vector<MuonR4::HoughSegmentSeed>& houghMaxima = houghPeakMap[chamber];
153  if (houghMaxima.empty()){
154  if (!m_tree.fill(ctx)) {
155  return StatusCode::FAILURE;
156  }
158  ATH_CHECK(drawEventDisplay(ctx, hits, nullptr));
159  }
160  continue;
161  }
162  const MuonR4::HoughSegmentSeed* foundMax = nullptr;
163  // find the best hough maximum
164  size_t max_hits{0}, max_etaHits{0}, max_phiHits{0};
165  for (const MuonR4::HoughSegmentSeed & max : houghMaxima){
166  size_t nFound{0}, nEta{0}, nPhi{0};
167  for (const xAOD::MuonSimHit* simHit : hits) {
168 
169  for (const MuonR4::HoughHitType & hitOnMax : max.getHitsInMax()) {
170  if(m_idHelperSvc->isMdt(simHit->identify()) &&
171  hitOnMax->identify() == simHit->identify()){
172  ++nFound;
173  break;
174  }
177  else if (m_idHelperSvc->gasGapId(hitOnMax->identify()) == simHit->identify()) {
178  ++nFound;
179  if (hitOnMax->measuresEta()) ++nEta;
180  if (hitOnMax->measuresPhi()) ++nPhi;
181  }
182  }
183  }
184  if (nFound > max_hits){
185  max_hits = nFound;
186  max_etaHits = nEta;
187  max_phiHits = nPhi;
188  foundMax = &max;
189  }
190  }
192  if (foundMax != nullptr){
193  matchedSeeds.insert(foundMax);
194  fillMaximum(foundMax);
195  m_out_max_nHits = max_hits;
196  m_out_max_nEtaHits = max_etaHits;
197  m_out_max_nPhiHits = max_phiHits;
198 
199  bool foundSegment = false;
200  const MuonR4::MuonSegment* theSegment = nullptr;
201  max_hits = max_etaHits = max_phiHits;
202  for (const MuonR4::MuonSegment & segment : *readMuonSegments){
203  size_t nFound{0}, nEta{0}, nPhi{0};
204  for (const xAOD::MuonSimHit* simHit : hits) {
205  for (const xAOD::UncalibratedMeasurement* hitOnMax : segment.measurements()) {
206  if(hitOnMax->type() == xAOD::UncalibMeasType::MdtDriftCircleType &&
207  hitOnMax->identifier() == simHit->identify().get_compact()){
208  ++nFound;
209  break;
210  }
213  else if (m_idHelperSvc->gasGapId(Identifier(Identifier::value_type(hitOnMax->identifier()))) == simHit->identify()) {
214  ++nFound;
215  if (m_idHelperSvc->measuresPhi(Identifier(Identifier::value_type(hitOnMax->identifier())))) ++nPhi;
216  else ++nEta;
217  }
218  }
219  }
220  if (nFound > max_hits){
221  max_hits = nFound;
222  max_etaHits = nEta;
223  max_phiHits = nPhi;
224  foundSegment = true;
225  theSegment = &segment;
226  }
227  }
228  if (foundSegment){
229  m_out_hasSegment = true;
230  m_out_segment_chi2 = theSegment->chi2();
231  for (auto & c2 : theSegment->chi2PerMeasurement()){
233  }
234  m_out_segment_tanphi = theSegment->tanPhi();
235  m_out_segment_tantheta = theSegment->tanTheta();
236  m_out_segment_z0 = theSegment->y0();
237  m_out_segment_x0 = theSegment->x0();
238  }
239 
241  ATH_CHECK(drawEventDisplay(ctx, hits, foundMax));
242  ATH_CHECK(drawChi2(ctx, hits, foundMax, theSegment ,"ValidMin"));
243 
244 
245  }
246  } else if (m_drawEvtDisplayFailure) {
247  ATH_CHECK(drawEventDisplay(ctx, hits, nullptr));
248  }
249  if (!m_tree.fill(ctx)) return StatusCode::FAILURE;
250  }
251  ATH_CHECK(dumpUnMatched(ctx, *readSegmentSeeds, matchedSeeds));
252  return StatusCode::SUCCESS;
253  }
255  if (!foundMax) return;
256  m_out_hasMax = true;
258  m_out_max_tantheta = foundMax->tanTheta();
259  m_out_max_z0 = foundMax->interceptY();
261  m_out_max_tanphi = foundMax->tanPhi();
262  m_out_max_x0 = foundMax->interceptX();
263  }
264  unsigned int nMdtMax{0}, nRpcMax{0}, nTgcMax{0}, nMmMax{0}, nsTgcMax{0};
265  for (const MuonR4::HoughHitType & houghSP: foundMax->getHitsInMax()){
267 
268  const xAOD::UncalibratedMeasurement* meas = houghSP->primaryMeasurement();
269  switch (meas->type()) {
271  m_max_driftCircleId.push_back(houghSP->identify());
272  m_max_driftCircleTubePos.push_back(houghSP->positionInChamber());
273  m_max_driftCirclRadius.push_back(houghSP->driftRadius());
274  m_max_driftCircleDriftUncert.push_back(houghSP->uncertainty()[0]);
275  m_max_driftCircleTubeLength.push_back(houghSP->uncertainty()[1]);
276  ++nMdtMax;
277  break;
279  m_max_rpcHitId.push_back(houghSP->identify());
280  m_max_rpcHitPos.push_back(houghSP->positionInChamber());
281  m_max_rpcHitHasPhiMeas.push_back(houghSP->measuresPhi());
282  m_max_rpcHitErrorX.push_back(houghSP->uncertainty()[0]);
283  m_max_rpcHitErrorY.push_back(houghSP->uncertainty()[1]);
284  ++nRpcMax;
285  break;
287  m_max_tgcHitId.push_back(houghSP->identify());
288  m_max_tgcHitPos.push_back(houghSP->positionInChamber());
289  m_max_tgcHitHasPhiMeas.push_back(houghSP->measuresPhi());
290  m_max_tgcHitErrorX.push_back(houghSP->uncertainty()[0]);
291  m_max_tgcHitErrorY.push_back(houghSP->uncertainty()[1]);
292  ++nTgcMax;
293  break;
295  m_max_stgcHitId.push_back(houghSP->identify());
296  m_max_stgcHitPos.push_back(houghSP->positionInChamber());
297  m_max_stgcHitHasPhiMeas.push_back(houghSP->measuresPhi());
298  m_max_stgcHitErrorX.push_back(houghSP->uncertainty()[0]);
299  m_max_stgcHitErrorY.push_back(houghSP->uncertainty()[1]);
300  ++nsTgcMax;
301  break;
303  m_max_MmHitId.push_back(houghSP->identify());
304  m_max_MmHitPos.push_back(houghSP->positionInChamber());
305  m_max_MmHitIsStero.push_back(m_idHelperSvc->mmIdHelper().isStereo(houghSP->identify()));
306  m_max_MmHitErrorX.push_back(houghSP->uncertainty()[0]);
307  m_max_MmHitErrorY.push_back(houghSP->uncertainty()[1]);
308  ++nMmMax;
309  break;
310  default:
311  ATH_MSG_WARNING("Technology "<<m_idHelperSvc->toString(houghSP->identify())
312  <<" not yet implemented");
313  }
314  }
315  m_out_max_nMdt = nMdtMax;
316  m_out_max_nRpc = nRpcMax;
317  m_out_max_nTgc = nTgcMax;
318  m_out_max_nsTgc = nsTgcMax;
319  m_out_max_nMm = nMmMax;
320 
321  }
323  const MuonR4::StationHoughSegmentSeedContainer& seedContainer,
324  const std::set<const MuonR4::HoughSegmentSeed*>& matchedSeeds) {
325  if (!m_dumpUnmatchedSeeds){
326  return StatusCode::SUCCESS;
327  }
328  for (const auto& maxInStation : seedContainer) {
329 
330  const MuonGMR4::MuonChamber* chamber = maxInStation.chamber();
331  for (const MuonR4::HoughSegmentSeed& dumpMeMayBe : maxInStation.getMaxima()) {
332  if (matchedSeeds.count(&dumpMeMayBe)) {
333  ATH_MSG_VERBOSE("Do not dump the seed twice");
334  continue;
335  }
336  fillMaximum(&dumpMeMayBe);
337  m_out_gen_Eta = -666;
338  m_out_gen_Phi = -666;
339  m_out_gen_Pt = -1;
340  m_out_gen_nHits = 0;
341  m_out_stationName = chamber->stationName();
342  m_out_stationEta = chamber->stationEta();
343  m_out_stationPhi = chamber->stationPhi();
344 
345  if (!m_tree.fill(ctx)) return StatusCode::FAILURE;
346  }
347  }
348  return StatusCode::SUCCESS;
349  }
351  const std::vector<const xAOD::MuonSimHit*>& simHits,
352  const MuonR4::HoughSegmentSeed* foundMax) const {
353 
354  if (simHits.size() < 4) return StatusCode::SUCCESS;
355 
357  ATH_CHECK(gctxHandle.isPresent());
358  const ActsGeometryContext& gctx{*gctxHandle};
359 
360  auto readSpacePoints = SG::makeHandle(m_spacePointKey, ctx);
361  ATH_CHECK(readSpacePoints.isPresent());
362 
363  double zmin{1.e9}, zmax{-1.e9}, ymin{1.e9}, ymax{-1.e9};
364  std::vector<std::pair<double,double>> shPos{}, shDir{};
365 
366  const MuonGMR4::MuonChamber* refChamber = m_r4DetMgr->getChamber(simHits[0]->identify());
367 
368  for (const xAOD::MuonSimHit* thisHit: simHits){
369  const Identifier thisID = thisHit->identify();
370  const Amg::Transform3D toChamber = toChamberTrf(gctx, thisID);
371 
372  const Amg::Vector3D localPos{toChamber * xAOD::toEigen(thisHit->localPosition())};
373  const Amg::Vector3D chamberDir = toChamber.linear() * xAOD::toEigen(thisHit->localDirection());
374 
375  shPos.push_back(std::make_pair(localPos.y(), localPos.z()));
376  shDir.push_back(std::make_pair(chamberDir.y(), chamberDir.z()));
377  zmin = std::min(localPos.z(), zmin);
378  zmax = std::max(localPos.z(), zmax);
379  ymin = std::min(localPos.y(), ymin);
380  ymax = std::max(localPos.y(), ymax);
381  }
382 
383  TCanvas myCanvas("can","can",800,600);
384  myCanvas.cd();
385 
386  double width = (ymax - ymin)*1.1;
387  double height = (zmax - zmin)*1.1;
388  if (height > width) width = height;
389  else height = width;
390 
391  double y0 = 0.5 * (ymax + ymin) - 0.5 * width;
392  double z0 = 0.5 * (zmax + zmin) - 0.5 * height;
393  double y1 = 0.5 * (ymax + ymin) + 0.5 * width;
394  double z1 = 0.5 * (zmax + zmin) + 0.5 * height;
395  auto frame = myCanvas.DrawFrame(y0,z0,y1,z1);
396  double frameWidth = frame->GetXaxis()->GetXmax() - frame->GetXaxis()->GetXmin();
397 
398  std::vector<std::unique_ptr<TObject>> primitives;
399  for (size_t h = 0; h < shPos.size(); ++h){
400  auto l = std::make_unique<TArrow>(shPos.at(h).first, shPos.at(h).second,shPos.at(h).first + 0.3 * frameWidth * shDir.at(h).first, shPos.at(h).second + 0.3 * frameWidth * shDir.at(h).second);
401  l->SetLineStyle(kDotted);
402  l->Draw();
403  primitives.emplace_back(std::move(l));
404  auto m = std::make_unique<TMarker>(shPos.at(h).first, shPos.at(h).second,kFullDotLarge);
405  m->Draw();
406  primitives.emplace_back(std::move(m));
407  }
408 
409  for (auto spbucket : *readSpacePoints) {
410  if (spbucket->muonChamber() != refChamber) continue;
411  std::set<MuonR4::HoughHitType> hitsOnMax{};
412  if (foundMax){
413  hitsOnMax.insert(foundMax->getHitsInMax().begin(), foundMax->getHitsInMax().end());
414  }
415  for (auto & hit : *spbucket){
416  ATH_MSG_DEBUG( " HIT @ "<<Amg::toString(hit->positionInChamber())<<" "<<m_idHelperSvc->toString(hit->identify())<<" with r = "<<hit->driftRadius());
418  if (hit->driftRadius() > 1e-6) {
419  auto ell = std::make_unique<TEllipse>(hit->positionInChamber().y(),
420  hit->positionInChamber().z(),
421  hit->driftRadius());
422  ell->SetLineColor(kRed);
423  ell->SetFillColor(kRed);
424  if (hitsOnMax.count(hit)) {
425  ell->SetFillStyle(1001);
426  ell->SetFillColorAlpha(ell->GetFillColor(), 0.8);
427  }else{
428  ell->SetFillStyle(0);
429  }
430  ell->Draw();
431  primitives.emplace_back(std::move(ell));
432  } else {
433  auto m = std::make_unique<TEllipse>(hit->positionInChamber().y(),
434  hit->positionInChamber().z(),
435  hit->uncertainty().y());
436  m->SetLineColor(kBlue);
437  m->SetFillColor(kBlue);
438  m->SetFillStyle(0);
439 
440  if (hit->measuresPhi() && hit->measuresEta()) {
441  m->SetLineColor(kViolet);
442  m->SetFillColor(kViolet);
443  } else if (hit->measuresPhi()) {
444  m->SetLineColor(kGreen);
445  m->SetFillColor(kGreen);
446  }
448  if (hitsOnMax.count(hit)) {
449  m->SetFillStyle(1001);
450  m->SetFillColorAlpha(m->GetFillColor(), 0.8);
451  }
452  m->Draw();
453  primitives.emplace_back(std::move(m));
454  }
455  }
456  }
457 
458  std::stringstream legendLabel{};
459  legendLabel<<"Evt "<<ctx.evt()<<" station: "<<m_idHelperSvc->mdtIdHelper().stationNameString(refChamber->stationName());
460  legendLabel<<"eta: "<<refChamber->stationEta()<<", phi: "<<refChamber->stationPhi();
461  legendLabel<<", found maximum: "<<( foundMax ? "si" : "no");
462 
463 
464  TLatex tl( 0.15,0.8,legendLabel.str().c_str());
465  tl.SetNDC();
466  tl.SetTextFont(53);
467  tl.SetTextSize(18);
468  tl.Draw();
469  if (foundMax) {
470  auto mrk = std::make_unique<TMarker>( foundMax->interceptY(), 0., kFullTriangleUp);
471  mrk->SetMarkerSize(1);
472  mrk->SetMarkerColor(kOrange-3);
473  mrk->Draw();
474  primitives.emplace_back(std::move(mrk));
475  auto trajectory = std::make_unique<TArrow>( foundMax->interceptY(), 0., foundMax->interceptY() + 0.3 * frameWidth * foundMax->tanTheta(), 0.3 * frameWidth);
476  trajectory->SetLineColor(kOrange-3);
477  trajectory->Draw();
478  primitives.push_back(std::move(trajectory));
479  }
480  static std::atomic<unsigned int> pdfCounter{0};
481  std::stringstream pdfName{};
482  pdfName<<"HoughEvt_"<<ctx.evt()<<"_"<<(++pdfCounter)
483  <<m_idHelperSvc->mdtIdHelper().stationNameString(refChamber->stationName())<<"_"
484  <<refChamber->stationEta()<<"_"<<refChamber->stationPhi()<<".pdf";
485 
486  myCanvas.SaveAs(pdfName.str().c_str());
487  myCanvas.SaveAs(m_allCanName.value().c_str());
488  primitives.clear();
489  return StatusCode::SUCCESS;
490  }
491 
492  double evalX2(const double* pars, std::function<double(double, double, const ActsGeometryContext &, const std::vector<const xAOD::MuonSimHit*>&, const MuonR4::HoughSegmentSeed*)> fcn, const ActsGeometryContext & gctx, const std::vector<const xAOD::MuonSimHit*>& simHits, const MuonR4::HoughSegmentSeed* seed){
493  return fcn(pars[0],pars[1],gctx,simHits,seed);
494  }
495  #define XXX std::cout << __LINE__ << std::endl;
497  const std::vector<const xAOD::MuonSimHit*>& simHits,
498  const MuonR4::HoughSegmentSeed* foundMax,
499  const MuonR4::MuonSegment* foundSegment,
500  const std::string & label) const{
501 
502  if (simHits.size() < 4) return StatusCode::SUCCESS;
503  std::vector<std::pair<double,double>> shPos{}, shDir{};
504 
505  const MuonGMR4::MuonChamber* refChamber = m_r4DetMgr->getChamber(simHits[0]->identify());
506  std::cout <<" ref chamber = "<<refChamber<<std::endl;
507 
508  double true_y0 = m_out_gen_z0.getVariable();
509  double true_x0 = m_out_gen_x0.getVariable();
510  double true_tanTheta = m_out_gen_tantheta.getVariable();
511  double true_tanPhi = m_out_gen_tanphi.getVariable();
512 
513  TCanvas myCanvas("can","can",800,600);
514  myCanvas.cd();
515 
516 
517  TH2D hChi2("chi2","chi2;y0;tan(theta)",200,true_y0 - 100,true_y0 + 100 , 200,true_tanTheta - 0.2,true_tanTheta + 0.2);
518 
519  std::vector<double>pars(4,0.);
520  std::vector<double> chi2PerLayer(foundMax->getHitsInMax().size());
525  for (int bx =1 ; bx < hChi2.GetXaxis()->GetNbins()+1; ++bx){
526  for (int by =1 ; by < hChi2.GetYaxis()->GetNbins()+1; ++by){
527  double y = hChi2.GetXaxis()->GetBinCenter(bx);
528  double t = hChi2.GetYaxis()->GetBinCenter(by);
531  hChi2.Fill(y,t,MuonR4::SegmentFitHelpers::segmentChiSquare(pars.data(),foundMax->getHitsInMax(),chi2PerLayer));
532  }
533  }
534  int mx,my,mz = 0;
535  auto mbin = hChi2.GetMinimumBin(mx, my, mz);
536  double minChi2 = hChi2.GetBinContent(mbin);
537  double ygx2 = hChi2.GetXaxis()->GetBinCenter(mx);
538  double tgx2 = hChi2.GetYaxis()->GetBinCenter(my);
539  std::vector<double> contourLevels{minChi2 + 0.1,minChi2 + 1.0,minChi2 + 4.0,minChi2 + 9.0,minChi2 + 50.};
540  myCanvas.SetLogz();
541  hChi2.SetMinimum(1.e-1);
542  hChi2.SetContour(100000);
543  hChi2.GetXaxis()->SetTitle("y0[mm]");
544  hChi2.GetYaxis()->SetTitle("tan #Theta");
545  hChi2.Draw("COLZ");
546  std::shared_ptr<TH2D> hClone (dynamic_cast<TH2D*>(hChi2.Clone("leeeeeak")));
547  hClone->SetContour(5, contourLevels.data());
548  hClone->SetFillStyle(0);
549  hClone->Draw("CONT2SAME");
550 
551  TMarker mark(true_y0, true_tanTheta, kFullDotLarge);
552  mark.SetMarkerColor(kAzure+10);
553  mark.SetMarkerSize(1);
554  mark.Draw();
555 
556 
557  TMarker houghMin(foundMax->interceptY(), foundMax->tanTheta(), kOpenSquare);
558  houghMin.SetMarkerColor(kOrange-3);
559  houghMin.SetMarkerSize(1);
560  houghMin.Draw();
561 
562 
563  TMarker th2min(ygx2, tgx2, kOpenDiamond);
564  th2min.SetMarkerColor(kGray+1);
565  th2min.SetMarkerSize(1);
566  th2min.Draw();
567  TMarker gx2Min(-99999,-9999999, kFullDiamond);
568  gx2Min.SetMarkerColor(kRed+1);
569  gx2Min.SetMarkerSize(1);
570  if (foundSegment){
571  gx2Min.SetX(foundSegment->y0());
572  gx2Min.SetY(foundSegment->tanTheta());
573  gx2Min.Draw();
574  }
575 
576  std::stringstream legendLabel{};
577  legendLabel<<"Method "<<label<<" Evt "<<ctx.evt()<<" station: "<<m_idHelperSvc->mdtIdHelper().stationNameString(refChamber->stationName());
578  legendLabel<<"eta: "<<refChamber->stationEta()<<", phi: "<<refChamber->stationPhi();
579  legendLabel<<", found maximum: "<<( foundMax ? "si" : "no");
580 
581 
582  TLatex tl( 0.15,0.8,legendLabel.str().c_str());
583  tl.SetNDC();
584  tl.SetTextFont(53);
585  tl.SetTextSize(18);
586  tl.Draw();
587  static std::atomic<unsigned int> pdfCounter{0};
588  std::stringstream pdfName{};
589  pdfName<<"Chi2_Eta_"<<label<<"_"<<ctx.evt()<<"_"<<(++pdfCounter)
590  <<m_idHelperSvc->mdtIdHelper().stationNameString(refChamber->stationName())<<"_"
591  <<refChamber->stationEta()<<"_"<<refChamber->stationPhi()<<".pdf";
592 
593  std::cout << "try to save "<<pdfName.str()<<", this might go poof"<<std::endl;
594  myCanvas.SaveAs(pdfName.str().c_str());
595  myCanvas.SaveAs(m_allCanName.value().c_str());
596  // primitives.clear();
597  hChi2.Reset();
598  myCanvas.Clear();
599  TH2D hChi3("chi3","chi2;x0;tan(phi)",500,true_x0 - 200,true_x0 + 200 , 500,true_tanPhi - 0.3,true_tanPhi + 0.3);
604  for (int bx =1 ; bx < hChi3.GetXaxis()->GetNbins()+1; ++bx){
605  for (int by =1 ; by < hChi3.GetYaxis()->GetNbins()+1; ++by){
606  double y = hChi3.GetXaxis()->GetBinCenter(bx);
607  double t = hChi3.GetYaxis()->GetBinCenter(by);
610  hChi3.Fill(y,t,MuonR4::SegmentFitHelpers::segmentChiSquare(pars.data(),foundMax->getHitsInMax(),chi2PerLayer));
611  }
612  }
613  mbin = hChi3.GetMinimumBin(mx, my, mz);
614  minChi2 = hChi3.GetBinContent(mbin);
615  ygx2 = hChi3.GetXaxis()->GetBinCenter(mx);
616  tgx2 = hChi3.GetYaxis()->GetBinCenter(my);
617  myCanvas.SetLogz();
618  hChi3.SetMinimum(1.e-1);
619  hChi3.GetXaxis()->SetTitle("x0[mm]");
620  hChi3.GetYaxis()->SetTitle("tan #Phi");
621  hChi3.SetContour(100000);
622  hChi3.Draw("COLZ");
623  hClone.reset (dynamic_cast<TH2D*>(hChi3.Clone("leeeeeak")));
624  hClone->SetContour(5, contourLevels.data());
625  hClone->SetFillStyle(0);
626  hClone->Draw("CONT2SAME");
627 
628  TMarker mark2(true_x0, true_tanPhi, kFullDotLarge);
629  mark2.SetMarkerColor(kAzure+10);
630  mark2.SetMarkerSize(1);
631  mark2.Draw();
632 
633 
634  TMarker houghMin2(foundMax->interceptX(), foundMax->tanPhi(), kOpenSquare);
635  houghMin2.SetMarkerColor(kOrange-3);
636  houghMin2.SetMarkerSize(1);
637  houghMin2.Draw();
638 
639 
640  TMarker th2min2(ygx2, tgx2, kOpenDiamond);
641  th2min2.SetMarkerColor(kGray+1);
642  th2min2.SetMarkerSize(1);
643  th2min2.Draw();
644  TMarker gx2Min2(-99999,-9999999, kFullDiamond);
645  gx2Min2.SetMarkerColor(kRed+1);
646  gx2Min2.SetMarkerSize(1);
647  if (foundSegment){
648  gx2Min2.SetX(foundSegment->x0());
649  gx2Min2.SetY(foundSegment->tanPhi());
650  gx2Min2.Draw();
651  }
652 
653  std::stringstream legendLabel2{};
654  legendLabel2<<"Method "<<label<<" Evt "<<ctx.evt()<<" station: "<<m_idHelperSvc->mdtIdHelper().stationNameString(refChamber->stationName());
655  legendLabel2<<"eta: "<<refChamber->stationEta()<<", phi: "<<refChamber->stationPhi();
656  legendLabel2<<", found maximum: "<<( foundMax ? "si" : "no");
657 
658 
659  TLatex tl2( 0.15,0.8,legendLabel2.str().c_str());
660  tl2.SetNDC();
661  tl2.SetTextFont(53);
662  tl2.SetTextSize(18);
663  tl2.Draw();
664  std::stringstream pdfName2{};
665  pdfName2<<"Chi2_Phi_"<<label<<"_"<<ctx.evt()<<"_"<<(++pdfCounter)
666  <<m_idHelperSvc->mdtIdHelper().stationNameString(refChamber->stationName())<<"_"
667  <<refChamber->stationEta()<<"_"<<refChamber->stationPhi()<<".pdf";
668 
669  std::cout << "try to save "<<pdfName2.str()<<", this might go poof"<<std::endl;
670  myCanvas.SaveAs(pdfName2.str().c_str());
671  myCanvas.SaveAs(m_allCanName.value().c_str());
672 
673 
674  return StatusCode::SUCCESS;
675 
676  }
677 
678 } // namespace MuonValR4
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
Identifier::value_type
IDENTIFIER_TYPE value_type
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:39
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
MuonValR4::MuonHoughTransformTester::m_out_max_nEtaHits
MuonVal::ScalarBranch< unsigned int > & m_out_max_nEtaHits
Definition: MuonHoughTransformTester.h:107
TH2D::GetBinContent
double GetBinContent(int) const
Definition: rootspy.cxx:435
xAOD::MuonSimHit_v1
Definition: MuonSimHit_v1.h:18
MuonValR4::MuonHoughTransformTester::m_max_stgcHitErrorY
MuonVal::VectorBranch< float > & m_max_stgcHitErrorY
Definition: MuonHoughTransformTester.h:140
ymin
double ymin
Definition: listroot.cxx:63
MuonVal::MdtIdentifierBranch::push_back
void push_back(const Identifier &id) override final
Definition: IdentifierBranch.cxx:24
MuonValR4::MuonHoughTransformTester::m_out_gen_nRPCHits
MuonVal::ScalarBranch< unsigned int > & m_out_gen_nRPCHits
Definition: MuonHoughTransformTester.h:89
MuonValR4::MuonHoughTransformTester::m_out_max_nMm
MuonVal::ScalarBranch< unsigned int > & m_out_max_nMm
Definition: MuonHoughTransformTester.h:113
MuonValR4::MuonHoughTransformTester::finalize
virtual StatusCode finalize() override
Definition: MuonHoughTransformTester.cxx:50
MuonValR4::MuonHoughTransformTester::m_out_stationPhi
MuonVal::ScalarBranch< int > & m_out_stationPhi
Definition: MuonHoughTransformTester.h:84
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
MuonGMR4::MuonChamber::stationEta
int stationEta() const
Returns the station eta of the chamber.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonChamber.cxx:65
max
#define max(a, b)
Definition: cfImp.cxx:41
MuonValR4::MuonHoughTransformTester::m_out_max_nsTgc
MuonVal::ScalarBranch< unsigned int > & m_out_max_nsTgc
Definition: MuonHoughTransformTester.h:112
xAOD::MuonSimHit_v1::identify
Identifier identify() const
Returns the global ATLAS identifier of the SimHit.
Definition: xAODMuonSimHit_V1.cxx:42
MuonGMR4::MuonChamber::stationName
int stationName() const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonChamber.cxx:63
fitman.my
my
Definition: fitman.py:523
ID
std::vector< Identifier > ID
Definition: CalibHitIDCheck.h:24
MuonVal::MuonTesterTree::init
StatusCode init(OWNER *instance)
Initialize method.
MuonValR4::MuonHoughTransformTester::m_max_stgcHitErrorX
MuonVal::VectorBranch< float > & m_max_stgcHitErrorX
Definition: MuonHoughTransformTester.h:139
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
MuonValR4::MuonHoughTransformTester::m_out_gen_z0
MuonVal::ScalarBranch< float > & m_out_gen_z0
Definition: MuonHoughTransformTester.h:96
MuonValR4::MuonHoughTransformTester::m_max_driftCirclRadius
MuonVal::VectorBranch< float > & m_max_driftCirclRadius
Definition: MuonHoughTransformTester.h:117
MuonR4::MuonSegmentFitterEventData_impl::parameterIndices::tanTheta
@ tanTheta
MuonValR4::MuonHoughTransformTester::m_max_MmHitErrorX
MuonVal::VectorBranch< float > & m_max_MmHitErrorX
Definition: MuonHoughTransformTester.h:145
MuonValR4::MuonHoughTransformTester::m_out_gen_x0
MuonVal::ScalarBranch< float > & m_out_gen_x0
Definition: MuonHoughTransformTester.h:98
MuonR4::SegmentFitHelpers::segmentChiSquare
double segmentChiSquare(const double *par, const std::vector< MuonR4::HoughHitType > &hits, std::vector< double > &chi2PerMeas)
Definition: SegmentFitHelperFunctions.cxx:24
calibdata.chamber
chamber
Definition: calibdata.py:32
PixelAthClusterMonAlgCfg.zmin
zmin
Definition: PixelAthClusterMonAlgCfg.py:176
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
MuonR4::MuonSegment::x0
double x0() const
Definition: MuonSpectrometer/MuonPhaseII/MuonPatternRecognition/MuonPatternEvent/MuonPatternEvent/MuonSegment.h:40
MuonValR4::MuonHoughTransformTester::m_max_rpcHitPos
MuonVal::ThreeVectorBranch m_max_rpcHitPos
Definition: MuonHoughTransformTester.h:125
MuonR4::HoughHitType
std::shared_ptr< MuonR4::MuonSpacePoint > HoughHitType
Definition: MuonHoughDefs.h:20
MuonR4::StationHoughSegmentSeedContainer
std::set< StationHoughSegmentSeeds > StationHoughSegmentSeedContainer
Definition: StationHoughMaxContainer.h:13
MuonValR4::MuonHoughTransformTester::m_out_max_nHits
MuonVal::ScalarBranch< unsigned int > & m_out_max_nHits
Definition: MuonHoughTransformTester.h:106
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
MuonValR4::MuonHoughTransformTester::m_max_tgcHitId
MuonVal::TgcIdentifierBranch m_max_tgcHitId
Definition: MuonHoughTransformTester.h:130
MuonValR4::MuonHoughTransformTester::m_out_gen_tantheta
MuonVal::ScalarBranch< float > & m_out_gen_tantheta
Definition: MuonHoughTransformTester.h:95
MuonR4::MuonSegment
Placeholder for what will later be the muon segment EDM representation.
Definition: MuonSpectrometer/MuonPhaseII/MuonPatternRecognition/MuonPatternEvent/MuonPatternEvent/MuonSegment.h:18
MuonR4::HoughMaximum_impl::tanTheta
double tanTheta() const
getter
Definition: HoughMaximum.h:31
MuonR4::HoughMaximum_impl::interceptY
double interceptY() const
getter
Definition: HoughMaximum.h:35
MuonValR4::MuonHoughTransformTester::m_out_max_nRpc
MuonVal::ScalarBranch< unsigned int > & m_out_max_nRpc
Definition: MuonHoughTransformTester.h:110
xAOD::UncalibMeasType::MMClusterType
@ MMClusterType
MuonGMR4::MuonReadoutElement
The MuonReadoutElement is an abstract class representing the geometry representing the muon detector.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonReadoutElement.h:38
HoughHelperFunctions.h
MuonVal::sTgcIdentifierBranch::push_back
void push_back(const Identifier &id) override final
Definition: IdentifierBranch.cxx:79
MuonValR4::MuonHoughTransformTester::m_out_segment_tantheta
MuonVal::ScalarBranch< float > & m_out_segment_tantheta
Definition: MuonHoughTransformTester.h:151
MuonValR4::MuonHoughTransformTester::m_drawEvtDisplaySuccess
Gaudi::Property< bool > m_drawEvtDisplaySuccess
Draw the event dispalty for the successful cases.
Definition: MuonHoughTransformTester.h:160
MuonVal::RpcIdentifierBranch::push_back
void push_back(const Identifier &id) override final
Definition: IdentifierBranch.cxx:36
MuonR4::MuonSegmentFitterEventData_impl::parameterIndices::y0
@ y0
MuonValR4::MuonHoughTransformTester::toChamberTrf
Amg::Transform3D toChamberTrf(const ActsGeometryContext &gctx, const Identifier &hitId) const
Definition: MuonHoughTransformTester.cxx:56
MuonValR4::MuonHoughTransformTester::m_max_MmHitIsStero
MuonVal::VectorBranch< bool > & m_max_MmHitIsStero
Definition: MuonHoughTransformTester.h:144
fitman.mx
mx
Definition: fitman.py:520
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
ActsTrk::IDetectorElement::detectorType
virtual DetectorType detectorType() const =0
Returns the detector element type.
EventInfoBranch.h
MuonVal::MmIdentifierBranch::push_back
void push_back(const Identifier &id) override final
Definition: IdentifierBranch.cxx:93
MuonGMR4::MuonReadoutElement::layerHash
virtual IdentifierHash layerHash(const Identifier &measId) const =0
MuonR4::MuonSegment::tanTheta
double tanTheta() const
Definition: MuonSpectrometer/MuonPhaseII/MuonPatternRecognition/MuonPatternEvent/MuonPatternEvent/MuonSegment.h:42
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
MuonGMR4::MuonChamber
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonChamber.h:39
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
xAOD::UncalibMeasType::sTgcStripType
@ sTgcStripType
dumpFileToPlots.pdfName
string pdfName
Definition: dumpFileToPlots.py:21
MuonValR4::MuonHoughTransformTester::dumpUnMatched
StatusCode dumpUnMatched(const EventContext &ctx, const MuonR4::StationHoughSegmentSeedContainer &seedContainer, const std::set< const MuonR4::HoughSegmentSeed * > &matchedSeeds)
Definition: MuonHoughTransformTester.cxx:322
MuonValR4::MuonHoughTransformTester::m_out_max_x0
MuonVal::ScalarBranch< float > & m_out_max_x0
Definition: MuonHoughTransformTester.h:104
MuonValR4::MuonHoughTransformTester::m_out_segment_z0
MuonVal::ScalarBranch< float > & m_out_segment_z0
Definition: MuonHoughTransformTester.h:152
TrigVSI::AlgConsts::nPhi
constexpr int nPhi
Default bin number of phi for vertex map.
Definition: Trigger/TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Constants.h:27
MuonValR4::MuonHoughTransformTester::m_out_max_tanphi
MuonVal::ScalarBranch< float > & m_out_max_tanphi
Definition: MuonHoughTransformTester.h:103
ReadCondHandle.h
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
MuonValR4::MuonHoughTransformTester::m_out_stationEta
MuonVal::ScalarBranch< int > & m_out_stationEta
Definition: MuonHoughTransformTester.h:83
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
xAOD::UncalibMeasType::TgcStripType
@ TgcStripType
MuonValR4::MuonHoughTransformTester::m_tree
MuonVal::MuonTesterTree m_tree
Definition: MuonHoughTransformTester.h:81
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:269
MuonValR4::MuonHoughTransformTester::m_drawEvtDisplayFailure
Gaudi::Property< bool > m_drawEvtDisplayFailure
Draw the event display for the cases where the hough transform did not find any hough maximum.
Definition: MuonHoughTransformTester.h:158
MuonValR4::MuonHoughTransformTester::m_max_tgcHitPos
MuonVal::ThreeVectorBranch m_max_tgcHitPos
Definition: MuonHoughTransformTester.h:131
MuonVal::ThreeVectorBranch::push_back
void push_back(const Amg::Vector3D &vec)
interface using the Amg::Vector3D
Definition: ThreeVectorBranch.cxx:23
MuonValR4::MuonHoughTransformTester::m_spacePointKey
SG::ReadHandleKey< MuonR4::MuonSpacePointContainer > m_spacePointKey
Definition: MuonHoughTransformTester.h:71
MuonR4::MuonSegmentFitterEventData_impl::parameterIndices::tanPhi
@ tanPhi
MuonValR4::MuonHoughTransformTester::m_out_hasMax
MuonVal::ScalarBranch< bool > & m_out_hasMax
Definition: MuonHoughTransformTester.h:99
MuonValR4::MuonHoughTransformTester::m_out_max_nMdt
MuonVal::ScalarBranch< unsigned int > & m_out_max_nMdt
Definition: MuonHoughTransformTester.h:109
MuonValR4::MuonHoughTransformTester::m_max_MmHitPos
MuonVal::ThreeVectorBranch m_max_MmHitPos
Definition: MuonHoughTransformTester.h:143
MuonVal::TgcIdentifierBranch::push_back
void push_back(const Identifier &id) override final
Definition: IdentifierBranch.cxx:66
MuonR4::MuonSegment::y0
double y0() const
Definition: MuonSpectrometer/MuonPhaseII/MuonPatternRecognition/MuonPatternEvent/MuonPatternEvent/MuonSegment.h:41
xAOD::UncalibratedMeasurement_v1
Definition: UncalibratedMeasurement_v1.h:13
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
MuonValR4::MuonHoughTransformTester::m_out_gen_nMDTHits
MuonVal::ScalarBranch< unsigned int > & m_out_gen_nMDTHits
Definition: MuonHoughTransformTester.h:90
xAOD::UncalibratedMeasurement_v1::type
virtual xAOD::UncalibMeasType type() const =0
Returns the type of the measurement type as a simple enumeration.
MuonValR4::MuonHoughTransformTester::m_max_stgcHitHasPhiMeas
MuonVal::VectorBranch< bool > & m_max_stgcHitHasPhiMeas
Definition: MuonHoughTransformTester.h:138
MuonValR4::MuonHoughTransformTester::m_out_max_z0
MuonVal::ScalarBranch< float > & m_out_max_z0
Definition: MuonHoughTransformTester.h:102
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
MuonR4::StationHoughResults
Small data class to collect the hough maxima for one given station.
Definition: StationHoughMaxima.h:18
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
extractSporadic.h
list h
Definition: extractSporadic.py:97
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
SegmentFitHelperFunctions.h
fitman.bx
bx
Definition: fitman.py:410
LArG4ShowerLibProcessing.hits
hits
Definition: LArG4ShowerLibProcessing.py:136
MuonValR4::MuonHoughTransformTester::m_max_stgcHitPos
MuonVal::ThreeVectorBranch m_max_stgcHitPos
Definition: MuonHoughTransformTester.h:137
MuonValR4::MuonHoughTransformTester::m_out_gen_tanphi
MuonVal::ScalarBranch< float > & m_out_gen_tanphi
Definition: MuonHoughTransformTester.h:97
fitman.mz
mz
Definition: fitman.py:526
MuonValR4::MuonHoughTransformTester::m_max_rpcHitErrorY
MuonVal::VectorBranch< float > & m_max_rpcHitErrorY
Definition: MuonHoughTransformTester.h:128
MuonValR4::MuonHoughTransformTester::m_max_driftCircleTubePos
MuonVal::ThreeVectorBranch m_max_driftCircleTubePos
Definition: MuonHoughTransformTester.h:118
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
MuonValR4::MuonHoughTransformTester::m_inSimHitKeys
SG::ReadHandleKeyArray< xAOD::MuonSimHitContainer > m_inSimHitKeys
Definition: MuonHoughTransformTester.h:67
MuonValR4::MuonHoughTransformTester::m_max_driftCircleId
MuonVal::MdtIdentifierBranch m_max_driftCircleId
Dump of the Mdt hits on maximum.
Definition: MuonHoughTransformTester.h:116
MuonValR4::MuonHoughTransformTester::fillMaximum
void fillMaximum(const MuonR4::HoughSegmentSeed *foundMax)
Definition: MuonHoughTransformTester.cxx:254
MuonValR4::MuonHoughTransformTester::m_out_max_tantheta
MuonVal::ScalarBranch< float > & m_out_max_tantheta
Definition: MuonHoughTransformTester.h:101
MuonValR4::MuonHoughTransformTester::m_max_stgcHitId
MuonVal::sTgcIdentifierBranch m_max_stgcHitId
Definition: MuonHoughTransformTester.h:136
PixelAthClusterMonAlgCfg.zmax
zmax
Definition: PixelAthClusterMonAlgCfg.py:176
MuonGMR4::MuonReadoutElement::getChamber
const MuonChamber * getChamber() const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:142
MuonChamber.h
MuonValR4::MuonHoughTransformTester::m_allCanName
Gaudi::Property< std::string > m_allCanName
Definition: MuonHoughTransformTester.h:163
MuonValR4::MuonHoughTransformTester::m_max_driftCircleDriftUncert
MuonVal::VectorBranch< float > & m_max_driftCircleDriftUncert
Definition: MuonHoughTransformTester.h:119
xAOD::MuonSimHit_v1::localDirection
ConstVectorMap< 3 > localDirection() const
Returns the local direction of the traversing particle.
Definition: xAODMuonSimHit_V1.cxx:65
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MuonValR4::MuonHoughTransformTester::m_max_rpcHitErrorX
MuonVal::VectorBranch< float > & m_max_rpcHitErrorX
Definition: MuonHoughTransformTester.h:127
MuonValR4::MuonHoughTransformTester::m_out_max_hasPhiExtension
MuonVal::ScalarBranch< bool > & m_out_max_hasPhiExtension
Definition: MuonHoughTransformTester.h:100
fitman.by
by
Definition: fitman.py:411
MuonValR4::MuonHoughTransformTester::drawEventDisplay
StatusCode drawEventDisplay(const EventContext &ctx, const std::vector< const xAOD::MuonSimHit * > &simHits, const MuonR4::HoughSegmentSeed *foundMax) const
Definition: MuonHoughTransformTester.cxx:350
TH2D
Definition: rootspy.cxx:430
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
TRT::Track::z0
@ z0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:63
MuonValR4::MuonHoughTransformTester::m_out_gen_nHits
MuonVal::ScalarBranch< unsigned int > & m_out_gen_nHits
Definition: MuonHoughTransformTester.h:88
MuonValR4::MuonHoughTransformTester::m_r4DetMgr
const MuonGMR4::MuonDetectorManager * m_r4DetMgr
Definition: MuonHoughTransformTester.h:76
MuonGMR4::MuonDetectorManager::getChamber
const MuonChamber * getChamber(const Identifier &channelId) const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorManager.cxx:146
MuonValR4::MuonHoughTransformTester::m_max_driftCircleTubeLength
MuonVal::VectorBranch< float > & m_max_driftCircleTubeLength
Definition: MuonHoughTransformTester.h:120
AthHistogramAlgorithm
Definition: AthHistogramAlgorithm.h:32
fcn
void fcn(int &, double *, double &result, double par[], int)
this is where we write out chi2
Definition: Chi2LJets.cxx:183
MuonGMR4::MuonChamber::stationPhi
int stationPhi() const
Returns the station phi of the chamber.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonChamber.cxx:64
ActsGeometryContext
Include the GeoPrimitives which need to be put first.
Definition: ActsGeometryContext.h:28
MuonValR4::MuonHoughTransformTester::m_out_max_nTgc
MuonVal::ScalarBranch< unsigned int > & m_out_max_nTgc
Definition: MuonHoughTransformTester.h:111
MuonValR4::MuonHoughTransformTester::m_out_gen_nTGCHits
MuonVal::ScalarBranch< unsigned int > & m_out_gen_nTGCHits
Definition: MuonHoughTransformTester.h:91
MuonValR4::MuonHoughTransformTester::m_out_segment_x0
MuonVal::ScalarBranch< float > & m_out_segment_x0
Definition: MuonHoughTransformTester.h:154
MuonR4::HoughSegmentSeed_impl::hasPhiExtension
bool hasPhiExtension() const
check whether the segment seed includes a valid phi extension
Definition: HoughSegmentSeed.h:51
MuonVal::VectorBranch::push_back
void push_back(const T &value)
Adds a new element at the end of the vector.
min
#define min(a, b)
Definition: cfImp.cxx:40
MuonValR4::MuonHoughTransformTester::m_out_gen_Eta
MuonVal::ScalarBranch< float > & m_out_gen_Eta
Definition: MuonHoughTransformTester.h:85
MuonValR4
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
Definition: MDTFastDigiTester.cxx:8
MuonValR4::MuonHoughTransformTester::m_out_gen_nMMits
MuonVal::ScalarBranch< unsigned int > & m_out_gen_nMMits
Definition: MuonHoughTransformTester.h:93
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
MuonHoughDefs.h
ActsTrk::DetectorType::Mdt
@ Mdt
MuonSpectrometer.
MuonR4::MuonSegmentFitterEventData_impl::parameterIndices::x0
@ x0
MuonValR4::MuonHoughTransformTester::m_geoCtxKey
SG::ReadHandleKey< ActsGeometryContext > m_geoCtxKey
Definition: MuonHoughTransformTester.h:73
MuonR4::MuonSegment::tanPhi
double tanPhi() const
Definition: MuonSpectrometer/MuonPhaseII/MuonPatternRecognition/MuonPatternEvent/MuonPatternEvent/MuonSegment.h:43
MuonValR4::MuonHoughTransformTester::m_out_gen_Phi
MuonVal::ScalarBranch< float > & m_out_gen_Phi
Definition: MuonHoughTransformTester.h:86
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
compileRPVLLRates.c2
c2
Definition: compileRPVLLRates.py:361
MuonR4::MuonSegment::chi2
double chi2() const
Definition: MuonSpectrometer/MuonPhaseII/MuonPatternRecognition/MuonPatternEvent/MuonPatternEvent/MuonSegment.h:39
MuonValR4::MuonHoughTransformTester::m_max_MmHitErrorY
MuonVal::VectorBranch< float > & m_max_MmHitErrorY
Definition: MuonHoughTransformTester.h:146
MuonR4::HoughSegmentSeed_impl::tanPhi
double tanPhi() const
getter
Definition: HoughSegmentSeed.h:41
MuonR4::MuonSegment::chi2PerMeasurement
std::vector< double > chi2PerMeasurement() const
Definition: MuonSpectrometer/MuonPhaseII/MuonPatternRecognition/MuonPatternEvent/MuonPatternEvent/MuonSegment.h:45
MuonValR4::evalX2
double evalX2(const double *pars, std::function< double(double, double, const ActsGeometryContext &, const std::vector< const xAOD::MuonSimHit * > &, const MuonR4::HoughSegmentSeed *)> fcn, const ActsGeometryContext &gctx, const std::vector< const xAOD::MuonSimHit * > &simHits, const MuonR4::HoughSegmentSeed *seed)
Definition: MuonHoughTransformTester.cxx:492
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonValR4::MuonHoughTransformTester::m_out_max_nPhiHits
MuonVal::ScalarBranch< unsigned int > & m_out_max_nPhiHits
Definition: MuonHoughTransformTester.h:108
MuonValR4::MuonHoughTransformTester::initialize
virtual StatusCode initialize() override
Definition: MuonHoughTransformTester.cxx:32
MuonValR4::MuonHoughTransformTester::MuonHoughTransformTester
MuonHoughTransformTester(const std::string &name, ISvcLocator *pSvcLocator)
Definition: MuonHoughTransformTester.cxx:27
MuonValR4::MuonHoughTransformTester::execute
virtual StatusCode execute() override
Definition: MuonHoughTransformTester.cxx:67
MuonValR4::MuonHoughTransformTester::m_inSegmentKey
SG::ReadHandleKey< MuonR4::MuonSegmentContainer > m_inSegmentKey
Definition: MuonHoughTransformTester.h:70
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
y
#define y
MuonValR4::MuonHoughTransformTester::m_allCan
std::unique_ptr< TCanvas > m_allCan
Definition: MuonHoughTransformTester.h:162
h
Identifier::get_compact
value_type get_compact(void) const
Get the compact id.
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
MuonValR4::MuonHoughTransformTester::m_max_MmHitId
MuonVal::MmIdentifierBranch m_max_MmHitId
Definition: MuonHoughTransformTester.h:142
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
MuonVal::ScalarBranch::getVariable
const T & getVariable() const
MuonValR4::MuonHoughTransformTester::m_out_gen_Pt
MuonVal::ScalarBranch< float > & m_out_gen_Pt
Definition: MuonHoughTransformTester.h:87
MuonValR4::MuonHoughTransformTester::m_max_tgcHitErrorX
MuonVal::VectorBranch< float > & m_max_tgcHitErrorX
Definition: MuonHoughTransformTester.h:133
MuonGMR4::MuonReadoutElement::measurementHash
virtual IdentifierHash measurementHash(const Identifier &measId) const =0
Constructs the identifier hash from the full measurement Identifier.
xAOD::MuonSimHit_v1::localPosition
ConstVectorMap< 3 > localPosition() const
Returns the local postion of the traversing particle.
Definition: xAODMuonSimHit_V1.cxx:59
MuonValR4::MuonHoughTransformTester::m_out_segment_tanphi
MuonVal::ScalarBranch< float > & m_out_segment_tanphi
Definition: MuonHoughTransformTester.h:153
MuonValR4::MuonHoughTransformTester::m_max_tgcHitErrorY
MuonVal::VectorBranch< float > & m_max_tgcHitErrorY
Definition: MuonHoughTransformTester.h:134
MuonVal::MuonTesterTree::fill
bool fill(const EventContext &ctx)
Fills the tree per call.
Definition: MuonTesterTree.cxx:89
MuonGMR4::MuonReadoutElement::localToGlobalTrans
const Amg::Transform3D & localToGlobalTrans(const ActsGeometryContext &ctx) const
Returns the local to global transformation into the ATLAS coordinate system.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:76
MuonVal::MuonTesterTree::write
StatusCode write()
Finally write the TTree objects.
Definition: MuonTesterTree.cxx:178
MuonHoughTransformTester.h
SG::VarHandleBase::isPresent
bool isPresent() const
Is the referenced object present in SG?
Definition: StoreGate/src/VarHandleBase.cxx:397
MuonValR4::MuonHoughTransformTester::m_max_rpcHitHasPhiMeas
MuonVal::VectorBranch< bool > & m_max_rpcHitHasPhiMeas
Definition: MuonHoughTransformTester.h:126
MuonValR4::MuonHoughTransformTester::m_max_rpcHitId
MuonVal::RpcIdentifierBranch m_max_rpcHitId
Branches to access the space points in the maximum.
Definition: MuonHoughTransformTester.h:124
dqt_zlumi_alleff_HIST.tl
tl
Definition: dqt_zlumi_alleff_HIST.py:73
MuonR4::HoughMaximum_impl::getHitsInMax
const std::vector< HitType > & getHitsInMax() const
getter
Definition: HoughMaximum.h:41
MuonValR4::MuonHoughTransformTester::m_out_segment_chi2_measurement
MuonVal::VectorBranch< double > & m_out_segment_chi2_measurement
Definition: MuonHoughTransformTester.h:155
MuonValR4::MuonHoughTransformTester::m_inHoughSegmentSeedKey
SG::ReadHandleKey< MuonR4::StationHoughSegmentSeedContainer > m_inHoughSegmentSeedKey
Definition: MuonHoughTransformTester.h:69
MuonValR4::MuonHoughTransformTester::m_out_segment_chi2
MuonVal::ScalarBranch< float > & m_out_segment_chi2
Definition: MuonHoughTransformTester.h:150
IdentifierHash
Definition: IdentifierHash.h:38
MuonValR4::MuonHoughTransformTester::m_out_hasSegment
MuonVal::ScalarBranch< bool > & m_out_hasSegment
Definition: MuonHoughTransformTester.h:149
TrigVSI::AlgConsts::nEta
constexpr int nEta
Default bin number of eta for vertex map.
Definition: Trigger/TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Constants.h:26
MuonR4::HoughSegmentSeed_impl
Representation of a segment seed (a fully processed hough maximum) produced by the hough transform.
Definition: HoughSegmentSeed.h:13
MuonValR4::MuonHoughTransformTester::m_max_tgcHitHasPhiMeas
MuonVal::VectorBranch< bool > & m_max_tgcHitHasPhiMeas
Definition: MuonHoughTransformTester.h:132
MuonValR4::MuonHoughTransformTester::drawChi2
StatusCode drawChi2(const EventContext &ctx, const std::vector< const xAOD::MuonSimHit * > &simHits, const MuonR4::HoughSegmentSeed *foundMax, const MuonR4::MuonSegment *foundSegment, const std::string &label) const
Definition: MuonHoughTransformTester.cxx:496
MuonGMR4::MuonChamber::globalToLocalTrans
Amg::Transform3D globalToLocalTrans(const ActsGeometryContext &gctx) const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonChamber.cxx:71
MuonValR4::MuonHoughTransformTester::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonHoughTransformTester.h:75
xAOD::UncalibMeasType::RpcStripType
@ RpcStripType
xAOD::UncalibMeasType::MdtDriftCircleType
@ MdtDriftCircleType
MuonValR4::MuonHoughTransformTester::m_out_stationName
MuonVal::ScalarBranch< int > & m_out_stationName
Definition: MuonHoughTransformTester.h:82
MuonR4::HoughSegmentSeed_impl::interceptX
double interceptX() const
getter
Definition: HoughSegmentSeed.h:45
MuonValR4::MuonHoughTransformTester::m_out_gen_nsTGCHits
MuonVal::ScalarBranch< unsigned int > & m_out_gen_nsTGCHits
Definition: MuonHoughTransformTester.h:92
NSWL1::PadTriggerAdapter::segment
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
Definition: PadTriggerAdapter.cxx:5
ymax
double ymax
Definition: listroot.cxx:64
MuonVal::MuonTesterTree::addBranch
bool addBranch(std::shared_ptr< IMuonTesterBranch > branch)
Branch is added to the tree without transferring the ownership.
Definition: MuonTesterTree.cxx:61
MuonGMR4::MuonDetectorManager::getReadoutElement
const MuonReadoutElement * getReadoutElement(const Identifier &id) const
Returns a generic Muon readout element.
MuonValR4::MuonHoughTransformTester::m_dumpUnmatchedSeeds
Gaudi::Property< bool > m_dumpUnmatchedSeeds
Definition: MuonHoughTransformTester.h:78