== Photon Finder Kit==

Originally this Clustering Algorithm was developed by Predrag Krstonosic. Have a look at his thesis for more information on the algorithm. The official source code version is kept in the ilcsoft repository:

/afs/desy.de/group/it/ilcsoft/v-xx-xx/MarlinReco/v-xx-xx/Clustering/PhotonFinderKit

I have adopted and tested the algorithm for ILD00. The clustering algorithm is restricted to ECAL, and was optimised for photons coming from the IP.

### Steering

An example steering file is marlinKIT.xml, which was used by Predrag for LDC00, as comparison of his method with other PFlow Algorhythms.

steering parameters are:

- Cleaning: Apply topological cleaning, to get rid of muons, neutrons, ... = YES
Topological

`Cut: If Cleaning = YES, require > N neighbouring hits to accept this as a photon candidate`Number

`Of``Levels: Number of threshold levels i in which the hits will be divided for clustering < 16`- Levels: Set the thresholds for the i levels in mip: 0.5 1.5 2.5 4.0 6.0 9.0 16.0 26.0 41.0 65.0
Min

`Hit``0: Minimum number of hits required in the 0th level (the one containing all other levels)`Min

`Hit``Split: Minimum number of hits for the ith level, before splitting the cluster = 4 (don't touch!)`Cos

`cut: cosine of the opening angle in which to expect a cluster, hits outside will be considered as 2nd cluster`Dist

`cut: Minimum distance between 2 clusters in mm, if smaller they will be merged`R

`cut: N_{hits}[level i]/N_{hits}[level i-1] = 0.4 (don't touch)`

### PGDB

The Photon`Finder needs the Physical Geometrical database (PGDB) for fast acces to properties of the subdetectors. The mip factor has to be adopted to the chosen detector model. `

### Superhit

The basic class for this photon finder.

- To ease the nearest neighbour clustering, all cells are artificially shifted
- to have equal diestance (10mm) in x, y and z. The Superhit knoes about their true and their shifted position. Be CAREFUL if the layer distance gets smaller then the cell width!

- Searches for cluster seeds (connected hits)
- calculates the center of each cluster,
- their direction as direction between the center and the IP
- CAREFUL: Cannot be used for non-pointing gammas!

- the initial cluster start as closest hit in the first ECAL layer to the line
- between cluster maximum and IP

- the energy collected in the cluster as well as an estimate of the
- true energy of this cluster

- and the distance bewteen clusters.

### MarlinMath

contains all functions needed from Superhit to calculate distances, energies and so on.

Before getting started:

### KALIBRATOR

needed to get the calibration values that determine the true cluster energy, in dependence of the cluster level: E_cluster [level ] = a*E_true + b with E_min < E_true < E_max

This input, needed by KIT, is stored in KIT`util as a 9x10 array for 9 energies with 10 levels each. `

### KITdev

The main program where all ends meet, searching for em-showers in the ECAL. It depends on the Physical Geometrical Data Base PGDB, the Superhit class, and mathematical operations defined in Marlin`Math. The required calibration values can be obtained from KALIBRATOR. KIT is working on the MIP scale. Each cluster level has to be tuned. As an output you get # clusters, energy in cluster, hits in cluster, estimated true energy in cluster, position, direction, and distance to other clusters. `

### Performance

Without any further adoptions, e.g. new energy calibration, KIT is already quite apllicable for LDC`Prime. Using Marks calibration constants (ECAL 41.97 83.93 / HCAL 34.5) the energy sum is always slightly higher than the estimated photon energy. I tested it with single photons with E_true = 10GeV directly in front of the ECAL surface (/gun/position 30 1810 30 mm). An additional restriction is the true number of cluster = 1 from the Cluster``Cheater. Phi is the angle between x and y, theta the angle between y and z is left unchanged at 90 degrees. `

phi [degree] |
E_sum [GeV] |
E_estim [GeV] |
N_gamma |
phi_reco [degree] |

90 |
10.3 +/- 0.6 |
9.4 +/- 0.5 |
1.0 +/- 0.1 |
90.1 +/- 2.2 |

80 |
10.3 +/- 0.6 |
9.3 +/- 0.6 |
1.0 +/- 0.1 |
79.6 +/- 2.3 |

70 |
10.1 +/- 0.5 |
9.2 +/- 0.6 |
1.0 +/- 0.1 |
69.0 +/- 2.1 |

60 |
10.1 +/- 0.5 |
9.1 +/- 0.6 |
1.0 +/- 0.2 |
58.5 +/- 2.3 |

50 |
10.1 +/- 0.6 |
9.1 +/- 0.5 |
1.0 +/- 0.1 |
48.4 +/- 2.3 |

40 |
10.0 +/- 0.5 |
9.0 +/- 0.5 |
1.0 +/- 0.1 |
38.6 +/- 2.2 |

### Distance of Closest Approach

From the centre of gravity cog and the cluster main axis EV_1, one can calculate the distance of closest appraoch to the interaction point IP. The cog is calculated in Marlin`Util/Cluster``Shapes.cc function Cluster``Shapes::get``Centre``Of``Gravity() according to `

cog[axis] += hitAmplitude[hit]*hitPosition[hit]

The main cluster axis is calculated in Marlin`Util/Cluster``Shapes.cc function Cluster``Shapes::get``Eigen``Vec``Inertia() `

aIne[0][0] += hitAmplitude[hit] * (yDistanceFromCog^2 + zDistanceFromCog^2)

The norm of the distance of closest approach d can be calculated from

|d| = | cog x EV_1 | = sqrt [ (cog[y]*EV_1[z] - cog[z]*EV_1[y])^2 + (cog[z]*EV_1[x] - cog[x]*EV_1[z])^2 + (cog[x]*EV_1[y] - cog[y]*EV_1[x])^2 ]

theta [degree] |
gunDir |
true dca [cm] |
reco dca [cm] |

90 |
0 0.83910 1 |
212.79 |
140.52 +/- 4.22 |

80 |
0 1.19175 1 |
148.93 |
119.32 +/- 5.81 |

70 |
0 1.73205 1 |
101.56 |
92.95 +/- 6.75 |

60 |
0 2.74748 1 |
62.96 |
62.99 +/- 8.95 |

50 |
0 5.67128 1 |
29.08 |
30.88 +/- 7.95 |

40 |
0 1 0 |
4.24 |
7.86 +/- 5.67 |