# Presentation: 360198

## New L2cal hardware and CPU timing

- Laura Sartori

## 	- System overview
	- Hardware Configuration: a set of Pulsar boards receives, preprocess and merges the  calorimeter trigger tower data and sent them to the L2 decision CPU
	- Algorithm Timing Study: preliminary study to perform clustering and Met calculation inside the L2 decision CPU

- 	- Hardware Configuration: a set of Pulsar boards receives, preprocess and merges the  calorimeter trigger tower data and sent them to the L2 decision CPU
- 	- Algorithm Timing Study: preliminary study to perform clustering and Met calculation inside the L2 decision CPU

- Outline

## System Overview

- L2CAL

**BASIC IDEA**:
- 	Make the calorimeter trigger tower information (full 10 bit resolution) directly available to the L2 decision CPU, where a new algorithm performs:
- 	1. Clustering (L2Cone)
- 	2. Met calculation
**How**
- Develop a parallel L2CAL path using Pulsars
- Send raw full 10-bit resolution trigger tower
-      energy information directly into L2 CPU
- Do software clustering inside the CPU
- Full resolution MET/SUMET at L2
- Commission done in pure parasitic mode

- Hardware Configuration

## Hardware setup

-            L1CAL

- L2CAL

- Calorimeter

- 10 bits tower energy

- 10 bits tower energy
-    288 LVDS cables

- Only 8 bits tower energy used by L1CAL

- L2
- CPU

- L2 Pulsar crate

-  L2CAL Pulsar crate

- L2 CPU for commission

- (1) A copy of input signal
- (2) New mezzanine: 4 cable/card
- (3) 18 Pulsars/AUX with new input firmware
- (4) 6 Pulsar/AUX SLINK mergers
- (5) Some simple online code
- (6) New clustering algorithm code

## New Cabling at trigger room 

- L2 CAL crates
- L1CAL crates

- Under the floor

- Not terminated
- on pulsar
- mezzanine

- Possible new
- pulsar crate
- locations

- L2
- Decision
- crate

- Commissioning can be done in pure parasitic mode, using the spare decision CPU,
- along with a copy of all other L2 data paths information

- Above the racks

## Copy of Input Signals

- In principle, one could design a special splitter board. But it is messy and not necessary
- We can use LVDS multi-drop property to get a copy:

- DIRAC
- driver

- DCAS
- receiver

- Pulsar mezzanine Receiver (no termination)

- 100 ohm

## Pulsar Cluster (1 Pulsar: 4 mezzanine x 4 cable = 16) x 18 = 288 input cables total 

- Pulsar
- x9

- Pulsar
-     x9

- Pulsar Crate 1

- Pulsar Crate 2

- 144 cables
- from DIRAC
- one
- 40-bit
- word/cable

- 144 cables
- from DIRAC

- 9 slink
- outputs

- 9 slink
- outputs

- Pulsar
- Slink merger
- x6

- PC

- Data transfer latency after L1A is expected to be on average within  10 us
- Note: unlike other L2 paths, CAL data already available at L2 input upon L1A

- Raw data size w/o suppression: 288x40/8 ~1.5KB per evt. With some overhead, < ~ 600 slink words maximum
- w/ suppression, data size should be much less.

## Mezzanine card design concept

- FPGA

- LVDS/TTL chips

- Cable connector

- Pulsar
- side

- Rack door

- 40

- EM         HAD        EM         HAD

- 10bits x4 =40 @ cdfclk

- input data
- per cable

-  JTAG

- Pulsar
- front panel

## Timing Study: Level-2 clustering/MET algorithm

## In order to test the algorithm we stripped out Dcas tower information for several events.

Data samples/events are as follows:
	1)  Dcas strip JET100 (Lum in the range between 1.1%1.7e32 [cm-2 s-1])
	 (350 events)
	2) Dcas strip JET100 plus minimum bias (merged “by hand”) 
	(1500 events)
	3) Dcas strip STT5 (Lum in the range between 1.1%1.7e32 [cm-2 s-1])

CPU and Software Setting
	- AMD Opteron processor (spare L2 decision PC)
	- Maximum priority for algorithm (like in real system )
	- Time stamps before and after algorithm

- Data samples/events are as follows:
- 	1)  Dcas strip JET100 (Lum in the range between 1.1%1.7e32 [cm-2 s-1])
- 	 (350 events)
- 	2) Dcas strip JET100 plus minimum bias (merged “by hand”)
- 	(1500 events)
- 	3) Dcas strip STT5 (Lum in the range between 1.1%1.7e32 [cm-2 s-1])
- CPU and Software Setting
- 	- AMD Opteron processor (spare L2 decision PC)
- 	- Maximum priority for algorithm (like in real system )
- 	- Time stamps before and after algorithm

- Method

## As input we assume all the non-zero Et towers and for each tower the following information are provided:
	- phi and eta index 
	- Had Em Energy
The Algorithm performs the following steps:
	1)  For each tower: Sum Em and Had, mark as seed/shoulders according to thresholds(3 GeV for seeds and 0.5 GeV for shoulders).
	2)  MET calculation(this operation could be done while looping on all the input towers for the previous item). 
	3)  Sort the seeds in decreasing Et. _x0018__x0013_
	4) L2cones generation. Beginning with the first seed:sum the Et of all the towers (seeds/shoulders) in a cone around (R<0.7). Mark all towers used in the L2cone as used   and then move to the next seed not marked as used and repeat. When seeds list is exhausted return a list of the first 20 L2cones.
	5)  Sort the clusters in decreasing Et.

- 	- phi and eta index
- 	- Had Em Energy
**The Algorithm performs the following steps:**
- 	1)  For each tower: Sum Em and Had, mark as seed/shoulders according to thresholds(3 GeV for seeds and 0.5 GeV for shoulders).
- 	2)  MET calculation(this operation could be done while looping on all the input towers for the previous item).
- 	3)  Sort the seeds in decreasing Et. _x0018__x0013_
- 	4) L2cones generation. Beginning with the first seed:sum the Et of all the towers (seeds/shoulders) in a cone around (R<0.7). Mark all towers used in the L2cone as *used   *and then move to the next seed not marked as *used *and repeat. When seeds list is exhausted return a list of the first 20 L2cones.
- 	5)  Sort the clusters in decreasing Et.

- Description of the algorithm

## Timing Analysis-First Steps

**2 months ago**** ****(on desktop)**
**Sample: ****Dcas strip JET70 (Lum in the range between 4-6e****30**** [cm****-2**** s****-1****])**** **
**Average Time :**** few hundred us**
**In a first version of the algorithm:**
**	****	****Sorting Op. of all the input towers very critical (about 60 us)**
** ****1 months ago ****(on L2 Decision CPU)**
**Sample: ****Dcas strip JET70 (Lum in the range between 4-6e****30**** [cm****-2**** s****-1****])**** **
**Average Time :**** 14.4 us**
**New version of the algorithm:**
**	****	****We perform sorting operation only for seeds and clusters**
**	****	****L2Cone generation was the main contribution to timing**
**	****	****We changed code style to improve timing**
** ****2 weeks ago ****(on L2 Decision CPU)**
**Sample: ****Dcas strip JET70 (Lum in the range between 4-6e****30**** [cm****-2**** s****-1****])**** **
**Changes in Code style, introduction of look-up tables to address directly shoulders for each seed => ****SEE NEXT SLIDE**** **

## Timing for clustering with/out LUT

- Data : 33 Jet70 events (Range Lum=4-6 1031)
- Average timing without LUT =10 us and tail up to 28 us
- Average timing with LUT =1.7 us and tail up to 4 us
- Now the MET timing is comparable to clustering timing
- => see next

## MET timing

- New Version

- First Version

- Worst Case

- Work in progress....

## Timing Analysis: Now

- This includes everything: Met+Clustering+Sorting

- Jet100 sample

- Jet100 sample+minimum bias

- STT5 sample

**Range of Luminosity: 110%170e****30**** [cm****-2**** s****-1****]**

**=>Goal<20 us on average**

## Timing Analysis vs Lum

**Instantaneous Lum [cm****-2**** s****-1****]**

## Extreme Case (Not realistic)

-  => 576 Inputs Towers
-  => Seed Energy Treshold = 0 GeV

- With maximum #of clusters (20)

- Work ongoing..

**Jet100 sample**
**Input Towers Distribution (Non-Zero Et )**

**Seed Distribution (Et>= 3 GeV)**

## Conclusion

- Hardware Tasks described:
- Input LVDS signal splitting
- Mezzanine card design (very similar to other designed for other L2 trigger paths)
- Pulsar firmware (very simple)

- Clustering algorithm code:
- The code is also already optimized to a point where the performance is quite good.
- There is room for more improvements.