Skip to content
Snippets Groups Projects

Phys/PhysConf: do not kill /Event/DAQ for Turbo

Closed Vanya Belyaev requested to merge vanya-microdst-turbo-v0 into master
1 unresolved thread
1 file
+ 69
22
Compare changes
  • Side-by-side
  • Inline
@@ -18,6 +18,10 @@
#include "Event/Particle.h"
#include "Event/ProtoParticle.h"
// ============================================================================
// LHCbMathq
// ============================================================================
#include "LHCbMath/EqualTo.h"
// ============================================================================
// DaVinciTypes
// ============================================================================
#include "Kernel/HashIDs.h"
@@ -31,13 +35,26 @@ namespace LoKi
* form the same protoparticle.
*
* Specific configuration properties
* - Type1CloneSlopeDifference : slope difference to identify ``clone type-1''
* - Type2CloneSlopeDifference : slope difference to identify ``clone type-2''
* - Type2CloneQoverPDifference: Q/p difference to identify ``clone type-2''
* - TrackOverlap : overlap criteria for tracks
* - TrackOverlap : overlap criteria for calos
* - Type1CloneSlopeXDifference : slope-X difference to identify ``clone type-1''
* - Type1CloneSlopeYDifference : slope-Y difference to identify ``clone type-1''
* - Type2CloneSlopeDifference : slope difference to identify ``clone type-2''
* - Type2CloneQoverPDifference : Q/p difference to identify ``clone type-2''
* - TrackOverlap : overlap criteria for tracks (percentage of common hits)
* - CaloOverlap : overlap criteria for calos (percentage of common hits)
*
* If parameter is outside its "physical" range, the correspondint
* Default values for "differences" are taken from Matt Needham:
* @code
* int type1Clone(float tx1, float tx2, float ty1, float ty2) {
* return ((TMath::Abs(tx1 -tx2) < 0.0004) && (TMath::Abs(ty1 -ty2) < 0.0002));
* }
* int type2Clone(float tx1, float tx2, float ty1, float ty2, float qDivp1, float qDivp2 ){
* return ((TMath::Abs(tx1 -tx2) < 0.005) && (TMath::Abs(ty1 -ty2) < 0.005) && TMath::Abs(qDivp1 - qDivp2) < 1e-6);
* }
* @endcode
* (with the reference to Wouter Hulsbergen's studies:
* @see https://indico.cern.ch/event/134170/contributions/135558/attachments/104261/148751/clones.pdf
*
* If parameter is outside its "physical" range, the corresponding
* criterion is not used to identify overlaps
*
* @author Vanya BELYAEV Ivan.Belyaev@itep.ru
@@ -53,16 +70,21 @@ namespace LoKi
const std::string& name ,
const IInterface* parent )
: base_class ( name , type , parent )
, m_clone_type1_slope ( 0.0004 ) // clone "Type1" slope difference
, m_clone_type1_slopeX ( 0.0004 ) // clone "Type1" slope difference
, m_clone_type1_slopeY ( 0.0002 ) // clone "Type1" slope difference
, m_clone_type2_slope ( 0.005 ) // clone "Type2" slope difference
, m_clone_type2_qOverP ( 1.e-6 ) // clone "Type2" q/P difference
, m_overlap_tracks ( 0.70 ) // overlap criteria for tracks
, m_overlap_calos ( 0.50 ) // overlap criteria for calo
{
declareProperty
( "Type1CloneSlopeDifference" ,
m_clone_type1_slope , // clone "Type1" slope difference
"Slope difference to identify ``Type1-clone'' [ignore, if negative]" ) ;
( "Type1CloneSlopeXDifference" ,
m_clone_type1_slopeX , // clone "Type1" slope difference
"Slope-X difference to identify ``Type1-clone'' [ignore, if negative]" ) ;
declareProperty
( "Type1CloneSlopeYDifference" ,
m_clone_type1_slopeY , // clone "Type1" slope difference
"Slope-Y difference to identify ``Type1-clone'' [ignore, if negative]" ) ;
declareProperty
( "Type2CloneSlopeDifference" ,
m_clone_type2_slope , // clone "Type2" slope difference
@@ -154,16 +176,18 @@ namespace LoKi
// ========================================================================
private:
// ========================================================================
/// clone "Type1" slope difference
double m_clone_type1_slope ; // clone "Type1" slope difference
/// clone "Type1" slope-X difference
double m_clone_type1_slopeX ; // clone "Type1" slope-X difference
/// clone "Type1" slope-Y difference
double m_clone_type1_slopeY ; // clone "Type1" slope-Y difference
/// clone "Type2" slope difference
double m_clone_type2_slope ; // clone "Type2" slope difference
double m_clone_type2_slope ; // clone "Type2" slope difference
/// clone "Type2" q/P difference
double m_clone_type2_qOverP ; // clone "Type2" q/P difference
double m_clone_type2_qOverP ; // clone "Type2" q/P difference
/// overlap criteria for tracks
double m_overlap_tracks ; // overlap criteria for tracks
double m_overlap_tracks ; // overlap criteria for tracks
/// overlap criteria for calo
double m_overlap_calos ; // overlap criteria for calo
double m_overlap_calos ; // overlap criteria for calo
// ========================================================================
}; // End of clas LoKi::CheckOverlap
// ==========================================================================
@@ -225,15 +249,36 @@ inline bool LoKi::CheckOverlap::overlap
//
if ( t1->charge() != t2->charge() ) { return false ; }
//
// trivial ``exact'' comparison for few basic properties
static const LHCb::Math::Equal_To<double> s_equal_1 {};
static const LHCb::Math::Equal_To<Gaudi::XYZVector> s_equal_2 {};
static const LHCb::Math::Equal_To<Gaudi::XYZPoint> s_equal_3 {};
//
if ( s_equal_1 ( t1->chi2() , t2->chi2() ) &&
s_equal_1 ( t1->phi () , t2->phi () ) &&
s_equal_2 ( t1->momentum() , t2->momentum() ) &&
s_equal_3 ( t1->position() , t2->position() ) ) { return true ; }
//
const LHCb::State* s1 = t1->stateAt ( LHCb::State::ClosestToBeam ) ;
if ( nullptr == s1 ) { s1 = t1->stateAt ( LHCb::State::FirstMeasurement ) ; }
if ( nullptr == s1 ) { s1 = &(t1->firstState() ) ; }
const LHCb::State* s2 = &(t2->closestState( s1->z() )) ;
//
if ( 0 < m_clone_type1_slope &&
std::abs ( s1 -> tx() - s2 -> tx() ) <= m_clone_type1_slope &&
std::abs ( s1 -> ty() - s2 -> ty() ) <= m_clone_type1_slope ) { return true ; }
// first try ``exact comparison''
if ( s_equal_1 ( s1->z () , s2->z () ) &&
s_equal_1 ( s1->x () , s2->x () ) &&
s_equal_1 ( s1->y () , s2->y () ) &&
s_equal_1 ( s1->tx () , s2->tx() ) &&
s_equal_1 ( s1->ty () , s2->ty() ) ) { return true ; }
//
// Now it is a time for Matt's recipe:
// - clone type-1
if ( 0 < m_clone_type1_slopeX &&
0 < m_clone_type1_slopeY &&
std::abs ( s1 -> tx() - s2 -> tx() ) <= m_clone_type1_slopeX &&
std::abs ( s1 -> ty() - s2 -> ty() ) <= m_clone_type1_slopeY ) { return true ; }
//
// - clone type-2
if ( 0 < m_clone_type2_slope &&
0 < m_clone_type2_qOverP )
{
@@ -243,13 +288,14 @@ inline bool LoKi::CheckOverlap::overlap
std::abs ( s1 -> qOverP() - s2 -> qOverP() ) <= m_clone_type2_qOverP ;
}
//
// check with percentage of common LHCbIDs
if ( 0 < m_overlap_tracks && m_overlap_tracks <= 1 )
{
const std::pair<double,double> ov = LHCb::HashIDs::overlap ( t1 , t2 ) ;
return m_overlap_tracks <= std::max ( ov.first , ov.second ) ;
}
//
Warning ( "Unclassified track overlap, ignore it" ).ignore() ;
// Warning ( "Unclassified track overlap, ignore it" ).ignore() ;
return false ;
}
// calo vs calo
@@ -261,11 +307,12 @@ inline bool LoKi::CheckOverlap::overlap
return m_overlap_calos <= std::max ( ov.first , ov.second ) ;
}
//
Warning ( "Unclassified calo overlap, ignore it" ).ignore() ;
// Warning ( "Unclassified calo overlap, ignore it" ).ignore() ;
return false ;
}
//
// weird case: should never happens
Warning ( "Error in overlap, ignore it" ).ignore() ;
// Warning ( "Error in overlap, ignore it" ).ignore() ;
return false ;
}
// ============================================================================
Loading