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

Migrate to esConsumes AlignmentProducerAsAnalyzer and MuonMillepedeTrackRefitter modules #34542

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -248,7 +248,6 @@ class AlignmentProducerBase {
const bool saveToDB_, saveApeToDB_, saveDeformationsToDB_;
const bool useSurvey_;
const bool enableAlignableUpdates_;
std::string idealGeometryLabel;

/*** ESTokens ***/
const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> ttopoToken_;
Expand Down
Expand Up @@ -76,28 +76,12 @@
# update alignables if triggered by corresponding input IOV boundary
enableAlignableUpdates = cms.bool(False),
)
DTGeometryAlignmentProducerAsAnalyzer = cms.ESProducer("DTGeometryESModule",
appendToDataLabel = cms.string('idealForAlignmentProducerBase'),
applyAlignment = cms.bool(False),
alignmentsLabel = cms.string(''),
fromDDD = cms.bool(True)
)
CSCGeometryAlignmentProducerAsAnalyzer = cms.ESProducer("CSCGeometryESModule",
appendToDataLabel = cms.string('idealForAlignmentProducerBase'),
debugV = cms.untracked.bool(False),
useGangedStripsInME1a = cms.bool(False),
alignmentsLabel = cms.string(''),
useOnlyWiresInME1a = cms.bool(False),
useRealWireGeometry = cms.bool(True),
useCentreTIOffsets = cms.bool(False),
applyAlignment = cms.bool(False),
fromDDD = cms.bool(True),
fromDD4hep = cms.bool(False)
)
GEMGeometryAlignmentProducerAsAnalyzer = cms.ESProducer("GEMGeometryESModule",
appendToDataLabel = cms.string('idealForAlignmentProducerBase'),
applyAlignment = cms.bool(False),
alignmentsLabel = cms.string(''),
fromDDD = cms.bool(True),
fromDD4Hep = cms.bool(False)
)
import Geometry.DTGeometryBuilder.dtGeometryDB_cfi
DTGeometryAlignmentProducerAsAnalyzer = Geometry.DTGeometryBuilder.dtGeometryDB_cfi.DTGeometryESModule.clone()
DTGeometryAlignmentProducerAsAnalyzer.appendToDataLabel = 'idealForAlignmentProducerBase'
import Geometry.CSCGeometryBuilder.cscGeometryDB_cfi
CSCGeometryAlignmentProducerAsAnalyzer = Geometry.CSCGeometryBuilder.cscGeometryDB_cfi.CSCGeometryESModule.clone()
CSCGeometryAlignmentProducerAsAnalyzer.appendToDataLabel = 'idealForAlignmentProducerBase'
import Geometry.GEMGeometryBuilder.gemGeometryDB_cfi
GEMGeometryAlignmentProducerAsAnalyzer = Geometry.GEMGeometryBuilder.gemGeometryDB_cfi.GEMGeometryESModule.clone()
GEMGeometryAlignmentProducerAsAnalyzer.appendToDataLabel = 'idealForAlignmentProducerBase'
16 changes: 6 additions & 10 deletions Alignment/CommonAlignmentProducer/src/AlignmentProducerBase.cc
Expand Up @@ -47,13 +47,12 @@ AlignmentProducerBase::AlignmentProducerBase(const edm::ParameterSet& config, ed
saveDeformationsToDB_{config.getParameter<bool>("saveDeformationsToDB")},
useSurvey_{config.getParameter<bool>("useSurvey")},
enableAlignableUpdates_{config.getParameter<bool>("enableAlignableUpdates")},
idealGeometryLabel("idealForAlignmentProducerBase"),
ttopoToken_(iC.esConsumes<edm::Transition::BeginRun>()),
geomDetToken_(iC.esConsumes<edm::Transition::BeginRun>()),
ptpToken_(iC.esConsumes<edm::Transition::BeginRun>()),
//dtGeomToken_(iC.esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", "idealForAlignmentProducerBase"))),
//cscGeomToken_(iC.esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", "idealForAlignmentProducerBase"))),
//gemGeomToken_(iC.esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", "idealForAlignmentProducerBase"))),
dtGeomToken_(iC.esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", "idealForAlignmentProducerBase"))),
cscGeomToken_(iC.esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", "idealForAlignmentProducerBase"))),
gemGeomToken_(iC.esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", "idealForAlignmentProducerBase"))),
tkAliToken_(iC.esConsumes<edm::Transition::BeginRun>()),
dtAliToken_(iC.esConsumes<edm::Transition::BeginRun>()),
cscAliToken_(iC.esConsumes<edm::Transition::BeginRun>()),
Expand Down Expand Up @@ -436,12 +435,9 @@ 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_);
//muonDTGeometry_ = iSetup.getHandle(dtGeomToken_);
//muonCSCGeometry_ = iSetup.getHandle(cscGeomToken_);
//muonGEMGeometry_ = iSetup.getHandle(gemGeomToken_);
muonDTGeometry_ = iSetup.getHandle(dtGeomToken_);
muonCSCGeometry_ = iSetup.getHandle(cscGeomToken_);
muonGEMGeometry_ = iSetup.getHandle(gemGeomToken_);
}
}

Expand Down
Expand Up @@ -16,10 +16,6 @@
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/ESHandle.h"

#include "MagneticField/Engine/interface/MagneticField.h"
#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
#include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h"
#include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
#include "Geometry/CommonDetUnit/interface/GeomDet.h"

#include "TrackingTools/TransientTrack/interface/TransientTrack.h"
Expand Down Expand Up @@ -49,8 +45,7 @@

/// Constructor
MuonMillepedeTrackRefitter::MuonMillepedeTrackRefitter(const edm::ParameterSet& pset) {
SACollectionTag = pset.getParameter<edm::InputTag>("SATrackCollectionTag");

tracksSAToken_ = consumes<reco::TrackCollection>(pset.getParameter<edm::InputTag>("SATrackCollectionTag"));
//Products
produces<std::vector<Trajectory>>();
produces<TrajTrackAssociationCollection>();
Expand All @@ -63,13 +58,11 @@ void MuonMillepedeTrackRefitter::produce(edm::Event& event, const edm::EventSetu
//Get collections from the event

edm::Handle<reco::TrackCollection> tracksSA;
event.getByLabel(SACollectionTag, tracksSA);
event.getByToken(tracksSAToken_, tracksSA);

edm::ESHandle<MagneticField> theMGField;
eventSetup.get<IdealMagneticFieldRecord>().get(theMGField);
theMGField = eventSetup.getHandle(theMGFieldToken_);

edm::ESHandle<GlobalTrackingGeometry> theTrackingGeometry;
eventSetup.get<GlobalTrackingGeometryRecord>().get(theTrackingGeometry);
theTrackingGeometry = eventSetup.getHandle(theTrackingGeometryToken_);

edm::RefProd<std::vector<Trajectory>> trajectoryCollectionRefProd = event.getRefBeforePut<std::vector<Trajectory>>();

Expand Down
Expand Up @@ -13,9 +13,15 @@
#define Alignment_MuonMillepedeTrackRefitter_MuonMillepedeTrackRefitter_H

// Base Class Headers
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please confirm if the private test is done with multicore, and you still get the memory in control, i.e. this module can run on multiple streams.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hyunyong ping?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried to validate and run on multiple streams but we never use this module recently and the cosmic dataset is not working with this module.
I think we can clean up the millipede method in the muon alignment modules.
However, is it fine?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hyunyong I'm not sure I understand "we can clean up the millipede method in the muon alignment modules.", can you please clarify?
Also "the cosmic dataset is not working with this module", couldn't you just use some older data for the tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tvami We don't have a plan to use this millipede method anymore. So, I think we can remove the module but I don't know the CMSSW policy.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srimanob , @mmusich what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the class is not used it can just be deleted

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Then @hyunyong please go ahead with the removal

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tvami Yes, I've removed it.

#include "FWCore/Framework/interface/Event.h"

#include "MagneticField/Engine/interface/MagneticField.h"
#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"

#include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h"
#include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"

#include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentAlgorithmBase.h"

#include <string>
Expand All @@ -34,7 +40,7 @@ namespace edm {
typedef std::vector<std::vector<int> > intDVector;
typedef std::vector<TrackingRecHit*> RecHitVector;

class MuonMillepedeTrackRefitter : public edm::EDProducer {
class MuonMillepedeTrackRefitter : public edm::stream::EDProducer<> {
public:
typedef AlignmentAlgorithmBase::ConstTrajTrackPair ConstTrajTrackPair;
typedef AlignmentAlgorithmBase::ConstTrajTrackPairCollection ConstTrajTrackPairCollection;
Expand All @@ -51,6 +57,11 @@ class MuonMillepedeTrackRefitter : public edm::EDProducer {

protected:
private:
edm::InputTag SACollectionTag;
edm::ESHandle<MagneticField> theMGField;
edm::ESHandle<GlobalTrackingGeometry> theTrackingGeometry;

edm::EDGetToken tracksSAToken_;
edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> theMGFieldToken_;
edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> theTrackingGeometryToken_;
};
#endif
1 change: 1 addition & 0 deletions Geometry/GEMGeometryBuilder/python/gemGeometryDB_cfi.py
Expand Up @@ -6,6 +6,7 @@
GEMGeometryESModule = cms.ESProducer("GEMGeometryESModule",
fromDDD = cms.bool(False),
fromDD4Hep = cms.bool(False),
appendToDataLabel = cms.string(''),
alignmentsLabel = cms.string(''),
applyAlignment = cms.bool(False)
)