Giter Site home page Giter Site logo

Comments (16)

ryuwd avatar ryuwd commented on September 17, 2024

I'd be happy to work on this - are the relevant modules located in TrkPtRec/, CosmicReco/, and TrkHitReco/ ?

from offline.

brownd1978 avatar brownd1978 commented on September 17, 2024

from offline.

ryuwd avatar ryuwd commented on September 17, 2024

Hi Dave,

OK, I've checked out v7_5_4 and had a look at KalFit, KalFinalFit in my IDE. Compiling it now.

In 7_5_4, it appears that any Tracker object retrieved by GeomHandle is nominal/unaligned, as GeometryService caches a Tracker object made by TrackerMaker, not AlignedTrackerMaker. . Also, for AlignedTrackerMaker to work, it relies on GeomHandle returning a nominal geometry. It doesn't look like it is / should be replaced by the Aligned Tracker at any point in the geometry service (??).

In KalFit.cc TrkStrawHits are given Straw objects from _tracker->getStraw, where Mu2eDetector::strawElem(...)->straw() should be used instead (??).

The KalFit object used in KalFinalFit_module.cc is passed a Tracker object from GeomHandle, which returns a nominal Tracker object (i.e. not modified by AlignedTrackerMaker) So KalFit is creating TrkStrawHits using nominal Straws.

If the ComboHitCollection persisted in the KalFitData struct, used to make TrkStrawHits, is produced by TrkHitReco/StrawHitReco_module, then that is using (nominal) Straw objects from GeomHandle Tracker.

After v7_5_4 finishes compiling I will run the reco job, go through with the debugger as suggested and check this is correct. At first glance I agree TrkStrawHits, ComboHits/ComboHitCollection (in StrawHitReco_module.cc) are made using the nominal geometry

Ryun

from offline.

ryuwd avatar ryuwd commented on September 17, 2024

OK, ran the job through the debugger. I made one small change to Tracker object and added a debug flag called "ALIGNED" set to false by default.
If a Tracker object is returned by AlignedTrackerMaker, ALIGNED is set to true.

I'm guessing that whether alignment constants are provided or not (e.g. by including misalign_epilog.fcl + db text file), the code should be using Tracker objects passing through AlignedTrackerMaker anyway.

Where TrkStrawHit objects are created, the flag is false, so the geometry used is nominal.

Where ComboHits are made in StrawHitReco_module, the flag is also false, so the geom is nominal here too.

I suppose the next step is to refactor KalFit, KalFinalFit, StrawHitReco to use aligned straws? Are combohits produced elsewhere that need to be considered for standard reco?

Best wishes, Ryun

from offline.

kutschke avatar kutschke commented on September 17, 2024

from offline.

ryuwd avatar ryuwd commented on September 17, 2024

Hi Rob,

The change was temporary just for my debugging session to confirm whether the Tracker object used in various locations of the code were modified by the AlignedTrackerMaker or not (i.e. is the geometry used nominal or not). I agree that the Tracker type should be able to represent any geometrical configuration of the tracker (which it already does), so no change required.

AlignedTrackerMaker makes a copy of Tracker provided by GeomHandle and modifies the positions, rotations, etc of tracker elements, then returns a pointer to this Tracker object. This is the configuration that should be used in track PatRec and reco (I believe).

Best wishes, Ryun

from offline.

rlcee avatar rlcee commented on September 17, 2024

I've been replying to the email, but it doesn't seem to be appearing in this comment thread,
so I'm re-entering my text here. If anyone know why my email is disappearing, let me know.

It looks like the connection with the alignment is occurring here
https://github.com/Mu2e/Offline/blob/master/TrkReco/src/KalFit.cc#L363
https://github.com/Mu2e/Offline/blob/master/TrkReco/src/KalFit.cc#L382
It is likely that there are other points where it should also make
contact. I'd say the way I left the code was that the alignment showed
a reasonable response in tracks, and not that every aspect of aligned tracking
was done and tested. So this is an early prototype, an example, and
tracking experts should be looking for problems and places to complete the
installation. I was coming at it from the perspective of installing a Proditions
table, not commissioning tracking.
As I recall, we intentionally did not install it in pattern recognition
as we thought we should establish that it was necessary
before doing that work. But that decision is up to Dave, as far
as I'm concerned.

from offline.

brownd1978 avatar brownd1978 commented on September 17, 2024

from offline.

rlcee avatar rlcee commented on September 17, 2024

but according to your tests it doesn't work.

This was a mis-communication. My statement was that without
your PR, I still saw reasonable response to the alignment - moving 1/2
of the planes 100um causes the chi2 to increase x4. That is the only high-level
testing I did, so it is perfectly possible that your PR is the right thing to do.
I just don't understand how moving the material would cause that change
in the chi2 - maybe another bug? Also, I recall we had agreed to not move
the material. Anyway, I don't think I'm adding anything useful at this point.

from offline.

brownd1978 avatar brownd1978 commented on September 17, 2024

from offline.

ryuwd avatar ryuwd commented on September 17, 2024

Hi All,

Thank you for the helpful input on this.

  • KalSeedFit also uses the nominal geometry (uses GeomHandle<Tracker>::get) in v7_5_4 and master/HEAD. Is this intended? If not that probably needs to be refactored to use Mu2eDetector as well as KalFit and KalFinalFit. If the Seed Fit isn't affected by the test misalignments, could this be keeping the final chi2 lower than expected ? and/or the number of hits kept in the fit higher than expected?

  • A GeometryService GeomHandle will always (as far as I can tell) return a nominal geometry version of the Tracker object, and this is used to make TrkStrawHits and Straw ComboHits in v7_5_4.

  • I confirmed with the debugger that Tracker objects given to Mu2eDetector always pass through AlignedTrackerMaker, either via fromDb or fromFcl, so Mu2eDetector should definitely be used to access aligned Tracker Straw objects as in Dave's PR #76

  • Small thing I noticed, a const_cast in AlignedTrackerMaker. It'd be good to make AlignedTrackerMaker a friend class to Tracker and access non-const straws directly instead to eliminate the possibility that the Straw objects in the Tracker object are not modified correctly for some reason. I should rule this out with the debugger first though with some test misalignments.

  • Also, where in the code are the materials aligned?

  • Lastly, what is used to make the chi2 validation plots (such as in doc-28470?)

Thanks again, Ryun

from offline.

ryuwd avatar ryuwd commented on September 17, 2024

Sorry, I mean doc-24870, not doc-28470.

from offline.

ryuwd avatar ryuwd commented on September 17, 2024

@brownd1978, since the Tracking infrastructure was mostly written to make use of Tracker objects, I think a nice way to fix this is to swap out any use of GeomHandle<Tracker> with ProditionsHandle<Tracker>, where the former only seems to return a nominal geometry Tracker.

This would be nice since then it becomes explicit that alignment constants in Proditions DB tables for the current event are correctly applied to the Tracker object used, and making changes deep in the tracking code isn't required past changing the Tracker instance given to setTracker(...) functions.

I guess it's also important to note that a GeomHandle isn't guaranteed to return a geometry representation that takes into account detector conditions, whereas Proditions does? Is this correct?

Or would it be best to swap out code such that Straw elements are retrieved using detmodel->strawElem(StrawId...)->straw()/Mu2eDetector::strawElem(...) ? as in PR #76 ?

I see three GeomHandle<Tracker> in use in KalFinalFit, KalSeedFit, and StrawHitReco modules (v7_5_4). In master/HEAD, CosmicReco also uses GeomHandle.

Cheers, Ryun

from offline.

rlcee avatar rlcee commented on September 17, 2024

I guess it's also important to note that a GeomHandle isn't guaranteed to return a geometry
representation that takes into account detector conditions, whereas Proditions does? Is this
correct?
The plan is that GeometryHandle will always return the static, nominal geometry. Proditions
will return nominal, test, or run-dependent aligned values depending on it's fcl configuration
and database entries.

from offline.

brownd1978 avatar brownd1978 commented on September 17, 2024

from offline.

ryuwd avatar ryuwd commented on September 17, 2024

Thanks for clarifying this, that has cleared things up for me. Proditions is the way to go then -

An argument was also made to keep GeomHandle for comparisons against default geometry in analysis. I personally find that uncompelling, as default geometry can be obtained from proditions by setting null alignment.

I agree. I would prefer to avoid writing additional code in e.g. Alignment, to compare nominal vs. misaligned (for example), if I can instead change the alignment of the geometry using Proditions, and compare outputs that way.

Alignment with straight cosmic rays will depend on CosmicReco ( and/or straight line kalman ) using Proditions-aligned geom rather than GeomHandle, so that will need to be checked / refactored before I continue using that track data for Millepede or anything like that.

I've made some changes to some of these modules in my fork to make use of Proditions instead, but I'll wait until I properly test (probably will look at residual distributions + debug again) before submitting a PR. Example here: ryuwd@596d8f0?w=1

from offline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.