-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30507 from ghugo83/cocoa_to_dd4hep
Port COCOA to rely on DD4hep
- Loading branch information
Showing
13 changed files
with
1,194 additions
and
387 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<use name="clhep"/> | ||
<use name="root"/> | ||
<use name="dd4hep"/> | ||
<use name="Alignment/CocoaFit"/> | ||
<use name="CondCore/DBOutputService"/> | ||
<use name="DetectorDescription/DDCMS"/> | ||
<flags EDM_PLUGIN="1"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# **CMS Object-oriented Code for Optical Alignment** | ||
|
||
|
||
## General COCOA documentation | ||
|
||
General documentation is at [1]. | ||
COCOA website is at [2]. | ||
Notably, a user guide can be found at [3]. | ||
|
||
[1] https://cds.cern.ch/record/1047121/files/p193.pdf | ||
[2] http://cmsdoc.cern.ch/cms/MUON/alignment/software/COCOA/doc/cocoa.html | ||
[3] http://cmsdoc.cern.ch/cms/MUON/alignment/software/COCOA/doc/tex/users_guide.ps | ||
|
||
|
||
|
||
## Run COCOA | ||
This shows how to: | ||
- Run the COCOA simulation of an optical alignment system (described in .txt or XML format, with adjustments from DB description); | ||
- Run the least-squared fit on the alignment system; | ||
- Store results back into DB. | ||
|
||
### Input XML file | ||
An XML file describing the optical alignment system of interest needs to be provided as input to COCOA. | ||
|
||
Such an XML file can be generated from a .txt description, by an independent cocoa application in `Alignment/CocoaApplication/bin`. | ||
For example, one can generate an XML optical alignment system description, by simply doing the following: | ||
|
||
cd Alignment/CocoaApplication/bin | ||
cocoa simple2D.txt | ||
|
||
### Input DB OpticalAlignmentsRcd | ||
For testing purposes, an example input DB `OpticalAlignmentsRcd` can now be found at `Alignment/CocoaApplication/test/OpticalAlignments.db`. | ||
It was generated by adding the following, in `CocoaAnalyzer::analyze`, after `readXMLFile` returns: | ||
|
||
Model& model = Model::getInstance(); | ||
model.BuildSystemDescriptionFromOA(oaList_); | ||
CocoaDBMgr::getInstance()->DumpCocoaResults(); | ||
Of course, in practice, one would actually just need to call the OpticalAlignmentsRcd of interest to the desired alignment study. | ||
|
||
### Run COCOA | ||
One can now just do: | ||
|
||
cd Alignment/CocoaApplication/test | ||
cmsRun cocoaAnalyzer_cfg.py | ||
This will perform the least-squared fit, and store all results in `Alignment/CocoaApplication/test/OpticalAlignments.db`. | ||
The `OpticalAlignmentsRcd` obtained after fit, is stored with `OpticalAlignmentsRcdOutput` tag. | ||
It should also be possible to use the feature of dumping the results into ROOT format. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef ALIGNMENT_COCOA_APPLICATION_COCOA_ANALYZER_H | ||
#define ALIGNMENT_COCOA_APPLICATION_COCOA_ANALYZER_H | ||
|
||
#include "FWCore/Framework/interface/one/EDAnalyzer.h" | ||
#include "DetectorDescription/DDCMS/interface/DDSpecParRegistry.h" | ||
#include "CondFormats/OptAlignObjects/interface/OpticalAlignments.h" | ||
#include "CondFormats/OptAlignObjects/interface/OpticalAlignMeasurements.h" | ||
|
||
class CocoaAnalyzer : public edm::one::EDAnalyzer<edm::one::SharedResources> { | ||
public: | ||
explicit CocoaAnalyzer(edm::ParameterSet const& p); | ||
explicit CocoaAnalyzer(int i) {} | ||
~CocoaAnalyzer() override {} | ||
|
||
void beginJob() override; | ||
void analyze(const edm::Event& e, const edm::EventSetup& c) override; | ||
|
||
private: | ||
void readXMLFile(const edm::EventSetup& evts); | ||
|
||
std::vector<OpticalAlignInfo> readCalibrationDB(const edm::EventSetup& evts); | ||
void correctAllOpticalAlignments(std::vector<OpticalAlignInfo>& allDBOpticalAlignments); | ||
void correctOpticalAlignmentParameter(OpticalAlignParam& myXMLParam, const OpticalAlignParam& myDBParam); | ||
|
||
void runCocoa(); | ||
|
||
template <typename T> | ||
std::vector<T> getAllParameterValuesFromSpecParSections(const cms::DDSpecParRegistry& allSpecParSections, | ||
const std::string& nodePath, | ||
const std::string& parameterName); | ||
template <typename T> | ||
T getParameterValueFromSpecParSections(const cms::DDSpecParRegistry& allSpecParSections, | ||
const std::string& nodePath, | ||
const std::string& parameterName, | ||
const unsigned int parameterValueIndex); | ||
|
||
private: | ||
OpticalAlignments oaList_; | ||
OpticalAlignMeasurements measList_; | ||
std::string theCocoaDaqRootFileName_; | ||
}; | ||
|
||
#endif |
Oops, something went wrong.