CMS 3D CMS Logo

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

#include <DTTPGParameters.h>

Public Types

typedef std::vector< std::pair< DTTPGParametersId, DTTPGParametersData > >::const_iterator const_iterator
 Access methods to data. More...
 

Public Member Functions

const_iterator begin () const
 
void clear ()
 reset content More...
 
int clock () const
 
 DTTPGParameters ()
 
 DTTPGParameters (DTTPGParameters const &)=delete
 
 DTTPGParameters (const std::string &version)
 
const_iterator end () const
 
int get (int wheelId, int stationId, int sectorId, int &nc, float &ph, DTTimeUnits::type unit) const
 get content More...
 
int get (const DTChamberId &id, int &nc, float &ph, DTTimeUnits::type unit) const
 
void initialize ()
 
DTTPGParametersoperator= (DTTPGParameters const &)
 
int set (int wheelId, int stationId, int sectorId, int nc, float ph, DTTimeUnits::type unit)
 
int set (const DTChamberId &id, int nc, float ph, DTTimeUnits::type unit)
 
void setClock (int clock)
 
void setUnit (float unit)
 
float totalTime (int wheelId, int stationId, int sectorId, DTTimeUnits::type unit) const
 
float totalTime (const DTChamberId &id, DTTimeUnits::type unit) const
 
float unit () const
 
const std::string & version () const
 access version More...
 
std::string & version ()
 
 ~DTTPGParameters ()
 

Private Member Functions

std::string mapName () const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

int clockLength
 
std::vector< std::pair< DTTPGParametersId, DTTPGParametersData > > dataList
 
std::string dataVersion
 
edm::ConstRespectingPtr< DTBufferTree< int, int > > dBuf
 
float nsPerCount
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Description: Class to hold drift tubes TPG parameters

Author
Paolo Ronchese INFN Padova

Definition at line 62 of file DTTPGParameters.h.

Member Typedef Documentation

◆ const_iterator

Access methods to data.

Definition at line 97 of file DTTPGParameters.h.

Constructor & Destructor Documentation

◆ DTTPGParameters() [1/3]

DTTPGParameters::DTTPGParameters ( )

Constructor

Definition at line 31 of file DTTPGParameters.cc.

References dataList.

32  : dataVersion(" "), nsPerCount(25.0 / 32.0), clockLength(32), dBuf(new DTBufferTree<int, int>) {
33  dataList.reserve(250);
34 }
edm::ConstRespectingPtr< DTBufferTree< int, int > > dBuf
std::vector< std::pair< DTTPGParametersId, DTTPGParametersData > > dataList
std::string dataVersion

◆ DTTPGParameters() [2/3]

DTTPGParameters::DTTPGParameters ( DTTPGParameters const &  )
delete

◆ DTTPGParameters() [3/3]

DTTPGParameters::DTTPGParameters ( const std::string &  version)

Definition at line 36 of file DTTPGParameters.cc.

References dataList.

38  dataList.reserve(250);
39 }
edm::ConstRespectingPtr< DTBufferTree< int, int > > dBuf
std::vector< std::pair< DTTPGParametersId, DTTPGParametersData > > dataList
std::string dataVersion
const std::string & version() const
access version

◆ ~DTTPGParameters()

DTTPGParameters::~DTTPGParameters ( )

Destructor

Definition at line 59 of file DTTPGParameters.cc.

59 {}

Member Function Documentation

◆ begin()

DTTPGParameters::const_iterator DTTPGParameters::begin ( void  ) const

Definition at line 166 of file DTTPGParameters.cc.

References dataList.

Referenced by DTLocalTriggerSynchTest::dqmEndJob().

166 { return dataList.begin(); }
std::vector< std::pair< DTTPGParametersId, DTTPGParametersData > > dataList

◆ clear()

void DTTPGParameters::clear ( void  )

reset content

Definition at line 117 of file DTTPGParameters.cc.

References dataList, and initialize().

117  {
118  dataList.clear();
119  initialize();
120  return;
121 }
std::vector< std::pair< DTTPGParametersId, DTTPGParametersData > > dataList

◆ clock()

int DTTPGParameters::clock ( ) const

Definition at line 109 of file DTTPGParameters.cc.

References clockLength.

Referenced by setClock(), and totalTime().

109 { return clockLength; }

◆ end()

DTTPGParameters::const_iterator DTTPGParameters::end ( void  ) const

Definition at line 168 of file DTTPGParameters.cc.

References dataList.

Referenced by Types.LuminosityBlockRange::cppID(), Types.EventRange::cppID(), and DTLocalTriggerSynchTest::dqmEndJob().

168 { return dataList.end(); }
std::vector< std::pair< DTTPGParametersId, DTTPGParametersData > > dataList

◆ get() [1/2]

int DTTPGParameters::get ( int  wheelId,
int  stationId,
int  sectorId,
int &  nc,
float &  ph,
DTTimeUnits::type  unit 
) const

get content

Operations

Definition at line 68 of file DTTPGParameters.cc.

References data, dataList, dBuf, DTBufferTree< Key, Content >::find(), DTTimeUnits::ns, nsPerCount, edm::second(), and unit().

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), submitPVValidationJobs.BetterConfigParser::__updateDict(), rrapi.RRApi::columns(), util.rrapi.RRApi::columns(), rrapi.RRApi::count(), util.rrapi.RRApi::count(), rrapi.RRApi::data(), util.rrapi.RRApi::data(), DTLocalTriggerSynchTest::dqmEndJob(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), DTConfigPedestals::getOffset(), betterConfigParser.BetterConfigParser::getResultingSection(), submitPVValidationJobs.BetterConfigParser::getResultingSection(), DTConfigPedestals::print(), util.rrapi.RRApi::report(), rrapi.RRApi::report(), util.rrapi.RRApi::reports(), rrapi.RRApi::reports(), rrapi.RRApi::tables(), util.rrapi.RRApi::tables(), util.rrapi.RRApi::tags(), rrapi.RRApi::tags(), rrapi.RRApi::templates(), util.rrapi.RRApi::templates(), util.rrapi.RRApi::workspaces(), and rrapi.RRApi::workspaces().

68  {
69  nc = 0;
70  ph = 0.0;
71 
72  std::vector<int> chanKey;
73  chanKey.reserve(3);
74  chanKey.push_back(wheelId);
75  chanKey.push_back(stationId);
76  chanKey.push_back(sectorId);
77  int ientry;
78  int searchStatus = dBuf->find(chanKey.begin(), chanKey.end(), ientry);
79  if (!searchStatus) {
80  const DTTPGParametersData& data(dataList[ientry].second);
81  nc = data.nClock;
82  ph = data.tPhase;
83  if (unit == DTTimeUnits::ns) {
84  ph *= nsPerCount;
85  }
86  }
87 
88  return searchStatus;
89 }
edm::ConstRespectingPtr< DTBufferTree< int, int > > dBuf
float unit() const
U second(std::pair< T, U > const &p)
std::vector< std::pair< DTTPGParametersId, DTTPGParametersData > > dataList
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79

◆ get() [2/2]

int DTTPGParameters::get ( const DTChamberId id,
int &  nc,
float &  ph,
DTTimeUnits::type  unit 
) const

◆ initialize()

void DTTPGParameters::initialize ( )

Definition at line 176 of file DTTPGParameters.cc.

References officialStyle::chan, DTBufferTree< Key, Content >::clear(), dataList, dBuf, and DTBufferTree< Key, Content >::insert().

Referenced by clear(), and operator=().

176  {
177  dBuf->clear();
178 
179  int entryNum = 0;
180  int entryMax = dataList.size();
181  std::vector<int> chanKey;
182  chanKey.reserve(3);
183  while (entryNum < entryMax) {
184  const DTTPGParametersId& chan = dataList[entryNum].first;
185 
186  chanKey.clear();
187  chanKey.push_back(chan.wheelId);
188  chanKey.push_back(chan.stationId);
189  chanKey.push_back(chan.sectorId);
190  dBuf->insert(chanKey.begin(), chanKey.end(), entryNum++);
191  }
192 
193  return;
194 }
edm::ConstRespectingPtr< DTBufferTree< int, int > > dBuf
std::vector< std::pair< DTTPGParametersId, DTTPGParametersData > > dataList
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
int insert(ElementKey fKey, ElementKey lKey, Content cont)

◆ mapName()

std::string DTTPGParameters::mapName ( ) const
private

Definition at line 170 of file DTTPGParameters.cc.

References dataVersion, and Skims_PA_cff::name.

170  {
171  std::stringstream name;
172  name << dataVersion << "_map_TTPG" << this;
173  return name.str();
174 }
std::string dataVersion

◆ operator=()

DTTPGParameters & DTTPGParameters::operator= ( DTTPGParameters const &  rhs)

Definition at line 41 of file DTTPGParameters.cc.

References clockLength, dataList, dataVersion, initialize(), and nsPerCount.

41  {
42  if (this != &rhs) {
43  dataVersion = rhs.dataVersion;
44  nsPerCount = rhs.nsPerCount;
45  clockLength = rhs.clockLength;
46  dataList = rhs.dataList;
47  initialize();
48  }
49  return *this;
50 }
std::vector< std::pair< DTTPGParametersId, DTTPGParametersData > > dataList
std::string dataVersion

◆ serialize()

template<class Archive >
void DTTPGParameters::serialize ( Archive &  ar,
const unsigned int  version 
)
private

◆ set() [1/2]

int DTTPGParameters::set ( int  wheelId,
int  stationId,
int  sectorId,
int  nc,
float  ph,
DTTimeUnits::type  unit 
)

Definition at line 123 of file DTTPGParameters.cc.

References data, dataList, dBuf, DTBufferTree< Key, Content >::find(), DTBufferTree< Key, Content >::insert(), crabWrapper::key, DTTimeUnits::ns, nsPerCount, edm::second(), and unit().

Referenced by DTConfigTrivialProducer::buildTrivialPedestals(), DTConfigDBProducer::buildTrivialPedestals(), DTLocalTriggerSynchTest::dqmEndJob(), and DTTPGParametersHandler::getNewObjects().

123  {
124  if (unit == DTTimeUnits::ns) {
125  ph /= nsPerCount;
126  }
127 
128  std::vector<int> chanKey;
129  chanKey.reserve(3);
130  chanKey.push_back(wheelId);
131  chanKey.push_back(stationId);
132  chanKey.push_back(sectorId);
133  int ientry;
134  int searchStatus = dBuf->find(chanKey.begin(), chanKey.end(), ientry);
135 
136  if (!searchStatus) {
138  data.nClock = nc;
139  data.tPhase = ph;
140  return -1;
141  } else {
143  key.wheelId = wheelId;
144  key.stationId = stationId;
145  key.sectorId = sectorId;
147  data.nClock = nc;
148  data.tPhase = ph;
149  ientry = dataList.size();
150  dataList.push_back(std::pair<DTTPGParametersId, DTTPGParametersData>(key, data));
151  dBuf->insert(chanKey.begin(), chanKey.end(), ientry);
152  return 0;
153  }
154 
155  return 99;
156 }
edm::ConstRespectingPtr< DTBufferTree< int, int > > dBuf
float unit() const
U second(std::pair< T, U > const &p)
std::vector< std::pair< DTTPGParametersId, DTTPGParametersData > > dataList
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
int insert(ElementKey fKey, ElementKey lKey, Content cont)

◆ set() [2/2]

int DTTPGParameters::set ( const DTChamberId id,
int  nc,
float  ph,
DTTimeUnits::type  unit 
)

Definition at line 158 of file DTTPGParameters.cc.

References unit().

158  {
159  return set(id.wheel(), id.station(), id.sector(), nc, ph, unit);
160 }
float unit() const

◆ setClock()

void DTTPGParameters::setClock ( int  clock)

Definition at line 162 of file DTTPGParameters.cc.

References clock(), and clockLength.

◆ setUnit()

void DTTPGParameters::setUnit ( float  unit)

Definition at line 164 of file DTTPGParameters.cc.

References nsPerCount, and unit().

164 { nsPerCount = unit; }
float unit() const

◆ totalTime() [1/2]

float DTTPGParameters::totalTime ( int  wheelId,
int  stationId,
int  sectorId,
DTTimeUnits::type  unit 
) const

Definition at line 95 of file DTTPGParameters.cc.

References haddnano::cl, clock(), DTTimeUnits::ns, nsPerCount, and unit().

Referenced by totalTime().

95  {
96  int cl = 0;
97  float ph = 0.0;
98  get(wheelId, stationId, sectorId, cl, ph, unit);
99  if (unit == DTTimeUnits::ns)
100  return (cl * clock() * nsPerCount) + ph;
101  else
102  return (cl * clock()) + ph;
103 }
float unit() const

◆ totalTime() [2/2]

float DTTPGParameters::totalTime ( const DTChamberId id,
DTTimeUnits::type  unit 
) const

Definition at line 105 of file DTTPGParameters.cc.

References relativeConstraints::station, totalTime(), unit(), and makeMuonMisalignmentScenario::wheel.

105  {
106  return totalTime(id.wheel(), id.station(), id.sector(), unit);
107 }
float unit() const
float totalTime(int wheelId, int stationId, int sectorId, DTTimeUnits::type unit) const

◆ unit()

float DTTPGParameters::unit ( ) const

Definition at line 111 of file DTTPGParameters.cc.

References nsPerCount.

Referenced by get(), set(), setUnit(), and totalTime().

111 { return nsPerCount; }

◆ version() [1/2]

const std::string & DTTPGParameters::version ( ) const

access version

Definition at line 113 of file DTTPGParameters.cc.

References dataVersion.

Referenced by validation.Sample::datasetpattern(), and validation.Sample::filename().

113 { return dataVersion; }
std::string dataVersion

◆ version() [2/2]

std::string & DTTPGParameters::version ( )

Definition at line 115 of file DTTPGParameters.cc.

References dataVersion.

Referenced by validation.Sample::datasetpattern(), and validation.Sample::filename().

115 { return dataVersion; }
std::string dataVersion

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 116 of file DTTPGParameters.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 116 of file DTTPGParameters.h.

Member Data Documentation

◆ clockLength

int DTTPGParameters::clockLength
private

Definition at line 108 of file DTTPGParameters.h.

Referenced by clock(), operator=(), and setClock().

◆ dataList

std::vector<std::pair<DTTPGParametersId, DTTPGParametersData> > DTTPGParameters::dataList
private

Definition at line 110 of file DTTPGParameters.h.

Referenced by begin(), clear(), DTTPGParameters(), end(), get(), initialize(), operator=(), and set().

◆ dataVersion

std::string DTTPGParameters::dataVersion
private

Definition at line 106 of file DTTPGParameters.h.

Referenced by mapName(), operator=(), and version().

◆ dBuf

edm::ConstRespectingPtr<DTBufferTree<int, int> > DTTPGParameters::dBuf
private

Definition at line 112 of file DTTPGParameters.h.

Referenced by get(), initialize(), and set().

◆ nsPerCount

float DTTPGParameters::nsPerCount
private

Definition at line 107 of file DTTPGParameters.h.

Referenced by get(), operator=(), set(), setUnit(), totalTime(), and unit().