CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiPixelLorentzAngleCalibration Class Reference
Inheritance diagram for SiPixelLorentzAngleCalibration:
IntegratedCalibrationBase

Public Member Functions

virtual void beginOfJob (AlignableTracker *tracker, AlignableMuon *muon, AlignableExtras *extras) override
 
virtual unsigned int derivatives (std::vector< ValuesIndexPair > &outDerivInds, const TransientTrackingRecHit &hit, const TrajectoryStateOnSurface &tsos, const edm::EventSetup &setup, const EventInfo &eventInfo) const override
 
virtual void endOfJob () override
 
virtual double getParameter (unsigned int index) const override
 
virtual double getParameterError (unsigned int index) const override
 
virtual unsigned int numParameters () const override
 How many parameters does this calibration define? More...
 
virtual bool setParameter (unsigned int index, double value) override
 
virtual bool setParameterError (unsigned int index, double error) override
 
 SiPixelLorentzAngleCalibration (const edm::ParameterSet &cfg)
 Constructor. More...
 
virtual ~SiPixelLorentzAngleCalibration ()
 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

bool checkLorentzAngleInput (const edm::EventSetup &setup, const EventInfo &eventInfo)
 
SiPixelLorentzAnglecreateFromTree (const char *fileName, const char *treeName) const
 
const SiPixelLorentzAnglegetLorentzAnglesInput ()
 
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

const std::vector< std::string > mergeFileNames_
 
const edm::ParameterSet moduleGroupSelCfg_
 
TkModuleGroupSelectormoduleGroupSelector_
 
const std::string outFileName_
 
std::vector< double > parameters_
 
std::vector< double > paramUncertainties_
 
const std::string recordNameDBwrite_
 
const bool saveToDB_
 
SiPixelLorentzAnglesiPixelLorentzAngleInput_
 
edm::ESWatcher
< SiPixelLorentzAngleRcd
watchLorentzAngleRcd_
 

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 ( const edm::ParameterSet cfg)
explicit

Constructor.

Definition at line 146 of file SiPixelLorentzAngleCalibration.cc.

148  saveToDB_(cfg.getParameter<bool>("saveToDB")),
149  recordNameDBwrite_(cfg.getParameter<std::string>("recordNameDBwrite")),
150  outFileName_(cfg.getParameter<std::string>("treeFile")),
151  mergeFileNames_(cfg.getParameter<std::vector<std::string> >("mergeTreeFiles")),
154  moduleGroupSelCfg_(cfg.getParameter<edm::ParameterSet>("LorentzAngleModuleGroups"))
155 {
156 
157 }
T getParameter(std::string const &) const
IntegratedCalibrationBase(const edm::ParameterSet &cfg)
Values and their parameter index.
const std::vector< std::string > mergeFileNames_
SiPixelLorentzAngleCalibration::~SiPixelLorentzAngleCalibration ( )
virtual

Destructor.

Definition at line 160 of file SiPixelLorentzAngleCalibration.cc.

References moduleGroupSelector_, and siPixelLorentzAngleInput_.

161 {
162  delete moduleGroupSelector_;
163  // std::cout << "Destroy SiPixelLorentzAngleCalibration named " << this->name() << std::endl;
165 }

Member Function Documentation

void SiPixelLorentzAngleCalibration::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 252 of file SiPixelLorentzAngleCalibration.cc.

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

255 {
256  //specify the sub-detectors for which the LA is determined
257  const std::vector<int> sdets = boost::assign::list_of(PixelSubdetector::PixelBarrel)(PixelSubdetector::PixelEndcap);
258 
260 
263 
264  edm::LogInfo("Alignment") << "@SUB=SiPixelLorentzAngleCalibration" << "Created with name "
265  << this->name() << "',\n" << this->numParameters() << " parameters to be determined,"
266  << "\n saveToDB = " << saveToDB_
267  << "\n outFileName = " << outFileName_
268  << "\n N(merge files) = " << mergeFileNames_.size()
269  << "\n number of IOVs = " << moduleGroupSelector_->numIovs();
270 
271  if (mergeFileNames_.size()) {
272  edm::LogInfo("Alignment") << "@SUB=SiPixelLorentzAngleCalibration"
273  << "First file to merge: " << mergeFileNames_[0];
274  }
275 }
virtual unsigned int numParameters() const override
How many parameters does this calibration define?
const std::string & name() const
name of this calibration
unsigned int getNumberOfParameters() const
unsigned int numIovs() const
Total number of IOVs.
const std::vector< std::string > mergeFileNames_
bool SiPixelLorentzAngleCalibration::checkLorentzAngleInput ( const edm::EventSetup setup,
const EventInfo eventInfo 
)
private

If called the first time, fill 'siPixelLorentzAngleInput_', later check that LorentzAngle has not changed.

Definition at line 347 of file SiPixelLorentzAngleCalibration.cc.

References edm::ESWatcher< T >::check(), AlignmentAlgorithmBase::EventInfo::eventId(), edm::hlt::Exception, edm::EventSetup::get(), SiPixelLorentzAngle::getLorentzAngles(), edm::EventID::run(), siPixelLorentzAngleInput_, and watchLorentzAngleRcd_.

Referenced by derivatives().

349 {
350  edm::ESHandle<SiPixelLorentzAngle> lorentzAngleHandle;
352  setup.get<SiPixelLorentzAngleRcd>().get(lorentzAngleHandle);
353  siPixelLorentzAngleInput_ = new SiPixelLorentzAngle(*lorentzAngleHandle);
354  } else {
355  if (watchLorentzAngleRcd_.check(setup)) { // new IOV of input
356  setup.get<SiPixelLorentzAngleRcd>().get(lorentzAngleHandle);
357  if (lorentzAngleHandle->getLorentzAngles() // but only bad if non-identical values
358  != siPixelLorentzAngleInput_->getLorentzAngles()) { // (comparing maps)
359  // Maps are containers sorted by key, but comparison problems may arise from
360  // 'floating point comparison' problems (FIXME?)
361  throw cms::Exception("BadInput")
362  << "SiPixelLorentzAngleCalibration::checkLorentzAngleInput:\n"
363  << "Content of SiPixelLorentzAngle changed at run " << eventInfo.eventId().run()
364  << ", but algorithm expects constant input!\n";
365  return false; // not reached...
366  }
367  }
368  }
369 
370  return true;
371 }
const std::map< unsigned int, float > & getLorentzAngles() const
edm::ESWatcher< SiPixelLorentzAngleRcd > watchLorentzAngleRcd_
const T & get() const
Definition: EventSetup.h:55
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
SiPixelLorentzAngle * SiPixelLorentzAngleCalibration::createFromTree ( const char *  fileName,
const char *  treeName 
) const
private

Definition at line 467 of file SiPixelLorentzAngleCalibration.cc.

References mergeVDriftHistosByStation::file, SiPixelLorentzAngle::putLorentzAngle(), query::result, MainPageGenerator::tree, and relativeConstraints::value.

Referenced by getLorentzAnglesInput().

468 {
469  // Check for file existence on your own to work around
470  // https://hypernews.cern.ch/HyperNews/CMS/get/swDevelopment/2715.html:
471  TFile* file = 0;
472  FILE* testFile = fopen(fileName,"r");
473  if (testFile) {
474  fclose(testFile);
475  file = TFile::Open(fileName, "READ");
476  } // else not existing, see error below
477 
478  TTree *tree = 0;
479  if (file) file->GetObject(treeName, tree);
480 
482  if (tree) {
483  unsigned int id = 0;
484  float value = 0.;
485  tree->SetBranchAddress("detId", &id);
486  tree->SetBranchAddress("value", &value);
487 
488  result = new SiPixelLorentzAngle;
489  const Long64_t nEntries = tree->GetEntries();
490  for (Long64_t iEntry = 0; iEntry < nEntries; ++iEntry) {
491  tree->GetEntry(iEntry);
492  result->putLorentzAngle(id, value);
493  }
494  } else { // Warning only since could be parallel job on no events.
495  edm::LogWarning("Alignment") << "@SUB=SiPixelLorentzAngleCalibration::createFromTree"
496  << "Could not get TTree '" << treeName << "' from file '"
497  << fileName << (file ? "'." : "' (file does not exist).");
498  }
499 
500  delete file; // tree will vanish with file
501  return result;
502 }
tuple result
Definition: query.py:137
bool putLorentzAngle(const uint32_t &, float &)
unsigned int SiPixelLorentzAngleCalibration::derivatives ( std::vector< ValuesIndexPair > &  outDerivInds,
const TransientTrackingRecHit hit,
const TrajectoryStateOnSurface tsos,
const edm::EventSetup setup,
const EventInfo eventInfo 
) const
overridevirtual

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

Definition at line 175 of file SiPixelLorentzAngleCalibration.cc.

References ecalTB2006H4_GenSimDigiReco_cfg::bField, Surface::bounds(), checkLorentzAngleInput(), TrackingRecHit::det(), AlignmentAlgorithmBase::EventInfo::eventId(), GeomDet::geographicalId(), edm::EventSetup::get(), TkModuleGroupSelector::getParameterIndexFromDetId(), cmsHarvester::index, HLT_25ns14e33_v1_cff::magneticField, moduleGroupSelector_, GloballyPositioned< T >::position(), edm::EventID::run(), GeomDet::surface(), Bounds::thickness(), and GloballyPositioned< T >::toLocal().

180 {
181  // ugly const-cast:
182  // But it is either only first initialisation or throwing an exception...
184 
185  outDerivInds.clear();
186 
187  if (hit.det()) { // otherwise 'constraint hit' or whatever
188 
190  eventInfo.eventId().run());
191  if (index >= 0) { // otherwise not treated
193  setup.get<IdealMagneticFieldRecord>().get(magneticField);
194  const GlobalVector bField(magneticField->inTesla(hit.det()->surface().position()));
195  const LocalVector bFieldLocal(hit.det()->surface().toLocal(bField));
196  const double dZ = hit.det()->surface().bounds().thickness(); // it is a float only...
197  // shift due to LA: dx = tan(LA) * dz/2 = mobility * B_y * dz/2,
198  // '-' since we have derivative of the residual r = trk -hit
199  const double xDerivative = bFieldLocal.y() * dZ * -0.5; // parameter is mobility!
200  // FIXME: Have to treat that for FPIX yDerivative != 0., due to higher order effects!
201  if (xDerivative) { // If field is zero, this is zero: do not return it
202  const Values derivs(xDerivative, 0.); // yDerivative = 0.
203  outDerivInds.push_back(ValuesIndexPair(derivs, index));
204  }
205  }
206  } else {
207  edm::LogWarning("Alignment") << "@SUB=SiPixelLorentzAngleCalibration::derivatives2"
208  << "Hit without GeomDet, skip!";
209  }
210 
211  return outDerivInds.size();
212 }
const Bounds & bounds() const
Definition: Surface.h:128
bool checkLorentzAngleInput(const edm::EventSetup &setup, const EventInfo &eventInfo)
int getParameterIndexFromDetId(unsigned int detId, edm::RunNumber_t run) const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
virtual float thickness() const =0
const GeomDet * det() const
LocalPoint toLocal(const GlobalPoint &gp) const
std::pair< Values, unsigned int > ValuesIndexPair
x- and y-values
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:77
std::pair< double, double > Values
const T & get() const
Definition: EventSetup.h:55
const PositionType & position() const
void SiPixelLorentzAngleCalibration::endOfJob ( )
overridevirtual

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

Implements IntegratedCalibrationBase.

Definition at line 279 of file SiPixelLorentzAngleCalibration.cc.

References TkModuleGroupSelector::firstRunOfIOV(), SiPixelLorentzAngle::getLorentzAngles(), getLorentzAnglesInput(), getParameterError(), getParameterForDetId(), TkModuleGroupSelector::getParameterIndexFromDetId(), input, edm::Service< T >::isAvailable(), moduleGroupSelector_, IntegratedCalibrationBase::name(), TkModuleGroupSelector::numIovs(), dbtoconf::out, convertSQLitetoXML_cfg::output, parameters_, paramUncertainties_, SiPixelLorentzAngle::putLorentzAngle(), recordNameDBwrite_, saveToDB_, AlCaHLTBitMon_QueryRunRegistry::string, relativeConstraints::value, cond::service::PoolDBOutputService::writeOne(), and writeTree().

280 {
281  // loginfo output
282  std::ostringstream out;
283  out << "Parameter results\n";
284  for (unsigned int iPar = 0; iPar < parameters_.size(); ++iPar) {
285  out << iPar << ": " << parameters_[iPar] << " +- " << paramUncertainties_[iPar] << "\n";
286  }
287  edm::LogInfo("Alignment") << "@SUB=SiPixelLorentzAngleCalibration::endOfJob" << out.str();
288 
289  std::map<unsigned int, TreeStruct> treeInfo; // map of TreeStruct for each detId
290 
291  // now write 'input' tree
292  const SiPixelLorentzAngle *input = this->getLorentzAnglesInput(); // never NULL
293  const std::string treeName(this->name() + '_');
294  this->writeTree(input, treeInfo, (treeName + "input").c_str()); // empty treeInfo for input...
295 
296  if (input->getLorentzAngles().empty()) {
297  edm::LogError("Alignment") << "@SUB=SiPixelLorentzAngleCalibration::endOfJob"
298  << "Input Lorentz angle map is empty, skip writing output!";
299  return;
300  }
301 
302  const unsigned int nonZeroParamsOrErrors = // Any determined value?
303  count_if (parameters_.begin(), parameters_.end(), std::bind2nd(std::not_equal_to<double>(),0.))
304  + count_if(paramUncertainties_.begin(), paramUncertainties_.end(),
305  std::bind2nd(std::not_equal_to<double>(), 0.));
306 
307  for (unsigned int iIOV = 0; iIOV < moduleGroupSelector_->numIovs(); ++iIOV) {
308  // for (unsigned int iIOV = 0; iIOV < 1; ++iIOV) { // For writing out the modified values
309  cond::Time_t firstRunOfIOV = moduleGroupSelector_->firstRunOfIOV(iIOV);
311  // Loop on map of values from input and add (possible) parameter results
312  for (auto iterIdValue = input->getLorentzAngles().begin();
313  iterIdValue != input->getLorentzAngles().end(); ++iterIdValue) {
314  // type of (*iterIdValue) is pair<unsigned int, float>
315  const unsigned int detId = iterIdValue->first; // key of map is DetId
316  const double param = this->getParameterForDetId(detId, firstRunOfIOV);
317  // put result in output, i.e. sum of input and determined parameter, but the nasty
318  // putLorentzAngle(..) takes float by reference - not even const reference:
319  float value = iterIdValue->second + param;
320  output->putLorentzAngle(detId, value);
321  const int paramIndex = moduleGroupSelector_->getParameterIndexFromDetId(detId,firstRunOfIOV);
322  treeInfo[detId] = TreeStruct(param, this->getParameterError(paramIndex), paramIndex);
323  }
324 
325  if (saveToDB_ || nonZeroParamsOrErrors != 0) { // Skip writing mille jobs...
326  this->writeTree(output, treeInfo, (treeName + Form("result_%lld", firstRunOfIOV)).c_str());
327  }
328 
329  if (saveToDB_) { // If requested, write out to DB
331  if (dbService.isAvailable()) {
332  dbService->writeOne(output, firstRunOfIOV, recordNameDBwrite_.c_str());
333  // no 'delete output;': writeOne(..) took over ownership
334  } else {
335  delete output;
336  edm::LogError("BadConfig") << "@SUB=SiPixelLorentzAngleCalibration::endOfJob"
337  << "No PoolDBOutputService available, but saveToDB true!";
338  }
339  } else {
340  delete output;
341  }
342  } // end loop on IOVs
343 
344 }
const std::map< unsigned int, float > & getLorentzAngles() const
edm::RunNumber_t firstRunOfIOV(unsigned int iovNum) const
First run of iov (0 if iovNum not treated).
const std::string & name() const
name of this calibration
int getParameterIndexFromDetId(unsigned int detId, edm::RunNumber_t run) const
static std::string const input
Definition: EdmProvDump.cc:43
void writeTree(const SiPixelLorentzAngle *lorentzAngle, const std::map< unsigned int, TreeStruct > &treeInfo, const char *treeName) const
structure to store algorithm results in a TTree
Definition: TreeStruct.h:6
unsigned long long Time_t
Definition: Time.h:16
virtual double getParameterError(unsigned int index) const override
bool isAvailable() const
Definition: Service.h:46
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
bool putLorentzAngle(const uint32_t &, float &)
tuple out
Definition: dbtoconf.py:99
const SiPixelLorentzAngle * getLorentzAnglesInput()
double getParameterForDetId(unsigned int detId, edm::RunNumber_t run) const
unsigned int numIovs() const
Total number of IOVs.
const SiPixelLorentzAngle * SiPixelLorentzAngleCalibration::getLorentzAnglesInput ( )
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 374 of file SiPixelLorentzAngleCalibration.cc.

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

Referenced by endOfJob().

375 {
376  // For parallel processing in Millepede II, create SiPixelLorentzAngle
377  // from info stored in files of parallel jobs and check that they are identical.
378  // If this job has run on data, still check that LA is identical to the ones
379  // from mergeFileNames_.
380  const std::string treeName(this->name() + "_input");
381  for (auto iFile = mergeFileNames_.begin(); iFile != mergeFileNames_.end(); ++iFile) {
382  SiPixelLorentzAngle* la = this->createFromTree(iFile->c_str(), treeName.c_str());
383  // siPixelLorentzAngleInput_ could be non-null from previous file of this loop
384  // or from checkLorentzAngleInput(..) when running on data in this job as well
386  delete siPixelLorentzAngleInput_; // NULL or empty
388  } else {
389  // FIXME: about comparison of maps see comments in checkLorentzAngleInput
390  if (la && !la->getLorentzAngles().empty() && // single job might not have got events
392  // Throw exception instead of error?
393  edm::LogError("NoInput") << "@SUB=SiPixelLorentzAngleCalibration::getLorentzAnglesInput"
394  << "Different input values from tree " << treeName
395  << " in file " << *iFile << ".";
396 
397  }
398  delete la;
399  }
400  }
401 
402  if (!siPixelLorentzAngleInput_) { // no files nor ran on events
404  edm::LogError("NoInput") << "@SUB=SiPixelLorentzAngleCalibration::getLorentzAnglesInput"
405  << "No input, create an empty one!";
406  } else if (siPixelLorentzAngleInput_->getLorentzAngles().empty()) {
407  edm::LogError("NoInput") << "@SUB=SiPixelLorentzAngleCalibration::getLorentzAnglesInput"
408  << "Empty result!";
409  }
410 
412 }
const std::map< unsigned int, float > & getLorentzAngles() const
const std::string & name() const
name of this calibration
SiPixelLorentzAngle * createFromTree(const char *fileName, const char *treeName) const
const std::vector< std::string > mergeFileNames_
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 237 of file SiPixelLorentzAngleCalibration.cc.

References cmsHarvester::index, and parameters_.

Referenced by Mixins._Parameterizable::hasParameter().

238 {
239  return (index >= parameters_.size() ? 0. : parameters_[index]);
240 }
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 243 of file SiPixelLorentzAngleCalibration.cc.

References cmsHarvester::index, and paramUncertainties_.

Referenced by endOfJob().

244 {
245  return (index >= paramUncertainties_.size() ? 0. : paramUncertainties_[index]);
246 }
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 415 of file SiPixelLorentzAngleCalibration.cc.

References TkModuleGroupSelector::getParameterIndexFromDetId(), cmsHarvester::index, moduleGroupSelector_, and parameters_.

Referenced by endOfJob().

417 {
419  return (index < 0 ? 0. : parameters_[index]);
420 }
int getParameterIndexFromDetId(unsigned int detId, edm::RunNumber_t run) const
unsigned int SiPixelLorentzAngleCalibration::numParameters ( ) const
overridevirtual

How many parameters does this calibration define?

Implements IntegratedCalibrationBase.

Definition at line 168 of file SiPixelLorentzAngleCalibration.cc.

References parameters_.

Referenced by beginOfJob().

169 {
170  return parameters_.size();
171 }
bool SiPixelLorentzAngleCalibration::setParameter ( unsigned int  index,
double  value 
)
overridevirtual

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

Implements IntegratedCalibrationBase.

Definition at line 215 of file SiPixelLorentzAngleCalibration.cc.

References cmsHarvester::index, parameters_, and relativeConstraints::value.

Referenced by editorTools.UserCodeTool::__call__(), HiCoreTools.RestrictInputToAOD::__call__(), coreTools.RunOnData::__call__(), trackTools.MakeAODTrackCandidates::__call__(), runJetUncertainties.RunJetUncertainties::__call__(), metTools.AddMETCollection::__call__(), editorTools.ChangeSource::__call__(), HiCoreTools.RemoveMCMatching::__call__(), cmsswVersionTools.PickRelValInputFiles::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__call__(), jetTools.AddJetCollection::__call__(), HiCoreTools.RemoveAllPATObjectsBut::__call__(), runType1CaloMEtUncertainties.RunType1CaloMEtUncertainties::__call__(), HiCoreTools.RemoveSpecificPATObjects::__call__(), trigTools.SwitchOnTriggerStandAlone::__call__(), trackTools.MakeTrackCandidates::__call__(), runMVAMEtUncertainties.RunMVAMEtUncertainties::__call__(), tauTools.AddTauCollection::__call__(), jmeUncertaintyTools.JetMEtUncertaintyTools::__call__(), trigTools.SwitchOnTriggerMatching::__call__(), HiCoreTools.RemoveCleaning::__call__(), runType1PFMEtUncertainties.RunType1PFMEtUncertainties::__call__(), HiCoreTools.AddCleaning::__call__(), runNoPileUpMEtUncertainties.RunNoPileUpMEtUncertainties::__call__(), trigTools.SwitchOnTriggerMatchingStandAlone::__call__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.AddJetID::__call__(), and jetTools.SetTagInfos::__call__().

216 {
217  if (index >= parameters_.size()) {
218  return false;
219  } else {
221  return true;
222  }
223 }
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 226 of file SiPixelLorentzAngleCalibration.cc.

References relativeConstraints::error, cmsHarvester::index, and paramUncertainties_.

227 {
228  if (index >= paramUncertainties_.size()) {
229  return false;
230  } else {
232  return true;
233  }
234 }
void SiPixelLorentzAngleCalibration::writeTree ( const SiPixelLorentzAngle lorentzAngle,
const std::map< unsigned int, TreeStruct > &  treeInfo,
const char *  treeName 
) const
private

Definition at line 423 of file SiPixelLorentzAngleCalibration.cc.

References mergeVDriftHistosByStation::file, TkModuleGroupSelector::firstRunOfIOV(), SiPixelLorentzAngle::getLorentzAngles(), TkModuleGroupSelector::getParameterIndexFromDetId(), TreeStruct::LeafList(), moduleGroupSelector_, outFileName_, MainPageGenerator::tree, and relativeConstraints::value.

Referenced by endOfJob().

426 {
427  if (!lorentzAngle) return;
428 
429  TFile* file = TFile::Open(outFileName_.c_str(), "UPDATE");
430  if (!file) {
431  edm::LogError("BadConfig") << "@SUB=SiPixelLorentzAngleCalibration::writeTree"
432  << "Could not open file '" << outFileName_ << "'.";
433  return;
434  }
435 
436  TTree *tree = new TTree(treeName, treeName);
437  unsigned int id = 0;
438  float value = 0.;
439  TreeStruct treeStruct;
440  tree->Branch("detId", &id, "detId/i");
441  tree->Branch("value", &value, "value/F");
442  tree->Branch("treeStruct", &treeStruct, TreeStruct::LeafList());
443 
444  for (auto iterIdValue = lorentzAngle->getLorentzAngles().begin();
445  iterIdValue != lorentzAngle->getLorentzAngles().end(); ++iterIdValue) {
446  // type of (*iterIdValue) is pair<unsigned int, float>
447  id = iterIdValue->first; // key of map is DetId
448  value = iterIdValue->second;
449  // type of (*treeStructIter) is pair<unsigned int, TreeStruct>
450  auto treeStructIter = treeInfo.find(id); // find info for this id
451  if (treeStructIter != treeInfo.end()) {
452  treeStruct = treeStructIter->second; // info from input map
453  } else { // if none found, fill at least parameter index (using 1st IOV...)
454  const cond::Time_t run1of1stIov = moduleGroupSelector_->firstRunOfIOV(0);
455  const int ind = moduleGroupSelector_->getParameterIndexFromDetId(id, run1of1stIov);
456  treeStruct = TreeStruct(ind);
457  }
458  tree->Fill();
459  }
460  tree->Write();
461  delete file; // tree vanishes with the file... (?)
462 
463 }
const std::map< unsigned int, float > & getLorentzAngles() const
edm::RunNumber_t firstRunOfIOV(unsigned int iovNum) const
First run of iov (0 if iovNum not treated).
int getParameterIndexFromDetId(unsigned int detId, edm::RunNumber_t run) const
structure to store algorithm results in a TTree
Definition: TreeStruct.h:6
unsigned long long Time_t
Definition: Time.h:16
static const char * LeafList()
Definition: TreeStruct.h:17

Member Data Documentation

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

Definition at line 129 of file SiPixelLorentzAngleCalibration.cc.

Referenced by beginOfJob(), and getLorentzAnglesInput().

const edm::ParameterSet SiPixelLorentzAngleCalibration::moduleGroupSelCfg_
private

Definition at line 139 of file SiPixelLorentzAngleCalibration.cc.

Referenced by beginOfJob().

TkModuleGroupSelector* SiPixelLorentzAngleCalibration::moduleGroupSelector_
private
const std::string SiPixelLorentzAngleCalibration::outFileName_
private

Definition at line 128 of file SiPixelLorentzAngleCalibration.cc.

Referenced by beginOfJob(), and writeTree().

std::vector<double> SiPixelLorentzAngleCalibration::parameters_
private
std::vector<double> SiPixelLorentzAngleCalibration::paramUncertainties_
private
const std::string SiPixelLorentzAngleCalibration::recordNameDBwrite_
private

Definition at line 127 of file SiPixelLorentzAngleCalibration.cc.

Referenced by endOfJob().

const bool SiPixelLorentzAngleCalibration::saveToDB_
private

Definition at line 126 of file SiPixelLorentzAngleCalibration.cc.

Referenced by beginOfJob(), and endOfJob().

SiPixelLorentzAngle* SiPixelLorentzAngleCalibration::siPixelLorentzAngleInput_
private
edm::ESWatcher<SiPixelLorentzAngleRcd> SiPixelLorentzAngleCalibration::watchLorentzAngleRcd_
private

Definition at line 131 of file SiPixelLorentzAngleCalibration.cc.

Referenced by checkLorentzAngleInput().