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

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
 
typedef WorkerT< EDAnalyzerWorkerType
 

Public Member Functions

 AlignmentMonitorAsAnalyzer (const edm::ParameterSet &)
 
 ~AlignmentMonitorAsAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

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

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::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

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

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

Definition at line 60 of file AlignmentMonitorAsAnalyzer.cc.

Member Typedef Documentation

Definition at line 65 of file AlignmentMonitorAsAnalyzer.cc.

Definition at line 66 of file AlignmentMonitorAsAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 98 of file AlignmentMonitorAsAnalyzer.cc.

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

99  : m_tjTag(iConfig.getParameter<edm::InputTag>("tjTkAssociationMapTag"))
100  , m_aliParamStoreCfg(iConfig.getParameter<edm::ParameterSet>("ParameterStore"))
104 {
105  std::vector<std::string> monitors = iConfig.getUntrackedParameter<std::vector<std::string> >( "monitors" );
106 
107  for (std::vector<std::string>::const_iterator miter = monitors.begin(); miter != monitors.end(); ++miter) {
109 
110  if (!newMonitor) throw cms::Exception("BadConfig") << "Couldn't find monitor named " << *miter;
111 
112  m_monitors.push_back(newMonitor);
113  }
114 }
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:56
AlignmentMonitorAsAnalyzer::~AlignmentMonitorAsAnalyzer ( )

Definition at line 117 of file AlignmentMonitorAsAnalyzer.cc.

References m_alignableMuon, m_alignableTracker, and m_alignmentParameterStore.

118 {
119  delete m_alignableTracker;
120  delete m_alignableMuon;
122 }
AlignmentParameterStore * m_alignmentParameterStore

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 131 of file AlignmentMonitorAsAnalyzer.cc.

References align::AlignableMuon, AlignmentParameterStore_cfi::AlignmentParameterStore, GeometryAligner::applyAlignments(), TrackerGeomBuilderFromGeometricDet::build(), CSCGeometryBuilderFromDDD::build(), DTGeometryBuilderFromDDD::build(), 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, and DetId::Tracker.

132 {
133  if (m_firstEvent) {
134  GeometryAligner aligner;
135 
137  iSetup.get<IdealGeometryRecord>().get( cpv );
138 
139  edm::ESHandle<GeometricDet> theGeometricDet;
140  iSetup.get<IdealGeometryRecord>().get( theGeometricDet );
141  TrackerGeomBuilderFromGeometricDet trackerBuilder;
142  boost::shared_ptr<TrackerGeometry> theTracker(trackerBuilder.build(&(*theGeometricDet)));
143 
145  iSetup.get<MuonNumberingRecord>().get(mdc);
146  DTGeometryBuilderFromDDD DTGeometryBuilder;
148  boost::shared_ptr<DTGeometry> theMuonDT(new DTGeometry);
149  DTGeometryBuilder.build(theMuonDT, &(*cpv), *mdc);
150  boost::shared_ptr<CSCGeometry> theMuonCSC(new CSCGeometry);
151  CSCGeometryBuilder.build(theMuonCSC, &(*cpv), *mdc);
152 
153  edm::ESHandle<Alignments> globalPositionRcd;
154  iSetup.get<GlobalPositionRcd>().get(globalPositionRcd);
155 
156  edm::ESHandle<Alignments> alignments;
157  iSetup.get<TrackerAlignmentRcd>().get( alignments );
158  edm::ESHandle<AlignmentErrors> alignmentErrors;
159  iSetup.get<TrackerAlignmentErrorRcd>().get( alignmentErrors );
160  aligner.applyAlignments<TrackerGeometry>( &(*theTracker), &(*alignments), &(*alignmentErrors),
161  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Tracker)) );
162 
163  edm::ESHandle<Alignments> dtAlignments;
164  iSetup.get<DTAlignmentRcd>().get( dtAlignments );
165  edm::ESHandle<AlignmentErrors> dtAlignmentErrors;
166  iSetup.get<DTAlignmentErrorRcd>().get( dtAlignmentErrors );
167  aligner.applyAlignments<DTGeometry>( &(*theMuonDT), &(*dtAlignments), &(*dtAlignmentErrors),
168  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)) );
169 
170  edm::ESHandle<Alignments> cscAlignments;
171  iSetup.get<CSCAlignmentRcd>().get( cscAlignments );
172  edm::ESHandle<AlignmentErrors> cscAlignmentErrors;
173  iSetup.get<CSCAlignmentErrorRcd>().get( cscAlignmentErrors );
174  aligner.applyAlignments<CSCGeometry>( &(*theMuonCSC), &(*cscAlignments), &(*cscAlignmentErrors),
175  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)) );
176 
177  // within an analyzer, modules can't expect to see any selected alignables!
178  std::vector<Alignable*> empty_alignables;
179 
180  m_alignableTracker = new AlignableTracker( &(*theTracker) );
181  m_alignableMuon = new AlignableMuon( &(*theMuonDT), &(*theMuonCSC) );
183 
184  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin(); monitor != m_monitors.end(); ++monitor) {
186  }
187  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin(); monitor != m_monitors.end(); ++monitor) {
188  (*monitor)->startingNewLoop();
189  }
190 
191  m_firstEvent = false;
192  }
193 
194  // Retrieve trajectories and tracks from the event
196  iEvent.getByLabel(m_tjTag, trajTracksMap);
197 
198  // Form pairs of trajectories and tracks
199  ConstTrajTrackPairCollection trajTracks;
200  for (TrajTrackAssociationCollection::const_iterator iPair = trajTracksMap->begin(); iPair != trajTracksMap->end(); ++iPair) {
201  trajTracks.push_back(ConstTrajTrackPair(&(*(*iPair).key), &(*(*iPair).val)));
202  }
203 
204  // Run the monitors
205  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin(); monitor != m_monitors.end(); ++monitor) {
206  (*monitor)->duringLoop(iEvent, iSetup, trajTracks);
207  }
208 
209  // Keep this for endOfLoop (why does endOfLoop want iSetup???)
210  m_lastSetup = &iSetup;
211 }
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
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrors *alignmentErrors, const AlignTransform &globalCoordinates)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
AlignmentParameterStore * m_alignmentParameterStore
Definition: DetId.h:20
void build(boost::shared_ptr< DTGeometry > theGeometry, const DDCompactView *cview, const MuonDDDConstants &muonConstants)
const T & get() const
Definition: EventSetup.h:55
TrackerGeometry * build(const GeometricDet *gd)
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
std::pair< const Trajectory *, const reco::Track * > ConstTrajTrackPair
void AlignmentMonitorAsAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 216 of file AlignmentMonitorAsAnalyzer.cc.

References m_firstEvent.

217 {
218  m_firstEvent = true;
219 }
void AlignmentMonitorAsAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 223 of file AlignmentMonitorAsAnalyzer.cc.

References m_lastSetup, and m_monitors.

224 {
225  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin(); monitor != m_monitors.end(); ++monitor) {
226  (*monitor)->endOfLoop(*m_lastSetup);
227  }
228  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin(); monitor != m_monitors.end(); ++monitor) {
229  (*monitor)->endOfJob();
230  }
231 }
std::vector< AlignmentMonitorBase * > m_monitors

Member Data Documentation

AlignableMuon* AlignmentMonitorAsAnalyzer::m_alignableMuon
private

Definition at line 78 of file AlignmentMonitorAsAnalyzer.cc.

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

AlignableTracker* AlignmentMonitorAsAnalyzer::m_alignableTracker
private

Definition at line 77 of file AlignmentMonitorAsAnalyzer.cc.

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

AlignmentParameterStore* AlignmentMonitorAsAnalyzer::m_alignmentParameterStore
private

Definition at line 79 of file AlignmentMonitorAsAnalyzer.cc.

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

edm::ParameterSet AlignmentMonitorAsAnalyzer::m_aliParamStoreCfg
private

Definition at line 75 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze().

bool AlignmentMonitorAsAnalyzer::m_firstEvent
private

Definition at line 84 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze(), and beginJob().

const edm::EventSetup* AlignmentMonitorAsAnalyzer::m_lastSetup
private

Definition at line 82 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze(), and endJob().

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

Definition at line 81 of file AlignmentMonitorAsAnalyzer.cc.

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

edm::InputTag AlignmentMonitorAsAnalyzer::m_tjTag
private

Definition at line 74 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze().