41 setConfig(ps,
"DTLocalTriggerSynch");
42 baseFolderTM =
"DT/90-LocalTriggerSynch/";
54 rangeInBX =
parameters.getParameter<
bool>(
"rangeWithinBX");
69 vector<string>::const_iterator iTr = trigSources.begin();
70 vector<string>::const_iterator trEnd = trigSources.end();
71 vector<string>::const_iterator iHw =
hwSources.begin();
72 vector<string>::const_iterator hwEnd =
hwSources.end();
75 if (
parameters.getUntrackedParameter<
bool>(
"staticBooking",
true)) {
76 for (; iTr != trEnd; ++iTr) {
78 for (; iHw != hwEnd; ++iHw) {
80 std::vector<const DTChamber*>::const_iterator chambIt = muonGeom->chambers().begin();
81 std::vector<const DTChamber*>::const_iterator chambEnd = muonGeom->chambers().end();
82 for (; chambIt != chambEnd; ++chambIt) {
92 if (
parameters.getParameter<
bool>(
"fineParamDiff")) {
95 wPhaseMap = (*wPhaseHandle);
103 for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr) {
105 for (vector<string>::const_iterator iHw =
hwSources.begin(); iHw !=
hwSources.end(); ++iHw) {
107 std::vector<const DTChamber*>::const_iterator chambIt = muonGeom->chambers().begin();
108 std::vector<const DTChamber*>::const_iterator chambEnd = muonGeom->chambers().end();
109 for (; chambIt != chambEnd; ++chambIt) {
111 uint32_t indexCh = chId.
rawId();
115 TH1F* numH = getHisto<TH1F>(igetter.
get(getMEName(
numHistoTag,
"", chId)));
116 TH1F* denH = getHisto<TH1F>(igetter.
get(getMEName(
denHistoTag,
"", chId)));
119 std::map<std::string, MonitorElement*> innerME = chambME[indexCh];
121 makeRatioME(numH, denH, ratioH);
124 TF1 mypol8(
"mypol8",
"pol8");
125 getHisto<TH1F>(ratioH)->
Fit(&mypol8,
"CQO");
128 <<
" returned 0" << endl;
131 if (!numH || !denH) {
133 <<
"Test]: At least one of the required Histograms was not found for chamber " << chId
134 <<
". Peaks not computed" << endl;
137 <<
" is less than minEntries=" <<
minEntries <<
". Peaks not computed" << endl;
148 if (
parameters.getParameter<
bool>(
"writeDB")) {
154 std::vector<const DTChamber*>::const_iterator chambIt = muonGeom->chambers().begin();
155 std::vector<const DTChamber*>::const_iterator chambEnd = muonGeom->chambers().end();
156 for (; chambIt != chambEnd; ++chambIt) {
159 int coarseDelay =
static_cast<int>(
160 (getFloatFromME(igetter, chId,
"tTrig_SL1") + getFloatFromME(igetter, chId,
"tTrig_SL3")) * 0.5 /
bxTime);
162 bool fineDiff =
parameters.getParameter<
bool>(
"fineParamDiff");
163 bool coarseDiff =
parameters.getParameter<
bool>(
"coarseParamDiff");
165 TH1F* ratioH = getHisto<TH1F>(igetter.
get(getMEName(
ratioHistoTag,
"", chId)));
167 TF1* fitF = ratioH->GetFunction(
"mypol8");
169 fineDelay = fitF->GetMaximumX(0,
bxTime);
173 <<
" is empty. Worst Phase value set to 0." << endl;
176 if (fineDiff || coarseDiff) {
181 fineDelay = wFine - fineDelay;
184 coarseDelay = wCoarse - coarseDelay;
190 std::vector<std::pair<DTTPGParametersId, DTTPGParametersData> >::const_iterator dbIt = delayMap->
begin();
191 std::vector<std::pair<DTTPGParametersId, DTTPGParametersData> >::const_iterator dbEnd = delayMap->
end();
192 for (; dbIt != dbEnd; ++dbIt) {
194 << (*dbIt).first.sectorId <<
" St " << (*dbIt).first.stationId <<
" has coarse " 195 << (*dbIt).second.nClock <<
" and phase " << (*dbIt).second.tPhase << std::endl;
198 string delayRecord =
"DTTPGParametersRcd";
205 efficiency->Divide(numerator, denominator, 1, 1,
"");
210 wheel << chId.
wheel();
216 string folderName = topFolder() +
"Wheel" + wheel.str() +
"/Sector" + sector.str() +
"/Station" + station.str() +
"/";
219 sourceFolder + folderName + meType +
"_W" + wheel.str() +
"_Sec" + sector.str() +
"_St" + station.str();
237 wheel << chambId.
wheel();
241 sector << chambId.
sector();
244 string HistoName = fullType +
"_W" + wheel.str() +
"_Sec" + sector.str() +
"_St" + station.str();
246 string folder = topFolder() +
"Wheel" + wheel.str() +
"/Sector" + sector.str() +
"/Station" + station.str();
247 if (!subfolder.empty()) {
248 folder +=
"7" + subfolder;
255 uint32_t indexChId = chambId.
rawId();
260 chambME[indexChId][fullType] =
261 ibooker.
book1D(HistoName.c_str(),
"All/HH ratio vs Muon Arrival Time",
nbins,
min,
max);
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
const_iterator begin() const
int set(int wheelId, int stationId, int sectorId, int nc, float ph, DTTimeUnits::type unit)
void setCurrentFolder(std::string const &fullpath)
virtual TH1F * getTH1F() const
constexpr uint32_t rawId() const
get the raw id
const std::string & getName() const
get name of ME
constexpr int32_t ceil(float num)
void runClientDiagnostic(DQMStore::IBooker &, DQMStore::IGetter &) override
DQM Client Diagnostic.
EventID const & min(EventID const &lh, EventID const &rh)
const_iterator end() const
float getFloatFromME(DQMStore::IGetter &, DTChamberId chId, std::string meType)
Get float MEs.
void beginRun(edm::Run const &run, edm::EventSetup const &context) override
BeginRun.
DTLocalTriggerSynchTest(const edm::ParameterSet &ps)
Constructor.
void beginRun(const edm::Run &run, const edm::EventSetup &c) override
begin Run
void makeRatioME(TH1F *numerator, TH1F *denominator, MonitorElement *result)
Compute efficiency plots.
void bookChambHistos(DQMStore::IBooker &, DTChamberId chambId, std::string htype, std::string subfolder="")
Book the new MEs (for each chamber)
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
virtual double getFloatValue() const
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
Perform client diagnostic in online.
int station() const
Return the station number.
MonitorElement * get(std::string const &path)
int wheel() const
Return the wheel number.
static void writeToDB(std::string record, T *payload)
~DTLocalTriggerSynchTest() override
Destructor.
EventID const & max(EventID const &lh, EventID const &rh)