Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GEM to muon alignment module #31634

Merged
merged 4 commits into from
Mar 25, 2021
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
5 changes: 3 additions & 2 deletions Alignment/CommonAlignment/interface/AlignableObjectId.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class TrackerGeometry;
class DTGeometry;
class CSCGeometry;
class GEMGeometry;

/// Allows conversion between type and name, and vice-versa
class AlignableObjectId {
Expand All @@ -15,7 +16,7 @@ class AlignableObjectId {
enum class Geometry { RunI, PhaseI, PhaseII, General, Unspecified };

AlignableObjectId(Geometry);
AlignableObjectId(const TrackerGeometry*, const DTGeometry*, const CSCGeometry*);
AlignableObjectId(const TrackerGeometry*, const DTGeometry*, const CSCGeometry*, const GEMGeometry*);
AlignableObjectId(const AlignableObjectId&) = default;
AlignableObjectId& operator=(const AlignableObjectId&) = default;
AlignableObjectId(AlignableObjectId&&) = default;
Expand Down Expand Up @@ -43,7 +44,7 @@ class AlignableObjectId {

private:
static Geometry trackerGeometry(const TrackerGeometry*);
static Geometry muonGeometry(const DTGeometry*, const CSCGeometry*);
static Geometry muonGeometry(const DTGeometry*, const CSCGeometry*, const GEMGeometry*);

const entry* entries_{nullptr};
Geometry geometry_{Geometry::Unspecified};
Expand Down
6 changes: 6 additions & 0 deletions Alignment/CommonAlignment/interface/StructureType.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ namespace align {
AlignableCSCRing,
AlignableCSCChamber,
AlignableCSCLayer, // = 110
AlignableGEMEndcap,
AlignableGEMStation,
AlignableGEMRing,
AlignableGEMSuperChamber,
AlignableGEMChamber,
AlignableGEMEtaPartition,
AlignableMuon,

Detector, // = 112 (what for?)
Expand Down
2 changes: 1 addition & 1 deletion Alignment/CommonAlignment/src/AlignableCompositeBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ AlignableCompositeBuilder ::AlignableCompositeBuilder(const TrackerTopology* tra
const TrackerGeometry* trackerGeometry,
const AlignableIndexer& alignableIndexer)
: trackerTopology_(trackerTopology),
alignableObjectId_(trackerGeometry, nullptr, nullptr),
alignableObjectId_(trackerGeometry, nullptr, nullptr, nullptr),
alignableIndexer_(alignableIndexer) {}

//_____________________________________________________________________________
Expand Down
21 changes: 18 additions & 3 deletions Alignment/CommonAlignment/src/AlignableObjectId.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ namespace {
{align::AlignableCSCRing, "CSCRing"},
{align::AlignableCSCChamber, "CSCChamber"},
{align::AlignableCSCLayer, "CSCLayer"},
{align::AlignableGEMEndcap, "GEMEndcap"},
{align::AlignableGEMStation, "GEMStation"},
{align::AlignableGEMRing, "GEMRing"},
{align::AlignableGEMSuperChamber, "GEMSuperChamber"},
{align::AlignableGEMChamber, "GEMChamber"},
{align::AlignableGEMEtaPartition, "GEMEtaPartition"},
{align::AlignableMuon, "Muon"},

{align::BeamSpot, "BeamSpot"},
Expand Down Expand Up @@ -201,6 +207,12 @@ namespace {
{align::AlignableCSCRing, "CSCRing"},
{align::AlignableCSCChamber, "CSCChamber"},
{align::AlignableCSCLayer, "CSCLayer"},
{align::AlignableGEMEndcap, "GEMEndcap"},
{align::AlignableGEMStation, "GEMStation"},
{align::AlignableGEMRing, "GEMRing"},
{align::AlignableGEMSuperChamber, "GEMSuperChamber"},
{align::AlignableGEMChamber, "GEMChamber"},
{align::AlignableGEMEtaPartition, "GEMEtaPartition"},
{align::AlignableMuon, "Muon"},

{align::BeamSpot, "BeamSpot"},
Expand Down Expand Up @@ -246,8 +258,9 @@ AlignableObjectId ::AlignableObjectId(AlignableObjectId::Geometry geometry) : ge
//_____________________________________________________________________________
AlignableObjectId ::AlignableObjectId(const TrackerGeometry *tracker,
const DTGeometry *muonDt,
const CSCGeometry *muonCsc)
: AlignableObjectId(commonGeometry(trackerGeometry(tracker), muonGeometry(muonDt, muonCsc))) {}
const CSCGeometry *muonCsc,
const GEMGeometry *muonGem)
: AlignableObjectId(commonGeometry(trackerGeometry(tracker), muonGeometry(muonDt, muonCsc, muonGem))) {}

//_____________________________________________________________________________
align::StructureType AlignableObjectId::nameToType(const std::string &name) const { return stringToId(name.c_str()); }
Expand Down Expand Up @@ -299,7 +312,9 @@ AlignableObjectId::Geometry AlignableObjectId ::trackerGeometry(const TrackerGeo
}
}

AlignableObjectId::Geometry AlignableObjectId ::muonGeometry(const DTGeometry *, const CSCGeometry *) {
AlignableObjectId::Geometry AlignableObjectId ::muonGeometry(const DTGeometry *,
const CSCGeometry *,
const GEMGeometry *) {
// muon alignment structure types are identical for all kinds of geometries
return Geometry::General;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeomBuilderFromGeometricDet.h"
#include "Geometry/DTGeometry/interface/DTGeometry.h"
#include "Geometry/CSCGeometry/interface/CSCGeometry.h"
#include "Geometry/GEMGeometry/interface/GEMGeometry.h"
#include "Geometry/Records/interface/TrackerTopologyRcd.h"
#include "Geometry/CommonTopologies/interface/GeometryAligner.h"
#include "CondFormats/GeometryObjects/interface/PTrackerParameters.h"
Expand All @@ -50,6 +51,8 @@
#include "CondFormats/AlignmentRecord/interface/DTAlignmentErrorExtendedRcd.h"
#include "CondFormats/AlignmentRecord/interface/CSCAlignmentRcd.h"
#include "CondFormats/AlignmentRecord/interface/CSCAlignmentErrorExtendedRcd.h"
#include "CondFormats/AlignmentRecord/interface/GEMAlignmentRcd.h"
#include "CondFormats/AlignmentRecord/interface/GEMAlignmentErrorExtendedRcd.h"
#include "CondFormats/AlignmentRecord/interface/GlobalPositionRcd.h"
#include "CondFormats/Alignment/interface/DetectorGlobalPosition.h"

Expand Down Expand Up @@ -81,7 +84,16 @@ class AlignmentMonitorAsAnalyzer : public edm::EDAnalyzer {
std::unique_ptr<AlignmentParameterStore> m_alignmentParameterStore;

std::vector<std::unique_ptr<AlignmentMonitorBase>> m_monitors;
std::string idealGeometryLabel;
edm::ESGetToken<DTGeometry, MuonGeometryRecord> esTokenDT_;
edm::ESGetToken<CSCGeometry, MuonGeometryRecord> esTokenCSC_;
edm::ESGetToken<GEMGeometry, MuonGeometryRecord> esTokenGEM_;
edm::ESGetToken<Alignments, GlobalPositionRcd> esTokenGPR_;
edm::ESGetToken<Alignments, DTAlignmentRcd> esTokenDTAl_;
edm::ESGetToken<AlignmentErrorsExtended, DTAlignmentErrorExtendedRcd> esTokenDTAPE_;
edm::ESGetToken<Alignments, CSCAlignmentRcd> esTokenCSCAl_;
edm::ESGetToken<AlignmentErrorsExtended, CSCAlignmentErrorExtendedRcd> esTokenCSCAPE_;
edm::ESGetToken<Alignments, GEMAlignmentRcd> esTokenGEMAl_;
edm::ESGetToken<AlignmentErrorsExtended, GEMAlignmentErrorExtendedRcd> esTokenGEMAPE_;
bool m_firstEvent;
};

Expand All @@ -99,7 +111,9 @@ class AlignmentMonitorAsAnalyzer : public edm::EDAnalyzer {
AlignmentMonitorAsAnalyzer::AlignmentMonitorAsAnalyzer(const edm::ParameterSet& iConfig)
: m_tjTag(iConfig.getParameter<edm::InputTag>("tjTkAssociationMapTag")),
m_aliParamStoreCfg(iConfig.getParameter<edm::ParameterSet>("ParameterStore")),
idealGeometryLabel("idealForAlignmentMonitorAsAnalyzer") {
esTokenDT_(esConsumes(edm::ESInputTag("", "idealForAlignmentMonitorAsAnalyzer"))),
esTokenCSC_(esConsumes(edm::ESInputTag("", "idealForAlignmentMonitorAsAnalyzer"))),
esTokenGEM_(esConsumes(edm::ESInputTag("", "idealForAlignmentMonitorAsAnalyzer"))) {
std::vector<std::string> monitors = iConfig.getUntrackedParameter<std::vector<std::string>>("monitors");

for (auto const& mon : monitors) {
Expand Down Expand Up @@ -129,13 +143,11 @@ void AlignmentMonitorAsAnalyzer::analyze(const edm::Event& iEvent, const edm::Ev
TrackerGeomBuilderFromGeometricDet trackerBuilder;
std::shared_ptr<TrackerGeometry> theTracker(trackerBuilder.build(&(*theGeometricDet), *ptp, tTopo));

edm::ESHandle<DTGeometry> theMuonDT;
edm::ESHandle<CSCGeometry> theMuonCSC;
iSetup.get<MuonGeometryRecord>().get(idealGeometryLabel, theMuonDT);
iSetup.get<MuonGeometryRecord>().get(idealGeometryLabel, theMuonCSC);
edm::ESHandle<DTGeometry> theMuonDT = iSetup.getHandle(esTokenDT_);
edm::ESHandle<CSCGeometry> theMuonCSC = iSetup.getHandle(esTokenCSC_);
edm::ESHandle<GEMGeometry> theMuonGEM = iSetup.getHandle(esTokenGEM_);

edm::ESHandle<Alignments> globalPositionRcd;
iSetup.get<GlobalPositionRcd>().get(globalPositionRcd);
edm::ESHandle<Alignments> globalPositionRcd = iSetup.getHandle(esTokenGPR_);

edm::ESHandle<Alignments> alignments;
iSetup.get<TrackerAlignmentRcd>().get(alignments);
Expand All @@ -146,29 +158,33 @@ void AlignmentMonitorAsAnalyzer::analyze(const edm::Event& iEvent, const edm::Ev
&(*alignmentErrors),
align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Tracker)));

edm::ESHandle<Alignments> dtAlignments;
iSetup.get<DTAlignmentRcd>().get(dtAlignments);
edm::ESHandle<AlignmentErrorsExtended> dtAlignmentErrorsExtended;
iSetup.get<DTAlignmentErrorExtendedRcd>().get(dtAlignmentErrorsExtended);
edm::ESHandle<Alignments> dtAlignments = iSetup.getHandle(esTokenDTAl_);
;
edm::ESHandle<AlignmentErrorsExtended> dtAlignmentErrorsExtended = iSetup.getHandle(esTokenDTAPE_);
aligner.applyAlignments<DTGeometry>(&(*theMuonDT),
&(*dtAlignments),
&(*dtAlignmentErrorsExtended),
align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)));

edm::ESHandle<Alignments> cscAlignments;
iSetup.get<CSCAlignmentRcd>().get(cscAlignments);
edm::ESHandle<AlignmentErrorsExtended> cscAlignmentErrorsExtended;
iSetup.get<CSCAlignmentErrorExtendedRcd>().get(cscAlignmentErrorsExtended);
edm::ESHandle<Alignments> cscAlignments = iSetup.getHandle(esTokenCSCAl_);
edm::ESHandle<AlignmentErrorsExtended> cscAlignmentErrorsExtended = iSetup.getHandle(esTokenCSCAPE_);
aligner.applyAlignments<CSCGeometry>(&(*theMuonCSC),
&(*cscAlignments),
&(*cscAlignmentErrorsExtended),
align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)));

edm::ESHandle<Alignments> gemAlignments = iSetup.getHandle(esTokenGEMAl_);
edm::ESHandle<AlignmentErrorsExtended> gemAlignmentErrorsExtended = iSetup.getHandle(esTokenGEMAPE_);
aligner.applyAlignments<GEMGeometry>(&(*theMuonGEM),
&(*gemAlignments),
&(*gemAlignmentErrorsExtended),
align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)));

// within an analyzer, modules can't expect to see any selected alignables!
align::Alignables empty_alignables;

m_alignableTracker = std::make_unique<AlignableTracker>(&(*theTracker), tTopo);
m_alignableMuon = std::make_unique<AlignableMuon>(&(*theMuonDT), &(*theMuonCSC));
m_alignableMuon = std::make_unique<AlignableMuon>(&(*theMuonDT), &(*theMuonCSC), &(*theMuonGEM));
m_alignmentParameterStore = std::make_unique<AlignmentParameterStore>(empty_alignables, m_aliParamStoreCfg);

for (auto const& monitor : m_monitors) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@

#include "Geometry/DTGeometry/interface/DTGeometry.h"
#include "Geometry/CSCGeometry/interface/CSCGeometry.h"
#include "Geometry/GEMGeometry/interface/GEMGeometry.h"
#include "Geometry/CommonTopologies/interface/GeometryAligner.h"
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
#include "Geometry/Records/interface/IdealGeometryRecord.h"
Expand Down Expand Up @@ -114,6 +115,7 @@ class AlignmentProducerBase {
std::shared_ptr<TrackerGeometry> trackerGeometry_;
edm::ESHandle<DTGeometry> muonDTGeometry_;
edm::ESHandle<CSCGeometry> muonCSCGeometry_;
edm::ESHandle<GEMGeometry> muonGEMGeometry_;
const bool doTracker_, doMuon_, useExtras_;

/// Map with tracks/trajectories
Expand Down
11 changes: 9 additions & 2 deletions Alignment/CommonAlignmentProducer/src/AlignmentProducerBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ void AlignmentProducerBase::createGeometries(const edm::EventSetup& iSetup, cons
if (doMuon_) {
iSetup.get<MuonGeometryRecord>().get(idealGeometryLabel, muonDTGeometry_);
iSetup.get<MuonGeometryRecord>().get(idealGeometryLabel, muonCSCGeometry_);
iSetup.get<MuonGeometryRecord>().get(idealGeometryLabel, muonGEMGeometry_);
}
}

Expand Down Expand Up @@ -452,6 +453,9 @@ void AlignmentProducerBase::applyAlignmentsToDB(const edm::EventSetup& setup) {

applyDB<CSCGeometry, CSCAlignmentRcd, CSCAlignmentErrorExtendedRcd>(
&*muonCSCGeometry_, setup, align::DetectorGlobalPosition(*globalPositions_, DetId(DetId::Muon)));

applyDB<GEMGeometry, GEMAlignmentRcd, GEMAlignmentErrorExtendedRcd>(
&*muonGEMGeometry_, setup, align::DetectorGlobalPosition(*globalPositions_, DetId(DetId::Muon)));
}
}
}
Expand All @@ -468,9 +472,9 @@ void AlignmentProducerBase::createAlignables(const TrackerTopology* tTopo, bool

if (doMuon_) {
if (update) {
alignableMuon_->update(&*muonDTGeometry_, &*muonCSCGeometry_);
alignableMuon_->update(&*muonDTGeometry_, &*muonCSCGeometry_, &*muonGEMGeometry_);
} else {
alignableMuon_ = std::make_unique<AlignableMuon>(&*muonDTGeometry_, &*muonCSCGeometry_);
alignableMuon_ = std::make_unique<AlignableMuon>(&*muonDTGeometry_, &*muonCSCGeometry_, &*muonGEMGeometry_);
}
}

Expand Down Expand Up @@ -646,12 +650,15 @@ void AlignmentProducerBase::applyAlignmentsToGeometry() {

std::unique_ptr<Alignments> dtAlignments{alignableMuon_->dtAlignments()};
std::unique_ptr<Alignments> cscAlignments{alignableMuon_->cscAlignments()};
std::unique_ptr<Alignments> gemAlignments{alignableMuon_->gemAlignments()};

std::unique_ptr<AlignmentErrorsExtended> dtAlignmentErrExt{alignableMuon_->dtAlignmentErrorsExtended()};
std::unique_ptr<AlignmentErrorsExtended> cscAlignmentErrExt{alignableMuon_->cscAlignmentErrorsExtended()};
std::unique_ptr<AlignmentErrorsExtended> gemAlignmentErrExt{alignableMuon_->gemAlignmentErrorsExtended()};

aligner.applyAlignments(&*muonDTGeometry_, dtAlignments.get(), dtAlignmentErrExt.get(), AlignTransform());
aligner.applyAlignments(&*muonCSCGeometry_, cscAlignments.get(), cscAlignmentErrExt.get(), AlignTransform());
aligner.applyAlignments(&*muonGEMGeometry_, gemAlignments.get(), gemAlignmentErrExt.get(), AlignTransform());
}
}

Expand Down
1 change: 1 addition & 0 deletions Alignment/MuonAlignment/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<use name="DataFormats/GeometryCommonDetAlgo"/>
<use name="Geometry/DTGeometry"/>
<use name="Geometry/CSCGeometry"/>
<use name="Geometry/GEMGeometry"/>
<use name="Geometry/CommonTopologies"/>
<use name="Geometry/Records"/>
<use name="FWCore/Framework"/>
Expand Down
27 changes: 27 additions & 0 deletions Alignment/MuonAlignment/interface/AlignableGEMChamber.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef Alignment_MuonAlignment_AlignableGEMChamber_H
#define Alignment_MuonAlignment_AlignableGEMChamber_H

/* \class AlignableGEMChamber
* \author Hyunyong Kim - TAMU
*/

#include <iosfwd>
#include <iostream>
#include <vector>

#include "Alignment/CommonAlignment/interface/StructureType.h"
#include "Alignment/CommonAlignment/interface/AlignableDet.h"

#include "Geometry/CommonDetUnit/interface/GeomDet.h"
#include "Alignment/CommonAlignment/interface/AlignableComposite.h"

class AlignableGEMChamber : public AlignableDet {
public:
friend std::ostream& operator<<(std::ostream&, const AlignableGEMChamber&);

AlignableGEMChamber(const GeomDet* geomDet);

void update(const GeomDet* geomDet);
};

#endif
42 changes: 42 additions & 0 deletions Alignment/MuonAlignment/interface/AlignableGEMEndcap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#ifndef Alignment_MuonAlignment_AlignableGEMEndcap_H
#define Alignment_MuonAlignment_AlignableGEMEndcap_H

/* \class AlignableGEMEndcap
* \author Hyunyong Kim - TAMU
*/

#include "Alignment/CommonAlignment/interface/Utilities.h"
#include "Alignment/CommonAlignment/interface/AlignableComposite.h"
#include "Alignment/CommonAlignment/interface/AlignableSurface.h"

#include "Alignment/MuonAlignment/interface/AlignableGEMStation.h"

#include <vector>

class GeomDet;

class AlignableGEMEndcap : public AlignableComposite {
public:
AlignableGEMEndcap(const std::vector<AlignableGEMStation*>& GEMStations);

PositionType computePosition();

RotationType computeOrientation();

AlignableSurface computeSurface();

AlignableGEMStation& station(int i);

friend std::ostream& operator<<(std::ostream&, const AlignableGEMEndcap&);

void dump(void) const override;

Alignments* alignments() const override;

AlignmentErrorsExtended* alignmentErrors() const override;

private:
std::vector<AlignableGEMStation*> theGEMStations;
};

#endif
36 changes: 36 additions & 0 deletions Alignment/MuonAlignment/interface/AlignableGEMRing.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#ifndef Alignment_MuonAlignment_AlignableGEMRing_H
#define Alignment_MuonAlignment_AlignableGEMRing_H

/* \class AlignableGEMRing
* \author Hyunyong Kim - TAMU
*/

#include "Alignment/CommonAlignment/interface/Utilities.h"
#include "Alignment/CommonAlignment/interface/AlignableComposite.h"
#include "Alignment/CommonAlignment/interface/AlignableSurface.h"
#include "Alignment/MuonAlignment/interface/AlignableGEMSuperChamber.h"
#include <vector>

class GeomDet;

class AlignableGEMRing : public AlignableComposite {
public:
AlignableGEMRing(const std::vector<AlignableGEMSuperChamber*>& GEMSuperChambers);

PositionType computePosition();

RotationType computeOrientation();

AlignableSurface computeSurface();

AlignableGEMSuperChamber& superChamber(int i);

friend std::ostream& operator<<(std::ostream&, const AlignableGEMRing&);

void dump(void) const override;

private:
std::vector<AlignableGEMSuperChamber*> theGEMSuperChambers;
};

#endif
Loading