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 #include "DQM/L1TMonitor/interface/L1TCompare.h"
00065
00066
00067 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctCollections.h"
00068 #include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h"
00069 #include "DataFormats/L1CaloTrigger/interface/L1CaloRegionDetId.h"
00070
00071
00072 #include "DataFormats/L1Trigger/interface/L1EmParticleFwd.h"
00073 #include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h"
00074 #include "DataFormats/L1Trigger/interface/L1EtMissParticleFwd.h"
00075
00076
00077 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
00078
00079 #include "DQMServices/Core/interface/DQMStore.h"
00080
00081
00082 #include <algorithm>
00083
00084 using namespace l1extra;
00085 using namespace edm;
00086
00087 const unsigned int PHIBINS = 18;
00088 const float PHIMIN = -0.5;
00089 const float PHIMAX = 17.5;
00090
00091
00092 const unsigned int R6BINS = 64;
00093 const float R6MIN = -0.5;
00094 const float R6MAX = 63.5;
00095 const unsigned int R10BINS = 1024;
00096 const float R10MIN = -0.5;
00097 const float R10MAX = 1023.5;
00098 const unsigned int R12BINS = 4096;
00099 const float R12MIN = -0.5;
00100 const float R12MAX = 4095.5;
00101
00102
00103
00104 const unsigned int ETABINS = 22;
00105 const float ETAMIN = -0.5;
00106 const float ETAMAX = 21.5;
00107
00108
00109 const unsigned int TPPHIBINS = 72;
00110 const float TPPHIMIN = 0.5;
00111 const float TPPHIMAX = 72.5;
00112
00113 const unsigned int TPETABINS = 65;
00114 const float TPETAMIN = -32.5;
00115 const float TPETAMAX = 32.5;
00116
00117
00118 L1TCompare::L1TCompare(const ParameterSet & ps) :
00119 rctSource_( ps.getParameter< InputTag >("rctSource") )
00120 ,gctSource_( ps.getParameter< InputTag >("gctSource") )
00121 ,ecalTpgSource_(ps.getParameter<edm::InputTag>("ecalTpgSource"))
00122
00123 {
00124
00125
00126 verbose_ = ps.getUntrackedParameter < bool > ("verbose", false);
00127
00128 if (verbose())
00129 std::cout << "L1TCompare: constructor...." << std::endl;
00130
00131
00132 dbe = NULL;
00133 if (ps.getUntrackedParameter < bool > ("DQMStore", false)) {
00134 dbe = Service < DQMStore > ().operator->();
00135 dbe->setVerbose(0);
00136 }
00137
00138 outputFile_ =
00139 ps.getUntrackedParameter < std::string > ("outputFile", "");
00140 if (outputFile_.size() != 0) {
00141 std::
00142 cout << "L1T Monitoring histograms will be saved to " <<
00143 outputFile_.c_str() << std::endl;
00144 }
00145
00146 bool disable =
00147 ps.getUntrackedParameter < bool > ("disableROOToutput", false);
00148 if (disable) {
00149 outputFile_ = "";
00150 }
00151
00152
00153 if (dbe != NULL) {
00154 dbe->setCurrentFolder("L1T/Compare");
00155 }
00156
00157
00158 }
00159
00160 L1TCompare::~L1TCompare()
00161 {
00162 }
00163
00164 void L1TCompare::beginJob(void)
00165 {
00166
00167 nev_ = 0;
00168
00169
00170 DQMStore *dbe = 0;
00171 dbe = Service < DQMStore > ().operator->();
00172
00173 if (dbe) {
00174 dbe->setCurrentFolder("L1T/Compare");
00175 dbe->rmdir("L1T/Compare");
00176 }
00177
00178
00179 if (dbe) {
00180 dbe->setCurrentFolder("L1T/Compare");
00181
00182
00183
00184
00185
00186 rctGctLeadingIsoEmRank_ = dbe->book2D("rctGctLeadingIsoEmRank",
00187 "RCT-GCT: rank", R6BINS, R6MIN, R6MAX,
00188 R6BINS, R6MIN, R6MAX);
00189 rctGctLeadingIsoEmRank_->setAxisTitle(std::string("gct"), 1);
00190 rctGctLeadingIsoEmRank_->setAxisTitle(std::string("rct"), 2);
00191 rctGctLeadingIsoEmEta_ = dbe->book2D("rctGctLeadingIsoEmEta",
00192 "RCT-GCT: #eta", ETABINS, ETAMIN, ETAMAX,
00193 ETABINS, ETAMIN, ETAMAX);
00194 rctGctLeadingIsoEmEta_->setAxisTitle(std::string("gct"), 1);
00195 rctGctLeadingIsoEmEta_->setAxisTitle(std::string("rct"), 2);
00196
00197 rctGctLeadingIsoEmPhi_ = dbe->book2D("rctGctLeadingIsoEmPhi",
00198 "RCT-GCT: #phi", PHIBINS, PHIMIN, PHIMAX,
00199 PHIBINS, PHIMIN, PHIMAX);
00200 rctGctLeadingIsoEmPhi_->setAxisTitle(std::string("gct"), 1);
00201 rctGctLeadingIsoEmPhi_->setAxisTitle(std::string("rct"), 2);
00202
00203 rctGctLeadingNonIsoEmRank_ = dbe->book2D("rctGctLeadingNonIsoEmRank",
00204 "RCT-GCT: rank", R6BINS, R6MIN, R6MAX,
00205 R6BINS, R6MIN, R6MAX);
00206 rctGctLeadingNonIsoEmRank_->setAxisTitle(std::string("gct"), 1);
00207 rctGctLeadingNonIsoEmRank_->setAxisTitle(std::string("rct"), 2);
00208
00209 rctGctLeadingNonIsoEmEta_ = dbe->book2D("rctGctLeadingNonIsoEmEta",
00210 "RCT-GCT: #eta", ETABINS, ETAMIN, ETAMAX,
00211 ETABINS, ETAMIN, ETAMAX);
00212 rctGctLeadingNonIsoEmEta_->setAxisTitle(std::string("gct"), 1);
00213 rctGctLeadingNonIsoEmEta_->setAxisTitle(std::string("rct"), 2);
00214
00215 rctGctLeadingNonIsoEmPhi_ = dbe->book2D("rctGctLeadingNonIsoEmPhi",
00216 "RCT-GCT: #phi", PHIBINS, PHIMIN, PHIMAX,
00217 PHIBINS, PHIMIN, PHIMAX);
00218 rctGctLeadingNonIsoEmPhi_->setAxisTitle(std::string("gct"), 1);
00219 rctGctLeadingNonIsoEmPhi_->setAxisTitle(std::string("rct"), 2);
00220
00221
00222
00223 ecalTpgRctLeadingEmRank_ = dbe->book2D("ecalTpgRctLeadingEmRank",
00224 "ECAL TPG-RCT: rank",
00225 R6BINS, R6MIN, R6MAX,
00226 R6BINS, R6MIN, R6MAX);
00227 ecalTpgRctLeadingEmRank_->setAxisTitle(std::string("rct"), 1);
00228 ecalTpgRctLeadingEmRank_->setAxisTitle(std::string("ecal tp"), 2);
00229
00230 ecalTpgRctLeadingEmEta_ = dbe->book2D("ecalTpgRctLeadingEmEta",
00231 "ECAL TPG-RCT: #eta",
00232 15, -0.5, 14.5,
00233 TPETABINS, TPETAMIN, TPETAMAX);
00234 ecalTpgRctLeadingEmEta_->setAxisTitle(std::string("rct"), 1);
00235 ecalTpgRctLeadingEmEta_->setAxisTitle(std::string("ecal tp"), 2);
00236 ecalTpgRctLeadingEmEta2_ = dbe->book2D("ecalTpgRctLeadingEmEta2",
00237 "ECAL TPG-RCT: #eta (2)",
00238 13, -6.5, 6.5,
00239 TPETABINS, TPETAMIN, TPETAMAX);
00240 ecalTpgRctLeadingEmEta2_->setAxisTitle(std::string("rct"), 1);
00241 ecalTpgRctLeadingEmEta2_->setAxisTitle(std::string("ecal tp"), 2);
00242 ecalTpgRctLeadingEmPhi_ = dbe->book2D("ecalTpgRctLeadingEmPhi",
00243 "ECAL TPG-RCT: #phi",
00244 PHIBINS, PHIMIN, PHIMAX,
00245 TPPHIBINS, TPPHIMIN, TPPHIMAX);
00246 ecalTpgRctLeadingEmPhi_->setAxisTitle(std::string("rct"), 1);
00247 ecalTpgRctLeadingEmPhi_->setAxisTitle(std::string("ecal tp"), 2);
00248 }
00249
00250 }
00251
00252
00253 void L1TCompare::endJob(void)
00254 {
00255 if (verbose())
00256 std::cout << "L1TCompare: end job...." << std::endl;
00257 LogInfo("EndJob") << "analyzed " << nev_ << " events";
00258
00259 if (outputFile_.size() != 0 && dbe)
00260 dbe->save(outputFile_);
00261
00262 return;
00263 }
00264
00265 void L1TCompare::analyze(const Event & e, const EventSetup & c)
00266 {
00267 ++nev_;
00268 if (verbose()) {
00269 std::cout << "L1TCompare: analyze...." << std::endl;
00270 }
00271
00272
00273 edm::Handle < L1EmParticleCollection > l1eIsoEm;
00274 edm::Handle < L1EmParticleCollection > l1eNonIsoEm;
00275 edm::Handle < L1JetParticleCollection > l1eCenJets;
00276 edm::Handle < L1JetParticleCollection > l1eForJets;
00277 edm::Handle < L1JetParticleCollection > l1eTauJets;
00278
00279 edm::Handle < L1EtMissParticleCollection > l1eEtMiss;
00280
00281 edm::Handle < L1CaloEmCollection > em;
00282 edm::Handle < L1CaloRegionCollection > rctEmRgn;
00283
00284
00285 edm::Handle <L1GctJetCandCollection> gctCenJets;
00286 edm::Handle <L1GctEmCandCollection> gctIsoEmCands;
00287 edm::Handle <L1GctEmCandCollection> gctNonIsoEmCands;
00288
00289
00290 e.getByLabel(rctSource_,em);
00291
00292 if (!em.isValid()) {
00293 edm::LogInfo("DataNotFound") << "can't find L1CaloEmCollection with label "
00294 << rctSource_.label() ;
00295 return;
00296 }
00297
00298
00299 e.getByLabel(rctSource_,rctEmRgn);
00300
00301 if (!rctEmRgn.isValid()) {
00302 edm::LogInfo("DataNotFound") << "can't find "
00303 << "L1CaloRegionCollection with label "
00304 << rctSource_.label() ;
00305 return;
00306 }
00307
00308
00309 e.getByLabel(gctSource_.label(),"cenJets", gctCenJets);
00310 e.getByLabel(gctSource_.label(), "isoEm", gctIsoEmCands);
00311 e.getByLabel(gctSource_.label(), "nonIsoEm", gctNonIsoEmCands);
00312
00313 if (!gctCenJets.isValid()) {
00314 std::cerr << "L1TGCT: could not find one of the classes?" << std::endl;
00315 return;
00316 }
00317 if (!gctIsoEmCands.isValid()) {
00318 std::cerr << "L1TGCT: could not find one of the classes?" << std::endl;
00319 return;
00320 }
00321 if (!gctNonIsoEmCands.isValid()) {
00322 std::cerr << "L1TGCT: could not find one of the classes?" << std::endl;
00323 return;
00324 }
00325
00326
00327
00328 if ( verbose() ) {
00329 for ( L1GctEmCandCollection::const_iterator iem = gctIsoEmCands->begin();
00330 iem != gctIsoEmCands->end(); ++iem) {
00331 if ( !iem->empty() )
00332 std::cout << "GCT EM: " << iem->rank()
00333 << ", "
00334 << iem->etaIndex() << "("
00335
00336 << "), "
00337 << iem->phiIndex()
00338 << std::endl;
00339 }
00340 }
00341
00342
00343
00344
00345
00346
00347
00348 RctObjectCollection rcj, rcj_iso, rcj_non_iso;
00349 for (L1CaloEmCollection::const_iterator iem = em->begin();
00350 iem != em->end(); ++iem) {
00351
00352
00353 L1CaloRegionDetId id(iem->rctCrate(), iem->rctCard(),
00354 iem->rctRegion());
00355
00356
00357 RctObject h(id.rctEta(), id.rctPhi(), iem->rank());
00358 if ( !iem->isolated() )
00359 rcj_non_iso.push_back(h);
00360 else
00361 rcj_iso.push_back(h);
00362 rcj.push_back(h);
00363 }
00364
00365 std::sort(rcj.begin(), rcj.end(), RctObjectComp());
00366 std::sort(rcj_non_iso.begin(), rcj_non_iso.end(), RctObjectComp());
00367 std::sort(rcj_iso.begin(), rcj_iso.end(), RctObjectComp());
00368 if ( verbose() ) {
00369 for (RctObjectCollection::reverse_iterator ij = rcj_iso.rbegin();
00370 ij != rcj_iso.rend() && ij != rcj_iso.rbegin()+8; ++ij) {
00371 std::cout << "RCT cj: "
00372 << ij->rank_ << ", " << ij->eta_ << ", " << ij->phi_
00373 << std::endl;
00374 }
00375 }
00376 L1GctEmCandCollection::const_iterator lead_em = gctIsoEmCands->begin();
00377 if ( !lead_em->empty() ) {
00378 rctGctLeadingIsoEmEta_->Fill(lead_em->etaIndex(), rcj_iso.rbegin()->eta_);
00379 rctGctLeadingIsoEmPhi_->Fill(lead_em->phiIndex(), rcj_iso.rbegin()->phi_);
00380 rctGctLeadingIsoEmRank_->Fill(lead_em->rank(), rcj_iso.rbegin()->rank_);
00381 }
00382
00383
00384 if ( verbose() ) {
00385 for ( L1GctEmCandCollection::const_iterator iem
00386 = gctNonIsoEmCands->begin(); iem != gctNonIsoEmCands->end();
00387 ++iem) {
00388 if ( ! iem->empty() )
00389 std::cout << "GCT EM non: " << iem->rank()
00390 << ", "
00391 << iem->etaIndex()
00392
00393
00394 << ", "
00395 << iem->phiIndex()
00396 << std::endl;
00397 }
00398 }
00399 if ( verbose() ) {
00400 for (RctObjectCollection::reverse_iterator ij = rcj_non_iso.rbegin();
00401 ij != rcj_non_iso.rend() && ij != rcj_non_iso.rbegin()+8; ++ij) {
00402 std::cout << "RCT cj non: "
00403 << ij->rank_ << ", " << ij->eta_ << ", " << ij->phi_
00404 << std::endl;
00405 }
00406 }
00407 lead_em = gctNonIsoEmCands->begin();
00408 if ( !lead_em->empty() ) {
00409 rctGctLeadingNonIsoEmEta_->Fill(lead_em->etaIndex(),
00410 rcj_non_iso.rbegin()->eta_);
00411 rctGctLeadingNonIsoEmPhi_->Fill(lead_em->phiIndex(),
00412 rcj_non_iso.rbegin()->phi_);
00413 rctGctLeadingNonIsoEmRank_->Fill(lead_em->rank(),
00414 rcj_non_iso.rbegin()->rank_);
00415 }
00416
00417
00418 edm::Handle < EcalTrigPrimDigiCollection > eTP;
00419 e.getByLabel(ecalTpgSource_,eTP);
00420
00421 if (!eTP.isValid()) {
00422 edm::LogInfo("DataNotFound")
00423 << "can't find EcalTrigPrimCollection with label "
00424 << ecalTpgSource_.label() ;
00425 return;
00426 }
00427 RctObjectCollection ecalobs;
00428 for (EcalTrigPrimDigiCollection::const_iterator ieTP = eTP->begin();
00429 ieTP != eTP->end(); ieTP++) {
00430 ecalobs.push_back(RctObject(ieTP->id().ieta(),
00431 ieTP->id().iphi(),
00432 ieTP->compressedEt()));
00433 }
00434 std::sort(ecalobs.begin(), ecalobs.end(), RctObjectComp());
00435 if ( verbose() ) {
00436 for (RctObjectCollection::reverse_iterator ij = ecalobs.rbegin();
00437 ij != ecalobs.rend() && ij != ecalobs.rbegin()+8; ++ij) {
00438 std::cout << "ECAL cj : "
00439 << ij->rank_ << ", " << ij->eta_ << ", " << ij->phi_
00440 << std::endl;
00441 }
00442 }
00443
00444 if ( rcj.rbegin()->rank_ > 4 ) {
00445 ecalTpgRctLeadingEmEta_->Fill(rcj.rbegin()->eta_,
00446 ecalobs.rbegin()->eta_);
00447 int e2 = (rcj.rbegin()->eta_&0x7UL)* ((rcj.rbegin()->eta_&0x8UL)?1:-1);
00448 ecalTpgRctLeadingEmEta2_->Fill(e2, ecalobs.rbegin()->eta_);
00449 ecalTpgRctLeadingEmPhi_->Fill(rcj.rbegin()->phi_, ecalobs.rbegin()->phi_);
00450 ecalTpgRctLeadingEmRank_->Fill(rcj.rbegin()->rank_,
00451 ecalobs.rbegin()->rank_);
00452 }
00453 if ( verbose() ) {
00454 int seta = rcj.rbegin()->eta_;
00455 seta = (seta&0x7UL)*(seta&0x8?-1:1);
00456 std::cout << "ZZ: "
00457 << rcj.rbegin()->eta_ << " "
00458 << rcj.rbegin()->phi_ << " "
00459 << rcj.rbegin()->rank_ << " "
00460 << (++rcj.rbegin())->rank_<< " "
00461 << ecalobs.rbegin()->eta_ << " "
00462 << ecalobs.rbegin()->phi_ << " "
00463 << ecalobs.rbegin()->rank_ << " "
00464 << (++ecalobs.rbegin())->rank_<< " "
00465 << seta << " "
00466 << std::endl;
00467 }
00468
00469
00470
00471 }