CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
AlignmentMonitorBase Class Referenceabstract

#include <Alignment/CommonAlignmentMonitor/interface/AlignmentMonitorBase.h>

Inheritance diagram for AlignmentMonitorBase:
AlignmentMonitorGeneric AlignmentMonitorMuonResiduals AlignmentMonitorMuonSystemMap1D AlignmentMonitorMuonVsCurvature AlignmentMonitorSegmentDifferences AlignmentMonitorSurvey AlignmentMonitorTemplate AlignmentMonitorTracksFromTrajectories

Public Types

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

Public Member Functions

virtual void afterAlignment ()
 
 AlignmentMonitorBase (const edm::ParameterSet &cfg, const edm::ConsumesCollector &iC, std::string name)
 Constructor. More...
 
 AlignmentMonitorBase (const AlignmentMonitorBase &)=delete
 
void beginOfJob (AlignableTracker *pTracker, AlignableMuon *pMuon, AlignmentParameterStore *pStore)
 Called at beginning of job: don't reimplement. More...
 
virtual void book ()=0
 Book or retrieve histograms; MUST be reimplemented. More...
 
void duringLoop (const edm::Event &iEvent, const edm::EventSetup &iSetup, const ConstTrajTrackPairCollection &iTrajTracks)
 Called for each event: don't reimplement. More...
 
void endOfJob ()
 Called at end of processing: don't implement. More...
 
void endOfLoop ()
 Called at end of loop: don't reimplement. More...
 
virtual void event (const edm::Event &iEvent, const edm::EventSetup &iSetup, const ConstTrajTrackPairCollection &iTrajTracks)
 Called for each event (by "run()"): may be reimplemented. More...
 
const AlignmentMonitorBaseoperator= (const AlignmentMonitorBase &)=delete
 
void startingNewLoop ()
 Called at beginning of loop: don't reimplement. More...
 
virtual ~AlignmentMonitorBase ()
 Destructor. More...
 

Protected Member Functions

TH1F * book1D (std::string dir, std::string name, std::string title, int nchX, double lowX, double highX)
 
TH2F * book2D (std::string dir, std::string name, std::string title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
 
TProfile * bookProfile (std::string dir, std::string name, std::string title, int nchX, double lowX, double highX, int nchY=1, double lowY=0., double highY=0., const char *option="s")
 
TFileDirectorydirectory (std::string dir)
 
int iteration ()
 
AlignableMuonpMuon ()
 
AlignableNavigatorpNavigator ()
 
AlignmentParameterStorepStore ()
 
AlignableTrackerpTracker ()
 

Protected Attributes

const edm::InputTag m_beamSpotTag
 

Private Attributes

std::map< std::vector< std::string >, TFileDirectory * > m_baseDirMap
 
int m_iteration
 
std::map< std::vector< std::string >, TFileDirectory * > m_iterDirMap
 
AlignableMuonmp_muon
 
AlignableNavigatormp_navigator
 
AlignmentParameterStoremp_store
 
AlignableTrackermp_tracker
 

Detailed Description

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

Usage: <usage>

Definition at line 43 of file AlignmentMonitorBase.h.

Member Typedef Documentation

◆ ConstTrajTrackPair

Definition at line 45 of file AlignmentMonitorBase.h.

◆ ConstTrajTrackPairCollection

Definition at line 46 of file AlignmentMonitorBase.h.

Constructor & Destructor Documentation

◆ AlignmentMonitorBase() [1/2]

AlignmentMonitorBase::AlignmentMonitorBase ( const edm::ParameterSet cfg,
const edm::ConsumesCollector iC,
std::string  name 
)

Constructor.

Definition at line 20 of file AlignmentMonitorBase.cc.

References m_baseDirMap, TFileService::mkdir(), and Skims_PA_cff::name.

23  : m_beamSpotTag(cfg.getUntrackedParameter<edm::InputTag>("beamSpotTag", edm::InputTag("offlineBeamSpot"))),
24  m_iteration(0),
25  mp_tracker(nullptr),
26  mp_muon(nullptr),
27  mp_store(nullptr) {
28  edm::Service<TFileService> tFileService;
29  m_baseDirMap[std::vector<std::string>()] = new TFileDirectory(tFileService->mkdir(name));
30 }
std::map< std::vector< std::string >, TFileDirectory * > m_baseDirMap
AlignmentParameterStore * mp_store
const edm::InputTag m_beamSpotTag
AlignableTracker * mp_tracker
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69

◆ ~AlignmentMonitorBase()

virtual AlignmentMonitorBase::~AlignmentMonitorBase ( )
inlinevirtual

Destructor.

Definition at line 52 of file AlignmentMonitorBase.h.

52 {}

◆ AlignmentMonitorBase() [2/2]

AlignmentMonitorBase::AlignmentMonitorBase ( const AlignmentMonitorBase )
delete

Member Function Documentation

◆ afterAlignment()

virtual void AlignmentMonitorBase::afterAlignment ( )
inlinevirtual

Called after updating AlignableTracker and AlignableMuon (by "endOfLoop()"): may be reimplemented

Reimplemented in AlignmentMonitorMuonSystemMap1D, AlignmentMonitorMuonResiduals, AlignmentMonitorTracksFromTrajectories, and AlignmentMonitorTemplate.

Definition at line 83 of file AlignmentMonitorBase.h.

Referenced by endOfLoop().

83 {}

◆ beginOfJob()

void AlignmentMonitorBase::beginOfJob ( AlignableTracker pTracker,
AlignableMuon pMuon,
AlignmentParameterStore pStore 
)

Called at beginning of job: don't reimplement.

Definition at line 32 of file AlignmentMonitorBase.cc.

References mp_muon, mp_navigator, mp_store, mp_tracker, pMuon(), pStore(), and pTracker().

34  {
36  mp_muon = pMuon;
37  mp_store = pStore;
38 
39  if (!pMuon)
41  else if (!pTracker)
43  else
45 }
AlignmentParameterStore * pStore()
AlignmentParameterStore * mp_store
AlignableTracker * pTracker()
AlignableTracker * mp_tracker
AlignableNavigator * mp_navigator

◆ book()

virtual void AlignmentMonitorBase::book ( )
pure virtual

◆ book1D()

TH1F * AlignmentMonitorBase::book1D ( std::string  dir,
std::string  name,
std::string  title,
int  nchX,
double  lowX,
double  highX 
)
protected

Use this every time you book a histogram (so that AlignmentMonitorBase can find your histograms in a collector (parallel-processing) job)

Definition at line 109 of file AlignmentMonitorBase.cc.

References DeadROC_duringRun::dir, directory(), TFileDirectory::make(), Skims_PA_cff::name, and runGCPTkAlMap::title.

Referenced by AlignmentMonitorGeneric::book(), AlignmentMonitorTemplate::book(), AlignmentMonitorMuonResiduals::book(), AlignmentMonitorSegmentDifferences::book(), AlignmentMonitorMuonVsCurvature::book(), and AlignmentMonitorTracksFromTrajectories::book().

110  {
111  return directory(dir)->make<TH1F>(name.c_str(), title.c_str(), nchX, lowX, highX);
112 }
T * make(const Args &...args) const
make new ROOT object
TFileDirectory * directory(std::string dir)

◆ book2D()

TH2F * AlignmentMonitorBase::book2D ( std::string  dir,
std::string  name,
std::string  title,
int  nchX,
double  lowX,
double  highX,
int  nchY,
double  lowY,
double  highY 
)
protected

Definition at line 131 of file AlignmentMonitorBase.cc.

References DeadROC_duringRun::dir, directory(), TFileDirectory::make(), Skims_PA_cff::name, and runGCPTkAlMap::title.

Referenced by AlignmentMonitorMuonVsCurvature::book().

139  {
140  return directory(dir)->make<TH2F>(name.c_str(), title.c_str(), nchX, lowX, highX, nchY, lowY, highY);
141 }
T * make(const Args &...args) const
make new ROOT object
TFileDirectory * directory(std::string dir)

◆ bookProfile()

TProfile * AlignmentMonitorBase::bookProfile ( std::string  dir,
std::string  name,
std::string  title,
int  nchX,
double  lowX,
double  highX,
int  nchY = 1,
double  lowY = 0.,
double  highY = 0.,
const char *  option = "s" 
)
protected

Definition at line 114 of file AlignmentMonitorBase.cc.

References DeadROC_duringRun::dir, directory(), TFileDirectory::make(), Skims_PA_cff::name, fileinputsource_cfi::option, and runGCPTkAlMap::title.

Referenced by AlignmentMonitorMuonVsCurvature::book(), and AlignmentMonitorSegmentDifferences::book().

123  {
124  if (lowY == highY) {
125  return directory(dir)->make<TProfile>(name.c_str(), title.c_str(), nchX, lowX, highX, option);
126  } else {
127  return directory(dir)->make<TProfile>(name.c_str(), title.c_str(), nchX, lowX, highX, lowY, highY, option);
128  }
129 }
T * make(const Args &...args) const
make new ROOT object
TFileDirectory * directory(std::string dir)

◆ directory()

TFileDirectory * AlignmentMonitorBase::directory ( std::string  dir)
protected

Definition at line 73 of file AlignmentMonitorBase.cc.

References DeadROC_duringRun::dir, heppy_check::dirs, mps_fire::i, dqmdumpme::last, m_baseDirMap, m_iterDirMap, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by AlignmentMonitorSurvey::book(), AlignmentMonitorMuonResiduals::book(), book1D(), book2D(), and bookProfile().

73  {
74  std::string::size_type lastPos = dir.find_first_not_of('/', 0);
75  std::string::size_type pos = dir.find_first_of('/', lastPos);
76  std::vector<std::string> dirs;
77 
78  bool isIter = false;
79  if (dir.substr(lastPos, pos - lastPos) == std::string("iterN")) {
80  isIter = true;
81  lastPos = dir.find_first_not_of('/', pos);
82  pos = dir.find_first_of('/', lastPos);
83  }
84 
85  while (std::string::npos != pos || std::string::npos != lastPos) {
86  dirs.push_back(dir.substr(lastPos, pos - lastPos));
87  lastPos = dir.find_first_not_of('/', pos);
88  pos = dir.find_first_of('/', lastPos);
89  }
90 
91  std::map<std::vector<std::string>, TFileDirectory *> *theMap;
92  if (isIter)
93  theMap = &m_iterDirMap;
94  else
95  theMap = &m_baseDirMap;
96 
97  std::vector<std::string> partial;
98  TFileDirectory *last = (*theMap)[partial];
99  for (unsigned int i = 0; i < dirs.size(); i++) {
100  partial.push_back(dirs[i]);
101  if (theMap->find(partial) == theMap->end()) {
102  (*theMap)[partial] = new TFileDirectory(last->mkdir(dirs[i]));
103  }
104  last = (*theMap)[partial];
105  }
106  return last;
107 }
std::map< std::vector< std::string >, TFileDirectory * > m_baseDirMap
std::map< std::vector< std::string >, TFileDirectory * > m_iterDirMap
uint16_t size_type

◆ duringLoop()

void AlignmentMonitorBase::duringLoop ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const ConstTrajTrackPairCollection iTrajTracks 
)

Called for each event: don't reimplement.

Definition at line 65 of file AlignmentMonitorBase.cc.

References event(), and iEvent.

67  {
68  event(iEvent, iSetup, iTrajTracks);
69 }
virtual void event(const edm::Event &iEvent, const edm::EventSetup &iSetup, const ConstTrajTrackPairCollection &iTrajTracks)
Called for each event (by "run()"): may be reimplemented.
int iEvent
Definition: GenABIO.cc:224

◆ endOfJob()

void AlignmentMonitorBase::endOfJob ( )
inline

Called at end of processing: don't implement.

Definition at line 69 of file AlignmentMonitorBase.h.

69 {}

◆ endOfLoop()

void AlignmentMonitorBase::endOfLoop ( )

Called at end of loop: don't reimplement.

Definition at line 71 of file AlignmentMonitorBase.cc.

References afterAlignment().

71 { afterAlignment(); }
virtual void afterAlignment()

◆ event()

virtual void AlignmentMonitorBase::event ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const ConstTrajTrackPairCollection iTrajTracks 
)
inlinevirtual

◆ iteration()

int AlignmentMonitorBase::iteration ( )
inlineprotected

◆ operator=()

const AlignmentMonitorBase& AlignmentMonitorBase::operator= ( const AlignmentMonitorBase )
delete

◆ pMuon()

AlignableMuon* AlignmentMonitorBase::pMuon ( )
inlineprotected

◆ pNavigator()

AlignableNavigator* AlignmentMonitorBase::pNavigator ( )
inlineprotected

◆ pStore()

AlignmentParameterStore* AlignmentMonitorBase::pStore ( )
inlineprotected

◆ pTracker()

AlignableTracker* AlignmentMonitorBase::pTracker ( )
inlineprotected

Definition at line 112 of file AlignmentMonitorBase.h.

References mp_tracker.

Referenced by beginOfJob(), AlignmentMonitorSurvey::book(), and AlignmentMonitorGeneric::book().

112 { return mp_tracker; }
AlignableTracker * mp_tracker

◆ startingNewLoop()

void AlignmentMonitorBase::startingNewLoop ( )

Called at beginning of loop: don't reimplement.

Definition at line 47 of file AlignmentMonitorBase.cc.

References book(), TrackerOfflineValidation_Dqm_cff::dirName, mps_fire::i, iteration(), m_baseDirMap, m_iteration, m_iterDirMap, and genParticles_cff::map.

47  {
48  m_iteration++;
49 
50  for (std::map<std::vector<std::string>, TFileDirectory *>::const_iterator i = m_iterDirMap.begin();
51  i != m_iterDirMap.end();
52  ++i) {
53  delete i->second;
54  }
55  m_iterDirMap.clear();
56 
57  std::ostringstream dirName;
58  dirName << "iter" << iteration();
59  m_iterDirMap[std::vector<std::string>()] =
60  new TFileDirectory(m_baseDirMap[std::vector<std::string>()]->mkdir(dirName.str()));
61 
62  book();
63 }
std::map< std::vector< std::string >, TFileDirectory * > m_baseDirMap
std::map< std::vector< std::string >, TFileDirectory * > m_iterDirMap
virtual void book()=0
Book or retrieve histograms; MUST be reimplemented.

Member Data Documentation

◆ m_baseDirMap

std::map<std::vector<std::string>, TFileDirectory *> AlignmentMonitorBase::m_baseDirMap
private

Definition at line 132 of file AlignmentMonitorBase.h.

Referenced by AlignmentMonitorBase(), directory(), and startingNewLoop().

◆ m_beamSpotTag

const edm::InputTag AlignmentMonitorBase::m_beamSpotTag
protected

Definition at line 117 of file AlignmentMonitorBase.h.

◆ m_iteration

int AlignmentMonitorBase::m_iteration
private

Definition at line 126 of file AlignmentMonitorBase.h.

Referenced by iteration(), and startingNewLoop().

◆ m_iterDirMap

std::map<std::vector<std::string>, TFileDirectory *> AlignmentMonitorBase::m_iterDirMap
private

Definition at line 132 of file AlignmentMonitorBase.h.

Referenced by directory(), and startingNewLoop().

◆ mp_muon

AlignableMuon* AlignmentMonitorBase::mp_muon
private

Definition at line 128 of file AlignmentMonitorBase.h.

Referenced by beginOfJob(), and pMuon().

◆ mp_navigator

AlignableNavigator* AlignmentMonitorBase::mp_navigator
private

Definition at line 130 of file AlignmentMonitorBase.h.

Referenced by beginOfJob(), and pNavigator().

◆ mp_store

AlignmentParameterStore* AlignmentMonitorBase::mp_store
private

Definition at line 129 of file AlignmentMonitorBase.h.

Referenced by beginOfJob(), and pStore().

◆ mp_tracker

AlignableTracker* AlignmentMonitorBase::mp_tracker
private

Definition at line 127 of file AlignmentMonitorBase.h.

Referenced by beginOfJob(), and pTracker().