00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075 #include "DQM/L1TMonitor/interface/L1TECALTPG.h"
00076
00077 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
00078 #include "DQMServices/Core/interface/DQMStore.h"
00079
00080
00081 using namespace edm;
00082
00083
00084 const unsigned int RTPBINS = 101;
00085 const float RTPMIN = -0.5;
00086 const float RTPMAX = 100.5;
00087
00088 const unsigned int TPPHIBINS = 72;
00089 const float TPPHIMIN = 0.5;
00090 const float TPPHIMAX = 72.5;
00091
00092 const unsigned int TPETABINS = 65;
00093 const float TPETAMIN = -32.5;
00094 const float TPETAMAX = 32.5;
00095
00096
00097 L1TECALTPG::L1TECALTPG(const ParameterSet & ps):
00098 ecaltpgSourceB_(ps.getParameter<edm::InputTag>("ecaltpgSourceB")),
00099 ecaltpgSourceE_(ps.getParameter<edm::InputTag>("ecaltpgSourceE"))
00100 {
00101
00102
00103 verbose_ = ps.getUntrackedParameter < bool > ("verbose", false);
00104
00105
00106 enableEE_ = ps.getUntrackedParameter < bool > ("enableEE", false);
00107
00108 if (verbose_)
00109 std::cout << "L1TECALTPG: constructor...." << std::endl;
00110
00111
00112 dbe = NULL;
00113 if (ps.getUntrackedParameter < bool > ("DQMStore", false)) {
00114 dbe = Service < DQMStore > ().operator->();
00115 dbe->setVerbose(0);
00116 }
00117
00118 outputFile_ =
00119 ps.getUntrackedParameter < std::string > ("outputFile", "");
00120 if (outputFile_.size() != 0) {
00121 std::cout << "L1T Monitoring histograms will be saved to "
00122 << outputFile_ << std::endl;
00123 }
00124
00125 bool disable =
00126 ps.getUntrackedParameter < bool > ("disableROOToutput", false);
00127 if (disable) {
00128 outputFile_ = "";
00129 }
00130
00131
00132 if (dbe != NULL) {
00133 dbe->setCurrentFolder("L1T/L1TECALTPG");
00134 }
00135
00136
00137 }
00138
00139 L1TECALTPG::~L1TECALTPG()
00140 {
00141 }
00142
00143 void L1TECALTPG::beginJob(void)
00144 {
00145
00146 nev_ = 0;
00147
00148
00149 DQMStore *dbe = 0;
00150 dbe = Service < DQMStore > ().operator->();
00151
00152 if (dbe) {
00153 dbe->setCurrentFolder("L1T/L1TECALTPG");
00154 dbe->rmdir("L1T/L1TECALTPG");
00155 }
00156
00157
00158 if (dbe) {
00159 dbe->setCurrentFolder("L1T/L1TECALTPG");
00160 ecalTpEtEtaPhiB_ =
00161 dbe->book2D("EcalTpEtEtaPhiB", "ECAL TP E_{T} Barrel", TPPHIBINS,
00162 TPPHIMIN, TPPHIMAX, TPETABINS, TPETAMIN, TPETAMAX);
00163 ecalTpOccEtaPhiB_ =
00164 dbe->book2D("EcalTpOccEtaPhiB", "ECAL TP OCCUPANCY Barrel", TPPHIBINS,
00165 TPPHIMIN, TPPHIMAX, TPETABINS, TPETAMIN, TPETAMAX);
00166 ecalTpRankB_ =
00167 dbe->book1D("EcalTpRankB", "ECAL TP RANK Barrel", RTPBINS, RTPMIN,
00168 RTPMAX);
00169
00170 ecalTpEtEtaPhiE_ =
00171 dbe->book2D("EcalTpEtEtaPhiE", "ECAL TP E_{T} Endcap", TPPHIBINS,
00172 TPPHIMIN, TPPHIMAX, TPETABINS, TPETAMIN, TPETAMAX);
00173 ecalTpOccEtaPhiE_ =
00174 dbe->book2D("EcalTpOccEtaPhiE", "ECAL TP OCCUPANCY Endcap", TPPHIBINS,
00175 TPPHIMIN, TPPHIMAX, TPETABINS, TPETAMIN, TPETAMAX);
00176 ecalTpRankE_ =
00177 dbe->book1D("EcalTpRankE", "ECAL TP RANK Endcap", RTPBINS, RTPMIN,
00178 RTPMAX);
00179
00180 }
00181 }
00182
00183
00184 void L1TECALTPG::endJob(void)
00185 {
00186 if (verbose_)
00187 std::cout << "L1TECALTPG: end job...." << std::endl;
00188 LogInfo("EndJob") << "analyzed " << nev_ << " events";
00189
00190 if (outputFile_.size() != 0 && dbe)
00191 dbe->save(outputFile_);
00192
00193 return;
00194 }
00195
00196 void L1TECALTPG::analyze(const Event & e, const EventSetup & c)
00197 {
00198 nev_++;
00199 if (verbose_) {
00200 std::cout << "L1TECALTPG: analyze...." << std::endl;
00201 }
00202
00203
00204 edm::Handle < EcalTrigPrimDigiCollection > eeTP;
00205 edm::Handle < EcalTrigPrimDigiCollection > ebTP;
00206
00207 e.getByLabel(ecaltpgSourceB_,ebTP);
00208 e.getByLabel(ecaltpgSourceE_,eeTP);
00209
00210 if (!eeTP.isValid() && enableEE_)
00211 {
00212 edm::LogInfo("DataNotFound") << "can't find EcalTrigPrimCollection with "
00213 " endcap label " << ecaltpgSourceE_.label() ;
00214 return;
00215 }
00216 if (!ebTP.isValid())
00217 {
00218 edm::LogInfo("DataNotFound") << "can't find EcalTrigPrimCollection with "
00219 " barrel label " << ecaltpgSourceB_.label() ;
00220 return;
00221 }
00222
00223
00224 if ( verbose_ ) {
00225 std::cout << "L1TECALTPG: barrel size is " << ebTP->size() << std::endl;
00226 std::cout << "L1TECALTPG: endcap size is " << eeTP->size() << std::endl;
00227 }
00228
00229 for (EcalTrigPrimDigiCollection::const_iterator iebTP = ebTP->begin();
00230 iebTP != ebTP->end(); iebTP++) {
00231 if ( verbose_ ) {
00232 std::cout << "barrel: " << iebTP->id().iphi() << ", "
00233 << iebTP->id().ieta()
00234 << std::endl;
00235 }
00236 ecalTpEtEtaPhiB_->Fill(iebTP->id().iphi(), iebTP->id().ieta(),
00237 iebTP->compressedEt());
00238 ecalTpOccEtaPhiB_->Fill(iebTP->id().iphi(), iebTP->id().ieta());
00239 ecalTpRankB_->Fill(iebTP->compressedEt());
00240
00241 }
00242
00243 if (enableEE_){
00244
00245 for (EcalTrigPrimDigiCollection::const_iterator ieeTP = eeTP->begin();
00246 ieeTP != eeTP->end(); ieeTP++) {
00247 if ( verbose_ ) {
00248 std::cout << "endcap: " << ieeTP->id().iphi() << ", "
00249 << ieeTP->id().ieta()
00250 << std::endl;
00251 }
00252 ecalTpEtEtaPhiE_->Fill(ieeTP->id().iphi(), ieeTP->id().ieta(),
00253 ieeTP->compressedEt());
00254 ecalTpOccEtaPhiE_->Fill(ieeTP->id().iphi(), ieeTP->id().ieta());
00255 ecalTpRankE_->Fill(ieeTP->compressedEt());
00256
00257 }
00258 }
00259
00260 }