00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <iostream>
00015 #include <cmath>
00016
00017
00018 #include "SimG4CMS/HcalTestBeam/interface/HcalTB06Histo.h"
00019 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00020 #include "FWCore/ServiceRegistry/interface/Service.h"
00021 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00022
00023
00024
00025 HcalTB06Histo::HcalTB06Histo(const edm::ParameterSet& ps) :
00026 iniE(0), iEta(0), iPhi(0), edepS(0), edecS(0), edhcS(0), edehS(0) {
00027
00028 verbose = ps.getUntrackedParameter<bool>("Verbose", false);
00029 double em1 = ps.getUntrackedParameter<double>("ETtotMax", 400.);
00030 double em2 = ps.getUntrackedParameter<double>("EHCalMax", 4.0);
00031
00032
00033 edm::Service<TFileService> tfile;
00034
00035 if ( !tfile.isAvailable() )
00036 throw cms::Exception("BadConfig") << "TFileService unavailable: "
00037 << "please add it to config file";
00038 iniE = tfile->make<TH1D>("iniE", "Incident Energy (GeV)", 4000, 0., em1);
00039 iEta = tfile->make<TH1D>("iEta", "Eta at incidence ", 300, 0., 3.);
00040 iPhi = tfile->make<TH1D>("iPhi", "Phi at incidence ", 300, -1., 1.);
00041 edepS= tfile->make<TH1D>("edepS", "Energy deposit == Total",4000, 0., em1);
00042 edecS= tfile->make<TH1D>("edecS", "Energy deposit == ECal ",4000, 0., em1);
00043 edhcS= tfile->make<TH1D>("edhcS", "Energy deposit == HCal ",4000, 0., em2);
00044 edehS= tfile->make<TH2D>("edehS", "Hcal vs Ecal", 100,0.,em1, 100, 0.,em2);
00045 }
00046
00047 HcalTB06Histo::~HcalTB06Histo() {}
00048
00049
00050
00051
00052
00053 void HcalTB06Histo::fillPrimary(double energy, double eta, double phi) {
00054
00055 LogDebug("HcalTBSim") << "HcalTB06Histo::fillPrimary: Energy "
00056 << energy << " Eta " << eta << " Phi " << phi;
00057 iniE->Fill(energy);
00058 iEta->Fill(eta);
00059 iPhi->Fill(phi);
00060 }
00061
00062 void HcalTB06Histo::fillEdep(double etots, double eecals, double ehcals) {
00063
00064 LogDebug("HcalTBSim") << "HcalTB06Histo:::fillEdep: Simulated Total "
00065 << etots << " ECal " << eecals << " HCal " << ehcals;
00066 edepS->Fill(etots);
00067 edecS->Fill(eecals);
00068 edhcS->Fill(ehcals);
00069 edehS->Fill(eecals, ehcals);
00070 }