48 #include <boost/assign/list_of.hpp> 76 unsigned int derivatives(std::vector<ValuesIndexPair> &outDerivInds,
119 const std::map<unsigned int, TreeStruct> &treeInfo,
120 const char *treeName)
const;
163 throw cms::Exception(
"BadConfig") <<
"SiStripBackplaneCalibration:\n" 165 <<
"', should be 'peak' or 'deconvolution' .\n";
189 outDerivInds.clear();
221 const double xDerivative = 0.5 * dZ * (mobility * bFieldLocal.y() + tanPsi);
231 const Values derivs(xDerivative, 0.);
235 edm::LogWarning(
"Alignment") <<
"@SUB=SiStripBackplaneCalibration::derivatives1" 236 <<
"Hit without GeomDet, skip!";
240 edm::LogWarning(
"Alignment") <<
"@SUB=SiStripBackplaneCalibration::derivatives2" 241 <<
"Readout mode is " << mode <<
", but looking for " <<
readoutMode_ <<
" (" 245 return outDerivInds.size();
283 const std::vector<int> sdets =
291 edm::LogInfo(
"Alignment") <<
"@SUB=SiStripBackplaneCalibration" 300 edm::LogInfo(
"Alignment") <<
"@SUB=SiStripBackplaneCalibration" 308 std::ostringstream
out;
310 for (
unsigned int iPar = 0; iPar <
parameters_.size(); ++iPar) {
313 edm::LogInfo(
"Alignment") <<
"@SUB=SiStripBackplaneCalibration::endOfJob" << out.str();
315 std::map<unsigned int, TreeStruct> treeInfo;
319 const std::string treeName(this->
name() +
'_' + readoutModeName_ +
'_');
320 this->
writeTree(input, treeInfo, (treeName +
"input").c_str());
323 edm::LogError(
"Alignment") <<
"@SUB=SiStripBackplaneCalibration::endOfJob" 324 <<
"Input back plane correction map is empty ('" << readoutModeName_
325 <<
"' mode), skip writing output!";
329 const unsigned int nonZeroParamsOrErrors =
341 const unsigned int detId = iterIdValue->first;
375 if (
saveToDB_ || nonZeroParamsOrErrors != 0) {
376 this->
writeTree(output, treeInfo, (treeName + Form(
"result_%lld", firstRunOfIOV)).c_str());
386 edm::LogError(
"BadConfig") <<
"@SUB=SiStripBackplaneCalibration::endOfJob" 387 <<
"No PoolDBOutputService available, but saveToDB true!";
412 throw cms::Exception(
"BadInput") <<
"SiStripBackplaneCalibration::checkBackPlaneCorrectionInput:\n" 413 <<
"Content of SiStripBackPlaneCorrection changed at run " 414 << eventInfo.
eventId().
run() <<
", but algorithm expects constant input!\n";
442 edm::LogError(
"NoInput") <<
"@SUB=SiStripBackplaneCalibration::getBackPlaneCorrectionInput" 443 <<
"Different input values from tree " << treeName <<
" in file " << *iFile <<
".";
451 edm::LogError(
"NoInput") <<
"@SUB=SiStripBackplaneCalibration::getBackPlaneCorrectionInput" 454 edm::LogError(
"NoInput") <<
"@SUB=SiStripBackplaneCalibration::getBackPlaneCorrectionInput" 470 const std::map<unsigned int, TreeStruct> &treeInfo,
471 const char *treeName)
const {
472 if (!backPlaneCorrection)
477 edm::LogError(
"BadConfig") <<
"@SUB=SiStripBackplaneCalibration::writeTree" 482 TTree *
tree =
new TTree(treeName, treeName);
486 tree->Branch(
"detId", &
id,
"detId/i");
487 tree->Branch(
"value", &value,
"value/F");
494 id = iterIdValue->first;
495 value = iterIdValue->second;
497 auto treeStructIter = treeInfo.find(
id);
498 if (treeStructIter != treeInfo.end()) {
499 treeStruct = treeStructIter->second;
513 const char *treeName)
const {
516 TFile *
file =
nullptr;
517 FILE *testFile = fopen(fileName,
"r");
520 file = TFile::Open(fileName,
"READ");
523 TTree *
tree =
nullptr;
525 file->GetObject(treeName, tree);
531 tree->SetBranchAddress(
"detId", &
id);
532 tree->SetBranchAddress(
"value", &value);
535 const Long64_t nEntries = tree->GetEntries();
536 for (Long64_t iEntry = 0; iEntry < nEntries; ++iEntry) {
537 tree->GetEntry(iEntry);
541 edm::LogWarning(
"Alignment") <<
"@SUB=SiStripBackplaneCalibration::createFromTree" 542 <<
"Could not get TTree '" << treeName <<
"' from file '" << fileName
543 << (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
std::pair< double, double > Values
SiStripBackplaneCalibration(const edm::ParameterSet &cfg)
Constructor.
virtual float thickness() const =0
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