File indexing completed on 2024-04-06 11:57:24
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include "Alignment/CommonAlignment/interface/AlignableComposite.h"
0011 #include "Alignment/CommonAlignment/interface/AlignableObjectId.h"
0012 #include "Alignment/CommonAlignment/interface/SurveyDet.h"
0013 #include "Alignment/SurveyAnalysis/interface/SurveyInputBase.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015
0016 class SurveyInputTest : public SurveyInputBase {
0017 public:
0018 SurveyInputTest(const edm::ParameterSet&);
0019
0020
0021 virtual void beginJob();
0022
0023 virtual void analyze(const edm::Event&, const edm::EventSetup&) {}
0024
0025 private:
0026 Alignable* create(const std::string& parName
0027 );
0028
0029 edm::ParameterSet theConfig;
0030 };
0031
0032 using namespace align;
0033
0034 SurveyInputTest::SurveyInputTest(const edm::ParameterSet& cfg) : theConfig(cfg) {}
0035
0036 void SurveyInputTest::beginJob() { addComponent(create(theConfig.getParameter<std::string>("detector"))); }
0037
0038 Alignable* SurveyInputTest::create(const std::string& parName) {
0039 typedef std::vector<double> Doubles;
0040 typedef std::vector<std::string> Strings;
0041
0042 static const Doubles zero3Vector(3, 0.);
0043 static const Doubles zero6Vector(6, 0.);
0044 static const Strings emptyString;
0045
0046 edm::ParameterSet pars = theConfig.getParameter<edm::ParameterSet>(parName);
0047
0048 Doubles center = pars.getUntrackedParameter<Doubles>("center", zero3Vector);
0049 Doubles angles = pars.getUntrackedParameter<Doubles>("angles", zero3Vector);
0050 Doubles shifts = pars.getUntrackedParameter<Doubles>("shifts", zero6Vector);
0051 Doubles errors = pars.getUntrackedParameter<Doubles>("errors", zero6Vector);
0052
0053 ErrorMatrix cov;
0054
0055 for (unsigned int i = 0; i < 6; ++i)
0056 cov(i, i) = errors[i];
0057
0058 PositionType pos(center[0], center[1], center[2]);
0059 EulerAngles ang(3);
0060
0061 ang(1) = angles[0], ang(2) = angles[1];
0062 ang(3) = angles[2];
0063
0064 AlignableSurface surf(pos, toMatrix(ang));
0065
0066 surf.setWidth(pars.getUntrackedParameter<double>("width", 0.));
0067 surf.setLength(pars.getUntrackedParameter<double>("length", 0.));
0068
0069 int type = pars.getParameter<int>("typeId");
0070 std::string name = pars.getParameter<std::string>("object");
0071
0072
0073
0074 AlignableObjectId alignableObjectId{AlignableObjectId::Geometry::General};
0075
0076 Alignable* ali = new AlignableComposite(type, alignableObjectId.stringToId(name), surf.rotation());
0077
0078 Strings comp = pars.getUntrackedParameter<Strings>("compon", emptyString);
0079
0080 unsigned int nComp = comp.size();
0081
0082 for (unsigned int i = 0; i < nComp; ++i) {
0083 ali->addComponent(create(comp[i]));
0084 }
0085
0086 ang(1) = shifts[3], ang(2) = shifts[4];
0087 ang(3) = shifts[5];
0088
0089 ali->setSurvey(new SurveyDet(surf, cov));
0090 ali->move(surf.toGlobal(align::LocalVector(shifts[0], shifts[1], shifts[2])));
0091 ali->rotateInLocalFrame(toMatrix(ang));
0092
0093 return ali;
0094 }
0095
0096 #include "FWCore/Framework/interface/MakerMacros.h"
0097 DEFINE_FWK_MODULE(SurveyInputTest);