Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read DT uncertainties map from DB #2993

Merged
merged 2 commits into from Mar 29, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 25 additions & 14 deletions RecoLocalMuon/DTRecHit/plugins/DTLinearDriftFromDBAlgo.cc
Expand Up @@ -28,12 +28,19 @@ DTLinearDriftFromDBAlgo::DTLinearDriftFromDBAlgo(const ParameterSet& config) :
doVdriftCorr(config.getParameter<bool>("doVdriftCorr")),
// Option to force going back to digi time at Step 2
stepTwoFromDigi(config.getParameter<bool>("stepTwoFromDigi")),
useUncertDB(false),
// Set verbose output
debug(config.getUntrackedParameter<bool>("debug"))
{
if(debug)
cout<<"[DTLinearDriftFromDBAlgo] Constructor called"<<endl;
if(debug)
cout<<"[DTLinearDriftFromDBAlgo] Constructor called"<<endl;

// Check for compatibility with older configurations
if (config.existsAs<bool>("useUncertDB")) {
// Assign hit uncertainties based on new uncertainties DB
useUncertDB= config.getParameter<bool>("useUncertDB");
}
}



Expand All @@ -49,17 +56,19 @@ void DTLinearDriftFromDBAlgo::setES(const EventSetup& setup) {
ESHandle<DTMtime> mTimeHandle;
setup.get<DTMtimeRcd>().get(mTimeHandle);
mTimeMap = &*mTimeHandle;

// ESHandle<DTRecoUncertainties> uncerts;
// setup.get<DTRecoUncertaintiesRcd>().get(uncerts);
// uncertMap = &*uncerts;

// check uncertainty map type
// if (uncerts->version()>1) edm::LogError("NotImplemented") << "DT Uncertainty DB version unknown: " << uncerts->version();

if (useUncertDB) {
ESHandle<DTRecoUncertainties> uncerts;
setup.get<DTRecoUncertaintiesRcd>().get(uncerts);
uncertMap = &*uncerts;

// check uncertainty map type
if (uncertMap->version()>1) edm::LogError("NotImplemented") << "DT Uncertainty DB version unknown: " << uncertMap->version();
}

if(debug) {
cout << "[DTLinearDriftFromDBAlgo] meanTimer version: " << mTimeMap->version()<<endl;
// cout << " uncertDB version: " << uncerts->version()<<endl;
if (useUncertDB) cout << " uncertDB version: " << uncertMap->version()<<endl;
}

}
Expand Down Expand Up @@ -154,12 +163,14 @@ bool DTLinearDriftFromDBAlgo::compute(const DTLayer* layer,
// vdrift is cm/ns , resolution is cm
mTimeMap->get(wireId.superlayerId(),
vDrift,
hitResolution, // Value from vdrift DB; obsolete.
hitResolution, // Value from vdrift DB; replaced below if useUncertDB card is set
DTVelocityUnits::cm_per_ns);

// Read the uncertainty from the DB for the given channel and step
// float hitResolution = uncertMap->get(wireId, step-1);

if (useUncertDB) {
// Read the uncertainty from the DB for the given channel and step
hitResolution = uncertMap->get(wireId, step-1);
}

//only in step 3
if(doVdriftCorr && step == 3){
if (abs(wireId.wheel()) == 2 &&
Expand Down
4 changes: 4 additions & 0 deletions RecoLocalMuon/DTRecHit/plugins/DTLinearDriftFromDBAlgo.h
Expand Up @@ -99,6 +99,10 @@ class DTLinearDriftFromDBAlgo : public DTRecHitBaseAlgo {
// (when off, Step 2 does nothing)
const bool stepTwoFromDigi;

// Assign hit uncertainties based on new uncertainties DB
// If false, the value taken from vdrift DB is used instead.
bool useUncertDB;

// Switch on/off the verbosity
const bool debug;
};
Expand Down
Expand Up @@ -26,7 +26,8 @@
stepTwoFromDigi = cms.bool(False),
# The module to be used for ttrig synchronization and its set parameter
tTrigMode = cms.string('DTTTrigSyncFromDB'),
doVdriftCorr = cms.bool(False)
doVdriftCorr = cms.bool(False),
useUncertDB = cms.bool(False)
),
recAlgo = cms.string('DTLinearDriftFromDBAlgo')
)
Expand Down
3 changes: 2 additions & 1 deletion RecoLocalMuon/DTRecHit/python/DTLinearDriftFromDBAlgo_cfi.py
Expand Up @@ -27,7 +27,8 @@
# The module to be used for ttrig synchronization and its set parameter
tTrigMode = cms.string('DTTTrigSyncFromDB'),
# perform a correction to vdrift in MB1s of external wheels
doVdriftCorr = cms.bool(True)
doVdriftCorr = cms.bool(True),
useUncertDB = cms.bool(True)
),
recAlgo = cms.string('DTLinearDriftFromDBAlgo')
)
Expand Down