ATLAS Offline Software
Loading...
Searching...
No Matches
LVL1BS::ModifySlices Class Reference

Utility to modify the number of slices. More...

#include <ModifySlices.h>

Collaboration diagram for LVL1BS::ModifySlices:

Public Member Functions

 ModifySlices ()
 ~ModifySlices ()

Static Public Member Functions

static int peak (int oldPeak, int oldSlices, int newSlices)
 Return new triggered slice offset.
static void data (const std::vector< int > &oldVec, std::vector< int > &newVec, int newSlices)
 Return modified data vector<int>
static void data (const std::vector< unsigned int > &oldVec, std::vector< unsigned int > &newVec, int newSlices)
 Return modified data vector<unsigned int>

Detailed Description

Utility to modify the number of slices.

Author
Peter Faulkner

Definition at line 17 of file ModifySlices.h.

Constructor & Destructor Documentation

◆ ModifySlices()

LVL1BS::ModifySlices::ModifySlices ( )

◆ ~ModifySlices()

LVL1BS::ModifySlices::~ModifySlices ( )

Member Function Documentation

◆ data() [1/2]

void LVL1BS::ModifySlices::data ( const std::vector< int > & oldVec,
std::vector< int > & newVec,
int newSlices )
static

Return modified data vector<int>

Definition at line 20 of file ModifySlices.cxx.

22{
23 const int oldSlices = oldVec.size();
24 const int offset = (newSlices - oldSlices)/2;
25 newVec.resize(newSlices);
26 for (int sl = 0; sl < newSlices; ++sl) {
27 const int oldSl = sl - offset;
28 if (oldSl < 0) newVec[sl] = oldVec[0];
29 else if (oldSl >= oldSlices) newVec[sl] = oldVec[oldSlices - 1];
30 else newVec[sl] = oldVec[oldSl];
31 }
32}

◆ data() [2/2]

void LVL1BS::ModifySlices::data ( const std::vector< unsigned int > & oldVec,
std::vector< unsigned int > & newVec,
int newSlices )
static

Return modified data vector<unsigned int>

Definition at line 36 of file ModifySlices.cxx.

39{
40 const int oldSlices = oldVec.size();
41 const int offset = (newSlices - oldSlices)/2;
42 newVec.resize(newSlices);
43 for (int sl = 0; sl < newSlices; ++sl) {
44 const int oldSl = sl - offset;
45 if (oldSl < 0) newVec[sl] = oldVec[0];
46 else if (oldSl >= oldSlices) newVec[sl] = oldVec[oldSlices - 1];
47 else newVec[sl] = oldVec[oldSl];
48 }
49}

◆ peak()

int LVL1BS::ModifySlices::peak ( int oldPeak,
int oldSlices,
int newSlices )
static

Return new triggered slice offset.

Definition at line 12 of file ModifySlices.cxx.

14{
15 return oldPeak + (newSlices - oldSlices)/2;
16}

The documentation for this class was generated from the following files: