CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/DQM/L1TMonitorClient/src/L1TDTTFClient.cc

Go to the documentation of this file.
00001 /*
00002  * \file L1TDTTFClient.cc
00003  *
00004  * $Date: 2012/06/14 16:38:30 $
00005  * $Revision: 1.9 $
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   testpath_ = l1tdttffolder_ + "/09-TEST";
00064 
00066   char hname[100];//histo name
00067   char mename[100];//ME name
00068 
00070   dbe_->setCurrentFolder( inclusivepath_ );
00071 
00073   sprintf(hname, "dttf_02_nTracks");
00074   sprintf(mename, "DTTF Tracks by Wheel");
00075   dttf_nTracks_integ = dbe_->book1D(hname, mename, 6, 0, 6);
00076   setWheelLabel( dttf_nTracks_integ );
00077 
00079   sprintf(hname, "dttf_03_tracks_occupancy_summary");
00080   sprintf(mename, "DTTF Tracks Occupancy");
00081   dttf_occupancySummary = dbe_->book2D( hname, mename, 6, 0, 6, 12, 1, 13 );
00082   setWheelLabel( dttf_occupancySummary );
00083   dttf_occupancySummary->setAxisTitle("Sector", 2);
00084 
00086 
00088   sprintf(hname, "dttf_05_bx_occupancy");
00089   sprintf(mename, "DTTF Tracks BX Distribution by Wheel");
00090   dttf_bx_summary = dbe_->book2D( hname, mename, 6, 0, 6, 3, -1, 2 );
00091   setWheelLabel( dttf_bx_summary );
00092   dttf_bx_summary->setAxisTitle("BX", 2 );
00093 
00095   sprintf(hname, "dttf_06_bx");
00096   sprintf(mename, "DTTF Tracks BX w.r.t. Tracks with BX=0");
00097   dttf_bx_integ = dbe_->book1D( hname, mename, 3, -1.5, 1.5 );
00098   dttf_bx_integ->setAxisTitle("BX", 1);
00099 
00101   sprintf(hname, "dttf_07_quality");
00102   sprintf(mename, "DTTF Tracks Quality distribution");
00103   dttf_quality_integ = dbe_->book1D(hname, mename, 7, 1, 8);
00104   setQualLabel( dttf_quality_integ, 1);
00105 
00107   sprintf(hname, "dttf_08_quality_occupancy");
00108   sprintf(mename, "DTTF Tracks Quality distribution by Wheel");
00109   dttf_quality_summary = dbe_->book2D( hname, mename, 6, 0, 6, 7, 1, 8 );
00110   dttf_quality_summary->setAxisTitle("Wheel", 1);
00111   setQualLabel( dttf_quality_summary, 2);
00112   setWheelLabel( dttf_quality_summary );
00113 
00115   sprintf(hname, "dttf_09_highQuality_Tracks");
00116   sprintf(mename, "Fraction of DTTF Tracks with Quality>3");
00117   dttf_highQual_Summary = dbe_->book2D( hname, mename, 6, 0, 6, 12, 1, 13 );
00118   setWheelLabel( dttf_highQual_Summary );
00119   dttf_highQual_Summary->setAxisTitle("Sector", 2);
00120 
00121 
00123   sprintf(hname, "dttf_10_phi_vs_etaCoarse");
00124   sprintf(mename, "#eta-#phi DTTF Tracks occupancy (coarse #eta only, packed values)");
00125   dttf_phi_eta_coarse_integ = dbe_->book2D( hname, mename, 64, 0, 64,
00126                                             144, -6, 138. );
00127   dttf_phi_eta_coarse_integ->setAxisTitle("#eta", 1);
00128   dttf_phi_eta_coarse_integ->setAxisTitle("#phi", 2);
00129 
00131   sprintf(hname, "dttf_11_phi_vs_etaFine");
00132   sprintf(mename, "#eta-#phi DTTF Tracks occupancy (fine #eta only, packed values)");
00133   dttf_phi_eta_fine_integ = dbe_->book2D( hname, mename, 64, 0, 64,
00134                                           144, -6, 138. );
00135   dttf_phi_eta_fine_integ->setAxisTitle("#eta", 1);
00136   dttf_phi_eta_fine_integ->setAxisTitle("#phi", 2);
00137 
00139   sprintf(hname, "dttf_12_phi_vs_eta");
00140   sprintf(mename, "#eta-#phi DTTF Tracks occupancy");
00141   dttf_phi_eta_integ = dbe_->book2D( hname, mename, 64, -1.2, 1.2,
00142                                      144, -15, 345. );
00143   dttf_phi_eta_integ->setAxisTitle("#eta", 1);
00144   dttf_phi_eta_integ->setAxisTitle("#phi", 2);
00145 
00147   sprintf(hname, "dttf_13_eta_fine_fraction");
00148   sprintf(mename, "Fraction of DTTF Tracks with Fine #eta Assignment");
00149   dttf_eta_fine_fraction = dbe_->book1D( hname, mename, 6, 0, 6 );
00150   setWheelLabel(dttf_eta_fine_fraction);
00151   dttf_eta_fine_fraction->setAxisTitle("", 2);
00152 
00154 
00156   sprintf(hname, "dttf_14_eta");
00157   sprintf(mename, "DTTF Tracks #eta distribution (Packed values)");
00158   dttf_eta_integ = dbe_->book1D(hname, mename, 64, -0.5, 63.5);
00159   dttf_eta_integ->setAxisTitle("#eta", 1);
00160 
00162   sprintf(hname, "dttf_15_phi");
00163   sprintf(mename, "DTTF Tracks Phi distribution (Packed values)");
00164   dttf_phi_integ = dbe_->book1D(hname, mename, 144, -6, 138. );
00165   dttf_phi_integ->setAxisTitle("#phi", 1);
00166 
00168   sprintf(hname, "dttf_16_pt");
00169   sprintf(mename, "DTTF Tracks p_{T} distribution (Packed values)");
00170   dttf_pt_integ  = dbe_->book1D(hname, mename, 32, -0.5, 31.5);
00171   dttf_pt_integ->setAxisTitle("p_{T}", 1);
00172 
00174   sprintf(hname, "dttf_17_charge");
00175   sprintf(mename, "DTTF Tracks Charge distribution");
00176   dttf_q_integ = dbe_->book1D(hname, mename, 2, -0.5, 1.5);
00177   dttf_q_integ->setAxisTitle("Charge", 1);
00178 
00179 
00180 
00182   sprintf(hname, "dttf_18_2ndTrack_occupancy_summary");
00183   sprintf(mename, "DTTF 2nd Tracks occupancy w.r.t. Tracks with BX=0");
00184   dttf_2ndTrack_Summary = dbe_->book2D( hname, mename, 6, 0, 6, 12, 1, 13 );
00185   setWheelLabel( dttf_2ndTrack_Summary );
00186 
00187 
00188 
00192   dbe_->setCurrentFolder( gmtpath_ );
00193   sprintf(hname, "dttf_gmt_fract_matching" );
00194   sprintf(mename, "Fraction of DTTF tracks matching with GMT tracks" );
00195   dttf_gmt_matching = dbe_->book1D( hname, mename, 3, 1, 4);
00196   dttf_gmt_matching->setBinLabel(1, "GMT Only", 1);
00197   dttf_gmt_matching->setBinLabel(2, "Matching", 1);
00198   dttf_gmt_matching->setBinLabel(3, "DTTF Only", 1);
00199 
00200 
00204 
00205   dbe_->setCurrentFolder( testpath_ );
00206   sprintf(hname, "dttf_01_tracks_occupancy_test_summary");
00207   sprintf(mename, "DTTF Tracks Occupancy");
00208   dttf_occupancySummary_test = dbe_->book2D( hname, mename, 6, 0, 6, 12, 1, 13 );
00209   setWheelLabel( dttf_occupancySummary_test );
00210   dttf_occupancySummary_test->setAxisTitle("Sector", 2);
00211 
00212 
00216   dbe_->setCurrentFolder( inclusivepath_ + "/2ND_TRACK_ONLY");
00217 
00219   sprintf(hname, "dttf_01_nTracks_2ndTrack");
00220   sprintf(mename, "DTTF 2nd Tracks per Wheel distribution");
00221   dttf_nTracks_integ_2ndTrack = dbe_->book1D(hname, mename, 6, 0, 6);
00222   setWheelLabel( dttf_nTracks_integ_2ndTrack );
00223 
00225   sprintf(hname, "dttf_02_occupancy_summary_2ndTrack");
00226   sprintf(mename, "DTTF 2nd Tracks distribution by Sector and Wheel");
00227   dttf_occupancySummary_2ndTrack = dbe_->book2D( hname, mename, 6, 0, 6,
00228                                                  12, 1, 13 );
00229   setWheelLabel( dttf_occupancySummary_2ndTrack );
00230 
00232   sprintf(hname, "dttf_03_bx_occupancy_2ndTrack");
00233   sprintf(mename, "DTTF 2nd Tracks BX Distribution by Wheel");
00234   dttf_bx_summary_2ndTrack = dbe_->book2D( hname, mename, 6, 0, 6, 3, -1, 2 );
00235   setWheelLabel( dttf_bx_summary_2ndTrack );
00236   dttf_bx_summary_2ndTrack->setAxisTitle("BX", 2 );
00237 
00239   sprintf(hname, "dttf_04_bx_2ndTrack");
00240   sprintf(mename, "Fraction of DTTF Tracks BX w.r.t. Tracks with BX=0");
00241   dttf_bx_integ_2ndTrack = dbe_->book1D( hname, mename, 3, -1.5, 1.5 );
00242   dttf_bx_integ_2ndTrack->setAxisTitle("BX", 1);
00243 
00245   sprintf(hname, "dttf_05_quality_2ndTrack");
00246   sprintf(mename, "DTTF 2nd Tracks Quality distribution");
00247   dttf_quality_integ_2ndTrack  = dbe_->book1D(hname, mename, 7, 0.5, 7.5);
00248   dttf_quality_integ_2ndTrack->setAxisTitle("Quality", 1);
00249   setQualLabel( dttf_quality_integ_2ndTrack, 1);
00250 
00252   sprintf(hname, "dttf_06_quality_occupancy_2ndTrack");
00253   sprintf(mename, "DTTF 2nd Tracks Quality distribution by Wheel");
00254   dttf_quality_summary_2ndTrack = dbe_->book2D( hname, mename,
00255                                                 6, 0, 6, 7, 1, 8 );
00256   dttf_quality_summary_2ndTrack->setAxisTitle("Wheel", 1);
00257   setQualLabel( dttf_quality_summary_2ndTrack, 2);
00258   setWheelLabel( dttf_quality_summary_2ndTrack );
00259 
00261   sprintf(hname, "dttf_07_highQuality_Tracks_2ndTrack");
00262   sprintf(mename, "Fraction of DTTF 2nd Tracks with Quality>3");
00263   dttf_highQual_Summary_2ndTrack = dbe_->book2D( hname, mename, 6, 0, 6,
00264                                                  12, 1, 13 );
00265   dttf_highQual_Summary_2ndTrack->setAxisTitle("Sector", 2);
00266   setWheelLabel( dttf_highQual_Summary_2ndTrack );
00267 
00269   sprintf(hname, "dttf_08_phi_vs_eta_2ndTrack");
00270   sprintf(mename, "#eta-#phi DTTF Tracks occupancy for 2nd Tracks");
00271   dttf_phi_eta_integ_2ndTrack = dbe_->book2D( hname, mename, 64, 0, 64,
00272                                               144, -6, 138. );
00273   dttf_phi_eta_integ_2ndTrack->setAxisTitle("#eta", 1);
00274   dttf_phi_eta_integ_2ndTrack->setAxisTitle("#phi", 2);
00275 
00277   sprintf(hname, "dttf_09_eta_2ndTrack");
00278   sprintf(mename, "DTTF 2nd Tracks #eta distribution (Packed values)");
00279   dttf_eta_integ_2ndTrack = dbe_->book1D(hname, mename, 64, -0.5, 63.5);
00280   dttf_eta_integ_2ndTrack->setAxisTitle("#eta", 1);
00281 
00283   sprintf(hname, "dttf_10_phi_2ndTrack");
00284   sprintf(mename, "DTTF 2nd Tracks Phi distribution (Packed values)");
00285   dttf_phi_integ_2ndTrack = dbe_->book1D(hname, mename, 144, -6, 138 );
00286   dttf_phi_integ_2ndTrack->setAxisTitle("#phi", 1);
00287 
00289   sprintf(hname, "dttf_11_pt_2ndTrack");
00290   sprintf(mename, "DTTF 2nd Tracks p_{T} distribution (Packed values)");
00291   dttf_pt_integ_2ndTrack  = dbe_->book1D(hname, mename, 32, -0.5, 31.5);
00292   dttf_pt_integ_2ndTrack->setAxisTitle("p_{T}", 1);
00293 
00295   sprintf(hname, "dttf_12_charge_2ndTrack");
00296   sprintf(mename, "DTTF 2nd Tracks Charge distribution");
00297   dttf_q_integ_2ndTrack = dbe_->book1D(hname, mename, 2, -0.5, 1.5);
00298   dttf_q_integ_2ndTrack->setAxisTitle("Charge", 1);
00299 
00300 
00301   for ( unsigned int wh = 0; wh < 6 ; ++wh ) {
00302     dbe_->setCurrentFolder( wheelpath_[wh] );
00303 
00305     sprintf( hname, "dttf_02_nTracks_wh%s", wheel_[wh].c_str() );
00306     sprintf( mename, "Wheel %s - Number of Tracks", wheel_[wh].c_str() );
00307     dttf_nTracks_wheel[wh] = dbe_->book1D( hname, mename, 12, 1, 13);
00308     dttf_nTracks_wheel[wh]->setAxisTitle("sector", 1);
00309  
00311     sprintf(hname, "dttf_03_bx_occupancy_wh%s",  wheel_[wh].c_str() );
00312     sprintf(mename, "Wheel %s - DTTF Tracks BX distribution by Sector",
00313             wheel_[wh].c_str());
00314     dttf_bx_wheel_summary[wh] = dbe_->book2D( hname, mename, 12, 1, 13, 3, -1, 2);
00315     dttf_bx_wheel_summary[wh]->setAxisTitle("BX", 2 );
00316     dttf_bx_wheel_summary[wh]->setAxisTitle("Sector", 1 );
00317 
00319     sprintf(hname, "dttf_04_bx_wh%s", wheel_[wh].c_str());
00320     sprintf(mename, "Wheel %s - DTTF Tracks BX w.r.t. Tracks with BX=0", wheel_[wh].c_str());
00321     dttf_bx_wheel_integ[wh] = dbe_->book1D(hname, mename, 3, -1.5, 1.5);
00322     dttf_bx_wheel_integ[wh]->setAxisTitle("BX", 1);
00323 
00325     sprintf(hname, "dttf_05_quality_wh%s", wheel_[wh].c_str() );
00326     sprintf(mename, "Wheel %s - Tracks Quality Distribution", wheel_[wh].c_str() );
00327     dttf_quality_wheel[wh] = dbe_->book1D(hname, mename, 7, 1, 8);
00328     dttf_quality_wheel[wh]->setAxisTitle("Quality", 1);
00329     setQualLabel(dttf_quality_wheel[wh], 1);
00330 
00332     sprintf(hname, "dttf_06_quality_summary_wh%s", wheel_[wh].c_str() );
00333     sprintf(mename, "Wheel %s - Tracks Quality Distribution by Sector",
00334             wheel_[wh].c_str() );
00335     dttf_quality_summary_wheel[wh] = dbe_->book2D(hname, mename, 12, 1, 13, 7, 1, 8);
00336     dttf_quality_summary_wheel[wh]->setAxisTitle("Sector", 1);
00337     // dttf_quality_summary_wheel[wh]->setAxisTitle("Quality", 2);
00338     setQualLabel(dttf_quality_summary_wheel[wh], 2);
00339 
00341     sprintf(hname, "dttf_09_etaFine_fraction_wh%s",  wheel_[wh].c_str() );
00342     sprintf(mename, "Wheel %s - Fraction of DTTF Tracks with fine #eta assignment",
00343             wheel_[wh].c_str());
00344     dttf_fine_fraction_wh[wh] = dbe_->book1D( hname, mename, 12, 1, 13);
00345     dttf_fine_fraction_wh[wh]->setAxisTitle("Sector", 1 );
00346 
00347 
00349     sprintf(hname, "dttf_10_eta_wh%s", wheel_[wh].c_str() );
00350     sprintf(mename, "Wheel %s - DTTF Tracks #eta distribution (Packed values)",
00351             wheel_[wh].c_str() );
00352     dttf_eta_wheel[wh] = dbe_->book1D(hname, mename, 64, -0.5, 63.5 );
00353     dttf_eta_wheel[wh]->setAxisTitle("#eta", 1 );
00354 
00356     sprintf(hname, "dttf_11_phi_wh%s", wheel_[wh].c_str() );
00357     sprintf(mename, "Wheel %s - DTTF Tracks Phi distribution (Packed values)",
00358             wheel_[wh].c_str() );
00359     dttf_phi_wheel[wh] = dbe_->book1D(hname, mename, 144, -6, 138. );
00360     dttf_phi_wheel[wh]->setAxisTitle("#phi", 1);
00361 
00363     sprintf(hname, "dttf_12_pt_wh%s", wheel_[wh].c_str() );
00364     sprintf(mename, "Wheel %s - DTTF Tracks p_{T} distribution (Packed values)",
00365             wheel_[wh].c_str() );
00366     dttf_pt_wheel[wh] = dbe_->book1D(hname, mename, 32, -0.5, 31.5);
00367     dttf_pt_wheel[wh]->setAxisTitle("p_{T}", 1);
00368 
00370     sprintf(hname, "dttf_13_charge_wh%s", wheel_[wh].c_str() );
00371     sprintf(mename, "Wheel %s - DTTF Tracks Charge distribution",
00372             wheel_[wh].c_str() );
00373     dttf_q_wheel[wh] = dbe_->book1D(hname, mename, 2, -0.5, 1.5);
00374     dttf_q_wheel[wh]->setAxisTitle("Charge", 1);
00375 
00376   }
00377 
00378 
00380   for ( unsigned int wh = 0; wh < 6 ; ++wh ) {
00381     dbe_->setCurrentFolder( wheelpath_[wh]  + "/2ND_TRACK_ONLY" );
00382 
00384     sprintf( hname, "dttf_01_nTracks_wh%s_2ndTrack", wheel_[wh].c_str() );
00385     sprintf( mename, "Wheel %s - DTTF Number of 2nd Tracks with BX=0",
00386              wheel_[wh].c_str() );
00387     dttf_nTracks_wheel_2ndTrack[wh] = dbe_->book1D( hname, mename,
00388                                                      12, 1, 13);
00389     dttf_nTracks_wheel_2ndTrack[wh]->setAxisTitle("sector", 1);
00390  
00392     sprintf(hname, "dttf_02_bx_occupancy_wh%s_2ndTrack",  wheel_[wh].c_str() );
00393     sprintf(mename, "Wheel %s - DTTF 2nd Tracks BX distribution by Sector",
00394             wheel_[wh].c_str());
00395     dttf_bx_wheel_summary_2ndTrack[wh] = dbe_->book2D( hname, mename, 12, 1, 13, 3, -1, 2);
00396     dttf_bx_wheel_summary_2ndTrack[wh]->setAxisTitle("BX", 2 );
00397     dttf_bx_wheel_summary_2ndTrack[wh]->setAxisTitle("Sector", 1 );
00398 
00400     sprintf(hname, "dttf_03_bx_wh%s_2ndTrack", wheel_[wh].c_str());
00401     sprintf(mename, "Wheel %s - 2nd Tracks BX Distribution", wheel_[wh].c_str());
00402     dttf_bx_wheel_integ_2ndTrack[wh] = dbe_->book1D(hname, mename, 3, -1.5, 1.5);
00403     dttf_bx_wheel_integ_2ndTrack[wh]->setAxisTitle("BX", 1);
00404 
00405 
00406   }
00407 
00408 
00409 
00410 }
00411 
00412 //--------------------------------------------------------
00413 void L1TDTTFClient::beginRun(const edm::Run& r, const edm::EventSetup& context)
00414 {
00415 }
00416 
00417 //--------------------------------------------------------
00418 void L1TDTTFClient::beginLuminosityBlock( const edm::LuminosityBlock& lumiSeg,
00419                                           const edm::EventSetup& context)
00420 {
00422   ++counterLS_;
00423 
00424   if ( online_ && !( counterLS_ % resetafterlumi_ ) ) {
00425     char hname[60];
00426     sprintf( hname, "%s/dttf_04_tracks_occupancy_by_lumi",
00427              inclusivepath_.c_str() );
00428 
00429     occupancy_r_ = getTH2F(hname);
00430     if ( ! occupancy_r_ ) {
00431       edm::LogError("L1TDTTFClient::beginLuminosityBlock:ME")
00432         << "Failed to get TH2D " << std::string(hname);
00433     } else {
00434       edm::LogInfo("L1TDTTFClient::beginLuminosityBlock:RESET") << "Reseting plots by lumi!";
00435       occupancy_r_->Reset();
00436     }
00437   }
00438 
00439 }
00440 
00441 //--------------------------------------------------------
00442 void L1TDTTFClient::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
00443                                        const edm::EventSetup& c)
00444 {
00445 
00447   if (  online_  ) {
00448     makeSummary();
00449     if ( occupancy_r_ ) normalize( occupancy_r_ );
00450   }
00451 
00452 }
00453 
00454 //--------------------------------------------------------
00455 void L1TDTTFClient::analyze(const edm::Event& e,
00456                             const edm::EventSetup& context)
00457 {
00458 
00459 
00460 }
00461 
00462 //--------------------------------------------------------
00463 void L1TDTTFClient::endRun(const edm::Run& r, const edm::EventSetup& context)
00464 {
00465   makeSummary();
00466 }
00467 
00468 //--------------------------------------------------------
00469 void L1TDTTFClient::endJob()
00470 {
00471 }
00472 
00473 
00474 //--------------------------------------------------------
00475 void L1TDTTFClient::makeSummary()
00476 {
00480   buildSummaries();
00481 
00485   double scale = 0;
00486   double entries = dttf_occupancySummary->getTH2F()->Integral();
00487 
00488   if ( entries ) {
00489 
00491     normalize( dttf_bx_summary->getTH2F() );
00492 
00494     scale = 1 / entries;
00495     normalize( dttf_occupancySummary->getTH2F(), scale );
00496     normalize( dttf_nTracks_integ->getTH1F(), scale );
00497 
00499     double physEntries = dttf_eta_integ->getTH1F()->Integral();
00500     if ( physEntries > 0 ) {
00501       double physScale = 1 / physEntries;
00502 
00503       normalize( dttf_phi_eta_integ->getTH2F(), physScale );
00504 
00505       normalize( dttf_phi_eta_fine_integ->getTH2F(), physScale );
00506       normalize( dttf_phi_eta_coarse_integ->getTH2F(), physScale );
00507       normalize( dttf_quality_summary->getTH2F(), physScale );
00508 
00509       normalize( dttf_eta_integ->getTH1F(), physScale );
00510       normalize( dttf_q_integ->getTH1F(), physScale );
00511       normalize( dttf_pt_integ->getTH1F(), physScale );
00512       normalize( dttf_phi_integ->getTH1F(), physScale );
00513       normalize( dttf_quality_integ->getTH1F(), physScale );
00514 
00515     }
00516 
00517   }
00518 
00522 
00523   double entries2ndTrack = dttf_occupancySummary_2ndTrack->getTH2F()->Integral();
00524   if ( entries2ndTrack > 0 ) {
00525 
00527     normalize( dttf_bx_summary_2ndTrack->getTH2F() ); //
00528 
00530     TH2F * ratio = dttf_occupancySummary_2ndTrack->getTH2F();
00531     buildHighQualityPlot( ratio, dttf_highQual_Summary_2ndTrack,
00532                           "%s/2ND_TRACK_ONLY/dttf_05_quality_summary_wh%s_2ndTrack" );
00533 
00534     normalize( dttf_2ndTrack_Summary->getTH2F(), scale ); //
00535 
00537     double scale2nd = 1 / entries2ndTrack;
00538     normalize( dttf_occupancySummary_2ndTrack->getTH2F(), scale2nd ); //
00539     normalize( dttf_nTracks_integ_2ndTrack->getTH1F(), scale2nd ); //
00540 
00541 
00543     normalize( dttf_phi_eta_integ_2ndTrack->getTH2F() );
00544     normalize( dttf_q_integ_2ndTrack->getTH1F() );
00545     normalize( dttf_pt_integ_2ndTrack->getTH1F() );
00546     normalize( dttf_phi_integ_2ndTrack->getTH1F() );
00547     normalize( dttf_eta_integ_2ndTrack->getTH1F() );
00548     normalize( dttf_quality_integ_2ndTrack->getTH1F() );
00549     normalize( dttf_quality_summary_2ndTrack->getTH2F() );
00550 
00551   }
00552 
00554   setGMTsummary();
00555 
00556 }
00557 
00558 
00559 
00560 
00561 //--------------------------------------------------------
00562 void L1TDTTFClient::buildSummaries()
00563 {
00564 
00565   char hname[100];
00566   int wheelBx[4]; 
00567   int wheelBx2nd[4]; 
00568   int wheelSumBx[4]; 
00569   int wheelSumBx2nd[4]; 
00570   int qualities[8]; 
00571 
00572   memset( wheelSumBx, 0, 4 * sizeof(int) );
00573   memset( wheelSumBx2nd, 0, 4 * sizeof(int) );
00574 
00576   dttf_eta_integ->Reset();
00577   dttf_q_integ->Reset();
00578   dttf_pt_integ->Reset();
00579   dttf_phi_integ->Reset();
00580   dttf_quality_integ->Reset();
00581   dttf_phi_eta_integ->Reset();
00582   dttf_phi_eta_fine_integ->Reset();
00583   dttf_phi_eta_coarse_integ->Reset();
00584   dttf_q_integ_2ndTrack->Reset();
00585   dttf_pt_integ_2ndTrack->Reset();
00586   dttf_phi_integ_2ndTrack->Reset();
00587   dttf_eta_integ_2ndTrack->Reset();
00588 
00590   dttf_quality_integ_2ndTrack->Reset();
00591   dttf_quality_summary_2ndTrack->Reset();
00592  
00593   for ( unsigned int wh = 0; wh < 6 ; ++wh ) {
00594 
00595     dttf_eta_wheel[wh]->Reset();
00596     dttf_q_wheel[wh]->Reset();
00597     dttf_pt_wheel[wh]->Reset();
00598     dttf_phi_wheel[wh]->Reset();
00599     dttf_quality_wheel[wh]->Reset();
00600     dttf_quality_summary_wheel[wh]->Reset();
00601  
00602     double wheelEtaAll = 0; 
00603     double wheelEtaFine = 0; 
00604     memset( wheelBx, 0, 4 * sizeof(int) );
00605     memset( wheelBx2nd, 0, 4 * sizeof(int) );
00606 
00608     memset( qualities, 0, 8 * sizeof(int) );
00609 
00613     buildPhiEtaPlotOFC( dttf_phi_eta_fine_integ, dttf_phi_eta_coarse_integ,
00614                         dttf_phi_eta_integ,
00615                         "%s/dttf_07_phi_vs_etaFine_wh%s",
00616                         "%s/dttf_08_phi_vs_etaCoarse_wh%s", wh );
00617 
00618     buildPhiEtaPlotO( dttf_phi_eta_integ_2ndTrack,
00619                       "%s/2ND_TRACK_ONLY/dttf_06_phi_vs_eta_wh%s_2ndTrack",
00620                       wh );
00621 
00622 
00626     for ( unsigned int sector = 1; sector < 13; ++sector ) {
00627 
00631       sprintf( hname, "%s/BX_BySector/dttf_bx_wh%s_se%d",
00632                wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector );
00633       
00634       TH1F * bxsector = getTH1F(hname);
00635       if ( ! bxsector ) {
00636         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00637                                                        << std::string(hname);
00638       } else {
00639       
00640         for ( unsigned int bx = 1; bx < 4 ; ++bx ) {
00641 
00642           int bxval = bxsector->GetBinContent( bx );
00643 
00644           if ( bx == 2 ) {
00645             // if ( wh == 2 )
00646             //   dttf_occupancySummary->setBinContent( wh+1, sector, bxval*14 );
00647             // else
00648             //   dttf_occupancySummary->setBinContent( wh+1, sector, bxval );
00649             dttf_occupancySummary->setBinContent( wh+1, sector, bxval );
00650             dttf_occupancySummary_test->setBinContent( wh+1, sector, bxval );
00651             dttf_nTracks_wheel[wh]->setBinContent(sector, bxval );
00652           }
00653           wheelBx[bx] += bxval;
00654           dttf_bx_wheel_summary[wh]->setBinContent( sector, bx, bxval );
00655         }
00656       }
00657 
00658 
00662       sprintf( hname, "%s/BX_BySector/2ND_TRACK_ONLY/dttf_bx_2ndTrack_wh%s_se%d",
00663                wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector );
00664       
00665       TH1F * bxsector2nd = getTH1F(hname);
00666       if ( ! bxsector2nd ) {
00667         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00668                                                        << std::string(hname);
00669       } else {
00670       
00671         for ( unsigned int bx = 1; bx < 4 ; ++bx ) {
00672           int bxval = bxsector2nd->GetBinContent( bx );
00673 
00674           if ( bx == 2 ) {
00675             dttf_2ndTrack_Summary->setBinContent( wh+1, sector, bxval );
00676             dttf_occupancySummary_2ndTrack->setBinContent(wh+1, sector, bxval);
00677             dttf_nTracks_wheel_2ndTrack[wh]->setBinContent(sector, bxval );
00678           }
00679           wheelBx2nd[bx] += bxval;
00680           dttf_bx_wheel_summary_2ndTrack[wh]->setBinContent(sector, bx, bxval);
00681         }
00682       }
00683 
00687       sprintf( hname, "%s/Charge/dttf_charge_wh%s_se%d", 
00688                wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector );
00689       TH1F * tmp = getTH1F(hname);
00690       if ( ! tmp ) {
00691         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00692                                                        << std::string(hname);
00693       } else {
00694         dttf_q_integ->getTH1F()->Add( tmp );
00695         dttf_q_wheel[wh]->getTH1F()->Add( tmp );
00696       }
00697 
00701       sprintf( hname, "%s/PT/dttf_pt_wh%s_se%d", 
00702                wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector );
00703       tmp = getTH1F(hname);
00704       if ( ! tmp ) {
00705         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00706                                                        << std::string(hname);
00707       } else {
00708         dttf_pt_integ->getTH1F()->Add( tmp );
00709         dttf_pt_wheel[wh]->getTH1F()->Add( tmp );
00710       }
00711 
00712 
00716       sprintf( hname, "%s/Phi/dttf_phi_wh%s_se%d", 
00717                wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector );
00718       tmp = getTH1F(hname);
00719       if ( ! tmp ) {
00720         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00721                                                        << std::string(hname);
00722       } else {
00723         dttf_phi_integ->getTH1F()->Add( tmp );
00724         dttf_phi_wheel[wh]->getTH1F()->Add( tmp );
00725       }
00726 
00727 
00731       double highQual = 0; 
00732       double denHighQual = 0; 
00733       sprintf( hname, "%s/Quality/dttf_qual_wh%s_se%d", 
00734                wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector );
00735       tmp = getTH1F(hname);
00736       if ( ! tmp ) {
00737         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00738                                                        << std::string(hname);
00739       } else {
00740 
00741         dttf_quality_wheel[wh]->getTH1F()->Add( tmp );
00742 
00743 
00744         for ( unsigned int qual = 1; qual < 4 ; ++qual ) {
00745           double bincontent = tmp->GetBinContent( qual );
00746           qualities[qual] += bincontent;
00747           denHighQual += bincontent;
00748           dttf_quality_summary_wheel[wh]->setBinContent(sector, qual, bincontent);
00749         }
00750 
00751         for ( unsigned int qual = 4; qual < 8 ; ++qual ) {
00752           double bincontent = tmp->GetBinContent( qual );
00753           qualities[qual] += bincontent;
00754           dttf_quality_summary_wheel[wh]->setBinContent(sector, qual, bincontent);
00755           denHighQual += bincontent;
00756           highQual += bincontent;
00757         }
00758 
00759       }
00760       if ( denHighQual > 0 ) highQual /= denHighQual;
00761       dttf_highQual_Summary->setBinContent( wh+1, sector, highQual );
00762 
00763 
00767       sprintf( hname, "%s/Eta/dttf_eta_wh%s_se%d", 
00768                wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector );
00769       tmp = getTH1F(hname);
00770       if ( ! tmp ) {
00771         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00772                                                        << std::string(hname);
00773       } else {
00774         dttf_eta_integ->getTH1F()->Add( tmp );
00775         dttf_eta_wheel[wh]->getTH1F()->Add( tmp );
00776       }
00777 
00778 
00782       sprintf( hname, "%s/EtaFineFraction/dttf_etaFine_fraction_wh%s_se%d", 
00783                wheelpath_[wh].c_str(), wheel_[wh].c_str(), sector );
00784       tmp = getTH1F(hname);
00785       if ( ! tmp ) {
00786         edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00787                                                        << std::string(hname);
00788       } else {
00789         double fine = tmp->GetBinContent( 1 );
00790         double coarse = tmp->GetBinContent( 2 );
00791         double tot = fine + coarse;
00792         wheelEtaAll += tot;
00793         wheelEtaFine += fine;
00794         if ( tot > 0 ) {
00795           dttf_fine_fraction_wh[wh]->setBinContent( sector, fine/tot );
00796         }
00797       }
00798 
00799     }
00800 
00804     if ( wheelEtaAll > 0 ) {
00805       dttf_eta_fine_fraction->setBinContent( wh+1, wheelEtaFine/wheelEtaAll );
00806     }
00807 
00811     dttf_nTracks_integ->setBinContent( wh+1, wheelBx[2] );
00812     dttf_nTracks_integ_2ndTrack->setBinContent( wh+1, wheelBx2nd[2] );
00813 
00817     for ( unsigned int bx = 1; bx < 4; ++bx ) {
00818 
00819       dttf_bx_wheel_integ[wh]->setBinContent( bx, wheelBx[bx] );
00820       dttf_bx_summary->setBinContent( wh+1, bx, wheelBx[bx] );
00821       wheelSumBx[bx] += wheelBx[bx];
00822 
00823       dttf_bx_wheel_integ_2ndTrack[wh]->setBinContent( bx, wheelBx2nd[bx] );
00824       dttf_bx_summary_2ndTrack->setBinContent( wh+1, bx, wheelBx2nd[bx] );
00825       wheelSumBx2nd[bx] += wheelBx2nd[bx];
00826 
00827     }
00828 
00829 
00833     for ( unsigned int qual = 1; qual < 8 ; ++qual ) {
00834       dttf_quality_summary->setBinContent( wh+1, qual, qualities[qual] );
00835       dttf_quality_integ->getTH1F()->AddBinContent( qual, qualities[qual] );
00836     }
00837 
00838 
00842     normalize( dttf_bx_wheel_summary[wh]->getTH2F() );
00843     normalize( dttf_bx_wheel_summary_2ndTrack[wh]->getTH2F() );
00844     normalize( dttf_nTracks_wheel[wh]->getTH1F() );
00845     normalize( dttf_nTracks_wheel_2ndTrack[wh]->getTH1F() );
00846     normalize( dttf_quality_summary_wheel[wh]->getTH2F() );
00847     normalize( dttf_quality_wheel[wh]->getTH1F() );
00848     normalize( dttf_eta_wheel[wh]->getTH1F() );
00849     normalize( dttf_q_wheel[wh]->getTH1F() );
00850     normalize( dttf_pt_wheel[wh]->getTH1F() );
00851     normalize( dttf_phi_wheel[wh]->getTH1F() );
00852 
00856     double scale = wheelBx[2];
00857     if ( scale > 0 ) {
00858       scale = 1/scale;
00859       normalize( dttf_bx_wheel_integ[wh]->getTH1F(), scale );
00860     }
00861 
00862     scale = wheelBx2nd[2];
00863     if ( scale > 0 ) {
00864       scale = 1/scale;
00865       normalize( dttf_bx_wheel_integ_2ndTrack[wh]->getTH1F(), scale );
00866     }
00867 
00868 
00869 
00870 
00876 
00877 
00881     sprintf( hname, "%s/2ND_TRACK_ONLY/dttf_07_eta_wh%s_2ndTrack", 
00882              wheelpath_[wh].c_str(), wheel_[wh].c_str() );
00883     
00884     TH1F * tmp = getTH1F(hname);
00885     if ( ! tmp ) {
00886       edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00887                                                      << std::string(hname);
00888     } else {
00889       dttf_eta_integ_2ndTrack->getTH1F()->Add( tmp );
00890     }
00891 
00895     sprintf( hname, "%s/2ND_TRACK_ONLY/dttf_08_phi_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_phi_integ_2ndTrack->getTH1F()->Add( tmp );
00903     }
00904 
00905 
00909     sprintf( hname, "%s/2ND_TRACK_ONLY/dttf_09_pt_wh%s_2ndTrack", 
00910              wheelpath_[wh].c_str(), wheel_[wh].c_str() );
00911     tmp = getTH1F(hname);
00912     if ( ! tmp ) {
00913       edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00914                                                      << std::string(hname);
00915     } else {
00916       dttf_pt_integ_2ndTrack->getTH1F()->Add( tmp );
00917     }
00918 
00922     sprintf( hname, "%s/2ND_TRACK_ONLY/dttf_10_charge_wh%s_2ndTrack", 
00923              wheelpath_[wh].c_str(), wheel_[wh].c_str() );
00924     tmp = getTH1F(hname);
00925     if ( ! tmp ) {
00926       edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00927                                                      << std::string(hname);
00928     } else {
00929       dttf_q_integ_2ndTrack->getTH1F()->Add( tmp );
00930     }
00931 
00935     sprintf( hname, "%s/2ND_TRACK_ONLY/dttf_04_quality_wh%s_2ndTrack", 
00936              wheelpath_[wh].c_str(), wheel_[wh].c_str() );
00937     tmp = getTH1F(hname);
00938     if ( ! tmp ) {
00939       edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00940                                                      << std::string(hname);
00941     } else {
00942       for ( unsigned int qual = 1; qual < 8; ++qual ) {
00943         double binqual = tmp->GetBinContent( qual );
00944         dttf_quality_integ_2ndTrack->getTH1F()->AddBinContent( qual, binqual );
00945         dttf_quality_summary_2ndTrack->setBinContent( wh+1, qual, binqual );
00946       }
00947     }
00948 
00949 
00950   }
00951 
00955   for ( unsigned int bx = 1; bx < 4; ++bx ) {
00956     dttf_bx_integ->setBinContent( bx, wheelSumBx[bx] );
00957     dttf_bx_integ_2ndTrack->setBinContent( bx, wheelSumBx2nd[bx] );
00958   }
00959 
00963   double scale = wheelSumBx[2];
00964   if ( scale > 0 ) {
00965     scale = 1./scale;
00966     normalize( dttf_bx_integ->getTH1F(), scale );
00967   }
00968 
00969   scale = wheelSumBx2nd[2];
00970   if ( scale > 0 ) {
00971     scale = 1./scale;
00972     normalize( dttf_bx_integ_2ndTrack->getTH1F(), scale );
00973   }
00974 
00975 
00976 }
00977 
00978 
00979 
00980 //--------------------------------------------------------
00981 void L1TDTTFClient::setGMTsummary()
00982 {
00983   char hname[60];
00984   sprintf( hname, "%s/dttf_tracks_with_gmt_match", gmtpath_.c_str() );
00985   TH2F * gmt_match = getTH2F(hname);
00986   if ( ! gmt_match ) {
00987     edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00988                                                    << std::string(hname);
00989     return;
00990   }
00991 
00992 
00993 
00994   sprintf( hname, "%s/dttf_tracks_without_gmt_match", gmtpath_.c_str() );
00995   TH2F * gmt_missed = getTH2F(hname);
00996   if ( ! gmt_missed ) {
00997     edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
00998                                                    << std::string(hname);
00999     return;
01000   }
01001 
01002 
01003   sprintf( hname, "%s/dttf_missing_tracks_in_gmt", gmtpath_.c_str() );
01004   TH2F * gmt_ghost = getTH2F(hname);
01005   if ( ! gmt_ghost ) {
01006     edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get TH1D "
01007                                                    << std::string(hname);
01008     return;
01009   }
01010 
01011   int match = gmt_match->Integral();
01012   int missed = gmt_missed->Integral();
01013   int ghost = gmt_ghost->Integral();
01014   float tot = match + missed + ghost;
01015   if ( tot > 0 ) {
01016     double val = ghost/tot;
01017     dttf_gmt_matching->setBinContent( 1, val );
01018     val = match/tot;
01019     dttf_gmt_matching->setBinContent( 2, val );
01020     val = missed/tot;
01021     dttf_gmt_matching->setBinContent( 3, val );
01022   }
01023 }
01024 
01025 
01026 
01027 //--------------------------------------------------------
01028 TH1F * L1TDTTFClient::getTH1F(const char * hname)
01029 {
01030 
01031   MonitorElement * me = dbe_->get(hname);
01032   if ( ! me ) {
01033     edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get ME "
01034                                                    << std::string(hname);
01035     return NULL;
01036   }
01037 
01038 
01039   //   edm::LogInfo("L1TDTTFClient::getTH1F") << "#################### "
01040   //                                     << std::string(hname);
01041 
01042   return me->getTH1F();
01043 
01044 }
01045 
01046 
01047 //--------------------------------------------------------
01048 TH2F * L1TDTTFClient::getTH2F(const char * hname)
01049 {
01050 
01051   MonitorElement * me = dbe_->get(hname);
01052   if ( ! me ) {
01053     edm::LogError("L1TDTTFClient::makeSummary:ME") << "Failed to get ME "
01054                                                    << std::string(hname);
01055     return NULL;
01056   }
01057 
01058 
01059   //   edm::LogInfo("L1TDTTFClient::getTH2F") << "#################### "
01060   //                                     << std::string(hname);
01061 
01062   return me->getTH2F();
01063 
01064 }
01065 
01066 
01067 //--------------------------------------------------------
01068 
01069 //--------------------------------------------------------
01070 void L1TDTTFClient::buildHighQualityPlot( TH2F * occupancySummary,
01071                                           MonitorElement * highQual_Summary,
01072                                           const std::string & path )
01073 {
01074 
01075   char hname[150];
01076 
01080   for ( unsigned int wh = 0; wh < 6 ; ++wh ) {
01081     sprintf( hname, path.c_str(), wheelpath_[wh].c_str(), wheel_[wh].c_str() );
01082 
01083     TH2F * quality = getTH2F(hname);
01084     if ( ! quality ) {
01085       edm::LogError("L1TDTTFClient::buildHighQualityPlot")
01086         << "Failed to get TH2F " << std::string(hname);
01087     } else {
01088 
01089       for ( unsigned int sec = 1; sec < 13 ; ++sec ) {
01090         double denHighQual = occupancySummary->GetBinContent( wh+1, sec );
01091         double val = 0;
01092         if ( denHighQual > 0 ) {
01093           for ( unsigned int qual = 4; qual < 8 ; ++qual ) {
01094             val += quality->GetBinContent( qual, sec );
01095           }
01096           val /= denHighQual;
01097         }
01098         highQual_Summary->setBinContent( wh+1, sec, val );
01099       }
01100     }
01101   }
01102 }
01103 
01104 //--------------------------------------------------------
01105 void L1TDTTFClient::buildPhiEtaPlotOFC( MonitorElement * phi_eta_fine_integ,
01106                                         MonitorElement * phi_eta_coarse_integ,
01107                                         MonitorElement * phi_eta_integ,
01108                                         const std::string & path_fine,
01109                                         const std::string & path_coarse,
01110                                         int wh )
01111 {
01112 
01113   char hname[150];
01114   sprintf( hname, path_fine.c_str(),
01115            wheelpath_[wh].c_str(), wheel_[wh].c_str() );
01116 
01117   TH2F * phi_vs_eta_fine = getTH2F(hname);
01118   if ( ! phi_vs_eta_fine ) {
01119     edm::LogError("L1TDTTFClient::buildPhiEtaPloOtFC")
01120       << "Failed to get TH1D " << std::string(hname);
01121   }
01122 
01123   sprintf( hname, path_coarse.c_str(),
01124            wheelpath_[wh].c_str(), wheel_[wh].c_str() );
01125   TH2F * phi_vs_eta_coarse = getTH2F(hname);
01126   if ( ! phi_vs_eta_coarse ) {
01127     edm::LogError("L1TDTTFClient::buildPhiEtaPlotOFC")
01128       << "Failed to get TH1D " << std::string(hname);
01129   }
01130 
01131   if ( ! phi_vs_eta_fine || ! phi_vs_eta_coarse ) {
01132     return;
01133   }
01134 
01135   for ( unsigned int phi = 1; phi < 145 ; ++phi ) {
01136     float start = 0;
01137     int nbins = 0;
01138     switch ( wh ) {
01139     case 0 : start = 0;  nbins = 18; break; // N2
01140     case 1 : start = 8;  nbins = 20; break; // N1
01141     case 2 : start = 22; nbins = 10; break; // N0
01142     case 3 : start = 22; nbins = 20; break; // P0
01143     case 4 : start = 36; nbins = 20; break; // P1
01144     case 5 : start = 46; nbins = 18; break; // P2
01145     default : start = 0; nbins = 0; break; // BOH
01146     }
01147 
01148     for ( int eta = 1; eta <= nbins ; ++eta ) {
01149       double setbin = eta + start;
01150 
01151       double valfine = phi_vs_eta_fine->GetBinContent( eta, phi )
01152         + phi_eta_fine_integ->getBinContent( setbin, phi );
01153 
01154       double valcoarse = phi_vs_eta_coarse->GetBinContent( eta, phi )
01155         + phi_eta_coarse_integ->getBinContent( setbin, phi );
01156 
01157       phi_eta_fine_integ->setBinContent( setbin, phi, valfine );
01158       phi_eta_coarse_integ->setBinContent( setbin, phi, valcoarse );
01159       phi_eta_integ->setBinContent( setbin, phi, valfine+valcoarse );
01160 
01161     }
01162 
01163     // double underflow_f = phi_vs_eta_fine->GetBinContent( 0, phi )
01164     //   + phi_eta_fine_integ->getBinContent( 1, phi );
01165     // phi_eta_fine_integ->setBinContent( 1, phi, underflow_f );
01166     // 
01167     // double underflow_c = phi_vs_eta_coarse->GetBinContent( 0, phi )
01168     //   + phi_eta_coarse_integ->getBinContent( 1, phi );
01169     // phi_eta_coarse_integ->setBinContent( 1, phi, underflow_c );
01170     // 
01171     // double overflow_f = phi_vs_eta_fine->GetBinContent( nbins+1, phi )
01172     //   + phi_eta_fine_integ->getBinContent( 64 );
01173     // phi_eta_fine_integ->setBinContent( 64, phi, overflow_f );
01174     // 
01175     // double overflow_c = phi_vs_eta_coarse->GetBinContent( nbins+1, phi )
01176     //   + phi_eta_coarse_integ->getBinContent( 64, phi );
01177     // phi_eta_coarse_integ->setBinContent( 64, phi, overflow_c );
01178     // 
01179     // double underflow = underflow_f + underflow_c;
01180     // phi_eta_integ->setBinContent( 1, phi, underflow );
01181     // 
01182     // double overflow = overflow_f + overflow_c;
01183     // phi_eta_integ->setBinContent( 64, phi, overflow );
01184 
01185   }
01186 
01187 }
01188 
01189 
01190 //--------------------------------------------------------
01191 void L1TDTTFClient::buildPhiEtaPlotO( MonitorElement * phi_eta_integ,
01192                                       const std::string & path,
01193                                       int wh )
01194 {
01195   char hname[100];
01196   sprintf( hname, path.c_str(),
01197            wheelpath_[wh].c_str(), wheel_[wh].c_str() );
01198 
01199   TH2F * phi_vs_eta = getTH2F(hname);
01200   if ( ! phi_vs_eta ) {
01201     edm::LogError("L1TDTTFClient::buildPhiEtaPlotO:ME") << "Failed to get TH1D "
01202                                                    << std::string(hname);
01203   } else {
01204 
01205     for ( unsigned int phi = 1; phi < 145 ; ++phi ) {
01206       float start = 0;
01207       int nbins = 0;
01208       switch ( wh ) {
01209       case 0 : start = 0;  nbins = 18; break; // N2
01210       case 1 : start = 8;  nbins = 20; break; // N1
01211       case 2 : start = 22; nbins = 10; break; // N0
01212       case 3 : start = 22; nbins = 20; break; // P0
01213       case 4 : start = 36; nbins = 20; break; // P1
01214       case 5 : start = 46; nbins = 18; break; // P2
01215       default : start = 0; nbins = 0; break; // BOH
01216       }
01217 
01218       for ( int eta = 1; eta <= nbins ; ++eta ) {
01219         double setbin = eta + start;
01220         double val = phi_vs_eta->GetBinContent( eta, phi )
01221           + phi_eta_integ->getBinContent( setbin, phi );
01222         phi_eta_integ->setBinContent( setbin, phi, val );
01223       }
01224 
01225       double underflow = phi_vs_eta->GetBinContent( 0, phi )
01226         + phi_eta_integ->getBinContent( 1, phi );
01227       phi_eta_integ->setBinContent( 1, phi, underflow );
01228 
01229       double overflow = phi_vs_eta->GetBinContent( nbins+1, phi )
01230         + phi_eta_integ->getBinContent( 64 );
01231       phi_eta_integ->setBinContent( 64, phi, overflow );
01232 
01233     }
01234   }
01235 }
01236 
01237 
01238 // //--------------------------------------------------------
01239 // void L1TDTTFClient::buildPhiEtaPlot( MonitorElement * phi_eta_integ,
01240 //                                   const std::string & path ,
01241 //                                   int wh)
01242 // {
01243 //   char hname[60];
01244 //   sprintf( hname, "%s/dttf_phi_eta_wh%s",
01245 //         wheelpath_[wh].c_str(), wheel_[wh].c_str() );
01246 // 
01247 //   TH2F * phi_vs_eta = getTH2F(hname);
01248 //   if ( ! phi_vs_eta ) {
01249 //     edm::LogError("L1TDTTFClient::buildPhiEtaPlot:ME") << "Failed to get TH1D "
01250 //                                                 << std::string(hname);
01251 //   } else {
01252 // 
01253 // 
01254 //     for ( unsigned int phi = 1; phi < 145 ; ++phi ) {
01255 //       for ( unsigned int eta = 1; eta < 65 ; ++eta ) {
01256 //      double val = phi_vs_eta->GetBinContent( eta, phi )
01257 //        + dttf_phi_eta_integ->getBinContent( eta, phi );
01258 //      dttf_phi_eta_integ->setBinContent( eta, phi, val );
01259 //       }
01260 // 
01261 //     }
01262 //   }
01263 // }
01264 // 
01265 // 
01266 // //--------------------------------------------------------
01267 // void L1TDTTFClient::buildPhiEtaPlotFC( MonitorElement * phi_eta_fine_integ,
01268 //                                     MonitorElement * phi_eta_coarse_integ,
01269 //                                     MonitorElement * phi_eta_integ,
01270 //                                     const std::string & path_fine,
01271 //                                     const std::string & path_coarse,
01272 //                                     int wh )
01273 // {
01274 // 
01275 //   char hname[60];
01276 // 
01277 //   sprintf( hname, path_fine.c_str(),
01278 //         wheelpath_[wh].c_str(), wheel_[wh].c_str() );
01279 //   TH2F * phi_vs_eta_fine = getTH2F(hname);
01280 //   if ( ! phi_vs_eta_fine ) {
01281 //     edm::LogError("L1TDTTFClient::buildPhiEtaPlotFC")
01282 //       << "Failed to get TH1D " << std::string(hname);
01283 //   }
01284 // 
01285 // 
01286 //   sprintf( hname, path_coarse.c_str(),
01287 //         wheelpath_[wh].c_str(), wheel_[wh].c_str() );
01288 //   TH2F * phi_vs_eta_coarse = getTH2F(hname);
01289 //   if ( ! phi_vs_eta_coarse ) {
01290 //     edm::LogError("L1TDTTFClient::buildPhiEtaPlotFC")
01291 //       << "Failed to get TH1D " << std::string(hname);
01292 //   }
01293 // 
01294 //   if ( ! phi_vs_eta_fine || ! phi_vs_eta_coarse ) {
01295 //     return;
01296 //   }
01297 // 
01298 //   for ( unsigned int phi = 1; phi < 145 ; ++phi ) {
01299 //     for ( unsigned int eta = 1; eta < 65 ; ++eta ) {
01300 // 
01301 //       double valfine = phi_vs_eta_fine->GetBinContent( eta, phi )
01302 //      + dttf_phi_eta_fine_integ->getBinContent( eta, phi );
01303 //       dttf_phi_eta_fine_integ->setBinContent( eta, phi, valfine );
01304 //       double valcoarse = phi_vs_eta_coarse->GetBinContent( eta, phi )
01305 //      + dttf_phi_eta_coarse_integ->getBinContent( eta, phi );
01306 //       dttf_phi_eta_coarse_integ->setBinContent( eta, phi, valcoarse );
01307 // 
01308 //       dttf_phi_eta_integ->setBinContent( eta, phi, valfine + valcoarse );
01309 // 
01310 //     }
01311 // 
01312 //   }
01313 // }
01314 
01315 
01316 
01317 
01318 //--------------------------------------------------------
01319 void L1TDTTFClient::setWheelLabel(MonitorElement *me)
01320 {
01321   me->setAxisTitle("Wheel", 1);
01322   me->setBinLabel(1, "N2", 1);
01323   me->setBinLabel(2, "N1", 1);
01324   me->setBinLabel(3, "N0", 1);
01325   me->setBinLabel(4, "P0", 1);
01326   me->setBinLabel(5, "P1", 1);
01327   me->setBinLabel(6, "P2", 1);
01328 
01329 }
01330 
01331 
01332 //--------------------------------------------------------
01333 void L1TDTTFClient::setQualLabel(MonitorElement *me, int axis)
01334 {
01335 
01336   if( axis == 1 )
01337     me->setAxisTitle("Quality", axis);
01338   me->setBinLabel(1, "T34", axis);
01339   me->setBinLabel(2, "T23/24", axis);
01340   me->setBinLabel(3, "T12/13/14", axis);
01341   me->setBinLabel(4, "T234", axis);
01342   me->setBinLabel(5, "T134", axis);
01343   me->setBinLabel(6, "T123/124", axis);
01344   me->setBinLabel(7, "T1234", axis);
01345 }
01346 
01347 
01348 
01349 
01350 
01351 
01352 
01353 
01354