Skip to content

Commit

Permalink
implemented energy-dependent cluster merge distance cut
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljeans committed Jan 30, 2015
1 parent 30a77a9 commit cd79dd0
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 26 deletions.
2 changes: 0 additions & 2 deletions example_steer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@

<!--Maximum distance from core to added hits (in Moliere Radii)-->
<parameter name="ClusterMaxDist" type="float">2 </parameter>
<!--maximum distance between 2 cluster COGs to consider merging them (int terms of Moliere Radii)-->
<parameter name="MaxMergeDist" type="float">2 </parameter>

</processor>

Expand Down
12 changes: 9 additions & 3 deletions include/GarlicAlgorithmParameters.hh
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,23 @@ public:
void SetConstantTerm ( float f ) {_constantTerm =f;}
void SetMoliereRadius ( float f ) {_moliereRadius =f;}

void Set_MaxMergeDist (float x) {_max_merge_dist=x;}
float Get_MaxMergeDist () {return _max_merge_dist;}
//void Set_MaxMergeDist (float x) {_max_merge_dist=x;}
//float Get_MaxMergeDist () {return _max_merge_dist;}

// for converting hit energies to MIPs - for first layer: scale aothers according to abs thickness
void SetEnergyMIPconversion(float x) {_en_mip_conv=x;}
float GetEnergyMIPconversion() {return _en_mip_conv;}

void SetMergeMaxDistAtLowEn(float x) {_MaxMergeDistAtLowEn=x;}
void SetMergeMaxDistEnDep(float x) {_MaxMergeDistEnDep=x;}
void SetMergeRatioCut (float x ) { _merge_ratioCut = x; };
void SetMergeEnergyDistFactor (float x ) { _merge_energy_dist_factor = x; };
void SetMergeAbsoluteLargestDist (float x ) { _merge_absoluteLargestDist = x; };
void SetMergePi0MassLimit (float x ) { _merge_pi0_mass_limit = x; };
void SetMergePi0MaxEnergyImbalance (float x ) { _merge_pi0_max_energy_imbalance = x; };

float GetMergeMaxDistAtLowEn() {return _MaxMergeDistAtLowEn;}
float GetMergeMaxDistEnDep() {return _MaxMergeDistEnDep;}
float GetMergeRatioCut () { return _merge_ratioCut ; };
float GetMergeEnergyDistFactor () { return _merge_energy_dist_factor ; };
float GetMergeAbsoluteLargestDist () { return _merge_absoluteLargestDist ; };
Expand Down Expand Up @@ -146,7 +150,9 @@ private:
float _mergeTouchFraction;
int _mergeInitialLayerSeparation;

float _max_merge_dist;
// float _max_merge_dist;
float _MaxMergeDistAtLowEn;
float _MaxMergeDistEnDep;

float _stochasticTerm;
float _constantTerm;
Expand Down
5 changes: 4 additions & 1 deletion include/GarlicProcessor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private:
int _x_maxHoleSection2;
float _x_maxCoreDist;

float _x_maxMergeDist;
// float _x_maxMergeDist;

// int _x_nIterations;
float _x_TouchingCellDistance;
Expand All @@ -154,6 +154,9 @@ private:
bool _x_debugCollections;


float _x_maxMergeDistLowEn;
float _x_maxMergeDistEnDep;

float _x_MergeRatioCut ;
float _x_MergeEnergyDistFactor ;
float _x_MergeDistanceMultiplier ;
Expand Down
23 changes: 8 additions & 15 deletions src/GarlicClusterAlgos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -913,21 +913,19 @@ bool GarlicClusterAlgos::mergeCandidate( GarlicExtendedCluster* primary, GarlicE
}
}

// // should make these parameters!
// const float ratioCut = 0.25;
// const float energy_dist_factor = 120;
// const float distanceMultiplier = 1.;
// const float absoluteLargestDist = 500.;
// // for pi0
// const float mass_limit = 0.1; // a little smaller than pi0 mass
// const float max_mass_imbalance_for_pi0=50; // reduced from 100....
float maxClEn = std::max( primary->getEnergy(), secondary->getEnergy() );

float ratioCut = GarlicAlgorithmParameters::Instance().GetMergeRatioCut ();
float energy_dist_factor = GarlicAlgorithmParameters::Instance().GetMergeEnergyDistFactor ();
float absoluteLargestDist = GarlicAlgorithmParameters::Instance().GetMergeAbsoluteLargestDist ();
float mass_limit = GarlicAlgorithmParameters::Instance().GetMergePi0MassLimit ();
float max_mass_imbalance_for_pi0 = GarlicAlgorithmParameters::Instance().GetMergePi0MaxEnergyImbalance ();

// energy-dependent max distance between clusters
float min_max_merge_dist = GarlicAlgorithmParameters::Instance().GetMergeMaxDistAtLowEn();
float edap_max_merge_dist = GarlicAlgorithmParameters::Instance().GetMergeMaxDistEnDep();
float max_merge_dist_rm = std::max ( float(min_max_merge_dist), float(min_max_merge_dist + edap_max_merge_dist*log10( maxClEn ) ));
float max_merge_dist_mm = max_merge_dist_rm*GarlicAlgorithmParameters::Instance().GetMoliereRadius();

// first a cut on the simple distance between centres of gravity
float simpleCCdist(0);
Expand All @@ -936,8 +934,6 @@ bool GarlicClusterAlgos::mergeCandidate( GarlicExtendedCluster* primary, GarlicE
simpleCCdist=sqrt(simpleCCdist);
if ( simpleCCdist>absoluteLargestDist ) return false;



// then the distance from cluster axis (energy-dependent cut)
float cogDist = primary->getDistToClusterAxis( secondary->getCentreOfGravity(), 0 ); // ip pointing
if ( primary->getAssociatedTrack() ) cogDist = std::min( cogDist, primary->getDistToClusterAxis( secondary->getCentreOfGravity(), 1 )); // track direction
Expand All @@ -949,14 +945,11 @@ bool GarlicClusterAlgos::mergeCandidate( GarlicExtendedCluster* primary, GarlicE

bool ok_enRatio = energyRatio<ratioCut; // don't merge similar-energy clusters
bool ok_enRatioDist = energyRatio<energy_dist_factor/pow(cogDist,2); // energy fraction-dependent distance cut
bool ok_Dist = cogDist<GarlicAlgorithmParameters::Instance().Get_MaxMergeDist()*GarlicAlgorithmParameters::Instance().GetMoliereRadius(); // distance
bool ok_Dist = cogDist<max_merge_dist_mm; // distance

if ( _verbose ) {
if ( !ok_Dist ) {
cout << "failed Dist cut " << cogDist << " " <<
GarlicAlgorithmParameters::Instance().Get_MaxMergeDist()*
GarlicAlgorithmParameters::Instance().GetMoliereRadius()
<< endl;
cout << "failed Dist cut " << cogDist << " > " << max_merge_dist_mm << endl;
}
}

Expand Down
18 changes: 13 additions & 5 deletions src/GarlicProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,19 @@ GarlicProcessor::GarlicProcessor() : Processor("GarlicProcessor") {

// cluster merging

registerProcessorParameter("MaxMergeDist",
"maximum distance between 2 cluster COGs to consider merging them (int terms of Moliere Radii)",
_x_maxMergeDist,

registerProcessorParameter("MaxMergeDistLowEn",
"maximum distance between clusters to consider merging: max(MaxMergeDistLowEn, MaxMergeDistLowEn + MaxMergeDistEnDep*log10(clusEn))",
_x_maxMergeDistLowEn,
float(2.) );


registerProcessorParameter("MaxMergeDistEnDep",
"maximum distance between clusters to consider merging: max(MaxMergeDistLowEn, MaxMergeDistLowEn + MaxMergeDistEnDep*log10(clusEn))",
_x_maxMergeDistEnDep,
float(1.5) );


registerProcessorParameter("stochasticTerm",
"assumed stochastic term of energy resolution",
_x_stochasticTerm,
Expand Down Expand Up @@ -482,8 +489,6 @@ void GarlicProcessor::setup()

GarlicAlgorithmParameters::Instance().SetClusterMaxDist(_x_clusterMaxDist);

GarlicAlgorithmParameters::Instance().Set_MaxMergeDist( _x_maxMergeDist ); // max dist to merge clusters

GarlicAlgorithmParameters::Instance().SetCoreLayersSection1(_x_nlayersSection1);
GarlicAlgorithmParameters::Instance().SetCoreMaxHoleSection1(_x_maxHoleSection1);
GarlicAlgorithmParameters::Instance().SetCoreMaxHoleSection2(_x_maxHoleSection2);
Expand All @@ -502,6 +507,9 @@ void GarlicProcessor::setup()
GarlicAlgorithmParameters::Instance().SetForwardTrackAngle(_x_forwardTrackAngle);


GarlicAlgorithmParameters::Instance().SetMergeMaxDistAtLowEn( _x_maxMergeDistLowEn );
GarlicAlgorithmParameters::Instance().SetMergeMaxDistEnDep( _x_maxMergeDistEnDep );

GarlicAlgorithmParameters::Instance().SetMergeRatioCut (_x_MergeRatioCut );
GarlicAlgorithmParameters::Instance().SetMergeEnergyDistFactor (_x_MergeEnergyDistFactor );
GarlicAlgorithmParameters::Instance().SetMergeAbsoluteLargestDist (_x_MergeAbsoluteLargestDist );
Expand Down

0 comments on commit cd79dd0

Please sign in to comment.