Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion doc/branches.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,12 @@ Reco files made with the association in Production's reco paths already hold the

```<trk>crv``` has one element per track. The other branches hold, per track, a vector of CRV sector crossings (```crvxings```, with the per-layer probe) or of associated clusters (```crvcands```).
```crvcands.crvcoinc``` is the index of the cluster in ```crvcoincs```; ```crvcandsmc``` and ```crvxingsmc``` are parallel to ```crvcands``` and ```crvxings```. See ```utils/trkcrv_example.py```.
```crvxings.inbounds``` tells the crossings the extrapolation found (true) from projections (false): a straight-line track that crosses no CRV sector is projected onto the extended plane of each sector holding one of its candidates. Use ```inbounds```, not ```nxings > 0```, to select tracks that reach a CRV sector. Candidates from projections run to larger chi2 than those from extrapolated crossings, on which the error model was tuned.

| branch | structure | explanation | leaf information |
|--------|-----------|-------------|------------------|
| trkcrv | Vector branch | track-CRV association summary of one track, from Offline TrkCrvMatch| [see TrkCrvInfo.hh](../inc/TrkCrvInfo.hh)
| trkcrvxings | Vector-of-vector branch | one CRV sector crossing of a track's extrapolation, with the layer probe of that sector| [see TrkCrvXingInfo.hh](../inc/TrkCrvXingInfo.hh)
| trkcrvxings | Vector-of-vector branch | one CRV sector crossing of a track's extrapolation (inbounds), or a projection onto a sector's extended plane for a straight-line track that crosses none, with the layer probe of that sector| [see TrkCrvXingInfo.hh](../inc/TrkCrvXingInfo.hh)
| trkcrvcands | Vector-of-vector branch | one CRV coincidence cluster associated with a track (candidates ordered geometric by chi2, then time-only)| [see TrkCrvCandInfo.hh](../inc/TrkCrvCandInfo.hh)
| trkcrvcandsmc | Vector-of-vector branch | truth of one track-CRV candidate, parallel to <trk>crvcands| [see TrkCrvCandInfoMC.hh](../inc/TrkCrvCandInfoMC.hh)
| trkcrvxingsmc | Vector-of-vector branch | truth of one reco CRV crossing, parallel to <trk>crvxings| [see TrkCrvXingInfoMC.hh](../inc/TrkCrvXingInfoMC.hh)
Expand Down
2 changes: 1 addition & 1 deletion inc/TrkCrvInfo.hh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace mu2e
{
struct TrkCrvInfo {
bool matched = false; // a TrkCrvMatch record exists for this track (false: the other leaves are defaults)
int nxings = 0; // CRV sector crossings of the track's extrapolation (entries of <trk>crvxings)
int nxings = 0; // entries of <trk>crvxings: the extrapolation's CRV crossings, or projections (inbounds false) for a line track with none
int ncands = 0; // associated CRV coincidence clusters (entries of <trk>crvcands)
int ngeom = 0; // candidates kept by the geometric test
int bestgeom = -1; // index into <trk>crvcands of the lowest-chi2 geometric candidate, -1 if none
Expand Down
2 changes: 1 addition & 1 deletion inc/TrkCrvTrueXingInfoMC.hh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace mu2e
XYZVectorF deppos; // energy-weighted position of those deposits, detector frame (mm)
int crvcoinc = -1; // index into crvcoincs of the cluster with most energy from the particle in this sector, -1 if none or not in that collection
int cand = -1; // index into <trk>crvcands of that cluster, -1 if it is not a candidate
int recoxing = -1; // index into <trk>crvxings of the reco crossing of this sector, -1 if not extrapolated there
int recoxing = -1; // index into <trk>crvxings of the reco crossing of this sector (a projection if not inbounds), -1 if none

void reset() { *this = TrkCrvTrueXingInfoMC(); }
};
Expand Down
5 changes: 3 additions & 2 deletions inc/TrkCrvXingInfo.hh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// TrkCrvXingInfo: one CRV sector crossing of a track's extrapolation, with the layer probe of that sector
// TrkCrvXingInfo: one CRV sector crossing of a track's extrapolation, or, for a straight-line track that crosses no
// sector, its projection onto a sector's extended plane (inbounds false); with the layer probe of that sector
//
#ifndef TrkCrvXingInfo_HH
#define TrkCrvXingInfo_HH
Expand All @@ -22,7 +23,7 @@ namespace mu2e
float sigt = 0; // track time error (ns)
float mom = 0; // track momentum at the crossing (MeV/c)
float momerr = 0; // its error (MeV/c)
bool inbounds = false; // crossing inside the sector rectangle
bool inbounds = false; // crossing inside the sector rectangle (found by the extrapolation); false: a projection, whose candidates run to larger chi2
float dedgeu = 0; // distance inside the sector edge along the bars (mm), negative outside
float dedgev = 0; // distance inside the sector edge across the bars (mm), negative outside
float edgesig = 0; // edge distance in units of the track error
Expand Down
16 changes: 9 additions & 7 deletions utils/trkcrv_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

For a track branch <trk> (e.g. "trk") configured with trkCrvMatchTags, the ntuple holds, per track:
<trk>crv one TrkCrvInfo: counts, bestgeom / besttime indices into <trk>crvcands, reference times
<trk>crvxings TrkCrvXingInfo per CRV sector crossing of the extrapolation, with the 4-layer probe
<trk>crvxings TrkCrvXingInfo per CRV sector crossing of the extrapolation (inbounds), or, for a straight-line track
that crosses no sector, per projection onto a sector's extended plane (not inbounds), with the 4-layer probe
<trk>crvcands TrkCrvCandInfo per associated CRV cluster: residuals, chi2, flags, and crvcoinc, the index into crvcoincs
and, with MC, <trk>crvcandsmc (parallel to crvcands), <trk>crvxingsmc (parallel to crvxings) and <trk>crvtruexingsmc.

Expand Down Expand Up @@ -80,11 +81,12 @@ def main():
matched = leaf(a, crv, "matched")
bestgeom = leaf(a, crv, "bestgeom")
ntracks = int(ak.sum(ak.num(matched, axis=1)))
nxing = leaf(a, crv, "nxings")
has_xing = nxing > 0
inbounds = leaf(a, xings, "inbounds") # [event][track][xing]
has_xing = ak.any(inbounds, axis=2) # crosses a CRV sector (not nxings > 0: projections)
has_proj = ak.any(~inbounds, axis=2) # a line track that crosses none, projected
has_geom = bestgeom >= 0
print("tracks %d, with a TrkCrvMatch record %d, crossing the CRV %d, with a geometric candidate %d"
% (ntracks, ak.sum(matched), ak.sum(has_xing), ak.sum(has_geom)))
print("tracks %d, with a TrkCrvMatch record %d, crossing the CRV %d, projected only %d, with a geometric candidate %d"
% (ntracks, ak.sum(matched), ak.sum(has_xing), ak.sum(has_proj), ak.sum(has_geom)))
best_dv = pick(leaf(a, cands, "dv"), bestgeom)
best_dtxing = pick(leaf(a, cands, "dtxing"), bestgeom)
best_chi2 = pick(leaf(a, cands, "chi2"), bestgeom)
Expand Down Expand Up @@ -125,8 +127,8 @@ def main():
print("tracks with a time candidate at 0 < dtref < 150 ns: %d" % ak.sum(in_window))

# --- 4. layer probe -------------------------------------------------------------------------------------------
pbar = leaf(a, xings, "probe_bar") # [event][track][xing][layer]
pdbar = leaf(a, xings, "probe_dbar")
pbar = leaf(a, xings, "probe_bar")[inbounds] # [event][track][xing][layer], crossed sectors only
pdbar = leaf(a, xings, "probe_dbar")[inbounds]
predicted = pbar >= 0
found = predicted & (pdbar != 127)
pred_per_layer = np.array([ak.sum(predicted[..., L]) for L in range(4)])
Expand Down