CMS 3D CMS Logo

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

#include <DTRecoConditions.h>

Public Types

typedef std::map< uint32_t, std::vector< double > >::const_iterator const_iterator
 

Public Member Functions

const_iterator begin () const
 Access the data. More...
 
 DTRecoConditions ()
 Constructor. More...
 
 DTRecoConditions (const DTRecoConditions &)
 
const_iterator end () const
 
float get (const DTWireId &wireid, double *x=nullptr) const
 Get the value correspoding to the given WireId, / using x[] as parameters of the parametrization when relevant. More...
 
std::string getFormulaExpr () const
 
const DTRecoConditionsoperator= (const DTRecoConditions &)
 
void set (const DTWireId &wireid, const std::vector< double > &values)
 Fill the payload. More...
 
void setFormulaExpr (const std::string &expr)
 Set the expression representing the formula used for parametrization. More...
 
void setVersion (int version)
 
int version () const
 Version numer specifying the structure of the payload. See .cc file for details. More...
 
virtual ~DTRecoConditions ()
 Destructor. More...
 

Private Member Functions

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

Private Attributes

std::string expression
 
std::atomic< TFormula * > formula
 
std::atomic< int > formulaType
 
std::map< uint32_t, std::vector< double > > payload
 
int theVersion
 

Friends

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

Detailed Description

DB object for storing per-SL DT reconstruction parameters (ttrig, vdrift, uncertainties), possibly with their dependency from external quantities (like position, angle, etc.)

Dependencies can be specified with the expression set by setFormula(string), representing: -a TFormula, e.g. "[0]+[1]*x", in the most general case; -special cases like "[0]" = fixed constant, that are implemented without calling TFormula.

Author
N. Amapane, G. Cerminara

Definition at line 28 of file DTRecoConditions.h.

Member Typedef Documentation

◆ const_iterator

typedef std::map<uint32_t, std::vector<double> >::const_iterator DTRecoConditions::const_iterator

Definition at line 30 of file DTRecoConditions.h.

Constructor & Destructor Documentation

◆ DTRecoConditions() [1/2]

DTRecoConditions::DTRecoConditions ( )

Constructor.

Definition at line 21 of file DTRecoConditions.cc.

21 : formula(nullptr), formulaType(0), expression("[0]"), theVersion(0) {}

◆ DTRecoConditions() [2/2]

DTRecoConditions::DTRecoConditions ( const DTRecoConditions iOther)

Definition at line 23 of file DTRecoConditions.cc.

24  : formula(nullptr),
25  formulaType(0),
26  expression(iOther.expression),
27  payload(iOther.payload),
28  theVersion(iOther.theVersion) {}

◆ ~DTRecoConditions()

DTRecoConditions::~DTRecoConditions ( )
virtual

Destructor.

Definition at line 40 of file DTRecoConditions.cc.

40 { delete formula.load(); }

References formula.

Member Function Documentation

◆ begin()

DTRecoConditions::const_iterator DTRecoConditions::begin ( void  ) const

Access the data.

Definition at line 82 of file DTRecoConditions.cc.

82 { return payload.begin(); }

References payload.

◆ end()

DTRecoConditions::const_iterator DTRecoConditions::end ( void  ) const

Definition at line 84 of file DTRecoConditions.cc.

84 { return payload.end(); }

References payload.

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

◆ get()

float DTRecoConditions::get ( const DTWireId wireid,
double *  x = nullptr 
) const

Get the value correspoding to the given WireId, / using x[] as parameters of the parametrization when relevant.

Definition at line 42 of file DTRecoConditions.cc.

42  {
43  map<uint32_t, vector<double> >::const_iterator slIt = payload.find(wireid.superlayerId().rawId());
44  if (slIt == payload.end()) {
45  throw cms::Exception("InvalidInput") << "The SLId: " << wireid.superlayerId() << " is not in the paylaod map";
46  }
47  const vector<double>& par = slIt->second;
48 
49  // Initialize if this is the first call
50  if (formulaType == 0) {
51  if (expression == "[0]") {
52  formulaType = 1;
53  } else if (expression == "par[step]") {
54  formulaType = 2;
55  } else {
56  std::unique_ptr<TFormula> temp{new TFormula("DTExpr", expression.c_str())};
57  TFormula* expected = nullptr;
58  if (formula.compare_exchange_strong(expected, temp.get())) {
59  //This thread set the value
60  temp.release();
61  }
62  formulaType = 99;
63  }
64  }
65 
66  if (formulaType == 1 || par.size() == 1) {
67  // Return value is simply a constant. Assume this is the case also if only one parameter exists.
68  return par[0];
69  } else if (formulaType == 2) {
70  // Special case: par[i] represents the value for step i
71  return par[unsigned(x[0])];
72  } else {
73  // Use the formula corresponding to expression.
74  return (*formula).EvalPar(x, par.data());
75  }
76 }

References Exception, expression, formula, formulaType, payload, DetId::rawId(), DTLayerId::superlayerId(), groupFilesInBlocks::temp, and x.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), util.rrapi.RRApi::columns(), rrapi.RRApi::columns(), DTLinearDriftFromDBAlgo::compute(), util.rrapi.RRApi::count(), rrapi.RRApi::count(), rrapi.RRApi::data(), util.rrapi.RRApi::data(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), rrapi.RRApi::report(), util.rrapi.RRApi::report(), util.rrapi.RRApi::reports(), rrapi.RRApi::reports(), util.rrapi.RRApi::tables(), 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().

◆ getFormulaExpr()

std::string DTRecoConditions::getFormulaExpr ( ) const
inline

Definition at line 52 of file DTRecoConditions.h.

52 { return expression; }

References expression.

◆ operator=()

const DTRecoConditions & DTRecoConditions::operator= ( const DTRecoConditions iOther)

Definition at line 30 of file DTRecoConditions.cc.

30  {
31  delete formula.load();
32  formula = nullptr;
33  formulaType = 0;
34  expression = iOther.expression;
35  payload = iOther.payload;
36  theVersion = iOther.theVersion;
37  return *this;
38 }

References expression, formula, formulaType, payload, and theVersion.

◆ serialize()

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

◆ set()

void DTRecoConditions::set ( const DTWireId wireid,
const std::vector< double > &  values 
)

Fill the payload.

Definition at line 78 of file DTRecoConditions.cc.

78  {
79  payload[wireid.superlayerId()] = values;
80 }

References payload, DTLayerId::superlayerId(), and contentValuesCheck::values.

◆ setFormulaExpr()

void DTRecoConditions::setFormulaExpr ( const std::string &  expr)
inline

Set the expression representing the formula used for parametrization.

Definition at line 50 of file DTRecoConditions.h.

50 { expression = expr; }

References jets_cff::expr, and expression.

◆ setVersion()

void DTRecoConditions::setVersion ( int  version)
inline

Definition at line 40 of file DTRecoConditions.h.

40 { theVersion = version; }

References theVersion, and version().

◆ version()

int DTRecoConditions::version ( ) const
inline

Version numer specifying the structure of the payload. See .cc file for details.

Definition at line 43 of file DTRecoConditions.h.

43 { return theVersion; }

References theVersion.

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

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 85 of file DTRecoConditions.h.

◆ cond::serialization::access

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

Definition at line 85 of file DTRecoConditions.h.

Member Data Documentation

◆ expression

std::string DTRecoConditions::expression
private

Definition at line 77 of file DTRecoConditions.h.

Referenced by get(), getFormulaExpr(), operator=(), and setFormulaExpr().

◆ formula

std::atomic<TFormula*> DTRecoConditions::formula
mutableprivate

Definition at line 64 of file DTRecoConditions.h.

Referenced by get(), operator=(), and ~DTRecoConditions().

◆ formulaType

std::atomic<int> DTRecoConditions::formulaType
mutableprivate

Definition at line 71 of file DTRecoConditions.h.

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

◆ payload

std::map<uint32_t, std::vector<double> > DTRecoConditions::payload
private

Definition at line 80 of file DTRecoConditions.h.

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

◆ theVersion

int DTRecoConditions::theVersion
private

Definition at line 83 of file DTRecoConditions.h.

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

DDAxes::x
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
DTRecoConditions::theVersion
int theVersion
Definition: DTRecoConditions.h:83
DTRecoConditions::formula
std::atomic< TFormula * > formula
Definition: DTRecoConditions.h:64
DTRecoConditions::version
int version() const
Version numer specifying the structure of the payload. See .cc file for details.
Definition: DTRecoConditions.h:43
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
DTRecoConditions::const_iterator
std::map< uint32_t, std::vector< double > >::const_iterator const_iterator
Definition: DTRecoConditions.h:30
DTRecoConditions::expression
std::string expression
Definition: DTRecoConditions.h:77
DTRecoConditions::payload
std::map< uint32_t, std::vector< double > > payload
Definition: DTRecoConditions.h:80
DTRecoConditions::formulaType
std::atomic< int > formulaType
Definition: DTRecoConditions.h:71
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
jets_cff.expr
expr
Definition: jets_cff.py:449
Exception
Definition: hltDiff.cc:246
DTLayerId::superlayerId
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:45