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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 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 104 of file AlignmentMonitorAsAnalyzer.cc.

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

105  : m_tjTag(iConfig.getParameter<edm::InputTag>("tjTkAssociationMapTag"))
106  , m_aliParamStoreCfg(iConfig.getParameter<edm::ParameterSet>("ParameterStore"))
110 {
111  std::vector<std::string> monitors = iConfig.getUntrackedParameter<std::vector<std::string> >( "monitors" );
112 
113  for (std::vector<std::string>::const_iterator miter = monitors.begin(); miter != monitors.end(); ++miter) {
115 
116  if (!newMonitor) throw cms::Exception("BadConfig") << "Couldn't find monitor named " << *miter;
117 
118  m_monitors.push_back(newMonitor);
119  }
120 }
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 123 of file AlignmentMonitorAsAnalyzer.cc.

References m_alignableMuon, m_alignableTracker, and m_alignmentParameterStore.

124 {
125  delete m_alignableTracker;
126  delete m_alignableMuon;
128 }
AlignmentParameterStore * m_alignmentParameterStore

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 137 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.

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

References m_firstEvent.

230 {
231  m_firstEvent = true;
232 }
void AlignmentMonitorAsAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 236 of file AlignmentMonitorAsAnalyzer.cc.

References m_lastSetup, and m_monitors.

Referenced by o2o.O2ORunMgr::executeJob().

237 {
238  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin(); monitor != m_monitors.end(); ++monitor) {
239  (*monitor)->endOfLoop(*m_lastSetup);
240  }
241  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin(); monitor != m_monitors.end(); ++monitor) {
242  (*monitor)->endOfJob();
243  }
244 }
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 90 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze(), and beginJob().

const edm::EventSetup* AlignmentMonitorAsAnalyzer::m_lastSetup
private

Definition at line 88 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze(), and endJob().

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().