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 | Protected Member Functions | Protected Attributes | Private Member Functions | 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
< ConstTrajTrackPair
ConstTrajTrackPairCollection
 

Public Member Functions

virtual void afterAlignment (const edm::EventSetup &iSetup)
 
 AlignmentMonitorBase (const edm::ParameterSet &cfg, std::string name)
 Constructor. More...
 
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 (const edm::EventSetup &iSetup)
 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...
 
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 Member Functions

 AlignmentMonitorBase (const AlignmentMonitorBase &)
 
const AlignmentMonitorBaseoperator= (const AlignmentMonitorBase &)
 

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 42 of file AlignmentMonitorBase.h.

Member Typedef Documentation

Definition at line 45 of file AlignmentMonitorBase.h.

Definition at line 46 of file AlignmentMonitorBase.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 21 of file AlignmentMonitorBase.cc.

References m_baseDirMap, and TFileService::mkdir().

22  : m_beamSpotTag(cfg.getUntrackedParameter<edm::InputTag>("beamSpotTag",edm::InputTag("offlineBeamSpot")))
23  , m_iteration(0), mp_tracker(0), mp_muon(0), mp_store(0)
24 {
25  edm::Service<TFileService> tFileService;
26  m_baseDirMap[std::vector<std::string>()] = new TFileDirectory(tFileService->mkdir(name));
27 }
T getUntrackedParameter(std::string const &, T const &) const
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
virtual AlignmentMonitorBase::~AlignmentMonitorBase ( )
inlinevirtual

Destructor.

Definition at line 52 of file AlignmentMonitorBase.h.

52 {}
AlignmentMonitorBase::AlignmentMonitorBase ( const AlignmentMonitorBase )
private

Member Function Documentation

virtual void AlignmentMonitorBase::afterAlignment ( const edm::EventSetup iSetup)
inlinevirtual
void AlignmentMonitorBase::beginOfJob ( AlignableTracker pTracker,
AlignableMuon pMuon,
AlignmentParameterStore pStore 
)

Called at beginning of job: don't reimplement.

Definition at line 30 of file AlignmentMonitorBase.cc.

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

31 {
33  mp_muon = pMuon;
34  mp_store = pStore;
35 
36  if (!pMuon) mp_navigator = new AlignableNavigator(pTracker);
37  else if (!pTracker) mp_navigator = new AlignableNavigator(pMuon);
38  else mp_navigator = new AlignableNavigator(pTracker, pMuon);
39 }
AlignableMuon * pMuon()
AlignmentParameterStore * pStore()
AlignmentParameterStore * mp_store
AlignableTracker * pTracker()
AlignableTracker * mp_tracker
AlignableNavigator * mp_navigator
virtual void AlignmentMonitorBase::book ( )
pure virtual
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 107 of file AlignmentMonitorBase.cc.

References directory(), and TFileDirectory::make().

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

108 {
109  return directory(dir)->make<TH1F>(name.c_str(), title.c_str(), nchX, lowX, highX);
110 }
TFileDirectory * directory(std::string dir)
T * make(const Args &...args) const
make new ROOT object
dbl *** dir
Definition: mlp_gen.cc:35
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 124 of file AlignmentMonitorBase.cc.

References directory(), and TFileDirectory::make().

Referenced by AlignmentMonitorMuonVsCurvature::book(), and AlignmentMonitorMuonSystemMap1D::MuonSystemMapPlot1D::MuonSystemMapPlot1D().

125 {
126  return directory(dir)->make<TH2F>(name.c_str(), title.c_str(), nchX, lowX, highX, nchY, lowY, highY);
127 }
TFileDirectory * directory(std::string dir)
T * make(const Args &...args) const
make new ROOT object
dbl *** dir
Definition: mlp_gen.cc:35
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 113 of file AlignmentMonitorBase.cc.

References directory(), and TFileDirectory::make().

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

114 {
115  if (lowY == highY) {
116  return directory(dir)->make<TProfile>(name.c_str(), title.c_str(), nchX, lowX, highX, option);
117  }
118  else {
119  return directory(dir)->make<TProfile>(name.c_str(), title.c_str(), nchX, lowX, highX, lowY, highY, option);
120  }
121 }
TFileDirectory * directory(std::string dir)
T * make(const Args &...args) const
make new ROOT object
dbl *** dir
Definition: mlp_gen.cc:35
TFileDirectory * AlignmentMonitorBase::directory ( std::string  dir)
protected

Definition at line 71 of file AlignmentMonitorBase.cc.

References accesses::dirs, i, prof2calltree::last, m_baseDirMap, m_iterDirMap, TFileDirectory::mkdir(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

72 {
73  std::string::size_type lastPos = dir.find_first_not_of("/", 0);
74  std::string::size_type pos = dir.find_first_of("/", lastPos);
75  std::vector<std::string> dirs;
76 
77  bool isIter = false;
78  if (dir.substr(lastPos, pos - lastPos) == std::string("iterN")) {
79  isIter = true;
80  lastPos = dir.find_first_not_of("/", pos);
81  pos = dir.find_first_of("/", lastPos);
82  }
83 
84  while (std::string::npos != pos || std::string::npos != lastPos) {
85  dirs.push_back(dir.substr(lastPos, pos - lastPos));
86  lastPos = dir.find_first_not_of("/", pos);
87  pos = dir.find_first_of("/", lastPos);
88  }
89 
90  std::map<std::vector<std::string>, TFileDirectory*> *theMap;
91  if (isIter) theMap = &m_iterDirMap;
92  else theMap = &m_baseDirMap;
93 
94  std::vector<std::string> partial;
95  TFileDirectory *last = (*theMap)[partial];
96  for (unsigned int i = 0; i < dirs.size(); i++) {
97  partial.push_back(dirs[i]);
98  if (theMap->find(partial) == theMap->end()) {
99  (*theMap)[partial] = new TFileDirectory(last->mkdir(dirs[i]));
100  }
101  last = (*theMap)[partial];
102  }
103  return last;
104 }
int i
Definition: DBlmapReader.cc:9
std::map< std::vector< std::string >, TFileDirectory * > m_baseDirMap
std::map< std::vector< std::string >, TFileDirectory * > m_iterDirMap
uint16_t size_type
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
tuple dirs
Definition: accesses.py:30
dbl *** dir
Definition: mlp_gen.cc:35
void AlignmentMonitorBase::duringLoop ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const ConstTrajTrackPairCollection iTrajTracks 
)

Called for each event: don't reimplement.

Definition at line 59 of file AlignmentMonitorBase.cc.

References event().

60 {
61  event(iEvent, iSetup, iTrajTracks);
62 }
virtual void event(const edm::Event &iEvent, const edm::EventSetup &iSetup, const ConstTrajTrackPairCollection &iTrajTracks)
Called for each event (by &quot;run()&quot;): may be reimplemented.
void AlignmentMonitorBase::endOfJob ( )
inline

Called at end of processing: don't implement.

Definition at line 67 of file AlignmentMonitorBase.h.

67 {}
void AlignmentMonitorBase::endOfLoop ( const edm::EventSetup iSetup)

Called at end of loop: don't reimplement.

Definition at line 65 of file AlignmentMonitorBase.cc.

References afterAlignment().

66 {
67  afterAlignment(iSetup);
68 }
virtual void afterAlignment(const edm::EventSetup &iSetup)
virtual void AlignmentMonitorBase::event ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const ConstTrajTrackPairCollection iTrajTracks 
)
inlinevirtual
int AlignmentMonitorBase::iteration ( )
inlineprotected
const AlignmentMonitorBase& AlignmentMonitorBase::operator= ( const AlignmentMonitorBase )
private
AlignableMuon* AlignmentMonitorBase::pMuon ( )
inlineprotected
AlignableNavigator* AlignmentMonitorBase::pNavigator ( )
inlineprotected
AlignmentParameterStore* AlignmentMonitorBase::pStore ( )
inlineprotected

Definition at line 93 of file AlignmentMonitorBase.h.

References mp_store.

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

93 { return mp_store; }
AlignmentParameterStore * mp_store
AlignableTracker* AlignmentMonitorBase::pTracker ( )
inlineprotected

Definition at line 91 of file AlignmentMonitorBase.h.

References mp_tracker.

Referenced by beginOfJob().

91 { return mp_tracker; }
AlignableTracker * mp_tracker
void AlignmentMonitorBase::startingNewLoop ( )

Called at beginning of loop: don't reimplement.

Definition at line 42 of file AlignmentMonitorBase.cc.

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

43 {
44  m_iteration++;
45 
46  for (std::map<std::vector<std::string>, TFileDirectory*>::const_iterator i = m_iterDirMap.begin(); i != m_iterDirMap.end(); ++i) {
47  delete i->second;
48  }
49  m_iterDirMap.clear();
50 
51  std::ostringstream dirName;
52  dirName << "iter" << iteration();
53  m_iterDirMap[std::vector<std::string>()] = new TFileDirectory(m_baseDirMap[std::vector<std::string>()]->mkdir(dirName.str()));
54 
55  book();
56 }
int i
Definition: DBlmapReader.cc:9
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

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

Definition at line 110 of file AlignmentMonitorBase.h.

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

const edm::InputTag AlignmentMonitorBase::m_beamSpotTag
protected
int AlignmentMonitorBase::m_iteration
private

Definition at line 104 of file AlignmentMonitorBase.h.

Referenced by iteration(), and startingNewLoop().

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

Definition at line 110 of file AlignmentMonitorBase.h.

Referenced by directory(), and startingNewLoop().

AlignableMuon* AlignmentMonitorBase::mp_muon
private

Definition at line 106 of file AlignmentMonitorBase.h.

Referenced by beginOfJob(), and pMuon().

AlignableNavigator* AlignmentMonitorBase::mp_navigator
private

Definition at line 108 of file AlignmentMonitorBase.h.

Referenced by beginOfJob(), and pNavigator().

AlignmentParameterStore* AlignmentMonitorBase::mp_store
private

Definition at line 107 of file AlignmentMonitorBase.h.

Referenced by beginOfJob(), and pStore().

AlignableTracker* AlignmentMonitorBase::mp_tracker
private

Definition at line 105 of file AlignmentMonitorBase.h.

Referenced by beginOfJob(), and pTracker().