CMS 3D CMS Logo

DTTTrigMatchRPhi.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 "DTTTrigMatchRPhi.h"
14 
15 #include <cmath>
16 
17 using namespace std;
18 using namespace edm;
19 
20 namespace dtCalibration {
21 
22  DTTTrigMatchRPhi::DTTTrigMatchRPhi(const ParameterSet& pset) {
23  dbLabel = pset.getUntrackedParameter<string>("dbLabel", "");
24  }
25 
26  DTTTrigMatchRPhi::~DTTTrigMatchRPhi() {}
27 
28  void DTTTrigMatchRPhi::setES(const EventSetup& setup) {
29  // Get tTrig record from DB
31  setup.get<DTTtrigRcd>().get(dbLabel, tTrig);
32  tTrigMap_ = &*tTrig;
33  }
34 
36  float tTrigMean, tTrigSigma, kFactor;
37  int status = tTrigMap_->get(slId, tTrigMean, tTrigSigma, kFactor, DTTimeUnits::ns);
38  // RZ superlayers return the current value
39  if (slId.superLayer() == 2) {
40  if (status != 0)
41  throw cms::Exception("[DTTTrigMatchRPhi]") << "Could not find tTrig entry in DB for" << slId << endl;
42  return DTTTrigData(tTrigMean, tTrigSigma, kFactor);
43  } else {
44  DTSuperLayerId partnerSLId(slId.chamberId(), (slId.superLayer() == 1) ? 3 : 1);
45  float tTrigMeanNew, tTrigSigmaNew, kFactorNew;
46  if (!status) { // Gets average of both SuperLayer's
47  if (!tTrigMap_->get(partnerSLId, tTrigMeanNew, tTrigSigmaNew, kFactorNew, DTTimeUnits::ns)) {
48  tTrigMeanNew = (tTrigMean + tTrigMeanNew) / 2.;
49  // tTrigSigmaNew = sqrt(tTrigSigmaNew*tTrigSigmaNew + tTrigSigma*tTrigSigma)/2.;
50  tTrigSigmaNew = (tTrigSigmaNew + tTrigSigma) / 2.;
51 
52  kFactorNew = kFactor;
53  return DTTTrigData(tTrigMeanNew, tTrigSigmaNew, kFactorNew);
54  } else
55  return DTTTrigData(tTrigMean, tTrigSigma, kFactor);
56  } else { // If there is no entry tries to find partner SL and retrieves its value
57  if (!tTrigMap_->get(partnerSLId, tTrigMeanNew, tTrigSigmaNew, kFactorNew, DTTimeUnits::ns))
58  return DTTTrigData(tTrigMeanNew, tTrigSigmaNew, kFactorNew);
59  else { // Both RPhi SL's not present in DB
60  throw cms::Exception("[DTTTrigMatchRPhi]") << "Could not find tTrig entry in DB for" << slId << "\n"
61  << partnerSLId << endl;
62  }
63  }
64  }
65  }
66 
67 } // namespace dtCalibration
TriggerEventFlag_cfi.dbLabel
dbLabel
Definition: TriggerEventFlag_cfi.py:5
DTSuperLayerId
Definition: DTSuperLayerId.h:12
dtCalibration::DTTTrigData
Definition: DTTTrigBaseCorrection.h:19
DTTtrigRcd.h
ESHandle.h
mps_update.status
status
Definition: mps_update.py:69
DTTtrigRcd
Definition: DTTtrigRcd.h:5
edm
HLT enums.
Definition: AlignableModifier.h:19
dttriganalyzer_cfi.tTrig
tTrig
Definition: dttriganalyzer_cfi.py:11
DTSuperLayerId::superLayer
int superLayer() const
Return the superlayer number.
Definition: DTSuperLayerId.h:39
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
DTTimeUnits::ns
Definition: DTTimeUnits.h:32
edm::ESHandle< DTTtrig >
edm::ParameterSet
Definition: ParameterSet.h:47
pfMETCorrectionType0_cfi.correction
correction
Definition: pfMETCorrectionType0_cfi.py:39
DTSuperLayerId::chamberId
DTChamberId chamberId() const
Return the corresponding ChamberId.
Definition: DTSuperLayerId.h:45
DTTTrigMatchRPhi.h
edm::EventSetup
Definition: EventSetup.h:58
DTTtrig.h
get
#define get
dtCalibration
Definition: DTT0BaseCorrection.h:16
std
Definition: JetResolutionObject.h:76
dttriganalyzer_cfi.kFactor
kFactor
Definition: dttriganalyzer_cfi.py:7
Exception
Definition: hltDiff.cc:245
EventSetup.h
ParameterSet.h
DTSuperLayerId.h
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27