42 setConfig(ps,
"DTTriggerEfficiency");
43 baseFolderTM =
"DT/03-LocalTrigger-TM/";
44 baseFolderDDU =
"DT/04-LocalTrigger-DDU/";
65 if (!bookingdone) Bookings(ibooker,igetter);
68 for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
70 for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
73 if( globalEffDistr.find(
fullName(
"TrigEffPhi")) == globalEffDistr.end() ){
78 for (
int wh=-2; wh<=2; ++wh){
80 TH2F * TrigEffDenum = getHisto<TH2F>(igetter.
get(getMEName(
"TrigEffDenum",
"Task",wh)));
81 TH2F * TrigEffNum = getHisto<TH2F>(igetter.
get(getMEName(
"TrigEffNum",
"Task",wh)));
82 TH2F * TrigEffCorrNum = getHisto<TH2F>(igetter.
get(getMEName(
"TrigEffCorrNum",
"Task",wh)));
84 if (TrigEffDenum && TrigEffNum && TrigEffCorrNum && TrigEffDenum->GetEntries()>1) {
86 if( whME[wh].
find(
fullName(
"TrigEffPhi")) == whME[wh].end() ){
88 bookWheelHistos(ibooker,wh,
"TrigEffPhi",
"");
89 bookWheelHistos(ibooker,wh,
"TrigEffCorrPhi",
"");
101 makeEfficiencyME(TrigEffNum,TrigEffDenum,Eff2DWh_TrigEffPhi,Eff1DWh_TrigEffPhi,Eff1DAll_TrigEffPhi);
102 makeEfficiencyME(TrigEffCorrNum,TrigEffDenum,Eff2DWh_TrigEffCorrPhi,Eff1DWh_TrigEffCorrPhi,Eff1DAll_TrigEffCorrPhi);
107 for (
int stat=1; stat<=4; ++stat){
108 for (
int sect=1; sect<=12; ++sect){
110 uint32_t indexCh = chId.
rawId();
114 TH2F * TrackPosvsAngle = getHisto<TH2F>(igetter.
get(getMEName(
"TrackPosvsAngle",
"Segment", chId)));
115 TH2F * TrackPosvsAngleAnyQual = getHisto<TH2F>(igetter.
get(getMEName(
"TrackPosvsAngleAnyQual",
"Segment", chId)));
116 TH2F * TrackPosvsAngleCorr = getHisto<TH2F>(igetter.
get(getMEName(
"TrackPosvsAngleCorr",
"Segment", chId)));
118 if (TrackPosvsAngle && TrackPosvsAngleAnyQual && TrackPosvsAngleCorr && TrackPosvsAngle->GetEntries()>1) {
120 if( chambME[indexCh].
find(
fullName(
"TrigEffAnglePhi")) == chambME[indexCh].end()){
121 bookChambHistos(ibooker,chId,
"TrigEffPosvsAnglePhi",
"Segment");
122 bookChambHistos(ibooker,chId,
"TrigEffPosvsAngleCorrPhi",
"Segment");
125 std::map<std::string,MonitorElement*> *innerME = &(chambME[indexCh]);
126 makeEfficiencyME(TrackPosvsAngleAnyQual,TrackPosvsAngle,innerME->find(
fullName(
"TrigEffPosvsAnglePhi"))->second);
127 makeEfficiencyME(TrackPosvsAngleCorr,TrackPosvsAngle,innerME->find(
fullName(
"TrigEffPosvsAngleCorrPhi"))->second);
143 efficiency->Divide(numerator,denominator,1,1,
"");
145 int nbinsx = efficiency->GetNbinsX();
146 int nbinsy = efficiency->GetNbinsY();
147 for (
int binx=1; binx<=nbinsx; ++binx){
148 for (
int biny=1; biny<=nbinsy; ++biny){
150 float bineff = efficiency->GetBinContent(binx,biny);
152 result1DWh->
Fill(bineff);
153 result1D->
Fill(bineff);
155 if (denominator->GetBinContent(binx,biny)){
156 error =
sqrt(bineff*(1-bineff)/denominator->GetBinContent(binx,biny));
160 efficiency->SetBinContent(binx,biny,0.);
163 efficiency->SetBinError(binx,biny,error);
172 efficiency->Divide(numerator,denominator,1,1,
"");
174 int nbinsx = efficiency->GetNbinsX();
175 int nbinsy = efficiency->GetNbinsY();
176 for (
int binx=1; binx<=nbinsx; ++binx){
177 for (
int biny=1; biny<=nbinsy; ++biny){
179 float bineff = efficiency->GetBinContent(binx,biny);
181 if (denominator->GetBinContent(binx,biny)){
182 error =
sqrt(bineff*(1-bineff)/denominator->GetBinContent(binx,biny));
186 efficiency->SetBinContent(binx,biny,0.);
189 efficiency->SetBinError(binx,biny,error);
197 stringstream wheel; wheel << wh;
199 string folderName = topFolder(hwSource==
"TM") + folder +
"/";
201 string histoname = sourceFolder + folderName
202 +
fullName(histoTag) +
"_W" + wheel.str();
211 bool isTM = hwSource==
"TM" ;
212 basedir = topFolder(isTM);
215 basedir += folder +
"/" ;
221 string hname = fullTag +
"_All";
223 globalEffDistr[fullTag] = ibooker.
book1D(hname.c_str(),hname.c_str(),51,0.,1.02);
230 stringstream wh; wh << wheel;
232 bool isTM = hwSource==
"TM" ;
233 if (hTag.find(
"Summary") != string::npos) {
234 basedir = topFolder(isTM);
236 basedir = topFolder(isTM) +
"Wheel" + wh.str() +
"/" ;
240 basedir += folder +
"/" ;
246 string hname = fullTag+
"_W" + wh.str();
248 string hnameAll = fullTag+
"_All_W" + wh.str();
250 LogTrace(
category()) <<
"[" << testName <<
"Test]: booking "<< basedir << hname;
252 (EffDistrPerWh[wheel])[fullTag] = ibooker.
book1D(hnameAll.c_str(),hnameAll.c_str(),51,0.,1.02);
254 if (hTag.find(
"Phi")!= string::npos ||
255 hTag.find(
"Summary") != string::npos ){
266 whME[wheel][fullTag] =
me;
270 if (hTag.find(
"Theta") != string::npos){
280 whME[wheel][fullTag] =
me;
287 string htype,
string folder) {
289 stringstream wheel; wheel << chambId.
wheel();
291 stringstream sector; sector << chambId.
sector();
294 bool isTM = hwSource==
"TM" ;
295 string HistoName = fullType +
"_W" + wheel.str() +
"_Sec" + sector.str() +
"_St" + station.str();
298 "Wheel" + wheel.str() +
299 "/Sector" + sector.str() +
300 "/Station" + station.str() +
303 LogTrace(
category()) <<
"[" << testName <<
"Test]: booking " + topFolder(isTM) +
"Wheel" << wheel.str()
304 <<
"/Sector" << sector.str() <<
"/Station" << station.str() <<
"/" + folder +
"/" <<
HistoName;
307 uint32_t indexChId = chambId.
rawId();
310 trigGeomUtils->phiRange(chambId,min,max,nbins,20);
311 if (htype.find(
"TrigEffPosvsAnglePhi") == 0 ){
313 chambME[indexChId][fullType] = ibooker.
book2D(HistoName.c_str(),
"Trigger efficiency (any qual.) position vs angle (Phi)",12,-30.,30.,
nbins,
min,
max);
316 if (htype.find(
"TrigEffPosvsAngleCorrPhi") == 0 ){
318 chambME[indexChId][fullType] = ibooker.
book2D(HistoName.c_str(),
"Trigger efficiency (correlated) pos vs angle (Phi)",12,-30.,30.,
nbins,
min,
max);
328 vector<string>::const_iterator iTr = trigSources.begin();
329 vector<string>::const_iterator trEnd = trigSources.end();
330 vector<string>::const_iterator iHw = hwSources.begin();
331 vector<string>::const_iterator hwEnd = hwSources.end();
335 if(
parameters.getUntrackedParameter<
bool>(
"staticBooking",
true)){
336 for (; iTr != trEnd; ++iTr){
338 for (; iHw != hwEnd; ++iHw){
344 for (
int wh=-2; wh<=2; ++wh){
346 for (
int sect=1; sect<=12; ++sect){
347 for (
int stat=1; stat<=4; ++stat){
350 bookChambHistos(ibooker,chId,
"TrigEffPosvsAnglePhi",
"Segment");
351 bookChambHistos(ibooker,chId,
"TrigEffPosvsAngleCorrPhi",
"Segment");
356 bookWheelHistos(ibooker,wh,
"TrigEffPhi",
"");
357 bookWheelHistos(ibooker,wh,
"TrigEffCorrPhi",
"");
void makeEfficiencyME(TH2F *numerator, TH2F *denominator, MonitorElement *result2DWh, MonitorElement *result1DWh, MonitorElement *result1D)
Compute 1D/2D efficiency plots.
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * get(const std::string &path)
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
void beginRun(edm::Run const &run, edm::EventSetup const &context)
BeginRun.
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
DTTriggerEfficiencyTest(const edm::ParameterSet &ps)
Constructor.
void bookWheelHistos(DQMStore::IBooker &ibooker, int wheel, std::string hTag, std::string folder)
Book the new MEs (for each wheel)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void runClientDiagnostic(DQMStore::IBooker &, DQMStore::IGetter &)
DQM Client Diagnostic.
virtual ~DTTriggerEfficiencyTest()
Destructor.
uint32_t rawId() const
get the raw id
U second(std::pair< T, U > const &p)
void bookChambHistos(DQMStore::IBooker &ibooker, DTChamberId chambId, std::string htype, std::string folder="")
Book the new MEs (for each chamber)
MonitorElement * book1D(Args &&...args)
std::string getMEName(std::string histoTag, std::string folder, int wh)
Get the ME name (by wheel)
EventID const & min(EventID const &lh, EventID const &rh)
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
int station() const
Return the station number.
TH2F * getTH2F(void) const
int wheel() const
Return the wheel number.
void Bookings(DQMStore::IBooker &, DQMStore::IGetter &)
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void bookHistos(DQMStore::IBooker &ibooker, std::string hTag, std::string folder)
Book the new MEs (global)
tuple folder
Histograms Source for live online DQM in P5
EventID const & max(EventID const &lh, EventID const &rh)