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