CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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=0) 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 29 of file DTRecoConditions.h.

Member Typedef Documentation

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

Definition at line 31 of file DTRecoConditions.h.

Constructor & Destructor Documentation

DTRecoConditions::DTRecoConditions ( )

Constructor.

Definition at line 22 of file DTRecoConditions.cc.

22  :
23  formula(nullptr),
24  formulaType(0),
25  expression("[0]")
26 {}
std::atomic< TFormula * > formula
std::string expression
std::atomic< int > formulaType
DTRecoConditions::DTRecoConditions ( const DTRecoConditions iOther)

Definition at line 28 of file DTRecoConditions.cc.

28  :
29  formula(nullptr),
30  formulaType(0),
31  expression(iOther.expression)
32 {}
std::atomic< TFormula * > formula
std::string expression
std::atomic< int > formulaType
DTRecoConditions::~DTRecoConditions ( )
virtual

Destructor.

Definition at line 45 of file DTRecoConditions.cc.

References formula.

45  {
46  delete formula.load();
47 }
std::atomic< TFormula * > formula

Member Function Documentation

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

Access the data.

Definition at line 93 of file DTRecoConditions.cc.

References payload.

93  {
94  return payload.begin();
95 }
std::map< uint32_t, std::vector< double > > payload
DTRecoConditions::const_iterator DTRecoConditions::end ( void  ) const

Definition at line 97 of file DTRecoConditions.cc.

References payload.

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

97  {
98  return payload.end();
99 }
std::map< uint32_t, std::vector< double > > payload
float DTRecoConditions::get ( const DTWireId wireid,
double *  x = 0 
) const

Get the value correspoding to the given WireId, 

/ using x[] as parameters of the parametrization when relevant

Definition at line 50 of file DTRecoConditions.cc.

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

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), rrapi.RRApi::columns(), rrapi.RRApi::count(), rrapi.RRApi::data(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), rrapi.RRApi::report(), rrapi.RRApi::reports(), rrapi.RRApi::tables(), rrapi.RRApi::tags(), rrapi.RRApi::templates(), and rrapi.RRApi::workspaces().

50  {
51 
52  map<uint32_t, vector<double> >::const_iterator slIt = payload.find(wireid.superlayerId().rawId());
53  if(slIt == payload.end()) {
54  throw cms::Exception("InvalidInput") << "The SLId: " << wireid.superlayerId() << " is not in the paylaod map";
55  }
56  const vector<double>& par = slIt->second;
57 
58  // Initialize if this is the first call
59  if (formulaType==0) {
60  if (expression=="[0]") {
61  formulaType = 1;
62  } else if (expression=="par[step]") {
63  formulaType = 2;
64  } else {
65  std::unique_ptr<TFormula> temp{new TFormula("DTExpr",expression.c_str())};
66  TFormula* expected = nullptr;
67  if(formula.compare_exchange_strong(expected,temp.get())) {
68  //This thread set the value
69  temp.release();
70  }
71  formulaType = 99;
72  }
73  }
74 
75  if (formulaType==1 || par.size()==1) {
76  // Return value is simply a constant. Assume this is the case also if only one parameter exists.
77  return par[0];
78  } else if (formulaType==2) {
79  // Special case: par[i] represents the value for step i
80  return par[unsigned (x[0])];
81  } else {
82  // Use the formula corresponding to expression.
83  return (*formula).EvalPar(x,par.data());
84  }
85 }
std::map< uint32_t, std::vector< double > > payload
std::map< uint32_t, std::vector< double > >::const_iterator const_iterator
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:59
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
std::atomic< TFormula * > formula
std::string expression
Definition: DDAxes.h:10
std::atomic< int > formulaType
std::string DTRecoConditions::getFormulaExpr ( ) const
inline

Definition at line 59 of file DTRecoConditions.h.

References expression.

59  {
60  return expression;
61  }
std::string expression
const DTRecoConditions & DTRecoConditions::operator= ( const DTRecoConditions iOther)

Definition at line 35 of file DTRecoConditions.cc.

References expression, formula, and formulaType.

36 {
37  delete formula.load();
38  formula=nullptr;
39  formulaType =0;
40  expression = iOther.expression;
41  return *this;
42 }
std::atomic< TFormula * > formula
std::string expression
std::atomic< int > formulaType
template<class Archive >
void DTRecoConditions::serialize ( Archive &  ar,
const unsigned int  version 
)
private
void DTRecoConditions::set ( const DTWireId wireid,
const std::vector< double > &  values 
)

Fill the payload.

Definition at line 88 of file DTRecoConditions.cc.

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

Referenced by betterConfigParser.BetterConfigParser::getGeneral().

88  {
89  payload[wireid.superlayerId()] = values;
90 }
std::map< uint32_t, std::vector< double > > payload
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:59
void DTRecoConditions::setFormulaExpr ( const std::string &  expr)
inline

Set the expression representing the formula used for parametrization.

Definition at line 55 of file DTRecoConditions.h.

References expression.

55  {
56  expression=expr;
57  }
std::string expression
void DTRecoConditions::setVersion ( int  version)
inline

Definition at line 41 of file DTRecoConditions.h.

References theVersion, and version().

41  {
43  }
int version() const
Version numer specifying the structure of the payload. See .cc file for details.
int DTRecoConditions::version ( ) const
inline

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

Definition at line 46 of file DTRecoConditions.h.

References theVersion.

Referenced by setVersion().

46  {
47  return theVersion;
48  }

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 95 of file DTRecoConditions.h.

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

Definition at line 95 of file DTRecoConditions.h.

Member Data Documentation

std::string DTRecoConditions::expression
private

Definition at line 87 of file DTRecoConditions.h.

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

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

Definition at line 74 of file DTRecoConditions.h.

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

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

Definition at line 81 of file DTRecoConditions.h.

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

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

Definition at line 90 of file DTRecoConditions.h.

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

int DTRecoConditions::theVersion
private

Definition at line 93 of file DTRecoConditions.h.

Referenced by setVersion(), and version().