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 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 21 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_, getBasePath(), SiStripConfigDb::getDeviceDescriptions(), ishaHistogram_, LogTrace, sistrip::mlDqmClient_, alignCSCRings::pwd, AlCaHLTBitMon_QueryRunRegistry::string, and vfsHistogram_.

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

Definition at line 70 of file CalibrationHistosUsingDb.cc.

References LogTrace, and sistrip::mlDqmClient_.

70  {
72  << "[CalibrationHistosUsingDb::" << __func__ << "]"
73  << " Destructing object...";
74 }
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 167 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_.

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

Definition at line 118 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__(), 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(), 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().

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

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

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