Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions Alignment/MuonAlignment/interface/MuonAlignment.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

class MuonAlignment {
public:
MuonAlignment(const edm::EventSetup& iSetup);
MuonAlignment(const DTGeometry* dtGeometry, const CSCGeometry* cscGeometry, const GEMGeometry* gemGeometry);

MuonAlignment(const edm::EventSetup& iSetup, const MuonAlignmentInputMethod& input);

Expand All @@ -45,7 +45,10 @@ class MuonAlignment {
void fillGapsInSurvey(double shiftErr, double angleErr);
void copySurveyToAlignment();

void writeXML(const edm::ParameterSet& iConfig, const edm::EventSetup& iSetup);
void writeXML(const edm::ParameterSet& iConfig,
const DTGeometry* dtGeometryXML,
const CSCGeometry* cscGeometryXML,
const GEMGeometry* gemGeometryXML);

void saveDTSurveyToDB();
void saveCSCSurveyToDB();
Expand All @@ -66,9 +69,9 @@ class MuonAlignment {
std::string theDTSurveyRecordName, theDTSurveyErrorRecordName;
std::string theCSCSurveyRecordName, theCSCSurveyErrorRecordName;

edm::ESGetToken<DTGeometry, MuonGeometryRecord> esTokenDT_;
edm::ESGetToken<CSCGeometry, MuonGeometryRecord> esTokenCSC_;
edm::ESGetToken<GEMGeometry, MuonGeometryRecord> esTokenGEM_;
const DTGeometry* dtGeometry_;
const CSCGeometry* cscGeometry_;
const GEMGeometry* gemGeometry_;

align::Scalars displacements;

Expand Down
41 changes: 32 additions & 9 deletions Alignment/MuonAlignment/interface/MuonAlignmentInputDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,23 @@

class MuonAlignmentInputDB : public MuonAlignmentInputMethod {
public:
MuonAlignmentInputDB();
MuonAlignmentInputDB(
std::string dtLabel, std::string cscLabel, std::string gemLabel, std::string idealLabel, bool getAPEs);
MuonAlignmentInputDB(const DTGeometry* dtGeometry,
const CSCGeometry* cscGeometry,
const GEMGeometry* gemGeometry,
const Alignments* dtAlignments,
const Alignments* cscAlignments,
const Alignments* gemAlignments,
const Alignments* globalPositionRcd);
MuonAlignmentInputDB(const DTGeometry* dtGeometry,
const CSCGeometry* cscGeometry,
const GEMGeometry* gemGeometry,
const Alignments* dtAlignments,
const Alignments* cscAlignments,
const Alignments* gemAlignments,
const Alignments* globalPositionRcd,
const AlignmentErrorsExtended* dtAlignmentErrorsExtended,
const AlignmentErrorsExtended* cscAlignmentErrorsExtended,
const AlignmentErrorsExtended* gemAlignmentErrorsExtended);
~MuonAlignmentInputDB() override;

// ---------- const member functions ---------------------
Expand All @@ -39,17 +53,26 @@ class MuonAlignmentInputDB : public MuonAlignmentInputMethod {

// ---------- member functions ---------------------------

AlignableMuon *newAlignableMuon(const edm::EventSetup &iSetup) const override;
AlignableMuon* newAlignableMuon() const override;

MuonAlignmentInputDB(const MuonAlignmentInputDB &) = delete; // stop default
MuonAlignmentInputDB(const MuonAlignmentInputDB&) = delete; // stop default

const MuonAlignmentInputDB &operator=(const MuonAlignmentInputDB &) = delete; // stop default
const MuonAlignmentInputDB& operator=(const MuonAlignmentInputDB&) = delete; // stop default

private:
// ---------- member data --------------------------------

std::string m_dtLabel, m_cscLabel, m_gemLabel, idealGeometryLabel;
bool m_getAPEs;
const DTGeometry* dtGeometry_;
const CSCGeometry* cscGeometry_;
const GEMGeometry* gemGeometry_;
const Alignments* dtAlignments_;
const Alignments* cscAlignments_;
const Alignments* gemAlignments_;
const Alignments* globalPositionRcd_;
const AlignmentErrorsExtended* dtAlignmentErrorsExtended_;
const AlignmentErrorsExtended* cscAlignmentErrorsExtended_;
const AlignmentErrorsExtended* gemAlignmentErrorsExtended_;

const bool m_getAPEs;
};

#endif
15 changes: 10 additions & 5 deletions Alignment/MuonAlignment/interface/MuonAlignmentInputMethod.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@
#include "Alignment/MuonAlignment/interface/AlignableMuon.h"
#include "Geometry/DTGeometry/interface/DTGeometry.h"
#include "Geometry/CSCGeometry/interface/CSCGeometry.h"
#include "Geometry/GEMGeometry/interface/GEMGeometry.h"

// forward declarations

class MuonAlignmentInputMethod {
public:
MuonAlignmentInputMethod();
MuonAlignmentInputMethod(std::string idealLabel);
MuonAlignmentInputMethod(const DTGeometry* dtGeometry,
const CSCGeometry* cscGeometry,
const GEMGeometry* gemGeometry);
virtual ~MuonAlignmentInputMethod();

// ---------- const member functions ---------------------
Expand All @@ -43,15 +46,17 @@ class MuonAlignmentInputMethod {

// ---------- member functions ---------------------------

virtual AlignableMuon *newAlignableMuon(const edm::EventSetup &iSetup) const;
virtual AlignableMuon* newAlignableMuon() const;

MuonAlignmentInputMethod(const MuonAlignmentInputMethod &) = delete; // stop default
MuonAlignmentInputMethod(const MuonAlignmentInputMethod&) = delete; // stop default

const MuonAlignmentInputMethod &operator=(const MuonAlignmentInputMethod &) = delete; // stop default
const MuonAlignmentInputMethod& operator=(const MuonAlignmentInputMethod&) = delete; // stop default

private:
// ---------- member data --------------------------------
std::string idealGeometryLabel;
const DTGeometry* dtGeometry_;
const CSCGeometry* cscGeometry_;
const GEMGeometry* gemGeometry_;
};

#endif
20 changes: 15 additions & 5 deletions Alignment/MuonAlignment/interface/MuonAlignmentInputSurveyDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@

class MuonAlignmentInputSurveyDB : public MuonAlignmentInputMethod {
public:
MuonAlignmentInputSurveyDB();
MuonAlignmentInputSurveyDB(std::string dtLabel, std::string cscLabel, std::string idealLabel);
MuonAlignmentInputSurveyDB(const DTGeometry* dtGeometry,
const CSCGeometry* cscGeometry,
const GEMGeometry* gemGeometry,
const Alignments* dtSurvey,
const Alignments* cscSurvey,
const SurveyErrors* dtSurveyError,
const SurveyErrors* cscSurveyError);
~MuonAlignmentInputSurveyDB() override;

// ---------- const member functions ---------------------
Expand All @@ -40,7 +45,7 @@ class MuonAlignmentInputSurveyDB : public MuonAlignmentInputMethod {

// ---------- member functions ---------------------------

AlignableMuon* newAlignableMuon(const edm::EventSetup& iSetup) const override;
AlignableMuon* newAlignableMuon() const override;

MuonAlignmentInputSurveyDB(const MuonAlignmentInputSurveyDB&) = delete; // stop default

Expand All @@ -53,8 +58,13 @@ class MuonAlignmentInputSurveyDB : public MuonAlignmentInputMethod {
const SurveyErrors* theSurveyErrors) const;

// ---------- member data --------------------------------

std::string m_dtLabel, m_cscLabel, idealGeometryLabel;
const DTGeometry* dtGeometry_;
const CSCGeometry* cscGeometry_;
const GEMGeometry* gemGeometry_;
const Alignments* dtSurvey_;
const Alignments* cscSurvey_;
const SurveyErrors* dtSurveyError_;
const SurveyErrors* cscSurveyError_;
};

#endif
31 changes: 28 additions & 3 deletions Alignment/MuonAlignment/interface/MuonAlignmentInputXML.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@

class MuonAlignmentInputXML : public MuonAlignmentInputMethod {
public:
MuonAlignmentInputXML(const std::string &fileName, std::string idealLabel);
MuonAlignmentInputXML(const std::string &fileName,
const DTGeometry *dtGeometry,
const CSCGeometry *cscGeometry,
const GEMGeometry *gemGeometry,
const DTGeometry *dtGeometryIdeal,
const CSCGeometry *cscGeometryIdeal,
const GEMGeometry *gemGeometryIdeal);
~MuonAlignmentInputXML() override;

// ---------- const member functions ---------------------
Expand All @@ -41,7 +47,7 @@ class MuonAlignmentInputXML : public MuonAlignmentInputMethod {

// ---------- member functions ---------------------------

AlignableMuon *newAlignableMuon(const edm::EventSetup &iSetup) const override;
AlignableMuon *newAlignableMuon() const override;

MuonAlignmentInputXML(const MuonAlignmentInputXML &) = delete; // stop default

Expand All @@ -66,6 +72,10 @@ class MuonAlignmentInputXML : public MuonAlignmentInputMethod {
std::map<unsigned int, Alignable *> &alignableNavigator,
const XERCES_CPP_NAMESPACE::DOMElement *node,
const AlignableObjectId &) const;
Alignable *getGEMnode(align::StructureType structureType,
std::map<unsigned int, Alignable *> &alignableNavigator,
const XERCES_CPP_NAMESPACE::DOMElement *node,
const AlignableObjectId &) const;

double parseDouble(const XMLCh *str, const char *attribute) const;
void set_one_position(Alignable *ali, const align::PositionType &pos, const align::RotationType &rot) const;
Expand Down Expand Up @@ -96,7 +106,14 @@ class MuonAlignmentInputXML : public MuonAlignmentInputMethod {
std::map<Alignable *, Alignable *> &alitoideal) const;

// ---------- member data --------------------------------
std::string m_fileName, idealGeometryLabel;
std::string m_fileName;

const DTGeometry *dtGeometry_;
const CSCGeometry *cscGeometry_;
const GEMGeometry *gemGeometry_;
const DTGeometry *dtGeometryIdeal_;
const CSCGeometry *cscGeometryIdeal_;
const GEMGeometry *gemGeometryIdeal_;

XMLCh *str_operation;
XMLCh *str_collection;
Expand All @@ -112,6 +129,12 @@ class MuonAlignmentInputXML : public MuonAlignmentInputMethod {
XMLCh *str_CSCRing;
XMLCh *str_CSCChamber;
XMLCh *str_CSCLayer;
XMLCh *str_GEMEndcap;
XMLCh *str_GEMStation;
XMLCh *str_GEMRing;
XMLCh *str_GEMSuperChamber;
XMLCh *str_GEMChamber;
XMLCh *str_GEMEtaPartition;
XMLCh *str_setposition;
XMLCh *str_setape;
XMLCh *str_setsurveyerr;
Expand All @@ -130,6 +153,8 @@ class MuonAlignmentInputXML : public MuonAlignmentInputMethod {
XMLCh *str_endcap;
XMLCh *str_ring;
XMLCh *str_chamber;
XMLCh *str_superChamber;
XMLCh *str_etaPartition;
XMLCh *str_axisx;
XMLCh *str_axisy;
XMLCh *str_axisz;
Expand Down
21 changes: 16 additions & 5 deletions Alignment/MuonAlignment/interface/MuonAlignmentOutputXML.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,18 @@
// user include files
#include "Alignment/MuonAlignment/interface/AlignableMuon.h"
#include "CondFormats/Alignment/interface/AlignTransformErrorExtended.h"

#include "Geometry/DTGeometry/interface/DTGeometry.h"
#include "Geometry/CSCGeometry/interface/CSCGeometry.h"
#include "Geometry/GEMGeometry/interface/GEMGeometry.h"
// forward declarations
class AlignableObjectId;

class MuonAlignmentOutputXML {
public:
MuonAlignmentOutputXML(const edm::ParameterSet &iConfig);
MuonAlignmentOutputXML(const edm::ParameterSet &iConfig,
const DTGeometry *dtGeometry,
const CSCGeometry *cscGeometry,
const GEMGeometry *gemGeometry);
virtual ~MuonAlignmentOutputXML();

// ---------- const member functions ---------------------
Expand All @@ -43,18 +48,19 @@ class MuonAlignmentOutputXML {

// ---------- member functions ---------------------------

void write(AlignableMuon *alignableMuon, const edm::EventSetup &iSetup) const;
void write(AlignableMuon *alignableMuon) const;

MuonAlignmentOutputXML(const MuonAlignmentOutputXML &) = delete; // stop default

const MuonAlignmentOutputXML &operator=(const MuonAlignmentOutputXML &) = delete; // stop default

private:
enum { doDT, doCSC, doGEM };
void writeComponents(align::Alignables &alignables,
align::Alignables &ideals,
std::map<align::ID, CLHEP::HepSymMatrix> &errors,
std::ofstream &outputFile,
bool DT,
const int doDet,
const AlignableObjectId &) const;

// ---------- member data --------------------------------
Expand All @@ -65,7 +71,12 @@ class MuonAlignmentOutputXML {
bool m_suppressDTBarrel, m_suppressDTWheels, m_suppressDTStations, m_suppressDTChambers, m_suppressDTSuperLayers,
m_suppressDTLayers;
bool m_suppressCSCEndcaps, m_suppressCSCStations, m_suppressCSCRings, m_suppressCSCChambers, m_suppressCSCLayers;
std::string idealGeometryLabel;
bool m_suppressGEMEndcaps, m_suppressGEMStations, m_suppressGEMRings, m_suppressGEMSuperChambers,
m_suppressGEMChambers, m_suppressGEMEtaPartitions;

const DTGeometry *dtGeometry_;
const CSCGeometry *cscGeometry_;
const GEMGeometry *gemGeometry_;
};

#endif
40 changes: 35 additions & 5 deletions Alignment/MuonAlignment/plugins/MuonGeometryArrange.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,20 @@ MuonGeometryArrange::MuonGeometryArrange(const edm::ParameterSet& cfg)
firstEvent_(true),
idealInputLabel1("MuonGeometryArrangeLabel1"),
idealInputLabel2("MuonGeometryArrangeLabel2"),
idealInputLabel2a("MuonGeometryArrangeLabel2a") {
idealInputLabel2a("MuonGeometryArrangeLabel2a"),
geomIdeal("MuonGeometryArrangeGeomIdeal"),
dtGeomToken1_(esConsumes(edm::ESInputTag("", idealInputLabel1))),
cscGeomToken1_(esConsumes(edm::ESInputTag("", idealInputLabel1))),
gemGeomToken1_(esConsumes(edm::ESInputTag("", idealInputLabel1))),
dtGeomToken2_(esConsumes(edm::ESInputTag("", idealInputLabel2))),
cscGeomToken2_(esConsumes(edm::ESInputTag("", idealInputLabel2))),
gemGeomToken2_(esConsumes(edm::ESInputTag("", idealInputLabel2))),
dtGeomToken3_(esConsumes(edm::ESInputTag("", idealInputLabel2a))),
cscGeomToken3_(esConsumes(edm::ESInputTag("", idealInputLabel2a))),
gemGeomToken3_(esConsumes(edm::ESInputTag("", idealInputLabel2a))),
dtGeomIdealToken_(esConsumes(edm::ESInputTag("", geomIdeal))),
cscGeomIdealToken_(esConsumes(edm::ESInputTag("", geomIdeal))),
gemGeomIdealToken_(esConsumes(edm::ESInputTag("", geomIdeal))) {
referenceMuon = nullptr;
currentMuon = nullptr;
// Input is XML
Expand Down Expand Up @@ -622,14 +635,31 @@ void MuonGeometryArrange::createROOTGeometry(const edm::EventSetup& iSetup) {}
//////////////////////////////////////////////////
void MuonGeometryArrange::analyze(const edm::Event&, const edm::EventSetup& iSetup) {
if (firstEvent_) {
// My stuff
MuonAlignmentInputXML inputMethod1(_inputXMLCurrent, idealInputLabel1);
MuonAlignmentInputXML inputMethod1(_inputXMLCurrent,
&iSetup.getData(dtGeomToken1_),
&iSetup.getData(cscGeomToken1_),
&iSetup.getData(gemGeomToken1_),
&iSetup.getData(dtGeomToken1_),
&iSetup.getData(cscGeomToken1_),
&iSetup.getData(gemGeomToken1_));
inputAlign1 = new MuonAlignment(iSetup, inputMethod1);
inputAlign1->fillGapsInSurvey(0, 0);
MuonAlignmentInputXML inputMethod2(_inputXMLReference, idealInputLabel2);
MuonAlignmentInputXML inputMethod2(_inputXMLReference,
&iSetup.getData(dtGeomToken2_),
&iSetup.getData(cscGeomToken2_),
&iSetup.getData(gemGeomToken2_),
&iSetup.getData(dtGeomToken1_),
&iSetup.getData(cscGeomToken1_),
&iSetup.getData(gemGeomToken1_));
inputAlign2 = new MuonAlignment(iSetup, inputMethod2);
inputAlign2->fillGapsInSurvey(0, 0);
MuonAlignmentInputXML inputMethod2a(_inputXMLReference, idealInputLabel2a);
MuonAlignmentInputXML inputMethod2a(_inputXMLReference,
&iSetup.getData(dtGeomToken3_),
&iSetup.getData(cscGeomToken3_),
&iSetup.getData(gemGeomToken3_),
&iSetup.getData(dtGeomToken1_),
&iSetup.getData(cscGeomToken1_),
&iSetup.getData(gemGeomToken1_));
inputAlign2a = new MuonAlignment(iSetup, inputMethod2a);
inputAlign2a->fillGapsInSurvey(0, 0);

Expand Down
Loading