CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
L1TLSBlock Class Reference

#include <L1TLSBlock.h>

Public Types

enum  BLOCKBY { STATISTICS, N_BLOCKINGBY }
 
typedef std::pair< int, int > LumiRange
 
typedef std::vector< LumiRangeLumiRangeList
 
typedef std::vector< std::pair< int, double > > LumiTestDoubleList
 
typedef std::vector< std::pair< int, double > > LumiTestIntList
 

Public Member Functions

LumiRangeList doBlocking (const LumiTestDoubleList &, double, BLOCKBY)
 
LumiRangeList doBlocking (const LumiTestIntList &, int, BLOCKBY)
 
 L1TLSBlock ()
 
virtual ~L1TLSBlock ()
 

Private Member Functions

void blockByStatistics ()
 
double computeErrorFromRange (LumiRange &)
 
void initializeIO (bool)
 
void orderTestDoubleList ()
 
void orderTestIntList ()
 

Private Attributes

LumiTestDoubleList inputDoubleList_
 
LumiTestIntList inputIntList_
 
LumiRangeList outputList_
 
double thresholdD_
 
int thresholdI_
 

Detailed Description

Description: offline DQM class for LS blocking

Implementation: <TODO: enter implementation details>

Author
: Pietro Vischia - LIP Lisbon pietr.nosp@m.o.vi.nosp@m.schia.nosp@m.@gma.nosp@m.il.co.nosp@m.m

Changelog: 2012/10/23 12:01:01: Creation, infrastructure and blocking by statistics

Todo:

Description: offline DQM class for LS blocking

Implementation: <TODO: enter implementation details>

Author
: Pietro Vischia - LIP Lisbon pietr.nosp@m.o.vi.nosp@m.schia.nosp@m.@gma.nosp@m.il.co.nosp@m.m

Changelog: 2012/10/23 12:01:01: Class

Todo: see header file

Definition at line 69 of file L1TLSBlock.h.

Member Typedef Documentation

◆ LumiRange

typedef std::pair<int, int> L1TLSBlock::LumiRange

Definition at line 74 of file L1TLSBlock.h.

◆ LumiRangeList

typedef std::vector<LumiRange> L1TLSBlock::LumiRangeList

Definition at line 75 of file L1TLSBlock.h.

◆ LumiTestDoubleList

typedef std::vector<std::pair<int, double> > L1TLSBlock::LumiTestDoubleList

Definition at line 72 of file L1TLSBlock.h.

◆ LumiTestIntList

typedef std::vector<std::pair<int, double> > L1TLSBlock::LumiTestIntList

Definition at line 73 of file L1TLSBlock.h.

Member Enumeration Documentation

◆ BLOCKBY

Enumerator
STATISTICS 
N_BLOCKINGBY 

Definition at line 77 of file L1TLSBlock.h.

Constructor & Destructor Documentation

◆ L1TLSBlock()

L1TLSBlock::L1TLSBlock ( )

Definition at line 62 of file L1TLSBlock.cc.

62  {
63  // Initialize LumiRangeList object. This will be redone at every doBlocking call. Perhaps rethink this
64  initializeIO(false);
65 }
void initializeIO(bool)
Definition: L1TLSBlock.cc:125

◆ ~L1TLSBlock()

L1TLSBlock::~L1TLSBlock ( )
virtual

Definition at line 70 of file L1TLSBlock.cc.

70 {}

Member Function Documentation

◆ blockByStatistics()

void L1TLSBlock::blockByStatistics ( )
private

Definition at line 151 of file L1TLSBlock.cc.

References mps_fire::i.

151  {
152  LumiRange currentRange;
153  double currentError(0);
154  bool resetFlag(true);
155 
156  for (LumiTestDoubleList::iterator i = inputDoubleList_.begin(); i != inputDoubleList_.end(); i++) {
157  if (resetFlag) {
158  currentRange = std::make_pair(i->first, i->first);
159  resetFlag = false;
160  } else
161  currentRange = std::make_pair(currentRange.first, i->first);
162  currentError = computeErrorFromRange(currentRange);
163  if (currentError < thresholdD_) {
164  outputList_.push_back(currentRange);
165  resetFlag = true;
166  }
167  }
168 }
LumiRangeList outputList_
Definition: L1TLSBlock.h:100
std::pair< int, int > LumiRange
Definition: L1TLSBlock.h:74
double computeErrorFromRange(LumiRange &)
Definition: L1TLSBlock.cc:170
LumiTestDoubleList inputDoubleList_
Definition: L1TLSBlock.h:99
double thresholdD_
Definition: L1TLSBlock.h:101

◆ computeErrorFromRange()

double L1TLSBlock::computeErrorFromRange ( LumiRange lumiRange)
private

Definition at line 170 of file L1TLSBlock.cc.

References relativeConstraints::error, first, mps_fire::i, lumiRange, and edm::second().

170  {
171  std::vector<double> errorList;
172  errorList.clear();
173 
174  for (size_t i = 0; i < inputDoubleList_.size(); i++) {
175  if (inputDoubleList_[i].first > lumiRange.first && inputDoubleList_[i].first < lumiRange.second)
176  errorList.push_back(inputDoubleList_[i].second);
177  }
178 
179  double error(-1);
180  for (size_t i = 0; i < errorList.size(); i++)
181  error += 1 / (errorList[i] * errorList[i]);
182  return error;
183 }
U second(std::pair< T, U > const &p)
LumiTestDoubleList inputDoubleList_
Definition: L1TLSBlock.h:99
string lumiRange

◆ doBlocking() [1/2]

L1TLSBlock::LumiRangeList L1TLSBlock::doBlocking ( const LumiTestDoubleList inputList,
double  threshold,
BLOCKBY  blockingMethod 
)

Definition at line 75 of file L1TLSBlock.cc.

References gather_cfg::cout, and remoteMonitoring_LASER_era2018_cfg::threshold.

77  {
78  inputDoubleList_ = inputList;
80 
81  initializeIO(true);
82 
84 
85  switch (blockingMethod) {
86  case STATISTICS:
88  break;
89  default:
90  cout << "[L1TLSBlock::doBlocking()]: Blocking method does not exist or is not implemented" << endl;
91  }
92 
93  return outputList_;
94 }
LumiRangeList outputList_
Definition: L1TLSBlock.h:100
void blockByStatistics()
Definition: L1TLSBlock.cc:151
LumiTestDoubleList inputDoubleList_
Definition: L1TLSBlock.h:99
double thresholdD_
Definition: L1TLSBlock.h:101
void orderTestDoubleList()
Definition: L1TLSBlock.cc:136
void initializeIO(bool)
Definition: L1TLSBlock.cc:125

◆ doBlocking() [2/2]

L1TLSBlock::LumiRangeList L1TLSBlock::doBlocking ( const LumiTestIntList inputList,
int  threshold,
BLOCKBY  blockingMethod 
)

Definition at line 99 of file L1TLSBlock.cc.

References gather_cfg::cout, and remoteMonitoring_LASER_era2018_cfg::threshold.

101  {
102  inputIntList_ = inputList;
104 
105  initializeIO(true);
106 
108 
109  switch (blockingMethod) {
110  case STATISTICS:
111  cout << "[L1TLSBlock::doBlocking()]: Blocking by statistics require doubles as inputs for test variable and "
112  "threshold"
113  << endl;
114  break;
115  default:
116  cout << "[L1TLSBlock::doBlocking()]: Blocking method does not exist or is not implemented" << endl;
117  }
118 
119  return outputList_;
120 }
LumiRangeList outputList_
Definition: L1TLSBlock.h:100
void orderTestIntList()
Definition: L1TLSBlock.cc:144
LumiTestIntList inputIntList_
Definition: L1TLSBlock.h:98
int thresholdI_
Definition: L1TLSBlock.h:102
void initializeIO(bool)
Definition: L1TLSBlock.cc:125

◆ initializeIO()

void L1TLSBlock::initializeIO ( bool  outputOnly)
private

Definition at line 125 of file L1TLSBlock.cc.

125  {
126  if (!outputOnly) {
127  inputIntList_.clear();
128  inputDoubleList_.clear();
129  }
130  outputList_.clear();
131 }
LumiRangeList outputList_
Definition: L1TLSBlock.h:100
LumiTestIntList inputIntList_
Definition: L1TLSBlock.h:98
LumiTestDoubleList inputDoubleList_
Definition: L1TLSBlock.h:99

◆ orderTestDoubleList()

void L1TLSBlock::orderTestDoubleList ( )
private

Definition at line 136 of file L1TLSBlock.cc.

References jetUpdater_cfi::sort.

136  {
138  // std::sort(v.begin(), v.end(), sort_pair_second<int, std::greater<int> >());
139 }
LumiTestDoubleList inputDoubleList_
Definition: L1TLSBlock.h:99

◆ orderTestIntList()

void L1TLSBlock::orderTestIntList ( )
private

Definition at line 144 of file L1TLSBlock.cc.

References jetUpdater_cfi::sort.

144  {
146 }
LumiTestIntList inputIntList_
Definition: L1TLSBlock.h:98

Member Data Documentation

◆ inputDoubleList_

LumiTestDoubleList L1TLSBlock::inputDoubleList_
private

Definition at line 99 of file L1TLSBlock.h.

◆ inputIntList_

LumiTestIntList L1TLSBlock::inputIntList_
private

Definition at line 98 of file L1TLSBlock.h.

◆ outputList_

LumiRangeList L1TLSBlock::outputList_
private

Definition at line 100 of file L1TLSBlock.h.

◆ thresholdD_

double L1TLSBlock::thresholdD_
private

Definition at line 101 of file L1TLSBlock.h.

◆ thresholdI_

int L1TLSBlock::thresholdI_
private

Definition at line 102 of file L1TLSBlock.h.