CMS 3D CMS Logo

AlignmentMonitorAsAnalyzer Class Reference

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

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

Inheritance diagram for AlignmentMonitorAsAnalyzer:

edm::EDAnalyzer

List of all members.

Public Types

typedef std::pair< const
Trajectory *, const
reco::Track * > 
ConstTrajTrackPair
typedef std::vector
< ConstTrajTrackPair
ConstTrajTrackPairCollection

Public Member Functions

 AlignmentMonitorAsAnalyzer (const edm::ParameterSet &)
 ~AlignmentMonitorAsAnalyzer ()

Private Member Functions

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

Private Attributes

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


Detailed Description

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

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

Definition at line 59 of file AlignmentMonitorAsAnalyzer.cc.


Member Typedef Documentation

typedef std::pair<const Trajectory*, const reco::Track*> AlignmentMonitorAsAnalyzer::ConstTrajTrackPair

Definition at line 64 of file AlignmentMonitorAsAnalyzer.cc.

typedef std::vector<ConstTrajTrackPair> AlignmentMonitorAsAnalyzer::ConstTrajTrackPairCollection

Definition at line 65 of file AlignmentMonitorAsAnalyzer.cc.


Constructor & Destructor Documentation

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

Definition at line 95 of file AlignmentMonitorAsAnalyzer.cc.

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

00096    : m_tjTag(iConfig.getParameter<edm::InputTag>("tjTkAssociationMapTag"))
00097    , m_aliParamStoreCfg(iConfig.getParameter<edm::ParameterSet>("ParameterStore"))
00098    , m_alignableTracker(NULL)
00099    , m_alignableMuon(NULL)
00100    , m_alignmentParameterStore(NULL)
00101 {
00102    std::vector<std::string> monitors = iConfig.getUntrackedParameter<std::vector<std::string> >( "monitors" );
00103 
00104    for (std::vector<std::string>::const_iterator miter = monitors.begin();  miter != monitors.end();  ++miter) {
00105       AlignmentMonitorBase* newMonitor = AlignmentMonitorPluginFactory::get()->create(*miter, iConfig.getUntrackedParameter<edm::ParameterSet>(*miter));
00106 
00107       if (!newMonitor) throw cms::Exception("BadConfig") << "Couldn't find monitor named " << *miter;
00108 
00109       m_monitors.push_back(newMonitor);
00110    }
00111 }

AlignmentMonitorAsAnalyzer::~AlignmentMonitorAsAnalyzer (  ) 

Definition at line 114 of file AlignmentMonitorAsAnalyzer.cc.

References m_alignableMuon, m_alignableTracker, and m_alignmentParameterStore.

00115 {
00116    delete m_alignableTracker;
00117    delete m_alignableMuon;
00118    delete m_alignmentParameterStore;
00119 }


Member Function Documentation

void AlignmentMonitorAsAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 128 of file AlignmentMonitorAsAnalyzer.cc.

References edm::Event::getByLabel(), m_lastSetup, m_monitors, and m_tjTag.

00128                                                                                        {
00129    // Retrieve trajectories and tracks from the event
00130    edm::Handle<TrajTrackAssociationCollection> trajTracksMap;
00131    iEvent.getByLabel(m_tjTag, trajTracksMap);
00132 
00133    // Form pairs of trajectories and tracks
00134    ConstTrajTrackPairCollection trajTracks;
00135    for (TrajTrackAssociationCollection::const_iterator iPair = trajTracksMap->begin();  iPair != trajTracksMap->end();  ++iPair) {
00136       trajTracks.push_back(ConstTrajTrackPair(&(*(*iPair).key), &(*(*iPair).val)));
00137    }
00138 
00139    // Run the monitors
00140    for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin();  monitor != m_monitors.end();  ++monitor) {
00141       (*monitor)->duringLoop(iSetup, trajTracks);
00142    }
00143 
00144    // Keep this for endOfLoop (why does endOfLoop want iSetup???)
00145    m_lastSetup = &iSetup;
00146 }

void AlignmentMonitorAsAnalyzer::beginJob ( const edm::EventSetup iSetup  )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 151 of file AlignmentMonitorAsAnalyzer.cc.

References align::AlignableMuon, AlignmentParameterStore_cfi::AlignmentParameterStore, GeometryAligner::applyAlignments(), DTGeometryBuilderFromDDD::build(), CSCGeometryBuilderFromDDD::build(), TrackerGeomBuilderFromGeometricDet::build(), align::DetectorGlobalPosition(), edm::EventSetup::get(), m_alignableMuon, m_alignableTracker, m_alignmentParameterStore, m_aliParamStoreCfg, m_monitors, DetId::Muon, and DetId::Tracker.

00151                                                                 {
00152    GeometryAligner aligner;
00153 
00154    edm::ESHandle<DDCompactView> cpv;
00155    iSetup.get<IdealGeometryRecord>().get( cpv );
00156 
00157    edm::ESHandle<GeometricDet> theGeometricDet;
00158    iSetup.get<IdealGeometryRecord>().get( theGeometricDet );
00159    TrackerGeomBuilderFromGeometricDet trackerBuilder;
00160    boost::shared_ptr<TrackerGeometry> theTracker = boost::shared_ptr<TrackerGeometry>(trackerBuilder.build(&(*theGeometricDet)));
00161 
00162    edm::ESHandle<MuonDDDConstants> mdc;
00163    iSetup.get<MuonNumberingRecord>().get(mdc);
00164    DTGeometryBuilderFromDDD DTGeometryBuilder;
00165    CSCGeometryBuilderFromDDD CSCGeometryBuilder;
00166    boost::shared_ptr<DTGeometry> theMuonDT = boost::shared_ptr<DTGeometry>(DTGeometryBuilder.build(&(*cpv), *mdc));
00167    boost::shared_ptr<CSCGeometry> theMuonCSC = boost::shared_ptr<CSCGeometry>(new CSCGeometry);
00168    CSCGeometryBuilder.build(theMuonCSC, &(*cpv), *mdc);
00169 
00170    edm::ESHandle<Alignments> globalPositionRcd;
00171    iSetup.get<GlobalPositionRcd>().get(globalPositionRcd);
00172 
00173    edm::ESHandle<Alignments> alignments;
00174    iSetup.get<TrackerAlignmentRcd>().get( alignments );
00175    edm::ESHandle<AlignmentErrors> alignmentErrors;
00176    iSetup.get<TrackerAlignmentErrorRcd>().get( alignmentErrors );
00177    aligner.applyAlignments<TrackerGeometry>( &(*theTracker), &(*alignments), &(*alignmentErrors),
00178                                              align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Tracker)) );
00179 
00180    edm::ESHandle<Alignments> dtAlignments;
00181    iSetup.get<DTAlignmentRcd>().get( dtAlignments );
00182    edm::ESHandle<AlignmentErrors> dtAlignmentErrors;
00183    iSetup.get<DTAlignmentErrorRcd>().get( dtAlignmentErrors );
00184    aligner.applyAlignments<DTGeometry>( &(*theMuonDT), &(*dtAlignments), &(*dtAlignmentErrors),
00185                                              align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)) );
00186 
00187    edm::ESHandle<Alignments> cscAlignments;
00188    iSetup.get<CSCAlignmentRcd>().get( cscAlignments );
00189    edm::ESHandle<AlignmentErrors> cscAlignmentErrors;
00190    iSetup.get<CSCAlignmentErrorRcd>().get( cscAlignmentErrors );
00191    aligner.applyAlignments<CSCGeometry>( &(*theMuonCSC), &(*cscAlignments), &(*cscAlignmentErrors),
00192                                              align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)) );
00193 
00194    // within an analyzer, modules can't expect to see any selected alignables!
00195    std::vector<Alignable*> empty_alignables;
00196 
00197    m_alignableTracker = new AlignableTracker( &(*theTracker) );
00198    m_alignableMuon = new AlignableMuon( &(*theMuonDT), &(*theMuonCSC) );
00199    m_alignmentParameterStore = new AlignmentParameterStore(empty_alignables, m_aliParamStoreCfg);
00200 
00201    for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin();  monitor != m_monitors.end();  ++monitor) {
00202       (*monitor)->beginOfJob(m_alignableTracker, m_alignableMuon, m_alignmentParameterStore);
00203    }
00204    for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin();  monitor != m_monitors.end();  ++monitor) {
00205       (*monitor)->startingNewLoop();
00206    }
00207 }

void AlignmentMonitorAsAnalyzer::endJob ( void   )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 211 of file AlignmentMonitorAsAnalyzer.cc.

References m_lastSetup, and m_monitors.

00211                                    {
00212    for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin();  monitor != m_monitors.end();  ++monitor) {
00213       (*monitor)->endOfLoop(*m_lastSetup);
00214    }
00215    for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = m_monitors.begin();  monitor != m_monitors.end();  ++monitor) {
00216       (*monitor)->endOfJob();
00217    }
00218 }


Member Data Documentation

AlignableMuon* AlignmentMonitorAsAnalyzer::m_alignableMuon [private]

Definition at line 77 of file AlignmentMonitorAsAnalyzer.cc.

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

AlignableTracker* AlignmentMonitorAsAnalyzer::m_alignableTracker [private]

Definition at line 76 of file AlignmentMonitorAsAnalyzer.cc.

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

AlignmentParameterStore* AlignmentMonitorAsAnalyzer::m_alignmentParameterStore [private]

Definition at line 78 of file AlignmentMonitorAsAnalyzer.cc.

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

edm::ParameterSet AlignmentMonitorAsAnalyzer::m_aliParamStoreCfg [private]

Definition at line 74 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by beginJob().

const edm::EventSetup* AlignmentMonitorAsAnalyzer::m_lastSetup [private]

Definition at line 81 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze(), and endJob().

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

Definition at line 80 of file AlignmentMonitorAsAnalyzer.cc.

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

edm::InputTag AlignmentMonitorAsAnalyzer::m_tjTag [private]

Definition at line 73 of file AlignmentMonitorAsAnalyzer.cc.

Referenced by analyze().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:14:28 2009 for CMSSW by  doxygen 1.5.4