CMS 3D CMS Logo

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

Public Member Functions

void beginOfJob (AlignableTracker *tracker, AlignableMuon *muon, AlignableExtras *extras) override
 Call at beginning of job: More...
 
void beginRun (const edm::Run &, const edm::EventSetup &) override
 Call at beginning of run: More...
 
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
 
 SiPixelLorentzAngleCalibration (const edm::ParameterSet &cfg)
 Constructor. More...
 
 ~SiPixelLorentzAngleCalibration () override=default
 Destructor. More...
 
- Public Member Functions inherited from IntegratedCalibrationBase
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

SiPixelLorentzAngle createFromTree (const char *fileName, const char *treeName) const
 
const SiPixelLorentzAnglegetLorentzAnglesInput (const align::RunNumber &=0)
 
double getParameterForDetId (unsigned int detId, edm::RunNumber_t run) const
 
void writeTree (const SiPixelLorentzAngle *lorentzAngle, const std::map< unsigned int, TreeStruct > &treeInfo, const char *treeName) const
 

Private Attributes

std::map< align::RunNumber, SiPixelLorentzAnglecachedLorentzAngleInputs_
 
align::RunNumber currentIOV_ {0}
 
const std::string lorentzAngleLabel_
 
const std::vector< std::string > mergeFileNames_
 
const edm::ParameterSet moduleGroupSelCfg_
 
std::unique_ptr< TkModuleGroupSelectormoduleGroupSelector_
 
const std::string outFileName_
 
std::vector< double > parameters_
 
std::vector< double > paramUncertainties_
 
const std::string recordNameDBwrite_
 
const bool saveToDB_
 
SiPixelLorentzAnglesiPixelLorentzAngleInput_ {nullptr}
 
edm::ESWatcher< SiPixelLorentzAngleRcdwatchLorentzAngleRcd_
 

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

Calibration of Lorentz angle for the pixel, integrated in the alignment algorithms.

Note that not all algorithms support this...

Author
: Gero Flucke date : September 2012
Revision
1.4.2.21
Date
2013/05/31 08:37:12

(last update by

Author
flucke

)

Definition at line 54 of file SiPixelLorentzAngleCalibration.cc.

Constructor & Destructor Documentation

◆ SiPixelLorentzAngleCalibration()

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

Constructor.

Definition at line 137 of file SiPixelLorentzAngleCalibration.cc.

139  saveToDB_(cfg.getParameter<bool>("saveToDB")),
140  recordNameDBwrite_(cfg.getParameter<std::string>("recordNameDBwrite")),
141  outFileName_(cfg.getParameter<std::string>("treeFile")),
142  mergeFileNames_(cfg.getParameter<std::vector<std::string> >("mergeTreeFiles")),
143  lorentzAngleLabel_(cfg.getParameter<std::string>("lorentzAngleLabel")),
144  moduleGroupSelCfg_(cfg.getParameter<edm::ParameterSet>("LorentzAngleModuleGroups")) {}

◆ ~SiPixelLorentzAngleCalibration()

SiPixelLorentzAngleCalibration::~SiPixelLorentzAngleCalibration ( )
overridedefault

Destructor.

Member Function Documentation

◆ beginOfJob()

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

Call at beginning of job:

Reimplemented from IntegratedCalibrationBase.

Definition at line 259 of file SiPixelLorentzAngleCalibration.cc.

261  {
262  //specify the sub-detectors for which the LA is determined
263  const std::vector<int> sdets = {PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap};
264 
265  moduleGroupSelector_ = std::make_unique<TkModuleGroupSelector>(aliTracker, moduleGroupSelCfg_, sdets);
266 
267  parameters_.resize(moduleGroupSelector_->getNumberOfParameters(), 0.);
268  paramUncertainties_.resize(moduleGroupSelector_->getNumberOfParameters(), 0.);
269 
270  edm::LogInfo("Alignment") << "@SUB=SiPixelLorentzAngleCalibration"
271  << "Created with name " << this->name() << "',\n"
272  << this->numParameters() << " parameters to be determined,"
273  << "\n saveToDB = " << saveToDB_ << "\n outFileName = " << outFileName_
274  << "\n N(merge files) = " << mergeFileNames_.size()
275  << "\n number of IOVs = " << moduleGroupSelector_->numIovs();
276 
277  if (!mergeFileNames_.empty()) {
278  edm::LogInfo("Alignment") << "@SUB=SiPixelLorentzAngleCalibration"
279  << "First file to merge: " << mergeFileNames_[0];
280  }
281 }

References mergeFileNames_, moduleGroupSelCfg_, moduleGroupSelector_, IntegratedCalibrationBase::name(), numParameters(), outFileName_, parameters_, paramUncertainties_, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, and saveToDB_.

◆ beginRun()

void SiPixelLorentzAngleCalibration::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
overridevirtual

Call at beginning of run:

Reimplemented from IntegratedCalibrationBase.

Definition at line 150 of file SiPixelLorentzAngleCalibration.cc.

150  {
151  // no action needed if the LA record didn't change
152  if (!(watchLorentzAngleRcd_.check(setup)))
153  return;
154 
155  const auto runNumber = run.run();
157 
158  // avoid infinite loop due to wrap-around of unsigned variable 'i' including
159  // arrow from i to zero and a nice smiley ;)
160  for (unsigned int i = moduleGroupSelector_->numIovs(); i-- > 0;) {
161  const auto firstRunOfIOV = moduleGroupSelector_->firstRunOfIOV(i);
162  if (runNumber >= firstRunOfIOV) {
163  firstRun = firstRunOfIOV;
164  break;
165  }
166  }
167 
168  edm::ESHandle<SiPixelLorentzAngle> lorentzAngleHandle;
169  const auto &lorentzAngleRcd = setup.get<SiPixelLorentzAngleRcd>();
170  lorentzAngleRcd.get(lorentzAngleLabel_, lorentzAngleHandle);
172  cachedLorentzAngleInputs_.emplace(firstRun, SiPixelLorentzAngle(*lorentzAngleHandle));
173  } else {
174  if (lorentzAngleRcd.validityInterval().first().eventID().run() > firstRun &&
175  lorentzAngleHandle->getLorentzAngles() // only bad if non-identical values
176  != cachedLorentzAngleInputs_[firstRun].getLorentzAngles()) { // (comparing maps)
177  // Maps are containers sorted by key, but comparison problems may arise from
178  // 'floating point comparison' problems (FIXME?)
179  throw cms::Exception("BadInput") << "Trying to cache SiPixelLorentzAngle payload for a run (" << runNumber
180  << ") in an IOV (" << firstRun << ") that was already cached.\n"
181  << "The following record in your input database tag has an IOV "
182  << "boundary that does not match your IOV definition:\n"
183  << " - SiPixelLorentzAngleRcd '" << lorentzAngleRcd.key().name() << "' (since "
184  << lorentzAngleRcd.validityInterval().first().eventID().run() << ")\n";
185  }
186  }
187 
190 }

References cond::TimeTypeSpecs::beginValue, cachedLorentzAngleInputs_, edm::ESWatcher< T >::check(), currentIOV_, Exception, dataset::firstRun, edm::eventsetup::EventSetupRecordImplementation< T >::get(), SiPixelLorentzAngle::getLorentzAngles(), mps_fire::i, lorentzAngleLabel_, moduleGroupSelector_, writedatasetfile::run, cond::runnumber, convertSQLiteXML::runNumber, singleTopDQM_cfi::setup, siPixelLorentzAngleInput_, cond::timeTypeSpecs, and watchLorentzAngleRcd_.

◆ createFromTree()

SiPixelLorentzAngle SiPixelLorentzAngleCalibration::createFromTree ( const char *  fileName,
const char *  treeName 
) const
private

Definition at line 440 of file SiPixelLorentzAngleCalibration.cc.

440  {
441  // Check for file existence on your own to work around
442  // https://hypernews.cern.ch/HyperNews/CMS/get/swDevelopment/2715.html:
443  TFile *file = nullptr;
444  FILE *testFile = fopen(fileName, "r");
445  if (testFile) {
446  fclose(testFile);
447  file = TFile::Open(fileName, "READ");
448  } // else not existing, see error below
449 
450  TTree *tree = nullptr;
451  if (file)
452  file->GetObject(treeName, tree);
453 
455  if (tree) {
456  unsigned int id = 0;
457  float value = 0.;
458  tree->SetBranchAddress("detId", &id);
459  tree->SetBranchAddress("value", &value);
460 
461  const Long64_t nEntries = tree->GetEntries();
462  for (Long64_t iEntry = 0; iEntry < nEntries; ++iEntry) {
463  tree->GetEntry(iEntry);
464  result.putLorentzAngle(id, value);
465  }
466  } else { // Warning only since could be parallel job on no events.
467  edm::LogWarning("Alignment") << "@SUB=SiPixelLorentzAngleCalibration::createFromTree"
468  << "Could not get TTree '" << treeName << "' from file '" << fileName
469  << (file ? "'." : "' (file does not exist).");
470  }
471 
472  delete file; // tree will vanish with file
473  return result;
474 }

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

Referenced by getLorentzAnglesInput().

◆ derivatives()

unsigned int SiPixelLorentzAngleCalibration::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 193 of file SiPixelLorentzAngleCalibration.cc.

197  {
198  outDerivInds.clear();
199 
200  if (hit.det()) { // otherwise 'constraint hit' or whatever
201 
202  const int index =
203  moduleGroupSelector_->getParameterIndexFromDetId(hit.det()->geographicalId(), eventInfo.eventId().run());
204  if (index >= 0) { // otherwise not treated
207  const GlobalVector bField(magneticField->inTesla(hit.det()->surface().position()));
208  const LocalVector bFieldLocal(hit.det()->surface().toLocal(bField));
209  const double dZ = hit.det()->surface().bounds().thickness(); // it is a float only...
210  // shift due to LA: dx = tan(LA) * dz/2 = mobility * B_y * dz/2,
211  // shift due to LA: dy = - mobility * B_x * dz/2,
212  // '-' since we have derivative of the residual r = trk -hit
213  const double xDerivative = bFieldLocal.y() * dZ * -0.5; // parameter is mobility!
214  const double yDerivative = bFieldLocal.x() * dZ * 0.5; // parameter is mobility!
215  if (xDerivative || yDerivative) { // If field is zero, this is zero: do not return it
216  const Values derivs{xDerivative, yDerivative};
217  outDerivInds.push_back(ValuesIndexPair(derivs, index));
218  }
219  }
220  } else {
221  edm::LogWarning("Alignment") << "@SUB=SiPixelLorentzAngleCalibration::derivatives2"
222  << "Hit without GeomDet, skip!";
223  }
224 
225  return outDerivInds.size();
226 }

References Calorimetry_cff::bField, ZMuMuAnalysisNtupler_cff::eventInfo, get, HLT_FULL_cff::magneticField, moduleGroupSelector_, singleTopDQM_cfi::setup, and hit::y.

◆ endOfJob()

void SiPixelLorentzAngleCalibration::endOfJob ( )
overridevirtual

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

Implements IntegratedCalibrationBase.

Definition at line 284 of file SiPixelLorentzAngleCalibration.cc.

284  {
285  // loginfo output
286  std::ostringstream out;
287  out << "Parameter results\n";
288  for (unsigned int iPar = 0; iPar < parameters_.size(); ++iPar) {
289  out << iPar << ": " << parameters_[iPar] << " +- " << paramUncertainties_[iPar] << "\n";
290  }
291  edm::LogInfo("Alignment") << "@SUB=SiPixelLorentzAngleCalibration::endOfJob" << out.str();
292 
293  std::map<unsigned int, TreeStruct> treeInfo; // map of TreeStruct for each detId
294 
295  // now write 'input' tree(s)
296  const std::string treeName{this->name() + '_'};
297  std::vector<const SiPixelLorentzAngle *> inputs{};
298  inputs.reserve(moduleGroupSelector_->numIovs());
299  for (unsigned int iIOV = 0; iIOV < moduleGroupSelector_->numIovs(); ++iIOV) {
300  const auto firstRunOfIOV = moduleGroupSelector_->firstRunOfIOV(iIOV);
301  inputs.push_back(this->getLorentzAnglesInput(firstRunOfIOV)); // never NULL
302  this->writeTree(inputs.back(),
303  treeInfo,
304  (treeName + "input_" + std::to_string(firstRunOfIOV)).c_str()); // empty treeInfo for input...
305 
306  if (inputs.back()->getLorentzAngles().empty()) {
307  edm::LogError("Alignment") << "@SUB=SiPixelLorentzAngleCalibration::endOfJob"
308  << "Input Lorentz angle map is empty, skip writing output!";
309  return;
310  }
311  }
312 
313  const unsigned int nonZeroParamsOrErrors = // Any determined value?
314  count_if(parameters_.begin(), parameters_.end(), [](auto c) { return c != 0.; }) +
315  count_if(paramUncertainties_.begin(), paramUncertainties_.end(), [](auto c) { return c != 0.; });
316 
317  for (unsigned int iIOV = 0; iIOV < moduleGroupSelector_->numIovs(); ++iIOV) {
318  auto firstRunOfIOV = static_cast<cond::Time_t>(moduleGroupSelector_->firstRunOfIOV(iIOV));
320  // Loop on map of values from input and add (possible) parameter results
321  for (const auto &iterIdValue : inputs[iIOV]->getLorentzAngles()) {
322  // type of 'iterIdValue' is pair<unsigned int, float>
323  const auto detId = iterIdValue.first; // key of map is DetId
324  const auto param = this->getParameterForDetId(detId, firstRunOfIOV);
325  // put result in output, i.e. sum of input and determined parameter, but the nasty
326  // putLorentzAngle(..) takes float by reference - not even const reference:
327  auto value = iterIdValue.second + static_cast<float>(param);
328  output.putLorentzAngle(detId, value);
329  const int paramIndex = moduleGroupSelector_->getParameterIndexFromDetId(detId, firstRunOfIOV);
330  treeInfo[detId] = TreeStruct(param, this->getParameterError(paramIndex), paramIndex);
331  }
332 
333  if (saveToDB_ || nonZeroParamsOrErrors != 0) { // Skip writing mille jobs...
334  this->writeTree(&output, treeInfo, (treeName + Form("result_%lld", firstRunOfIOV)).c_str());
335  }
336 
337  if (saveToDB_) { // If requested, write out to DB
339  if (dbService.isAvailable()) {
340  dbService->writeOne(&output, firstRunOfIOV, recordNameDBwrite_);
341  } else {
342  edm::LogError("BadConfig") << "@SUB=SiPixelLorentzAngleCalibration::endOfJob"
343  << "No PoolDBOutputService available, but saveToDB true!";
344  }
345  }
346  } // end loop on IOVs
347 }

References HltBtagPostValidation_cff::c, getLorentzAnglesInput(), getParameterError(), getParameterForDetId(), PixelMapPlotter::inputs, edm::Service< T >::isAvailable(), moduleGroupSelector_, IntegratedCalibrationBase::name(), MillePedeFileConverter_cfg::out, convertSQLitetoXML_cfg::output, parameters_, paramUncertainties_, recordNameDBwrite_, saveToDB_, AlCaHLTBitMon_QueryRunRegistry::string, cond::service::PoolDBOutputService::writeOne(), and writeTree().

◆ getLorentzAnglesInput()

const SiPixelLorentzAngle * SiPixelLorentzAngleCalibration::getLorentzAnglesInput ( const align::RunNumber run = 0)
private

Input LorentzAngle 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 350 of file SiPixelLorentzAngleCalibration.cc.

350  {
351  const auto &resolvedRun = run > 0 ? run : currentIOV_;
352  // For parallel processing in Millepede II, create SiPixelLorentzAngle
353  // from info stored in files of parallel jobs and check that they are identical.
354  // If this job has run on data, still check that LA is identical to the ones
355  // from mergeFileNames_.
356  const std::string treeName{this->name() + "_input_" + std::to_string(resolvedRun)};
357  for (const auto &iFile : mergeFileNames_) {
358  auto la = this->createFromTree(iFile.c_str(), treeName.c_str());
359  // siPixelLorentzAngleInput_ could be non-null from previous file of this loop
360  // or from checkLorentzAngleInput(..) when running on data in this job as well
362  cachedLorentzAngleInputs_[resolvedRun] = la;
364  currentIOV_ = resolvedRun;
365  } else {
366  // FIXME: about comparison of maps see comments in checkLorentzAngleInput
367  if (!la.getLorentzAngles().empty() && // single job might not have got events
368  la.getLorentzAngles() != siPixelLorentzAngleInput_->getLorentzAngles()) {
369  // Throw exception instead of error?
370  edm::LogError("NoInput") << "@SUB=SiPixelLorentzAngleCalibration::getLorentzAnglesInput"
371  << "Different input values from tree " << treeName << " in file " << iFile << ".";
372  }
373  }
374  }
375 
376  if (!siPixelLorentzAngleInput_) { // no files nor ran on events
377  // [] operator default-constructs an empty SiPixelLorentzAngle object in place:
379  currentIOV_ = resolvedRun;
380  edm::LogError("NoInput") << "@SUB=SiPixelLorentzAngleCalibration::getLorentzAnglesInput"
381  << "No input, create an empty one!";
382  } else if (siPixelLorentzAngleInput_->getLorentzAngles().empty()) {
383  edm::LogError("NoInput") << "@SUB=SiPixelLorentzAngleCalibration::getLorentzAnglesInput"
384  << "Empty result!";
385  }
386 
388 }

References cachedLorentzAngleInputs_, createFromTree(), currentIOV_, SiPixelLorentzAngle::getLorentzAngles(), mergeFileNames_, IntegratedCalibrationBase::name(), writedatasetfile::run, siPixelLorentzAngleInput_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by endOfJob().

◆ getParameter()

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

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

Implements IntegratedCalibrationBase.

Definition at line 249 of file SiPixelLorentzAngleCalibration.cc.

249  {
250  return (index >= parameters_.size() ? 0. : parameters_[index]);
251 }

References parameters_.

Referenced by Mixins._Parameterizable::hasParameter().

◆ getParameterError()

double SiPixelLorentzAngleCalibration::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 254 of file SiPixelLorentzAngleCalibration.cc.

254  {
255  return (index >= paramUncertainties_.size() ? 0. : paramUncertainties_[index]);
256 }

References paramUncertainties_.

Referenced by endOfJob().

◆ getParameterForDetId()

double SiPixelLorentzAngleCalibration::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 391 of file SiPixelLorentzAngleCalibration.cc.

391  {
392  const int index = moduleGroupSelector_->getParameterIndexFromDetId(detId, run);
393  return (index < 0 ? 0. : parameters_[index]);
394 }

References moduleGroupSelector_, parameters_, and writedatasetfile::run.

Referenced by endOfJob().

◆ numParameters()

unsigned int SiPixelLorentzAngleCalibration::numParameters ( ) const
overridevirtual

How many parameters does this calibration define?

Implements IntegratedCalibrationBase.

Definition at line 147 of file SiPixelLorentzAngleCalibration.cc.

147 { return parameters_.size(); }

References parameters_.

Referenced by beginOfJob().

◆ setParameter()

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

◆ setParameterError()

bool SiPixelLorentzAngleCalibration::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 239 of file SiPixelLorentzAngleCalibration.cc.

239  {
240  if (index >= paramUncertainties_.size()) {
241  return false;
242  } else {
244  return true;
245  }
246 }

References relativeConstraints::error, and paramUncertainties_.

◆ writeTree()

void SiPixelLorentzAngleCalibration::writeTree ( const SiPixelLorentzAngle lorentzAngle,
const std::map< unsigned int, TreeStruct > &  treeInfo,
const char *  treeName 
) const
private

Definition at line 397 of file SiPixelLorentzAngleCalibration.cc.

399  {
400  if (!lorentzAngle)
401  return;
402 
403  TFile *file = TFile::Open(outFileName_.c_str(), "UPDATE");
404  if (!file) {
405  edm::LogError("BadConfig") << "@SUB=SiPixelLorentzAngleCalibration::writeTree"
406  << "Could not open file '" << outFileName_ << "'.";
407  return;
408  }
409 
410  TTree *tree = new TTree(treeName, treeName);
411  unsigned int id = 0;
412  float value = 0.;
413  TreeStruct treeStruct;
414  tree->Branch("detId", &id, "detId/i");
415  tree->Branch("value", &value, "value/F");
416  tree->Branch("treeStruct", &treeStruct, TreeStruct::LeafList());
417 
418  for (auto iterIdValue = lorentzAngle->getLorentzAngles().begin();
419  iterIdValue != lorentzAngle->getLorentzAngles().end();
420  ++iterIdValue) {
421  // type of (*iterIdValue) is pair<unsigned int, float>
422  id = iterIdValue->first; // key of map is DetId
423  value = iterIdValue->second;
424  // type of (*treeStructIter) is pair<unsigned int, TreeStruct>
425  auto treeStructIter = treeInfo.find(id); // find info for this id
426  if (treeStructIter != treeInfo.end()) {
427  treeStruct = treeStructIter->second; // info from input map
428  } else { // if none found, fill at least parameter index (using 1st IOV...)
429  const cond::Time_t run1of1stIov = moduleGroupSelector_->firstRunOfIOV(0);
430  const int ind = moduleGroupSelector_->getParameterIndexFromDetId(id, run1of1stIov);
431  treeStruct = TreeStruct(ind);
432  }
433  tree->Fill();
434  }
435  tree->Write();
436  delete file; // tree vanishes with the file... (?)
437 }

References FrontierConditions_GlobalTag_cff::file, SiPixelLorentzAngle::getLorentzAngles(), TreeStruct::LeafList(), moduleGroupSelector_, and outFileName_.

Referenced by endOfJob().

Member Data Documentation

◆ cachedLorentzAngleInputs_

std::map<align::RunNumber, SiPixelLorentzAngle> SiPixelLorentzAngleCalibration::cachedLorentzAngleInputs_
private

Definition at line 123 of file SiPixelLorentzAngleCalibration.cc.

Referenced by beginRun(), and getLorentzAnglesInput().

◆ currentIOV_

align::RunNumber SiPixelLorentzAngleCalibration::currentIOV_ {0}
private

Definition at line 125 of file SiPixelLorentzAngleCalibration.cc.

Referenced by beginRun(), and getLorentzAnglesInput().

◆ lorentzAngleLabel_

const std::string SiPixelLorentzAngleCalibration::lorentzAngleLabel_
private

Definition at line 118 of file SiPixelLorentzAngleCalibration.cc.

Referenced by beginRun().

◆ mergeFileNames_

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

Definition at line 117 of file SiPixelLorentzAngleCalibration.cc.

Referenced by beginOfJob(), and getLorentzAnglesInput().

◆ moduleGroupSelCfg_

const edm::ParameterSet SiPixelLorentzAngleCalibration::moduleGroupSelCfg_
private

Definition at line 130 of file SiPixelLorentzAngleCalibration.cc.

Referenced by beginOfJob().

◆ moduleGroupSelector_

std::unique_ptr<TkModuleGroupSelector> SiPixelLorentzAngleCalibration::moduleGroupSelector_
private

◆ outFileName_

const std::string SiPixelLorentzAngleCalibration::outFileName_
private

Definition at line 116 of file SiPixelLorentzAngleCalibration.cc.

Referenced by beginOfJob(), and writeTree().

◆ parameters_

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

◆ paramUncertainties_

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

◆ recordNameDBwrite_

const std::string SiPixelLorentzAngleCalibration::recordNameDBwrite_
private

Definition at line 115 of file SiPixelLorentzAngleCalibration.cc.

Referenced by endOfJob().

◆ saveToDB_

const bool SiPixelLorentzAngleCalibration::saveToDB_
private

Definition at line 114 of file SiPixelLorentzAngleCalibration.cc.

Referenced by beginOfJob(), and endOfJob().

◆ siPixelLorentzAngleInput_

SiPixelLorentzAngle* SiPixelLorentzAngleCalibration::siPixelLorentzAngleInput_ {nullptr}
private

Definition at line 124 of file SiPixelLorentzAngleCalibration.cc.

Referenced by beginRun(), and getLorentzAnglesInput().

◆ watchLorentzAngleRcd_

edm::ESWatcher<SiPixelLorentzAngleRcd> SiPixelLorentzAngleCalibration::watchLorentzAngleRcd_
private

Definition at line 120 of file SiPixelLorentzAngleCalibration.cc.

Referenced by beginRun().

Vector3DBase
Definition: Vector3DBase.h:8
edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
dataset.firstRun
firstRun
Definition: dataset.py:940
SiPixelLorentzAngleCalibration::cachedLorentzAngleInputs_
std::map< align::RunNumber, SiPixelLorentzAngle > cachedLorentzAngleInputs_
Definition: SiPixelLorentzAngleCalibration.cc:123
mps_fire.i
i
Definition: mps_fire.py:428
cond::TimeTypeSpecs::beginValue
Time_t beginValue
Definition: Time.h:41
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
IntegratedCalibrationBase::name
const std::string & name() const
name of this calibration
Definition: IntegratedCalibrationBase.h:126
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
hit::y
double y
Definition: SiStripHitEffFromCalibTree.cc:90
SiPixelLorentzAngleCalibration::writeTree
void writeTree(const SiPixelLorentzAngle *lorentzAngle, const std::map< unsigned int, TreeStruct > &treeInfo, const char *treeName) const
Definition: SiPixelLorentzAngleCalibration.cc:397
SiPixelLorentzAngleCalibration::getLorentzAnglesInput
const SiPixelLorentzAngle * getLorentzAnglesInput(const align::RunNumber &=0)
Definition: SiPixelLorentzAngleCalibration.cc:350
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
tree
Definition: tree.py:1
IntegratedCalibrationBase::ValuesIndexPair
std::pair< Values, unsigned int > ValuesIndexPair
x- and y-values
Definition: IntegratedCalibrationBase.h:44
TreeStruct
structure to store algorithm results in a TTree
Definition: TreeStruct.h:6
SiPixelLorentzAngleCalibration::lorentzAngleLabel_
const std::string lorentzAngleLabel_
Definition: SiPixelLorentzAngleCalibration.cc:118
SiPixelLorentzAngleCalibration::siPixelLorentzAngleInput_
SiPixelLorentzAngle * siPixelLorentzAngleInput_
Definition: SiPixelLorentzAngleCalibration.cc:124
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
HLT_FULL_cff.magneticField
magneticField
Definition: HLT_FULL_cff.py:348
relativeConstraints.error
error
Definition: relativeConstraints.py:53
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
convertSQLiteXML.runNumber
runNumber
Definition: convertSQLiteXML.py:91
SiPixelLorentzAngleCalibration::numParameters
unsigned int numParameters() const override
How many parameters does this calibration define?
Definition: SiPixelLorentzAngleCalibration.cc:147
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
SiPixelLorentzAngleCalibration::getParameterError
double getParameterError(unsigned int index) const override
Definition: SiPixelLorentzAngleCalibration.cc:254
cond::timeTypeSpecs
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:16
SiPixelLorentzAngle::getLorentzAngles
const std::map< unsigned int, float > & getLorentzAngles() const
Definition: SiPixelLorentzAngle.h:17
IntegratedCalibrationBase::Values
std::pair< double, double > Values
Definition: IntegratedCalibrationBase.h:43
SiPixelLorentzAngle
Definition: SiPixelLorentzAngle.h:11
edm::ESHandle< SiPixelLorentzAngle >
SiPixelLorentzAngleCalibration::parameters_
std::vector< double > parameters_
Definition: SiPixelLorentzAngleCalibration.cc:126
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ZMuMuAnalysisNtupler_cff.eventInfo
eventInfo
Definition: ZMuMuAnalysisNtupler_cff.py:15
SiPixelLorentzAngleCalibration::paramUncertainties_
std::vector< double > paramUncertainties_
Definition: SiPixelLorentzAngleCalibration.cc:127
edm::ParameterSet
Definition: ParameterSet.h:47
SiPixelLorentzAngleCalibration::moduleGroupSelector_
std::unique_ptr< TkModuleGroupSelector > moduleGroupSelector_
Definition: SiPixelLorentzAngleCalibration.cc:129
cond::runnumber
Definition: Time.h:19
SiPixelLorentzAngleCalibration::saveToDB_
const bool saveToDB_
Definition: SiPixelLorentzAngleCalibration.cc:114
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
edm::Service< cond::service::PoolDBOutputService >
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
value
Definition: value.py:1
SiPixelLorentzAngleCalibration::moduleGroupSelCfg_
const edm::ParameterSet moduleGroupSelCfg_
Definition: SiPixelLorentzAngleCalibration.cc:130
PixelMapPlotter.inputs
inputs
Definition: PixelMapPlotter.py:490
SiPixelLorentzAngleCalibration::getParameterForDetId
double getParameterForDetId(unsigned int detId, edm::RunNumber_t run) const
Definition: SiPixelLorentzAngleCalibration.cc:391
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
TreeStruct::LeafList
static const char * LeafList()
Definition: TreeStruct.h:16
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
SiPixelLorentzAngleCalibration::outFileName_
const std::string outFileName_
Definition: SiPixelLorentzAngleCalibration.cc:116
SiPixelLorentzAngleRcd
Definition: SiPixelLorentzAngleRcd.h:24
get
#define get
looper.cfg
cfg
Definition: looper.py:297
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:20
SiPixelLorentzAngleCalibration::watchLorentzAngleRcd_
edm::ESWatcher< SiPixelLorentzAngleRcd > watchLorentzAngleRcd_
Definition: SiPixelLorentzAngleCalibration.cc:120
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:63
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
SiPixelLorentzAngleCalibration::mergeFileNames_
const std::vector< std::string > mergeFileNames_
Definition: SiPixelLorentzAngleCalibration.cc:117
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
SiPixelLorentzAngleCalibration::currentIOV_
align::RunNumber currentIOV_
Definition: SiPixelLorentzAngleCalibration.cc:125
edm::eventsetup::EventSetupRecordImplementation::get
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
Definition: EventSetupRecordImplementation.h:74
mps_fire.result
result
Definition: mps_fire.py:311
SiPixelLorentzAngleCalibration::createFromTree
SiPixelLorentzAngle createFromTree(const char *fileName, const char *treeName) const
Definition: SiPixelLorentzAngleCalibration.cc:440
SiPixelLorentzAngleCalibration::recordNameDBwrite_
const std::string recordNameDBwrite_
Definition: SiPixelLorentzAngleCalibration.cc:115
hit
Definition: SiStripHitEffFromCalibTree.cc:88