Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
CalibMuon
DTCalibration
plugins
DTT0FillDefaultFromDB.cc
Go to the documentation of this file.
1
/*
2
* See header file for a description of this class.
3
*
4
* \author A. Vilela Pereira
5
*/
6
7
#include "
DTT0FillDefaultFromDB.h
"
8
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
9
#include "
FWCore/Framework/interface/EventSetup.h
"
10
#include "
FWCore/Framework/interface/ESHandle.h
"
11
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
12
13
#include "
DataFormats/MuonDetId/interface/DTWireId.h
"
14
#include "
CondFormats/DTObjects/interface/DTT0.h
"
15
#include "
CondFormats/DataRecord/interface/DTT0Rcd.h
"
16
17
#include <string>
18
19
using namespace
std;
20
using namespace
edm;
21
22
namespace
dtCalibration {
23
24
DTT0FillDefaultFromDB::DTT0FillDefaultFromDB(
const
ParameterSet
& pset):
25
dbLabelRef_( pset.getParameter<
string
>(
"dbLabelRef"
) ) {
26
}
27
28
DTT0FillDefaultFromDB::~DTT0FillDefaultFromDB
() {
29
}
30
31
void
DTT0FillDefaultFromDB::setES
(
const
EventSetup
&
setup
) {
32
// Get t0 record from DB
33
ESHandle<DTT0>
t0H;
34
setup.
get
<
DTT0Rcd
>().
get
(t0H);
35
t0Map_
= &*t0H;
36
LogVerbatim
(
"Calibration"
) <<
"[DTT0FillDefaultFromDB] T0 version: "
<< t0H->version();
37
38
// Get reference t0 DB
39
ESHandle<DTT0>
t0RefH;
40
setup.
get
<
DTT0Rcd
>().
get
(
dbLabelRef_
,t0RefH);
41
t0MapRef_
= &*t0RefH;
42
LogVerbatim
(
"Calibration"
) <<
"[DTT0FillDefaultFromDB] Reference T0 version: "
<< t0RefH->version();
43
44
}
45
46
DTT0Data
DTT0FillDefaultFromDB::correction
(
const
DTWireId
& wireId) {
47
// Try to access value in default DB
48
// If it does not exist return value from reference DB
49
// If it does not exist in reference DB, throw exception
50
// Could also set to default zero value
51
float
t0Mean,t0RMS;
52
int
status
=
t0Map_
->
get
(wireId,t0Mean,t0RMS,
DTTimeUnits::counts
);
53
if
(!status){
54
return
DTT0Data
(t0Mean,t0RMS);
55
}
else
{
56
// Now access reference DB
57
float
t0MeanRef,t0RMSRef;
58
int
statusRef =
t0MapRef_
->
get
(wireId,t0MeanRef,t0RMSRef,
DTTimeUnits::counts
);
59
if
(!statusRef){
60
return
DTT0Data
(t0MeanRef,t0RMSRef);
61
}
else
{
62
//...
63
throw
cms::Exception
(
"[DTT0FillDefaultFromDB]"
) <<
"Could not find t0 entry in reference DB for"
64
<< wireId << endl;
65
}
66
}
67
}
68
69
}
// namespace
dtCalibration::DTT0Data
Definition:
DTT0BaseCorrection.h:19
MessageLogger.h
dtCalibration::DTT0FillDefaultFromDB::dbLabelRef_
std::string dbLabelRef_
Definition:
DTT0FillDefaultFromDB.h:35
EventSetup.h
DTT0Rcd.h
DTT0::get
int get(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float &t0mean, float &t0rms, DTTimeUnits::type unit) const
Definition:
DTT0.cc:67
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
dtCalibration::DTT0FillDefaultFromDB::t0MapRef_
const DTT0 * t0MapRef_
Definition:
DTT0FillDefaultFromDB.h:37
ParameterSet.h
dtCalibration::DTT0FillDefaultFromDB::correction
virtual DTT0Data correction(const DTWireId &)
Definition:
DTT0FillDefaultFromDB.cc:46
edm::ESHandle< DTT0 >
ESHandle.h
edm::EventSetup
Definition:
EventSetup.h:44
edm::LogVerbatim
Definition:
MessageLogger.h:240
DTT0FillDefaultFromDB.h
DTT0.h
dtCalibration::DTT0FillDefaultFromDB::setES
virtual void setES(const edm::EventSetup &setup)
Definition:
DTT0FillDefaultFromDB.cc:31
edm::hlt::Exception
error
Definition:
HLTenums.h:21
edm::EventSetup::get
const T & get() const
Definition:
EventSetup.h:55
DTTimeUnits::counts
Definition:
DTTimeUnits.h:37
dtCalibration::DTT0FillDefaultFromDB::~DTT0FillDefaultFromDB
virtual ~DTT0FillDefaultFromDB()
Definition:
DTT0FillDefaultFromDB.cc:28
DTT0Rcd
Definition:
DTT0Rcd.h:9
DTWireId.h
dtCalibration::DTT0FillDefaultFromDB::t0Map_
const DTT0 * t0Map_
Definition:
DTT0FillDefaultFromDB.h:38
DTWireId
Definition:
DTWireId.h:13
edm::ParameterSet
Definition:
ParameterSet.h:35
ntuplemaker.status
tuple status
Definition:
ntuplemaker.py:245
HcalObjRepresent::setup
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
Definition:
HcalObjRepresent.h:628
Generated for CMSSW Reference Manual by
1.8.5