# Common reconstruction SDHCal and SiW -ECal Testbeam Sept 2018

The common reconstruction consists in extracting hits from ECAL and HCAL raw data and mix them in a common format data file.

Fields needed for common reconstruction

• d : detector id
• x : horizontal coordinate in mm from the left part of HCAL
• y : vertical coordinate in mm from the bottom of HCAL
• z : depth in mm from the first ECAL slab
• t : time in nanoseconds from the first BCID of the first spill of the run
• Vincent: I would split this information into 2 numbers: tsp (spill time, in ms) and tbc (time in a spill, in ns). A single time in ns requires a precision of 3600s / 200 ns ~ 1/2•10^10 (~34 significative bits) coding to distinguish 2 BCID at the end of 1h run, i.e a coding as double (55bits mantissa). It will also allow easier cuts (on the position in a spill, etc).
• e : measured energy or threshold

The attached plan show the different dimension of the system.

## Detector id

a value for identifying the detector where the hit belongs

• 100 for HCAL
• 200 for ECAL

## X coordinate

The x zero is the bottom left corner of HCAL (view from the beam). The x coordinate is parallel to the ground (horizontal). It is expressed in mm. The distance from the left edge of ECAL and left edge of HCAL is 225 mm.

Let's note Ex_i the ith pixel in x of ECAL with i in 0..31

Let's note Hx_i the ith pixel in x of HCAL with i in 0..96

if a hit happens at Ex_i then its x coordinate is 225+i*5.5+2.25 mm

if a hit happens at Hx_i then its x coordinate is i*10.4+5.2 mm

## Y coordinate

The y zero is the bottom left corner of HCAL (view from the beam). The y coordinate is vertical. It is expressed in mm.

The low edge of the first pixel of HCAL is at 42mm from the ground. The low edge of the first pixel of ECAL is at 419mm from the ground, thus the shift between the two is 377mm.

The pixels of ECAL are 5.5mm high thus a correction of 2.25mm is needed to take the barycenter of the pixel

The pixels of HCAL are 10.4mm high thus a correction of 5mm is needed to take the barycenter of the pixel

Let's note Ey_i the ith pixel in y of ECAL with i in 0..31

Let's note Hy_i the ith pixel in y of HCAL with i in 0..96

if a hit happens at Ey_i then its y coordinate is 377+i*5.5+2.25 mm

if a hit happens at Hy_i then its y coordinate is i*10.4+5.2 mm

## Z coordinate

The z zero is the first slab of the ECAL (the one in front of beam). The coordinate z is parallel to the beam. it is expressed in mm.

All ECAL slabs are separated by 15mm. The last one is at 70mm of the first absorber of HCAL. The first layer of HCAL is 28mm after this first absorber. The length of HCAL chambers in z is 8mm (including free space) thus the barycenter inside the chamber is at 4mm

Let's note Ez_i the ith layer of ECAL with i in 0..9

Let's note Hz_i the ith chamber of HCAL with i in 0..34

if a hit happens in Ez_i then its z coordinate is i*15 mm

if a hit happens in Hz_i then its z coordinate is 225+i*28+4 mm

 dif name Ez SLAB name dif_1_1_1 9 SLAB 16 dif_1_1_2 0 SLAB 17 dif_1_1_3 7 SLAB 18 dif_1_1_4 8 SLAB 19 dif_1_1_5 3 SLAB K1 dif_1_2_1 2 SLAB 20 dif_1_2_2 1 SLAB 22 dif_1_2_3 6 SLAB K2 dif_1_2_4 5 SLAB P3 dif_1_2_5 4 SLAB P2
Position checked with comparison of xml file, hdmi cables and picture of detector

## Time reconstruction

The time coordinate is expressed in ns from the beginning of the run.

The time in ECAL is completely absolute and based on Spill number. Only the HCAL can give absolute time through its absolute bcid. Let's call AB_i the absolute bcid corresponding to the first relative bcid of the spill i. This absolute bcid has an evolution at 5MHz and begin from an indefinite value. Let's call Ref_AB=AB_0. The time coordinate of an absolute bcid AB value is (AB-Ref_AB)*200 ns.

ECAL bcid reconstruction : The frequency of the bcid clock can be 2.5MHz or 5Mhz depending on the DIF firmware. Let's call p_b the period of this clock (200 ns for 5MHz 400ns for 2.5MHz). Spill inherited from HCAL are typically longer than the bcid counter cycle (12 bits). Any time a cycle is finished, the counter value go back to zero. Thus any time a monotony disruption is detected, 4096 should be added to bcid. the algorithm is the following :

• offset=0
• last_bcid=-1
• for b in bcid of one spill :
• if bcid<last_bcid: offset=offset+4096
• true_bcid=bcid+offset
• last_bcid=bcid

(Vincent note: this algorithm is better if applied to a larger consistent - bcid-wise - sample: a slab, all slabs sharing with the same clock (frequency; 2.5 or 5 MHz).

There is a systematic shift between the different ECAL slabs depending on the DIF code. The shift values are in the array. Let's call it s_i

There is also a systematic timing shift between the two detectors : this should be discovered by analysing muons. Let's call S this shift in 5MHz bcid number.

Considering an ECAL event that happened at spill i (of absolute first bcid AB_i) and true_bcid tb, it's time coordinate is (AB_i-Ref_AB+S)*200+(s_i+tb)*p_b ns

Considering an HCAL event that happened on dif i at absolute bcid b, its time coordinate is (b-Ref_AB)*200 ns

 dif name bcid freq. syst. shift dif_1_1_1 2.5MHz +8 dif_1_1_2 5MHz NO gated clock +0 dif_1_1_3 2.5MHz +8 dif_1_1_4 2.5MHz +8 dif_1_1_5 5MHz +1838 +11 dif_1_2_1 2.5MHz +8 dif_1_2_2 2.5MHz +7 dif_1_2_3 5MHz +1838 + 11 dif_1_2_4 5MHz +1838 + 9 dif_1_2_5 5MHz +1838 + 11
For the ECAL, the typical tolerance in the same shower should be 4 bcid at 5 Mhz or 2 at 2.5 MHz

## Energy

The energy field is simply the ADC read of ECAL and the 2 bits threshold for HCAL

## Reconstruction steps

• extract absolute bcid of first bcid of every spill from the SDHCal raw data (data : spill_nb abs_bcid)
• extract fields from both datasets (see before)
• fusion extracted fields
• output in root and csv files
Topic attachments
I Attachment History Action Size Date Who Comment
png plan_hcal_ecal.png r1 manage 974.8 K 2018-12-19 - 07:50 FredericBrunoMagniette
Topic revision: r12 - 2018-12-19 - FredericBrunoMagniette