|
|
Go to the documentation of this file.
66 unsigned int derivatives(std::vector<ValuesIndexPair> &outDerivInds,
111 const std::map<unsigned int, TreeStruct> &treeInfo,
112 const char *treeName)
const;
141 readoutModeName_(
cfg.getParameter<
std::
string>(
"readoutMode")),
142 saveToDB_(
cfg.getParameter<
bool>(
"saveToDB")),
143 recordNameDBwrite_(
cfg.getParameter<
std::
string>(
"recordNameDBwrite")),
144 outFileName_(
cfg.getParameter<
std::
string>(
"treeFile")),
155 throw cms::Exception(
"BadConfig") <<
"SiStripLorentzAngleCalibration:\n"
157 <<
"', should be 'peak' or 'deconvolution' .\n";
189 if (lorentzAngleRcd.validityInterval().first().eventID().run() >
firstRun &&
195 <<
") in an IOV (" <<
firstRun <<
") that was already cached.\n"
196 <<
"The following record in your input database tag has an IOV "
197 <<
"boundary that does not match your IOV definition:\n"
198 <<
" - SiStripLorentzAngleRcd '" << lorentzAngleRcd.key().name() <<
"' (since "
199 << lorentzAngleRcd.validityInterval().first().eventID().run() <<
")\n";
213 outDerivInds.clear();
239 const double xDerivative = bFieldLocal.y() * dZ * -0.5;
240 const double yDerivative = bFieldLocal.x() * dZ * 0.5;
241 if (xDerivative || yDerivative) {
242 const Values derivs{xDerivative, yDerivative};
247 edm::LogWarning(
"Alignment") <<
"@SUB=SiStripLorentzAngleCalibration::derivatives1"
248 <<
"Hit without GeomDet, skip!";
252 edm::LogWarning(
"Alignment") <<
"@SUB=SiStripLorentzAngleCalibration::derivatives2"
253 <<
"Readout mode is " <<
mode <<
", but looking for " <<
readoutMode_ <<
" ("
257 return outDerivInds.size();
301 edm::LogInfo(
"Alignment") <<
"@SUB=SiStripLorentzAngleCalibration"
310 edm::LogInfo(
"Alignment") <<
"@SUB=SiStripLorentzAngleCalibration"
318 std::ostringstream
out;
320 for (
unsigned int iPar = 0; iPar <
parameters_.size(); ++iPar) {
323 edm::LogInfo(
"Alignment") <<
"@SUB=SiStripLorentzAngleCalibration::endOfJob" <<
out.str();
325 std::map<unsigned int, TreeStruct> treeInfo;
328 const std::string treeName{this->
name() +
'_' + readoutModeName_ +
'_'};
329 std::vector<const SiStripLorentzAngle *>
inputs{};
336 (treeName +
"input_" + std::to_string(firstRunOfIOV)).c_str());
338 if (
inputs.back()->getLorentzAngles().empty()) {
339 edm::LogError(
"Alignment") <<
"@SUB=SiStripLorentzAngleCalibration::endOfJob"
341 <<
"' mode), skip writing output!";
346 const unsigned int nonZeroParamsOrErrors =
354 for (
const auto &iterIdValue :
inputs[iIOV]->getLorentzAngles()) {
356 const auto detId = iterIdValue.first;
367 auto value = iterIdValue.second + static_cast<float>(param);
373 if (
saveToDB_ || nonZeroParamsOrErrors != 0) {
374 this->
writeTree(&
output, treeInfo, (treeName + Form(
"result_%lld", firstRunOfIOV)).c_str());
382 edm::LogError(
"BadConfig") <<
"@SUB=SiStripLorentzAngleCalibration::endOfJob"
383 <<
"No PoolDBOutputService available, but saveToDB true!";
401 const double bpCor = backPlaneHandle->getBackPlaneCorrection(
id);
426 if (!la.getLorentzAngles().empty() &&
429 edm::LogError(
"NoInput") <<
"@SUB=SiStripLorentzAngleCalibration::getLorentzAnglesInput"
430 <<
"Different input values from tree " << treeName <<
" in file " << iFile <<
".";
439 edm::LogError(
"NoInput") <<
"@SUB=SiStripLorentzAngleCalibration::getLorentzAnglesInput"
442 edm::LogError(
"NoInput") <<
"@SUB=SiStripLorentzAngleCalibration::getLorentzAnglesInput"
458 const std::map<unsigned int, TreeStruct> &treeInfo,
459 const char *treeName)
const {
465 edm::LogError(
"BadConfig") <<
"@SUB=SiStripLorentzAngleCalibration::writeTree"
470 TTree *
tree =
new TTree(treeName, treeName);
474 tree->Branch(
"detId", &
id,
"detId/i");
475 tree->Branch(
"value", &
value,
"value/F");
482 id = iterIdValue->first;
483 value = iterIdValue->second;
485 auto treeStructIter = treeInfo.find(
id);
486 if (treeStructIter != treeInfo.end()) {
487 treeStruct = treeStructIter->second;
503 TFile *
file =
nullptr;
504 FILE *testFile = fopen(
fileName,
"r");
510 TTree *
tree =
nullptr;
518 tree->SetBranchAddress(
"detId", &
id);
521 const Long64_t nEntries =
tree->GetEntries();
522 for (Long64_t iEntry = 0; iEntry < nEntries; ++iEntry) {
523 tree->GetEntry(iEntry);
527 edm::LogWarning(
"Alignment") <<
"@SUB=SiStripLorentzAngleCalibration::createFromTree"
528 <<
"Could not get TTree '" << treeName <<
"' from file '" <<
fileName
529 << (
file ?
"'." :
"' (file does not exist).");
bool check(const edm::EventSetup &iSetup)
std::map< align::RunNumber, SiStripLorentzAngle > cachedLorentzAngleInputs_
const std::string recordNameDBwrite_
const std::string & name() const
name of this calibration
const std::vector< std::string > mergeFileNames_
SiStripLorentzAngleCalibration(const edm::ParameterSet &cfg)
Constructor.
unsigned int numParameters() const override
How many parameters does this calibration define?
align::RunNumber currentIOV_
cond::RealTimeType< cond::runnumber >::type RunNumber
std::pair< Values, unsigned int > ValuesIndexPair
x- and y-values
const GeomDet * det() const
double getParameter(unsigned int index) const override
structure to store algorithm results in a TTree
Log< level::Info, false > LogInfo
Log< level::Warning, false > LogWarning
SiStripLorentzAngle createFromTree(const char *fileName, const char *treeName) const
const std::string readoutModeName_
const Plane & surface() const
The nominal surface of the GeomDet.
const TimeTypeSpecs timeTypeSpecs[]
std::pair< double, double > Values
edm::ESWatcher< SiStripLorentzAngleRcd > watchLorentzAngleRcd_
const Bounds & bounds() const
bool setParameter(unsigned int index, double value) override
std::vector< double > paramUncertainties_
std::unique_ptr< TkModuleGroupSelector > moduleGroupSelector_
double effectiveThickness(const GeomDet *det, int16_t mode, const edm::EventSetup &setup) const
in non-peak mode the effective thickness is reduced...
unsigned int derivatives(std::vector< ValuesIndexPair > &outDerivInds, const TransientTrackingRecHit &hit, const TrajectoryStateOnSurface &tsos, const edm::EventSetup &setup, const EventInfo &eventInfo) const override
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
#define DEFINE_EDM_PLUGIN(factory, type, name)
static constexpr auto TEC
double getParameterError(unsigned int index) const override
DetId geographicalId() const
The label of this GeomDet.
virtual float thickness() const =0
const std::string outFileName_
std::vector< double > parameters_
unsigned long long Time_t
Constructor of the full muon geometry.
bool setParameterError(unsigned int index, double error) override
~SiStripLorentzAngleCalibration() override=default
Destructor.
static constexpr auto TOB
static const char * LeafList()
Log< level::Error, false > LogError
static constexpr auto TID
eventInfo
add run, event number and lumi section
void beginOfJob(AlignableTracker *tracker, AlignableMuon *muon, AlignableExtras *extras) override
const std::map< unsigned int, float > & getLorentzAngles() const
void beginRun(const edm::Run &, const edm::EventSetup &) override
Call at beginning of run:
SiStripLorentzAngle * siStripLorentzAngleInput_
void writeTree(const SiStripLorentzAngle *lorentzAngle, const std::map< unsigned int, TreeStruct > &treeInfo, const char *treeName) const
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
static constexpr auto TIB
const SiStripLorentzAngle * getLorentzAnglesInput(const align::RunNumber &=0)
Detector identifier class for the strip tracker.
double getParameterForDetId(unsigned int detId, edm::RunNumber_t run) const
const edm::ParameterSet moduleGroupSelCfg_
define event information passed to algorithms