35 setConfig(ps,
"DTLocalTriggerEfficiency");
53 vector<string>::const_iterator iTr =
trigSources.begin();
54 vector<string>::const_iterator trEnd =
trigSources.end();
55 vector<string>::const_iterator iHw =
hwSources.begin();
56 vector<string>::const_iterator hwEnd =
hwSources.end();
60 for (; iTr != trEnd; ++iTr) {
62 for (; iHw != hwEnd; ++iHw) {
65 for (
int wh = -2; wh <= 2; ++wh) {
66 for (
int sect = 1; sect <= 12; ++sect) {
108 for (vector<string>::const_iterator iHw =
hwSources.begin(); iHw !=
hwSources.end(); ++iHw) {
112 for (
int wh = -2; wh <= 2; ++wh) {
113 for (
int sect = 1; sect <= 12; ++sect) {
116 uint32_t indexCh = chId.
rawId();
118 TH2F* TrackPosvsAngle = getHisto<TH2F>(igetter.
get(
getMEName(
"TrackPosvsAngle",
"Segment", chId)));
119 TH2F* TrackPosvsAngleandTrig =
120 getHisto<TH2F>(igetter.
get(
getMEName(
"TrackPosvsAngleandTrig",
"Segment", chId)));
121 TH2F* TrackPosvsAngleandTrigHHHL =
122 getHisto<TH2F>(igetter.
get(
getMEName(
"TrackPosvsAngleandTrigHHHL",
"Segment", chId)));
124 if (TrackPosvsAngle && TrackPosvsAngleandTrig && TrackPosvsAngleandTrigHHHL &&
125 TrackPosvsAngle->GetEntries() > 1) {
142 std::map<std::string, MonitorElement*>* innerME = &(
secME[sector_id]);
143 TH1D* TrackPos = TrackPosvsAngle->ProjectionY();
144 TH1D* TrackAngle = TrackPosvsAngle->ProjectionX();
145 TH1D* TrackPosandTrig = TrackPosvsAngleandTrig->ProjectionY();
146 TH1D* TrackAngleandTrig = TrackPosvsAngleandTrig->ProjectionX();
147 TH1D* TrackPosandTrigHHHL = TrackPosvsAngleandTrigHHHL->ProjectionY();
148 TH1D* TrackAngleandTrigHHHL = TrackPosvsAngleandTrigHHHL->ProjectionX();
149 float binEff = float(TrackPosandTrig->GetEntries()) / TrackPos->GetEntries();
150 float binEffHHHL = float(TrackPosandTrigHHHL->GetEntries()) / TrackPos->GetEntries();
151 float binErr =
sqrt(binEff * (1 - binEff) / TrackPos->GetEntries());
152 float binErrHHHL =
sqrt(binEffHHHL * (1 - binEffHHHL) / TrackPos->GetEntries());
156 globalEff->setBinError(
stat, binErr);
158 innerME = &(
whME[wh]);
159 globalEff = innerME->find(
fullName(
"TrigEffPhi"))->second;
160 globalEff->setBinContent(sect,
stat, binEff);
161 globalEff->setBinError(sect,
stat, binErr);
162 globalEff = innerME->find(
fullName(
"TrigEffHHHLPhi"))->second;
163 globalEff->setBinContent(sect,
stat, binEffHHHL);
164 globalEff->setBinError(sect,
stat, binErrHHHL);
171 TrackAngleandTrigHHHL, TrackAngle, innerME->find(
fullName(
"TrigEffAngleHHHLPhi"))->second);
173 TrackPosvsAngleandTrig, TrackPosvsAngle, innerME->find(
fullName(
"TrigEffPosvsAnglePhi"))->second);
176 innerME->find(
fullName(
"TrigEffPosvsAngleHHHLPhi"))->second);
180 TH2F* TrackThetaPosvsAngle =
181 getHisto<TH2F>(igetter.
get(
getMEName(
"TrackThetaPosvsAngle",
"Segment", chId)));
182 TH2F* TrackThetaPosvsAngleandTrig =
183 getHisto<TH2F>(igetter.
get(
getMEName(
"TrackThetaPosvsAngleandTrig",
"Segment", chId)));
184 TH2F* TrackThetaPosvsAngleandTrigH =
185 getHisto<TH2F>(igetter.
get(
getMEName(
"TrackThetaPosvsAngleandTrigH",
"Segment", chId)));
187 if (TrackThetaPosvsAngle && TrackThetaPosvsAngleandTrig && TrackThetaPosvsAngleandTrigH &&
188 TrackThetaPosvsAngle->GetEntries() > 1) {
205 std::map<std::string, MonitorElement*>* innerME = &(
secME[sector_id]);
206 TH1D* TrackThetaPos = TrackThetaPosvsAngle->ProjectionY();
207 TH1D* TrackThetaAngle = TrackThetaPosvsAngle->ProjectionX();
208 TH1D* TrackThetaPosandTrig = TrackThetaPosvsAngleandTrig->ProjectionY();
209 TH1D* TrackThetaAngleandTrig = TrackThetaPosvsAngleandTrig->ProjectionX();
210 TH1D* TrackThetaPosandTrigH = TrackThetaPosvsAngleandTrigH->ProjectionY();
211 TH1D* TrackThetaAngleandTrigH = TrackThetaPosvsAngleandTrigH->ProjectionX();
212 float binEff = float(TrackThetaPosandTrig->GetEntries()) / TrackThetaPos->GetEntries();
213 float binErr =
sqrt(binEff * (1 - binEff) / TrackThetaPos->GetEntries());
214 float binEffH = float(TrackThetaPosandTrigH->GetEntries()) / TrackThetaPos->GetEntries();
215 float binErrH =
sqrt(binEffH * (1 - binEffH) / TrackThetaPos->GetEntries());
219 globalEff->setBinError(
stat, binErr);
221 innerME = &(
whME[wh]);
222 globalEff = innerME->find(
fullName(
"TrigEffTheta"))->second;
223 globalEff->setBinContent(sect,
stat, binEff);
224 globalEff->setBinError(sect,
stat, binErr);
225 globalEff = innerME->find(
fullName(
"TrigEffHTheta"))->second;
226 globalEff->setBinContent(sect,
stat, binEffH);
227 globalEff->setBinError(sect,
stat, binErrH);
232 TrackThetaPosandTrigH, TrackThetaPos, innerME->find(
fullName(
"TrigEffPosHTheta"))->second);
234 TrackThetaAngleandTrig, TrackThetaAngle, innerME->find(
fullName(
"TrigEffAngleTheta"))->second);
236 TrackThetaAngleandTrigH, TrackThetaAngle, innerME->find(
fullName(
"TrigEffAngleHTheta"))->second);
238 TrackThetaPosvsAngle,
239 innerME->find(
fullName(
"TrigEffPosvsAngleTheta"))->second);
241 TrackThetaPosvsAngle,
242 innerME->find(
fullName(
"TrigEffPosvsAngleHTheta"))->second);
253 efficiency->Divide(numerator, denominator, 1, 1,
"");
255 int nbins = efficiency->GetNbinsX();
258 float bineff = efficiency->GetBinContent(
bin);
260 if (denominator->GetBinContent(
bin)) {
261 error =
sqrt(bineff * (1 - bineff) / denominator->GetBinContent(
bin));
264 efficiency->SetBinContent(
bin, 1.);
267 efficiency->SetBinError(
bin, error);
273 efficiency->Divide(numerator, denominator, 1, 1,
"");
275 int nbinsx = efficiency->GetNbinsX();
276 int nbinsy = efficiency->GetNbinsY();
277 for (
int binx = 1; binx <= nbinsx; ++binx) {
278 for (
int biny = 1; biny <= nbinsy; ++biny) {
280 float bineff = efficiency->GetBinContent(binx, biny);
282 if (denominator->GetBinContent(binx, biny)) {
283 error =
sqrt(bineff * (1 - bineff) / denominator->GetBinContent(binx, biny));
286 efficiency->SetBinContent(binx, biny, 0.);
289 efficiency->SetBinError(binx, biny, error);
296 wheel << chambId.
wheel();
300 sector << chambId.
sector();
303 string HistoName = fullType +
"_W" + wheel.str() +
"_Sec" + sector.str() +
"_St" + station.str();
309 << sector.str() <<
"/Station" << station.str() <<
"/Segment/" <<
HistoName;
311 uint32_t indexChId = chambId.
rawId();
312 if (htype.find(
"TrigEffAnglePhi") == 0) {
314 ibooker.
book1D(HistoName.c_str(),
"Trigger efficiency vs angle of incidence (Phi)", 16, -40., 40.);
315 }
else if (htype.find(
"TrigEffAngleHHHLPhi") == 0) {
317 ibooker.
book1D(HistoName.c_str(),
"Trigger efficiency (HH/HL) vs angle of incidence (Phi)", 16, -40., 40.);
318 }
else if (htype.find(
"TrigEffAngleTheta") == 0) {
320 ibooker.
book1D(HistoName.c_str(),
"Trigger efficiency vs angle of incidence (Theta)", 16, -40., 40.);
321 }
else if (htype.find(
"TrigEffAngleHTheta") == 0) {
323 ibooker.
book1D(HistoName.c_str(),
"Trigger efficiency (H) vs angle of incidence (Theta)", 16, -40., 40.);
324 }
else if (htype.find(
"TrigEffPosPhi") == 0) {
329 ibooker.
book1D(HistoName.c_str(),
"Trigger efficiency vs position (Phi)",
nbins,
min,
max);
330 }
else if (htype.find(
"TrigEffPosvsAnglePhi") == 0) {
335 ibooker.
book2D(HistoName.c_str(),
"Trigger efficiency position vs angle (Phi)", 16, -40., 40.,
nbins,
min,
max);
336 }
else if (htype.find(
"TrigEffPosvsAngleHHHLPhi") == 0) {
341 HistoName.c_str(),
"Trigger efficiency (HH/HL) pos vs angle (Phi)", 16, -40., 40.,
nbins,
min,
max);
342 }
else if (htype.find(
"TrigEffPosHHHLPhi") == 0) {
347 ibooker.
book1D(HistoName.c_str(),
"Trigger efficiency (HH/HL) vs position (Phi)",
nbins,
min,
max);
348 }
else if (htype.find(
"TrigEffPosTheta") == 0) {
353 ibooker.
book1D(HistoName.c_str(),
"Trigger efficiency vs position (Theta)",
nbins,
min,
max);
354 }
else if (htype.find(
"TrigEffPosHTheta") == 0) {
359 ibooker.
book1D(HistoName.c_str(),
"Trigger efficiency (H) vs position (Theta)",
nbins,
min,
max);
360 }
else if (htype.find(
"TrigEffPosvsAngleTheta") == 0) {
365 ibooker.
book2D(HistoName.c_str(),
"Trigger efficiency pos vs angle (Theta)", 16, -40., 40.,
nbins,
min,
max);
366 }
else if (htype.find(
"TrigEffPosvsAngleHTheta") == 0) {
371 HistoName.c_str(),
"Trigger efficiency (H) pos vs angle (Theta)", 16, -40., 40.,
nbins,
min,
max);
std::map< uint32_t, std::map< std::string, MonitorElement * > > chambME
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::string > trigSources
virtual TH2F * getTH2F() const
const edm::EventSetup & c
void thetaRange(const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
Compute theta range in local chamber coordinates.
std::string & topFolder()
Get top folder name.
virtual void setCurrentFolder(std::string const &fullpath)
void makeEfficiencyME(TH1D *numerator, TH1D *denominator, MonitorElement *result)
Compute efficiency plots.
DTTrigGeomUtils * trigGeomUtils
void Bookings(DQMStore::IBooker &, DQMStore::IGetter &)
virtual TH1F * getTH1F() const
void makeEfficiencyME2D(TH2F *numerator, TH2F *denominator, MonitorElement *result)
Compute 2D efficiency plots.
constexpr uint32_t rawId() const
get the raw id
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::map< int, std::map< std::string, MonitorElement * > > whME
~DTLocalTriggerEfficiencyTest() override
Destructor.
void bookChambHistos(DQMStore::IBooker &, DTChamberId chambId, std::string htype)
Book the new MEs (for each chamber)
virtual MonitorElement * get(std::string const &fullpath) const
void runClientDiagnostic(DQMStore::IBooker &, DQMStore::IGetter &) override
DQM Client Diagnostic.
DTLocalTriggerEfficiencyTest(const edm::ParameterSet &ps)
Constructor.
std::string category()
Get message logger name.
void phiRange(const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
Compute phi range in local chamber coordinates.
void beginRun(edm::Run const &run, edm::EventSetup const &context) override
BeginRun.
edm::ParameterSet parameters
const DTGeometry * muonGeom
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
const int wheelArrayShift
std::string getMEName(std::string histoTag, std::string subfolder, const DTChamberId &chambid)
Get the ME name (by chamber)
void bookSectorHistos(DQMStore::IBooker &, int wheel, int sector, std::string hTag, std::string folder="")
Book the new MEs (for each sector)
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
BeginRun.
void setConfig(const edm::ParameterSet &ps, std::string name)
Set configuration variables.
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
int station() const
Return the station number.
std::vector< std::string > hwSources
std::map< int, std::map< std::string, MonitorElement * > > secME
int wheel() const
Return the wheel number.
void bookWheelHistos(DQMStore::IBooker &, int wheel, std::string hTag, std::string folder="")
Book the new MEs (for each wheel)
std::string fullName(std::string htype)
Create fullname from histo partial name.