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 }

◆ ~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.

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 }

References mps_fire::i.

◆ computeErrorFromRange()

double L1TLSBlock::computeErrorFromRange ( LumiRange lumiRange)
private

Definition at line 170 of file L1TLSBlock.cc.

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 }

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

◆ doBlocking() [1/2]

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

Definition at line 75 of file L1TLSBlock.cc.

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 }

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

◆ doBlocking() [2/2]

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

Definition at line 99 of file L1TLSBlock.cc.

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 }

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

◆ 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 }

◆ orderTestDoubleList()

void L1TLSBlock::orderTestDoubleList ( )
private

Definition at line 136 of file L1TLSBlock.cc.

136  {
138  // std::sort(v.begin(), v.end(), sort_pair_second<int, std::greater<int> >());
139 }

References jetUpdater_cfi::sort.

◆ orderTestIntList()

void L1TLSBlock::orderTestIntList ( )
private

Definition at line 144 of file L1TLSBlock.cc.

144  {
146 }

References jetUpdater_cfi::sort.

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.

L1TLSBlock::orderTestIntList
void orderTestIntList()
Definition: L1TLSBlock.cc:144
mps_fire.i
i
Definition: mps_fire.py:428
L1TLSBlock::inputDoubleList_
LumiTestDoubleList inputDoubleList_
Definition: L1TLSBlock.h:99
gather_cfg.cout
cout
Definition: gather_cfg.py:144
L1TLSBlock::thresholdI_
int thresholdI_
Definition: L1TLSBlock.h:102
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
relativeConstraints.error
error
Definition: relativeConstraints.py:53
sort_pair_first
Definition: L1TLSBlock.h:61
L1TLSBlock::computeErrorFromRange
double computeErrorFromRange(LumiRange &)
Definition: L1TLSBlock.cc:170
L1TLSBlock::N_BLOCKINGBY
Definition: L1TLSBlock.h:77
L1TLSBlock::initializeIO
void initializeIO(bool)
Definition: L1TLSBlock.cc:125
L1TLSBlock::outputList_
LumiRangeList outputList_
Definition: L1TLSBlock.h:100
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
L1TLSBlock::thresholdD_
double thresholdD_
Definition: L1TLSBlock.h:101
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
L1TLSBlock::blockByStatistics
void blockByStatistics()
Definition: L1TLSBlock.cc:151
L1TLSBlock::STATISTICS
Definition: L1TLSBlock.h:77
L1TLSBlock::LumiRange
std::pair< int, int > LumiRange
Definition: L1TLSBlock.h:74
remoteMonitoring_LED_IterMethod_cfg.threshold
threshold
Definition: remoteMonitoring_LED_IterMethod_cfg.py:430
L1TLSBlock::inputIntList_
LumiTestIntList inputIntList_
Definition: L1TLSBlock.h:98
L1TLSBlock::orderTestDoubleList
void orderTestDoubleList()
Definition: L1TLSBlock.cc:136