CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/Validation/HcalDigis/src/HcalDigisValidation.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    HcalDigisValidation
00004 // Class:      HcalDigisValidation
00005 //
00013 //
00014 // Original Author:  Ali Fahim,22 R-013,+41227672649,
00015 //         Created:  Wed Mar 23 11:42:34 CET 2011
00016 // $Id: HcalDigisValidation.cc,v 1.6 2012/11/12 03:39:19 lhx Exp $
00017 //
00018 //
00019 
00020 #include <Validation/HcalDigis/interface/HcalDigisValidation.h>
00021 #include "FWCore/Framework/interface/MakerMacros.h"
00022 
00023 HcalDigisValidation::HcalDigisValidation(const edm::ParameterSet& iConfig) {
00024 
00025     using namespace std;
00026 
00027     subdet_ = iConfig.getUntrackedParameter<std::string > ("subdetector", "all");
00028     outputFile_ = iConfig.getUntrackedParameter<std::string > ("outputFile", "");
00029     inputTag_ = iConfig.getParameter<edm::InputTag > ("digiLabel");
00030     mc_ = iConfig.getUntrackedParameter<std::string > ("mc", "no");
00031     mode_ = iConfig.getUntrackedParameter<std::string > ("mode", "multi");
00032     dirName_ = iConfig.getUntrackedParameter<std::string > ("dirName", "HcalDigisV/HcalDigiTask");
00033 
00034     dbe_ = edm::Service<DQMStore > ().operator->();
00035     msm_ = new std::map<std::string, MonitorElement*>();
00036 
00037     if (outputFile_.size() != 0) edm::LogInfo("OutputInfo") << " Hcal Digi Task histograms will be saved to '" << outputFile_.c_str() << "'";
00038     else edm::LogInfo("OutputInfo") << " Hcal Digi Task histograms will NOT be saved";
00039 
00040     if (dbe_) dbe_->setCurrentFolder(dirName_);
00041 
00042     // book
00043     book1D("nevtot", 1, 0, 1);
00044     int bnoise = 0;
00045     int bmc = 0;
00046     if (subdet_ == "noise") bnoise = 1;
00047     if (mc_ == "yes") bmc = 1;
00048     if (subdet_ == "noise" || subdet_ == "all") {
00049         booking("HB", bnoise, bmc);
00050         booking("HO", bnoise, bmc);
00051         booking("HF", bnoise, bmc);
00052         booking("HE", bnoise, bmc);
00053     } else {
00054         booking(subdet_, 0, bmc);
00055     }
00056 }
00057 
00058 void HcalDigisValidation::booking(const std::string bsubdet, int bnoise, int bmc) {
00059 
00060     // defaults are for HB
00061 
00062     HistLim Ndigis(2600, 0., 2600.);
00063     HistLim ndigis(505, -10., 1000.);
00064     HistLim sime(200, 0., 1.0);
00065 //    HistLim digiAmp(2050, -100., 4000.);
00066     HistLim digiAmp(205, -100., 4000.);
00067     HistLim ratio(2000, -100., 3900.);
00068     HistLim sumAmp(100, -500., 1500.);
00069 
00070     HistLim nbin(10, 0., 10.);
00071 
00072     HistLim pedestal(75, 0., 15.);
00073     HistLim pedestalfC(400, -10., 30.);
00074 
00075     HistLim frac(52, -0.02, 1.02);
00076 
00077     HistLim pedLim(80, 0., 8.);
00078     HistLim pedWidthLim(100, 0., 2.);
00079 
00080     HistLim gainLim(120, 0., 0.6);
00081     HistLim gainWidthLim(100, 0., 0.3);
00082 
00083     HistLim ietaLim(82, -41., 41.);
00084     HistLim iphiLim(72, 0., 72.);
00085 
00086     if (bsubdet == "HE") {
00087         sime = HistLim(200, 0., 1.0);
00088 //        digiAmp = HistLim(250, -100., 1000.);
00089     } else if (bsubdet == "HF") {
00090 //        ndigis = HistLim(500, 0., 500.);
00091         sime = HistLim(100, 0., 100.);
00092 //        digiAmp = HistLim(420, -100., 2000.);
00093 //        ratio = HistLim(120, 0., 120.);
00094         pedLim = HistLim(100, 0., 20.);
00095         pedWidthLim = HistLim(100, 0., 5.);
00096         frac = HistLim(400, -4.00, 4.00);
00097 
00098     } else if (bsubdet == "HO") {
00099         sime = HistLim(200, 0., 1.0);
00100 //        digiAmp = HistLim(200, 0., 1000.);
00101         gainLim = HistLim(150, 0., 1.5);
00102     }
00103 
00104     Char_t histo[100];
00105     const char * sub = bsubdet.c_str();
00106     if (bnoise == 0) {
00107         // number of digis in each subdetector
00108         sprintf(histo, "HcalDigiTask_Ndigis_%s", sub);
00109         book1D(histo, Ndigis);
00110 
00111         // maps of occupancies
00112         sprintf(histo, "HcalDigiTask_ieta_iphi_occupancy_map_depth1_%s", sub);
00113         book2D(histo, ietaLim, iphiLim);
00114 
00115         sprintf(histo, "HcalDigiTask_ieta_iphi_occupancy_map_depth2_%s", sub);
00116         book2D(histo, ietaLim, iphiLim);
00117 
00118         sprintf(histo, "HcalDigiTask_ieta_iphi_occupancy_map_depth3_%s", sub);
00119         book2D(histo, ietaLim, iphiLim);
00120 
00121         sprintf(histo, "HcalDigiTask_ieta_iphi_occupancy_map_depth4_%s", sub);
00122         book2D(histo, ietaLim, iphiLim);
00123 
00124         // occupancies vs ieta
00125         sprintf(histo, "HcalDigiTask_occupancy_vs_ieta_depth1_%s", sub);
00126         book1D(histo, ietaLim);
00127 
00128         sprintf(histo, "HcalDigiTask_occupancy_vs_ieta_depth2_%s", sub);
00129         book1D(histo, ietaLim);
00130 
00131         sprintf(histo, "HcalDigiTask_occupancy_vs_ieta_depth3_%s", sub);
00132         book1D(histo, ietaLim);
00133 
00134         sprintf(histo, "HcalDigiTask_occupancy_vs_ieta_depth4_%s", sub);
00135         book1D(histo, ietaLim);
00136 
00137 
00138         // maps of sum of amplitudes (sum lin.digis(4,5,6,7) - ped) all depths
00139 /*
00140         sprintf(histo, "HcalDigiTask_ieta_iphi_map_of_amplitudes_fC_depth1_%s", sub);
00141         book2D(histo, ietaLim, iphiLim);
00142         sprintf(histo, "HcalDigiTask_ieta_iphi_map_of_amplitudes_fC_depth2_%s", sub);
00143         book2D(histo, ietaLim, iphiLim);
00144         sprintf(histo, "HcalDigiTask_ieta_iphi_map_of_amplitudes_fC_depth3_%s", sub);
00145         book2D(histo, ietaLim, iphiLim);
00146         sprintf(histo, "HcalDigiTask_ieta_iphi_map_of_amplitudes_fC_depth4_%s", sub);
00147         book2D(histo, ietaLim, iphiLim);
00148 */
00149         // just 1D of all cells' amplitudes
00150         sprintf(histo, "HcalDigiTask_sum_all_amplitudes_%s", sub);
00151         book1D(histo, sumAmp);
00152 
00153         sprintf(histo, "HcalDigiTask_number_of_amplitudes_above_10fC_%s", sub);
00154         book1D(histo, ndigis);
00155 
00156         sprintf(histo, "HcalDigiTask_ADC0_adc_depth1_%s", sub);
00157         book1D(histo, pedestal);
00158         sprintf(histo, "HcalDigiTask_ADC0_adc_depth2_%s", sub);
00159         book1D(histo, pedestal);
00160         sprintf(histo, "HcalDigiTask_ADC0_adc_depth3_%s", sub);
00161         book1D(histo, pedestal);
00162         sprintf(histo, "HcalDigiTask_ADC0_adc_depth4_%s", sub);
00163         book1D(histo, pedestal);
00164 
00165         sprintf(histo, "HcalDigiTask_ADC0_fC_depth1_%s", sub);
00166         book1D(histo, pedestalfC);
00167         sprintf(histo, "HcalDigiTask_ADC0_fC_depth2_%s", sub);
00168         book1D(histo, pedestalfC);
00169         sprintf(histo, "HcalDigiTask_ADC0_fC_depth3_%s", sub);
00170         book1D(histo, pedestalfC);
00171         sprintf(histo, "HcalDigiTask_ADC0_fC_depth4_%s", sub);
00172         book1D(histo, pedestalfC);
00173 
00174         sprintf(histo, "HcalDigiTask_signal_amplitude_%s", sub);
00175         book1D(histo, digiAmp);
00176         sprintf(histo, "HcalDigiTask_signal_amplitude_depth1_%s", sub);
00177         book1D(histo, digiAmp);
00178         sprintf(histo, "HcalDigiTask_signal_amplitude_depth2_%s", sub);
00179         book1D(histo, digiAmp);
00180         sprintf(histo, "HcalDigiTask_signal_amplitude_depth3_%s", sub);
00181         book1D(histo, digiAmp);
00182         sprintf(histo, "HcalDigiTask_signal_amplitude_depth4_%s", sub);
00183         book1D(histo, digiAmp);
00184 
00185         sprintf(histo, "HcalDigiTask_signal_amplitude_vs_bin_all_depths_%s", sub);
00186         book2D(histo, nbin, digiAmp);
00187 
00188 /*
00189         sprintf(histo, "HcalDigiTask_all_amplitudes_vs_bin_depth1_%s", sub);
00190         book2D(histo, nbin, digiAmp);
00191         sprintf(histo, "HcalDigiTask_all_amplitudes_vs_bin_depth2_%s", sub);
00192         book2D(histo, nbin, digiAmp);
00193 */
00194         sprintf(histo, "HcalDigiTask_all_amplitudes_vs_bin_1D_depth1_%s", sub);
00195         book1D(histo, nbin);
00196         sprintf(histo, "HcalDigiTask_all_amplitudes_vs_bin_1D_depth2_%s", sub);
00197         book1D(histo, nbin);
00198 
00199         sprintf(histo, "HcalDigiTask_bin_5_frac_%s", sub);
00200         book1D(histo, frac);
00201         sprintf(histo, "HcalDigiTask_bin_6_7_frac_%s", sub);
00202         book1D(histo, frac);
00203 
00204         if (bmc == 1) {
00205             sprintf(histo, "HcalDigiTask_amplitude_vs_simhits_%s", sub);
00206             book2D(histo, sime, digiAmp);
00207             sprintf(histo, "HcalDigiTask_amplitude_vs_simhits_depth1_%s", sub);
00208             book2D(histo, sime, digiAmp);
00209             sprintf(histo, "HcalDigiTask_amplitude_vs_simhits_depth2_%s", sub);
00210             book2D(histo, sime, digiAmp);
00211             sprintf(histo, "HcalDigiTask_amplitude_vs_simhits_depth3_%s", sub);
00212             book2D(histo, sime, digiAmp);
00213             sprintf(histo, "HcalDigiTask_amplitude_vs_simhits_depth4_%s", sub);
00214             book2D(histo, sime, digiAmp);
00215 
00216             sprintf(histo, "HcalDigiTask_amplitude_vs_simhits_profile_%s", sub);
00217             bookPf(histo, sime, digiAmp);
00218             sprintf(histo, "HcalDigiTask_amplitude_vs_simhits_profile_depth1_%s", sub);
00219             bookPf(histo, sime, digiAmp);
00220             sprintf(histo, "HcalDigiTask_amplitude_vs_simhits_profile_depth2_%s", sub);
00221             bookPf(histo, sime, digiAmp);
00222             sprintf(histo, "HcalDigiTask_amplitude_vs_simhits_profile_depth3_%s", sub);
00223             bookPf(histo, sime, digiAmp);
00224             sprintf(histo, "HcalDigiTask_amplitude_vs_simhits_profile_depth4_%s", sub);
00225             bookPf(histo, sime, digiAmp);
00226 
00227             sprintf(histo, "HcalDigiTask_ratio_amplitude_vs_simhits_%s", sub);
00228             book1D(histo, ratio);
00229             sprintf(histo, "HcalDigiTask_ratio_amplitude_vs_simhits_depth1_%s", sub);
00230             book1D(histo, ratio);
00231             sprintf(histo, "HcalDigiTask_ratio_amplitude_vs_simhits_depth2_%s", sub);
00232             book1D(histo, ratio);
00233             sprintf(histo, "HcalDigiTask_ratio_amplitude_vs_simhits_depth3_%s", sub);
00234             book1D(histo, ratio);
00235             sprintf(histo, "HcalDigiTask_ratio_amplitude_vs_simhits_depth4_%s", sub);
00236             book1D(histo, ratio);
00237         }//mc only
00238 
00239     } else { // noise only
00240 
00241         // EVENT "1" distributions of all cells properties
00242 
00243 
00244         if (subdet_ == "HB" || subdet_ == "HE" || subdet_ == "HF") {
00245             sprintf(histo, "HcalDigiTask_gain_capId0_Depth1_%s", sub);
00246             book1D(histo, gainLim);
00247             sprintf(histo, "HcalDigiTask_gain_capId1_Depth1_%s", sub);
00248             book1D(histo, gainLim);
00249             sprintf(histo, "HcalDigiTask_gain_capId2_Depth1_%s", sub);
00250             book1D(histo, gainLim);
00251             sprintf(histo, "HcalDigiTask_gain_capId3_Depth1_%s", sub);
00252             book1D(histo, gainLim);
00253 
00254             sprintf(histo, "HcalDigiTask_gain_capId0_Depth2_%s", sub);
00255             book1D(histo, gainLim);
00256             sprintf(histo, "HcalDigiTask_gain_capId1_Depth2_%s", sub);
00257             book1D(histo, gainLim);
00258             sprintf(histo, "HcalDigiTask_gain_capId2_Depth2_%s", sub);
00259             book1D(histo, gainLim);
00260             sprintf(histo, "HcalDigiTask_gain_capId3_Depth2_%s", sub);
00261             book1D(histo, gainLim);
00262 
00263             sprintf(histo, "HcalDigiTask_gainWidth_capId0_Depth1_%s", sub);
00264             book1D(histo, gainWidthLim);
00265             sprintf(histo, "HcalDigiTask_gainWidth_capId1_Depth1_%s", sub);
00266             book1D(histo, gainWidthLim);
00267             sprintf(histo, "HcalDigiTask_gainWidth_capId2_Depth1_%s", sub);
00268             book1D(histo, gainWidthLim);
00269             sprintf(histo, "HcalDigiTask_gainWidth_capId3_Depth1_%s", sub);
00270             book1D(histo, gainWidthLim);
00271 
00272             sprintf(histo, "HcalDigiTask_gainWidth_capId0_Depth2_%s", sub);
00273             book1D(histo, gainWidthLim);
00274             sprintf(histo, "HcalDigiTask_gainWidth_capId1_Depth2_%s", sub);
00275             book1D(histo, gainWidthLim);
00276             sprintf(histo, "HcalDigiTask_gainWidth_capId2_Depth2_%s", sub);
00277             book1D(histo, gainWidthLim);
00278             sprintf(histo, "HcalDigiTask_gainWidth_capId3_Depth2_%s", sub);
00279             book1D(histo, gainWidthLim);
00280 
00281             sprintf(histo, "HcalDigiTask_pedestal_capId0_Depth1_%s", sub);
00282             book1D(histo, pedLim);
00283             sprintf(histo, "HcalDigiTask_pedestal_capId1_Depth1_%s", sub);
00284             book1D(histo, pedLim);
00285             sprintf(histo, "HcalDigiTask_pedestal_capId2_Depth1_%s", sub);
00286             book1D(histo, pedLim);
00287             sprintf(histo, "HcalDigiTask_pedestal_capId3_Depth1_%s", sub);
00288             book1D(histo, pedLim);
00289 
00290             sprintf(histo, "HcalDigiTask_pedestal_capId0_Depth2_%s", sub);
00291             book1D(histo, pedLim);
00292             sprintf(histo, "HcalDigiTask_pedestal_capId1_Depth2_%s", sub);
00293             book1D(histo, pedLim);
00294             sprintf(histo, "HcalDigiTask_pedestal_capId2_Depth2_%s", sub);
00295             book1D(histo, pedLim);
00296             sprintf(histo, "HcalDigiTask_pedestal_capId3_Depth2_%s", sub);
00297             book1D(histo, pedLim);
00298 
00299             sprintf(histo, "HcalDigiTask_pedestal_width_capId0_Depth1_%s", sub);
00300             book1D(histo, pedWidthLim);
00301             sprintf(histo, "HcalDigiTask_pedestal_width_capId1_Depth1_%s", sub);
00302             book1D(histo, pedWidthLim);
00303             sprintf(histo, "HcalDigiTask_pedestal_width_capId2_Depth1_%s", sub);
00304             book1D(histo, pedWidthLim);
00305             sprintf(histo, "HcalDigiTask_pedestal_width_capId3_Depth1_%s", sub);
00306             book1D(histo, pedWidthLim);
00307 
00308             sprintf(histo, "HcalDigiTask_pedestal_width_capId0_Depth2_%s", sub);
00309             book1D(histo, pedWidthLim);
00310             sprintf(histo, "HcalDigiTask_pedestal_width_capId1_Depth2_%s", sub);
00311             book1D(histo, pedWidthLim);
00312             sprintf(histo, "HcalDigiTask_pedestal_width_capId2_Depth2_%s", sub);
00313             book1D(histo, pedWidthLim);
00314             sprintf(histo, "HcalDigiTask_pedestal_width_capId3_Depth2_%s", sub);
00315             book1D(histo, pedWidthLim);
00316 
00317         }
00318 
00319         if (subdet_ == "HE") {
00320             sprintf(histo, "HcalDigiTask_gain_capId0_Depth3_%s", sub);
00321             book1D(histo, gainLim);
00322             sprintf(histo, "HcalDigiTask_gain_capId1_Depth3_%s", sub);
00323             book1D(histo, gainLim);
00324             sprintf(histo, "HcalDigiTask_gain_capId2_Depth3_%s", sub);
00325             book1D(histo, gainLim);
00326             sprintf(histo, "HcalDigiTask_gain_capId3_Depth3_%s", sub);
00327             book1D(histo, gainLim);
00328 
00329             sprintf(histo, "HcalDigiTask_gainWidth_capId0_Depth3_%s", sub);
00330             book1D(histo, gainWidthLim);
00331             sprintf(histo, "HcalDigiTask_gainWidth_capId1_Depth3_%s", sub);
00332             book1D(histo, gainWidthLim);
00333             sprintf(histo, "HcalDigiTask_gainWidth_capId2_Depth3_%s", sub);
00334             book1D(histo, gainWidthLim);
00335             sprintf(histo, "HcalDigiTask_gainWidth_capId3_Depth3_%s", sub);
00336             book1D(histo, gainWidthLim);
00337 
00338             sprintf(histo, "HcalDigiTask_pedestal_capId0_Depth3_%s", sub);
00339             book1D(histo, pedLim);
00340             sprintf(histo, "HcalDigiTask_pedestal_capId1_Depth3_%s", sub);
00341             book1D(histo, pedLim);
00342             sprintf(histo, "HcalDigiTask_pedestal_capId2_Depth3_%s", sub);
00343             book1D(histo, pedLim);
00344             sprintf(histo, "HcalDigiTask_pedestal_capId3_Depth3_%s", sub);
00345             book1D(histo, pedLim);
00346 
00347             sprintf(histo, "HcalDigiTask_pedestal_width_capId0_Depth3_%s", sub);
00348             book1D(histo, pedWidthLim);
00349             sprintf(histo, "HcalDigiTask_pedestal_width_capId1_Depth3_%s", sub);
00350             book1D(histo, pedWidthLim);
00351             sprintf(histo, "HcalDigiTask_pedestal_width_capId2_Depth3_%s", sub);
00352             book1D(histo, pedWidthLim);
00353             sprintf(histo, "HcalDigiTask_pedestal_width_capId3_Depth3_%s", sub);
00354             book1D(histo, pedWidthLim);
00355 
00356         }
00357 
00358         if (subdet_ == "HO") {
00359             sprintf(histo, "HcalDigiTask_gain_capId0_Depth4_%s", sub);
00360             book1D(histo, gainLim);
00361             sprintf(histo, "HcalDigiTask_gain_capId1_Depth4_%s", sub);
00362             book1D(histo, gainLim);
00363             sprintf(histo, "HcalDigiTask_gain_capId2_Depth4_%s", sub);
00364             book1D(histo, gainLim);
00365             sprintf(histo, "HcalDigiTask_gain_capId3_Depth4_%s", sub);
00366             book1D(histo, gainLim);
00367 
00368             sprintf(histo, "HcalDigiTask_gainWidth_capId0_Depth4_%s", sub);
00369             book1D(histo, gainWidthLim);
00370             sprintf(histo, "HcalDigiTask_gainWidth_capId1_Depth4_%s", sub);
00371             book1D(histo, gainWidthLim);
00372             sprintf(histo, "HcalDigiTask_gainWidth_capId2_Depth4_%s", sub);
00373             book1D(histo, gainWidthLim);
00374             sprintf(histo, "HcalDigiTask_gainWidth_capId3_Depth4_%s", sub);
00375             book1D(histo, gainWidthLim);
00376 
00377 
00378             sprintf(histo, "HcalDigiTask_pedestal_capId0_Depth4_%s", sub);
00379             book1D(histo, pedLim);
00380             sprintf(histo, "HcalDigiTask_pedestal_capId1_Depth4_%s", sub);
00381             book1D(histo, pedLim);
00382             sprintf(histo, "HcalDigiTask_pedestal_capId2_Depth4_%s", sub);
00383             book1D(histo, pedLim);
00384             sprintf(histo, "HcalDigiTask_pedestal_capId3_Depth4_%s", sub);
00385             book1D(histo, pedLim);
00386 
00387             sprintf(histo, "HcalDigiTask_pedestal_width_capId0_Depth4_%s", sub);
00388             book1D(histo, pedWidthLim);
00389             sprintf(histo, "HcalDigiTask_pedestal_width_capId1_Depth4_%s", sub);
00390             book1D(histo, pedWidthLim);
00391             sprintf(histo, "HcalDigiTask_pedestal_width_capId2_Depth4_%s", sub);
00392             book1D(histo, pedWidthLim);
00393             sprintf(histo, "HcalDigiTask_pedestal_width_capId3_Depth4_%s", sub);
00394             book1D(histo, pedWidthLim);
00395 
00396         }
00397 
00398         sprintf(histo, "HcalDigiTask_gainMap_Depth1_%s", sub);
00399         book2D(histo, ietaLim, iphiLim);
00400         sprintf(histo, "HcalDigiTask_gainMap_Depth2_%s", sub);
00401         book2D(histo, ietaLim, iphiLim);
00402         sprintf(histo, "HcalDigiTask_gainMap_Depth3_%s", sub);
00403         book2D(histo, ietaLim, iphiLim);
00404         sprintf(histo, "HcalDigiTask_gainMap_Depth4_%s", sub);
00405         book2D(histo, ietaLim, iphiLim);
00406 
00407         sprintf(histo, "HcalDigiTask_pwidthMap_Depth1_%s", sub);
00408         book2D(histo, ietaLim, iphiLim);
00409         sprintf(histo, "HcalDigiTask_pwidthMap_Depth2_%s", sub);
00410         book2D(histo, ietaLim, iphiLim);
00411         sprintf(histo, "HcalDigiTask_pwidthMap_Depth3_%s", sub);
00412         book2D(histo, ietaLim, iphiLim);
00413         sprintf(histo, "HcalDigiTask_pwidthMap_Depth4_%s", sub);
00414         book2D(histo, ietaLim, iphiLim);
00415 
00416     } //end of noise-only
00417 }//book
00418 
00419 void HcalDigisValidation::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
00420     using namespace edm;
00421 
00422     iSetup.get<CaloGeometryRecord > ().get(geometry);
00423     iSetup.get<HcalDbRecord > ().get(conditions);
00424 
00425     //  std::cout << " >>>>> HcalDigiTester::analyze  hcalselector = "
00426     //      << subdet_ << std::endl;
00427 
00428     if (subdet_ != "all") {
00429        noise_ = 0;
00430        if (subdet_ == "HB") reco<HBHEDataFrame > (iEvent, iSetup);
00431        if (subdet_ == "HE") reco<HBHEDataFrame > (iEvent, iSetup);
00432        if (subdet_ == "HO") reco<HODataFrame > (iEvent, iSetup);
00433        if (subdet_ == "HF") reco<HFDataFrame > (iEvent, iSetup);
00434 
00435         if (subdet_ == "noise") {
00436             noise_ = 1;
00437             //      std::cout << " >>>>> HcalDigiTester::analyze  entering noise "
00438             //      << std::endl;
00439             subdet_ = "HB";
00440             reco<HBHEDataFrame > (iEvent, iSetup);
00441             subdet_ = "HE";
00442             reco<HBHEDataFrame > (iEvent, iSetup);
00443             subdet_ = "HO";
00444             reco<HODataFrame > (iEvent, iSetup);
00445             subdet_ = "HF";
00446             reco<HFDataFrame > (iEvent, iSetup);
00447             subdet_ = "noise";
00448             }
00449         }// all subdetectors
00450     else {
00451         noise_ = 0;
00452 
00453         subdet_ = "HB";
00454         reco<HBHEDataFrame > (iEvent, iSetup);
00455         subdet_ = "HE";
00456         reco<HBHEDataFrame > (iEvent, iSetup);
00457         subdet_ = "HO";
00458         reco<HODataFrame > (iEvent, iSetup);
00459         subdet_ = "HF";
00460         reco<HFDataFrame > (iEvent, iSetup);
00461         subdet_ = "all";
00462     }
00463 
00464     fill1D("nevtot", 0);
00465     nevtot++;
00466 }
00467 
00468 template<class Digi> void HcalDigisValidation::reco(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
00469 
00470 
00471     // HistLim =============================================================
00472 
00473     std::string strtmp;
00474 
00475     // ======================================================================
00476     using namespace edm;
00477     typename edm::Handle<edm::SortedCollection<Digi> > digiCollection;
00478     typename edm::SortedCollection<Digi>::const_iterator digiItr;
00479 
00480     // ADC2fC
00481     HcalCalibrations calibrations;
00482     CaloSamples tool;
00483     iEvent.getByLabel(inputTag_, digiCollection);
00484 //    std::cout << "***************RECO*****************" << std::endl;
00485     int isubdet = 0;
00486     if (subdet_ == "HB") isubdet = 1;
00487     if (subdet_ == "HE") isubdet = 2;
00488     if (subdet_ == "HO") isubdet = 3;
00489     if (subdet_ == "HF") isubdet = 4;
00490 
00491     if (isubdet == 1) nevent1++;
00492     if (isubdet == 2) nevent2++;
00493     if (isubdet == 3) nevent3++;
00494     if (isubdet == 4) nevent4++;
00495 
00496     int indigis = 0;
00497     //  amplitude for signal cell at diff. depths
00498     double ampl1_c = 0.;
00499     double ampl2_c = 0.;
00500     double ampl3_c = 0.;
00501     double ampl4_c = 0.;
00502     double ampl_c = 0.;
00503 
00504     // is set to 1 if "seed" SimHit is found
00505     int seedSimHit = 0;
00506 
00507     //  std::cout << " HcalDigiTester::reco :  "
00508     //      << "subdet=" << subdet << "  noise="<< noise_ << std::endl;
00509 
00510     int ieta_Sim = 9999;
00511     int iphi_Sim = 9999;
00512     double emax_Sim = -9999.;
00513 
00514 
00515     // SimHits MC only
00516     if (mc_ == "yes") {
00517         edm::Handle<edm::PCaloHitContainer> hcalHits;
00518         iEvent.getByLabel("g4SimHits", "HcalHits", hcalHits);
00519         const edm::PCaloHitContainer * simhitResult = hcalHits.product();
00520 
00521         if (isubdet != 0 && noise_ == 0) { // signal only SimHits
00522 
00523             for (std::vector<PCaloHit>::const_iterator simhits = simhitResult->begin(); simhits != simhitResult->end(); ++simhits) {
00524 
00525                 HcalDetId cell(simhits->id());
00526                 double en = simhits->energy();
00527                 int sub = cell.subdet();
00528                 int ieta = cell.ieta();
00529                 if (ieta > 0) ieta--;
00530                 int iphi = cell.iphi() - 1;
00531 
00532 
00533                 if (en > emax_Sim && sub == isubdet) {
00534                     emax_Sim = en;
00535                     ieta_Sim = ieta;
00536                     iphi_Sim = iphi;
00537                     // to limit "seed" SimHit energy in case of "multi" event
00538                     if (mode_ == "multi" &&
00539                             ((sub == 4 && en < 100. && en > 1.)
00540                             || ((sub != 4) && en < 1. && en > 0.02))) {
00541                         seedSimHit = 1;
00542                         break;
00543                     }
00544                 }
00545 
00546             } // end of SimHits cycle
00547 
00548 
00549             // found highest-energy SimHit for single-particle
00550             if (mode_ != "multi" && emax_Sim > 0.) seedSimHit = 1;
00551         } // end of SimHits
00552     }// end of mc_ == "yes"
00553 
00554     // CYCLE OVER CELLS ========================================================
00555     int Ndig = 0;
00556 
00557     /*
00558     std::cout << " HcalDigiTester::reco :     nevent 1,2,3,4 = "
00559               << nevent1 << " " << nevent2 << " " << nevent3 << " "
00560               << nevent4 << std::endl;
00561      */
00562 
00563     for (digiItr = digiCollection->begin(); digiItr != digiCollection->end(); digiItr++) {
00564 
00565         HcalDetId cell(digiItr->id());
00566         int depth = cell.depth();
00567         int iphi = cell.iphi() - 1;
00568         int ieta = cell.ieta();
00569         if (ieta > 0) ieta--;
00570         int sub = cell.subdet();
00571 
00572 
00573         //  amplitude for signal cell at diff. depths
00574         double ampl = 0.;
00575         double ampl1 = 0.;
00576         double ampl2 = 0.;
00577         double ampl3 = 0.;
00578         double ampl4 = 0.;
00579 
00580 
00581         // Gains, pedestals (once !) and only for "noise" case
00582         if (((nevent1 == 1 && isubdet == 1) ||
00583                 (nevent2 == 1 && isubdet == 2) ||
00584                 (nevent3 == 1 && isubdet == 3) ||
00585                 (nevent4 == 1 && isubdet == 4)) && noise_ == 1 && sub == isubdet) {
00586 
00587             HcalGenericDetId hcalGenDetId(digiItr->id());
00588             const HcalPedestal* pedestal = conditions->getPedestal(hcalGenDetId);
00589             const HcalGain* gain = conditions->getGain(hcalGenDetId);
00590             const HcalGainWidth* gainWidth = conditions->getGainWidth(hcalGenDetId);
00591             const HcalPedestalWidth* pedWidth = conditions-> getPedestalWidth(hcalGenDetId);
00592 
00593             for (int i = 0; i < 4; i++) {
00594                 fill1D("HcalDigiTask_gain_capId" + str(i) + "_Depth" + str(depth) + "_" + subdet_, gain->getValue(i));
00595                 fill1D("HcalDigiTask_gainWidth_capId" + str(i) + "_Depth" + str(depth) + "_" + subdet_, gainWidth->getValue(i));
00596                 fill1D("HcalDigiTask_pedestal_capId" + str(i) + "_Depth" + str(depth) + "_" + subdet_, pedestal->getValue(i));
00597                 fill1D("HcalDigiTask_pedestal_width_capId" + str(i) + "_Depth" + str(depth) + "_" + subdet_, pedWidth->getWidth(i));
00598             }
00599 
00600             fill2D("HcalDigiTask_gainMap_Depth" + str(depth) + "_" + subdet_, double(ieta), double(iphi), gain->getValue(0));
00601             fill2D("HcalDigiTask_pwidthMap_Depth" + str(depth) + "_" + subdet_, double(ieta), double(iphi), pedWidth->getWidth(0));
00602 
00603         }// end of event #1
00604         //std::cout << "==== End of event noise block in cell cycle"  << std::endl;
00605 
00606         if (sub == isubdet) Ndig++; // subdet number of digi
00607 
00608         // No-noise case, only single  subdet selected  ===========================
00609 
00610         if (sub == isubdet && noise_ == 0) {
00611 
00612 
00613             HcalCalibrations calibrations = conditions->getHcalCalibrations(cell);
00614 
00615             const HcalQIECoder* channelCoder = conditions->getHcalCoder(cell);
00616             const HcalQIEShape* shape = conditions->getHcalShape(channelCoder);
00617             HcalCoderDb coder(*channelCoder, *shape);
00618             coder.adc2fC(*digiItr, tool);
00619 
00620             double noiseADC = (*digiItr)[0].adc();
00621             double noisefC = tool[0];
00622             // noise evaluations from "pre-samples"
00623             fill1D("HcalDigiTask_ADC0_adc_depth" + str(depth) + "_" + subdet_, noiseADC);
00624             fill1D("HcalDigiTask_ADC0_fC_depth" + str(depth) + "_" + subdet_, noisefC);
00625 
00626 
00627             // OCCUPANCY maps fill
00628             fill2D("HcalDigiTask_ieta_iphi_occupancy_map_depth" + str(depth) + "_" + subdet_, double(ieta), double(iphi));
00629 
00630             // Cycle on time slices
00631             // - for each Digi
00632             // - for one Digi with max SimHits E in subdet
00633 
00634 
00635             int closen = 0; // =1 if 1) seedSimHit = 1 and 2) the cell is the same
00636             if (ieta == ieta_Sim && iphi == iphi_Sim) closen = seedSimHit;
00637 
00638             for (int ii = 0; ii < tool.size(); ii++) {
00639                 int capid = (*digiItr)[ii].capid();
00640                 // single ts amplitude
00641                 double val = (tool[ii] - calibrations.pedestal(capid));
00642 /*
00643                 if (val > 10.) {
00644                     if (depth == 1) strtmp = "HcalDigiTask_all_amplitudes_vs_bin_depth1_" + subdet_;
00645                     else strtmp = "HcalDigiTask_all_amplitudes_vs_bin_depth2_" + subdet_;
00646                     fill2D(strtmp, double(ii), val);
00647                 }
00648 */
00649                 if (val > 100.) {
00650                     if (depth == 1) strtmp = "HcalDigiTask_all_amplitudes_vs_bin_1D_depth1_" + subdet_;
00651                     else strtmp = "HcalDigiTask_all_amplitudes_vs_bin_1D_depth2_" + subdet_;
00652                     fill1D(strtmp, double(ii), val);
00653                 }
00654 
00655                 if (closen == 1) {
00656                     strtmp = "HcalDigiTask_signal_amplitude_vs_bin_all_depths_" + subdet_;
00657                     fill2D(strtmp, double(ii), val);
00658                 }
00659 
00660 
00661                 // HB/HE/HO
00662                 if (isubdet != 4 && ii >= 4 && ii <= 7) {
00663                     ampl += val;
00664                     if (depth == 1) ampl1 += val;
00665                     if (depth == 2) ampl2 += val;
00666                     if (depth == 3) ampl3 += val;
00667                     if (depth == 4) ampl4 += val;
00668 
00669                     if (closen == 1) {
00670                         ampl_c += val;
00671                         if (depth == 1) ampl1_c += val;
00672                         if (depth == 2) ampl2_c += val;
00673                         if (depth == 3) ampl3_c += val;
00674                         if (depth == 4) ampl4_c += val;
00675                     }
00676                 }
00677 
00678                 // HF
00679                 if (isubdet == 4 && ii >= 2 && ii <= 4) {
00680                     ampl += val;
00681                     if (depth == 1) ampl1 += val;
00682                     if (depth == 2) ampl2 += val;
00683                     if (depth == 3) ampl3 += val;
00684                     if (depth == 4) ampl4 += val;
00685                     if (closen == 1) {
00686                         ampl_c += val;
00687                         if (depth == 1) ampl1_c += val;
00688                         if (depth == 2) ampl2_c += val;
00689                         if (depth == 3) ampl3_c += val;
00690                         if (depth == 4) ampl4_c += val;
00691 
00692                     }
00693                 }
00694             }
00695             // end of time bucket sample
00696 
00697 
00698             // maps of sum of amplitudes (sum lin.digis(4,5,6,7) - ped) all depths
00699 /*
00700             strtmp = "HcalDigiTask_ieta_iphi_map_of_amplitudes_fC_depth1_" + subdet_;
00701             fill2D(strtmp, double(ieta), double(iphi), ampl1);
00702             strtmp = "HcalDigiTask_ieta_iphi_map_of_amplitudes_fC_depth2_" + subdet_;
00703             fill2D(strtmp, double(ieta), double(iphi), ampl2);
00704             strtmp = "HcalDigiTask_ieta_iphi_map_of_amplitudes_fC_depth3_" + subdet_;
00705             fill2D(strtmp, double(ieta), double(iphi), ampl3);
00706             strtmp = "HcalDigiTask_ieta_iphi_map_of_amplitudes_fC_depth4_" + subdet_;
00707             fill2D(strtmp, double(ieta), double(iphi), ampl4);
00708 */
00709             // just 1D of all cells' amplitudes
00710             strtmp = "HcalDigiTask_sum_all_amplitudes_" + subdet_;
00711             fill1D(strtmp, ampl);
00712 
00713 
00714             if (ampl1 > 10. || ampl2 > 10. || ampl3 > 10. || ampl4 > 10.) indigis++;
00715 
00716             // fraction 5,6 bins if ampl. is big.
00717             if (ampl1 > 30. && depth == 1 && closen == 1 && isubdet != 4) {
00718               double fBin5 = tool[4] - calibrations.pedestal((*digiItr)[4].capid());
00719               double fBin67 = tool[5] + tool[6]
00720                 - calibrations.pedestal((*digiItr)[5].capid())
00721                 - calibrations.pedestal((*digiItr)[6].capid());
00722               
00723               fBin5 /= ampl1;
00724               fBin67 /= ampl1;
00725               
00726               strtmp = "HcalDigiTask_bin_5_frac_" + subdet_;
00727               fill1D(strtmp, fBin5);
00728               strtmp = "HcalDigiTask_bin_6_7_frac_" + subdet_;
00729               fill1D(strtmp, fBin67);
00730               
00731             }
00732             
00733             //Special for HF
00734             if (isubdet == 4 && ampl1 > 30. && depth == 1) {
00735               double fBin5 = tool[2] - calibrations.pedestal((*digiItr)[2].capid());
00736               double fBin67 = tool[3] + tool[4]
00737                 - calibrations.pedestal((*digiItr)[3].capid())
00738                 - calibrations.pedestal((*digiItr)[4].capid());
00739               fBin5 /= ampl1;
00740               fBin67 /= ampl1;
00741               strtmp = "HcalDigiTask_bin_5_frac_" + subdet_;
00742               fill1D(strtmp, fBin5);
00743               strtmp = "HcalDigiTask_bin_6_7_frac_" + subdet_;
00744               fill1D(strtmp, fBin67);
00745             }
00746             
00747             
00748             strtmp = "HcalDigiTask_signal_amplitude_" + subdet_;
00749             fill1D(strtmp, ampl);
00750             strtmp = "HcalDigiTask_signal_amplitude_depth1_" + subdet_;
00751             fill1D(strtmp, ampl1);
00752             strtmp = "HcalDigiTask_signal_amplitude_depth2_" + subdet_;
00753             fill1D(strtmp, ampl2);
00754             strtmp = "HcalDigiTask_signal_amplitude_depth3_" + subdet_;
00755             fill1D(strtmp, ampl3);
00756             strtmp = "HcalDigiTask_signal_amplitude_depth4_" + subdet_;
00757             fill1D(strtmp, ampl4);
00758         }
00759     } // End of CYCLE OVER CELLS =============================================
00760 
00761     if (isubdet != 0 && noise_ == 0) { // signal only, once per event
00762         strtmp = "HcalDigiTask_number_of_amplitudes_above_10fC_" + subdet_;
00763         fill1D(strtmp, indigis);
00764 
00765         // SimHits once again !!!
00766         double eps = 1.e-3;
00767         double ehits = 0.;
00768         double ehits1 = 0.;
00769         double ehits2 = 0.;
00770         double ehits3 = 0.;
00771         double ehits4 = 0.;
00772 
00773         if (mc_ == "yes") {
00774             edm::Handle<edm::PCaloHitContainer> hcalHits;
00775             iEvent.getByLabel("g4SimHits", "HcalHits", hcalHits);
00776             const edm::PCaloHitContainer * simhitResult = hcalHits.product();
00777             for (std::vector<PCaloHit>::const_iterator simhits = simhitResult->begin(); simhits != simhitResult->end(); ++simhits) {
00778 
00779                 HcalDetId cell(simhits->id());
00780                 int ieta = cell.ieta();
00781                 if (ieta > 0) ieta--;
00782                 int iphi = cell.iphi() - 1;
00783                 int sub = cell.subdet();
00784 
00785                 // take cell already found to be max energy in a particular subdet
00786                 if (sub == isubdet && ieta == ieta_Sim && iphi == iphi_Sim) {
00787                     int depth = cell.depth();
00788                     double en = simhits->energy();
00789 
00790                     ehits += en;
00791                     if (depth == 1) ehits1 += en;
00792                     if (depth == 2) ehits2 += en;
00793                     if (depth == 3) ehits3 += en;
00794                     if (depth == 4) ehits4 += en;
00795                 }
00796             }
00797 
00798             strtmp = "HcalDigiTask_amplitude_vs_simhits_" + subdet_;
00799             if (ehits > eps) fill2D(strtmp, ehits, ampl_c);
00800             strtmp = "HcalDigiTask_amplitude_vs_simhits_depth1_" + subdet_;
00801             if (ehits1 > eps) fill2D(strtmp, ehits1, ampl1_c);
00802             strtmp = "HcalDigiTask_amplitude_vs_simhits_depth2_" + subdet_;
00803             if (ehits2 > eps) fill2D(strtmp, ehits2, ampl2_c);
00804             strtmp = "HcalDigiTask_amplitude_vs_simhits_depth3_" + subdet_;
00805             if (ehits3 > eps) fill2D(strtmp, ehits3, ampl3_c);
00806             strtmp = "HcalDigiTask_amplitude_vs_simhits_depth4_" + subdet_;
00807             if (ehits4 > eps) fill2D(strtmp, ehits4, ampl4_c);
00808 
00809             strtmp = "HcalDigiTask_amplitude_vs_simhits_profile_" + subdet_;
00810             if (ehits > eps) fillPf(strtmp, ehits, ampl_c);
00811             strtmp = "HcalDigiTask_amplitude_vs_simhits_profile_depth1_" + subdet_;
00812             if (ehits1 > eps) fillPf(strtmp, ehits1, ampl1_c);
00813             strtmp = "HcalDigiTask_amplitude_vs_simhits_profile_depth2_" + subdet_;
00814             if (ehits2 > eps) fillPf(strtmp, ehits2, ampl2_c);
00815             strtmp = "HcalDigiTask_amplitude_vs_simhits_profile_depth3_" + subdet_;
00816             if (ehits3 > eps) fillPf(strtmp, ehits3, ampl3_c);
00817             strtmp = "HcalDigiTask_amplitude_vs_simhits_profile_depth4_" + subdet_;
00818             if (ehits4 > eps) fillPf(strtmp, ehits4, ampl4_c);
00819 
00820             strtmp = "HcalDigiTask_ratio_amplitude_vs_simhits_" + subdet_;
00821             if (ehits > eps) fill1D(strtmp, ampl_c / ehits);
00822             strtmp = "HcalDigiTask_ratio_amplitude_vs_simhits_depth1_" + subdet_;
00823             if (ehits1 > eps) fill1D(strtmp, ampl1_c / ehits1);
00824             strtmp = "HcalDigiTask_ratio_amplitude_vs_simhits_depth2_" + subdet_;
00825             if (ehits2 > eps) fill1D(strtmp, ampl2_c / ehits2);
00826             strtmp = "HcalDigiTask_ratio_amplitude_vs_simhits_depth3_" + subdet_;
00827             if (ehits3 > eps) fill1D(strtmp, ampl3_c / ehits3);
00828             strtmp = "HcalDigiTask_ratio_amplitude_vs_simhits_depth4_" + subdet_;
00829             if (ehits4 > eps) fill1D(strtmp, ampl4_c / ehits4);
00830 
00831         } // end of if(mc_ == "yes")
00832 
00833         strtmp = "HcalDigiTask_Ndigis_" + subdet_;
00834         fill1D(strtmp, double(Ndig));
00835 
00836     } //  end of if( subdet != 0 && noise_ == 0) { // signal only
00837 }
00838 
00839 void HcalDigisValidation::eval_occupancy() {
00840 
00841     std::string strtmp;
00842     HistLim ietaLim(82, -41., 41.);
00843 
00844     int nx = 82;
00845     int ny = 72;
00846     float cnorm;
00847     float fev = float (nevtot);
00848         std::cout << "*** nevtot " <<  nevtot << std::endl;
00849 
00850     float sumphi_1, sumphi_2, sumphi_3, sumphi_4;
00851     float phi_factor;
00852 
00853     for (int i = 1; i <= nx; i++) {
00854         sumphi_1 = 0.;
00855         sumphi_2 = 0.;
00856         sumphi_3 = 0.;
00857         sumphi_4 = 0.;
00858 
00859         for (int j = 1; j <= ny; j++) {
00860 
00861             // occupancies
00862 
00863             strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth1_" + subdet_;
00864             cnorm = monitor(strtmp)->getBinContent(i, j) / fev;
00865             monitor(strtmp)->setBinContent(i, j, cnorm);
00866             sumphi_1 += monitor(strtmp)->getBinContent(i, j);
00867 
00868             strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth2_" + subdet_;
00869             cnorm = monitor(strtmp)->getBinContent(i, j) / fev;
00870             monitor(strtmp)->setBinContent(i, j, cnorm);
00871             sumphi_2 += monitor(strtmp)->getBinContent(i, j);
00872 
00873             strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth3_" + subdet_;
00874             cnorm = monitor(strtmp)->getBinContent(i, j) / fev;
00875             monitor(strtmp)->setBinContent(i, j, cnorm);
00876             sumphi_3 += monitor(strtmp)->getBinContent(i, j);
00877 
00878             strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth4_" + subdet_;
00879             cnorm = monitor(strtmp)->getBinContent(i, j) / fev;
00880             monitor(strtmp)->setBinContent(i, j, cnorm);
00881             sumphi_4 += monitor(strtmp)->getBinContent(i, j);
00882 
00883         }
00884 
00885         int ieta = i - 42; // -41 -1, 0 40
00886         if (ieta >= 0) ieta += 1; // -41 -1, 1 41  - to make it detector-like
00887 
00888         if (ieta >= -20 && ieta <= 20) {
00889             phi_factor = 72.;
00890         } else {
00891             if (ieta >= 40 || ieta <= -40) {
00892                 phi_factor = 18.;
00893             } else
00894                 phi_factor = 36.;
00895         }
00896 
00897 
00898         if (ieta >= 0) ieta -= 1; // -41 -1, 0 40  - to bring back to strtmp num !!!
00899         double deta = double(ieta);
00900 
00901         // occupancies vs ieta
00902         cnorm = sumphi_1 / phi_factor;
00903         strtmp = "HcalDigiTask_occupancy_vs_ieta_depth1_" + subdet_;
00904         fill1D(strtmp, deta, cnorm);
00905 
00906         cnorm = sumphi_2 / phi_factor;
00907         strtmp = "HcalDigiTask_occupancy_vs_ieta_depth2_" + subdet_;
00908         fill1D(strtmp, deta, cnorm);
00909 
00910         cnorm = sumphi_3 / phi_factor;
00911         strtmp = "HcalDigiTask_occupancy_vs_ieta_depth3_" + subdet_;
00912         fill1D(strtmp, deta, cnorm);
00913 
00914         cnorm = sumphi_4 / phi_factor;
00915         strtmp = "HcalDigiTask_occupancy_vs_ieta_depth4_" + subdet_;
00916         fill1D(strtmp, deta, cnorm);
00917 
00918     } // end of i-loop
00919 
00920 }
00921 
00922 void HcalDigisValidation::beginJob() {
00923     nevent1 = 0;
00924     nevent2 = 0;
00925     nevent3 = 0;
00926     nevent4 = 0;
00927 
00928     nevtot = 0;
00929 }
00930 
00931 void HcalDigisValidation::endJob() {
00932     //        if (outputFile_.size() != 0 && dbe_) dbe_->save(outputFile_);
00933 }
00934 
00935 void HcalDigisValidation::beginRun() {
00936 
00937 }
00938 
00939 void HcalDigisValidation::endRun() {
00940 
00941 }
00942 
00943 void HcalDigisValidation::book1D(std::string name, int n, double min, double max) {
00944     if (!msm_->count(name)) (*msm_)[name] = dbe_->book1D(name.c_str(), name.c_str(), n, min, max);
00945 }
00946 
00947 void HcalDigisValidation::book1D(std::string name, HistLim limX) {
00948     if (!msm_->count(name)) (*msm_)[name] = dbe_->book1D(name.c_str(), name.c_str(), limX.n, limX.min, limX.max);
00949 }
00950 
00951 void HcalDigisValidation::fill1D(std::string name, double X, double weight) {
00952     msm_->find(name)->second->Fill(X, weight);
00953 }
00954 
00955 void HcalDigisValidation::book2D(std::string name, HistLim limX, HistLim limY) {
00956     if (!msm_->count(name)) (*msm_)[name] = dbe_->book2D(name.c_str(), name.c_str(), limX.n, limX.min, limX.max, limY.n, limY.min, limY.max);
00957 }
00958 
00959 void HcalDigisValidation::fill2D(std::string name, double X, double Y, double weight) {
00960     msm_->find(name)->second->Fill(X, Y, weight);
00961 }
00962 
00963 void HcalDigisValidation::bookPf(std::string name, HistLim limX, HistLim limY) {
00964     if (!msm_->count(name)) (*msm_)[name] = dbe_->bookProfile(name.c_str(), name.c_str(), limX.n, limX.min, limX.max, limY.n, limY.min, limY.max);
00965 }
00966 
00967 void HcalDigisValidation::fillPf(std::string name, double X, double Y) {
00968     msm_->find(name)->second->Fill(X, Y);
00969 }
00970 
00971 MonitorElement* HcalDigisValidation::monitor(std::string name) {
00972     if (!msm_->count(name)) return NULL;
00973     else return msm_->find(name)->second;
00974 }
00975 
00976 std::string HcalDigisValidation::str(int x) {
00977     std::stringstream out;
00978     out << x;
00979     return out.str();
00980 }
00981 
00982 
00983 //define this as a plug-in
00984 DEFINE_FWK_MODULE(HcalDigisValidation);
00985 
00986