CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripCommissioningOfflineDbClient.cc
Go to the documentation of this file.
1 // Last commit: $Id: SiStripCommissioningOfflineDbClient.cc,v 1.26 2010/04/21 14:26:18 dstrom Exp $
2 
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::UNDEFINED_RUN_TYPE ) {
114  histos_ = 0;
116  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
117  << " Undefined run type!";
118  return;
119  } else if ( runType_ == sistrip::UNKNOWN_RUN_TYPE ) {
120  histos_ = 0;
122  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
123  << " Unknown run type!";
124  return;
125  }
126  histos_->configure(pset,setup);
127 
129  if ( tmp ) {
130  tmp->doUploadConf( uploadConf_ );
131  tmp->doUploadAnal( uploadAnal_ );
132  std::stringstream ss;
133  ss << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
134  << std::endl
135  << " Uploading hardware configurations? : "
136  << ( tmp->doUploadConf() ? "true" : "false" )
137  << std::endl
138  << " Uploading calibrations from analysis? : "
139  << ( tmp->doUploadAnal() ? "true" : "false" )
140  << std::endl;
141  edm::LogVerbatim(mlDqmClient_) << ss.str();
142  } else {
144  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
145  << " NULL pointer to CommissioningHistosUsingDb!";
146  }
147 
148 }
149 
150 // -----------------------------------------------------------------------------
151 //
154  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
155  << " Uploading parameters to database...";
157  if ( tmp ) {
158  tmp->uploadToConfigDb();
160  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
161  << " Uploaded parameters to database!";
162  } else {
164  << "[SiStripCommissioningOfflineDbClient::" << __func__ << "]"
165  << " NULL pointer to CommissioningHistosUsingDb object!"
166  << " Upload aborted!...";
167  }
168 }
tuple db
Definition: EcalCondDB.py:151
static const char mlDqmClient_[]
void createHistos(const edm::ParameterSet &, const edm::EventSetup &)
Class which reads a root file containing &quot;commissioning histograms&quot;, 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
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")