CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
l1t::Stage1Layer2CentralityAlgorithm Class Reference

#include <Stage1Layer2HFRingSumAlgorithmImp.h>

Inheritance diagram for l1t::Stage1Layer2CentralityAlgorithm:
l1t::Stage1Layer2HFRingSumAlgorithm

Public Member Functions

virtual void processEvent (const std::vector< l1t::CaloRegion > &regions, const std::vector< l1t::CaloEmCand > &EMCands, const std::vector< l1t::Tau > *taus, l1t::CaloSpare *spare)
 
 Stage1Layer2CentralityAlgorithm (CaloParamsHelper *params)
 
virtual ~Stage1Layer2CentralityAlgorithm ()
 
- Public Member Functions inherited from l1t::Stage1Layer2HFRingSumAlgorithm
virtual ~Stage1Layer2HFRingSumAlgorithm ()
 

Private Attributes

CaloParamsHelperparams_
 

Detailed Description

Authors
: Gian Michele Innocenti R. Alex Barbieri

Description: Centrality Algorithm HI

Definition at line 42 of file Stage1Layer2HFRingSumAlgorithmImp.h.

Constructor & Destructor Documentation

l1t::Stage1Layer2CentralityAlgorithm::Stage1Layer2CentralityAlgorithm ( CaloParamsHelper params)

Definition at line 14 of file Stage1Layer2CentralityAlgorithm.cc.

15  : params_(params)
16 {}
l1t::Stage1Layer2CentralityAlgorithm::~Stage1Layer2CentralityAlgorithm ( )
virtual

Definition at line 19 of file Stage1Layer2CentralityAlgorithm.cc.

20 {}

Member Function Documentation

void l1t::Stage1Layer2CentralityAlgorithm::processEvent ( const std::vector< l1t::CaloRegion > &  regions,
const std::vector< l1t::CaloEmCand > &  EMCands,
const std::vector< l1t::Tau > *  taus,
l1t::CaloSpare spare 
)
virtual

Implements l1t::Stage1Layer2HFRingSumAlgorithm.

Definition at line 23 of file Stage1Layer2CentralityAlgorithm.cc.

References bits, gather_cfg::cout, l1t::L1Candidate::hwPt(), i, j, HLT_25ns14e33_v3_cff::region, l1t::CaloSpare::SetRing(), and cond::to_string().

26  {
27 
28  // This is no really two algorithms, the first is the HI centrality algorithm
29  // while the second is an alternative MB trigger.
30 
31  // Begin Centrality Trigger //
32  int etaMask = params_->centralityRegionMask();
33  int sumET = 0;
34  int regionET=0;
35 
36  for(std::vector<CaloRegion>::const_iterator region = regions.begin(); region != regions.end(); region++) {
37 
38  int etaVal = region->hwEta();
39  if (etaVal > 3 && etaVal < 18) continue; // never consider central regions, independent of mask
40  if((etaMask & (1<<etaVal))>>etaVal) continue;
41 
42  regionET=region->hwPt();
43  sumET +=regionET;
44  }
45 
46  // The LUT format is pretty funky.
47  int LUT_under[8];
48  int LUT_nominal[8];
49  int LUT_over[8];
50  for(int i = 0; i < 8; ++i)
51  {
52  LUT_nominal[i] = params_->centralityLUT()->data(i);
53  }
54  LUT_under[0] = LUT_nominal[0];
55  LUT_over[0] = LUT_nominal[0];
56  for(int i = 8; i < 22; ++i)
57  {
58  int j=i-8;
59  if(j%2 == 0){
60  LUT_under[j/2+1] = params_->centralityLUT()->data(i);
61  } else {
62  LUT_over[j/2+1] = params_->centralityLUT()->data(i);
63  }
64  }
65 
66  int regularResult = 0;
67  int underlapResult = 0;
68  int overlapResult = 0;
69 
70  for(int i = 0; i < 8; ++i)
71  {
72  if(sumET > LUT_nominal[i])
73  regularResult = i;
74  if(sumET > LUT_under[i])
75  underlapResult = i;
76  if(sumET >= LUT_over[i]) // logical expression in firmware is constructed slightly differently, but this is equivalent
77  overlapResult = i;
78  }
79 
80  int alternateResult = 0;
81  if(underlapResult > regularResult) {
82  alternateResult = underlapResult;
83  } else if(overlapResult < regularResult) {
84  alternateResult = overlapResult;
85  } else {
86  alternateResult = regularResult;
87  }
88 
89  //paranoia
90  if(regularResult > 0x7) regularResult = 0x7;
91  if(alternateResult > 0x7) alternateResult = 0x7;
92 
93  spare->SetRing(0, regularResult);
94  spare->SetRing(1, alternateResult);
95  // End Centrality Trigger //
96 
97  // Begin MB Trigger //
98  std::vector<int> thresholds = params_->minimumBiasThresholds();
99  int numOverThresh[4] = {0};
100  for(std::vector<CaloRegion>::const_iterator region = regions.begin(); region != regions.end(); region++) {
101  if(region->hwEta() < 4) {
102  if(region->hwPt() >= thresholds.at(0))
103  numOverThresh[0]++;
104  if(region->hwPt() >= thresholds.at(2))
105  numOverThresh[2]++;
106  }
107  if(region->hwEta() > 17) {
108  if(region->hwPt() >= thresholds.at(1))
109  numOverThresh[1]++;
110  if(region->hwPt() >= thresholds.at(3))
111  numOverThresh[3]++;
112  }
113  }
114 
115  int bits[6];
116  bits[0] = ((numOverThresh[0] > 0) && (numOverThresh[1] > 0));
117  bits[1] = ((numOverThresh[0] > 0) || (numOverThresh[1] > 0));
118  bits[2] = ((numOverThresh[2] > 0) && (numOverThresh[3] > 0));
119  bits[3] = ((numOverThresh[2] > 0) || (numOverThresh[3] > 0));
120  bits[4] = ((numOverThresh[0] > 1) && (numOverThresh[1] > 1));
121  bits[5] = ((numOverThresh[2] > 1) && (numOverThresh[3] > 1));
122 
123  spare->SetRing(2, (bits[2]<<2) + (bits[1]<<1) + bits[0]);
124  spare->SetRing(3, (bits[5]<<2) + (bits[4]<<1) + bits[3]);
125  // End MB Trigger //
126 
127  const bool verbose = false;
128  const bool hex = true;
129  if(verbose)
130  {
131  if(!hex)
132  {
133  std::cout << "HF Ring Sums (Centrality)" << std::endl;
134  std::cout << bitset<12>(spare->hwPt()).to_string() << std::endl;
135  } else {
136  std::cout << "Centrality" << std::endl;
137  std::cout << std::hex << spare->hwPt() << std::endl;
138  // std::cout << std::hex << spare->GetRing(0) << " "
139  // << spare->GetRing(1) << " "
140  // << bits[0] << " " << bits[1] << " "
141  // << bits[2] << " " << bits[3] << " "
142  // << bits[4] << " " << bits[5] << std::endl;
143  }
144  }
145 
146 }
int i
Definition: DBlmapReader.cc:9
int centralityRegionMask() const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision bits
void SetRing(unsigned index, int value)
Definition: CaloSpare.cc:42
std::string to_string(const T &t)
Definition: Logger.cc:26
std::vector< int > minimumBiasThresholds() const
int j
Definition: DBlmapReader.cc:9
int hwPt() const
Definition: L1Candidate.cc:69
tuple cout
Definition: gather_cfg.py:121
int data(unsigned int address) const
Definition: LUT.h:46

Member Data Documentation

CaloParamsHelper* l1t::Stage1Layer2CentralityAlgorithm::params_
private

Definition at line 52 of file Stage1Layer2HFRingSumAlgorithmImp.h.