Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major upgrade of TofEstimators with new track length calculation and bug fixes #96

Merged
merged 22 commits into from
Nov 5, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Finalize documentation v2.0
dudarboh committed Nov 4, 2021
commit b169a093e125335defbff584122139f28b435839
21 changes: 15 additions & 6 deletions TimeOfFlight/README.md
Original file line number Diff line number Diff line change
@@ -8,12 +8,16 @@ In case reader uses dark theme on the github and finds hard to read the formulas

# Requirements

TOFEstimators is dependent on InitDD4hep processor to extract detector geometry details. <br>
Make sure to run InitDD4hep before this processor is executed.
TOFEstimators is currently working with only simple cases of particle flow objects.<br>
The analyzed *ReconstructedParticle* object must have **exactly one** associated `Track` and **exactly one** associated `Cluster`.<br>
In other cases it still produces PIDHandler, but with `0.0` for every output parameter.

In addition, input sclio file must contain a lot of various tracker and calorimeter hit collections.<br>
The input sclio file must contain a lot of various tracker and calorimeter hit collections.<br>
Thus, input slcio file can be e.g. *REC* format, but **cannot** be *DST* or *mini-DST* format.

TOFEstimators is dependent on InitDD4hep processor to extract detector geometry details. <br>
Make sure to run InitDD4hep before this processor is executed.

# Steering parameters

There are five steering parameters:
@@ -36,12 +40,17 @@ There are five steering parameters:
If *ExtrapolateToEcal* is set to `true` then it defines how to use ECal hits to calculate the time-of-flight at the ECal surface.

- `"closest"` uses the closest ECal hit to the extrapolated track position at the ECal surface.<br>
Time-of-flight is defined as: <img src="https://render.githubusercontent.com/render/math?math=\mathrm{TOF} = t_{\mathrm{closest}} - \frac{\left| \vec{r}_{\mathrm{track}} - \vec{r}_{\mathrm{closest}} \right|}{c}">
Time-of-flight is defined as: <img src="https://render.githubusercontent.com/render/math?math=\mathrm{TOF} = t_{\mathrm{closest}} - \frac{\left| \vec{r}_{\mathrm{track}} - \vec{r}_{\mathrm{closest}} \right|}{c}"> <br>
If no ECal hits are found returns `0.0`.

- `"frankAvg"` Select the closest ECal hit to the linearly extrapolated track line inside the ECal in each of the first *MaxEcalLayer* ECal layers. Define time-of-flight as an average of their time corrected for the distance to the track position at the ECal surface assuming speed of flight is the speed of light.
<img src="https://render.githubusercontent.com/render/math?math=\mathrm{TOF} = \frac{1}{\mathrm{MaxEcalLayer}}\sum_{i}^{\mathrm{MaxEcalLayer}} \left( t_{i} - \frac{\left|\vec{r}_{\mathrm{track}} - \vec{r}_{i} \right|}{c} \right)">
<img src="https://render.githubusercontent.com/render/math?math=\mathrm{TOF} = \frac{1}{\mathrm{MaxEcalLayer}}\sum_{i}^{\mathrm{MaxEcalLayer}} \left( t_{i} - \frac{\left|\vec{r}_{\mathrm{track}} - \vec{r}_{i} \right|}{c} \right)"> <br>
If no ECal hits are found returns `0.0`.


- `"frankFit"` Select the closest ECal hit to the linearly extrapolated track line inside the ECal in each of the first *MaxEcalLayer* ECal layers. Use linear fit of the hits time as a function of the distance to the track position at the ECal surface <img src="https://render.githubusercontent.com/render/math?math=t=f(|\vec{r}_{\mathrm{track}} - \vec{r}_{\mathrm{hit}} |)"> to define time-of-flight as an extrapolated time at the extrapolated track position at the ECal surface <img src="https://render.githubusercontent.com/render/math?math=\mathrm{TOF}=f(|\vec{r}_{\mathrm{track}} - \vec{r}_{\mathrm{hit}} |=0)">
- `"frankFit"` Select the closest ECal hit to the linearly extrapolated track line inside the ECal in each of the first *MaxEcalLayer* ECal layers. Use linear fit of the hits time as a function of the distance to the track position at the ECal surface <img src="https://render.githubusercontent.com/render/math?math=t=f(|\vec{r}_{\mathrm{track}} - \vec{r}_{\mathrm{hit}} |)"> to define time-of-flight as an extrapolated time at the extrapolated track position at the ECal surface <img src="https://render.githubusercontent.com/render/math?math=\mathrm{TOF}=f(|\vec{r}_{\mathrm{track}} - \vec{r}_{\mathrm{hit}} |=0)"> <br>
If no ECal hits are found returns `0.0`.<br>
If only one ECal hit is found, which is not enough to perform the linear fit, then returns the same as *closest* and *frankAvg*.

for more illustrative explanations of the methods above see slides 10, 12, 13 from the following [LCWS2021 talk]((https://indico.cern.ch/event/995633/contributions/4259659/attachments/2209010/3738157/Bohdan_TOF_LCWS2021.pdf)).

2 changes: 1 addition & 1 deletion TimeOfFlight/include/TOFEstimators.h
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
#define TOFEstimators_h 1

/**
Marlin processor than calculates output parameters.
Marlin processor that calculates output parameters.
\author F. Gaede, DESY, April 2018
\author B. Dudar, DESY, September 2021
*/
7 changes: 7 additions & 0 deletions TimeOfFlight/include/TOFUtils.h
Original file line number Diff line number Diff line change
@@ -130,6 +130,8 @@ namespace TOFUtils{
Returns time measured by the closest ECal hit to the extrapolated track position at the ECal surface.

\f$ \mathrm{TOF} = t_{\mathrm{closest}} - \frac{\left| \vec{r}_{\mathrm{track}} - \vec{r}_{\mathrm{closest}} \right|}{c} \f$

If no ECal hits are found returns `0.0`.
*/
double getTofClosest( EVENT::Cluster* cluster, EVENT::Track* track, double timeResolution);

@@ -138,6 +140,8 @@ namespace TOFUtils{
the extrapolated track position at the ECal surface assuming speed of flight is the speed of light.

\f$ \mathrm{TOF} = \frac{1}{\mathrm{MaxEcalLayer}}\sum_{i}^{\mathrm{MaxEcalLayer}} \left( t_{i} - \frac{\left|\vec{r}_{\mathrm{track}} - \vec{r}_{i} \right|}{c} \right) \f$

If no ECal hits are found within selectedHits, then returns `0.0`.
*/
double getTofFrankAvg( std::vector<EVENT::CalorimeterHit*> selectedHits, EVENT::Track* track, double timeResolution);

@@ -147,6 +151,9 @@ namespace TOFUtils{
function of the distance to the extrapolated track position at the ECal surface.

\f$ \mathrm{TOF}=f(|\vec{r}_{\mathrm{track}} - \vec{r}_{\mathrm{hit}} |=0) \f$

If no ECal hits are found within selectedHits, then returns `0.0`.
If *only one* ECal hit is found, which is not enough to perform the linear fit, then returns the same as getTofClosest() and getTofFrankAvg().
*/
double getTofFrankFit( std::vector<EVENT::CalorimeterHit*> selectedHits, EVENT::Track* track, double timeResolution);

2 changes: 2 additions & 0 deletions TimeOfFlight/src/TOFUtils.cc
Original file line number Diff line number Diff line change
@@ -254,6 +254,7 @@ double TOFUtils::getTofClosest( EVENT::Cluster* cluster, EVENT::Track* track, do
const TrackState* tsEcal = track->getTrackState(TrackState::AtCalorimeter);
Vector3D trackPosAtEcal ( tsEcal->getReferencePoint() );


double hitTime = numeric_limits<double>::max();
double closestDistance = numeric_limits<double>::max();
for( auto hit : cluster->getCalorimeterHits() ){
@@ -268,6 +269,7 @@ double TOFUtils::getTofClosest( EVENT::Cluster* cluster, EVENT::Track* track, do
hitTime = hit->getTime();
}
}
if ( hitTime == numeric_limits<double>::max() ) return 0.;

return RandGauss::shoot(hitTime, timeResolution) - closestDistance/CLHEP::c_light;
}