CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
virtual void uploadConfigurations ()
 
virtual ~CalibrationHistosUsingDb ()
 
- Public Member Functions inherited from CommissioningHistosUsingDb
 CommissioningHistosUsingDb (SiStripConfigDb *const, sistrip::RunType=sistrip::UNDEFINED_RUN_TYPE)
 
bool doUploadAnal () const
 
void doUploadAnal (bool)
 
bool doUploadConf () const
 
void doUploadConf (bool)
 
void uploadToConfigDb ()
 
virtual ~CommissioningHistosUsingDb ()
 
- Public Member Functions inherited from CommissioningHistograms
 CommissioningHistograms (const edm::ParameterSet &pset, DQMStore *const, const sistrip::RunType &)
 
 CommissioningHistograms ()
 
virtual void configure (const edm::ParameterSet &, const edm::EventSetup &)
 
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)
 
virtual ~CommissioningHistograms ()
 
- Public Member Functions inherited from CalibrationHistograms
 CalibrationHistograms (const edm::ParameterSet &pset, DQMStore *, const sistrip::RunType &task=sistrip::CALIBRATION)
 
void histoAnalysis (bool debug)
 
void printAnalyses ()
 
virtual ~CalibrationHistograms ()
 

Private Member Functions

void create (SiStripConfigDb::AnalysisDescriptionsV &, Analysis)
 
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,
Histos
HistosMap
 
- 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 ()
 
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::auto_ptr< Factoryfactory_
 
- Protected Attributes inherited from CalibrationHistograms
int calchan_
 
int isha_
 
int vfs_
 

Detailed Description

Definition at line 15 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 22 of file CalibrationHistosUsingDb.cc.

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

26  : CommissioningHistograms( pset.getParameter<edm::ParameterSet>("CalibrationParameters"),
27  bei,
28  task ),
30  task ),
31  CalibrationHistograms( pset.getParameter<edm::ParameterSet>("CalibrationParameters"),
32  bei,
33  task )
34 {
36  << "[CalibrationHistosUsingDb::" << __func__ << "]"
37  << " Constructing object...";
38  // Load and dump the current ISHA/VFS values. This is used by the standalone analysis script
39  const SiStripConfigDb::DeviceDescriptionsRange & apvDescriptions = db->getDeviceDescriptions(APV25);
40  for(SiStripConfigDb::DeviceDescriptionsV::const_iterator apv = apvDescriptions.begin();apv!=apvDescriptions.end();++apv) {
41  apvDescription* desc = dynamic_cast<apvDescription*>( *apv );
42  if ( !desc ) { continue; }
43  // Retrieve device addresses from device description
44  const SiStripConfigDb::DeviceAddress& addr = db->deviceAddress(*desc);
45  std::stringstream bin;
46  bin << std::setw(1) << std::setfill('0') << addr.fecCrate_;
47  bin << "." << std::setw(2) << std::setfill('0') << addr.fecSlot_;
48  bin << "." << std::setw(1) << std::setfill('0') << addr.fecRing_;
49  bin << "." << std::setw(3) << std::setfill('0') << addr.ccuAddr_;
50  bin << "." << std::setw(2) << std::setfill('0') << addr.ccuChan_;
51  bin << "." << desc->getAddress();
52  LogTrace(mlDqmClient_) << "Present values for ISHA/VFS of APV "
53  << bin.str() << " : "
54  << static_cast<uint16_t>(desc->getIsha()) << " " << static_cast<uint16_t>(desc->getVfs());
55  }
56  // Load the histograms with the results
57  std::string pwd = bei->pwd();
58  std::string ishaPath = getBasePath(pwd);
59  ishaPath += "/ControlView/isha";
60  LogTrace(mlDqmClient_) << "Looking for " << ishaPath;
61  ishaHistogram_ = ExtractTObject<TH1F>().extract( bei->get(ishaPath) );
62  std::string vfsPath = getBasePath(pwd);
63  vfsPath += "/ControlView/vfs";
64  LogTrace(mlDqmClient_) << "Looking for " << vfsPath;
65  vfsHistogram_ = ExtractTObject<TH1F>().extract( bei->get(vfsPath) );
66 
67 }
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 &)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1473
#define LogTrace(id)
int extract(std::vector< int > *output, const std::string &dati)
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
std::string getBasePath(const std::string &path)
const std::string & pwd(void) const
Definition: DQMStore.cc:406
CalibrationHistosUsingDb::~CalibrationHistosUsingDb ( )
virtual

Definition at line 71 of file CalibrationHistosUsingDb.cc.

References LogTrace, and sistrip::mlDqmClient_.

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

Member Function Documentation

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

Reimplemented from CommissioningHistosUsingDb.

Definition at line 168 of file CalibrationHistosUsingDb.cc.

References CalibrationAnalysis::amplitudeMean(), CalibrationHistograms::calchan_, CalibrationAnalysis::chi2Mean(), CommissioningHistosUsingDb::db(), SiStripConfigDb::dbParams(), CalibrationAnalysis::deconvMode(), benchmark_cfg::errors, 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_.

169  {
170 
171  CalibrationAnalysis* anal = dynamic_cast<CalibrationAnalysis*>( analysis->second );
172  if ( !anal ) { return; }
173 
174  SiStripFecKey fec_key( anal->fecKey() );
175  SiStripFedKey fed_key( anal->fedKey() );
176 
177  std::ofstream ofile("calibrationResults.txt",ios_base::app);
178  for ( uint16_t iapv = 0; iapv < 2; ++iapv ) {
179 
180  // Create description
181  CalibrationAnalysisDescription *tmp;
182  tmp = new CalibrationAnalysisDescription(anal->amplitudeMean()[iapv],
183  anal->tailMean()[iapv],
184  anal->riseTimeMean()[iapv],
185  anal->timeConstantMean()[iapv],
186  anal->smearingMean()[iapv],
187  anal->chi2Mean()[iapv],
188  anal->deconvMode(),
189  fec_key.fecCrate(),
190  fec_key.fecSlot(),
191  fec_key.fecRing(),
192  fec_key.ccuAddr(),
193  fec_key.ccuChan(),
194  SiStripFecKey::i2cAddr( fec_key.lldChan(), !iapv ),
195  db()->dbParams().partitions().begin()->second.partitionName(),
196  db()->dbParams().partitions().begin()->second.runNumber(),
197  anal->isValid(),
198  "",
199  fed_key.fedId(),
200  fed_key.feUnit(),
201  fed_key.feChan(),
202  fed_key.fedApv(),
203  calchan_,
204  isha_,
205  vfs_ );
206 
207  // debug simplified printout in text file
208  ofile << " " << anal->amplitudeMean()[iapv]
209  << " " << anal->tailMean()[iapv]
210  << " " << anal->riseTimeMean()[iapv]
211  << " " << anal->timeConstantMean()[iapv]
212  << " " << anal->smearingMean()[iapv]
213  << " " << anal->chi2Mean()[iapv]
214  << " " << anal->deconvMode()
215  << " " << fec_key.fecCrate()
216  << " " << fec_key.fecSlot()
217  << " " << fec_key.fecRing()
218  << " " << fec_key.ccuAddr()
219  << " " << fec_key.ccuChan()
220  << " " << SiStripFecKey::i2cAddr( fec_key.lldChan(), !iapv )
221  << " " << db()->dbParams().partitions().begin()->second.partitionName()
222  << " " << db()->dbParams().partitions().begin()->second.runNumber()
223  << " " << fed_key.fedId()
224  << " " << fed_key.feUnit()
225  << " " << fed_key.feChan()
226  << " " << fed_key.fedApv()
227  << " " << calchan_
228  << " " << isha_
229  << " " << vfs_ << std::endl;
230 
231  // Add comments
232  typedef std::vector<std::string> Strings;
233  Strings errors = anal->getErrorCodes();
234  Strings::const_iterator istr = errors.begin();
235  Strings::const_iterator jstr = errors.end();
236  for ( ; istr != jstr; ++istr ) { tmp->addComments( *istr ); }
237 
238  // Store description
239  desc.push_back( tmp );
240  }
241  ofile.close();
242 
243 }
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:57
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:46
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
SiStripConfigDb *const db() const
const VString & getErrorCodes() const
void CalibrationHistosUsingDb::update ( SiStripConfigDb::DeviceDescriptionsRange devices)
private

Definition at line 119 of file CalibrationHistosUsingDb.cc.

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

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.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(), 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(), relval_steps.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().

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

Reimplemented from CommissioningHistosUsingDb.

Definition at line 79 of file CalibrationHistosUsingDb.cc.

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

79  {
80 
82  << "[CalibrationHistosUsingDb::" << __func__ << "]" << ishaHistogram_ << " " << vfsHistogram_;
83 
84  if(!ishaHistogram_ && !vfsHistogram_) return;
85 
86  if ( !db() ) {
88  << "[CalibrationHistosUsingDb::" << __func__ << "]"
89  << " NULL pointer to SiStripConfigDb interface!"
90  << " Aborting upload...";
91  return;
92  }
93 
94  // Update all APV device descriptions with new ISHA and VFS settings
96  update( devices );
97  if ( doUploadConf() ) {
99  << "[CalibrationHistosUsingDb::" << __func__ << "]"
100  << " Uploading ISHA/VFS settings to DB...";
103  << "[CalibrationHistosUsingDb::" << __func__ << "]"
104  << " Uploaded ISHA/VFS settings to DB!";
105  } else {
107  << "[CalibrationHistosUsingDb::" << __func__ << "]"
108  << " TEST only! No ISHA/VFS settings will be uploaded to DB...";
109  }
110 
112  << "[CalibrationHistosUsingDb::" << __func__ << "]"
113  << " Upload of ISHA/VFS settings to DB finished!";
114 
115 }
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