CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DQM/L1TMonitorClient/src/L1TDTTFClient.cc

Go to the documentation of this file.
00001 /*
00002  * \file L1TDTTFClient.cc
00003  *
00004  * $Date: 2010/11/14 14:02:42 $
00005  * $Revision: 1.6 $
00006  * \author G. Codispoti
00007  *
00008  */
00009 
00010 
00011 #include "DQM/L1TMonitorClient/interface/L1TDTTFClient.h"
00012 
00014 #include "FWCore/ServiceRegistry/interface/Service.h"
00015 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00016 #include "DQMServices/Core/interface/DQMStore.h"
00017 #include "DQMServices/Core/interface/MonitorElement.h"
00018 #include "FWCore/Framework/interface/MakerMacros.h"
00019 
00020 
00021 L1TDTTFClient::L1TDTTFClient(const edm::ParameterSet& ps)
00022   : l1tdttffolder_ ( ps.getUntrackedParameter<std::string> ("l1tSourceFolder", "L1T/L1TDTTF") ),
00023     dttfSource_( ps.getParameter< edm::InputTag >("dttfSource") ),
00024     online_( ps.getUntrackedParameter<bool>("online", true) ),
00025     resetafterlumi_( ps.getUntrackedParameter<int>("resetAfterLumi", 3) ),
00026     counterLS_(0), occupancy_r_(0)
00027 {
00028   edm::LogInfo( "L1TDTTFClient");
00029 }
00030 
00031 
00032 //--------------------------------------------------------
00033 L1TDTTFClient::~L1TDTTFClient(){
00034   edm::LogInfo("L1TDTTFClient")<<"[L1TDTTFClient]: ending... ";
00035 }
00036 
00037 
00038 //--------------------------------------------------------
00039 void L1TDTTFClient::beginJob(void)
00040 {
00041 
00042   edm::LogInfo("L1TDTTFClient")<<"[L1TDTTFClient]: Begin Job";
00043 
00045   dbe_ = edm::Service<DQMStore>().operator->();
00046 
00047   wheelpath_[0] = l1tdttffolder_ + "/02-WHEEL_N2";
00048   wheelpath_[1] = l1tdttffolder_ + "/03-WHEEL_N1";
00049   wheelpath_[2] = l1tdttffolder_ + "/04-WHEEL_N0";
00050   wheelpath_[3] = l1tdttffolder_ + "/05-WHEEL_P0";
00051   wheelpath_[4] = l1tdttffolder_ + "/06-WHEEL_P1";
00052   wheelpath_[5] = l1tdttffolder_ + "/07-WHEEL_P2";
00053 
00054   wheel_[0] = "N2";
00055   wheel_[1] = "N1";
00056   wheel_[2] = "N0";
00057   wheel_[3] = "P0";
00058   wheel_[4] = "P1";
00059   wheel_[5] = "P2";
00060 
00061   inclusivepath_ = l1tdttffolder_ + "/01-INCLUSIVE";
00062   gmtpath_ = l1tdttffolder_ + "/08-GMT_MATCH";
00063 
00065   char hname[100];//histo name
00066   char mename[100];//ME name
00067 
00069   dbe_->setCurrentFolder( inclusivepath_ );
00070 
00072   sprintf(hname, "dttf_02_nTracks");
00073   sprintf(mename, "DTTF Tracks by Wheel");
00074   dttf_nTracks_integ = dbe_->book1D(hname, mename, 6, 0, 6);
00075   setWheelLabel( dttf_nTracks_integ );
00076 
00078   sprintf(hname, "dttf_03_tracks_occupancy_summary");
00079   sprintf(mename, "DTTF Tracks Occupancy");
00080   dttf_occupancySummary = dbe_->book2D( hname, mename, 6, 0, 6, 12, 1, 13 );
00081   setWheelLabel( dttf_occupancySummary );
00082   dttf_occupancySummary->setAxisTitle("Sector", 2);
00083 
00085 
00087   sprintf(hname, "dttf_05_bx_occupancy");
00088   sprintf(mename, "DTTF Tracks BX Distribution by Wheel");
00089   dttf_bx_summary = dbe_->book2D( hname, mename, 6, 0, 6, 3, -1, 2 );
00090   setWheelLabel( dttf_bx_summary );
00091   dttf_bx_summary->setAxisTitle("BX", 2 );
00092 
00094   sprintf(hname, "dttf_06_bx");
00095   sprintf(mename, "DTTF Tracks BX w.r.t. Tracks with BX=0");
00096   dttf_bx_integ = dbe_->book1D( hname, mename, 3, -1.5, 1.5 );
00097   dttf_bx_integ->setAxisTitle("BX", 1);
00098 
00100   sprintf(hname, "dttf_07_quality");
00101   sprintf(mename, "DTTF Tracks Quality distribution");
00102   dttf_quality_integ = dbe_->book1D(hname, mename, 7, 1, 8);
00103   setQualLabel( dttf_quality_integ, 1);
00104 
00106   sprintf(hname, "dttf_08_quality_occupancy");
00107   sprintf(mename, "DTTF Tracks Quality distribution by Wheel");
00108   dttf_quality_summary = dbe_->book2D( hname, mename, 6, 0, 6, 7, 1, 8 );
00109   dttf_quality_summary->setAxisTitle("Wheel", 1);
00110   setQualLabel( dttf_quality_summary, 2);
00111   setWheelLabel( dttf_quality_summary );
00112 
00114   sprintf(hname, "dttf_09_highQuality_Tracks");
00115   sprintf(mename, "Fraction of DTTF Tracks with Quality>3");
00116   dttf_highQual_Summary = dbe_->book2D( hname, mename, 6, 0, 6, 12, 1, 13 );
00117   setWheelLabel( dttf_highQual_Summary );
00118   dttf_highQual_Summary->setAxisTitle("Sector", 2);
00119 
00120 
00122   sprintf(hname, "dttf_10_phi_vs_etaCoarse");
00123   sprintf(mename, "#eta-#phi DTTF Tracks occupancy (coarse #eta only, packed values)");
00124   dttf_phi_eta_coarse_integ = dbe_->book2D( hname, mename, 64, 0, 64,
00125                                             144, -6, 138. );
00126   dttf_phi_eta_coarse_integ->setAxisTitle("#eta", 1);
00127   dttf_phi_eta_coarse_integ->setAxisTitle("#phi", 2);
00128 
00130   sprintf(hname, "dttf_11_phi_vs_etaFine");
00131   sprintf(mename, "#eta-#phi DTTF Tracks occupancy (fine #eta only, packed values)");
00132   dttf_phi_eta_fine_integ = dbe_->book2D( hname, mename, 64, 0, 64,
00133                                           144, -6, 138. );
00134   dttf_phi_eta_fine_integ->setAxisTitle("#eta", 1);
00135   dttf_phi_eta_fine_integ->setAxisTitle("#phi", 2);
00136 
00138   sprintf(hname, "dttf_12_phi_vs_eta");
00139   sprintf(mename, "#eta-#phi DTTF Tracks occupancy");
00140   dttf_phi_eta_integ = dbe_->book2D( hname, mename, 64, -1.2, 1.2,
00141                                      144, -15, 345. );
00142   dttf_phi_eta_integ->setAxisTitle("#eta", 1);
00143   dttf_phi_eta_integ->setAxisTitle("#phi", 2);
00144 
00146   sprintf(hname, "dttf_13_eta_fine_fraction");
00147   sprintf(mename, "Fraction of DTTF Tracks with Fine #eta Assignment");
00148   dttf_eta_fine_fraction = dbe_->book1D( hname, mename, 6, 0, 6 );
00149   setWheelLabel(dttf_eta_fine_fraction);
00150   dttf_eta_fine_fraction->setAxisTitle("", 2);
00151 
00153 
00155   sprintf(hname, "dttf_14_eta");
00156   sprintf(mename, "DTTF Tracks #eta distribution (Packed values)");
00157   dttf_eta_integ = dbe_->book1D(hname, mename, 64, -0.5, 63.5);
00158   dttf_eta_integ->setAxisTitle("#eta", 1);
00159 
00161   sprintf(hname, "dttf_15_phi");
00162   sprintf(mename, "DTTF Tracks Phi distribution (Packed values)");
00163   dttf_phi_integ = dbe_->book1D(hname, mename, 144, -6, 138. );
00164   dttf_phi_integ->setAxisTitle("#phi", 1);
00165 
00167   sprintf(hname, "dttf_16_pt");
00168   sprintf(mename, "DTTF Tracks p_{T} distribution (Packed values)");
00169   dttf_pt_integ  = dbe_->book1D(hname, mename, 32, -0.5, 31.5);
00170   dttf_pt_integ->setAxisTitle("p_{T}", 1);
00171 
00173   sprintf(hname, "dttf_17_charge");
00174   sprintf(mename, "DTTF Tracks Charge distribution");
00175   dttf_q_integ = dbe_->book1D(hname, mename, 2, -0.5, 1.5);
00176   dttf_q_integ->setAxisTitle("Charge", 1);
00177 
00178 
00179 
00181   sprintf(hname, "dttf_18_2ndTrack_occupancy_summary");
00182   sprintf(mename, "DTTF 2nd Tracks occupancy w.r.t. Tracks with BX=0");
00183   dttf_2ndTrack_Summary = dbe_->book2D( hname, mename, 6, 0, 6, 12, 1, 13 );
00184   setWheelLabel( dttf_2ndTrack_Summary );
00185 
00186 
00187 
00191   dbe_->setCurrentFolder( gmtpath_ );
00192   sprintf(hname, "dttf_gmt_fract_matching" );
00193   sprintf(mename, "Fraction of DTTF tracks matching with GMT tracks" );
00194   dttf_gmt_matching = dbe_->book1D( hname, mename, 3, 1, 4);
00195   dttf_gmt_matching->setBinLabel(1, "GMT Only", 1);
00196   dttf_gmt_matching->setBinLabel(2, "Matching", 1);
00197   dttf_gmt_matching->setBinLabel(3, "DTTF Only", 1);
00198 
00199 
00203   dbe_->setCurrentFolder( inclusivepath_ + "/2ND_TRACK_ONLY");
00204 
00206   sprintf(hname, "dttf_01_nTracks_2ndTrack");
00207   sprintf(mename, "DTTF 2nd Tracks per Wheel distribution");
00208   dttf_nTracks_integ_2ndTrack = dbe_->book1D(hname, mename, 6, 0, 6);
00209   setWheelLabel( dttf_nTracks_integ_2ndTrack );
00210 
00212   sprintf(hname, "dttf_02_occupancy_summary_2ndTrack");
00213   sprintf(mename, "DTTF 2nd Tracks distribution by Sector and Wheel");
00214   dttf_occupancySummary_2ndTrack = dbe_->book2D( hname, mename, 6, 0, 6,
00215                                                  12, 1, 13 );
00216   setWheelLabel( dttf_occupancySummary_2ndTrack );
00217 
00219   sprintf(hname, "dttf_03_bx_occupancy_2ndTrack");
00220   sprintf(mename, "DTTF 2nd Tracks BX Distribution by Wheel");
00221   dttf_bx_summary_2ndTrack = dbe_->book2D( hname, mename, 6, 0, 6, 3, -1, 2 );
00222   setWheelLabel( dttf_bx_summary_2ndTrack );
00223   dttf_bx_summary_2ndTrack->setAxisTitle("BX", 2 );
00224 
00226   sprintf(hname, "dttf_04_bx_2ndTrack");
00227   sprintf(mename, "Fraction of DTTF Tracks BX w.r.t. Tracks with BX=0");
00228   dttf_bx_integ_2ndTrack = dbe_->book1D( hname, mename, 3, -1.5, 1.5 );
00229   dttf_bx_integ_2ndTrack->setAxisTitle("BX", 1);
00230 
00232   sprintf(hname, "dttf_05_quality_2ndTrack");
00233   sprintf(mename, "DTTF 2nd Tracks Quality distribution");
00234   dttf_quality_integ_2ndTrack  = dbe_->book1D(hname, mename, 7, 0.5, 7.5);
00235   dttf_quality_integ_2ndTrack->setAxisTitle("Quality", 1);
00236   setQualLabel( dttf_quality_integ_2ndTrack, 1);
00237 
00239   sprintf(hname, "dttf_06_quality_occupancy_2ndTrack");
00240   sprintf(mename, "DTTF 2nd Tracks Quality distribution by Wheel");
00241   dttf_quality_summary_2ndTrack = dbe_->book2D( hname, mename,
00242                                                 6, 0, 6, 7, 1, 8 );
00243   dttf_quality_summary_2ndTrack->setAxisTitle("Wheel", 1);
00244   setQualLabel( dttf_quality_summary_2ndTrack, 2);
00245   setWheelLabel( dttf_quality_summary_2ndTrack );
00246 
00248   sprintf(hname, "dttf_07_highQuality_Tracks_2ndTrack");
00249   sprintf(mename, "Fraction of DTTF 2nd Tracks with Quality>3");
00250   dttf_highQual_Summary_2ndTrack = dbe_->book2D( hname, mename, 6, 0, 6,
00251                                                  12, 1, 13 );
00252   dttf_highQual_Summary_2ndTrack->setAxisTitle("Sector", 2);
00253   setWheelLabel( dttf_highQual_Summary_2ndTrack );
00254 
00256   sprintf(hname, "dttf_08_phi_vs_eta_2ndTrack");
00257   sprintf(mename, "#eta-#phi DTTF Tracks occupancy for 2nd Tracks");
00258   dttf_phi_eta_integ_2ndTrack = dbe_->book2D( hname, mename, 64, 0, 64,
00259                                               144, -6, 138. );
00260   dttf_phi_eta_integ_2ndTrack->setAxisTitle("#eta", 1);
00261   dttf_phi_eta_integ_2ndTrack->setAxisTitle("#phi", 2);
00262 
00264   sprintf(hname, "dttf_09_eta_2ndTrack");
00265   sprintf(mename, "DTTF 2nd Tracks #eta distribution (Packed values)");
00266   dttf_eta_integ_2ndTrack = dbe_->book1D(hname, mename, 64, -0.5, 63.5);
00267   dttf_eta_integ_2ndTrack->setAxisTitle("#eta", 1);
00268 
00270   sprintf(hname, "dttf_10_phi_2ndTrack");
00271   sprintf(mename, "DTTF 2nd Tracks Phi distribution (Packed values)");
00272   dttf_phi_integ_2ndTrack = dbe_->book1D(hname, mename, 144, -6, 138 );
00273   dttf_phi_integ_2ndTrack->setAxisTitle("#phi", 1);
00274 
00276   sprintf(hname, "dttf_11_pt_2ndTrack");
00277   sprintf(mename, "DTTF 2nd Tracks p_{T} distribution (Packed values)");
00278   dttf_pt_integ_2ndTrack  = dbe_->book1D(hname, mename, 32, -0.5, 31.5);
00279   dttf_pt_integ_2ndTrack->setAxisTitle("p_{T}", 1);
00280 
00282   sprintf(hname, "dttf_12_charge_2ndTrack");
00283   sprintf(mename, "DTTF 2nd Tracks Charge distribution");
00284   dttf_q_integ_2ndTrack = dbe_->book1D(hname, mename, 2, -0.5, 1.5);
00285   dttf_q_integ_2ndTrack->setAxisTitle("Charge", 1);
00286 
00287 
00288   for ( unsigned int wh = 0; wh < 6 ; ++wh ) {
00289     dbe_->setCurrentFolder( wheelpath_[wh] );
00290 
00292     sprintf( hname, "dttf_02_nTracks_wh%s", wheel_[wh].c_str() );
00293     sprintf( mename, "Wheel %s - Number of Tracks", wheel_[wh].c_str() );
00294     dttf_nTracks_wheel[wh] = dbe_->book1D( hname, mename, 12, 1, 13);
00295     dttf_nTracks_wheel[wh]->setAxisTitle("sector", 1);
00296  
00298     sprintf(hname, "dttf_03_bx_occupancy_wh%s",  wheel_[wh].c_str() );
00299     sprintf(mename, "Wheel %s - DTTF Tracks BX distribution by Sector",
00300             wheel_[wh].c_str());
00301     dttf_bx_wheel_summary[wh] = dbe_->book2D( hname, mename, 12, 1, 13, 3, -1, 2);
00302     dttf_bx_wheel_summary[wh]->setAxisTitle("BX", 2 );
00303     dttf_bx_wheel_summary[wh]->setAxisTitle("Sector", 1 );
00304 
00306     sprintf(hname, "dttf_04_bx_wh%s", wheel_[wh].c_str());
00307     sprintf(mename, "Wheel %s - DTTF Tracks BX w.r.t. Tracks with BX=0", wheel_[wh].c_str());
00308     dttf_bx_wheel_integ[wh] = dbe_->book1D(hname, mename, 3, -1.5, 1.5);
00309     dttf_bx_wheel_integ[wh]->setAxisTitle("BX", 1);
00310 
00312     sprintf(hname, "dttf_05_quality_wh%s", wheel_[wh].c_str() );
00313     sprintf(mename, "Wheel %s - Tracks Quality Distribution", wheel_[wh].c_str() );
00314     dttf_quality_wheel[wh] = dbe_->book1D(hname, mename, 7, 1, 8);
00315     dttf_quality_wheel[wh]->setAxisTitle("Quality", 1);
00316     setQualLabel(dttf_quality_wheel[wh], 1);
00317 
00319     sprintf(hname, "dttf_06_quality_summary_wh%s", wheel_[wh].c_str() );
00320     sprintf(mename, "Wheel %s - Tracks Quality Distribution by Sector",
00321             wheel_[wh].c_str() );
00322     dttf_quality_summary_wheel[wh] = dbe_->book2D(hname, mename, 12, 1, 13, 7, 1, 8);
00323     dttf_quality_summary_wheel[wh]->setAxisTitle("Sector", 1);
00324     // dttf_quality_summary_wheel[wh]->setAxisTitle("Quality", 2);
00325     setQualLabel(dttf_quality_summary_wheel[wh], 2);
00326 
00328     sprintf(hname, "dttf_09_etaFine_fraction_wh%s",  wheel_[wh].c_str() );
00329     sprintf(mename, "Wheel %s - Fraction of DTTF Tracks with fine #eta assignment",
00330             wheel_[wh].c_str());
00331     dttf_fine_fraction_wh[wh] = dbe_->book1D( hname, mename, 12, 1, 13);
00332     dttf_fine_fraction_wh[wh]->setAxisTitle("Sector", 1 );
00333 
00334 
00336     sprintf(hname, "dttf_10_eta_wh%s", wheel_[wh].c_str() );
00337     sprintf(mename, "Wheel %s - DTTF Tracks #eta distribution (Packed values)",
00338             wheel_[wh].c_str() );
00339     dttf_eta_wheel[wh] = dbe_->book1D(hname, mename, 64, -0.5, 63.5 );
00340     dttf_eta_wheel[wh]->setAxisTitle("#eta", 1 );
00341 
00343     sprintf(hname, "dttf_11_phi_wh%s", wheel_[wh].c_str() );
00344     sprintf(mename, "Wheel %s - DTTF Tracks Phi distribution (Packed values)",
00345             wheel_[wh].c_str() );
00346     dttf_phi_wheel[wh] = dbe_->book1D(hname, mename, 144, -6, 138. );
00347     dttf_phi_wheel[wh]->setAxisTitle("#phi", 1);
00348 
00350     sprintf(hname, "dttf_12_pt_wh%s", wheel_[wh].c_str() );
00351     sprintf(mename, "Wheel %s - DTTF Tracks p_{T} distribution (Packed values)",
00352             wheel_[wh].c_str() );
00353     dttf_pt_wheel[wh] = dbe_->book1D(hname, mename, 32, -0.5, 31.5);
00354     dttf_pt_wheel[wh]->setAxisTitle("p_{T}", 1);
00355 
00357     sprintf(hname, "dttf_13_charge_wh%s", wheel_[wh].c_str() );
00358     sprintf(mename, "Wheel %s - DTTF Tracks Charge distribution",
00359             wheel_[wh].c_str() );
00360     dttf_q_wheel[wh] = dbe_->book1D(hname, mename, 2, -0.5, 1.5);
00361     dttf_q_wheel[wh]->setAxisTitle("Charge", 1);
00362 
00363   }
00364 
00365 
00367   for ( unsigned int wh = 0; wh < 6 ; ++wh ) {
00368     dbe_->setCurrentFolder( wheelpath_[wh]  + "/2ND_TRACK_ONLY" );
00369 
00371     sprintf( hname, "dttf_01_nTracks_wh%s_2ndTrack", wheel_[wh].c_str() );
00372     sprintf( mename, "Wheel %s - DTTF Number of 2nd Tracks with BX=0",
00373              wheel_[wh].c_str() );
00374     dttf_nTracks_wheel_2ndTrack[wh] = dbe_->book1D( hname, mename,
00375                                                      12, 1, 13);
00376     dttf_nTracks_wheel_2ndTrack[wh]->setAxisTitle("sector", 1);
00377  
00379     sprintf(hname, "dttf_02_bx_occupancy_wh%s_2ndTrack",  wheel_[wh].c_str() );
00380     sprintf(mename, "Wheel %s - DTTF 2nd Tracks BX distribution by Sector",
00381             wheel_[wh].c_str());
00382     dttf_bx_wheel_summary_2ndTrack[wh] = dbe_->book2D( hname, mename, 12, 1, 13, 3, -1, 2);
00383     dttf_bx_wheel_summary_2ndTrack[wh]->setAxisTitle("BX", 2 );
00384     dttf_bx_wheel_summary_2ndTrack[wh]->setAxisTitle("Sector", 1 );
00385 
00387     sprintf(hname, "dttf_03_bx_wh%s_2ndTrack", wheel_[wh].c_str());
00388     sprintf(mename, "Wheel %s - 2nd Tracks BX Distribution", wheel_[wh].c_str());
00389     dttf_bx_wheel_integ_2ndTrack[wh] = dbe_->book1D(hname, mename, 3, -1.5, 1.5);
00390     dttf_bx_wheel_integ_2ndTrack[wh]->setAxisTitle("BX", 1);
00391 
00392 
00393   }
00394 
00395 
00396 
00397 }
00398 
00399 //--------------------------------------------------------
00400 void L1TDTTFClient::beginRun(const edm::Run& r, const edm::EventSetup& context)
00401 {
00402 }
00403 
00404 //--------------------------------------------------------
00405 void L1TDTTFClient::beginLuminosityBlock( const edm::LuminosityBlock& lumiSeg,
00406                                           const edm::EventSetup& context)
00407 {
00409   ++counterLS_;
00410 
00411   if ( online_ && !( counterLS_ % resetafterlumi_ ) ) {
00412     char hname[60];
00413     sprintf( hname, "%s/dttf_04_tracks_occupancy_by_lumi",
00414              inclusivepath_.c_str() );
00415 
00416     occupancy_r_ = getTH2F(hname);
00417     if ( ! occupancy_r_ ) {
00418       edm::LogError("L1TDTTFClient::beginLuminosityBlock:ME")
00419         << "Failed to get TH2D " << std::string(hname);
00420     } else {
00421       edm::LogInfo("L1TDTTFClient::beginLuminosityBlock:RESET") << "Reseting plots by lumi!";
00422       occupancy_r_->Reset();
00423     }
00424   }
00425 
00426 }
00427 
00428 //--------------------------------------------------------
00429 void L1TDTTFClient::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
00430                                        const edm::EventSetup& c)
00431 {
00432 
00434   if (  online_  ) {
00435     makeSummary();
00436     if ( occupancy_r_ ) normalize( occupancy_r_ );
00437   }
00438 
00439 }
00440 
00441 //--------------------------------------------------------
00442 void L1TDTTFClient::analyze(const edm::Event& e,
00443                             const edm::EventSetup& context)
00444 {
00445 
00446 
00447 }
00448 
00449 //--------------------------------------------------------
00450 void L1TDTTFClient::endRun(const edm::Run& r, const edm::EventSetup& context)
00451 {
00452   makeSummary();
00453 }
00454 
00455 //--------------------------------------------------------
00456 void L1TDTTFClient::endJob()
00457 {
00458 }
00459 
00460 
00461 //--------------------------------------------------------
00462 void L1TDTTFClient::makeSummary()
00463 {
00467   buildSummaries();
00468 
00472   double scale = 0;
00473   double entries = dttf_occupancySummary->getTH2F()->Integral();
00474 
00475   if ( entries ) {
00476 
00478     normalize( dttf_bx_summary->getTH2F() );
00479 
00481     scale = 1 / entries;
00482     normalize( dttf_occupancySummary->getTH2F(), scale );
00483     normalize( dttf_nTracks_integ->getTH1F(), scale );
00484 
00486     double physEntries = dttf_eta_integ->getTH1F()->Integral();
00487     if ( physEntries > 0 ) {
00488       double physScale = 1 / physEntries;
00489 
00490       normalize( dttf_phi_eta_integ->getTH2F(), physScale );
00491 
00492       normalize( dttf_phi_eta_fine_integ->getTH2F(), physScale );
00493       normalize( dttf_phi_eta_coarse_integ->getTH2F(), physScale );
00494       normalize( dttf_quality_summary->getTH2F(), physScale );
00495 
00496       normalize( dttf_eta_integ->getTH1F(), physScale );
00497       normalize( dttf_q_integ->getTH1F(), physScale );
00498       normalize( dttf_pt_integ->getTH1F(), physScale );
00499       normalize( dttf_phi_integ->getTH1F(), physScale );
00500       normalize( dttf_quality_integ->getTH1F(), physScale );
00501 
00502     }
00503 
00504   }
00505 
00509 
00510   double entries2ndTrack = dttf_occupancySummary_2ndTrack->getTH2F()->Integral();
00511   if ( entries2ndTrack > 0 ) {
00512 
00514     normalize( dttf_bx_summary_2ndTrack->getTH2F() ); //
00515 
00517     TH2F * ratio = dttf_occupancySummary_2ndTrack->getTH2F();
00518     buildHighQualityPlot( ratio, dttf_highQual_Summary_2ndTrack,
00519                           "%s/2ND_TRACK_ONLY/dttf_05_quality_summary_wh%s_2ndTrack" );
00520 
00521     normalize( dttf_2ndTrack_Summary->getTH2F(), scale ); //
00522 
00524     double scale2nd = 1 / entries2ndTrack;
00525     normalize( dttf_occupancySummary_2ndTrack->getTH2F(), scale2nd ); //
00526     normalize( dttf_nTracks_integ_2ndTrack->getTH1F(), scale2nd ); //
00527 
00528 
00530     normalize( dttf_phi_eta_integ_2ndTrack->getTH2F() );
00531     normalize( dttf_q_integ_2ndTrack->getTH1F() );
00532     normalize( dttf_pt_integ_2ndTrack->getTH1F() );
00533     normalize( dttf_phi_integ_2ndTrack->getTH1F() );
00534     normalize( dttf_eta_integ_2ndTrack->getTH1F() );
00535     normalize( dttf_quality_integ_2ndTrack->getTH1F() );
00536     normalize( dttf_quality_summary_2ndTrack->getTH2F() );
00537 
00538   }
00539 
00541   setGMTsummary();
00542 
00543 }
00544 
00545 
00546 
00547 
00548 //--------------------------------------------------------
00549 void L1TDTTFClient::buildSummaries()
00550 {
00551 
00552   char hname[100];
00553   int wheelBx[4]; 
00554   int wheelBx2nd[4]; 
00555   int wheelSumBx[4]; 
00556   int wheelSumBx2nd[4]; 
00557   int qualities[8]; 
00558 
00559   memset( wheelSumBx, 0, 4 * sizeof(int) );
00560   memset( wheelSumBx2nd, 0, 4 * sizeof(int) );
00561 
00563   dttf_eta_integ->Reset();
00564   dttf_q_integ->Reset();
00565   dttf_pt_integ->Reset();
00566   dttf_phi_integ->Reset();
00567   dttf_quality_integ->Reset();
00568   dttf_phi_eta_integ->Reset();
00569   dttf_phi_eta_fine_integ->Reset();
00570   dttf_phi_eta_coarse_integ->Reset();
00571   dttf_q_integ_2ndTrack->Reset();
00572   dttf_pt_integ_2ndTrack->Reset();
00573   dttf_phi_integ_2ndTrack->Reset();
00574   dttf_eta_integ_2ndTrack->Reset();
00575 
00577   dttf_quality_integ_2ndTrack->Reset();
00578   dttf_quality_summary_2ndTrack->Reset();
00579  
00580   for ( unsigned int wh = 0; wh < 6 ; ++wh ) {
00581 
00582     dttf_eta_wheel[wh]->Reset();
00583     dttf_q_wheel[wh]->Reset();
00584     dttf_pt_wheel[wh]->Reset();
00585     dttf_phi_wheel[wh]->Reset();
00586     dttf_quality_wheel[wh]->Reset();
00587     dttf_quality_summary_wheel[wh]->Reset();
00588  
00589     double wheelEtaAll = 0; 
00590     double wheelEtaFine = 0; 
00591     memset( wheelBx, 0, 4 * sizeof(int) );
00592     memset( wheelBx2nd, 0, 4 * sizeof(int) );
00593 
00595     memset( qualities, 0, 8 * sizeof(int) );
00596 
00600     buildPhiEtaPlotOFC( dttf_phi_eta_fine_integ, dttf_phi_eta_coarse_integ,
00601                         dttf_phi_eta_integ,
00602                         "%s/dttf_07_phi_vs_etaFine_wh%s",
00603                         "%s/dttf_08_phi_vs_etaCoarse_wh%s", wh );
00604 
00605     buildPhiEtaPlotO( dttf_phi_eta_integ_2ndTrack,
00606                       "%s/2ND_TRACK_ONLY/dttf_06_phi_vs_eta_wh%s_2ndTrack",
00607                       wh );
00608 
00609 
00613     for ( unsigned int sector = 1; sector < 13; ++sector ) {
00614 
00618       sprintf( hname, "%s/BX_BySector/dttf_bx_wh%s_se%d",
00619                wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector );
00620       
00621       TH1F * bxsector = getTH1F(hname);
00622       if ( ! bxsector ) {
00623         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00624                                                        << std::string(hname);
00625       } else {
00626       
00627         for ( unsigned int bx = 1; bx < 4 ; ++bx ) {
00628 
00629           int bxval = bxsector->GetBinContent( bx );
00630 
00631           if ( bx == 2 ) {
00632             // if ( wh == 2 )
00633             //   dttf_occupancySummary->setBinContent( wh+1, sector, bxval*14 );
00634             // else
00635             //   dttf_occupancySummary->setBinContent( wh+1, sector, bxval );
00636             dttf_occupancySummary->setBinContent( wh+1, sector, bxval );
00637             dttf_nTracks_wheel[wh]->setBinContent(sector, bxval );
00638           }
00639           wheelBx[bx] += bxval;
00640           dttf_bx_wheel_summary[wh]->setBinContent( sector, bx, bxval );
00641         }
00642       }
00643 
00644 
00648       sprintf( hname, "%s/BX_BySector/2ND_TRACK_ONLY/dttf_bx_2ndTrack_wh%s_se%d",
00649                wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector );
00650       
00651       TH1F * bxsector2nd = getTH1F(hname);
00652       if ( ! bxsector2nd ) {
00653         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00654                                                        << std::string(hname);
00655       } else {
00656       
00657         for ( unsigned int bx = 1; bx < 4 ; ++bx ) {
00658           int bxval = bxsector2nd->GetBinContent( bx );
00659 
00660           if ( bx == 2 ) {
00661             dttf_2ndTrack_Summary->setBinContent( wh+1, sector, bxval );
00662             dttf_occupancySummary_2ndTrack->setBinContent(wh+1, sector, bxval);
00663             dttf_nTracks_wheel_2ndTrack[wh]->setBinContent(sector, bxval );
00664           }
00665           wheelBx2nd[bx] += bxval;
00666           dttf_bx_wheel_summary_2ndTrack[wh]->setBinContent(sector, bx, bxval);
00667         }
00668       }
00669 
00673       sprintf( hname, "%s/Charge/dttf_charge_wh%s_se%d", 
00674                wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector );
00675       TH1F * tmp = getTH1F(hname);
00676       if ( ! tmp ) {
00677         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00678                                                        << std::string(hname);
00679       } else {
00680         dttf_q_integ->getTH1F()->Add( tmp );
00681         dttf_q_wheel[wh]->getTH1F()->Add( tmp );
00682       }
00683 
00687       sprintf( hname, "%s/PT/dttf_pt_wh%s_se%d", 
00688                wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector );
00689       tmp = getTH1F(hname);
00690       if ( ! tmp ) {
00691         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00692                                                        << std::string(hname);
00693       } else {
00694         dttf_pt_integ->getTH1F()->Add( tmp );
00695         dttf_pt_wheel[wh]->getTH1F()->Add( tmp );
00696       }
00697 
00698 
00702       sprintf( hname, "%s/Phi/dttf_phi_wh%s_se%d", 
00703                wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector );
00704       tmp = getTH1F(hname);
00705       if ( ! tmp ) {
00706         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00707                                                        << std::string(hname);
00708       } else {
00709         dttf_phi_integ->getTH1F()->Add( tmp );
00710         dttf_phi_wheel[wh]->getTH1F()->Add( tmp );
00711       }
00712 
00713 
00717       double highQual = 0; 
00718       double denHighQual = 0; 
00719       sprintf( hname, "%s/Quality/dttf_qual_wh%s_se%d", 
00720                wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector );
00721       tmp = getTH1F(hname);
00722       if ( ! tmp ) {
00723         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00724                                                        << std::string(hname);
00725       } else {
00726 
00727         dttf_quality_wheel[wh]->getTH1F()->Add( tmp );
00728 
00729 
00730         for ( unsigned int qual = 1; qual < 4 ; ++qual ) {
00731           double bincontent = tmp->GetBinContent( qual );
00732           qualities[qual] += bincontent;
00733           denHighQual += bincontent;
00734           dttf_quality_summary_wheel[wh]->setBinContent(sector, qual, bincontent);
00735         }
00736 
00737         for ( unsigned int qual = 4; qual < 8 ; ++qual ) {
00738           double bincontent = tmp->GetBinContent( qual );
00739           qualities[qual] += bincontent;
00740           dttf_quality_summary_wheel[wh]->setBinContent(sector, qual, bincontent);
00741           denHighQual += bincontent;
00742           highQual += bincontent;
00743         }
00744 
00745       }
00746       if ( denHighQual > 0 ) highQual /= denHighQual;
00747       dttf_highQual_Summary->setBinContent( wh+1, sector, highQual );
00748 
00749 
00753       sprintf( hname, "%s/Eta/dttf_eta_wh%s_se%d", 
00754                wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector );
00755       tmp = getTH1F(hname);
00756       if ( ! tmp ) {
00757         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00758                                                        << std::string(hname);
00759       } else {
00760         dttf_eta_integ->getTH1F()->Add( tmp );
00761         dttf_eta_wheel[wh]->getTH1F()->Add( tmp );
00762       }
00763 
00764 
00768       sprintf( hname, "%s/EtaFineFraction/dttf_etaFine_fraction_wh%s_se%d", 
00769                wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector );
00770       tmp = getTH1F(hname);
00771       if ( ! tmp ) {
00772         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00773                                                        << std::string(hname);
00774       } else {
00775         double fine = tmp->GetBinContent( 1 );
00776         double coarse = tmp->GetBinContent( 2 );
00777         double tot = fine + coarse;
00778         wheelEtaAll += tot;
00779         wheelEtaFine += fine;
00780         if ( tot > 0 ) {
00781           dttf_fine_fraction_wh[wh]->setBinContent( sector, fine/tot );
00782         }
00783       }
00784 
00785     }
00786 
00790     if ( wheelEtaAll > 0 ) {
00791       dttf_eta_fine_fraction->setBinContent( wh+1, wheelEtaFine/wheelEtaAll );
00792     }
00793 
00797     dttf_nTracks_integ->setBinContent( wh+1, wheelBx[2] );
00798     dttf_nTracks_integ_2ndTrack->setBinContent( wh+1, wheelBx2nd[2] );
00799 
00803     for ( unsigned int bx = 1; bx < 4; ++bx ) {
00804 
00805       dttf_bx_wheel_integ[wh]->setBinContent( bx, wheelBx[bx] );
00806       dttf_bx_summary->setBinContent( wh+1, bx, wheelBx[bx] );
00807       wheelSumBx[bx] += wheelBx[bx];
00808 
00809       dttf_bx_wheel_integ_2ndTrack[wh]->setBinContent( bx, wheelBx2nd[bx] );
00810       dttf_bx_summary_2ndTrack->setBinContent( wh+1, bx, wheelBx2nd[bx] );
00811       wheelSumBx2nd[bx] += wheelBx2nd[bx];
00812 
00813     }
00814 
00815 
00819     for ( unsigned int qual = 1; qual < 8 ; ++qual ) {
00820       dttf_quality_summary->setBinContent( wh+1, qual, qualities[qual] );
00821       dttf_quality_integ->getTH1F()->AddBinContent( qual, qualities[qual] );
00822     }
00823 
00824 
00828     normalize( dttf_bx_wheel_summary[wh]->getTH2F() );
00829     normalize( dttf_bx_wheel_summary_2ndTrack[wh]->getTH2F() );
00830     normalize( dttf_nTracks_wheel[wh]->getTH1F() );
00831     normalize( dttf_nTracks_wheel_2ndTrack[wh]->getTH1F() );
00832     normalize( dttf_quality_summary_wheel[wh]->getTH2F() );
00833     normalize( dttf_quality_wheel[wh]->getTH1F() );
00834     normalize( dttf_eta_wheel[wh]->getTH1F() );
00835     normalize( dttf_q_wheel[wh]->getTH1F() );
00836     normalize( dttf_pt_wheel[wh]->getTH1F() );
00837     normalize( dttf_phi_wheel[wh]->getTH1F() );
00838 
00842     double scale = wheelBx[2];
00843     if ( scale > 0 ) {
00844       scale = 1/scale;
00845       normalize( dttf_bx_wheel_integ[wh]->getTH1F(), scale );
00846     }
00847 
00848     scale = wheelBx2nd[2];
00849     if ( scale > 0 ) {
00850       scale = 1/scale;
00851       normalize( dttf_bx_wheel_integ_2ndTrack[wh]->getTH1F(), scale );
00852     }
00853 
00854 
00855 
00856 
00862 
00863 
00867     sprintf( hname, "%s/2ND_TRACK_ONLY/dttf_07_eta_wh%s_2ndTrack", 
00868              wheelpath_[wh].c_str(), wheel_[wh].c_str() );
00869     
00870     TH1F * tmp = getTH1F(hname);
00871     if ( ! tmp ) {
00872       edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00873                                                      << std::string(hname);
00874     } else {
00875       dttf_eta_integ_2ndTrack->getTH1F()->Add( tmp );
00876     }
00877 
00881     sprintf( hname, "%s/2ND_TRACK_ONLY/dttf_08_phi_wh%s_2ndTrack", 
00882              wheelpath_[wh].c_str(), wheel_[wh].c_str() );
00883     tmp = getTH1F(hname);
00884     if ( ! tmp ) {
00885       edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00886                                                      << std::string(hname);
00887     } else {
00888       dttf_phi_integ_2ndTrack->getTH1F()->Add( tmp );
00889     }
00890 
00891 
00895     sprintf( hname, "%s/2ND_TRACK_ONLY/dttf_09_pt_wh%s_2ndTrack", 
00896              wheelpath_[wh].c_str(), wheel_[wh].c_str() );
00897     tmp = getTH1F(hname);
00898     if ( ! tmp ) {
00899       edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00900                                                      << std::string(hname);
00901     } else {
00902       dttf_pt_integ_2ndTrack->getTH1F()->Add( tmp );
00903     }
00904 
00908     sprintf( hname, "%s/2ND_TRACK_ONLY/dttf_10_charge_wh%s_2ndTrack", 
00909              wheelpath_[wh].c_str(), wheel_[wh].c_str() );
00910     tmp = getTH1F(hname);
00911     if ( ! tmp ) {
00912       edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00913                                                      << std::string(hname);
00914     } else {
00915       dttf_q_integ_2ndTrack->getTH1F()->Add( tmp );
00916     }
00917 
00921     sprintf( hname, "%s/2ND_TRACK_ONLY/dttf_04_quality_wh%s_2ndTrack", 
00922              wheelpath_[wh].c_str(), wheel_[wh].c_str() );
00923     tmp = getTH1F(hname);
00924     if ( ! tmp ) {
00925       edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00926                                                      << std::string(hname);
00927     } else {
00928       for ( unsigned int qual = 1; qual < 8; ++qual ) {
00929         double binqual = tmp->GetBinContent( qual );
00930         dttf_quality_integ_2ndTrack->getTH1F()->AddBinContent( qual, binqual );
00931         dttf_quality_summary_2ndTrack->setBinContent( wh, qual, binqual );
00932       }
00933     }
00934 
00935 
00936   }
00937 
00941   for ( unsigned int bx = 1; bx < 4; ++bx ) {
00942     dttf_bx_integ->setBinContent( bx, wheelSumBx[bx] );
00943     dttf_bx_integ_2ndTrack->setBinContent( bx, wheelSumBx2nd[bx] );
00944   }
00945 
00949   double scale = wheelSumBx[2];
00950   if ( scale > 0 ) {
00951     scale = 1./scale;
00952     normalize( dttf_bx_integ->getTH1F(), scale );
00953   }
00954 
00955   scale = wheelSumBx2nd[2];
00956   if ( scale > 0 ) {
00957     scale = 1./scale;
00958     normalize( dttf_bx_integ_2ndTrack->getTH1F(), scale );
00959   }
00960 
00961 
00962 }
00963 
00964 
00965 
00966 //--------------------------------------------------------
00967 void L1TDTTFClient::setGMTsummary()
00968 {
00969   char hname[60];
00970   sprintf( hname, "%s/dttf_tracks_with_gmt_match", gmtpath_.c_str() );
00971   TH2F * gmt_match = getTH2F(hname);
00972   if ( ! gmt_match ) {
00973     edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00974                                                    << std::string(hname);
00975     return;
00976   }
00977 
00978 
00979 
00980   sprintf( hname, "%s/dttf_tracks_without_gmt_match", gmtpath_.c_str() );
00981   TH2F * gmt_missed = getTH2F(hname);
00982   if ( ! gmt_missed ) {
00983     edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00984                                                    << std::string(hname);
00985     return;
00986   }
00987 
00988 
00989   sprintf( hname, "%s/dttf_missing_tracks_in_gmt", gmtpath_.c_str() );
00990   TH2F * gmt_ghost = getTH2F(hname);
00991   if ( ! gmt_ghost ) {
00992     edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00993                                                    << std::string(hname);
00994     return;
00995   }
00996 
00997   int match = gmt_match->Integral();
00998   int missed = gmt_missed->Integral();
00999   int ghost = gmt_ghost->Integral();
01000   float tot = match + missed + ghost;
01001   if ( tot > 0 ) {
01002     double val = ghost/tot;
01003     dttf_gmt_matching->setBinContent( 1, val );
01004     val = match/tot;
01005     dttf_gmt_matching->setBinContent( 2, val );
01006     val = missed/tot;
01007     dttf_gmt_matching->setBinContent( 3, val );
01008   }
01009 }
01010 
01011 
01012 
01013 //--------------------------------------------------------
01014 TH1F * L1TDTTFClient::getTH1F(const char * hname)
01015 {
01016 
01017   MonitorElement * me = dbe_->get(hname);
01018   if ( ! me ) {
01019     edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get ME "
01020                                                    << std::string(hname);
01021     return NULL;
01022   }
01023 
01024 
01025   //   edm::LogInfo("L1TDTTFClient::getTH1F") << "#################### "
01026   //                                     << std::string(hname);
01027 
01028   return me->getTH1F();
01029 
01030 }
01031 
01032 
01033 //--------------------------------------------------------
01034 TH2F * L1TDTTFClient::getTH2F(const char * hname)
01035 {
01036 
01037   MonitorElement * me = dbe_->get(hname);
01038   if ( ! me ) {
01039     edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get ME "
01040                                                    << std::string(hname);
01041     return NULL;
01042   }
01043 
01044 
01045   //   edm::LogInfo("L1TDTTFClient::getTH2F") << "#################### "
01046   //                                     << std::string(hname);
01047 
01048   return me->getTH2F();
01049 
01050 }
01051 
01052 
01053 //--------------------------------------------------------
01054 
01055 //--------------------------------------------------------
01056 void L1TDTTFClient::buildHighQualityPlot( TH2F * occupancySummary,
01057                                           MonitorElement * highQual_Summary,
01058                                           const std::string & path )
01059 {
01060 
01061   char hname[150];
01062 
01066   for ( unsigned int wh = 0; wh < 6 ; ++wh ) {
01067     sprintf( hname, path.c_str(), wheelpath_[wh].c_str(), wheel_[wh].c_str() );
01068 
01069     TH2F * quality = getTH2F(hname);
01070     if ( ! quality ) {
01071       edm::LogError("L1TDTTFClient::buildHighQualityPlot")
01072         << "Failed to get TH2F " << std::string(hname);
01073     } else {
01074 
01075       for ( unsigned int sec = 1; sec < 13 ; ++sec ) {
01076         double denHighQual = occupancySummary->GetBinContent( wh+1, sec );
01077         double val = 0;
01078         if ( denHighQual > 0 ) {
01079           for ( unsigned int qual = 4; qual < 8 ; ++qual ) {
01080             val += quality->GetBinContent( qual, sec );
01081           }
01082           val /= denHighQual;
01083         }
01084         highQual_Summary->setBinContent( wh+1, sec, val );
01085       }
01086     }
01087   }
01088 }
01089 
01090 //--------------------------------------------------------
01091 void L1TDTTFClient::buildPhiEtaPlotOFC( MonitorElement * phi_eta_fine_integ,
01092                                         MonitorElement * phi_eta_coarse_integ,
01093                                         MonitorElement * phi_eta_integ,
01094                                         const std::string & path_fine,
01095                                         const std::string & path_coarse,
01096                                         int wh )
01097 {
01098 
01099   char hname[150];
01100   sprintf( hname, path_fine.c_str(),
01101            wheelpath_[wh].c_str(), wheel_[wh].c_str() );
01102 
01103   TH2F * phi_vs_eta_fine = getTH2F(hname);
01104   if ( ! phi_vs_eta_fine ) {
01105     edm::LogError("L1TDTTFClient::buildPhiEtaPloOtFC")
01106       << "Failed to get TH1D " << std::string(hname);
01107   }
01108 
01109   sprintf( hname, path_coarse.c_str(),
01110            wheelpath_[wh].c_str(), wheel_[wh].c_str() );
01111   TH2F * phi_vs_eta_coarse = getTH2F(hname);
01112   if ( ! phi_vs_eta_coarse ) {
01113     edm::LogError("L1TDTTFClient::buildPhiEtaPlotOFC")
01114       << "Failed to get TH1D " << std::string(hname);
01115   }
01116 
01117   if ( ! phi_vs_eta_fine || ! phi_vs_eta_coarse ) {
01118     return;
01119   }
01120 
01121   for ( unsigned int phi = 1; phi < 145 ; ++phi ) {
01122     float start = 0;
01123     float stop = 0;
01124     int nbins = 0;
01125     switch ( wh ) {
01126     case 0 : start = 0; stop = 18; nbins = 18; break; // N2
01127     case 1 : start = 8; stop = 28; nbins = 20; break; // N1
01128     case 2 : start = 22; stop = 32; nbins = 10; break; // N0
01129     case 3 : start = 22; stop = 42; nbins = 20; break; // P0
01130     case 4 : start = 36; stop = 56; nbins = 20; break; // P1
01131     case 5 : start = 46; stop = 64; nbins = 18; break; // P2
01132     default : start = 0; stop = 0; nbins = 0; break; // BOH
01133     }
01134 
01135     for ( int eta = 1; eta <= nbins ; ++eta ) {
01136       double setbin = eta + start;
01137 
01138       double valfine = phi_vs_eta_fine->GetBinContent( eta, phi )
01139         + phi_eta_fine_integ->getBinContent( setbin, phi );
01140 
01141       double valcoarse = phi_vs_eta_coarse->GetBinContent( eta, phi )
01142         + phi_eta_coarse_integ->getBinContent( setbin, phi );
01143 
01144       phi_eta_fine_integ->setBinContent( setbin, phi, valfine );
01145       phi_eta_coarse_integ->setBinContent( setbin, phi, valcoarse );
01146       phi_eta_integ->setBinContent( setbin, phi, valfine+valcoarse );
01147 
01148     }
01149 
01150     // double underflow_f = phi_vs_eta_fine->GetBinContent( 0, phi )
01151     //   + phi_eta_fine_integ->getBinContent( 1, phi );
01152     // phi_eta_fine_integ->setBinContent( 1, phi, underflow_f );
01153     // 
01154     // double underflow_c = phi_vs_eta_coarse->GetBinContent( 0, phi )
01155     //   + phi_eta_coarse_integ->getBinContent( 1, phi );
01156     // phi_eta_coarse_integ->setBinContent( 1, phi, underflow_c );
01157     // 
01158     // double overflow_f = phi_vs_eta_fine->GetBinContent( nbins+1, phi )
01159     //   + phi_eta_fine_integ->getBinContent( 64 );
01160     // phi_eta_fine_integ->setBinContent( 64, phi, overflow_f );
01161     // 
01162     // double overflow_c = phi_vs_eta_coarse->GetBinContent( nbins+1, phi )
01163     //   + phi_eta_coarse_integ->getBinContent( 64, phi );
01164     // phi_eta_coarse_integ->setBinContent( 64, phi, overflow_c );
01165     // 
01166     // double underflow = underflow_f + underflow_c;
01167     // phi_eta_integ->setBinContent( 1, phi, underflow );
01168     // 
01169     // double overflow = overflow_f + overflow_c;
01170     // phi_eta_integ->setBinContent( 64, phi, overflow );
01171 
01172   }
01173 
01174 }
01175 
01176 
01177 //--------------------------------------------------------
01178 void L1TDTTFClient::buildPhiEtaPlotO( MonitorElement * phi_eta_integ,
01179                                       const std::string & path,
01180                                       int wh )
01181 {
01182   char hname[100];
01183   sprintf( hname, path.c_str(),
01184            wheelpath_[wh].c_str(), wheel_[wh].c_str() );
01185 
01186   TH2F * phi_vs_eta = getTH2F(hname);
01187   if ( ! phi_vs_eta ) {
01188     edm::LogError("L1TDTTFClient::buildPhiEtaPlotO:ME") << "Failed to get TH1D "
01189                                                    << std::string(hname);
01190   } else {
01191 
01192     for ( unsigned int phi = 1; phi < 145 ; ++phi ) {
01193       float start = 0;
01194       float stop = 0;
01195       int nbins = 0;
01196       switch ( wh ) {
01197       case 0 : start = 0; stop = 18; nbins = 18; break; // N2
01198       case 1 : start = 8; stop = 28; nbins = 20; break; // N1
01199       case 2 : start = 22; stop = 32; nbins = 10; break; // N0
01200       case 3 : start = 22; stop = 42; nbins = 20; break; // P0
01201       case 4 : start = 36; stop = 56; nbins = 20; break; // P1
01202       case 5 : start = 46; stop = 64; nbins = 18; break; // P2
01203       default : start = 0; stop = 0; nbins = 0; break; // BOH
01204       }
01205 
01206       for ( int eta = 1; eta <= nbins ; ++eta ) {
01207         double setbin = eta + start;
01208         double val = phi_vs_eta->GetBinContent( eta, phi )
01209           + phi_eta_integ->getBinContent( setbin, phi );
01210         phi_eta_integ->setBinContent( setbin, phi, val );
01211       }
01212 
01213       double underflow = phi_vs_eta->GetBinContent( 0, phi )
01214         + phi_eta_integ->getBinContent( 1, phi );
01215       phi_eta_integ->setBinContent( 1, phi, underflow );
01216 
01217       double overflow = phi_vs_eta->GetBinContent( nbins+1, phi )
01218         + phi_eta_integ->getBinContent( 64 );
01219       phi_eta_integ->setBinContent( 64, phi, overflow );
01220 
01221     }
01222   }
01223 }
01224 
01225 
01226 // //--------------------------------------------------------
01227 // void L1TDTTFClient::buildPhiEtaPlot( MonitorElement * phi_eta_integ,
01228 //                                   const std::string & path ,
01229 //                                   int wh)
01230 // {
01231 //   char hname[60];
01232 //   sprintf( hname, "%s/dttf_phi_eta_wh%s",
01233 //         wheelpath_[wh].c_str(), wheel_[wh].c_str() );
01234 // 
01235 //   TH2F * phi_vs_eta = getTH2F(hname);
01236 //   if ( ! phi_vs_eta ) {
01237 //     edm::LogError("L1TDTTFClient::buildPhiEtaPlot:ME") << "Failed to get TH1D "
01238 //                                                 << std::string(hname);
01239 //   } else {
01240 // 
01241 // 
01242 //     for ( unsigned int phi = 1; phi < 145 ; ++phi ) {
01243 //       for ( unsigned int eta = 1; eta < 65 ; ++eta ) {
01244 //      double val = phi_vs_eta->GetBinContent( eta, phi )
01245 //        + dttf_phi_eta_integ->getBinContent( eta, phi );
01246 //      dttf_phi_eta_integ->setBinContent( eta, phi, val );
01247 //       }
01248 // 
01249 //     }
01250 //   }
01251 // }
01252 // 
01253 // 
01254 // //--------------------------------------------------------
01255 // void L1TDTTFClient::buildPhiEtaPlotFC( MonitorElement * phi_eta_fine_integ,
01256 //                                     MonitorElement * phi_eta_coarse_integ,
01257 //                                     MonitorElement * phi_eta_integ,
01258 //                                     const std::string & path_fine,
01259 //                                     const std::string & path_coarse,
01260 //                                     int wh )
01261 // {
01262 // 
01263 //   char hname[60];
01264 // 
01265 //   sprintf( hname, path_fine.c_str(),
01266 //         wheelpath_[wh].c_str(), wheel_[wh].c_str() );
01267 //   TH2F * phi_vs_eta_fine = getTH2F(hname);
01268 //   if ( ! phi_vs_eta_fine ) {
01269 //     edm::LogError("L1TDTTFClient::buildPhiEtaPlotFC")
01270 //       << "Failed to get TH1D " << std::string(hname);
01271 //   }
01272 // 
01273 // 
01274 //   sprintf( hname, path_coarse.c_str(),
01275 //         wheelpath_[wh].c_str(), wheel_[wh].c_str() );
01276 //   TH2F * phi_vs_eta_coarse = getTH2F(hname);
01277 //   if ( ! phi_vs_eta_coarse ) {
01278 //     edm::LogError("L1TDTTFClient::buildPhiEtaPlotFC")
01279 //       << "Failed to get TH1D " << std::string(hname);
01280 //   }
01281 // 
01282 //   if ( ! phi_vs_eta_fine || ! phi_vs_eta_coarse ) {
01283 //     return;
01284 //   }
01285 // 
01286 //   for ( unsigned int phi = 1; phi < 145 ; ++phi ) {
01287 //     for ( unsigned int eta = 1; eta < 65 ; ++eta ) {
01288 // 
01289 //       double valfine = phi_vs_eta_fine->GetBinContent( eta, phi )
01290 //      + dttf_phi_eta_fine_integ->getBinContent( eta, phi );
01291 //       dttf_phi_eta_fine_integ->setBinContent( eta, phi, valfine );
01292 //       double valcoarse = phi_vs_eta_coarse->GetBinContent( eta, phi )
01293 //      + dttf_phi_eta_coarse_integ->getBinContent( eta, phi );
01294 //       dttf_phi_eta_coarse_integ->setBinContent( eta, phi, valcoarse );
01295 // 
01296 //       dttf_phi_eta_integ->setBinContent( eta, phi, valfine + valcoarse );
01297 // 
01298 //     }
01299 // 
01300 //   }
01301 // }
01302 
01303 
01304 
01305 
01306 //--------------------------------------------------------
01307 void L1TDTTFClient::setWheelLabel(MonitorElement *me)
01308 {
01309   me->setAxisTitle("Wheel", 1);
01310   me->setBinLabel(1, "N2", 1);
01311   me->setBinLabel(2, "N1", 1);
01312   me->setBinLabel(3, "N0", 1);
01313   me->setBinLabel(4, "P0", 1);
01314   me->setBinLabel(5, "P1", 1);
01315   me->setBinLabel(6, "P2", 1);
01316 
01317 }
01318 
01319 
01320 //--------------------------------------------------------
01321 void L1TDTTFClient::setQualLabel(MonitorElement *me, int axis)
01322 {
01323 
01324   if( axis == 1 )
01325     me->setAxisTitle("Quality", axis);
01326   me->setBinLabel(1, "T34", axis);
01327   me->setBinLabel(2, "T23/24", axis);
01328   me->setBinLabel(3, "T12/13/14", axis);
01329   me->setBinLabel(4, "T234", axis);
01330   me->setBinLabel(5, "T134", axis);
01331   me->setBinLabel(6, "T123/124", axis);
01332   me->setBinLabel(7, "T1234", axis);
01333 }
01334 
01335 
01336 
01337 
01338 
01339 
01340 
01341 
01342