200 likes | 353 Views
Intelligent (or not completely stupid) Unpacking. Structure and Timing Studies of the Level 3 Calorimeter Unpacking Tool l3tCalUnp. Calorimeter Unpacker L3TCalUnp. Level 3 unpacking tool. Selectively unpacks sections of the calorimeter according to input directives:
E N D
Intelligent (or not completely stupid) Unpacking Structure and Timing Studies of the Level 3 Calorimeter Unpacking Tool l3tCalUnp
Calorimeter UnpackerL3TCalUnp • Level 3 unpacking tool. • Selectively unpacks sections of the calorimeter according to input directives: • Level 1 & 2 seed towers • Entire calorimeter • By region • Size of neighborhood to unpack • Energy thresholds • Hot cell flagging thresholds
Low Level Structure • The calorimeter unpacker will share many low level unpacking routines with other subdetectors. • Reads in RawDataChunks, and accesses them on a per-module (ADC card) basis, which is the granularity of the unpacker. This means that if you ask for 1 channel in a module, the unpacker will unpack all 384 channel, reducing the time to access other channels in the same module. • No method for getting the L2 trigger seed tower information exists, so artificially creates seed towers according to various RCP flags.
Data Structure • static float CalUnpData[Neta][Nphi][Nlayer] • Neta = 74 • Nphi = 64 • Nlayer = 18 • array of cell energies and towers (layer = 0) • static vector<float *> CalUnpEt • pointers toCalUnpData[eta][phi][0] towers • for new towers with energy deposits • various helper routines to access position information, hotcells, to go between array indices, array addresses, and physics indices, etc
Memory Requirements • CalUnpData: 85248 entries = 333.0 kB • only 47456 valid cell addresses • CalUnpEt: ~18kB (10 % calorimeter occupancy) • various other internal data: ~10kB • memory is allocated at beginning of run, and reused. Very little dynamic memory allocation occurs. • Big, with lots of empty space.
Initial Setup : MakeMe() • Initialize CalUnpData, and other variables • Reserve space for all stl objects • Calculate and fill lookup tables • Queries run_config_mgr to determine hardware configuration, then builds translation tables between (moduleID, crateID) and (crate number, slot number) • Load CalGainTable
Unpacking Procedure : DoThisTool(---) • The DoThisTool() method has been overloaded, so as to tell the unpacker which regions of the calorimeter are to be unpacked. It will currently take: • DoThisTool() • DoThisTool(vector<TowerAddress> &TA) • DoThisTool(vector<TriggerTowerAddress> &TTA) • DoThisTool(vector<short> &eta, vector<short>&phi) • DoThisTool(vector<float> &eta, vector<float>&phi) • DoThisTool(L3Region &) • DoThisTool(L2Seeds &)
Unpacking Procedure : DoThisTool() • Reset vector of CalUnpEt • Loop over requested seed towers • Identify neighbors (radius n), form list of towers to unpack • Loop over selected towers • Identify associated module(s) (ADC card) • If the module is not already unpacked, unpack it into CalUnpData • For all cells in module, calculate energy if has non-zero ADC count • Add current tower to list of populated towers • For all newly populated towers, calculate tower energy, place in layer 0 of CalUnpData
Unpacking Procedure : Whole Calorimeter • Reset CalUnpEt • Get all modules in the calorimeter • Hopefully, this type of unpacking will be called after directed unpacking has already occurred • Loop over all (new) modules • For each cell, calculate energy • Set flag showing tower has energy deposits • For all (new) towers with energy deposits, calculate tower energy
Unpacking Procedure (cont) • Do something with hotcells • When all selected towers have been processed, fill a vector (CalUnpEt) of pointers to layer 0 of CalUnpData array for all new towers that have energy deposited in them. • Sort CalUnpEt according to Et of associated tower in a decreasing order. • Assumes vertex = (0,0,0) - may apply correction for other vertices • expensive - requires atan(e -): uses a lookup table instead of calculating it each time
Unpacking Procedure: Reset() • Loop over all unpacked towers and cells, and zero CalUnpData • Reset vector of all unpacked modules • Reset vector of all unpacked towers • Accumulate statistics for hot cell killer
Timing Studies • Majority of time spent in low level routines, such as extracting the module ID for a given seed tower, or translating physics cell addresses to electronic addresses. Already uses lookup tables for some of this, may use more. • Significant time spent sorting and unique-ing vectors. • Time does not rise linearly with number of cells/towers unpacked. • Impossible to say if current implementation is satisfactory, as we don’t have an optimized version of the D0RunII software that runs on NT • WAY OUT OF DATE
Timing Results t-tbar sample, no lookup tables running on d02ka
Timing Results Using lookup tables
Timing Results Unpacking Entire Detector
Timing Results Directed unpacking, trigger threshold = 0.5GeV
Timing Results Directed unpacking, trigger tower energy > 2 GeV
Timing Results Directed unpacking, trigger tower energy > 2 GeV, radius = 7 towers
Timing Results Directed unpacking, trigger tower energy > 5 GeV
Timing Results Directed unpacking, trigger tower energy > 5.0 GeV, neighborhood = 7