CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
< ConstTrajTrackPair
ConstTrajTrackPairCollection
 
- 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 ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

AlignableMuonm_alignableMuon
 
AlignableTrackerm_alignableTracker
 
AlignmentParameterStorem_alignmentParameterStore
 
edm::ParameterSet m_aliParamStoreCfg
 
bool m_firstEvent
 
const edm::EventSetupm_lastSetup
 
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 &)
 
- 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 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 63 of file AlignmentMonitorAsAnalyzer.cc.

Member Typedef Documentation

Definition at line 68 of file AlignmentMonitorAsAnalyzer.cc.

Definition at line 69 of file AlignmentMonitorAsAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 101 of file AlignmentMonitorAsAnalyzer.cc.

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

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

Definition at line 120 of file AlignmentMonitorAsAnalyzer.cc.

References m_alignableMuon, m_alignableTracker, and m_alignmentParameterStore.

121 {
122  delete m_alignableTracker;
123  delete m_alignableMuon;
125 }
AlignmentParameterStore * m_alignmentParameterStore

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 134 of file AlignmentMonitorAsAnalyzer.cc.

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

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

234 {
235  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin(); monitor != m_monitors.end(); ++monitor) {
236  (*monitor)->endOfLoop(*m_lastSetup);
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 81 of file AlignmentMonitorAsAnalyzer.cc.

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

AlignableTracker* AlignmentMonitorAsAnalyzer::m_alignableTracker
private

Definition at line 80 of file AlignmentMonitorAsAnalyzer.cc.

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

AlignmentParameterStore* AlignmentMonitorAsAnalyzer::m_alignmentParameterStore
private

Definition at line 82 of file AlignmentMonitorAsAnalyzer.cc.

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

edm::ParameterSet AlignmentMonitorAsAnalyzer::m_aliParamStoreCfg
private

Definition at line 78 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze().

bool AlignmentMonitorAsAnalyzer::m_firstEvent
private

Definition at line 87 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze(), and beginJob().

const edm::EventSetup* AlignmentMonitorAsAnalyzer::m_lastSetup
private

Definition at line 85 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze(), and endJob().

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

Definition at line 84 of file AlignmentMonitorAsAnalyzer.cc.

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

edm::InputTag AlignmentMonitorAsAnalyzer::m_tjTag
private

Definition at line 77 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze().