#include <Alignment/CommonAlignmentMonitor/interface/AlignmentMonitorBase.h>
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) |
Called after updating AlignableTracker and AlignableMuon (by "endOfLoop()"): may be reimplemented. | |
AlignmentMonitorBase (const edm::ParameterSet &cfg, std::string name) | |
Constructor. | |
void | beginOfJob (AlignableTracker *pTracker, AlignableMuon *pMuon, AlignmentParameterStore *pStore) |
Called at beginning of job: don't reimplement. | |
virtual void | book ()=0 |
Book or retrieve histograms; MUST be reimplemented. | |
void | duringLoop (const edm::EventSetup &iSetup, const ConstTrajTrackPairCollection &iTrajTracks) |
Called for each event: don't reimplement. | |
void | endOfJob () |
Called at end of processing: don't implement. | |
void | endOfLoop (const edm::EventSetup &iSetup) |
Called at end of loop: don't reimplement. | |
virtual void | event (const edm::EventSetup &iSetup, const ConstTrajTrackPairCollection &iTrajTracks) |
Called for each event (by "run()"): may be reimplemented. | |
void | startingNewLoop () |
Called at beginning of loop: don't reimplement. | |
virtual | ~AlignmentMonitorBase () |
Destructor. | |
Protected Member Functions | |
TH1F * | book1D (std::string dir, std::string name, std::string title, int nchX, double lowX, double highX) |
Use this every time you book a histogram (so that AlignmentMonitorBase can find your histograms in a collector (parallel-processing) job). | |
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., char *option="s") |
TFileDirectory * | directory (std::string dir) |
int | iteration () |
AlignableMuon * | pMuon () |
AlignableNavigator * | pNavigator () |
AlignmentParameterStore * | pStore () |
AlignableTracker * | pTracker () |
Private Member Functions | |
AlignmentMonitorBase (const AlignmentMonitorBase &) | |
const AlignmentMonitorBase & | operator= (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 |
AlignableMuon * | mp_muon |
AlignableNavigator * | mp_navigator |
AlignmentParameterStore * | mp_store |
AlignableTracker * | mp_tracker |
Usage: <usage>
Definition at line 40 of file AlignmentMonitorBase.h.
typedef std::pair<const Trajectory*, const reco::Track*> AlignmentMonitorBase::ConstTrajTrackPair |
Definition at line 42 of file AlignmentMonitorBase.h.
typedef std::vector<ConstTrajTrackPair> AlignmentMonitorBase::ConstTrajTrackPairCollection |
Definition at line 43 of file AlignmentMonitorBase.h.
AlignmentMonitorBase::AlignmentMonitorBase | ( | const edm::ParameterSet & | cfg, | |
std::string | name | |||
) |
Constructor.
Definition at line 40 of file AlignmentMonitorBase.cc.
References m_baseDirMap.
00041 : m_iteration(0), mp_tracker(0), mp_muon(0), mp_store(0) { 00042 edm::Service<TFileService> tFileService; 00043 m_baseDirMap[std::vector<std::string>()] = new TFileDirectory(tFileService->mkdir(name)); 00044 }
virtual AlignmentMonitorBase::~AlignmentMonitorBase | ( | ) | [inline, virtual] |
AlignmentMonitorBase::AlignmentMonitorBase | ( | const AlignmentMonitorBase & | ) | [private] |
virtual void AlignmentMonitorBase::afterAlignment | ( | const edm::EventSetup & | iSetup | ) | [inline, virtual] |
Called after updating AlignableTracker and AlignableMuon (by "endOfLoop()"): may be reimplemented.
Reimplemented in AlignmentMonitorGeneric, AlignmentMonitorMuonHIP, AlignmentMonitorMuonPositions, AlignmentMonitorMuonResiduals, AlignmentMonitorTemplate, and AlignmentMonitorTracksFromTrajectories.
Definition at line 76 of file AlignmentMonitorBase.h.
Referenced by endOfLoop().
void AlignmentMonitorBase::beginOfJob | ( | AlignableTracker * | pTracker, | |
AlignableMuon * | pMuon, | |||
AlignmentParameterStore * | pStore | |||
) |
Called at beginning of job: don't reimplement.
Definition at line 62 of file AlignmentMonitorBase.cc.
References mp_muon, mp_navigator, mp_store, and mp_tracker.
00062 { 00063 mp_tracker = pTracker; 00064 mp_muon = pMuon; 00065 mp_store = pStore; 00066 00067 if (!pMuon) mp_navigator = new AlignableNavigator(pTracker); 00068 else if (!pTracker) mp_navigator = new AlignableNavigator(pMuon); 00069 else mp_navigator = new AlignableNavigator(pTracker, pMuon); 00070 }
virtual void AlignmentMonitorBase::book | ( | ) | [pure virtual] |
Book or retrieve histograms; MUST be reimplemented.
Implemented in AlignmentMonitorGeneric, AlignmentMonitorMuonHIP, AlignmentMonitorMuonPositions, AlignmentMonitorMuonResiduals, AlignmentMonitorSurvey, AlignmentMonitorTemplate, and AlignmentMonitorTracksFromTrajectories.
Referenced by startingNewLoop().
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 132 of file AlignmentMonitorBase.cc.
References directory(), and TFileDirectory::make().
Referenced by AlignmentMonitorMuonResiduals::book(), AlignmentMonitorGeneric::book(), AlignmentMonitorTemplate::book(), AlignmentMonitorTracksFromTrajectories::book(), AlignmentMonitorMuonHIP::book(), and AlignmentMonitorMuonHIP::bookByAli().
00132 { 00133 return directory(dir)->make<TH1F>(name.c_str(), title.c_str(), nchX, lowX, highX); 00134 }
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. , |
|||
char * | option = "s" | |||
) | [protected] |
Definition at line 136 of file AlignmentMonitorBase.cc.
References directory(), and TFileDirectory::make().
Referenced by AlignmentMonitorMuonHIP::bookByAli().
00136 { 00137 if (lowY == highY) { 00138 return directory(dir)->make<TProfile>(name.c_str(), title.c_str(), nchX, lowX, highX, option); 00139 } 00140 else { 00141 return directory(dir)->make<TProfile>(name.c_str(), title.c_str(), nchX, lowX, highX, lowY, highY, option); 00142 } 00143 }
TFileDirectory * AlignmentMonitorBase::directory | ( | std::string | dir | ) | [protected] |
Definition at line 98 of file AlignmentMonitorBase.cc.
References i, prof2calltree::last, m_baseDirMap, m_iterDirMap, and TFileDirectory::mkdir().
Referenced by AlignmentMonitorMuonResiduals::book(), AlignmentMonitorSurvey::book(), AlignmentMonitorMuonHIP::book(), AlignmentMonitorMuonPositions::book(), book1D(), and bookProfile().
00098 { 00099 std::string::size_type lastPos = dir.find_first_not_of("/", 0); 00100 std::string::size_type pos = dir.find_first_of("/", lastPos); 00101 std::vector<std::string> dirs; 00102 00103 bool isIter = false; 00104 if (dir.substr(lastPos, pos - lastPos) == std::string("iterN")) { 00105 isIter = true; 00106 lastPos = dir.find_first_not_of("/", pos); 00107 pos = dir.find_first_of("/", lastPos); 00108 } 00109 00110 while (std::string::npos != pos || std::string::npos != lastPos) { 00111 dirs.push_back(dir.substr(lastPos, pos - lastPos)); 00112 lastPos = dir.find_first_not_of("/", pos); 00113 pos = dir.find_first_of("/", lastPos); 00114 } 00115 00116 std::map<std::vector<std::string>, TFileDirectory*> *theMap; 00117 if (isIter) theMap = &m_iterDirMap; 00118 else theMap = &m_baseDirMap; 00119 00120 std::vector<std::string> partial; 00121 TFileDirectory *last = (*theMap)[partial]; 00122 for (unsigned int i = 0; i < dirs.size(); i++) { 00123 partial.push_back(dirs[i]); 00124 if (theMap->find(partial) == theMap->end()) { 00125 (*theMap)[partial] = new TFileDirectory(last->mkdir(dirs[i])); 00126 } 00127 last = (*theMap)[partial]; 00128 } 00129 return last; 00130 }
void AlignmentMonitorBase::duringLoop | ( | const edm::EventSetup & | iSetup, | |
const ConstTrajTrackPairCollection & | iTrajTracks | |||
) |
Called for each event: don't reimplement.
Definition at line 87 of file AlignmentMonitorBase.cc.
References event().
00087 { 00088 event(iSetup, iTrajTracks); 00089 }
void AlignmentMonitorBase::endOfJob | ( | ) |
Called at end of processing: don't implement.
Definition at line 95 of file AlignmentMonitorBase.cc.
void AlignmentMonitorBase::endOfLoop | ( | const edm::EventSetup & | iSetup | ) |
Called at end of loop: don't reimplement.
Definition at line 91 of file AlignmentMonitorBase.cc.
References afterAlignment().
00091 { 00092 afterAlignment(iSetup); 00093 }
virtual void AlignmentMonitorBase::event | ( | const edm::EventSetup & | iSetup, | |
const ConstTrajTrackPairCollection & | iTrajTracks | |||
) | [inline, virtual] |
Called for each event (by "run()"): may be reimplemented.
Definition at line 72 of file AlignmentMonitorBase.h.
Referenced by duringLoop().
int AlignmentMonitorBase::iteration | ( | ) | [inline, protected] |
Definition at line 86 of file AlignmentMonitorBase.h.
References m_iteration.
Referenced by AlignmentMonitorMuonHIP::afterAlignment(), AlignmentMonitorTemplate::afterAlignment(), AlignmentMonitorMuonHIP::book(), AlignmentMonitorMuonPositions::book(), AlignmentMonitorMuonHIP::bookByAli(), AlignmentMonitorTemplate::event(), AlignmentMonitorMuonHIP::fill(), and startingNewLoop().
00086 { return m_iteration; };
const AlignmentMonitorBase& AlignmentMonitorBase::operator= | ( | const AlignmentMonitorBase & | ) | [private] |
AlignableMuon* AlignmentMonitorBase::pMuon | ( | ) | [inline, protected] |
Definition at line 88 of file AlignmentMonitorBase.h.
References mp_muon.
Referenced by AlignmentMonitorMuonResiduals::afterAlignment(), AlignmentMonitorMuonResiduals::book(), AlignmentMonitorMuonHIP::book(), and AlignmentMonitorMuonPositions::fill().
00088 { return mp_muon; };
AlignableNavigator* AlignmentMonitorBase::pNavigator | ( | ) | [inline, protected] |
Definition at line 90 of file AlignmentMonitorBase.h.
References mp_navigator.
Referenced by AlignmentMonitorMuonHIP::event(), AlignmentMonitorTemplate::event(), AlignmentMonitorMuonResiduals::event(), and AlignmentMonitorGeneric::event().
00090 { return mp_navigator; };
AlignmentParameterStore* AlignmentMonitorBase::pStore | ( | ) | [inline, protected] |
Definition at line 89 of file AlignmentMonitorBase.h.
References mp_store.
Referenced by AlignmentMonitorMuonHIP::afterAlignment(), AlignmentMonitorGeneric::book(), AlignmentMonitorSurvey::book(), AlignmentMonitorTemplate::book(), and AlignmentMonitorMuonHIP::book().
00089 { return mp_store; };
AlignableTracker* AlignmentMonitorBase::pTracker | ( | ) | [inline, protected] |
Definition at line 87 of file AlignmentMonitorBase.h.
References mp_tracker.
00087 { return mp_tracker; };
void AlignmentMonitorBase::startingNewLoop | ( | ) |
Called at beginning of loop: don't reimplement.
Definition at line 72 of file AlignmentMonitorBase.cc.
References book(), test_cfg::dirName, i, iteration(), m_baseDirMap, m_iteration, m_iterDirMap, and python::multivaluedict::map().
00072 { 00073 m_iteration++; 00074 00075 for (std::map<std::vector<std::string>, TFileDirectory*>::const_iterator i = m_iterDirMap.begin(); i != m_iterDirMap.end(); ++i) { 00076 delete i->second; 00077 } 00078 m_iterDirMap.clear(); 00079 00080 std::ostringstream dirName; 00081 dirName << "iter" << iteration(); 00082 m_iterDirMap[std::vector<std::string>()] = new TFileDirectory(m_baseDirMap[std::vector<std::string>()]->mkdir(dirName.str())); 00083 00084 book(); 00085 }
std::map<std::vector<std::string>, TFileDirectory*> AlignmentMonitorBase::m_baseDirMap [private] |
Definition at line 104 of file AlignmentMonitorBase.h.
Referenced by AlignmentMonitorBase(), directory(), and startingNewLoop().
int AlignmentMonitorBase::m_iteration [private] |
Definition at line 98 of file AlignmentMonitorBase.h.
Referenced by iteration(), and startingNewLoop().
std::map<std::vector<std::string>, TFileDirectory*> AlignmentMonitorBase::m_iterDirMap [private] |
Definition at line 104 of file AlignmentMonitorBase.h.
Referenced by directory(), and startingNewLoop().
AlignableMuon* AlignmentMonitorBase::mp_muon [private] |
Definition at line 102 of file AlignmentMonitorBase.h.
Referenced by beginOfJob(), and pNavigator().
AlignableTracker* AlignmentMonitorBase::mp_tracker [private] |