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 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
 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
 
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
 
const edm::ParameterSet m_pSet
 
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 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 99 of file AlignmentMonitorAsAnalyzer.cc.

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

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

References m_alignableMuon, m_alignableTracker, and m_alignmentParameterStore.

120 {
121  delete m_alignableTracker;
122  delete m_alignableMuon;
124 }
AlignmentParameterStore * m_alignmentParameterStore

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 133 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_pSet, m_tjTag, DetId::Muon, edm::ESHandle< class >::product(), and DetId::Tracker.

134 {
135  //Retrieve tracker topology from geometry
136  edm::ESHandle<TrackerTopology> tTopoHandle;
137  iSetup.get<IdealGeometryRecord>().get(tTopoHandle);
138  const TrackerTopology* const tTopo = tTopoHandle.product();
139 
140  if (m_firstEvent) {
141  GeometryAligner aligner;
142 
144  iSetup.get<IdealGeometryRecord>().get( cpv );
145 
146  edm::ESHandle<GeometricDet> theGeometricDet;
147  iSetup.get<IdealGeometryRecord>().get( theGeometricDet );
148  TrackerGeomBuilderFromGeometricDet trackerBuilder;
149  boost::shared_ptr<TrackerGeometry> theTracker(trackerBuilder.build(&(*theGeometricDet), m_pSet ));
150 
152  iSetup.get<MuonNumberingRecord>().get(mdc);
153  DTGeometryBuilderFromDDD DTGeometryBuilder;
155  boost::shared_ptr<DTGeometry> theMuonDT(new DTGeometry);
156  DTGeometryBuilder.build(theMuonDT, &(*cpv), *mdc);
157  boost::shared_ptr<CSCGeometry> theMuonCSC(new CSCGeometry);
158  CSCGeometryBuilder.build(theMuonCSC, &(*cpv), *mdc);
159 
160  edm::ESHandle<Alignments> globalPositionRcd;
161  iSetup.get<GlobalPositionRcd>().get(globalPositionRcd);
162 
163  edm::ESHandle<Alignments> alignments;
164  iSetup.get<TrackerAlignmentRcd>().get( alignments );
165  edm::ESHandle<AlignmentErrors> alignmentErrors;
166  iSetup.get<TrackerAlignmentErrorRcd>().get( alignmentErrors );
167  aligner.applyAlignments<TrackerGeometry>( &(*theTracker), &(*alignments), &(*alignmentErrors),
168  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Tracker)) );
169 
170  edm::ESHandle<Alignments> dtAlignments;
171  iSetup.get<DTAlignmentRcd>().get( dtAlignments );
172  edm::ESHandle<AlignmentErrors> dtAlignmentErrors;
173  iSetup.get<DTAlignmentErrorRcd>().get( dtAlignmentErrors );
174  aligner.applyAlignments<DTGeometry>( &(*theMuonDT), &(*dtAlignments), &(*dtAlignmentErrors),
175  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)) );
176 
177  edm::ESHandle<Alignments> cscAlignments;
178  iSetup.get<CSCAlignmentRcd>().get( cscAlignments );
179  edm::ESHandle<AlignmentErrors> cscAlignmentErrors;
180  iSetup.get<CSCAlignmentErrorRcd>().get( cscAlignmentErrors );
181  aligner.applyAlignments<CSCGeometry>( &(*theMuonCSC), &(*cscAlignments), &(*cscAlignmentErrors),
182  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)) );
183 
184  // within an analyzer, modules can't expect to see any selected alignables!
185  std::vector<Alignable*> empty_alignables;
186 
187  m_alignableTracker = new AlignableTracker( &(*theTracker), tTopo );
188  m_alignableMuon = new AlignableMuon( &(*theMuonDT), &(*theMuonCSC) );
190 
191  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin(); monitor != m_monitors.end(); ++monitor) {
193  }
194  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin(); monitor != m_monitors.end(); ++monitor) {
195  (*monitor)->startingNewLoop();
196  }
197 
198  m_firstEvent = false;
199  }
200 
201  // Retrieve trajectories and tracks from the event
203  iEvent.getByLabel(m_tjTag, trajTracksMap);
204 
205  // Form pairs of trajectories and tracks
206  ConstTrajTrackPairCollection trajTracks;
207  for (TrajTrackAssociationCollection::const_iterator iPair = trajTracksMap->begin(); iPair != trajTracksMap->end(); ++iPair) {
208  trajTracks.push_back(ConstTrajTrackPair(&(*(*iPair).key), &(*(*iPair).val)));
209  }
210 
211  // Run the monitors
212  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin(); monitor != m_monitors.end(); ++monitor) {
213  (*monitor)->duringLoop(iEvent, iSetup, trajTracks);
214  }
215 
216  // Keep this for endOfLoop (why does endOfLoop want iSetup???)
217  m_lastSetup = &iSetup;
218 }
std::vector< ConstTrajTrackPair > ConstTrajTrackPairCollection
Class to update a given geometry with a set of alignments.
TrackerGeometry * build(const GeometricDet *gd, const edm::ParameterSet &pSet)
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:390
AlignmentParameterStore * m_alignmentParameterStore
Definition: DetId.h:18
void build(boost::shared_ptr< DTGeometry > theGeometry, const DDCompactView *cview, const MuonDDDConstants &muonConstants)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
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 223 of file AlignmentMonitorAsAnalyzer.cc.

References m_firstEvent.

224 {
225  m_firstEvent = true;
226 }
void AlignmentMonitorAsAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 230 of file AlignmentMonitorAsAnalyzer.cc.

References m_lastSetup, and m_monitors.

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

Member Data Documentation

AlignableMuon* AlignmentMonitorAsAnalyzer::m_alignableMuon
private

Definition at line 79 of file AlignmentMonitorAsAnalyzer.cc.

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

AlignableTracker* AlignmentMonitorAsAnalyzer::m_alignableTracker
private

Definition at line 78 of file AlignmentMonitorAsAnalyzer.cc.

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

AlignmentParameterStore* AlignmentMonitorAsAnalyzer::m_alignmentParameterStore
private

Definition at line 80 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 85 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze(), and beginJob().

const edm::EventSetup* AlignmentMonitorAsAnalyzer::m_lastSetup
private

Definition at line 83 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze(), and endJob().

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

Definition at line 82 of file AlignmentMonitorAsAnalyzer.cc.

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

const edm::ParameterSet AlignmentMonitorAsAnalyzer::m_pSet
private

Definition at line 76 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze().

edm::InputTag AlignmentMonitorAsAnalyzer::m_tjTag
private

Definition at line 74 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze().