CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
CalibrationHistosUsingDb Class Reference

#include <CalibrationHistosUsingDb.h>

Inheritance diagram for CalibrationHistosUsingDb:
CommissioningHistosUsingDb CalibrationHistograms CommissioningHistograms CommissioningHistograms

Public Member Functions

 CalibrationHistosUsingDb (const edm::ParameterSet &pset, DQMStore *, SiStripConfigDb *const, const sistrip::RunType &task=sistrip::CALIBRATION)
 
void uploadConfigurations () override
 
 ~CalibrationHistosUsingDb () override
 
- Public Member Functions inherited from CommissioningHistosUsingDb
 CommissioningHistosUsingDb (SiStripConfigDb *const, sistrip::RunType=sistrip::UNDEFINED_RUN_TYPE)
 
void configure (const edm::ParameterSet &, const edm::EventSetup &) override
 
bool doUploadAnal () const
 
void doUploadAnal (bool)
 
bool doUploadConf () const
 
void doUploadConf (bool)
 
void uploadToConfigDb ()
 
 ~CommissioningHistosUsingDb () override
 
- Public Member Functions inherited from CommissioningHistograms
 CommissioningHistograms (const edm::ParameterSet &pset, DQMStore *const, const sistrip::RunType &)
 
 CommissioningHistograms ()
 
void createCollations (const std::vector< std::string > &)
 
virtual void createSummaryHisto (const sistrip::Monitorable &, const sistrip::Presentation &, const std::string &top_level_dir, const sistrip::Granularity &)
 
void extractHistograms (const std::vector< std::string > &)
 
virtual void printSummary ()
 
void remove (std::string pattern="")
 
void save (std::string &filename, uint32_t run_number=0, std::string partitionName="")
 
virtual ~CommissioningHistograms ()
 
- Public Member Functions inherited from CalibrationHistograms
 CalibrationHistograms (const edm::ParameterSet &pset, DQMStore *, const sistrip::RunType &task=sistrip::CALIBRATION)
 
void histoAnalysis (bool debug) override
 
void printAnalyses () override
 
 ~CalibrationHistograms () override
 

Private Member Functions

void create (SiStripConfigDb::AnalysisDescriptionsV &, Analysis) override
 
void update (SiStripConfigDb::DeviceDescriptionsRange &)
 

Private Attributes

TH1F * ishaHistogram_
 
TH1F * vfsHistogram_
 

Additional Inherited Members

- Public Types inherited from CommissioningHistograms
typedef std::map< uint32_t, CommissioningAnalysis * > Analyses
 
typedef Analyses::iterator Analysis
 
typedef SummaryPlotFactory< CommissioningAnalysis * > Factory
 
typedef std::map< uint32_t, uint32_t > FedToFecMap
 
typedef std::vector< Histo * > Histos
 
typedef std::map< uint32_t, HistosHistosMap
 
- Static Public Member Functions inherited from CommissioningHistograms
static void copyCustomInformation (DQMStore *const, const std::vector< std::string > &)
 
static void getContents (DQMStore *const, std::vector< std::string > &)
 
static uint32_t runNumber (DQMStore *const, const std::vector< std::string > &)
 
static sistrip::RunType runType (DQMStore *const, const std::vector< std::string > &)
 
- Protected Member Functions inherited from CommissioningHistosUsingDb
virtual void addDcuDetIds ()
 
void buildDetInfo ()
 
SiStripFedCabling *const cabling () const
 
virtual void createAnalyses (SiStripConfigDb::AnalysisDescriptionsV &)
 
SiStripConfigDb *const db () const
 
std::pair< std::string, DetInfodetInfo (const SiStripFecKey &)
 
bool deviceIsPresent (const SiStripFecKey &)
 
void uploadAnalyses ()
 
- Protected Member Functions inherited from CommissioningHistograms
DQMStore *const bei () const
 
void clearHistosMap ()
 
Analysesdata (bool getMaskedData=false)
 
Factory *const factory ()
 
TH1 * histogram (const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &directory, const uint32_t &xbins, const float &xlow=1.*sistrip::invalid_, const float &xhigh=1.*sistrip::invalid_)
 
const HistosMaphistos () const
 
const FedToFecMapmapping () const
 
void printHistosMap ()
 
const edm::ParameterSetpset () const
 
const sistrip::RunTypetask () const
 
- Protected Attributes inherited from CommissioningHistograms
std::unique_ptr< Factoryfactory_
 
- Protected Attributes inherited from CalibrationHistograms
int calchan_
 
int isha_
 
int vfs_
 

Detailed Description

Definition at line 14 of file CalibrationHistosUsingDb.h.

Constructor & Destructor Documentation

CalibrationHistosUsingDb::CalibrationHistosUsingDb ( const edm::ParameterSet pset,
DQMStore bei,
SiStripConfigDb * const  db,
const sistrip::RunType task = sistrip::CALIBRATION 
)

Definition at line 20 of file CalibrationHistosUsingDb.cc.

References stringResolutionProvider_cfi::bin, SiStripConfigDb::DeviceAddress::ccuAddr_, SiStripConfigDb::DeviceAddress::ccuChan_, SiStripConfigDb::deviceAddress(), extract(), SiStripConfigDb::DeviceAddress::fecCrate_, SiStripConfigDb::DeviceAddress::fecRing_, SiStripConfigDb::DeviceAddress::fecSlot_, getBasePath(), SiStripConfigDb::getDeviceDescriptions(), ishaHistogram_, LogTrace, sistrip::mlDqmClient_, alignCSCRings::pwd, AlCaHLTBitMon_QueryRunRegistry::string, and vfsHistogram_.

24  : CommissioningHistograms( pset.getParameter<edm::ParameterSet>("CalibrationParameters"),
25  bei,
26  task ),
28  task ),
29  CalibrationHistograms( pset.getParameter<edm::ParameterSet>("CalibrationParameters"),
30  bei,
31  task )
32 {
34  << "[CalibrationHistosUsingDb::" << __func__ << "]"
35  << " Constructing object...";
36  // Load and dump the current ISHA/VFS values. This is used by the standalone analysis script
37  const SiStripConfigDb::DeviceDescriptionsRange & apvDescriptions = db->getDeviceDescriptions(APV25);
38  for(SiStripConfigDb::DeviceDescriptionsV::const_iterator apv = apvDescriptions.begin();apv!=apvDescriptions.end();++apv) {
39  apvDescription* desc = dynamic_cast<apvDescription*>( *apv );
40  if ( !desc ) { continue; }
41  // Retrieve device addresses from device description
42  const SiStripConfigDb::DeviceAddress& addr = db->deviceAddress(*desc);
43  std::stringstream bin;
44  bin << std::setw(1) << std::setfill('0') << addr.fecCrate_;
45  bin << "." << std::setw(2) << std::setfill('0') << addr.fecSlot_;
46  bin << "." << std::setw(1) << std::setfill('0') << addr.fecRing_;
47  bin << "." << std::setw(3) << std::setfill('0') << addr.ccuAddr_;
48  bin << "." << std::setw(2) << std::setfill('0') << addr.ccuChan_;
49  bin << "." << desc->getAddress();
50  LogTrace(mlDqmClient_) << "Present values for ISHA/VFS of APV "
51  << bin.str() << " : "
52  << static_cast<uint16_t>(desc->getIsha()) << " " << static_cast<uint16_t>(desc->getVfs());
53  }
54  // Load the histograms with the results
55  const std::string& pwd = bei->pwd();
56  std::string ishaPath = getBasePath(pwd);
57  ishaPath += "/ControlView/isha";
58  LogTrace(mlDqmClient_) << "Looking for " << ishaPath;
59  ishaHistogram_ = ExtractTObject<TH1F>().extract( bei->get(ishaPath) );
60  std::string vfsPath = getBasePath(pwd);
61  vfsPath += "/ControlView/vfs";
62  LogTrace(mlDqmClient_) << "Looking for " << vfsPath;
63  vfsHistogram_ = ExtractTObject<TH1F>().extract( bei->get(vfsPath) );
64 
65 }
T getParameter(std::string const &) const
const sistrip::RunType & task() const
static const char mlDqmClient_[]
CalibrationHistograms(const edm::ParameterSet &pset, DQMStore *, const sistrip::RunType &task=sistrip::CALIBRATION)
DeviceDescriptions::range DeviceDescriptionsRange
DeviceAddress deviceAddress(const deviceDescription &)
#define LogTrace(id)
bin
set the eta bin as selection string.
int extract(std::vector< int > *output, const std::string &dati)
DQMStore *const bei() const
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
std::string getBasePath(const std::string &path)
CalibrationHistosUsingDb::~CalibrationHistosUsingDb ( )
override

Definition at line 69 of file CalibrationHistosUsingDb.cc.

References LogTrace, and sistrip::mlDqmClient_.

69  {
71  << "[CalibrationHistosUsingDb::" << __func__ << "]"
72  << " Destructing object...";
73 }
static const char mlDqmClient_[]
#define LogTrace(id)

Member Function Documentation

void CalibrationHistosUsingDb::create ( SiStripConfigDb::AnalysisDescriptionsV desc,
Analysis  analysis 
)
overrideprivatevirtual

Reimplemented from CommissioningHistosUsingDb.

Definition at line 166 of file CalibrationHistosUsingDb.cc.

References CalibrationAnalysis::amplitudeMean(), CalibrationHistograms::calchan_, CalibrationAnalysis::chi2Mean(), CommissioningHistosUsingDb::db(), SiStripConfigDb::dbParams(), CalibrationAnalysis::deconvMode(), CommissioningAnalysis::fecKey(), CommissioningAnalysis::fedKey(), CommissioningAnalysis::getErrorCodes(), SiStripFecKey::i2cAddr(), CalibrationHistograms::isha_, CommissioningAnalysis::isValid(), checklumidiff::ofile, SiStripDbParams::partitions(), CalibrationAnalysis::riseTimeMean(), CalibrationAnalysis::smearingMean(), CalibrationAnalysis::tailMean(), CalibrationAnalysis::timeConstantMean(), tmp, and CalibrationHistograms::vfs_.

167  {
168 
169  CalibrationAnalysis* anal = dynamic_cast<CalibrationAnalysis*>( analysis->second );
170  if ( !anal ) { return; }
171 
172  SiStripFecKey fec_key( anal->fecKey() );
173  SiStripFedKey fed_key( anal->fedKey() );
174 
175  std::ofstream ofile("calibrationResults.txt",ios_base::app);
176  for ( uint16_t iapv = 0; iapv < 2; ++iapv ) {
177 
178  // Create description
179  CalibrationAnalysisDescription *tmp;
180  tmp = new CalibrationAnalysisDescription(anal->amplitudeMean()[iapv],
181  anal->tailMean()[iapv],
182  anal->riseTimeMean()[iapv],
183  anal->timeConstantMean()[iapv],
184  anal->smearingMean()[iapv],
185  anal->chi2Mean()[iapv],
186  anal->deconvMode(),
187  fec_key.fecCrate(),
188  fec_key.fecSlot(),
189  fec_key.fecRing(),
190  fec_key.ccuAddr(),
191  fec_key.ccuChan(),
192  SiStripFecKey::i2cAddr( fec_key.lldChan(), !iapv ),
193  db()->dbParams().partitions().begin()->second.partitionName(),
194  db()->dbParams().partitions().begin()->second.runNumber(),
195  anal->isValid(),
196  "",
197  fed_key.fedId(),
198  fed_key.feUnit(),
199  fed_key.feChan(),
200  fed_key.fedApv(),
201  calchan_,
202  isha_,
203  vfs_ );
204 
205  // debug simplified printout in text file
206  ofile << " " << anal->amplitudeMean()[iapv]
207  << " " << anal->tailMean()[iapv]
208  << " " << anal->riseTimeMean()[iapv]
209  << " " << anal->timeConstantMean()[iapv]
210  << " " << anal->smearingMean()[iapv]
211  << " " << anal->chi2Mean()[iapv]
212  << " " << anal->deconvMode()
213  << " " << fec_key.fecCrate()
214  << " " << fec_key.fecSlot()
215  << " " << fec_key.fecRing()
216  << " " << fec_key.ccuAddr()
217  << " " << fec_key.ccuChan()
218  << " " << SiStripFecKey::i2cAddr( fec_key.lldChan(), !iapv )
219  << " " << db()->dbParams().partitions().begin()->second.partitionName()
220  << " " << db()->dbParams().partitions().begin()->second.runNumber()
221  << " " << fed_key.fedId()
222  << " " << fed_key.feUnit()
223  << " " << fed_key.feChan()
224  << " " << fed_key.fedApv()
225  << " " << calchan_
226  << " " << isha_
227  << " " << vfs_ << std::endl;
228 
229  // Add comments
230  typedef std::vector<std::string> Strings;
231  Strings errors = anal->getErrorCodes();
232  Strings::const_iterator istr = errors.begin();
233  Strings::const_iterator jstr = errors.end();
234  for ( ; istr != jstr; ++istr ) { tmp->addComments( *istr ); }
235 
236  // Store description
237  desc.push_back( tmp );
238  }
239  ofile.close();
240 
241 }
const VFloat & smearingMean() const
const uint32_t & fedKey() const
const VFloat & amplitudeMean() const
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
const VFloat & timeConstantMean() const
virtual bool isValid() const
std::vector< std::string > Strings
Definition: MsgTools.h:18
const VFloat & riseTimeMean() const
const uint16_t & i2cAddr() const
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
const_iterator_range partitions() const
Analysis for calibration runs.
const uint32_t & fecKey() const
const VFloat & chi2Mean() const
const SiStripDbParams & dbParams() const
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
const VFloat & tailMean() const
Definition: errors.py:1
SiStripConfigDb *const db() const
const VString & getErrorCodes() const
void CalibrationHistosUsingDb::update ( SiStripConfigDb::DeviceDescriptionsRange devices)
private

Definition at line 117 of file CalibrationHistosUsingDb.cc.

References stringResolutionProvider_cfi::bin, SiStripConfigDb::DeviceAddress::ccuAddr_, SiStripConfigDb::DeviceAddress::ccuChan_, CommissioningHistosUsingDb::db(), SiStripConfigDb::deviceAddress(), SiStripConfigDb::DeviceAddress::fecCrate_, SiStripConfigDb::DeviceAddress::fecRing_, SiStripConfigDb::DeviceAddress::fecSlot_, mps_fire::i, createfilelist::int, ishaHistogram_, label, LogDebug, sistrip::mlDqmClient_, AlCaHLTBitMon_QueryRunRegistry::string, and vfsHistogram_.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), dqm-mbProfile.Profile::finish(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), Vispa.Gui.PortConnection.PointToPointConnection::updateConnection(), and uploadConfigurations().

117  {
118 
119  if(!ishaHistogram_ && !vfsHistogram_) return;
120 
121  // Iterate through devices and update device descriptions
122  SiStripConfigDb::DeviceDescriptionsV::const_iterator idevice;
123  for ( idevice = devices.begin(); idevice != devices.end(); idevice++ ) {
124 
125  // Check device type
126  if ( (*idevice)->getDeviceType() != APV25 ) { continue; }
127 
128  // Cast to retrieve appropriate description object
129  apvDescription* desc = dynamic_cast<apvDescription*>( *idevice );
130  if ( !desc ) { continue; }
131 
132  // Retrieve the device address from device description
133  const SiStripConfigDb::DeviceAddress& addr = db()->deviceAddress(*desc);
134 
135  // Construct the string for that address
136  std::stringstream bin;
137  bin << std::setw(1) << std::setfill('0') << addr.fecCrate_;
138  bin << "." << std::setw(2) << std::setfill('0') << addr.fecSlot_;
139  bin << "." << std::setw(1) << std::setfill('0') << addr.fecRing_;
140  bin << "." << std::setw(3) << std::setfill('0') << addr.ccuAddr_;
141  bin << "." << std::setw(2) << std::setfill('0') << addr.ccuChan_;
142  bin << "." << desc->getAddress();
143 
144  // Iterate over the histo bins and find the right one
145  for(int i = 1;i <= ishaHistogram_->GetNbinsX(); ++i) {
146  std::string label = ishaHistogram_->GetXaxis()->GetBinLabel(i);
147  if(label == bin.str()) {
148  desc->setIsha( (int)round(ishaHistogram_->GetBinContent(i)) );
149  LogDebug(mlDqmClient_) << "Setting ISHA to " << ((int)round(ishaHistogram_->GetBinContent(i))) << " for " << label;
150  }
151  }
152  for(int i = 1;i <= vfsHistogram_->GetNbinsX(); ++i) {
153  std::string label = vfsHistogram_->GetXaxis()->GetBinLabel(i);
154  if(label == bin.str()) {
155  desc->setVfs( (int)round(vfsHistogram_->GetBinContent(i)) );
156  LogDebug(mlDqmClient_) << "Setting VFS to " << ((int)round(vfsHistogram_->GetBinContent(i))) << " for " << label;
157  }
158  }
159 
160  }
161 
162 }
#define LogDebug(id)
static const char mlDqmClient_[]
char const * label
DeviceAddress deviceAddress(const deviceDescription &)
bin
set the eta bin as selection string.
SiStripConfigDb *const db() const
void CalibrationHistosUsingDb::uploadConfigurations ( )
overridevirtual

Reimplemented from CommissioningHistosUsingDb.

Definition at line 77 of file CalibrationHistosUsingDb.cc.

References CommissioningHistosUsingDb::db(), CommissioningHistosUsingDb::doUploadConf(), SiStripConfigDb::getDeviceDescriptions(), ishaHistogram_, LogTrace, sistrip::mlDqmClient_, update(), SiStripConfigDb::uploadDeviceDescriptions(), and vfsHistogram_.

77  {
78 
80  << "[CalibrationHistosUsingDb::" << __func__ << "]" << ishaHistogram_ << " " << vfsHistogram_;
81 
82  if(!ishaHistogram_ && !vfsHistogram_) return;
83 
84  if ( !db() ) {
86  << "[CalibrationHistosUsingDb::" << __func__ << "]"
87  << " NULL pointer to SiStripConfigDb interface!"
88  << " Aborting upload...";
89  return;
90  }
91 
92  // Update all APV device descriptions with new ISHA and VFS settings
94  update( devices );
95  if ( doUploadConf() ) {
97  << "[CalibrationHistosUsingDb::" << __func__ << "]"
98  << " Uploading ISHA/VFS settings to DB...";
101  << "[CalibrationHistosUsingDb::" << __func__ << "]"
102  << " Uploaded ISHA/VFS settings to DB!";
103  } else {
105  << "[CalibrationHistosUsingDb::" << __func__ << "]"
106  << " TEST only! No ISHA/VFS settings will be uploaded to DB...";
107  }
108 
110  << "[CalibrationHistosUsingDb::" << __func__ << "]"
111  << " Upload of ISHA/VFS settings to DB finished!";
112 
113 }
static const char mlDqmClient_[]
DeviceDescriptions::range DeviceDescriptionsRange
#define LogTrace(id)
void update(SiStripConfigDb::DeviceDescriptionsRange &)
SiStripConfigDb *const db() const
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
void uploadDeviceDescriptions(std::string partition="")

Member Data Documentation

TH1F* CalibrationHistosUsingDb::ishaHistogram_
private
TH1F * CalibrationHistosUsingDb::vfsHistogram_
private