CMS 3D CMS Logo

SiStripCommissioningOfflineDbClient.cc
Go to the documentation of this file.
1 
21 
22 using namespace sistrip;
23 
24 // -----------------------------------------------------------------------------
25 //
28  uploadAnal_( pset.getUntrackedParameter<bool>("UploadAnalyses",false) ),
29  uploadConf_( pset.getUntrackedParameter<bool>("UploadHwConfig",false) )
30 {
32  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
33  << " Constructing object...";
34  if ( !uploadConf_ ) {
36  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
37  << " ===> TEST only! No hardware configurations"
38  << " will be uploaded to the DB...";
39  }
40  if ( !uploadAnal_ ) {
42  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
43  << " ===> TEST only! No analysis descriptions"
44  << " will be uploaded to the DB...";
45  }
46 
47 }
48 
49 // -----------------------------------------------------------------------------
50 //
53  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
54  << " Destructing object...";
55 }
56 
57 // -----------------------------------------------------------------------------
58 //
60 
61  // Check pointer
62  if ( histos_ ) {
64  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
65  << " CommissioningHistogram object already exists!"
66  << " Aborting...";
67  return;
68  }
69 
70  // Check pointer to BEI
71  // is this needed here? bei_ = edm::Service<DQMStore>().operator->();
72  if ( !bei_ ) {
74  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
75  << " NULL pointer to DQMStore!";
76  return;
77  }
78 
79  // Create DB connection
80  SiStripConfigDb* db = edm::Service<SiStripConfigDb>().operator->(); //@@ NOT GUARANTEED TO BE THREAD SAFE!
82  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
83  << " Nota bene: using the SiStripConfigDb API"
84  << " as a \"service\" does not presently guarantee"
85  << " thread-safe behaviour!...";
86 
87  // Check DB connection
88  if ( !db ) {
90  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
91  << " NULL pointer to SiStripConfigDb!"
92  << " Aborting...";
93  return;
94  }
95 
96  // Create corresponding "commissioning histograms" object
98  else if ( runType_ == sistrip::APV_TIMING ) { histos_ = new ApvTimingHistosUsingDb( pset, bei_, db ); }
99  else if ( runType_ == sistrip::OPTO_SCAN ) { histos_ = new OptoScanHistosUsingDb( pset, bei_, db ); }
100  else if ( runType_ == sistrip::VPSP_SCAN ) { histos_ = new VpspScanHistosUsingDb( pset, bei_, db ); }
101  else if ( runType_ == sistrip::PEDESTALS ) { histos_ = new PedestalsHistosUsingDb( pset, bei_, db ); }
102  else if ( runType_ == sistrip::PEDS_ONLY ) { histos_ = new PedsOnlyHistosUsingDb( pset, bei_, db ); }
103  else if ( runType_ == sistrip::PEDS_FULL_NOISE ) { histos_ = new PedsFullNoiseHistosUsingDb( pset, bei_, db ); }
104  else if ( runType_ == sistrip::NOISE ) { histos_ = new NoiseHistosUsingDb( pset, bei_, db ); }
105  else if ( runType_ == sistrip::APV_LATENCY ) { histos_ = new LatencyHistosUsingDb( pset, bei_, db ); }
106  else if ( runType_ == sistrip::FINE_DELAY ) { histos_ = new FineDelayHistosUsingDb( pset, bei_, db ); }
107  else if ( runType_ == sistrip::CALIBRATION ||
111  { histos_ = new CalibrationHistosUsingDb( pset, bei_, db, runType_ ); }
112  else if ( runType_ == sistrip::UNDEFINED_RUN_TYPE ) {
113  histos_ = nullptr;
115  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
116  << " Undefined run type!";
117  return;
118  } else if ( runType_ == sistrip::UNKNOWN_RUN_TYPE ) {
119  histos_ = nullptr;
121  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
122  << " Unknown run type!";
123  return;
124  }
125  histos_->configure(pset,setup);
126 
128  if ( tmp ) {
129  tmp->doUploadConf( uploadConf_ );
130  tmp->doUploadAnal( uploadAnal_ );
131  std::stringstream ss;
132  ss << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
133  << std::endl
134  << " Uploading hardware configurations? : "
135  << ( tmp->doUploadConf() ? "true" : "false" )
136  << std::endl
137  << " Uploading calibrations from analysis? : "
138  << ( tmp->doUploadAnal() ? "true" : "false" )
139  << std::endl;
140  edm::LogVerbatim(mlDqmClient_) << ss.str();
141  } else {
143  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
144  << " NULL pointer to CommissioningHistosUsingDb!";
145  }
146 
147 }
148 
149 // -----------------------------------------------------------------------------
150 //
153  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
154  << " Uploading parameters to database...";
156  if ( tmp ) {
157  tmp->uploadToConfigDb();
159  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
160  << " Uploaded parameters to database!";
161  } else {
163  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
164  << " NULL pointer to CommissioningHistosUsingDb object!"
165  << " Upload aborted!...";
166  }
167 }
void createHistos(const edm::ParameterSet &, const edm::EventSetup &) override
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
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