![]() |
![]() |
#include <DTVDriftWriter.h>
Public Member Functions | |
void | analyze (const edm::Event &event, const edm::EventSetup &eventSetup) |
DTVDriftWriter (const edm::ParameterSet &pset) | |
Constructor. | |
void | endJob () |
virtual | ~DTVDriftWriter () |
Destructor. | |
Private Attributes | |
bool | debug |
edm::ParameterSet | theCalibFilePar |
TFile * | theFile |
DTMeanTimerFitter * | theFitter |
std::string | theGranularity |
DTMtime * | theMTime |
std::string | theRootInputFile |
std::string | theVDriftOutputFile |
Definition at line 32 of file DTVDriftWriter.h.
DTVDriftWriter::DTVDriftWriter | ( | const edm::ParameterSet & | pset | ) |
Constructor.
Definition at line 41 of file DTVDriftWriter.cc.
References gather_cfg::cout, debug, edm::ParameterSet::getUntrackedParameter(), and interactiveExample::theFile.
{ // get selected debug option debug = pset.getUntrackedParameter<bool>("debug", "false"); // Open the root file which contains the histos theRootInputFile = pset.getUntrackedParameter<string>("rootFileName"); theFile = new TFile(theRootInputFile.c_str(), "READ"); theFitter = new DTMeanTimerFitter(theFile); if(debug) theFitter->setVerbosity(1); // the text file which will contain the histos theVDriftOutputFile = pset.getUntrackedParameter<string>("vDriftFileName"); // get parameter set for DTCalibrationMap constructor theCalibFilePar = pset.getUntrackedParameter<ParameterSet>("calibFileConfig"); // the granularity to be used for calib constants evaluation theGranularity = pset.getUntrackedParameter<string>("calibGranularity","bySL"); theMTime = new DTMtime(); if(debug) cout << "[DTVDriftWriter]Constructor called!" << endl; }
DTVDriftWriter::~DTVDriftWriter | ( | ) | [virtual] |
Destructor.
Definition at line 69 of file DTVDriftWriter.cc.
References gather_cfg::cout, debug, and interactiveExample::theFile.
void DTVDriftWriter::analyze | ( | const edm::Event & | event, |
const edm::EventSetup & | eventSetup | ||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 76 of file DTVDriftWriter.cc.
References DTCalibrationMap::addCell(), DTVelocityUnits::cm_per_ns, gather_cfg::cout, debug, edm::EventSetup::get(), DTCalibrationMap::getConsts(), DTCalibrationMap::getKey(), MultiGaussianStateTransform::N, DTChamberId::sector(), DTChamberId::station(), DTSuperLayerId::superLayer(), DTChamberId::wheel(), and DTCalibrationMap::writeConsts().
{ if(debug) cout << "[DTVDriftWriter]Analyzer called!" << endl; // Instantiate a DTCalibrationMap object DTCalibrationMap calibValuesFile(theCalibFilePar); // Get the DT Geometry ESHandle<DTGeometry> dtGeom; eventSetup.get<MuonGeometryRecord>().get(dtGeom); if(theGranularity == "bySL") { // Get all the sls from the setup const vector<DTSuperLayer*> superLayers = dtGeom->superLayers(); // Loop over all SLs for(vector<DTSuperLayer*>::const_iterator slCell = superLayers.begin(); slCell != superLayers.end(); slCell++) { DTSuperLayerId slId = (*slCell)->id(); // evaluate v_drift and sigma from the TMax histograms DTWireId wireId(slId, 0, 0); vector<float> newConstants; TString N=(((((TString) "TMax"+(long) wireId.wheel()) +(long) wireId.station()) +(long) wireId.sector())+(long) wireId.superLayer()); vector<float> vDriftAndReso = theFitter->evaluateVDriftAndReso(N); // Don't write the constants for the SL if the vdrift was not computed if(vDriftAndReso.front() == -1) continue; const DTCalibrationMap::CalibConsts* oldConstants = calibValuesFile.getConsts(wireId); if(oldConstants != 0) { newConstants.push_back((*oldConstants)[0]); newConstants.push_back((*oldConstants)[1]); newConstants.push_back((*oldConstants)[2]); } else { newConstants.push_back(-1); newConstants.push_back(-1); newConstants.push_back(-1); } for(int ivd=0; ivd<=5;ivd++) { // 0=vdrift, 1=reso, 2=(3deltat0-2deltat0), 3=(2deltat0-1deltat0), // 4=(1deltat0-0deltat0), 5=deltat0 from hists with max entries, newConstants.push_back(vDriftAndReso[ivd]); } calibValuesFile.addCell(calibValuesFile.getKey(wireId), newConstants); // vdrift is cm/ns , resolution is cm theMTime->set(slId, vDriftAndReso[0], vDriftAndReso[1], DTVelocityUnits::cm_per_ns); if(debug) { cout << " SL: " << slId << " vDrift = " << vDriftAndReso[0] << " reso = " << vDriftAndReso[1] << endl; } } } // to be implemented: granularity different from bySL // if(theGranularity == "byChamber") { // const vector<DTChamber*> chambers = dMap.chambers(); // // Loop over all chambers // for(vector<MuBarChamber*>::const_iterator chamber = chambers.begin(); // chamber != chambers.end(); chamber ++) { // MuBarChamberId chamber_id = (*chamber)->id(); // MuBarDigiParameters::Key wire_id(chamber_id, 0, 0, 0); // vector<float> newConstants; // vector<float> vDriftAndReso = evaluateVDriftAndReso(wire_id, f); // const CalibConsts* oldConstants = digiParams.getConsts(wire_id); // if(oldConstants !=0) { // newConstants = *oldConstants; // newConstants.push_back(vDriftAndReso[0]); // newConstants.push_back(vDriftAndReso[1]); // newConstants.push_back(vDriftAndReso[2]); // newConstants.push_back(vDriftAndReso[3]); // } else { // newConstants.push_back(-1); // newConstants.push_back(-1); // newConstants.push_back(vDriftAndReso[0]); // newConstants.push_back(vDriftAndReso[1]); // newConstants.push_back(vDriftAndReso[2]); // newConstants.push_back(vDriftAndReso[3]); // } // digiParams.addCell(wire_id, newConstants); // } // } //write values to a table calibValuesFile.writeConsts(theVDriftOutputFile); }
void DTVDriftWriter::endJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 173 of file DTVDriftWriter.cc.
References gather_cfg::cout, debug, and record.
bool DTVDriftWriter::debug [private] |
Definition at line 49 of file DTVDriftWriter.h.
Definition at line 61 of file DTVDriftWriter.h.
TFile* DTVDriftWriter::theFile [private] |
Definition at line 52 of file DTVDriftWriter.h.
DTMeanTimerFitter* DTVDriftWriter::theFitter [private] |
Definition at line 67 of file DTVDriftWriter.h.
std::string DTVDriftWriter::theGranularity [private] |
Definition at line 64 of file DTVDriftWriter.h.
DTMtime* DTVDriftWriter::theMTime [private] |
Definition at line 70 of file DTVDriftWriter.h.
std::string DTVDriftWriter::theRootInputFile [private] |
Definition at line 55 of file DTVDriftWriter.h.
std::string DTVDriftWriter::theVDriftOutputFile [private] |
Definition at line 58 of file DTVDriftWriter.h.