CMS 3D CMS Logo

SiStripCommissioningOfflineDbClient.cc
Go to the documentation of this file.
1 
22 
23 using namespace sistrip;
24 
25 // -----------------------------------------------------------------------------
26 //
29  uploadAnal_( pset.getUntrackedParameter<bool>("UploadAnalyses",false) ),
30  uploadConf_( pset.getUntrackedParameter<bool>("UploadHwConfig",false) )
31 {
33  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
34  << " Constructing object...";
35  if ( !uploadConf_ ) {
37  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
38  << " ===> TEST only! No hardware configurations"
39  << " will be uploaded to the DB...";
40  }
41  if ( !uploadAnal_ ) {
43  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
44  << " ===> TEST only! No analysis descriptions"
45  << " will be uploaded to the DB...";
46  }
47 
48 }
49 
50 // -----------------------------------------------------------------------------
51 //
54  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
55  << " Destructing object...";
56 }
57 
58 // -----------------------------------------------------------------------------
59 //
61 
62  // Check pointer
63  if ( histos_ ) {
65  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
66  << " CommissioningHistogram object already exists!"
67  << " Aborting...";
68  return;
69  }
70 
71  // Check pointer to BEI
72  // is this needed here? bei_ = edm::Service<DQMStore>().operator->();
73  if ( !bei_ ) {
75  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
76  << " NULL pointer to DQMStore!";
77  return;
78  }
79 
80  // Create DB connection
81  SiStripConfigDb* db = edm::Service<SiStripConfigDb>().operator->(); //@@ NOT GUARANTEED TO BE THREAD SAFE!
83  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
84  << " Nota bene: using the SiStripConfigDb API"
85  << " as a \"service\" does not presently guarantee"
86  << " thread-safe behaviour!...";
87 
88  // Check DB connection
89  if ( !db ) {
91  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
92  << " NULL pointer to SiStripConfigDb!"
93  << " Aborting...";
94  return;
95  }
96 
97  // Create corresponding "commissioning histograms" object
99  else if ( runType_ == sistrip::APV_TIMING ) { histos_ = new ApvTimingHistosUsingDb( pset, bei_, db ); }
100  else if ( runType_ == sistrip::OPTO_SCAN ) { histos_ = new OptoScanHistosUsingDb( pset, bei_, db ); }
101  else if ( runType_ == sistrip::VPSP_SCAN ) { histos_ = new VpspScanHistosUsingDb( pset, bei_, db ); }
102  else if ( runType_ == sistrip::PEDESTALS ) { histos_ = new PedestalsHistosUsingDb( pset, bei_, db ); }
103  else if ( runType_ == sistrip::PEDS_ONLY ) { histos_ = new PedsOnlyHistosUsingDb( pset, bei_, db ); }
104  else if ( runType_ == sistrip::PEDS_FULL_NOISE ) { histos_ = new PedsFullNoiseHistosUsingDb( pset, bei_, db ); }
105  else if ( runType_ == sistrip::NOISE ) { histos_ = new NoiseHistosUsingDb( pset, bei_, db ); }
106  else if ( runType_ == sistrip::APV_LATENCY ) { histos_ = new LatencyHistosUsingDb( pset, bei_, db ); }
107  else if ( runType_ == sistrip::FINE_DELAY ) { histos_ = new FineDelayHistosUsingDb( pset, bei_, db ); }
108  else if ( runType_ == sistrip::CALIBRATION ||
112  { histos_ = new CalibrationHistosUsingDb( pset, bei_, db, runType_ ); }
113  else if ( runType_ == sistrip::DAQ_SCOPE_MODE) {histos_ = new DaqScopeModeHistosUsingDb( pset, bei_, db);}
114  else if ( runType_ == sistrip::UNDEFINED_RUN_TYPE ) {
115  histos_ = nullptr;
117  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
118  << " Undefined run type!";
119  return;
120  } else if ( runType_ == sistrip::UNKNOWN_RUN_TYPE ) {
121  histos_ = nullptr;
123  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
124  << " Unknown run type!";
125  return;
126  }
127  histos_->configure(pset,setup);
128 
130  if ( tmp ) {
131  tmp->doUploadConf( uploadConf_ );
132  tmp->doUploadAnal( uploadAnal_ );
133  std::stringstream ss;
134  ss << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
135  << std::endl
136  << " Uploading hardware configurations? : "
137  << ( tmp->doUploadConf() ? "true" : "false" )
138  << std::endl
139  << " Uploading calibrations from analysis? : "
140  << ( tmp->doUploadAnal() ? "true" : "false" )
141  << std::endl;
142  edm::LogVerbatim(mlDqmClient_) << ss.str();
143  } else {
145  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
146  << " NULL pointer to CommissioningHistosUsingDb!";
147  }
148 
149 }
150 
151 // -----------------------------------------------------------------------------
152 //
155  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
156  << " Uploading parameters to database...";
158  if ( tmp ) {
159  tmp->uploadToConfigDb();
161  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
162  << " Uploaded parameters to database!";
163  } else {
165  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
166  << " NULL pointer to CommissioningHistosUsingDb object!"
167  << " Upload aborted!...";
168  }
169 }
void createHistos(const edm::ParameterSet &, const edm::EventSetup &) override
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
static const char mlDqmClient_[]
sistrip classes
Class which reads a root file containing "commissioning histograms", analyzes the histograms to extra...
virtual void configure(const edm::ParameterSet &, const edm::EventSetup &)
static const char mlCabling_[]
An interface class to the DeviceFactory.
#define LogTrace(id)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100