CMS 3D CMS Logo

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

#include <RPCLogCone.h>

Public Types

typedef std::map< int, std::vector< int > > TLogPlane
 

Public Member Functions

bool addLogHit (const RPCLogHit &logHit)
 Adds next logHit . More...
 
unsigned long long getCompressedCone ()
 Compresses cone. Throws exception, if there is more than one hit in any logplane. More...
 
RPCConst::l1RpcConeCrdnts getConeCrdnts () const
 
int getFiredPlanesCnt () const
 
int getHitsCnt (int logPlane) const
 Gets fired strips count in given logPlane. More...
 
int getIdx () const
 
TLogPlane getLogPlane (int logPlane) const
 
int getLogSector () const
 
int getLogSegment () const
 
std::vector< int > getLogStripDigisIdxs (int logPlane, unsigned int logStripNum) const
 
bool getLogStripState (int logPlane, unsigned int logStripNum) const
 
int getMuonCode () const
 
int getMuonSign () const
 
int getTower () const
 
bool isPlaneFired (int logPlane) const
 
int possibleTrigger () const
 
 RPCLogCone ()
 Default constructor. No hits, no muon. More...
 
 RPCLogCone (const RPCLogHit &logHit)
 Constructor. One hit is added, cone coordinates are set from logHit. More...
 
 RPCLogCone (const unsigned long long &pat, int tower, int logSector, int logSegment)
 Constructor. The cone is built from unsigned long long. More...
 
 RPCLogCone (int m_tower, int logSector, int logSegment)
 Constructor. Cone coordinates are set. More...
 
void setIdx (int index)
 
void setLogStrip (int logPlane, int logStripNum)
 Set logic strip as fired. More...
 
void setLogStrip (int logPlane, int logStripNum, int m_digiIdx)
 Set logic strip as fired. m_digiIdx - index of digi in digis vector stored by L1RpcTrigg. More...
 
void setMuonCode (int code)
 sets pt code of muon that fired the strips *‍/ More...
 
void setMuonSign (int sign)
 
void shift (int pos)
 Changes fired LogStrips: from "stripNum" to "stripNum + pos". More...
 
std::string toString () const
 

Private Attributes

RPCConst::l1RpcConeCrdnts m_ConeCrdnts
 
std::vector< std::vector< int > > m_DigisIdx
 
int m_Index
 m_Index in LogConesVec stored by L1RpcTrigg More...
 
std::vector< TLogPlanem_LogPlanesVec
 Logic Planes. More...
 
int m_MuonCode
 
int m_MuonSign
 

Detailed Description

The input for m_PAC. State of strips in smalest unit of volum in RPC trigger system (Logic Cone), defined by 8 strips of reference plane.

Author
Karol Bunkowski (Warsaw),
Porting to CMSSW - Tomasz Frueboes

Definition at line 23 of file RPCLogCone.h.

Member Typedef Documentation

◆ TLogPlane

typedef std::map<int, std::vector<int> > RPCLogCone::TLogPlane

Hits in one Logic Plane, if strips is fired, its number is added to the map as a key. Vector stores the indexes in DigisVec (stored in L1RpcTrigg) of Digis that formed log hits Logic m_Strips are diferent from RPC strips - Logic m_Strips it is usaly OR of 2 RPC strips with diferent eta (but the same phi).

See also
RPCLogHit

Definition at line 30 of file RPCLogCone.h.

Constructor & Destructor Documentation

◆ RPCLogCone() [1/4]

RPCLogCone::RPCLogCone ( )

Default constructor. No hits, no muon.

Default constructor. No hits, no muon.

Definition at line 18 of file RPCLogCone.cc.

19  : m_ConeCrdnts() {
21  m_MuonCode = 0;
22  m_MuonSign = 0;

◆ RPCLogCone() [2/4]

RPCLogCone::RPCLogCone ( int  tower,
int  logSector,
int  logSegment 
)

Constructor. Cone coordinates are set.

Constructor. Cone coordinates are set.

Definition at line 29 of file RPCLogCone.cc.

30  : m_ConeCrdnts(tower, logSector, logSegment) {
32  m_MuonCode = 0;
33  m_MuonSign = 0;

◆ RPCLogCone() [3/4]

RPCLogCone::RPCLogCone ( const RPCLogHit logHit)

Constructor. One hit is added, cone coordinates are set from logHit.

Copying Constructor

Definition at line 39 of file RPCLogCone.cc.

40  {
42 
43  m_ConeCrdnts = logHit.getConeCrdnts();
44 
45  m_MuonCode = 0;
46  m_MuonSign = 0;
47 
48  setLogStrip(logHit.getlogPlaneNumber() - 1, logHit.getStripNumberInCone(), logHit.getDigiIdx());

◆ RPCLogCone() [4/4]

RPCLogCone::RPCLogCone ( const unsigned long long &  pat,
int  tower,
int  logSector,
int  logSegment 
)

Constructor. The cone is built from unsigned long long.

Definition at line 50 of file RPCLogCone.cc.

52  : m_ConeCrdnts(tower, logSector, logSegment) {
54  m_MuonCode = 0;
55  m_MuonSign = 0;
56 
57  unsigned long long int mask = 255; // (first 8 bits)
58  int shift = 0;
59 
60  //std::cout << "Decompressing pattern: " << pat << std::endl;
61  for (int logplane = RPCConst::m_FIRST_PLANE; logplane != RPCConst::m_USED_PLANES_COUNT[std::abs(getTower())];
62  ++logplane) {
63  unsigned int strip = (pat & (mask << shift)) >> shift;
64  //std::cout << logplane << " " << strip << std::endl;
65  shift += 8;
66  // We should prob. use m_NOT_CONNECTED value
67  if (strip != RPCConst::m_LOGPLANE_SIZE[std::abs(getTower())][logplane])
68  setLogStrip(logplane, strip);
69  }

References funct::abs(), getTower(), RPCConst::m_FIRST_PLANE, RPCConst::m_LOGPLANE_SIZE, RPCConst::m_LOGPLANES_COUNT, m_LogPlanesVec, m_MuonCode, m_MuonSign, RPCConst::m_USED_PLANES_COUNT, setLogStrip(), shift(), and digitizers_cfi::strip.

Member Function Documentation

◆ addLogHit()

bool RPCLogCone::addLogHit ( const RPCLogHit logHit)

Adds next logHit .

Adds a loghit to a cone

Definition at line 192 of file RPCLogCone.cc.

193  {
194  if (m_ConeCrdnts.m_Tower == logHit.getTower() && m_ConeCrdnts.m_LogSector == logHit.getLogSector() &&
196  setLogStrip(logHit.getlogPlaneNumber() - 1, logHit.getStripNumberInCone(), logHit.getDigiIdx());
197  return true;
198  } else
199  return false;

◆ getCompressedCone()

unsigned long long RPCLogCone::getCompressedCone ( )

Compresses cone. Throws exception, if there is more than one hit in any logplane.

Definition at line 71 of file RPCLogCone.cc.

72  {
73  unsigned long long int pattern = 0;
74  int shift = 0;
75 
76  for (int logplane = RPCConst::m_FIRST_PLANE; logplane != RPCConst::m_USED_PLANES_COUNT[std::abs(getTower())];
77  logplane++) {
78  unsigned long long int strip;
79  if (getHitsCnt(logplane) == 0) {
80  // We need to mark somehow, that plane is empty (strip 0 is not fired)
82  } else if (getHitsCnt(logplane) == 1) {
83  RPCLogCone::TLogPlane lp = getLogPlane(logplane);
84  strip = lp.begin()->first;
85  } else {
86  throw RPCException("To many hits in logcone");
87  }
88  pattern = pattern | (strip << shift);
89  shift += 8;
90  }
91 
92  //std::cout << " Compressed cone: " << pattern << std::endl;
93  return pattern;

References funct::abs(), getHitsCnt(), getLogPlane(), getTower(), RPCConst::m_FIRST_PLANE, RPCConst::m_LOGPLANE_SIZE, RPCConst::m_USED_PLANES_COUNT, topSingleLeptonDQM_PU_cfi::pattern, shift(), and digitizers_cfi::strip.

◆ getConeCrdnts()

RPCConst::l1RpcConeCrdnts RPCLogCone::getConeCrdnts ( ) const

Definition at line 167 of file RPCLogCone.cc.

References m_ConeCrdnts.

Referenced by RPCTriggerCrate::runCone().

◆ getFiredPlanesCnt()

int RPCLogCone::getFiredPlanesCnt ( ) const

Definition at line 216 of file RPCLogCone.cc.

217  {
218  int firedPlanes = 0;
220  logPlane++) {
221  firedPlanes = firedPlanes + isPlaneFired(logPlane);
222  }
223  return firedPlanes;

References funct::abs(), isPlaneFired(), m_ConeCrdnts, RPCConst::m_FIRST_PLANE, RPCConst::l1RpcConeCrdnts::m_Tower, and RPCConst::m_USED_PLANES_COUNT.

◆ getHitsCnt()

int RPCLogCone::getHitsCnt ( int  logPlane) const

Gets fired strips count in given logPlane.

Definition at line 149 of file RPCLogCone.cc.

Referenced by getCompressedCone(), and RPCPac::runEnergeticPatternsGroups().

◆ getIdx()

int RPCLogCone::getIdx ( ) const

Definition at line 171 of file RPCLogCone.cc.

References m_Index.

Referenced by RPCPac::run().

◆ getLogPlane()

RPCLogCone::TLogPlane RPCLogCone::getLogPlane ( int  logPlane) const

Definition at line 146 of file RPCLogCone.cc.

References m_LogPlanesVec.

Referenced by getCompressedCone(), and RPCPac::runEnergeticPatternsGroups().

◆ getLogSector()

int RPCLogCone::getLogSector ( ) const

Definition at line 163 of file RPCLogCone.cc.

References m_ConeCrdnts, and RPCConst::l1RpcConeCrdnts::m_LogSector.

◆ getLogSegment()

int RPCLogCone::getLogSegment ( ) const

Definition at line 165 of file RPCLogCone.cc.

References m_ConeCrdnts, and RPCConst::l1RpcConeCrdnts::m_LogSegment.

Referenced by RPCTriggerBoard::runCone().

◆ getLogStripDigisIdxs()

std::vector< int > RPCLogCone::getLogStripDigisIdxs ( int  logPlane,
unsigned int  logStripNum 
) const

Get vector of didgis indexes (in digis vector stored by L1RpcTrigg) for given logic strip. If strip was not fired returns empty vector

Definition at line 201 of file RPCLogCone.cc.

202  {
203  TLogPlane::const_iterator it = m_LogPlanesVec[logPlane].find(logStripNum);
204  if (it != m_LogPlanesVec[logPlane].end())
205  return it->second;
206  else
207  return std::vector<int>();

References end, and m_LogPlanesVec.

Referenced by RPCPac::runEnergeticPatternsGroups(), and RPCPac::runTrackPatternsGroup().

◆ getLogStripState()

bool RPCLogCone::getLogStripState ( int  logPlane,
unsigned int  logStripNum 
) const

Get logic strip state.

Returns
true if fired

Definition at line 183 of file RPCLogCone.cc.

184  {
185  return m_LogPlanesVec[logPlane].count(logStripNum);

References m_LogPlanesVec.

Referenced by RPCPac::runEnergeticPatternsGroups(), RPCPac::runTrackPatternsGroup(), and toString().

◆ getMuonCode()

int RPCLogCone::getMuonCode ( ) const
Returns
pt code of muon that fired the strips

Definition at line 155 of file RPCLogCone.cc.

◆ getMuonSign()

int RPCLogCone::getMuonSign ( ) const

Definition at line 159 of file RPCLogCone.cc.

References m_MuonSign.

◆ getTower()

int RPCLogCone::getTower ( ) const

◆ isPlaneFired()

bool RPCLogCone::isPlaneFired ( int  logPlane) const

Definition at line 209 of file RPCLogCone.cc.

210  {
211  if (m_LogPlanesVec[logPlane].empty())
212  return false;
213  else
214  return true;

References relativeConstraints::empty, and m_LogPlanesVec.

Referenced by getFiredPlanesCnt(), and possibleTrigger().

◆ possibleTrigger()

int RPCLogCone::possibleTrigger ( ) const
Returns
0 - trigger not possible, 1 - 3 inner planes fired, 2 - 4 or more planes fired

Definition at line 225 of file RPCLogCone.cc.

226  {
227  int triggerType = 0; //0 - trigger not possible
228  //1 - 3/4 (3 inner planes fired)
229  //2 - 4/6 (four palnes fired)
230  int firedPlanes = 0;
231 
232  int logPlane = RPCConst::m_FIRST_PLANE;
233  for (; logPlane <= RPCConst::m_LOGPLANE4; logPlane++) {
234  firedPlanes = firedPlanes + isPlaneFired(logPlane);
235  }
236  if (firedPlanes >= 3)
237  triggerType = 1;
238 
239  for (; logPlane < RPCConst::m_USED_PLANES_COUNT[abs(m_ConeCrdnts.m_Tower)]; logPlane++) {
240  firedPlanes = firedPlanes + isPlaneFired(logPlane);
241  }
242  if (firedPlanes >= 4)
243  triggerType = 2;
244 
245  return triggerType;

References funct::abs(), isPlaneFired(), m_ConeCrdnts, RPCConst::m_FIRST_PLANE, RPCConst::m_LOGPLANE4, RPCConst::l1RpcConeCrdnts::m_Tower, RPCConst::m_USED_PLANES_COUNT, and HLT_2018_cff::triggerType.

◆ setIdx()

void RPCLogCone::setIdx ( int  index)

Definition at line 169 of file RPCLogCone.cc.

References m_Index.

Referenced by RPCConeBuilderFromES::getConesFromES().

◆ setLogStrip() [1/2]

void RPCLogCone::setLogStrip ( int  logPlane,
int  logStripNum 
)

Set logic strip as fired.

Definition at line 179 of file RPCLogCone.cc.

180  {
181  m_LogPlanesVec[logPlane].insert(TLogPlane::value_type(logStripNum, std::vector<int>()));

References m_LogPlanesVec.

◆ setLogStrip() [2/2]

void RPCLogCone::setLogStrip ( int  logPlane,
int  logStripNum,
int  m_digiIdx 
)

Set logic strip as fired. m_digiIdx - index of digi in digis vector stored by L1RpcTrigg.

Definition at line 173 of file RPCLogCone.cc.

174  {
175  //m_LogPlanesVec[logPlane].insert(logStripNum);
176  //m_LogPlanesVec[logPlane].insert(TLogPlane::value_type(logStripNum, vector<int>()));
177  m_LogPlanesVec[logPlane][logStripNum].push_back(m_digiIdx);

References m_LogPlanesVec.

Referenced by RPCLogCone(), and TPatternsGroup::updateShape().

◆ setMuonCode()

void RPCLogCone::setMuonCode ( int  code)

sets pt code of muon that fired the strips *‍/

Definition at line 152 of file RPCLogCone.cc.

◆ setMuonSign()

void RPCLogCone::setMuonSign ( int  sign)

Definition at line 157 of file RPCLogCone.cc.

References m_MuonSign, and Validation_hcalonly_cfi::sign.

◆ shift()

void RPCLogCone::shift ( int  pos)

Changes fired LogStrips: from "stripNum" to "stripNum + pos".

Definition at line 125 of file RPCLogCone.cc.

126  {
127  int shiftPos;
128  for (int logPlane = RPCConst::m_FIRST_PLANE; logPlane <= RPCConst::m_LAST_PLANE; logPlane++) {
129  TLogPlane shifted;
130  for (TLogPlane::iterator it = m_LogPlanesVec[logPlane].begin(); it != m_LogPlanesVec[logPlane].end(); it++) {
131  shiftPos = it->first + pos;
132  /* std::cout << shiftPos << " "
133  << RPCConst::m_LOGPLANE_SIZE[abs(m_ConeCrdnts.m_Tower)]
134  << std::endl;*/
135  if (shiftPos >= 0 && shiftPos < (int)RPCConst::m_LOGPLANE_SIZE[abs(m_ConeCrdnts.m_Tower)][logPlane])
136  shifted.insert(TLogPlane::value_type(shiftPos, it->second));
137  }
138  m_LogPlanesVec[logPlane] = shifted;
139  }

Referenced by getCompressedCone(), and RPCLogCone().

◆ toString()

std::string RPCLogCone::toString ( ) const

Definition at line 95 of file RPCLogCone.cc.

96  {
97  std::ostringstream ostr;
98  ostr << "\n ======================> TOWER = ";
99  ostr << std::setw(2) << m_ConeCrdnts.m_Tower << ", m_LogSector = " << m_ConeCrdnts.m_LogSector
100  << ", m_LogSegment = " << m_ConeCrdnts.m_LogSegment << " <=======================" << std::endl;
101 
102  std::string spacer;
103 
104  for (int logPlane = RPCConst::m_LAST_PLANE; logPlane >= RPCConst::m_FIRST_PLANE; logPlane--) {
105  ostr << RPCConst::m_LOGPLANE_STR[logPlane] << " ";
106  spacer.assign((72 - RPCConst::m_LOGPLANE_SIZE[abs(m_ConeCrdnts.m_Tower)][logPlane]) / 2, ' ');
107  ostr << spacer;
108 
109  for (int i = RPCConst::m_LOGPLANE_SIZE[abs(m_ConeCrdnts.m_Tower)][logPlane] - 1; i >= 0; i--) {
110  if (getLogStripState(logPlane, i))
111  ostr << "X";
112  else {
113  if (i % 8 == 0)
114  ostr << i % 10;
115  else
116  ostr << ".";
117  }
118  }
119 
120  ostr << std::endl;
121  }
122 
123  ostr << std::endl;
124  return ostr.str();

References funct::abs(), getLogStripState(), mps_fire::i, m_ConeCrdnts, RPCConst::m_FIRST_PLANE, RPCConst::m_LAST_PLANE, RPCConst::m_LOGPLANE_SIZE, RPCConst::m_LOGPLANE_STR, RPCConst::l1RpcConeCrdnts::m_LogSector, RPCConst::l1RpcConeCrdnts::m_LogSegment, RPCConst::l1RpcConeCrdnts::m_Tower, and AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ m_ConeCrdnts

RPCConst::l1RpcConeCrdnts RPCLogCone::m_ConeCrdnts
private

◆ m_DigisIdx

std::vector<std::vector<int> > RPCLogCone::m_DigisIdx
private

Digis that formed log hits in this LogCone, m_DigisIdx[logPlaneNum][i] gets the index in DigisVec stored in L1RpcTrigg

Definition at line 107 of file RPCLogCone.h.

◆ m_Index

int RPCLogCone::m_Index
private

m_Index in LogConesVec stored by L1RpcTrigg

Definition at line 116 of file RPCLogCone.h.

Referenced by getIdx(), and setIdx().

◆ m_LogPlanesVec

std::vector<TLogPlane> RPCLogCone::m_LogPlanesVec
private

Logic Planes.

Definition at line 102 of file RPCLogCone.h.

Referenced by getLogPlane(), getLogStripDigisIdxs(), getLogStripState(), isPlaneFired(), RPCLogCone(), and setLogStrip().

◆ m_MuonCode

int RPCLogCone::m_MuonCode
private

Definition at line 111 of file RPCLogCone.h.

Referenced by RPCLogCone().

◆ m_MuonSign

int RPCLogCone::m_MuonSign
private

Definition at line 113 of file RPCLogCone.h.

Referenced by getMuonSign(), RPCLogCone(), and setMuonSign().

RPCLogCone::getLogStripState
bool getLogStripState(int logPlane, unsigned int logStripNum) const
Definition: RPCLogCone.cc:183
RPCLogCone::shift
void shift(int pos)
Changes fired LogStrips: from "stripNum" to "stripNum + pos".
Definition: RPCLogCone.cc:125
mps_fire.i
i
Definition: mps_fire.py:355
RPCLogCone::m_LogPlanesVec
std::vector< TLogPlane > m_LogPlanesVec
Logic Planes.
Definition: RPCLogCone.h:102
RPCConst::l1RpcConeCrdnts::m_Tower
int m_Tower
Definition: RPCConst.h:119
RPCLogCone::m_MuonSign
int m_MuonSign
Definition: RPCLogCone.h:113
RPCLogCone::getTower
int getTower() const
Definition: RPCLogCone.cc:161
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
pos
Definition: PixelAliasList.h:18
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:3
RPCLogHit::getTower
int getTower() const
Definition: RPCLogHit.cc:23
end
#define end
Definition: vmac.h:39
RPCConst::m_LOGPLANE4
static const int m_LOGPLANE4
Definition: RPCConst.h:51
RPCLogHit::getLogSector
int getLogSector() const
Definition: RPCLogHit.cc:25
RPCLogHit::getStripNumberInCone
int getStripNumberInCone() const
Definition: RPCLogHit.cc:31
RPCConst::m_LOGPLANE_STR
static const std::string m_LOGPLANE_STR[]
Log Planes names.
Definition: RPCConst.h:78
RPCLogCone::TLogPlane
std::map< int, std::vector< int > > TLogPlane
Definition: RPCLogCone.h:30
RPCLogCone::getLogPlane
TLogPlane getLogPlane(int logPlane) const
Definition: RPCLogCone.cc:146
RPCLogCone::isPlaneFired
bool isPlaneFired(int logPlane) const
Definition: RPCLogCone.cc:209
RPCConst::m_FIRST_PLANE
static const int m_FIRST_PLANE
Use ase a first index in loops.
Definition: RPCConst.h:55
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RPCLogCone::m_ConeCrdnts
RPCConst::l1RpcConeCrdnts m_ConeCrdnts
Definition: RPCLogCone.h:109
RPCConst::l1RpcConeCrdnts::m_LogSegment
int m_LogSegment
Definition: RPCConst.h:121
RPCLogCone::getHitsCnt
int getHitsCnt(int logPlane) const
Gets fired strips count in given logPlane.
Definition: RPCLogCone.cc:149
RPCLogHit::getlogPlaneNumber
int getlogPlaneNumber() const
Definition: RPCLogHit.cc:29
RPCException
Definition: RPCException.h:21
RPCLogHit::getDigiIdx
int getDigiIdx() const
Definition: RPCLogHit.cc:35
topSingleLeptonDQM_PU_cfi.pattern
pattern
Definition: topSingleLeptonDQM_PU_cfi.py:39
RPCLogCone::setLogStrip
void setLogStrip(int logPlane, int logStripNum, int m_digiIdx)
Set logic strip as fired. m_digiIdx - index of digi in digis vector stored by L1RpcTrigg.
Definition: RPCLogCone.cc:173
pat
Definition: HeavyIon.h:7
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
RPCConst::m_USED_PLANES_COUNT
static const int m_USED_PLANES_COUNT[m_TOWER_COUNT]
m_Number of Logic Planes existing in each m_Tower.
Definition: RPCConst.h:87
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
RPCLogHit::getLogSegment
int getLogSegment() const
Definition: RPCLogHit.cc:27
HLT_2018_cff.triggerType
triggerType
Definition: HLT_2018_cff.py:7443
RPCConst::m_LOGPLANE_SIZE
static const unsigned int m_LOGPLANE_SIZE[m_TOWER_COUNT][m_LOGPLANES_COUNT]
Definition of Logic Cone Sizes - number of Logic m_Strips in each plane.
Definition: RPCConst.h:81
RPCConst::m_LOGPLANES_COUNT
static const int m_LOGPLANES_COUNT
Max Logic Planes Count in trigger towers.
Definition: RPCConst.h:45
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
RPCConst::l1RpcConeCrdnts::m_LogSector
int m_LogSector
Definition: RPCConst.h:120
RPCLogCone::m_MuonCode
int m_MuonCode
Definition: RPCLogCone.h:111
begin
#define begin
Definition: vmac.h:32
RPCLogHit::getConeCrdnts
RPCConst::l1RpcConeCrdnts getConeCrdnts() const
Definition: RPCLogHit.cc:21
RPCConst::m_LAST_PLANE
static const int m_LAST_PLANE
Use ase a last index in loops.
Definition: RPCConst.h:56