Belle II Software  release-08-01-10
CDCMCHitCollectionLookUp< ACDCHitCollection > Class Template Reference

Interface class to the Monte Carlo information for collections of hits. More...

#include <CDCMCHitCollectionLookUp.h>

Public Member Functions

void clear ()
 Clears all Monte Carlo information left from the last event.
 
 CDCMCHitCollectionLookUp ()
 Dummy constructor to silence the intel-compiler warnings (NOTE: using "=default" will make the intel compilation fail)
 
MCTrackIdPurityPair getHighestPurity (const ACDCHitCollection &hits) const
 Get the track id with the highest corresponding purity.
 
ITrackType getMCTrackId (const ACDCHitCollection *ptrHits) const
 Getter for the Monte Carlo track id matched to this collection of hits. More...
 
int getCorrectRLVote (const ACDCHitCollection *ptrHits) const
 Getter for the difference of correct versus incorrect right left passage informations.
 
double getRLPurity (const ACDCHitCollection *ptrHits) const
 Getter for the right left passge purity which respects the forward backward reconstruction.
 
const MCParticlegetMCParticle (const ACDCHitCollection *ptrHits) const
 Getter for the mc particle matched to this collection of hits.
 
const CDCHitgetFirstHit (const ACDCHitCollection *ptrHits) const
 Getter for the first hit in the collection of hits which has the Monte Carlo track id matched to this collection of hits.
 
const CDCHitgetLastHit (const ACDCHitCollection *ptrHits) const
 Getter for the last hit in the collection of hits which has the Monte Carlo track id matched to this collection of hits.
 
Index getFirstInTrackId (const ACDCHitCollection *ptrHits) const
 Getter for in track id for the first hit in the collection of hits which has the Monte Carlo track id matched to this collection of hits.
 
Index getLastInTrackId (const ACDCHitCollection *ptrHits) const
 Getter for in track id for the last hit in the collection of hits which has the Monte Carlo track id matched to this collection of hits.
 
Index getFirstInTrackSegmentId (const ACDCHitCollection *ptrHits) const
 Getter for in track collection of hits id for the first hit in the collection of hits which has the Monte Carlo track id matched to this collection of hits.
 
Index getLastInTrackSegmentId (const ACDCHitCollection *ptrHits) const
 Getter for in track collection of hits id for the last hit in the collection of hits which has the Monte Carlo track id matched to this collection of hits.
 
Index getFirstNPassedSuperLayers (const ACDCHitCollection *ptrHits) const
 Getter for number of passed superlayer till the first hit the collection of hits which has the Monte Carlo track id matched to this collection of hits.
 
Index getLastNPassedSuperLayers (const ACDCHitCollection *ptrHits) const
 Getter for number of passed superlayer till the last hit the collection of hits which has the Monte Carlo track id matched to this collection of hits.
 
Index getFirstNLoops (const ACDCHitCollection *ptrHits) const
 Getter for number of loops till the first hit the collection of hits which has the Monte Carlo track id matched to this collection of hits.
 
Index getLastNLoops (const ACDCHitCollection *ptrHits) const
 Getter for number of loops till the last hit the collection of hits which has the Monte Carlo track id matched to this collection of hits.
 
EForwardBackward isForwardOrBackwardToMCTrack (const ACDCHitCollection *ptrHits) const
 Returns the orientation of the collection of hits relative to its matched track. More...
 
EForwardBackward areAlignedInMCTrack (const ACDCHitCollection *ptrFromHits, const ACDCHitCollection *ptrToHits) const
 Returns if the second collection of hits follows the first collection of hits in their common Monte Carlo track. More...
 
EForwardBackward areAlignedInMCTrackWithRLCheck (const ACDCHitCollection *ptrFromHits, const ACDCHitCollection *ptrToHits) const
 Returns if the second collection of hits follows the first collection of hits in their common Monte Carlo track. More...
 
CDCTrajectory3D getTrajectory3D (const ACDCHitCollection *ptrHits) const
 Returns the trajectory of the collection of hits.
 

Private Member Functions

std::map< ITrackType, size_t > getHitCountByMCTrackId (const ACDCHitCollection &hits) const
 Fill a map with the number of hits for each track id contained in the given hit range.
 

Private Attributes

float m_minimalMatchPurity = 0.5
 Threshold for the purity that must be exceeded to be considered as a match.
 
float m_minimalRLPurity = 0.5
 Threshold for the correct fraction of right left passage informations to be considered a match.
 

Detailed Description

template<typename ACDCHitCollection>
class Belle2::TrackFindingCDC::CDCMCHitCollectionLookUp< ACDCHitCollection >

Interface class to the Monte Carlo information for collections of hits.

Definition at line 70 of file CDCMCHitCollectionLookUp.h.

Member Function Documentation

◆ areAlignedInMCTrack()

EForwardBackward areAlignedInMCTrack ( const ACDCHitCollection *  ptrFromHits,
const ACDCHitCollection *  ptrToHits 
) const

Returns if the second collection of hits follows the first collection of hits in their common Monte Carlo track.

  • Returns EForwardBackward::c_Invalid if the collection of hits is not matched in the same Monte Carlo track.
  • Returns EForwardBackward::c_Forward if both collections of hits are coaligned with the Monte Carlo track and the second collection of hits comes after the first.
  • Returns EForwardBackward::c_Backward if both collections of hits are anticoaligned with the Monte Carlo track and the second collection of hits comes after the first in the reversed sense.

Check if the segments are in the same track

Definition at line 202 of file CDCMCHitCollectionLookUp.icc.h.

205  {
207  ITrackType fromMCTrackId = getMCTrackId(ptrFromHits);
208  if (fromMCTrackId == INVALID_ITRACK) return EForwardBackward::c_Invalid;
209 
210  ITrackType toMCTrackId = getMCTrackId(ptrToHits);
211  if (toMCTrackId == INVALID_ITRACK) return EForwardBackward::c_Invalid;
212 
213  if (fromMCTrackId != toMCTrackId) return EForwardBackward::c_Invalid;
214 
215  // Check if the segments are sensable on their own
216  EForwardBackward fromFBInfo = isForwardOrBackwardToMCTrack(ptrFromHits);
217  if (fromFBInfo == EForwardBackward::c_Invalid) return EForwardBackward::c_Invalid;
218 
219  EForwardBackward toFBInfo = isForwardOrBackwardToMCTrack(ptrToHits);
220  if (toFBInfo == EForwardBackward::c_Invalid) return EForwardBackward::c_Invalid;
221 
222  if (fromFBInfo != toFBInfo) return EForwardBackward::c_Invalid;
223 
224  {
225  // Now check if hits are aligned within their common track
226  // Index firstNPassedSuperLayersOfFromHits = getFirstNPassedSuperLayers(ptrFromHits);
227  Index lastNPassedSuperLayersOfFromHits = getLastNPassedSuperLayers(ptrFromHits);
228  // if (firstNPassedSuperLayersOfFromHits == c_InvalidIndex) return
229  // EForwardBackward::c_Invalid;
230  if (lastNPassedSuperLayersOfFromHits == c_InvalidIndex) return EForwardBackward::c_Invalid;
231 
232  Index firstNPassedSuperLayersOfToHits = getFirstNPassedSuperLayers(ptrToHits);
233  // Index lastNPassedSuperLayersOfToHits = getLastNPassedSuperLayers(ptrToHits);
234  if (firstNPassedSuperLayersOfToHits == c_InvalidIndex) return EForwardBackward::c_Invalid;
235  // if (lastNPassedSuperLayersOfToHits == c_InvalidIndex) return EForwardBackward::c_Invalid;
236 
237  if (lastNPassedSuperLayersOfFromHits < firstNPassedSuperLayersOfToHits) {
238  if (fromFBInfo == EForwardBackward::c_Forward and
239  toFBInfo == EForwardBackward::c_Forward) {
240  return EForwardBackward::c_Forward;
241  } else {
242  return EForwardBackward::c_Invalid;
243  }
244  } else if (firstNPassedSuperLayersOfToHits < lastNPassedSuperLayersOfFromHits) {
245  if (fromFBInfo == EForwardBackward::c_Backward and
246  toFBInfo == EForwardBackward::c_Backward) {
247  return EForwardBackward::c_Backward;
248  } else {
249  return EForwardBackward::c_Invalid;
250  }
251  }
252  }
253 
254  {
255  // Now we are in the same true segment with both segments
256  // Index firstInTrackSegmentIdOfFromHits = getFirstInTrackSegmentId(ptrFromHits);
257  Index lastInTrackSegmentIdOfFromHits = getLastInTrackSegmentId(ptrFromHits);
258  // if (firstInTrackSegmentIdOfFromHits == c_InvalidIndex) return
259  // EForwardBackward::c_Invalid;
260  if (lastInTrackSegmentIdOfFromHits == c_InvalidIndex) return EForwardBackward::c_Invalid;
261 
262  Index firstInTrackSegmentIdOfToHits = getFirstInTrackSegmentId(ptrToHits);
263  // Index lastInTrackSegmentIdOfToHits = getLastInTrackSegmentId(ptrToHits);
264  if (firstInTrackSegmentIdOfToHits == c_InvalidIndex) return EForwardBackward::c_Invalid;
265  // if (lastInTrackSegmentIdOfToHits == c_InvalidIndex) return EForwardBackward::c_Invalid;
266 
267  if (lastInTrackSegmentIdOfFromHits < firstInTrackSegmentIdOfToHits) {
268  if (fromFBInfo == EForwardBackward::c_Forward and
269  toFBInfo == EForwardBackward::c_Forward) {
270  return EForwardBackward::c_Forward;
271  } else {
272  return EForwardBackward::c_Invalid;
273  }
274  } else if (firstInTrackSegmentIdOfToHits < lastInTrackSegmentIdOfFromHits) {
275  // Test if to segment lies before in the mc track
276  // Hence the whole pair of segments is reverse to the track direction of flight
277  if (fromFBInfo == EForwardBackward::c_Backward and
278  toFBInfo == EForwardBackward::c_Backward) {
279  return EForwardBackward::c_Backward;
280  } else {
281  return EForwardBackward::c_Invalid;
282  }
283  }
284  }
285 
286  {
287  // Now we are in the same true segment with both of the hits
288  // Index firstInTrackIdOfFromHits = getFirstInTrackId(ptrFromHits);
289  Index lastInTrackIdOfFromHits = getLastInTrackId(ptrFromHits);
290  // if (firstInTrackIdOfFromHits == c_InvalidIndex) return EForwardBackward::c_Invalid;
291  if (lastInTrackIdOfFromHits == c_InvalidIndex) return EForwardBackward::c_Invalid;
292 
293  Index firstInTrackIdOfToHits = getFirstInTrackId(ptrToHits);
294  // Index lastInTrackIdOfToHits = getLastInTrackId(ptrToHits);
295  if (firstInTrackIdOfToHits == c_InvalidIndex) return EForwardBackward::c_Invalid;
296  // if (lastInTrackIdOfToHits == c_InvalidIndex) return EForwardBackward::c_Invalid;
297 
298  // Relax conditions somewhat such that segments may overlap at the borders.
299 
300  if (lastInTrackIdOfFromHits - 1 < firstInTrackIdOfToHits + 1) {
301  if (fromFBInfo == EForwardBackward::c_Forward and
302  toFBInfo == EForwardBackward::c_Forward) {
303  return EForwardBackward::c_Forward;
304  }
305  }
306 
307  if (firstInTrackIdOfToHits - 1 < lastInTrackIdOfFromHits + 1) {
308  if (fromFBInfo == EForwardBackward::c_Backward and
309  toFBInfo == EForwardBackward::c_Backward) {
310  return EForwardBackward::c_Backward;
311  }
312  }
313  }
314  // FIXME: Handle intertwined hits that are not cleanly consecutive along the track?
315  return EForwardBackward::c_Invalid;
316  }
EForwardBackward isForwardOrBackwardToMCTrack(const ACDCHitCollection *ptrHits) const
Returns the orientation of the collection of hits relative to its matched track.
ITrackType getMCTrackId(const ACDCHitCollection *ptrHits) const
Getter for the Monte Carlo track id matched to this collection of hits.
Index getLastNPassedSuperLayers(const ACDCHitCollection *ptrHits) const
Getter for number of passed superlayer till the last hit the collection of hits which has the Monte C...
Index getLastInTrackId(const ACDCHitCollection *ptrHits) const
Getter for in track id for the last hit in the collection of hits which has the Monte Carlo track id ...
Index getLastInTrackSegmentId(const ACDCHitCollection *ptrHits) const
Getter for in track collection of hits id for the last hit in the collection of hits which has the Mo...
Index getFirstInTrackSegmentId(const ACDCHitCollection *ptrHits) const
Getter for in track collection of hits id for the first hit in the collection of hits which has the M...
Index getFirstInTrackId(const ACDCHitCollection *ptrHits) const
Getter for in track id for the first hit in the collection of hits which has the Monte Carlo track id...
Index getFirstNPassedSuperLayers(const ACDCHitCollection *ptrHits) const
Getter for number of passed superlayer till the first hit the collection of hits which has the Monte ...
EForwardBackward
Enumeration to represent the distinct possibilities of the right left passage information.

◆ areAlignedInMCTrackWithRLCheck()

EForwardBackward areAlignedInMCTrackWithRLCheck ( const ACDCHitCollection *  ptrFromHits,
const ACDCHitCollection *  ptrToHits 
) const

Returns if the second collection of hits follows the first collection of hits in their common Monte Carlo track.

Also checks that the majority of the right left passage informations agrees with the forward backward information

Definition at line 319 of file CDCMCHitCollectionLookUp.icc.h.

◆ getMCTrackId()

ITrackType getMCTrackId ( const ACDCHitCollection *  ptrHits) const

Getter for the Monte Carlo track id matched to this collection of hits.

On first encounter of a collection of hits this evaluates the purities for the contained track ids. The match is valid if the highest purity exceeds the s_minimalMatchPurity threshold. In case the highest purity is to low to result will be INVALID_ITRACK. To result is stored in member map object for fast look up for repeated calls.

Definition at line 93 of file CDCMCHitCollectionLookUp.icc.h.

◆ isForwardOrBackwardToMCTrack()

EForwardBackward isForwardOrBackwardToMCTrack ( const ACDCHitCollection *  ptrHits) const

Returns the orientation of the collection of hits relative to its matched track.

  • Returns EForwardBackward::c_Invalid if the collection of hits is not matched to any track.
  • Returns EForwardBackward::c_Forward if the collection of hits is coaligned with the matched track.
  • Returns EForwardBackward::c_Backward if the collection of hits is coaligned with the matched track interpreted in reverse.
  • Returns EForwardBackward::c_Unknown if the matter cannot be decided.

Definition at line 184 of file CDCMCHitCollectionLookUp.icc.h.


The documentation for this class was generated from the following files: