68 vector<string>::const_iterator iTr =
trigSources.begin();
69 vector<string>::const_iterator trEnd =
trigSources.end();
70 vector<string>::const_iterator iHw =
hwSources.begin();
71 vector<string>::const_iterator hwEnd =
hwSources.end();
75 if(
parameters.getUntrackedParameter<
bool>(
"staticBooking",
true)){
76 for (; iTr != trEnd; ++iTr){
78 for (; iHw != hwEnd; ++iHw){
81 for (
int wh=-2; wh<=2; ++wh){
82 for (
int sect=1; sect<=12; ++sect){
124 for (vector<string>::const_iterator iHw =
hwSources.begin(); iHw !=
hwSources.end(); ++iHw){
128 for (
int wh=-2; wh<=2; ++wh){
129 for (
int sect=1; sect<=12; ++sect){
132 uint32_t indexCh = chId.
rawId();
135 TH2F * TrackPosvsAngle = getHisto<TH2F>(igetter.
get(
getMEName(
"TrackPosvsAngle",
"Segment", chId)));
136 TH2F * TrackPosvsAngleandTrig = getHisto<TH2F>(igetter.
get(
getMEName(
"TrackPosvsAngleandTrig",
"Segment", chId)));
137 TH2F * TrackPosvsAngleandTrigHHHL = getHisto<TH2F>(igetter.
get(
getMEName(
"TrackPosvsAngleandTrigHHHL",
"Segment", chId)));
139 if (TrackPosvsAngle && TrackPosvsAngleandTrig && TrackPosvsAngleandTrigHHHL && TrackPosvsAngle->GetEntries()>1) {
160 std::map<std::string,MonitorElement*> *innerME = &(
secME[sector_id]);
161 TH1D* TrackPos = TrackPosvsAngle->ProjectionY();
162 TH1D*
TrackAngle = TrackPosvsAngle->ProjectionX();
163 TH1D* TrackPosandTrig = TrackPosvsAngleandTrig->ProjectionY();
164 TH1D* TrackAngleandTrig = TrackPosvsAngleandTrig->ProjectionX();
165 TH1D* TrackPosandTrigHHHL = TrackPosvsAngleandTrigHHHL->ProjectionY();
166 TH1D* TrackAngleandTrigHHHL = TrackPosvsAngleandTrigHHHL->ProjectionX();
167 float binEff =
float(TrackPosandTrig->GetEntries())/TrackPos->GetEntries();
168 float binEffHHHL =
float(TrackPosandTrigHHHL->GetEntries())/TrackPos->GetEntries();
169 float binErr =
sqrt(binEff*(1-binEff)/TrackPos->GetEntries());
170 float binErrHHHL =
sqrt(binEffHHHL*(1-binEffHHHL)/TrackPos->GetEntries());
174 globalEff->setBinError(
stat,binErr);
176 innerME = &(
whME[wh]);
177 globalEff = innerME->find(
fullName(
"TrigEffPhi"))->second;
178 globalEff->setBinContent(sect,
stat,binEff);
179 globalEff->setBinError(sect,
stat,binErr);
180 globalEff = innerME->find(
fullName(
"TrigEffHHHLPhi"))->second;
181 globalEff->setBinContent(sect,
stat,binEffHHHL);
182 globalEff->setBinError(sect,
stat,binErrHHHL);
196 TH2F * TrackThetaPosvsAngle = getHisto<TH2F>(igetter.
get(
getMEName(
"TrackThetaPosvsAngle",
"Segment", chId)));
197 TH2F * TrackThetaPosvsAngleandTrig = getHisto<TH2F>(igetter.
get(
getMEName(
"TrackThetaPosvsAngleandTrig",
"Segment", chId)));
198 TH2F * TrackThetaPosvsAngleandTrigH = getHisto<TH2F>(igetter.
get(
getMEName(
"TrackThetaPosvsAngleandTrigH",
"Segment", chId)));
200 if (TrackThetaPosvsAngle && TrackThetaPosvsAngleandTrig && TrackThetaPosvsAngleandTrigH && TrackThetaPosvsAngle->GetEntries()>1) {
220 std::map<std::string,MonitorElement*> *innerME = &(
secME[sector_id]);
221 TH1D* TrackThetaPos = TrackThetaPosvsAngle->ProjectionY();
222 TH1D* TrackThetaAngle = TrackThetaPosvsAngle->ProjectionX();
223 TH1D* TrackThetaPosandTrig = TrackThetaPosvsAngleandTrig->ProjectionY();
224 TH1D* TrackThetaAngleandTrig = TrackThetaPosvsAngleandTrig->ProjectionX();
225 TH1D* TrackThetaPosandTrigH = TrackThetaPosvsAngleandTrigH->ProjectionY();
226 TH1D* TrackThetaAngleandTrigH = TrackThetaPosvsAngleandTrigH->ProjectionX();
227 float binEff =
float(TrackThetaPosandTrig->GetEntries())/TrackThetaPos->GetEntries();
228 float binErr =
sqrt(binEff*(1-binEff)/TrackThetaPos->GetEntries());
229 float binEffH =
float(TrackThetaPosandTrigH->GetEntries())/TrackThetaPos->GetEntries();
230 float binErrH =
sqrt(binEffH*(1-binEffH)/TrackThetaPos->GetEntries());
234 globalEff->setBinError(
stat,binErr);
236 innerME = &(
whME[wh]);
237 globalEff = innerME->find(
fullName(
"TrigEffTheta"))->second;
238 globalEff->setBinContent(sect,
stat,binEff);
239 globalEff->setBinError(sect,
stat,binErr);
240 globalEff = innerME->find(
fullName(
"TrigEffHTheta"))->second;
241 globalEff->setBinContent(sect,
stat,binEffH);
242 globalEff->setBinError(sect,
stat,binErrH);
249 makeEfficiencyME2D(TrackThetaPosvsAngleandTrig,TrackThetaPosvsAngle,innerME->find(
fullName(
"TrigEffPosvsAngleTheta"))->second);
250 makeEfficiencyME2D(TrackThetaPosvsAngleandTrigH,TrackThetaPosvsAngle,innerME->find(
fullName(
"TrigEffPosvsAngleHTheta"))->second);
265 efficiency->Divide(numerator,denominator,1,1,
"");
267 int nbins = efficiency->GetNbinsX();
270 float bineff = efficiency->GetBinContent(
bin);
272 if (denominator->GetBinContent(
bin)){
273 error =
sqrt(bineff*(1-bineff)/denominator->GetBinContent(
bin));
277 efficiency->SetBinContent(
bin,1.);
280 efficiency->SetBinError(
bin,error);
289 efficiency->Divide(numerator,denominator,1,1,
"");
291 int nbinsx = efficiency->GetNbinsX();
292 int nbinsy = efficiency->GetNbinsY();
293 for (
int binx=1; binx<=nbinsx; ++binx){
294 for (
int biny=1; biny<=nbinsy; ++biny){
296 float bineff = efficiency->GetBinContent(binx,biny);
298 if (denominator->GetBinContent(binx,biny)){
299 error =
sqrt(bineff*(1-bineff)/denominator->GetBinContent(binx,biny));
303 efficiency->SetBinContent(binx,biny,0.);
306 efficiency->SetBinError(binx,biny,error);
316 stringstream sector; sector << chambId.
sector();
320 string HistoName = fullType +
"_W" + wheel.str() +
"_Sec" + sector.str() +
"_St" + station.str();
323 "/Sector" + sector.str() +
324 "/Station" + station.str() +
"/Segment");
327 <<
"/Sector" << sector.str() <<
"/Station" << station.str() <<
"/Segment/" <<
HistoName;
330 uint32_t indexChId = chambId.
rawId();
331 if (htype.find(
"TrigEffAnglePhi") == 0){
332 chambME[indexChId][fullType] = ibooker.
book1D(HistoName.c_str(),
"Trigger efficiency vs angle of incidence (Phi)",16,-40.,40.);
334 else if (htype.find(
"TrigEffAngleHHHLPhi") == 0){
335 chambME[indexChId][fullType] = ibooker.
book1D(HistoName.c_str(),
"Trigger efficiency (HH/HL) vs angle of incidence (Phi)",16,-40.,40.);
337 else if (htype.find(
"TrigEffAngleTheta") == 0){
338 chambME[indexChId][fullType] = ibooker.
book1D(HistoName.c_str(),
"Trigger efficiency vs angle of incidence (Theta)",16,-40.,40.);
340 else if (htype.find(
"TrigEffAngleHTheta") == 0){
341 chambME[indexChId][fullType] = ibooker.
book1D(HistoName.c_str(),
"Trigger efficiency (H) vs angle of incidence (Theta)",16,-40.,40.);
343 else if (htype.find(
"TrigEffPosPhi") == 0 ){
347 chambME[indexChId][fullType] = ibooker.
book1D(HistoName.c_str(),
"Trigger efficiency vs position (Phi)",
nbins,
min,
max);
349 else if (htype.find(
"TrigEffPosvsAnglePhi") == 0 ){
353 chambME[indexChId][fullType] = ibooker.
book2D(HistoName.c_str(),
"Trigger efficiency position vs angle (Phi)",16,-40.,40.,
nbins,
min,
max);
355 else if (htype.find(
"TrigEffPosvsAngleHHHLPhi") == 0 ){
359 chambME[indexChId][fullType] = ibooker.
book2D(HistoName.c_str(),
"Trigger efficiency (HH/HL) pos vs angle (Phi)",16,-40.,40.,
nbins,
min,
max);
361 else if (htype.find(
"TrigEffPosHHHLPhi") == 0 ){
365 chambME[indexChId][fullType] = ibooker.
book1D(HistoName.c_str(),
"Trigger efficiency (HH/HL) vs position (Phi)",
nbins,
min,
max);
367 else if (htype.find(
"TrigEffPosTheta") == 0){
371 chambME[indexChId][fullType] = ibooker.
book1D(HistoName.c_str(),
"Trigger efficiency vs position (Theta)",
nbins,
min,
max);
373 else if (htype.find(
"TrigEffPosHTheta") == 0){
377 chambME[indexChId][fullType] = ibooker.
book1D(HistoName.c_str(),
"Trigger efficiency (H) vs position (Theta)",
nbins,
min,
max);
379 else if (htype.find(
"TrigEffPosvsAngleTheta") == 0 ){
383 chambME[indexChId][fullType] = ibooker.
book2D(HistoName.c_str(),
"Trigger efficiency pos vs angle (Theta)",16,-40.,40.,
nbins,
min,
max);
385 else if (htype.find(
"TrigEffPosvsAngleHTheta") == 0 ){
389 chambME[indexChId][fullType] = ibooker.
book2D(HistoName.c_str(),
"Trigger efficiency (H) pos vs angle (Theta)",16,-40.,40.,
nbins,
min,
max);
std::map< int, std::map< std::string, MonitorElement * > > secME
std::vector< std::string > trigSources
void setBinContent(int binx, double content)
set content of bin (1-D)
void thetaRange(const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
Compute theta range in local chamber coordinates.
std::map< int, std::map< std::string, MonitorElement * > > whME
void makeEfficiencyME(TH1D *numerator, TH1D *denominator, MonitorElement *result)
Compute efficiency plots.
DTTrigGeomUtils * trigGeomUtils
void Bookings(DQMStore::IBooker &, DQMStore::IGetter &)
MonitorElement * get(const std::string &path)
void makeEfficiencyME2D(TH2F *numerator, TH2F *denominator, MonitorElement *result)
Compute 2D efficiency plots.
std::string baseFolderDDU
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)
edm::ESHandle< DTGeometry > muonGeom
std::map< uint32_t, std::map< std::string, MonitorElement * > > chambME
~DTLocalTriggerEfficiencyTest() override
Destructor.
void bookChambHistos(DQMStore::IBooker &, DTChamberId chambId, std::string htype)
Book the new MEs (for each chamber)
MonitorElement * book1D(Args &&...args)
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.
bin
set the eta bin as selection string.
void beginRun(edm::Run const &run, edm::EventSetup const &context) override
BeginRun.
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
const int wheelArrayShift
std::string getMEName(std::string histoTag, std::string subfolder, const DTChamberId &chambid)
Get the ME name (by chamber)
std::string & topFolder(bool isTM)
Get top folder name.
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.
int station() const
Return the station number.
std::vector< std::string > hwSources
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.