48 #include <boost/assign/list_of.hpp> 77 unsigned int derivatives(std::vector<ValuesIndexPair> &outDerivInds,
122 const std::map<unsigned int,TreeStruct> &treeInfo,
const char *treeName)
const;
169 <<
"SiStripBackplaneCalibration:\n" <<
"Unknown mode '" 201 outDerivInds.clear();
233 const double xDerivative = 0.5 * dZ * (mobility * bFieldLocal.y() + tanPsi);
243 const Values derivs(xDerivative, 0.);
247 edm::LogWarning(
"Alignment") <<
"@SUB=SiStripBackplaneCalibration::derivatives1" 248 <<
"Hit without GeomDet, skip!";
252 edm::LogWarning(
"Alignment") <<
"@SUB=SiStripBackplaneCalibration::derivatives2" 253 <<
"Readout mode is " << mode <<
", but looking for " 257 return outDerivInds.size();
308 edm::LogInfo(
"Alignment") <<
"@SUB=SiStripBackplaneCalibration" <<
"Created with name " 310 <<
"',\n" << this->
numParameters() <<
" parameters to be determined." 317 edm::LogInfo(
"Alignment") <<
"@SUB=SiStripBackplaneCalibration" 328 std::ostringstream
out;
330 for (
unsigned int iPar = 0; iPar <
parameters_.size(); ++iPar) {
333 edm::LogInfo(
"Alignment") <<
"@SUB=SiStripBackplaneCalibration::endOfJob" << out.str();
335 std::map<unsigned int, TreeStruct> treeInfo;
339 const std::string treeName(this->
name() +
'_' + readoutModeName_ +
'_');
340 this->
writeTree(input, treeInfo, (treeName +
"input").c_str());
343 edm::LogError(
"Alignment") <<
"@SUB=SiStripBackplaneCalibration::endOfJob" 344 <<
"Input back plane correction map is empty ('" 345 << readoutModeName_ <<
"' mode), skip writing output!";
349 const unsigned int nonZeroParamsOrErrors =
352 [](
auto c){
return c!= 0.;});
361 const unsigned int detId = iterIdValue->first;
395 if (
saveToDB_ || nonZeroParamsOrErrors != 0) {
396 this->
writeTree(output, treeInfo, (treeName + Form(
"result_%lld", firstRunOfIOV)).c_str());
406 edm::LogError(
"BadConfig") <<
"@SUB=SiStripBackplaneCalibration::endOfJob" 407 <<
"No PoolDBOutputService available, but saveToDB true!";
434 <<
"SiStripBackplaneCalibration::checkBackPlaneCorrectionInput:\n" 435 <<
"Content of SiStripBackPlaneCorrection changed at run " << eventInfo.
eventId().
run()
436 <<
", but algorithm expects constant input!\n";
465 edm::LogError(
"NoInput") <<
"@SUB=SiStripBackplaneCalibration::getBackPlaneCorrectionInput" 466 <<
"Different input values from tree " << treeName
467 <<
" in file " << *iFile <<
".";
476 edm::LogError(
"NoInput") <<
"@SUB=SiStripBackplaneCalibration::getBackPlaneCorrectionInput" 479 edm::LogError(
"NoInput") <<
"@SUB=SiStripBackplaneCalibration::getBackPlaneCorrectionInput" 497 const std::map<unsigned int, TreeStruct> &treeInfo,
498 const char *treeName)
const 500 if (!backPlaneCorrection)
return;
504 edm::LogError(
"BadConfig") <<
"@SUB=SiStripBackplaneCalibration::writeTree" 509 TTree *
tree =
new TTree(treeName, treeName);
513 tree->Branch(
"detId", &
id,
"detId/i");
514 tree->Branch(
"value", &value,
"value/F");
520 id = iterIdValue->first;
521 value = iterIdValue->second;
523 auto treeStructIter = treeInfo.find(
id);
524 if (treeStructIter != treeInfo.end()) {
525 treeStruct = treeStructIter->second;
544 TFile*
file =
nullptr;
545 FILE* testFile = fopen(fileName,
"r");
548 file = TFile::Open(fileName,
"READ");
551 TTree *
tree =
nullptr;
552 if (file) file->GetObject(treeName, tree);
558 tree->SetBranchAddress(
"detId", &
id);
559 tree->SetBranchAddress(
"value", &value);
562 const Long64_t nEntries = tree->GetEntries();
563 for (Long64_t iEntry = 0; iEntry < nEntries; ++iEntry) {
564 tree->GetEntry(iEntry);
568 edm::LogWarning(
"Alignment") <<
"@SUB=SiStripBackplaneCalibration::createFromTree" 569 <<
"Could not get TTree '" << treeName <<
"' from file '" 570 << fileName << (file ?
"'." :
"' (file does not exist).");
TkModuleGroupSelector * moduleGroupSelector_
bool putBackPlaneCorrection(const uint32_t &, float)
const std::string outFileName_
const LocalTrajectoryParameters & localParameters() const
std::vector< double > paramUncertainties_
edm::RunNumber_t firstRunOfIOV(unsigned int iovNum) const
First run of iov (0 if iovNum not treated).
int16_t singleReadOutMode() const
const std::string & name() const
name of this calibration
def setup(process, global_tag, zero_tesla=False)
const Bounds & bounds() const
~SiStripBackplaneCalibration() override
Destructor.
int getParameterIndexFromDetId(unsigned int detId, edm::RunNumber_t run) const
SiStripBackPlaneCorrection * siStripBackPlaneCorrInput_
void writeTree(const SiStripBackPlaneCorrection *backPlaneCorr, const std::map< unsigned int, TreeStruct > &treeInfo, const char *treeName) const
const edm::ParameterSet moduleGroupSelCfg_
const edm::EventID eventId() const
const Plane & surface() const
The nominal surface of the GeomDet.
unsigned int numParameters() const override
How many parameters does this calibration define?
define event information passed to algorithms
static std::string const input
bool checkBackPlaneCorrectionInput(const edm::EventSetup &setup, const EventInfo &eventInfo)
const SiStripBackPlaneCorrection * getBackPlaneCorrectionInput()
structure to store algorithm results in a TTree
const std::map< unsigned int, float > & getBackPlaneCorrections() const
SiStripBackPlaneCorrection * createFromTree(const char *fileName, const char *treeName) const
float getLorentzAngle(const uint32_t &) const
unsigned long long Time_t
const std::vector< std::string > mergeFileNames_
const GeomDet * det() const
void beginOfJob(AlignableTracker *tracker, AlignableMuon *muon, AlignableExtras *extras) override
LocalPoint toLocal(const GlobalPoint &gp) const
std::pair< Values, unsigned int > ValuesIndexPair
x- and y-values
edm::ESWatcher< SiStripBackPlaneCorrectionRcd > watchBackPlaneCorrRcd_
double getParameterForDetId(unsigned int detId, edm::RunNumber_t run) const
const std::string recordNameDBwrite_
DetId geographicalId() const
The label of this GeomDet.
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
bool setParameterError(unsigned int index, double error) override
const std::string readoutModeName_
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
double getParameter(unsigned int index) const override
SiStripBackplaneCalibration(const edm::ParameterSet &cfg)
Constructor.
virtual float thickness() const =0
std::pair< double, double > Values
unsigned int derivatives(std::vector< ValuesIndexPair > &outDerivInds, const TransientTrackingRecHit &hit, const TrajectoryStateOnSurface &tsos, const edm::EventSetup &setup, const EventInfo &eventInfo) const override
static const char * LeafList()
double getParameterError(unsigned int index) const override
AlgebraicVector5 mixedFormatVector() const
bool check(const edm::EventSetup &iSetup)
std::vector< double > parameters_
unsigned int getNumberOfParameters() const
unsigned int numIovs() const
Total number of IOVs.
#define DEFINE_EDM_PLUGIN(factory, type, name)
eventInfo
add run, event number and lumi section
Constructor of the full muon geometry.
const PositionType & position() const
bool setParameter(unsigned int index, double value) override