46 #include <boost/assign/list_of.hpp> 75 unsigned int derivatives(std::vector<ValuesIndexPair> &outDerivInds,
123 const std::map<unsigned int,TreeStruct> &treeInfo,
const char *treeName)
const;
169 <<
"SiStripLorentzAngleCalibration:\n" <<
"Unknown mode '" 201 outDerivInds.clear();
227 const double xDerivative = bFieldLocal.y() * dZ * -0.5;
229 const Values derivs(xDerivative, 0.);
234 edm::LogWarning(
"Alignment") <<
"@SUB=SiStripLorentzAngleCalibration::derivatives1" 235 <<
"Hit without GeomDet, skip!";
239 edm::LogWarning(
"Alignment") <<
"@SUB=SiStripLorentzAngleCalibration::derivatives2" 240 <<
"Readout mode is " << mode <<
", but looking for " 244 return outDerivInds.size();
293 edm::LogInfo(
"Alignment") <<
"@SUB=SiStripLorentzAngleCalibration" <<
"Created with name " 295 <<
"',\n" << this->
numParameters() <<
" parameters to be determined." 302 edm::LogInfo(
"Alignment") <<
"@SUB=SiStripLorentzAngleCalibration" 312 std::ostringstream
out;
314 for (
unsigned int iPar = 0; iPar <
parameters_.size(); ++iPar) {
317 edm::LogInfo(
"Alignment") <<
"@SUB=SiStripLorentzAngleCalibration::endOfJob" << out.str();
319 std::map<unsigned int, TreeStruct> treeInfo;
323 const std::string treeName(this->
name() +
'_' + readoutModeName_ +
'_');
324 this->
writeTree(input, treeInfo, (treeName +
"input").c_str());
327 edm::LogError(
"Alignment") <<
"@SUB=SiStripLorentzAngleCalibration::endOfJob" 328 <<
"Input Lorentz angle map is empty ('" 329 << readoutModeName_ <<
"' mode), skip writing output!";
333 const unsigned int nonZeroParamsOrErrors =
336 std::bind2nd(std::not_equal_to<double>(), 0.));
345 const unsigned int detId = iterIdValue->first;
361 if (
saveToDB_ || nonZeroParamsOrErrors != 0) {
362 this->
writeTree(output, treeInfo, (treeName + Form(
"result_%lld", firstRunOfIOV)).c_str());
372 edm::LogError(
"BadConfig") <<
"@SUB=SiStripLorentzAngleCalibration::endOfJob" 373 <<
"No PoolDBOutputService available, but saveToDB true!";
400 <<
"SiStripLorentzAngleCalibration::checkLorentzAngleInput:\n" 401 <<
"Content of SiStripLorentzAngle changed at run " << eventInfo.
eventId().
run()
402 <<
", but algorithm expects constant input!\n";
423 const double bpCor = backPlaneHandle->getBackPlaneCorrection(
id);
450 edm::LogError(
"NoInput") <<
"@SUB=SiStripLorentzAngleCalibration::getLorentzAnglesInput" 451 <<
"Different input values from tree " << treeName
452 <<
" in file " << *iFile <<
".";
461 edm::LogError(
"NoInput") <<
"@SUB=SiStripLorentzAngleCalibration::getLorentzAnglesInput" 464 edm::LogError(
"NoInput") <<
"@SUB=SiStripLorentzAngleCalibration::getLorentzAnglesInput" 482 const std::map<unsigned int, TreeStruct> &treeInfo,
483 const char *treeName)
const 485 if (!lorentzAngle)
return;
489 edm::LogError(
"BadConfig") <<
"@SUB=SiStripLorentzAngleCalibration::writeTree" 494 TTree *
tree =
new TTree(treeName, treeName);
498 tree->Branch(
"detId", &
id,
"detId/i");
499 tree->Branch(
"value", &value,
"value/F");
505 id = iterIdValue->first;
506 value = iterIdValue->second;
508 auto treeStructIter = treeInfo.find(
id);
509 if (treeStructIter != treeInfo.end()) {
510 treeStruct = treeStructIter->second;
528 TFile*
file =
nullptr;
529 FILE* testFile = fopen(fileName,
"r");
532 file = TFile::Open(fileName,
"READ");
535 TTree *
tree =
nullptr;
536 if (file) file->GetObject(treeName, tree);
542 tree->SetBranchAddress(
"detId", &
id);
543 tree->SetBranchAddress(
"value", &value);
546 const Long64_t nEntries = tree->GetEntries();
547 for (Long64_t iEntry = 0; iEntry < nEntries; ++iEntry) {
548 tree->GetEntry(iEntry);
552 edm::LogWarning(
"Alignment") <<
"@SUB=SiStripLorentzAngleCalibration::createFromTree" 553 <<
"Could not get TTree '" << treeName <<
"' from file '" 554 << fileName << (file ?
"'." :
"' (file does not exist).");
const std::string recordNameDBwrite_
edm::RunNumber_t firstRunOfIOV(unsigned int iovNum) const
First run of iov (0 if iovNum not treated).
const edm::ParameterSet moduleGroupSelCfg_
int16_t singleReadOutMode() const
const std::vector< std::string > mergeFileNames_
SiStripLorentzAngleCalibration(const edm::ParameterSet &cfg)
Constructor.
std::vector< double > parameters_
const std::string & name() const
name of this calibration
def setup(process, global_tag, zero_tesla=False)
const Bounds & bounds() const
int getParameterIndexFromDetId(unsigned int detId, edm::RunNumber_t run) const
void writeTree(const SiStripLorentzAngle *lorentzAngle, const std::map< unsigned int, TreeStruct > &treeInfo, const char *treeName) const
const edm::EventID eventId() const
const Plane & surface() const
The nominal surface of the GeomDet.
bool setParameter(unsigned int index, double value) override
double getParameterForDetId(unsigned int detId, edm::RunNumber_t run) const
define event information passed to algorithms
bool putLorentzAngle(const uint32_t &, float)
edm::ESWatcher< SiStripLorentzAngleRcd > watchLorentzAngleRcd_
static std::string const input
const std::string outFileName_
structure to store algorithm results in a TTree
const std::map< unsigned int, float > & getLorentzAngles() const
unsigned long long Time_t
const std::string readoutModeName_
const GeomDet * det() const
LocalPoint toLocal(const GlobalPoint &gp) const
std::vector< double > paramUncertainties_
std::pair< Values, unsigned int > ValuesIndexPair
x- and y-values
DetId geographicalId() const
The label of this GeomDet.
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
TkModuleGroupSelector * moduleGroupSelector_
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
double getParameterError(unsigned int index) const override
Detector identifier class for the strip tracker.
~SiStripLorentzAngleCalibration() override
Destructor.
double getParameter(unsigned int index) const override
virtual float thickness() const =0
std::pair< double, double > Values
static const char * LeafList()
double effectiveThickness(const GeomDet *det, int16_t mode, const edm::EventSetup &setup) const
in non-peak mode the effective thickness is reduced...
bool check(const edm::EventSetup &iSetup)
bool checkLorentzAngleInput(const edm::EventSetup &setup, const EventInfo &eventInfo)
unsigned int numParameters() const override
How many parameters does this calibration define?
unsigned int getNumberOfParameters() const
bool setParameterError(unsigned int index, double error) override
unsigned int numIovs() const
Total number of IOVs.
void beginOfJob(AlignableTracker *tracker, AlignableMuon *muon, AlignableExtras *extras) override
#define DEFINE_EDM_PLUGIN(factory, type, name)
SiStripLorentzAngle * siStripLorentzAngleInput_
eventInfo
add run, event number and lumi section
unsigned int derivatives(std::vector< ValuesIndexPair > &outDerivInds, const TransientTrackingRecHit &hit, const TrajectoryStateOnSurface &tsos, const edm::EventSetup &setup, const EventInfo &eventInfo) const override
Constructor of the full muon geometry.
const SiStripLorentzAngle * getLorentzAnglesInput()
SiStripLorentzAngle * createFromTree(const char *fileName, const char *treeName) const
const PositionType & position() const