CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
AlignmentMonitorAsAnalyzer Class Reference

#include <Dummy/AlignmentMonitorAsAnalyzer/src/AlignmentMonitorAsAnalyzer.cc>

Inheritance diagram for AlignmentMonitorAsAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Types

typedef std::pair< const Trajectory *, const reco::Track * > ConstTrajTrackPair
 
typedef std::vector< ConstTrajTrackPairConstTrajTrackPairCollection
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 AlignmentMonitorAsAnalyzer (const edm::ParameterSet &)
 
 ~AlignmentMonitorAsAnalyzer () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 

Private Attributes

AlignableMuonm_alignableMuon
 
AlignableTrackerm_alignableTracker
 
AlignmentParameterStorem_alignmentParameterStore
 
edm::ParameterSet m_aliParamStoreCfg
 
bool m_firstEvent
 
std::vector< AlignmentMonitorBase * > m_monitors
 
edm::InputTag m_tjTag
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 66 of file AlignmentMonitorAsAnalyzer.cc.

Member Typedef Documentation

Definition at line 71 of file AlignmentMonitorAsAnalyzer.cc.

Definition at line 72 of file AlignmentMonitorAsAnalyzer.cc.

Constructor & Destructor Documentation

AlignmentMonitorAsAnalyzer::AlignmentMonitorAsAnalyzer ( const edm::ParameterSet iConfig)
explicit

Definition at line 103 of file AlignmentMonitorAsAnalyzer.cc.

References Exception, reco::get(), edm::ParameterSet::getUntrackedParameter(), m_monitors, and gather_cfg::monitors.

104  : m_tjTag(iConfig.getParameter<edm::InputTag>("tjTkAssociationMapTag"))
105  , m_aliParamStoreCfg(iConfig.getParameter<edm::ParameterSet>("ParameterStore"))
106  , m_alignableTracker(nullptr)
107  , m_alignableMuon(nullptr)
108  , m_alignmentParameterStore(nullptr)
109 {
110  std::vector<std::string> monitors = iConfig.getUntrackedParameter<std::vector<std::string> >( "monitors" );
111 
112  for (std::vector<std::string>::const_iterator miter = monitors.begin(); miter != monitors.end(); ++miter) {
114 
115  if (!newMonitor) throw cms::Exception("BadConfig") << "Couldn't find monitor named " << *miter;
116 
117  m_monitors.push_back(newMonitor);
118  }
119 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< AlignmentMonitorBase * > m_monitors
AlignmentParameterStore * m_alignmentParameterStore
T get(const Candidate &c)
Definition: component.h:55
AlignmentMonitorAsAnalyzer::~AlignmentMonitorAsAnalyzer ( )
override

Definition at line 122 of file AlignmentMonitorAsAnalyzer.cc.

References m_alignableMuon, m_alignableTracker, and m_alignmentParameterStore.

123 {
124  delete m_alignableTracker;
125  delete m_alignableMuon;
127 }
AlignmentParameterStore * m_alignmentParameterStore

Member Function Documentation

void AlignmentMonitorAsAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 136 of file AlignmentMonitorAsAnalyzer.cc.

References align::AlignableMuon, AlignmentParameterStore_cfi::AlignmentParameterStore, GeometryAligner::applyAlignments(), edm::AssociationMap< Tag >::begin(), TrackerGeomBuilderFromGeometricDet::build(), CSCGeometryBuilderFromDDD::build(), DTGeometryBuilderFromDDD::build(), edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, align::DetectorGlobalPosition(), edm::AssociationMap< Tag >::end(), edm::EventSetup::get(), edm::Event::getByLabel(), m_alignableMuon, m_alignableTracker, m_alignmentParameterStore, m_aliParamStoreCfg, m_firstEvent, m_monitors, m_tjTag, DetId::Muon, edm::ESHandle< T >::product(), and DetId::Tracker.

137 {
138  //Retrieve tracker topology from geometry
139  edm::ESHandle<TrackerTopology> tTopoHandle;
140  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
141  const TrackerTopology* const tTopo = tTopoHandle.product();
142 
143  if (m_firstEvent) {
144  GeometryAligner aligner;
145 
147  iSetup.get<IdealGeometryRecord>().get( cpv );
148 
149  edm::ESHandle<GeometricDet> theGeometricDet;
150  iSetup.get<IdealGeometryRecord>().get( theGeometricDet );
152  iSetup.get<PTrackerParametersRcd>().get( ptp );
153  TrackerGeomBuilderFromGeometricDet trackerBuilder;
154  boost::shared_ptr<TrackerGeometry> theTracker(trackerBuilder.build(&(*theGeometricDet), *ptp, tTopo ));
155 
157  iSetup.get<MuonNumberingRecord>().get(mdc);
160  auto theMuonDT = std::make_shared<DTGeometry>();
161  DTGeometryBuilder.build(*theMuonDT, &(*cpv), *mdc);
162  auto theMuonCSC = std::make_shared<CSCGeometry>();
163  CSCGeometryBuilder.build(*theMuonCSC, &(*cpv), *mdc);
164 
165  edm::ESHandle<Alignments> globalPositionRcd;
166  iSetup.get<GlobalPositionRcd>().get(globalPositionRcd);
167 
168  edm::ESHandle<Alignments> alignments;
169  iSetup.get<TrackerAlignmentRcd>().get( alignments );
171  iSetup.get<TrackerAlignmentErrorExtendedRcd>().get( alignmentErrors );
172  aligner.applyAlignments<TrackerGeometry>( &(*theTracker), &(*alignments), &(*alignmentErrors),
173  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Tracker)) );
174 
175  edm::ESHandle<Alignments> dtAlignments;
176  iSetup.get<DTAlignmentRcd>().get( dtAlignments );
177  edm::ESHandle<AlignmentErrorsExtended> dtAlignmentErrorsExtended;
178  iSetup.get<DTAlignmentErrorExtendedRcd>().get( dtAlignmentErrorsExtended );
179  aligner.applyAlignments<DTGeometry>( &(*theMuonDT), &(*dtAlignments), &(*dtAlignmentErrorsExtended),
180  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)) );
181 
182  edm::ESHandle<Alignments> cscAlignments;
183  iSetup.get<CSCAlignmentRcd>().get( cscAlignments );
184  edm::ESHandle<AlignmentErrorsExtended> cscAlignmentErrorsExtended;
185  iSetup.get<CSCAlignmentErrorExtendedRcd>().get( cscAlignmentErrorsExtended );
186  aligner.applyAlignments<CSCGeometry>( &(*theMuonCSC), &(*cscAlignments), &(*cscAlignmentErrorsExtended),
187  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)) );
188 
189  // within an analyzer, modules can't expect to see any selected alignables!
190  align::Alignables empty_alignables;
191 
192  m_alignableTracker = new AlignableTracker( &(*theTracker), tTopo );
193  m_alignableMuon = new AlignableMuon( &(*theMuonDT), &(*theMuonCSC) );
195 
196  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin(); monitor != m_monitors.end(); ++monitor) {
198  }
199  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin(); monitor != m_monitors.end(); ++monitor) {
200  (*monitor)->startingNewLoop();
201  }
202 
203  m_firstEvent = false;
204  }
205 
206  // Retrieve trajectories and tracks from the event
208  iEvent.getByLabel(m_tjTag, trajTracksMap);
209 
210  // Form pairs of trajectories and tracks
211  ConstTrajTrackPairCollection trajTracks;
212  for (TrajTrackAssociationCollection::const_iterator iPair = trajTracksMap->begin(); iPair != trajTracksMap->end(); ++iPair) {
213  trajTracks.push_back(ConstTrajTrackPair(&(*(*iPair).key), &(*(*iPair).val)));
214  }
215 
216  // Run the monitors
217  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin(); monitor != m_monitors.end(); ++monitor) {
218  (*monitor)->duringLoop(iEvent, iSetup, trajTracks);
219  }
220 
221 }
std::vector< ConstTrajTrackPair > ConstTrajTrackPairCollection
const_iterator end() const
last iterator over the map (read only)
Class to update a given geometry with a set of alignments.
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
void build(CSCGeometry &geom, const DDCompactView *fv, const MuonDDDConstants &muonConstants)
Build the geometry.
std::vector< AlignmentMonitorBase * > m_monitors
void build(DTGeometry &theGeometry, const DDCompactView *cview, const MuonDDDConstants &muonConstants)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
AlignmentParameterStore * m_alignmentParameterStore
Definition: DetId.h:18
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
std::vector< Alignable * > Alignables
Definition: Utilities.h:32
T get() const
Definition: EventSetup.h:71
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
const_iterator begin() const
first iterator over the map (read only)
T const * product() const
Definition: ESHandle.h:86
std::pair< const Trajectory *, const reco::Track * > ConstTrajTrackPair
void AlignmentMonitorAsAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 226 of file AlignmentMonitorAsAnalyzer.cc.

References m_firstEvent.

227 {
228  m_firstEvent = true;
229 }
void AlignmentMonitorAsAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 233 of file AlignmentMonitorAsAnalyzer.cc.

References DEFINE_FWK_MODULE, and m_monitors.

Referenced by o2olib.O2ORunMgr::executeJob().

234 {
235  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin(); monitor != m_monitors.end(); ++monitor) {
236  (*monitor)->endOfLoop();
237  }
238  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin(); monitor != m_monitors.end(); ++monitor) {
239  (*monitor)->endOfJob();
240  }
241 }
std::vector< AlignmentMonitorBase * > m_monitors

Member Data Documentation

AlignableMuon* AlignmentMonitorAsAnalyzer::m_alignableMuon
private

Definition at line 84 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze(), and ~AlignmentMonitorAsAnalyzer().

AlignableTracker* AlignmentMonitorAsAnalyzer::m_alignableTracker
private

Definition at line 83 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze(), and ~AlignmentMonitorAsAnalyzer().

AlignmentParameterStore* AlignmentMonitorAsAnalyzer::m_alignmentParameterStore
private

Definition at line 85 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze(), and ~AlignmentMonitorAsAnalyzer().

edm::ParameterSet AlignmentMonitorAsAnalyzer::m_aliParamStoreCfg
private

Definition at line 81 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze().

bool AlignmentMonitorAsAnalyzer::m_firstEvent
private

Definition at line 89 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze(), and beginJob().

std::vector<AlignmentMonitorBase*> AlignmentMonitorAsAnalyzer::m_monitors
private

Definition at line 87 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by AlignmentMonitorAsAnalyzer(), analyze(), and endJob().

edm::InputTag AlignmentMonitorAsAnalyzer::m_tjTag
private

Definition at line 80 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze().