Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:59

0001 /*
0002  * \file L1TDTTFClient.cc
0003  *
0004  * \author G. Codispoti
0005  *
0006  */
0007 
0008 #include "DQM/L1TMonitorClient/interface/L1TDTTFClient.h"
0009 
0010 /// base services
0011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0012 #include "DQMServices/Core/interface/DQMStore.h"
0013 #include "FWCore/Framework/interface/MakerMacros.h"
0014 
0015 L1TDTTFClient::L1TDTTFClient(const edm::ParameterSet &ps)
0016     : l1tdttffolder_(ps.getUntrackedParameter<std::string>("l1tSourceFolder", "L1T/L1TDTTF")),
0017       dttfSource_(ps.getParameter<edm::InputTag>("dttfSource")),
0018       online_(ps.getUntrackedParameter<bool>("online", true)),
0019       resetafterlumi_(ps.getUntrackedParameter<int>("resetAfterLumi", 3)),
0020       counterLS_(0),
0021       occupancy_r_(nullptr) {
0022   edm::LogInfo("L1TDTTFClient");
0023 }
0024 
0025 //--------------------------------------------------------
0026 L1TDTTFClient::~L1TDTTFClient() { edm::LogInfo("L1TDTTFClient") << "[L1TDTTFClient]: ending... "; }
0027 
0028 //--------------------------------------------------------
0029 void L1TDTTFClient::book(DQMStore::IBooker &ibooker) {
0030   edm::LogInfo("L1TDTTFClient") << "[L1TDTTFClient]: Begin Job";
0031 
0032   wheelpath_[0] = l1tdttffolder_ + "/02-WHEEL_N2";
0033   wheelpath_[1] = l1tdttffolder_ + "/03-WHEEL_N1";
0034   wheelpath_[2] = l1tdttffolder_ + "/04-WHEEL_N0";
0035   wheelpath_[3] = l1tdttffolder_ + "/05-WHEEL_P0";
0036   wheelpath_[4] = l1tdttffolder_ + "/06-WHEEL_P1";
0037   wheelpath_[5] = l1tdttffolder_ + "/07-WHEEL_P2";
0038 
0039   wheel_[0] = "N2";
0040   wheel_[1] = "N1";
0041   wheel_[2] = "N0";
0042   wheel_[3] = "P0";
0043   wheel_[4] = "P1";
0044   wheel_[5] = "P2";
0045 
0046   inclusivepath_ = l1tdttffolder_ + "/01-INCLUSIVE";
0047   gmtpath_ = l1tdttffolder_ + "/08-GMT_MATCH";
0048   testpath_ = l1tdttffolder_ + "/09-TEST";
0049 
0050   /// occupancy summary
0051   char hname[100];   //histo name
0052   char mename[100];  //ME name
0053 
0054   /// SUMMARY
0055   ibooker.setCurrentFolder(inclusivepath_);
0056   /// DTTF Tracks per Wheel ditribution
0057   sprintf(hname, "dttf_02_nTracks");
0058   sprintf(mename, "DTTF Tracks by Wheel");
0059   dttf_nTracks_integ = ibooker.book1D(hname, mename, 6, 0, 6);
0060   setWheelLabel(dttf_nTracks_integ);
0061 
0062   /// DTTF Tracks distribution by Sector and Wheel
0063   sprintf(hname, "dttf_03_tracks_occupancy_summary");
0064   sprintf(mename, "DTTF Tracks Occupancy");
0065   dttf_occupancySummary = ibooker.book2D(hname, mename, 6, 0, 6, 12, 1, 13);
0066   setWheelLabel(dttf_occupancySummary);
0067   dttf_occupancySummary->setAxisTitle("Sector", 2);
0068 
0069   /// RESET 04
0070 
0071   /// DTTF Tracks BX Distribution by Wheel
0072   sprintf(hname, "dttf_05_bx_occupancy");
0073   sprintf(mename, "DTTF Tracks BX Distribution by Wheel");
0074   dttf_bx_summary = ibooker.book2D(hname, mename, 6, 0, 6, 3, -1, 2);
0075   setWheelLabel(dttf_bx_summary);
0076   dttf_bx_summary->setAxisTitle("BX", 2);
0077 
0078   /// Fraction of DTTF Tracks BX w.r.t. Tracks with BX=0
0079   sprintf(hname, "dttf_06_bx");
0080   sprintf(mename, "DTTF Tracks BX w.r.t. Tracks with BX=0");
0081   dttf_bx_integ = ibooker.book1D(hname, mename, 3, -1.5, 1.5);
0082   dttf_bx_integ->setAxisTitle("BX", 1);
0083 
0084   /// DTTF Tracks Quality distribution
0085   sprintf(hname, "dttf_07_quality");
0086   sprintf(mename, "DTTF Tracks Quality distribution");
0087   dttf_quality_integ = ibooker.book1D(hname, mename, 7, 1, 8);
0088   setQualLabel(dttf_quality_integ, 1);
0089 
0090   /// DTTF Tracks Quality distribution by Wheel
0091   sprintf(hname, "dttf_08_quality_occupancy");
0092   sprintf(mename, "DTTF Tracks Quality distribution by Wheel");
0093   dttf_quality_summary = ibooker.book2D(hname, mename, 6, 0, 6, 7, 1, 8);
0094   dttf_quality_summary->setAxisTitle("Wheel", 1);
0095   setQualLabel(dttf_quality_summary, 2);
0096   setWheelLabel(dttf_quality_summary);
0097 
0098   /// Fraction of DTTF Tracks with Quality>4 by Sector and Wheel
0099   sprintf(hname, "dttf_09_highQuality_Tracks");
0100   sprintf(mename, "Fraction of DTTF Tracks with Quality>3");
0101   dttf_highQual_Summary = ibooker.book2D(hname, mename, 6, 0, 6, 12, 1, 13);
0102   setWheelLabel(dttf_highQual_Summary);
0103   dttf_highQual_Summary->setAxisTitle("Sector", 2);
0104 
0105   /// #eta-#phi Distribution of DTTF Tracks with coarse #eta assignment
0106   sprintf(hname, "dttf_10_phi_vs_etaCoarse");
0107   sprintf(mename, "#eta-#phi DTTF Tracks occupancy (coarse #eta only, packed values)");
0108   dttf_phi_eta_coarse_integ = ibooker.book2D(hname, mename, 64, 0, 64, 144, -6, 138.);
0109   dttf_phi_eta_coarse_integ->setAxisTitle("#eta", 1);
0110   dttf_phi_eta_coarse_integ->setAxisTitle("#phi", 2);
0111 
0112   /// #eta-#phi Distribution of DTTF Tracks with fine #eta assignment
0113   sprintf(hname, "dttf_11_phi_vs_etaFine");
0114   sprintf(mename, "#eta-#phi DTTF Tracks occupancy (fine #eta only, packed values)");
0115   dttf_phi_eta_fine_integ = ibooker.book2D(hname, mename, 64, 0, 64, 144, -6, 138.);
0116   dttf_phi_eta_fine_integ->setAxisTitle("#eta", 1);
0117   dttf_phi_eta_fine_integ->setAxisTitle("#phi", 2);
0118 
0119   /// #eta-#phi Distribution of DTTF Tracks
0120   sprintf(hname, "dttf_12_phi_vs_eta");
0121   sprintf(mename, "#eta-#phi DTTF Tracks occupancy");
0122   dttf_phi_eta_integ = ibooker.book2D(hname, mename, 64, -1.2, 1.2, 144, -15, 345.);
0123   dttf_phi_eta_integ->setAxisTitle("#eta", 1);
0124   dttf_phi_eta_integ->setAxisTitle("#phi", 2);
0125 
0126   /// Fraction of DTTF Tracks with Fine #eta Assignment
0127   sprintf(hname, "dttf_13_eta_fine_fraction");
0128   sprintf(mename, "Fraction of DTTF Tracks with Fine #eta Assignment");
0129   dttf_eta_fine_fraction = ibooker.book1D(hname, mename, 6, 0, 6);
0130   setWheelLabel(dttf_eta_fine_fraction);
0131   dttf_eta_fine_fraction->setAxisTitle("", 2);
0132 
0133   //////// TH1F
0134 
0135   /// DTTF Tracks #eta distribution (Packed values)
0136   sprintf(hname, "dttf_14_eta");
0137   sprintf(mename, "DTTF Tracks #eta distribution (Packed values)");
0138   dttf_eta_integ = ibooker.book1D(hname, mename, 64, -0.5, 63.5);
0139   dttf_eta_integ->setAxisTitle("#eta", 1);
0140 
0141   /// DTTF Tracks Phi distribution (Packed values)
0142   sprintf(hname, "dttf_15_phi");
0143   sprintf(mename, "DTTF Tracks Phi distribution (Packed values)");
0144   dttf_phi_integ = ibooker.book1D(hname, mename, 144, -6, 138.);
0145   dttf_phi_integ->setAxisTitle("#phi", 1);
0146 
0147   /// DTTF Tracks p_{T} distribution (Packed values)
0148   sprintf(hname, "dttf_16_pt");
0149   sprintf(mename, "DTTF Tracks p_{T} distribution (Packed values)");
0150   dttf_pt_integ = ibooker.book1D(hname, mename, 32, -0.5, 31.5);
0151   dttf_pt_integ->setAxisTitle("p_{T}", 1);
0152   /// DTTF Tracks Charge distribution
0153   sprintf(hname, "dttf_17_charge");
0154   sprintf(mename, "DTTF Tracks Charge distribution");
0155   dttf_q_integ = ibooker.book1D(hname, mename, 2, -0.5, 1.5);
0156   dttf_q_integ->setAxisTitle("Charge", 1);
0157 
0158   /// DTTF 2nd Tracks Only Distribution by Sector and Wheel w.r.t. the total Number of tracks
0159   sprintf(hname, "dttf_18_2ndTrack_occupancy_summary");
0160   sprintf(mename, "DTTF 2nd Tracks occupancy w.r.t. Tracks with BX=0");
0161   dttf_2ndTrack_Summary = ibooker.book2D(hname, mename, 6, 0, 6, 12, 1, 13);
0162   setWheelLabel(dttf_2ndTrack_Summary);
0163 
0164   ////////////////////////////////////////////////////////
0165   /// GMT matching
0166   ////////////////////////////////////////////////////////
0167   ibooker.setCurrentFolder(gmtpath_);
0168   sprintf(hname, "dttf_gmt_fract_matching");
0169   sprintf(mename, "Fraction of DTTF tracks matching with GMT tracks");
0170   dttf_gmt_matching = ibooker.book1D(hname, mename, 3, 1, 4);
0171   dttf_gmt_matching->setBinLabel(1, "GMT Only", 1);
0172   dttf_gmt_matching->setBinLabel(2, "Matching", 1);
0173   dttf_gmt_matching->setBinLabel(3, "DTTF Only", 1);
0174 
0175   ////////////////////////////////////////////////////////
0176   /// TEST directory for stats comparisons
0177   ////////////////////////////////////////////////////////
0178 
0179   ibooker.setCurrentFolder(testpath_);
0180   sprintf(hname, "dttf_01_tracks_occupancy_test_summary");
0181   sprintf(mename, "DTTF Tracks Occupancy");
0182   dttf_occupancySummary_test = ibooker.book2D(hname, mename, 6, 0, 6, 12, 1, 13);
0183   setWheelLabel(dttf_occupancySummary_test);
0184   dttf_occupancySummary_test->setAxisTitle("Sector", 2);
0185 
0186   ////////////////////////////////////////////////////////
0187   /////// Second Track
0188   ////////////////////////////////////////////////////////
0189   ibooker.setCurrentFolder(inclusivepath_ + "/2ND_TRACK_ONLY");
0190 
0191   /// DTTF 2nd Tracks per Wheel distribution
0192   sprintf(hname, "dttf_01_nTracks_2ndTrack");
0193   sprintf(mename, "DTTF 2nd Tracks per Wheel distribution");
0194   dttf_nTracks_integ_2ndTrack = ibooker.book1D(hname, mename, 6, 0, 6);
0195   setWheelLabel(dttf_nTracks_integ_2ndTrack);
0196 
0197   /// DTTF 2nd Tracks distribution by Sector and Wheel
0198   sprintf(hname, "dttf_02_occupancy_summary_2ndTrack");
0199   sprintf(mename, "DTTF 2nd Tracks distribution by Sector and Wheel");
0200   dttf_occupancySummary_2ndTrack = ibooker.book2D(hname, mename, 6, 0, 6, 12, 1, 13);
0201   setWheelLabel(dttf_occupancySummary_2ndTrack);
0202 
0203   /// DTTF 2nd Tracks BX Distribution by Wheel
0204   sprintf(hname, "dttf_03_bx_occupancy_2ndTrack");
0205   sprintf(mename, "DTTF 2nd Tracks BX Distribution by Wheel");
0206   dttf_bx_summary_2ndTrack = ibooker.book2D(hname, mename, 6, 0, 6, 3, -1, 2);
0207   setWheelLabel(dttf_bx_summary_2ndTrack);
0208   dttf_bx_summary_2ndTrack->setAxisTitle("BX", 2);
0209 
0210   /// Fraction of DTTF Tracks BX w.r.t. Tracks with BX=0
0211   sprintf(hname, "dttf_04_bx_2ndTrack");
0212   sprintf(mename, "Fraction of DTTF Tracks BX w.r.t. Tracks with BX=0");
0213   dttf_bx_integ_2ndTrack = ibooker.book1D(hname, mename, 3, -1.5, 1.5);
0214   dttf_bx_integ_2ndTrack->setAxisTitle("BX", 1);
0215 
0216   /// Quality
0217   sprintf(hname, "dttf_05_quality_2ndTrack");
0218   sprintf(mename, "DTTF 2nd Tracks Quality distribution");
0219   dttf_quality_integ_2ndTrack = ibooker.book1D(hname, mename, 7, 0.5, 7.5);
0220   dttf_quality_integ_2ndTrack->setAxisTitle("Quality", 1);
0221   setQualLabel(dttf_quality_integ_2ndTrack, 1);
0222 
0223   /// DTTF 2nd Tracks Tracks Quality distribution by Wheel
0224   sprintf(hname, "dttf_06_quality_occupancy_2ndTrack");
0225   sprintf(mename, "DTTF 2nd Tracks Quality distribution by Wheel");
0226   dttf_quality_summary_2ndTrack = ibooker.book2D(hname, mename, 6, 0, 6, 7, 1, 8);
0227   dttf_quality_summary_2ndTrack->setAxisTitle("Wheel", 1);
0228   setQualLabel(dttf_quality_summary_2ndTrack, 2);
0229   setWheelLabel(dttf_quality_summary_2ndTrack);
0230 
0231   /// Fraction of DTTF 2nd Tracks with Quality>4 by Sector and Wheel
0232   sprintf(hname, "dttf_07_highQuality_Tracks_2ndTrack");
0233   sprintf(mename, "Fraction of DTTF 2nd Tracks with Quality>3");
0234   dttf_highQual_Summary_2ndTrack = ibooker.book2D(hname, mename, 6, 0, 6, 12, 1, 13);
0235   dttf_highQual_Summary_2ndTrack->setAxisTitle("Sector", 2);
0236   setWheelLabel(dttf_highQual_Summary_2ndTrack);
0237 
0238   /// #eta-#phi Distribution of DTTF 2nd Tracks
0239   sprintf(hname, "dttf_08_phi_vs_eta_2ndTrack");
0240   sprintf(mename, "#eta-#phi DTTF Tracks occupancy for 2nd Tracks");
0241   dttf_phi_eta_integ_2ndTrack = ibooker.book2D(hname, mename, 64, 0, 64, 144, -6, 138.);
0242   dttf_phi_eta_integ_2ndTrack->setAxisTitle("#eta", 1);
0243   dttf_phi_eta_integ_2ndTrack->setAxisTitle("#phi", 2);
0244 
0245   /// #eta Distribution of DTTF 2nd Tracks
0246   sprintf(hname, "dttf_09_eta_2ndTrack");
0247   sprintf(mename, "DTTF 2nd Tracks #eta distribution (Packed values)");
0248   dttf_eta_integ_2ndTrack = ibooker.book1D(hname, mename, 64, -0.5, 63.5);
0249   dttf_eta_integ_2ndTrack->setAxisTitle("#eta", 1);
0250 
0251   /// phi Distribution of DTTF 2nd Tracks
0252   sprintf(hname, "dttf_10_phi_2ndTrack");
0253   sprintf(mename, "DTTF 2nd Tracks Phi distribution (Packed values)");
0254   dttf_phi_integ_2ndTrack = ibooker.book1D(hname, mename, 144, -6, 138);
0255   dttf_phi_integ_2ndTrack->setAxisTitle("#phi", 1);
0256 
0257   /// pt Distribution of DTTF 2nd Tracks
0258   sprintf(hname, "dttf_11_pt_2ndTrack");
0259   sprintf(mename, "DTTF 2nd Tracks p_{T} distribution (Packed values)");
0260   dttf_pt_integ_2ndTrack = ibooker.book1D(hname, mename, 32, -0.5, 31.5);
0261   dttf_pt_integ_2ndTrack->setAxisTitle("p_{T}", 1);
0262 
0263   /// charge Distribution of DTTF 2nd Tracks
0264   sprintf(hname, "dttf_12_charge_2ndTrack");
0265   sprintf(mename, "DTTF 2nd Tracks Charge distribution");
0266   dttf_q_integ_2ndTrack = ibooker.book1D(hname, mename, 2, -0.5, 1.5);
0267   dttf_q_integ_2ndTrack->setAxisTitle("Charge", 1);
0268 
0269   for (unsigned int wh = 0; wh < 6; ++wh) {
0270     ibooker.setCurrentFolder(wheelpath_[wh]);
0271 
0272     /// number of tracks per wheel
0273     sprintf(hname, "dttf_02_nTracks_wh%s", wheel_[wh].c_str());
0274     sprintf(mename, "Wheel %s - Number of Tracks", wheel_[wh].c_str());
0275     dttf_nTracks_wheel[wh] = ibooker.book1D(hname, mename, 12, 1, 13);
0276     dttf_nTracks_wheel[wh]->setAxisTitle("sector", 1);
0277 
0278     /// Tracks BX distribution by Sector for each wheel
0279     sprintf(hname, "dttf_03_bx_occupancy_wh%s", wheel_[wh].c_str());
0280     sprintf(mename, "Wheel %s - DTTF Tracks BX distribution by Sector", wheel_[wh].c_str());
0281     dttf_bx_wheel_summary[wh] = ibooker.book2D(hname, mename, 12, 1, 13, 3, -1, 2);
0282     dttf_bx_wheel_summary[wh]->setAxisTitle("BX", 2);
0283     dttf_bx_wheel_summary[wh]->setAxisTitle("Sector", 1);
0284 
0285     /// bx for each wheel
0286     sprintf(hname, "dttf_04_bx_wh%s", wheel_[wh].c_str());
0287     sprintf(mename, "Wheel %s - DTTF Tracks BX w.r.t. Tracks with BX=0", wheel_[wh].c_str());
0288     dttf_bx_wheel_integ[wh] = ibooker.book1D(hname, mename, 3, -1.5, 1.5);
0289     dttf_bx_wheel_integ[wh]->setAxisTitle("BX", 1);
0290 
0291     /// quality per wheel
0292     sprintf(hname, "dttf_05_quality_wh%s", wheel_[wh].c_str());
0293     sprintf(mename, "Wheel %s - Tracks Quality Distribution", wheel_[wh].c_str());
0294     dttf_quality_wheel[wh] = ibooker.book1D(hname, mename, 7, 1, 8);
0295     dttf_quality_wheel[wh]->setAxisTitle("Quality", 1);
0296     setQualLabel(dttf_quality_wheel[wh], 1);
0297 
0298     /// quality per wheel 2D
0299     sprintf(hname, "dttf_06_quality_summary_wh%s", wheel_[wh].c_str());
0300     sprintf(mename, "Wheel %s - Tracks Quality Distribution by Sector", wheel_[wh].c_str());
0301     dttf_quality_summary_wheel[wh] = ibooker.book2D(hname, mename, 12, 1, 13, 7, 1, 8);
0302     dttf_quality_summary_wheel[wh]->setAxisTitle("Sector", 1);
0303     // dttf_quality_summary_wheel[wh]->setAxisTitle("Quality", 2);
0304     setQualLabel(dttf_quality_summary_wheel[wh], 2);
0305 
0306     /// eta assigment for each wheel
0307     sprintf(hname, "dttf_09_etaFine_fraction_wh%s", wheel_[wh].c_str());
0308     sprintf(mename, "Wheel %s - Fraction of DTTF Tracks with fine #eta assignment", wheel_[wh].c_str());
0309     dttf_fine_fraction_wh[wh] = ibooker.book1D(hname, mename, 12, 1, 13);
0310     dttf_fine_fraction_wh[wh]->setAxisTitle("Sector", 1);
0311 
0312     /// DTTF Tracks #eta distribution (Packed values)
0313     sprintf(hname, "dttf_10_eta_wh%s", wheel_[wh].c_str());
0314     sprintf(mename, "Wheel %s - DTTF Tracks #eta distribution (Packed values)", wheel_[wh].c_str());
0315     dttf_eta_wheel[wh] = ibooker.book1D(hname, mename, 64, -0.5, 63.5);
0316     dttf_eta_wheel[wh]->setAxisTitle("#eta", 1);
0317 
0318     /// DTTF Tracks Phi distribution (Packed values)
0319     sprintf(hname, "dttf_11_phi_wh%s", wheel_[wh].c_str());
0320     sprintf(mename, "Wheel %s - DTTF Tracks Phi distribution (Packed values)", wheel_[wh].c_str());
0321     dttf_phi_wheel[wh] = ibooker.book1D(hname, mename, 144, -6, 138.);
0322     dttf_phi_wheel[wh]->setAxisTitle("#phi", 1);
0323 
0324     /// DTTF Tracks p_{T} distribution (Packed values)
0325     sprintf(hname, "dttf_12_pt_wh%s", wheel_[wh].c_str());
0326     sprintf(mename, "Wheel %s - DTTF Tracks p_{T} distribution (Packed values)", wheel_[wh].c_str());
0327     dttf_pt_wheel[wh] = ibooker.book1D(hname, mename, 32, -0.5, 31.5);
0328     dttf_pt_wheel[wh]->setAxisTitle("p_{T}", 1);
0329 
0330     /// DTTF Tracks Charge distribution
0331     sprintf(hname, "dttf_13_charge_wh%s", wheel_[wh].c_str());
0332     sprintf(mename, "Wheel %s - DTTF Tracks Charge distribution", wheel_[wh].c_str());
0333     dttf_q_wheel[wh] = ibooker.book1D(hname, mename, 2, -0.5, 1.5);
0334     dttf_q_wheel[wh]->setAxisTitle("Charge", 1);
0335   }
0336 
0337   //// 2ND track by wheel
0338   for (unsigned int wh = 0; wh < 6; ++wh) {
0339     ibooker.setCurrentFolder(wheelpath_[wh] + "/2ND_TRACK_ONLY");
0340 
0341     /// number of 2nd tracks per wheel
0342     sprintf(hname, "dttf_01_nTracks_wh%s_2ndTrack", wheel_[wh].c_str());
0343     sprintf(mename, "Wheel %s - DTTF Number of 2nd Tracks with BX=0", wheel_[wh].c_str());
0344     dttf_nTracks_wheel_2ndTrack[wh] = ibooker.book1D(hname, mename, 12, 1, 13);
0345     dttf_nTracks_wheel_2ndTrack[wh]->setAxisTitle("sector", 1);
0346 
0347     /// bx for each wheel
0348     sprintf(hname, "dttf_02_bx_occupancy_wh%s_2ndTrack", wheel_[wh].c_str());
0349     sprintf(mename, "Wheel %s - DTTF 2nd Tracks BX distribution by Sector", wheel_[wh].c_str());
0350     dttf_bx_wheel_summary_2ndTrack[wh] = ibooker.book2D(hname, mename, 12, 1, 13, 3, -1, 2);
0351     dttf_bx_wheel_summary_2ndTrack[wh]->setAxisTitle("BX", 2);
0352     dttf_bx_wheel_summary_2ndTrack[wh]->setAxisTitle("Sector", 1);
0353 
0354     /// bx for each wheel
0355     sprintf(hname, "dttf_03_bx_wh%s_2ndTrack", wheel_[wh].c_str());
0356     sprintf(mename, "Wheel %s - 2nd Tracks BX Distribution", wheel_[wh].c_str());
0357     dttf_bx_wheel_integ_2ndTrack[wh] = ibooker.book1D(hname, mename, 3, -1.5, 1.5);
0358     dttf_bx_wheel_integ_2ndTrack[wh]->setAxisTitle("BX", 1);
0359   }
0360 }
0361 
0362 //--------------------------------------------------------
0363 
0364 void L1TDTTFClient::dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) {
0365   //Processing by run ID
0366   book(ibooker);
0367   makeSummary(igetter);
0368 }
0369 
0370 //--------------------------------------------------------
0371 void L1TDTTFClient::dqmEndLuminosityBlock(DQMStore::IBooker &ibooker,
0372                                           DQMStore::IGetter &igetter,
0373                                           const edm::LuminosityBlock &lumiSeg,
0374                                           const edm::EventSetup &c) {
0375   /// Processing by Luminosity Block
0376   if (online_ && !(counterLS_ % resetafterlumi_)) {
0377     book(ibooker);
0378     char hname[60];
0379     sprintf(hname, "%s/dttf_04_tracks_occupancy_by_lumi", inclusivepath_.c_str());
0380 
0381     occupancy_r_ = getTH2F(igetter, hname);
0382     if (!occupancy_r_) {
0383       edm::LogError("L1TDTTFClient::beginLuminosityBlock:ME") << "Failed to get TH2D " << std::string(hname);
0384     } else {
0385       edm::LogInfo("L1TDTTFClient::beginLuminosityBlock:RESET") << "Reseting plots by lumi!";
0386       occupancy_r_->Reset();
0387     }
0388   }
0389 
0390   if (online_) {
0391     makeSummary(igetter);
0392     if (occupancy_r_)
0393       normalize(occupancy_r_);
0394   }
0395 }
0396 
0397 //--------------------------------------------------------
0398 void L1TDTTFClient::makeSummary(DQMStore::IGetter &igetter) {
0399   ////////////////////////////////////////////////////////
0400   /// Build Summariy plots
0401   ////////////////////////////////////////////////////////
0402   buildSummaries(igetter);
0403 
0404   ////////////////////////////////////////////////////////
0405   /// RESCALE PLOTS
0406   ////////////////////////////////////////////////////////
0407   double scale = 0;
0408   double entries = dttf_occupancySummary->getTH2F()->Integral();
0409 
0410   if (entries) {
0411     /// BX has simply all entries
0412     normalize(dttf_bx_summary->getTH2F());
0413 
0414     /// Scale plots with all entries
0415     scale = 1 / entries;
0416     normalize(dttf_occupancySummary->getTH2F(), scale);
0417     normalize(dttf_nTracks_integ->getTH1F(), scale);
0418 
0419     /// Scale plots with only physical entries (no N0 duplicates)
0420     double physEntries = dttf_eta_integ->getTH1F()->Integral();
0421     if (physEntries > 0) {
0422       double physScale = 1 / physEntries;
0423 
0424       normalize(dttf_phi_eta_integ->getTH2F(), physScale);
0425 
0426       normalize(dttf_phi_eta_fine_integ->getTH2F(), physScale);
0427       normalize(dttf_phi_eta_coarse_integ->getTH2F(), physScale);
0428       normalize(dttf_quality_summary->getTH2F(), physScale);
0429 
0430       normalize(dttf_eta_integ->getTH1F(), physScale);
0431       normalize(dttf_q_integ->getTH1F(), physScale);
0432       normalize(dttf_pt_integ->getTH1F(), physScale);
0433       normalize(dttf_phi_integ->getTH1F(), physScale);
0434       normalize(dttf_quality_integ->getTH1F(), physScale);
0435     }
0436   }
0437 
0438   ////////////////////////////////////////////////////////
0439   /// RESCALE PLOTS FOR 2nd tracks
0440   ////////////////////////////////////////////////////////
0441 
0442   double entries2ndTrack = dttf_occupancySummary_2ndTrack->getTH2F()->Integral();
0443   if (entries2ndTrack > 0) {
0444     /// BX has simply all entries
0445     normalize(dttf_bx_summary_2ndTrack->getTH2F());  //
0446 
0447     /// buildHigh Quality Summary Plot
0448     TH2F *ratio = dttf_occupancySummary_2ndTrack->getTH2F();
0449     buildHighQualityPlot(
0450         igetter, ratio, dttf_highQual_Summary_2ndTrack, "%s/2ND_TRACK_ONLY/dttf_05_quality_summary_wh%s_2ndTrack");
0451 
0452     normalize(dttf_2ndTrack_Summary->getTH2F(), scale);  //
0453 
0454     /// Scale plots with all entries
0455     double scale2nd = 1 / entries2ndTrack;
0456     normalize(dttf_occupancySummary_2ndTrack->getTH2F(), scale2nd);  //
0457     normalize(dttf_nTracks_integ_2ndTrack->getTH1F(), scale2nd);     //
0458 
0459     /// Scale plots with only physical entries (no N0 duplicates)
0460     normalize(dttf_phi_eta_integ_2ndTrack->getTH2F());
0461     normalize(dttf_q_integ_2ndTrack->getTH1F());
0462     normalize(dttf_pt_integ_2ndTrack->getTH1F());
0463     normalize(dttf_phi_integ_2ndTrack->getTH1F());
0464     normalize(dttf_eta_integ_2ndTrack->getTH1F());
0465     normalize(dttf_quality_integ_2ndTrack->getTH1F());
0466     normalize(dttf_quality_summary_2ndTrack->getTH2F());
0467   }
0468 
0469   /// GMT
0470   setGMTsummary(igetter);
0471 }
0472 
0473 //--------------------------------------------------------
0474 void L1TDTTFClient::buildSummaries(DQMStore::IGetter &igetter) {
0475   char hname[100];
0476   int wheelBx[4];        /// needed for bx_integ
0477   int wheelBx2nd[4];     /// needed for bx_summary 2nd
0478   int wheelSumBx[4];     /// needed for bx_integ
0479   int wheelSumBx2nd[4];  /// needed for bx_summary 2nd
0480   int qualities[8];      /// needed for by wheel qualities
0481 
0482   memset(wheelSumBx, 0, 4 * sizeof(int));
0483   memset(wheelSumBx2nd, 0, 4 * sizeof(int));
0484 
0485   /// reset histograms
0486   dttf_eta_integ->Reset();
0487   dttf_q_integ->Reset();
0488   dttf_pt_integ->Reset();
0489   dttf_phi_integ->Reset();
0490   dttf_quality_integ->Reset();
0491   dttf_phi_eta_integ->Reset();
0492   dttf_phi_eta_fine_integ->Reset();
0493   dttf_phi_eta_coarse_integ->Reset();
0494   dttf_q_integ_2ndTrack->Reset();
0495   dttf_pt_integ_2ndTrack->Reset();
0496   dttf_phi_integ_2ndTrack->Reset();
0497   dttf_eta_integ_2ndTrack->Reset();
0498 
0499   /// ????
0500   dttf_quality_integ_2ndTrack->Reset();
0501   dttf_quality_summary_2ndTrack->Reset();
0502 
0503   for (unsigned int wh = 0; wh < 6; ++wh) {
0504     dttf_eta_wheel[wh]->Reset();
0505     dttf_q_wheel[wh]->Reset();
0506     dttf_pt_wheel[wh]->Reset();
0507     dttf_phi_wheel[wh]->Reset();
0508     dttf_quality_wheel[wh]->Reset();
0509     dttf_quality_summary_wheel[wh]->Reset();
0510 
0511     double wheelEtaAll = 0;   /// needed for fine fraction
0512     double wheelEtaFine = 0;  /// needed for fine fraction
0513     memset(wheelBx, 0, 4 * sizeof(int));
0514     memset(wheelBx2nd, 0, 4 * sizeof(int));
0515 
0516     /// for quality
0517     memset(qualities, 0, 8 * sizeof(int));
0518 
0519     ////////////////////////////////////////////////////////
0520     /// PHI vs Eta
0521     ////////////////////////////////////////////////////////
0522     buildPhiEtaPlotOFC(igetter,
0523                        dttf_phi_eta_fine_integ,
0524                        dttf_phi_eta_coarse_integ,
0525                        dttf_phi_eta_integ,
0526                        "%s/dttf_07_phi_vs_etaFine_wh%s",
0527                        "%s/dttf_08_phi_vs_etaCoarse_wh%s",
0528                        wh);
0529 
0530     buildPhiEtaPlotO(igetter, dttf_phi_eta_integ_2ndTrack, "%s/2ND_TRACK_ONLY/dttf_06_phi_vs_eta_wh%s_2ndTrack", wh);
0531 
0532     ////////////////////////////////////////////////////////
0533     /// Loop over sectors
0534     ////////////////////////////////////////////////////////
0535     for (unsigned int sector = 1; sector < 13; ++sector) {
0536       ////////////////////////////////////////////////////////
0537       //// BX by sector
0538       ////////////////////////////////////////////////////////
0539       sprintf(hname, "%s/BX_BySector/dttf_bx_wh%s_se%d", wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector);
0540 
0541       TH1F *bxsector = getTH1F(igetter, hname);
0542       if (!bxsector) {
0543         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D " << std::string(hname);
0544       } else {
0545         for (unsigned int bx = 1; bx < 4; ++bx) {
0546           int bxval = bxsector->GetBinContent(bx);
0547 
0548           if (bx == 2) {
0549             // if ( wh == 2 )
0550             //   dttf_occupancySummary->setBinContent( wh+1, sector, bxval*14 );
0551             // else
0552             //   dttf_occupancySummary->setBinContent( wh+1, sector, bxval );
0553             dttf_occupancySummary->setBinContent(wh + 1, sector, bxval);
0554             dttf_occupancySummary_test->setBinContent(wh + 1, sector, bxval);
0555             dttf_nTracks_wheel[wh]->setBinContent(sector, bxval);
0556           }
0557           wheelBx[bx] += bxval;
0558           dttf_bx_wheel_summary[wh]->setBinContent(sector, bx, bxval);
0559         }
0560       }
0561 
0562       ////////////////////////////////////////////////////////
0563       //// BX 2nd by sector
0564       ////////////////////////////////////////////////////////
0565       sprintf(hname,
0566               "%s/BX_BySector/2ND_TRACK_ONLY/dttf_bx_2ndTrack_wh%s_se%d",
0567               wheelpath_[wh].c_str(),
0568               wheel_[wh].c_str(),
0569               sector);
0570 
0571       TH1F *bxsector2nd = getTH1F(igetter, hname);
0572       if (!bxsector2nd) {
0573         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D " << std::string(hname);
0574       } else {
0575         for (unsigned int bx = 1; bx < 4; ++bx) {
0576           int bxval = bxsector2nd->GetBinContent(bx);
0577 
0578           if (bx == 2) {
0579             dttf_2ndTrack_Summary->setBinContent(wh + 1, sector, bxval);
0580             dttf_occupancySummary_2ndTrack->setBinContent(wh + 1, sector, bxval);
0581             dttf_nTracks_wheel_2ndTrack[wh]->setBinContent(sector, bxval);
0582           }
0583           wheelBx2nd[bx] += bxval;
0584           dttf_bx_wheel_summary_2ndTrack[wh]->setBinContent(sector, bx, bxval);
0585         }
0586       }
0587 
0588       ////////////////////////////////////////////////////////
0589       /// Charge by sector
0590       ////////////////////////////////////////////////////////
0591       sprintf(hname, "%s/Charge/dttf_charge_wh%s_se%d", wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector);
0592       TH1F *tmp = getTH1F(igetter, hname);
0593       if (!tmp) {
0594         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D " << std::string(hname);
0595       } else {
0596         dttf_q_integ->getTH1F()->Add(tmp);
0597         dttf_q_wheel[wh]->getTH1F()->Add(tmp);
0598       }
0599 
0600       ////////////////////////////////////////////////////////
0601       /// PT by sector
0602       ////////////////////////////////////////////////////////
0603       sprintf(hname, "%s/PT/dttf_pt_wh%s_se%d", wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector);
0604       tmp = getTH1F(igetter, hname);
0605       if (!tmp) {
0606         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D " << std::string(hname);
0607       } else {
0608         dttf_pt_integ->getTH1F()->Add(tmp);
0609         dttf_pt_wheel[wh]->getTH1F()->Add(tmp);
0610       }
0611 
0612       ////////////////////////////////////////////////////////
0613       /// Phi by sector
0614       ////////////////////////////////////////////////////////
0615       sprintf(hname, "%s/Phi/dttf_phi_wh%s_se%d", wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector);
0616       tmp = getTH1F(igetter, hname);
0617       if (!tmp) {
0618         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D " << std::string(hname);
0619       } else {
0620         dttf_phi_integ->getTH1F()->Add(tmp);
0621         dttf_phi_wheel[wh]->getTH1F()->Add(tmp);
0622       }
0623 
0624       ////////////////////////////////////////////////////////
0625       /// Quality by sector
0626       ////////////////////////////////////////////////////////
0627       double highQual = 0;     /// needed for high quality plot
0628       double denHighQual = 0;  /// needed for high quality plot (denominator)
0629       sprintf(hname, "%s/Quality/dttf_qual_wh%s_se%d", wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector);
0630       tmp = getTH1F(igetter, hname);
0631       if (!tmp) {
0632         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D " << std::string(hname);
0633       } else {
0634         dttf_quality_wheel[wh]->getTH1F()->Add(tmp);
0635 
0636         for (unsigned int qual = 1; qual < 4; ++qual) {
0637           double bincontent = tmp->GetBinContent(qual);
0638           qualities[qual] += bincontent;
0639           denHighQual += bincontent;
0640           dttf_quality_summary_wheel[wh]->setBinContent(sector, qual, bincontent);
0641         }
0642 
0643         for (unsigned int qual = 4; qual < 8; ++qual) {
0644           double bincontent = tmp->GetBinContent(qual);
0645           qualities[qual] += bincontent;
0646           dttf_quality_summary_wheel[wh]->setBinContent(sector, qual, bincontent);
0647           denHighQual += bincontent;
0648           highQual += bincontent;
0649         }
0650       }
0651       if (denHighQual > 0)
0652         highQual /= denHighQual;
0653       dttf_highQual_Summary->setBinContent(wh + 1, sector, highQual);
0654 
0655       ////////////////////////////////////////////////////////
0656       /// eta fine by sector
0657       ////////////////////////////////////////////////////////
0658       sprintf(hname, "%s/Eta/dttf_eta_wh%s_se%d", wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector);
0659       tmp = getTH1F(igetter, hname);
0660       if (!tmp) {
0661         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D " << std::string(hname);
0662       } else {
0663         dttf_eta_integ->getTH1F()->Add(tmp);
0664         dttf_eta_wheel[wh]->getTH1F()->Add(tmp);
0665       }
0666 
0667       ////////////////////////////////////////////////////////
0668       /// eta fine fraction by sector
0669       ////////////////////////////////////////////////////////
0670       sprintf(hname,
0671               "%s/EtaFineFraction/dttf_etaFine_fraction_wh%s_se%d",
0672               wheelpath_[wh].c_str(),
0673               wheel_[wh].c_str(),
0674               sector);
0675       tmp = getTH1F(igetter, hname);
0676       if (!tmp) {
0677         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D " << std::string(hname);
0678       } else {
0679         double fine = tmp->GetBinContent(1);
0680         double coarse = tmp->GetBinContent(2);
0681         double tot = fine + coarse;
0682         wheelEtaAll += tot;
0683         wheelEtaFine += fine;
0684         if (tot > 0) {
0685           dttf_fine_fraction_wh[wh]->setBinContent(sector, fine / tot);
0686         }
0687       }
0688     }
0689 
0690     ////////////////////////////////////////////////////////
0691     /// still eta: fraction by wheel
0692     ////////////////////////////////////////////////////////
0693     if (wheelEtaAll > 0) {
0694       dttf_eta_fine_fraction->setBinContent(wh + 1, wheelEtaFine / wheelEtaAll);
0695     }
0696 
0697     ////////////////////////////////////////////////////////
0698     /// integ summary
0699     ////////////////////////////////////////////////////////
0700     dttf_nTracks_integ->setBinContent(wh + 1, wheelBx[2]);
0701     dttf_nTracks_integ_2ndTrack->setBinContent(wh + 1, wheelBx2nd[2]);
0702 
0703     ////////////////////////////////////////////////////////
0704     /// still bx: wheel summary & inclusive
0705     ////////////////////////////////////////////////////////
0706     for (unsigned int bx = 1; bx < 4; ++bx) {
0707       dttf_bx_wheel_integ[wh]->setBinContent(bx, wheelBx[bx]);
0708       dttf_bx_summary->setBinContent(wh + 1, bx, wheelBx[bx]);
0709       wheelSumBx[bx] += wheelBx[bx];
0710 
0711       dttf_bx_wheel_integ_2ndTrack[wh]->setBinContent(bx, wheelBx2nd[bx]);
0712       dttf_bx_summary_2ndTrack->setBinContent(wh + 1, bx, wheelBx2nd[bx]);
0713       wheelSumBx2nd[bx] += wheelBx2nd[bx];
0714     }
0715 
0716     ////////////////////////////////////////////////////////
0717     /// by wheel quality: integ summary
0718     ////////////////////////////////////////////////////////
0719     for (unsigned int qual = 1; qual < 8; ++qual) {
0720       dttf_quality_summary->setBinContent(wh + 1, qual, qualities[qual]);
0721       dttf_quality_integ->getTH1F()->AddBinContent(qual, qualities[qual]);
0722     }
0723 
0724     ////////////////////////////////////////////////////////
0725     /// by wheel rescaling bx by wheel and number of tracks distribution
0726     ////////////////////////////////////////////////////////
0727     normalize(dttf_bx_wheel_summary[wh]->getTH2F());
0728     normalize(dttf_bx_wheel_summary_2ndTrack[wh]->getTH2F());
0729     normalize(dttf_nTracks_wheel[wh]->getTH1F());
0730     normalize(dttf_nTracks_wheel_2ndTrack[wh]->getTH1F());
0731     normalize(dttf_quality_summary_wheel[wh]->getTH2F());
0732     normalize(dttf_quality_wheel[wh]->getTH1F());
0733     normalize(dttf_eta_wheel[wh]->getTH1F());
0734     normalize(dttf_q_wheel[wh]->getTH1F());
0735     normalize(dttf_pt_wheel[wh]->getTH1F());
0736     normalize(dttf_phi_wheel[wh]->getTH1F());
0737 
0738     ////////////////////////////////////////////////////////
0739     /// by wheel rescaling bx distributions
0740     ////////////////////////////////////////////////////////
0741     double scale = wheelBx[2];
0742     if (scale > 0) {
0743       scale = 1 / scale;
0744       normalize(dttf_bx_wheel_integ[wh]->getTH1F(), scale);
0745     }
0746 
0747     scale = wheelBx2nd[2];
0748     if (scale > 0) {
0749       scale = 1 / scale;
0750       normalize(dttf_bx_wheel_integ_2ndTrack[wh]->getTH1F(), scale);
0751     }
0752 
0753     ////////////////////////////////////////////////////////
0754     ////////////////////////////////////////////////////////
0755     /// MORE ON 2ND TRACKS
0756     ////////////////////////////////////////////////////////
0757     ////////////////////////////////////////////////////////
0758 
0759     ////////////////////////////////////////////////////////
0760     /// eta by sector
0761     ////////////////////////////////////////////////////////
0762     sprintf(hname, "%s/2ND_TRACK_ONLY/dttf_07_eta_wh%s_2ndTrack", wheelpath_[wh].c_str(), wheel_[wh].c_str());
0763 
0764     TH1F *tmp = getTH1F(igetter, hname);
0765     if (!tmp) {
0766       edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D " << std::string(hname);
0767     } else {
0768       dttf_eta_integ_2ndTrack->getTH1F()->Add(tmp);
0769     }
0770 
0771     ////////////////////////////////////////////////////////
0772     /// Phi by wheel 2nd Tracks
0773     ////////////////////////////////////////////////////////
0774     sprintf(hname, "%s/2ND_TRACK_ONLY/dttf_08_phi_wh%s_2ndTrack", wheelpath_[wh].c_str(), wheel_[wh].c_str());
0775     tmp = getTH1F(igetter, hname);
0776     if (!tmp) {
0777       edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D " << std::string(hname);
0778     } else {
0779       dttf_phi_integ_2ndTrack->getTH1F()->Add(tmp);
0780     }
0781 
0782     ////////////////////////////////////////////////////////
0783     /// PT by wheel 2nd Tracks
0784     ////////////////////////////////////////////////////////
0785     sprintf(hname, "%s/2ND_TRACK_ONLY/dttf_09_pt_wh%s_2ndTrack", wheelpath_[wh].c_str(), wheel_[wh].c_str());
0786     tmp = getTH1F(igetter, hname);
0787     if (!tmp) {
0788       edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D " << std::string(hname);
0789     } else {
0790       dttf_pt_integ_2ndTrack->getTH1F()->Add(tmp);
0791     }
0792 
0793     ////////////////////////////////////////////////////////
0794     /// Charge by wheel 2nd Tracks
0795     ////////////////////////////////////////////////////////
0796     sprintf(hname, "%s/2ND_TRACK_ONLY/dttf_10_charge_wh%s_2ndTrack", wheelpath_[wh].c_str(), wheel_[wh].c_str());
0797     tmp = getTH1F(igetter, hname);
0798     if (!tmp) {
0799       edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D " << std::string(hname);
0800     } else {
0801       dttf_q_integ_2ndTrack->getTH1F()->Add(tmp);
0802     }
0803 
0804     ////////////////////////////////////////////////////////
0805     /// Quality by wheel 2nd Tracks
0806     ////////////////////////////////////////////////////////
0807     sprintf(hname, "%s/2ND_TRACK_ONLY/dttf_04_quality_wh%s_2ndTrack", wheelpath_[wh].c_str(), wheel_[wh].c_str());
0808     tmp = getTH1F(igetter, hname);
0809     if (!tmp) {
0810       edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D " << std::string(hname);
0811     } else {
0812       for (unsigned int qual = 1; qual < 8; ++qual) {
0813         double binqual = tmp->GetBinContent(qual);
0814         dttf_quality_integ_2ndTrack->getTH1F()->AddBinContent(qual, binqual);
0815         dttf_quality_summary_2ndTrack->setBinContent(wh + 1, qual, binqual);
0816       }
0817     }
0818   }
0819 
0820   ////////////////////////////////////////////////////////
0821   /// still bx: scaling integrals
0822   ////////////////////////////////////////////////////////
0823   for (unsigned int bx = 1; bx < 4; ++bx) {
0824     dttf_bx_integ->setBinContent(bx, wheelSumBx[bx]);
0825     dttf_bx_integ_2ndTrack->setBinContent(bx, wheelSumBx2nd[bx]);
0826   }
0827 
0828   ////////////////////////////////////////////////////////
0829   /// rescaling bx distributions
0830   ////////////////////////////////////////////////////////
0831   double scale = wheelSumBx[2];
0832   if (scale > 0) {
0833     scale = 1. / scale;
0834     normalize(dttf_bx_integ->getTH1F(), scale);
0835   }
0836 
0837   scale = wheelSumBx2nd[2];
0838   if (scale > 0) {
0839     scale = 1. / scale;
0840     normalize(dttf_bx_integ_2ndTrack->getTH1F(), scale);
0841   }
0842 }
0843 
0844 //--------------------------------------------------------
0845 void L1TDTTFClient::setGMTsummary(DQMStore::IGetter &igetter) {
0846   char hname[60];
0847   sprintf(hname, "%s/dttf_tracks_with_gmt_match", gmtpath_.c_str());
0848   TH2F *gmt_match = getTH2F(igetter, hname);
0849   if (!gmt_match) {
0850     edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D " << std::string(hname);
0851     return;
0852   }
0853 
0854   sprintf(hname, "%s/dttf_tracks_without_gmt_match", gmtpath_.c_str());
0855   TH2F *gmt_missed = getTH2F(igetter, hname);
0856   if (!gmt_missed) {
0857     edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D " << std::string(hname);
0858     return;
0859   }
0860 
0861   sprintf(hname, "%s/dttf_missing_tracks_in_gmt", gmtpath_.c_str());
0862   TH2F *gmt_ghost = getTH2F(igetter, hname);
0863   if (!gmt_ghost) {
0864     edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D " << std::string(hname);
0865     return;
0866   }
0867 
0868   int match = gmt_match->Integral();
0869   int missed = gmt_missed->Integral();
0870   int ghost = gmt_ghost->Integral();
0871   float tot = match + missed + ghost;
0872   if (tot > 0) {
0873     double val = ghost / tot;
0874     dttf_gmt_matching->setBinContent(1, val);
0875     val = match / tot;
0876     dttf_gmt_matching->setBinContent(2, val);
0877     val = missed / tot;
0878     dttf_gmt_matching->setBinContent(3, val);
0879   }
0880 }
0881 
0882 //--------------------------------------------------------
0883 TH1F *L1TDTTFClient::getTH1F(DQMStore::IGetter &igetter, const char *hname) {
0884   MonitorElement *me = igetter.get(hname);
0885   if (!me) {
0886     edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get ME " << std::string(hname);
0887     return nullptr;
0888   }
0889 
0890   return me->getTH1F();
0891 }
0892 
0893 //--------------------------------------------------------
0894 TH2F *L1TDTTFClient::getTH2F(DQMStore::IGetter &igetter, const char *hname) {
0895   MonitorElement *me = igetter.get(hname);
0896   if (!me) {
0897     edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get ME " << std::string(hname);
0898     return nullptr;
0899   }
0900 
0901   return me->getTH2F();
0902 }
0903 
0904 //--------------------------------------------------------
0905 
0906 //--------------------------------------------------------
0907 void L1TDTTFClient::buildHighQualityPlot(DQMStore::IGetter &igetter,
0908                                          TH2F *occupancySummary,
0909                                          MonitorElement *highQual_Summary,
0910                                          const std::string &path) {
0911   char hname[150];
0912 
0913   ////////////////////////////////////////////////////////
0914   /// high quality  TOBE IMPROVED
0915   ////////////////////////////////////////////////////////
0916   for (unsigned int wh = 0; wh < 6; ++wh) {
0917     sprintf(hname, path.c_str(), wheelpath_[wh].c_str(), wheel_[wh].c_str());
0918 
0919     TH2F *quality = getTH2F(igetter, hname);
0920     if (!quality) {
0921       edm::LogError("L1TDTTFClient::buildHighQualityPlot") << "Failed to get TH2F " << std::string(hname);
0922     } else {
0923       for (unsigned int sec = 1; sec < 13; ++sec) {
0924         double denHighQual = occupancySummary->GetBinContent(wh + 1, sec);
0925         double val = 0;
0926         if (denHighQual > 0) {
0927           for (unsigned int qual = 4; qual < 8; ++qual) {
0928             val += quality->GetBinContent(qual, sec);
0929           }
0930           val /= denHighQual;
0931         }
0932         highQual_Summary->setBinContent(wh + 1, sec, val);
0933       }
0934     }
0935   }
0936 }
0937 
0938 //--------------------------------------------------------
0939 void L1TDTTFClient::buildPhiEtaPlotOFC(DQMStore::IGetter &igetter,
0940                                        MonitorElement *phi_eta_fine_integ,
0941                                        MonitorElement *phi_eta_coarse_integ,
0942                                        MonitorElement *phi_eta_integ,
0943                                        const std::string &path_fine,
0944                                        const std::string &path_coarse,
0945                                        int wh) {
0946   char hname[150];
0947   sprintf(hname, path_fine.c_str(), wheelpath_[wh].c_str(), wheel_[wh].c_str());
0948 
0949   TH2F *phi_vs_eta_fine = getTH2F(igetter, hname);
0950   if (!phi_vs_eta_fine) {
0951     edm::LogError("L1TDTTFClient::buildPhiEtaPloOtFC") << "Failed to get TH1D " << std::string(hname);
0952   }
0953 
0954   sprintf(hname, path_coarse.c_str(), wheelpath_[wh].c_str(), wheel_[wh].c_str());
0955   TH2F *phi_vs_eta_coarse = getTH2F(igetter, hname);
0956   if (!phi_vs_eta_coarse) {
0957     edm::LogError("L1TDTTFClient::buildPhiEtaPlotOFC") << "Failed to get TH1D " << std::string(hname);
0958   }
0959 
0960   if (!phi_vs_eta_fine || !phi_vs_eta_coarse) {
0961     return;
0962   }
0963 
0964   for (unsigned int phi = 1; phi < 145; ++phi) {
0965     float start = 0;
0966     int nbins = 0;
0967     switch (wh) {
0968       case 0:
0969         start = 0;
0970         nbins = 18;
0971         break;  // N2
0972       case 1:
0973         start = 8;
0974         nbins = 20;
0975         break;  // N1
0976       case 2:
0977         start = 22;
0978         nbins = 10;
0979         break;  // N0
0980       case 3:
0981         start = 22;
0982         nbins = 20;
0983         break;  // P0
0984       case 4:
0985         start = 36;
0986         nbins = 20;
0987         break;  // P1
0988       case 5:
0989         start = 46;
0990         nbins = 18;
0991         break;  // P2
0992       default:
0993         start = 0;
0994         nbins = 0;
0995         break;  // BOH
0996     }
0997 
0998     for (int eta = 1; eta <= nbins; ++eta) {
0999       double setbin = eta + start;
1000 
1001       double valfine = phi_vs_eta_fine->GetBinContent(eta, phi) + phi_eta_fine_integ->getBinContent(setbin, phi);
1002 
1003       double valcoarse = phi_vs_eta_coarse->GetBinContent(eta, phi) + phi_eta_coarse_integ->getBinContent(setbin, phi);
1004 
1005       phi_eta_fine_integ->setBinContent(setbin, phi, valfine);
1006       phi_eta_coarse_integ->setBinContent(setbin, phi, valcoarse);
1007       phi_eta_integ->setBinContent(setbin, phi, valfine + valcoarse);
1008     }
1009 
1010     // double underflow_f = phi_vs_eta_fine->GetBinContent( 0, phi )
1011     //   + phi_eta_fine_integ->getBinContent( 1, phi );
1012     // phi_eta_fine_integ->setBinContent( 1, phi, underflow_f );
1013     //
1014     // double underflow_c = phi_vs_eta_coarse->GetBinContent( 0, phi )
1015     //   + phi_eta_coarse_integ->getBinContent( 1, phi );
1016     // phi_eta_coarse_integ->setBinContent( 1, phi, underflow_c );
1017     //
1018     // double overflow_f = phi_vs_eta_fine->GetBinContent( nbins+1, phi )
1019     //   + phi_eta_fine_integ->getBinContent( 64 );
1020     // phi_eta_fine_integ->setBinContent( 64, phi, overflow_f );
1021     //
1022     // double overflow_c = phi_vs_eta_coarse->GetBinContent( nbins+1, phi )
1023     //   + phi_eta_coarse_integ->getBinContent( 64, phi );
1024     // phi_eta_coarse_integ->setBinContent( 64, phi, overflow_c );
1025     //
1026     // double underflow = underflow_f + underflow_c;
1027     // phi_eta_integ->setBinContent( 1, phi, underflow );
1028     //
1029     // double overflow = overflow_f + overflow_c;
1030     // phi_eta_integ->setBinContent( 64, phi, overflow );
1031   }
1032 }
1033 
1034 //--------------------------------------------------------
1035 void L1TDTTFClient::buildPhiEtaPlotO(DQMStore::IGetter &igetter,
1036                                      MonitorElement *phi_eta_integ,
1037                                      const std::string &path,
1038                                      int wh) {
1039   char hname[100];
1040   sprintf(hname, path.c_str(), wheelpath_[wh].c_str(), wheel_[wh].c_str());
1041 
1042   TH2F *phi_vs_eta = getTH2F(igetter, hname);
1043   if (!phi_vs_eta) {
1044     edm::LogError("L1TDTTFClient::buildPhiEtaPlotO:ME") << "Failed to get TH1D " << std::string(hname);
1045   } else {
1046     for (unsigned int phi = 1; phi < 145; ++phi) {
1047       float start = 0;
1048       int nbins = 0;
1049       switch (wh) {
1050         case 0:
1051           start = 0;
1052           nbins = 18;
1053           break;  // N2
1054         case 1:
1055           start = 8;
1056           nbins = 20;
1057           break;  // N1
1058         case 2:
1059           start = 22;
1060           nbins = 10;
1061           break;  // N0
1062         case 3:
1063           start = 22;
1064           nbins = 20;
1065           break;  // P0
1066         case 4:
1067           start = 36;
1068           nbins = 20;
1069           break;  // P1
1070         case 5:
1071           start = 46;
1072           nbins = 18;
1073           break;  // P2
1074         default:
1075           start = 0;
1076           nbins = 0;
1077           break;  // BOH
1078       }
1079 
1080       for (int eta = 1; eta <= nbins; ++eta) {
1081         double setbin = eta + start;
1082         double val = phi_vs_eta->GetBinContent(eta, phi) + phi_eta_integ->getBinContent(setbin, phi);
1083         phi_eta_integ->setBinContent(setbin, phi, val);
1084       }
1085 
1086       double underflow = phi_vs_eta->GetBinContent(0, phi) + phi_eta_integ->getBinContent(1, phi);
1087       phi_eta_integ->setBinContent(1, phi, underflow);
1088 
1089       double overflow = phi_vs_eta->GetBinContent(nbins + 1, phi) + phi_eta_integ->getBinContent(64);
1090       phi_eta_integ->setBinContent(64, phi, overflow);
1091     }
1092   }
1093 }
1094 
1095 // //--------------------------------------------------------
1096 // void L1TDTTFClient::buildPhiEtaPlot( MonitorElement * phi_eta_integ,
1097 //                   const std::string & path ,
1098 //                   int wh)
1099 // {
1100 //   char hname[60];
1101 //   sprintf( hname, "%s/dttf_phi_eta_wh%s",
1102 //     wheelpath_[wh].c_str(), wheel_[wh].c_str() );
1103 //
1104 //   TH2F * phi_vs_eta = getTH2F(hname);
1105 //   if ( ! phi_vs_eta ) {
1106 //     edm::LogError("L1TDTTFClient::buildPhiEtaPlot:ME") << "Failed to get TH1D "
1107 //                         << std::string(hname);
1108 //   } else {
1109 //
1110 //
1111 //     for ( unsigned int phi = 1; phi < 145 ; ++phi ) {
1112 //       for ( unsigned int eta = 1; eta < 65 ; ++eta ) {
1113 //  double val = phi_vs_eta->GetBinContent( eta, phi )
1114 //    + dttf_phi_eta_integ->getBinContent( eta, phi );
1115 //  dttf_phi_eta_integ->setBinContent( eta, phi, val );
1116 //       }
1117 //
1118 //     }
1119 //   }
1120 // }
1121 //
1122 //
1123 // //--------------------------------------------------------
1124 // void L1TDTTFClient::buildPhiEtaPlotFC( MonitorElement * phi_eta_fine_integ,
1125 //                     MonitorElement * phi_eta_coarse_integ,
1126 //                     MonitorElement * phi_eta_integ,
1127 //                     const std::string & path_fine,
1128 //                     const std::string & path_coarse,
1129 //                     int wh )
1130 // {
1131 //
1132 //   char hname[60];
1133 //
1134 //   sprintf( hname, path_fine.c_str(),
1135 //     wheelpath_[wh].c_str(), wheel_[wh].c_str() );
1136 //   TH2F * phi_vs_eta_fine = getTH2F(hname);
1137 //   if ( ! phi_vs_eta_fine ) {
1138 //     edm::LogError("L1TDTTFClient::buildPhiEtaPlotFC")
1139 //       << "Failed to get TH1D " << std::string(hname);
1140 //   }
1141 //
1142 //
1143 //   sprintf( hname, path_coarse.c_str(),
1144 //     wheelpath_[wh].c_str(), wheel_[wh].c_str() );
1145 //   TH2F * phi_vs_eta_coarse = getTH2F(hname);
1146 //   if ( ! phi_vs_eta_coarse ) {
1147 //     edm::LogError("L1TDTTFClient::buildPhiEtaPlotFC")
1148 //       << "Failed to get TH1D " << std::string(hname);
1149 //   }
1150 //
1151 //   if ( ! phi_vs_eta_fine || ! phi_vs_eta_coarse ) {
1152 //     return;
1153 //   }
1154 //
1155 //   for ( unsigned int phi = 1; phi < 145 ; ++phi ) {
1156 //     for ( unsigned int eta = 1; eta < 65 ; ++eta ) {
1157 //
1158 //       double valfine = phi_vs_eta_fine->GetBinContent( eta, phi )
1159 //  + dttf_phi_eta_fine_integ->getBinContent( eta, phi );
1160 //       dttf_phi_eta_fine_integ->setBinContent( eta, phi, valfine );
1161 //       double valcoarse = phi_vs_eta_coarse->GetBinContent( eta, phi )
1162 //  + dttf_phi_eta_coarse_integ->getBinContent( eta, phi );
1163 //       dttf_phi_eta_coarse_integ->setBinContent( eta, phi, valcoarse );
1164 //
1165 //       dttf_phi_eta_integ->setBinContent( eta, phi, valfine + valcoarse );
1166 //
1167 //     }
1168 //
1169 //   }
1170 // }
1171 
1172 //--------------------------------------------------------
1173 void L1TDTTFClient::setWheelLabel(MonitorElement *me) {
1174   me->setAxisTitle("Wheel", 1);
1175   me->setBinLabel(1, "N2", 1);
1176   me->setBinLabel(2, "N1", 1);
1177   me->setBinLabel(3, "N0", 1);
1178   me->setBinLabel(4, "P0", 1);
1179   me->setBinLabel(5, "P1", 1);
1180   me->setBinLabel(6, "P2", 1);
1181 }
1182 
1183 //--------------------------------------------------------
1184 void L1TDTTFClient::setQualLabel(MonitorElement *me, int axis) {
1185   if (axis == 1)
1186     me->setAxisTitle("Quality", axis);
1187   me->setBinLabel(1, "T34", axis);
1188   me->setBinLabel(2, "T23/24", axis);
1189   me->setBinLabel(3, "T12/13/14", axis);
1190   me->setBinLabel(4, "T234", axis);
1191   me->setBinLabel(5, "T134", axis);
1192   me->setBinLabel(6, "T123/124", axis);
1193   me->setBinLabel(7, "T1234", axis);
1194 }