CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripBackplaneCalibration Class Reference
Inheritance diagram for SiStripBackplaneCalibration:
IntegratedCalibrationBase

Public Member Functions

void beginOfJob (AlignableTracker *tracker, AlignableMuon *muon, AlignableExtras *extras) override
 
unsigned int derivatives (std::vector< ValuesIndexPair > &outDerivInds, const TransientTrackingRecHit &hit, const TrajectoryStateOnSurface &tsos, const edm::EventSetup &setup, const EventInfo &eventInfo) const override
 
void endOfJob () override
 
double getParameter (unsigned int index) const override
 
double getParameterError (unsigned int index) const override
 
unsigned int numParameters () const override
 How many parameters does this calibration define? More...
 
bool setParameter (unsigned int index, double value) override
 
bool setParameterError (unsigned int index, double error) override
 
 SiStripBackplaneCalibration (const edm::ParameterSet &cfg)
 Constructor. More...
 
 ~SiStripBackplaneCalibration () override
 Destructor. More...
 
- Public Member Functions inherited from IntegratedCalibrationBase
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 
virtual std::vector< Valuesderivatives (const TrackingRecHit &hit, const TrajectoryStateOnSurface &tsos, const edm::EventSetup &setup, const EventInfo &eventInfo) const
 
virtual unsigned int derivatives (std::vector< ValuesIndexPair > &outDerivInds, const TrackingRecHit &hit, const TrajectoryStateOnSurface &tsos, const edm::EventSetup &setup, const EventInfo &eventInfo) const =0
 
virtual void endOfLoop ()
 
 IntegratedCalibrationBase (const edm::ParameterSet &cfg)
 Values and their parameter index. More...
 
const std::string & name () const
 name of this calibration More...
 
virtual void startNewLoop ()
 
virtual ~IntegratedCalibrationBase ()
 Destructor. More...
 

Private Member Functions

bool checkBackPlaneCorrectionInput (const edm::EventSetup &setup, const EventInfo &eventInfo)
 
SiStripBackPlaneCorrectioncreateFromTree (const char *fileName, const char *treeName) const
 
const SiStripBackPlaneCorrectiongetBackPlaneCorrectionInput ()
 
double getParameterForDetId (unsigned int detId, edm::RunNumber_t run) const
 
void writeTree (const SiStripBackPlaneCorrection *backPlaneCorr, const std::map< unsigned int, TreeStruct > &treeInfo, const char *treeName) const
 

Private Attributes

const std::vector< std::string > mergeFileNames_
 
const edm::ParameterSet moduleGroupSelCfg_
 
TkModuleGroupSelectormoduleGroupSelector_
 
const std::string outFileName_
 
std::vector< double > parameters_
 
std::vector< double > paramUncertainties_
 
int16_t readoutMode_
 
const std::string readoutModeName_
 
const std::string recordNameDBwrite_
 
const bool saveToDB_
 
SiStripBackPlaneCorrectionsiStripBackPlaneCorrInput_
 
edm::ESWatcher< SiStripBackPlaneCorrectionRcdwatchBackPlaneCorrRcd_
 

Additional Inherited Members

- Public Types inherited from IntegratedCalibrationBase
typedef AlignmentAlgorithmBase::EventInfo EventInfo
 
typedef std::pair< double, double > Values
 
typedef std::pair< Values, unsigned int > ValuesIndexPair
 x- and y-values More...
 

Detailed Description

Author
: Gero Flucke date : November 2012
Revision
1.1.2.13
Date
2013/05/31 08:37:12

(last update by

Author
flucke

)

Calibration of back plane corrections for the strip tracker, integrated in the alignment algorithms. Note that not all algorithms support this...

Usally use one instance for deco mode data since peak mode should give the

Definition at line 54 of file SiStripBackplaneCalibration.cc.

Constructor & Destructor Documentation

◆ SiStripBackplaneCalibration()

SiStripBackplaneCalibration::SiStripBackplaneCalibration ( const edm::ParameterSet cfg)
explicit

Constructor.

Definition at line 144 of file SiStripBackplaneCalibration.cc.

146  readoutModeName_(cfg.getParameter<std::string>("readoutMode")),
147  saveToDB_(cfg.getParameter<bool>("saveToDB")),
148  recordNameDBwrite_(cfg.getParameter<std::string>("recordNameDBwrite")),
149  outFileName_(cfg.getParameter<std::string>("treeFile")),
150  mergeFileNames_(cfg.getParameter<std::vector<std::string> >("mergeTreeFiles")),
152  moduleGroupSelector_(nullptr),
153  moduleGroupSelCfg_(cfg.getParameter<edm::ParameterSet>("BackplaneModuleGroups")) {
154  // SiStripLatency::singleReadOutMode() returns
155  // 1: all in peak, 0: all in deco, -1: mixed state
156  // (in principle one could treat even mixed state APV by APV...)
157  if (readoutModeName_ == "peak") {
159  } else if (readoutModeName_ == "deconvolution") {
161  } else {
162  throw cms::Exception("BadConfig") << "SiStripBackplaneCalibration:\n"
163  << "Unknown mode '" << readoutModeName_
164  << "', should be 'peak' or 'deconvolution' .\n";
165  }
166 }

References Exception, kDeconvolutionMode, kPeakMode, readoutMode_, and readoutModeName_.

◆ ~SiStripBackplaneCalibration()

SiStripBackplaneCalibration::~SiStripBackplaneCalibration ( )
override

Destructor.

Definition at line 169 of file SiStripBackplaneCalibration.cc.

169  {
170  delete moduleGroupSelector_;
171  // std::cout << "Destroy SiStripBackplaneCalibration named " << this->name() << std::endl;
173 }

References moduleGroupSelector_, and siStripBackPlaneCorrInput_.

Member Function Documentation

◆ beginOfJob()

void SiStripBackplaneCalibration::beginOfJob ( AlignableTracker tracker,
AlignableMuon muon,
AlignableExtras extras 
)
overridevirtual

Call at beginning of job: default implementation is dummy, to be overwritten in derived class if useful.

Reimplemented from IntegratedCalibrationBase.

Definition at line 278 of file SiStripBackplaneCalibration.cc.

280  {
281  //specify the sub-detectors for which the back plane correction is determined: all strips
282  const std::vector<int> sdets = {SiStripDetId::TIB, SiStripDetId::TID, SiStripDetId::TOB, SiStripDetId::TEC};
283 
285 
288 
289  edm::LogInfo("Alignment") << "@SUB=SiStripBackplaneCalibration"
290  << "Created with name " << this->name() << " for readout mode '" << readoutModeName_
291  << "',\n"
292  << this->numParameters() << " parameters to be determined."
293  << "\nsaveToDB = " << saveToDB_ << "\n outFileName = " << outFileName_
294  << "\n N(merge files) = " << mergeFileNames_.size()
295  << "\n number of IOVs = " << moduleGroupSelector_->numIovs();
296 
297  if (!mergeFileNames_.empty()) {
298  edm::LogInfo("Alignment") << "@SUB=SiStripBackplaneCalibration"
299  << "First file to merge: " << mergeFileNames_[0];
300  }
301 }

References TkModuleGroupSelector::getNumberOfParameters(), mergeFileNames_, moduleGroupSelCfg_, moduleGroupSelector_, IntegratedCalibrationBase::name(), TkModuleGroupSelector::numIovs(), numParameters(), outFileName_, parameters_, paramUncertainties_, readoutModeName_, saveToDB_, SiStripDetId::TEC, SiStripDetId::TIB, SiStripDetId::TID, and SiStripDetId::TOB.

◆ checkBackPlaneCorrectionInput()

bool SiStripBackplaneCalibration::checkBackPlaneCorrectionInput ( const edm::EventSetup setup,
const EventInfo eventInfo 
)
private

If called the first time, fill 'siStripBackPlaneCorrInput_', later check that Backplane has not changed.

Definition at line 394 of file SiStripBackplaneCalibration.cc.

395  {
396  edm::ESHandle<SiStripBackPlaneCorrection> backPlaneCorrHandle;
398  setup.get<SiStripBackPlaneCorrectionRcd>().get(readoutModeName_, backPlaneCorrHandle);
399  siStripBackPlaneCorrInput_ = new SiStripBackPlaneCorrection(*backPlaneCorrHandle);
400  // FIXME: Should we call 'watchBackPlaneCorrRcd_.check(setup)' as well?
401  // Otherwise could be that next check has to check via following 'else', though
402  // no new IOV has started... (to be checked)
403  } else {
404  if (watchBackPlaneCorrRcd_.check(setup)) { // new IOV of input - but how to check peak vs deco?
405  setup.get<SiStripBackPlaneCorrectionRcd>().get(readoutModeName_, backPlaneCorrHandle);
406  if (backPlaneCorrHandle->getBackPlaneCorrections() // but only bad if non-identical values
407  != siStripBackPlaneCorrInput_->getBackPlaneCorrections()) { // (comparing maps)
408  // Maps are containers sorted by key, but comparison problems may arise from
409  // 'floating point comparison' problems (FIXME?)
410  throw cms::Exception("BadInput") << "SiStripBackplaneCalibration::checkBackPlaneCorrectionInput:\n"
411  << "Content of SiStripBackPlaneCorrection changed at run "
412  << eventInfo.eventId().run() << ", but algorithm expects constant input!\n";
413  return false; // not reached...
414  }
415  }
416  }
417 
418  return true;
419 }

References edm::ESWatcher< T >::check(), ZMuMuAnalysisNtupler_cff::eventInfo, Exception, get, SiStripBackPlaneCorrection::getBackPlaneCorrections(), readoutModeName_, singleTopDQM_cfi::setup, siStripBackPlaneCorrInput_, and watchBackPlaneCorrRcd_.

◆ createFromTree()

SiStripBackPlaneCorrection * SiStripBackplaneCalibration::createFromTree ( const char *  fileName,
const char *  treeName 
) const
private

Definition at line 510 of file SiStripBackplaneCalibration.cc.

511  {
512  // Check for file existence on your own to work around
513  // https://hypernews.cern.ch/HyperNews/CMS/get/swDevelopment/2715.html:
514  TFile *file = nullptr;
515  FILE *testFile = fopen(fileName, "r");
516  if (testFile) {
517  fclose(testFile);
518  file = TFile::Open(fileName, "READ");
519  } // else not existing, see error below
520 
521  TTree *tree = nullptr;
522  if (file)
523  file->GetObject(treeName, tree);
524 
526  if (tree) {
527  unsigned int id = 0;
528  float value = 0.;
529  tree->SetBranchAddress("detId", &id);
530  tree->SetBranchAddress("value", &value);
531 
533  const Long64_t nEntries = tree->GetEntries();
534  for (Long64_t iEntry = 0; iEntry < nEntries; ++iEntry) {
535  tree->GetEntry(iEntry);
536  result->putBackPlaneCorrection(id, value);
537  }
538  } else { // Warning only since could be parallel job on no events.
539  edm::LogWarning("Alignment") << "@SUB=SiStripBackplaneCalibration::createFromTree"
540  << "Could not get TTree '" << treeName << "' from file '" << fileName
541  << (file ? "'." : "' (file does not exist).");
542  }
543 
544  delete file; // tree will vanish with file
545  return result;
546 }

References FrontierConditions_GlobalTag_cff::file, MillePedeFileConverter_cfg::fileName, and mps_fire::result.

Referenced by getBackPlaneCorrectionInput().

◆ derivatives()

unsigned int SiStripBackplaneCalibration::derivatives ( std::vector< ValuesIndexPair > &  outDerivInds,
const TransientTrackingRecHit hit,
const TrajectoryStateOnSurface tsos,
const edm::EventSetup setup,
const EventInfo eventInfo 
) const
override

Return non-zero derivatives for x- and y-measurements with their indices by reference. Return value is their number.

Definition at line 179 of file SiStripBackplaneCalibration.cc.

183  {
184  // ugly const-cast:
185  // But it is either only first initialisation or throwing an exception...
186  const_cast<SiStripBackplaneCalibration *>(this)->checkBackPlaneCorrectionInput(setup, eventInfo);
187 
188  outDerivInds.clear();
189 
192  const int16_t mode = latency->singleReadOutMode();
193 
194  if (mode == readoutMode_) {
195  if (hit.det()) { // otherwise 'constraint hit' or whatever
196 
197  const int index =
198  moduleGroupSelector_->getParameterIndexFromDetId(hit.det()->geographicalId(), eventInfo.eventId().run());
199  if (index >= 0) { // otherwise not treated
202  const GlobalVector bField(magneticField->inTesla(hit.det()->surface().position()));
203  const LocalVector bFieldLocal(hit.det()->surface().toLocal(bField));
204  //std::cout << "SiStripBackplaneCalibration derivatives " << readoutModeName_ << std::endl;
205  const double dZ = hit.det()->surface().bounds().thickness(); // it's a float only...
206  const double tanPsi = tsos.localParameters().mixedFormatVector()[1]; //float...
207 
208  edm::ESHandle<SiStripLorentzAngle> lorentzAngleHandle;
209  setup.get<SiStripLorentzAngleRcd>().get(readoutModeName_, lorentzAngleHandle);
210  // Yes, mobility (= LA/By) stored in object called LA...
211  const double mobility = lorentzAngleHandle->getLorentzAngle(hit.det()->geographicalId());
212  // shift due to dead back plane has two parts:
213  // 1) Lorentz Angle correction formula gets reduced thickness dz*(1-bp)
214  // 2) 'Direct' effect is shift of effective module position in local z by bp*dz/2
215  // (see GF's presentation in alignment meeting 25.10.2012,
216  // https://indico.cern.ch/conferenceDisplay.py?confId=174266#2012-10-25)
217  // const double xDerivative = 0.5 * dZ * (mobility * bFieldLocal.y() - tanPsi);
218  //FIXME: +tanPsi? At least that fits the sign of the dr/dw residual
219  // in KarimakiDerivatives...
220  const double xDerivative = 0.5 * dZ * (mobility * bFieldLocal.y() + tanPsi);
221  // std::cout << "derivative is " << xDerivative << " for index " << index
222  // << std::endl;
223  // if (index >= 10) {
224  // std::cout << "mobility * y-field " << mobility * bFieldLocal.y()
225  // << ", \n tanPsi " << tanPsi /*<< ", dZ " << dZ */ << std::endl;
226  // std::cout << "|tanPsi| - |mobility * y-field| "
227  // << fabs(tanPsi) - fabs(mobility * bFieldLocal.y())
228  // << std::endl;
229  // }
230  const Values derivs(xDerivative, 0.); // yDerivative = 0.
231  outDerivInds.push_back(ValuesIndexPair(derivs, index));
232  }
233  } else {
234  edm::LogWarning("Alignment") << "@SUB=SiStripBackplaneCalibration::derivatives1"
235  << "Hit without GeomDet, skip!";
236  }
237  } else if (mode != kDeconvolutionMode && mode != kPeakMode) {
238  // warn only if unknown/mixed mode
239  edm::LogWarning("Alignment") << "@SUB=SiStripBackplaneCalibration::derivatives2"
240  << "Readout mode is " << mode << ", but looking for " << readoutMode_ << " ("
241  << readoutModeName_ << ").";
242  }
243 
244  return outDerivInds.size();
245 }

References Calorimetry_cff::bField, ZMuMuAnalysisNtupler_cff::eventInfo, get, SiStripLorentzAngle::getLorentzAngle(), TkModuleGroupSelector::getParameterIndexFromDetId(), kDeconvolutionMode, kPeakMode, config_102169_raw_cff::latency, TrajectoryStateOnSurface::localParameters(), HLT_2018_cff::magneticField, LocalTrajectoryParameters::mixedFormatVector(), ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, moduleGroupSelector_, readoutMode_, readoutModeName_, and singleTopDQM_cfi::setup.

◆ endOfJob()

void SiStripBackplaneCalibration::endOfJob ( )
overridevirtual

Called at end of a the job of the AlignmentProducer. Write out determined parameters.

Implements IntegratedCalibrationBase.

Definition at line 304 of file SiStripBackplaneCalibration.cc.

304  {
305  // loginfo output
306  std::ostringstream out;
307  out << "Parameter results for readout mode '" << readoutModeName_ << "'\n";
308  for (unsigned int iPar = 0; iPar < parameters_.size(); ++iPar) {
309  out << iPar << ": " << parameters_[iPar] << " +- " << paramUncertainties_[iPar] << "\n";
310  }
311  edm::LogInfo("Alignment") << "@SUB=SiStripBackplaneCalibration::endOfJob" << out.str();
312 
313  std::map<unsigned int, TreeStruct> treeInfo; // map of TreeStruct for each detId
314 
315  // now write 'input' tree
316  const SiStripBackPlaneCorrection *input = this->getBackPlaneCorrectionInput(); // never NULL
317  const std::string treeName(this->name() + '_' + readoutModeName_ + '_');
318  this->writeTree(input, treeInfo, (treeName + "input").c_str()); // empty treeInfo for input...
319 
320  if (input->getBackPlaneCorrections().empty()) {
321  edm::LogError("Alignment") << "@SUB=SiStripBackplaneCalibration::endOfJob"
322  << "Input back plane correction map is empty ('" << readoutModeName_
323  << "' mode), skip writing output!";
324  return;
325  }
326 
327  const unsigned int nonZeroParamsOrErrors = // Any determined value?
328  count_if(parameters_.begin(), parameters_.end(), [](auto c) { return c != 0.; }) +
329  count_if(paramUncertainties_.begin(), paramUncertainties_.end(), [](auto c) { return c != 0.; });
330 
331  for (unsigned int iIOV = 0; iIOV < moduleGroupSelector_->numIovs(); ++iIOV) {
332  cond::Time_t firstRunOfIOV = moduleGroupSelector_->firstRunOfIOV(iIOV);
334  // Loop on map of values from input and add (possible) parameter results
335  for (auto iterIdValue = input->getBackPlaneCorrections().begin();
336  iterIdValue != input->getBackPlaneCorrections().end();
337  ++iterIdValue) {
338  // type of (*iterIdValue) is pair<unsigned int, float>
339  const unsigned int detId = iterIdValue->first; // key of map is DetId
340  // Some code one could use to miscalibrate wrt input:
341  // double param = 0.;
342  // const DetId id(detId);
343  // switch (id.subdetId()) {
344  // case 3:
345  // // delta = 0.025;
346  // {
347  // TIBDetId tibId(detId);
348  // param = tibId.layer() * 0.01;
349  // }
350  // break;
351  // case 5:
352  // //delta = 0.050;
353  // {
354  // TOBDetId tobId(detId);
355  // param = tobId.layer() * 0.015;
356  // }
357  // break;
358  // case 4: // TID
359  // param = 0.03; break;
360  // case 6: // TEC
361  // param = 0.05; break;
362  // break;
363  // default:
364  // std::cout << "unknown subdet " << id.subdetId() << std::endl;
365  // }
366  const double param = this->getParameterForDetId(detId, firstRunOfIOV);
367  // put result in output, i.e. sum of input and determined parameter:
368  output->putBackPlaneCorrection(detId, iterIdValue->second + param);
369  const int paramIndex = moduleGroupSelector_->getParameterIndexFromDetId(detId, firstRunOfIOV);
370  treeInfo[detId] = TreeStruct(param, this->getParameterError(paramIndex), paramIndex);
371  }
372 
373  if (saveToDB_ || nonZeroParamsOrErrors != 0) { // Skip writing mille jobs...
374  this->writeTree(output, treeInfo, (treeName + Form("result_%lld", firstRunOfIOV)).c_str());
375  }
376 
377  if (saveToDB_) { // If requested, write out to DB
379  if (dbService.isAvailable()) {
380  dbService->writeOne(output, firstRunOfIOV, recordNameDBwrite_);
381  // no 'delete output;': writeOne(..) took over ownership
382  } else {
383  delete output;
384  edm::LogError("BadConfig") << "@SUB=SiStripBackplaneCalibration::endOfJob"
385  << "No PoolDBOutputService available, but saveToDB true!";
386  }
387  } else {
388  delete output;
389  }
390  } // end loop on IOVs
391 }

References HltBtagPostValidation_cff::c, TkModuleGroupSelector::firstRunOfIOV(), getBackPlaneCorrectionInput(), getParameterError(), getParameterForDetId(), TkModuleGroupSelector::getParameterIndexFromDetId(), input, edm::Service< T >::isAvailable(), moduleGroupSelector_, IntegratedCalibrationBase::name(), TkModuleGroupSelector::numIovs(), MillePedeFileConverter_cfg::out, convertSQLitetoXML_cfg::output, parameters_, paramUncertainties_, readoutModeName_, recordNameDBwrite_, saveToDB_, AlCaHLTBitMon_QueryRunRegistry::string, cond::service::PoolDBOutputService::writeOne(), and writeTree().

◆ getBackPlaneCorrectionInput()

const SiStripBackPlaneCorrection * SiStripBackplaneCalibration::getBackPlaneCorrectionInput ( )
private

Input BackPlaneCorrection values:

  • either from EventSetup of first call to derivatives(..)
  • or created from files of passed by configuration (i.e. from parallel processing)

Definition at line 422 of file SiStripBackplaneCalibration.cc.

422  {
423  // For parallel processing in Millepede II, create SiStripBackPlaneCorrection
424  // from info stored in files of parallel jobs and check that they are identical.
425  // If this job has run on events, still check that back plane corrections are
426  // identical to the ones from mergeFileNames_.
427  const std::string treeName(((this->name() + '_') += readoutModeName_) += "_input");
428  for (auto iFile = mergeFileNames_.begin(); iFile != mergeFileNames_.end(); ++iFile) {
429  SiStripBackPlaneCorrection *bpCorr = this->createFromTree(iFile->c_str(), treeName.c_str());
430  // siStripBackPlaneCorrInput_ could be non-null from previous file of this loop
431  // or from checkBackPlaneCorrectionInput(..) when running on data in this job as well
433  delete siStripBackPlaneCorrInput_; // NULL or empty
435  } else {
436  // about comparison of maps see comments in checkBackPlaneCorrectionInput
437  if (bpCorr && !bpCorr->getBackPlaneCorrections().empty() && // single job might not have got events
439  // Throw exception instead of error?
440  edm::LogError("NoInput") << "@SUB=SiStripBackplaneCalibration::getBackPlaneCorrectionInput"
441  << "Different input values from tree " << treeName << " in file " << *iFile << ".";
442  }
443  delete bpCorr;
444  }
445  }
446 
447  if (!siStripBackPlaneCorrInput_) { // no files nor ran on events
449  edm::LogError("NoInput") << "@SUB=SiStripBackplaneCalibration::getBackPlaneCorrectionInput"
450  << "No input, create an empty one ('" << readoutModeName_ << "' mode)!";
451  } else if (siStripBackPlaneCorrInput_->getBackPlaneCorrections().empty()) {
452  edm::LogError("NoInput") << "@SUB=SiStripBackplaneCalibration::getBackPlaneCorrectionInput"
453  << "Empty result ('" << readoutModeName_ << "' mode)!";
454  }
455 
457 }

References createFromTree(), SiStripBackPlaneCorrection::getBackPlaneCorrections(), mergeFileNames_, IntegratedCalibrationBase::name(), readoutModeName_, siStripBackPlaneCorrInput_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by endOfJob().

◆ getParameter()

double SiStripBackplaneCalibration::getParameter ( unsigned int  index) const
overridevirtual

Return current value of parameter identified by index. Returns 0. if index out-of-bounds.

Implements IntegratedCalibrationBase.

Definition at line 268 of file SiStripBackplaneCalibration.cc.

268  {
269  return (index >= parameters_.size() ? 0. : parameters_[index]);
270 }

References parameters_.

Referenced by Mixins._Parameterizable::hasParameter().

◆ getParameterError()

double SiStripBackplaneCalibration::getParameterError ( unsigned int  index) const
overridevirtual

Return current value of parameter identified by index. Returns 0. if index out-of-bounds or if errors undetermined.

Implements IntegratedCalibrationBase.

Definition at line 273 of file SiStripBackplaneCalibration.cc.

273  {
274  return (index >= paramUncertainties_.size() ? 0. : paramUncertainties_[index]);
275 }

References paramUncertainties_.

Referenced by endOfJob().

◆ getParameterForDetId()

double SiStripBackplaneCalibration::getParameterForDetId ( unsigned int  detId,
edm::RunNumber_t  run 
) const
private

Determined parameter value for this detId (detId not treated => 0.) and the given run.

Definition at line 460 of file SiStripBackplaneCalibration.cc.

460  {
462 
463  return (index < 0 ? 0. : parameters_[index]);
464 }

References TkModuleGroupSelector::getParameterIndexFromDetId(), moduleGroupSelector_, parameters_, and writedatasetfile::run.

Referenced by endOfJob().

◆ numParameters()

unsigned int SiStripBackplaneCalibration::numParameters ( ) const
overridevirtual

How many parameters does this calibration define?

Implements IntegratedCalibrationBase.

Definition at line 176 of file SiStripBackplaneCalibration.cc.

176 { return parameters_.size(); }

References parameters_.

Referenced by beginOfJob().

◆ setParameter()

bool SiStripBackplaneCalibration::setParameter ( unsigned int  index,
double  value 
)
overridevirtual

◆ setParameterError()

bool SiStripBackplaneCalibration::setParameterError ( unsigned int  index,
double  error 
)
overridevirtual

Setting the determined parameter uncertainty identified by index, returns false if out-of-bounds, true otherwise.

Implements IntegratedCalibrationBase.

Definition at line 258 of file SiStripBackplaneCalibration.cc.

258  {
259  if (index >= paramUncertainties_.size()) {
260  return false;
261  } else {
263  return true;
264  }
265 }

References relativeConstraints::error, and paramUncertainties_.

◆ writeTree()

void SiStripBackplaneCalibration::writeTree ( const SiStripBackPlaneCorrection backPlaneCorr,
const std::map< unsigned int, TreeStruct > &  treeInfo,
const char *  treeName 
) const
private

Definition at line 467 of file SiStripBackplaneCalibration.cc.

469  {
470  if (!backPlaneCorrection)
471  return;
472 
473  TFile *file = TFile::Open(outFileName_.c_str(), "UPDATE");
474  if (!file) {
475  edm::LogError("BadConfig") << "@SUB=SiStripBackplaneCalibration::writeTree"
476  << "Could not open file '" << outFileName_ << "'.";
477  return;
478  }
479 
480  TTree *tree = new TTree(treeName, treeName);
481  unsigned int id = 0;
482  float value = 0.;
483  TreeStruct treeStruct;
484  tree->Branch("detId", &id, "detId/i");
485  tree->Branch("value", &value, "value/F");
486  tree->Branch("treeStruct", &treeStruct, TreeStruct::LeafList());
487 
488  for (auto iterIdValue = backPlaneCorrection->getBackPlaneCorrections().begin();
489  iterIdValue != backPlaneCorrection->getBackPlaneCorrections().end();
490  ++iterIdValue) {
491  // type of (*iterIdValue) is pair<unsigned int, float>
492  id = iterIdValue->first; // key of map is DetId
493  value = iterIdValue->second;
494  // type of (*treeStructIter) is pair<unsigned int, TreeStruct>
495  auto treeStructIter = treeInfo.find(id); // find info for this id
496  if (treeStructIter != treeInfo.end()) {
497  treeStruct = treeStructIter->second; // info from input map
498  } else { // if none found, fill at least parameter index (using 1st IOV...)
499  const cond::Time_t run1of1stIov = moduleGroupSelector_->firstRunOfIOV(0);
500  const int ind = moduleGroupSelector_->getParameterIndexFromDetId(id, run1of1stIov);
501  treeStruct = TreeStruct(ind);
502  }
503  tree->Fill();
504  }
505  tree->Write();
506  delete file; // tree vanishes with the file...
507 }

References FrontierConditions_GlobalTag_cff::file, TkModuleGroupSelector::firstRunOfIOV(), SiStripBackPlaneCorrection::getBackPlaneCorrections(), TkModuleGroupSelector::getParameterIndexFromDetId(), TreeStruct::LeafList(), moduleGroupSelector_, and outFileName_.

Referenced by endOfJob().

Member Data Documentation

◆ mergeFileNames_

const std::vector<std::string> SiStripBackplaneCalibration::mergeFileNames_
private

Definition at line 127 of file SiStripBackplaneCalibration.cc.

Referenced by beginOfJob(), and getBackPlaneCorrectionInput().

◆ moduleGroupSelCfg_

const edm::ParameterSet SiStripBackplaneCalibration::moduleGroupSelCfg_
private

Definition at line 137 of file SiStripBackplaneCalibration.cc.

Referenced by beginOfJob().

◆ moduleGroupSelector_

TkModuleGroupSelector* SiStripBackplaneCalibration::moduleGroupSelector_
private

◆ outFileName_

const std::string SiStripBackplaneCalibration::outFileName_
private

Definition at line 126 of file SiStripBackplaneCalibration.cc.

Referenced by beginOfJob(), and writeTree().

◆ parameters_

std::vector<double> SiStripBackplaneCalibration::parameters_
private

◆ paramUncertainties_

std::vector<double> SiStripBackplaneCalibration::paramUncertainties_
private

◆ readoutMode_

int16_t SiStripBackplaneCalibration::readoutMode_
private

Definition at line 123 of file SiStripBackplaneCalibration.cc.

Referenced by derivatives(), and SiStripBackplaneCalibration().

◆ readoutModeName_

const std::string SiStripBackplaneCalibration::readoutModeName_
private

◆ recordNameDBwrite_

const std::string SiStripBackplaneCalibration::recordNameDBwrite_
private

Definition at line 125 of file SiStripBackplaneCalibration.cc.

Referenced by endOfJob().

◆ saveToDB_

const bool SiStripBackplaneCalibration::saveToDB_
private

Definition at line 124 of file SiStripBackplaneCalibration.cc.

Referenced by beginOfJob(), and endOfJob().

◆ siStripBackPlaneCorrInput_

SiStripBackPlaneCorrection* SiStripBackplaneCalibration::siStripBackPlaneCorrInput_
private

◆ watchBackPlaneCorrRcd_

edm::ESWatcher<SiStripBackPlaneCorrectionRcd> SiStripBackplaneCalibration::watchBackPlaneCorrRcd_
private

Definition at line 129 of file SiStripBackplaneCalibration.cc.

Referenced by checkBackPlaneCorrectionInput().

Vector3DBase
Definition: Vector3DBase.h:8
edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
SiStripBackplaneCalibration::moduleGroupSelCfg_
const edm::ParameterSet moduleGroupSelCfg_
Definition: SiStripBackplaneCalibration.cc:137
input
static const std::string input
Definition: EdmProvDump.cc:48
IntegratedCalibrationBase::name
const std::string & name() const
name of this calibration
Definition: IntegratedCalibrationBase.h:126
SiStripBackplaneCalibration::writeTree
void writeTree(const SiStripBackPlaneCorrection *backPlaneCorr, const std::map< unsigned int, TreeStruct > &treeInfo, const char *treeName) const
Definition: SiStripBackplaneCalibration.cc:467
config_102169_raw_cff.latency
latency
Definition: config_102169_raw_cff.py:29
SiStripBackplaneCalibration::getBackPlaneCorrectionInput
const SiStripBackPlaneCorrection * getBackPlaneCorrectionInput()
Definition: SiStripBackplaneCalibration.cc:422
kDeconvolutionMode
Definition: SiStripReadoutModeEnums.h:6
HLT_2018_cff.magneticField
magneticField
Definition: HLT_2018_cff.py:348
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
SiStripBackplaneCalibration::siStripBackPlaneCorrInput_
SiStripBackPlaneCorrection * siStripBackPlaneCorrInput_
Definition: SiStripBackplaneCalibration.cc:131
SiStripBackplaneCalibration::readoutModeName_
const std::string readoutModeName_
Definition: SiStripBackplaneCalibration.cc:122
TkModuleGroupSelector::getParameterIndexFromDetId
int getParameterIndexFromDetId(unsigned int detId, edm::RunNumber_t run) const
Definition: TkModuleGroupSelector.cc:210
tree
Definition: tree.py:1
IntegratedCalibrationBase::ValuesIndexPair
std::pair< Values, unsigned int > ValuesIndexPair
x- and y-values
Definition: IntegratedCalibrationBase.h:44
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
SiStripBackplaneCalibration::moduleGroupSelector_
TkModuleGroupSelector * moduleGroupSelector_
Definition: SiStripBackplaneCalibration.cc:136
edm::LogInfo
Definition: MessageLogger.h:254
TreeStruct
structure to store algorithm results in a TTree
Definition: TreeStruct.h:6
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
SiStripBackplaneCalibration::saveToDB_
const bool saveToDB_
Definition: SiStripBackplaneCalibration.cc:124
TkModuleGroupSelector::firstRunOfIOV
edm::RunNumber_t firstRunOfIOV(unsigned int iovNum) const
First run of iov (0 if iovNum not treated).
Definition: TkModuleGroupSelector.cc:205
relativeConstraints.error
error
Definition: relativeConstraints.py:53
SiStripBackPlaneCorrectionRcd
Definition: SiStripCondDataRecords.h:30
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
TkModuleGroupSelector::numIovs
unsigned int numIovs() const
Total number of IOVs.
Definition: TkModuleGroupSelector.cc:202
SiStripBackPlaneCorrection::getBackPlaneCorrections
const std::map< unsigned int, float > & getBackPlaneCorrections() const
Definition: SiStripBackPlaneCorrection.h:33
IntegratedCalibrationBase::Values
std::pair< double, double > Values
Definition: IntegratedCalibrationBase.h:43
SiStripBackplaneCalibration::parameters_
std::vector< double > parameters_
Definition: SiStripBackplaneCalibration.cc:133
edm::ESHandle< SiStripBackPlaneCorrection >
SiStripBackplaneCalibration::getParameterError
double getParameterError(unsigned int index) const override
Definition: SiStripBackplaneCalibration.cc:273
SiStripBackplaneCalibration::getParameterForDetId
double getParameterForDetId(unsigned int detId, edm::RunNumber_t run) const
Definition: SiStripBackplaneCalibration.cc:460
SiStripDetId::TEC
static constexpr auto TEC
Definition: SiStripDetId.h:40
SiStripBackplaneCalibration::recordNameDBwrite_
const std::string recordNameDBwrite_
Definition: SiStripBackplaneCalibration.cc:125
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
TrajectoryStateOnSurface::localParameters
const LocalTrajectoryParameters & localParameters() const
Definition: TrajectoryStateOnSurface.h:73
ZMuMuAnalysisNtupler_cff.eventInfo
eventInfo
Definition: ZMuMuAnalysisNtupler_cff.py:15
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
SiStripBackplaneCalibration::outFileName_
const std::string outFileName_
Definition: SiStripBackplaneCalibration.cc:126
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
edm::Service< cond::service::PoolDBOutputService >
TkModuleGroupSelector
Definition: TkModuleGroupSelector.h:35
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
SiStripLorentzAngleRcd
Definition: SiStripCondDataRecords.h:25
value
Definition: value.py:1
SiStripDetId::TOB
static constexpr auto TOB
Definition: SiStripDetId.h:39
LocalTrajectoryParameters::mixedFormatVector
AlgebraicVector5 mixedFormatVector() const
Definition: LocalTrajectoryParameters.h:135
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
TreeStruct::LeafList
static const char * LeafList()
Definition: TreeStruct.h:16
get
#define get
looper.cfg
cfg
Definition: looper.py:297
SiStripDetId::TID
static constexpr auto TID
Definition: SiStripDetId.h:38
SiStripLorentzAngle::getLorentzAngle
float getLorentzAngle(const uint32_t &) const
Definition: SiStripLorentzAngle.cc:15
writedatasetfile.run
run
Definition: writedatasetfile.py:27
Calorimetry_cff.bField
bField
Definition: Calorimetry_cff.py:292
IntegratedCalibrationBase::IntegratedCalibrationBase
IntegratedCalibrationBase(const edm::ParameterSet &cfg)
Values and their parameter index.
Definition: IntegratedCalibrationBase.cc:19
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Exception
Definition: hltDiff.cc:246
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition: PoolDBOutputService.h:56
SiStripBackplaneCalibration::paramUncertainties_
std::vector< double > paramUncertainties_
Definition: SiStripBackplaneCalibration.cc:134
SiStripBackplaneCalibration::watchBackPlaneCorrRcd_
edm::ESWatcher< SiStripBackPlaneCorrectionRcd > watchBackPlaneCorrRcd_
Definition: SiStripBackplaneCalibration.cc:129
SiStripDetId::TIB
static constexpr auto TIB
Definition: SiStripDetId.h:37
SiStripBackplaneCalibration::numParameters
unsigned int numParameters() const override
How many parameters does this calibration define?
Definition: SiStripBackplaneCalibration.cc:176
SiStripLatencyRcd
Definition: SiStripCondDataRecords.h:36
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
SiStripBackplaneCalibration::mergeFileNames_
const std::vector< std::string > mergeFileNames_
Definition: SiStripBackplaneCalibration.cc:127
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
mps_fire.result
result
Definition: mps_fire.py:303
kPeakMode
Definition: SiStripReadoutModeEnums.h:6
SiStripBackplaneCalibration::readoutMode_
int16_t readoutMode_
Definition: SiStripBackplaneCalibration.cc:123
SiStripBackPlaneCorrection
Definition: SiStripBackPlaneCorrection.h:27
TkModuleGroupSelector::getNumberOfParameters
unsigned int getNumberOfParameters() const
Definition: TkModuleGroupSelector.cc:199
hit
Definition: SiStripHitEffFromCalibTree.cc:88
SiStripBackplaneCalibration::createFromTree
SiStripBackPlaneCorrection * createFromTree(const char *fileName, const char *treeName) const
Definition: SiStripBackplaneCalibration.cc:510