00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <memory>
00012 #include <iostream>
00013 #include <fstream>
00014 #include <iomanip>
00015
00016 #include "TCanvas.h"
00017 #include "TStyle.h"
00018
00019 #include "DQMServices/Core/interface/DQMStore.h"
00020
00021 #include "DQM/EcalCommon/interface/UtilsClient.h"
00022 #include "DQM/EcalCommon/interface/Numbers.h"
00023
00024 #include <DataFormats/EcalDetId/interface/EBDetId.h>
00025
00026 #include <DQM/EcalBarrelMonitorClient/interface/EBTriggerTowerClient.h>
00027
00028 using namespace cms;
00029 using namespace edm;
00030 using namespace std;
00031
00032 EBTriggerTowerClient::EBTriggerTowerClient(const ParameterSet& ps) {
00033
00034
00035 cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00036
00037
00038 verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
00039
00040
00041 debug_ = ps.getUntrackedParameter<bool>("debug", false);
00042
00043
00044 prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
00045
00046
00047 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00048
00049
00050 superModules_.reserve(36);
00051 for ( unsigned int i = 1; i <= 36; i++ ) superModules_.push_back(i);
00052 superModules_ = ps.getUntrackedParameter<vector<int> >("superModules", superModules_);
00053
00054 h01_ = 0;
00055 h02_ = 0;
00056
00057 for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00058
00059 int ism = superModules_[i];
00060
00061 i01_[ism-1] = 0;
00062 i02_[ism-1] = 0;
00063 j01_[ism-1] = 0;
00064 j02_[ism-1] = 0;
00065
00066 l01_[ism-1] = 0;
00067 m01_[ism-1] = 0;
00068 n01_[ism-1] = 0;
00069 o01_[ism-1] = 0;
00070
00071 meh01_ = 0;
00072 meh02_ = 0;
00073
00074 mei01_[ism-1] = 0;
00075 mei02_[ism-1] = 0;
00076 mej01_[ism-1] = 0;
00077 mej02_[ism-1] = 0;
00078
00079 mel01_[ism-1] = 0;
00080 mem01_[ism-1] = 0;
00081 men01_[ism-1] = 0;
00082 meo01_[ism-1] = 0;
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094 me_h01_[ism-1] = 0;
00095 me_h02_[ism-1] = 0;
00096 for (int j=0; j<2; j++) {
00097 me_i01_[ism-1][j] = 0;
00098 me_i02_[ism-1][j] = 0;
00099 me_n01_[ism-1][j] = 0;
00100 }
00101 for (int j=0; j<6; j++) {
00102 me_j01_[ism-1][j] = 0;
00103 me_j02_[ism-1][j] = 0;
00104 me_m01_[ism-1][j] = 0;
00105 }
00106 me_o01_[ism-1] = 0;
00107
00108 }
00109
00110 }
00111
00112 EBTriggerTowerClient::~EBTriggerTowerClient() {
00113
00114 }
00115
00116 void EBTriggerTowerClient::beginJob(DQMStore* dqmStore) {
00117
00118 dqmStore_ = dqmStore;
00119
00120 if ( debug_ ) cout << "EBTriggerTowerClient: beginJob" << endl;
00121
00122 ievt_ = 0;
00123 jevt_ = 0;
00124
00125 }
00126
00127 void EBTriggerTowerClient::beginRun(void) {
00128
00129 if ( debug_ ) cout << "EBTriggerTowerClient: beginRun" << endl;
00130
00131 jevt_ = 0;
00132
00133 this->setup();
00134
00135 }
00136
00137 void EBTriggerTowerClient::endJob(void) {
00138
00139 if ( debug_ ) cout << "EBTriggerTowerClient: endJob, ievt = " << ievt_ << endl;
00140
00141 this->cleanup();
00142
00143 }
00144
00145 void EBTriggerTowerClient::endRun(void) {
00146
00147 if ( debug_ ) cout << "EBTriggerTowerClient: endRun, jevt = " << jevt_ << endl;
00148
00149 this->cleanup();
00150
00151 }
00152
00153 void EBTriggerTowerClient::setup(void) {
00154
00155 char histo[200];
00156
00157 dqmStore_->setCurrentFolder( prefixME_ + "/EBTriggerTowerClient" );
00158
00159 for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00160
00161 int ism = superModules_[i];
00162
00163 if ( me_h01_[ism-1] ) dqmStore_->removeElement( me_h01_[ism-1]->getName() );
00164 sprintf(histo, "EBTTT Et map Real Digis %s", Numbers::sEB(ism).c_str());
00165 me_h01_[ism-1] = dqmStore_->bookProfile2D(histo, histo, 17, 0., 17., 4, 0., 4., 256, 0., 256., "s");
00166 me_h01_[ism-1]->setAxisTitle("ieta'", 1);
00167 me_h01_[ism-1]->setAxisTitle("iphi'", 2);
00168 if ( me_h02_[ism-1] ) dqmStore_->removeElement( me_h02_[ism-1]->getName() );
00169 sprintf(histo, "EBTTT Et map Emulated Digis %s", Numbers::sEB(ism).c_str());
00170 me_h02_[ism-1] = dqmStore_->bookProfile2D(histo, histo, 17, 0., 17., 4, 0., 4., 256, 0., 256., "s");
00171 me_h02_[ism-1]->setAxisTitle("ieta'", 1);
00172 me_h02_[ism-1]->setAxisTitle("iphi'", 2);
00173 for (int j=0; j<2; j++) {
00174 if ( me_i01_[ism-1][j] ) dqmStore_->removeElement( me_i01_[ism-1][j]->getName() );
00175 sprintf(histo, "EBTTT FineGrainVeto Real Digis Flag %d %s", j, Numbers::sEB(ism).c_str());
00176 me_i01_[ism-1][j] = dqmStore_->book2D(histo, histo, 17, 0., 17., 4, 0., 4.);
00177 me_i01_[ism-1][j]->setAxisTitle("ieta'", 1);
00178 me_i01_[ism-1][j]->setAxisTitle("iphi'", 2);
00179 if ( me_i02_[ism-1][j] ) dqmStore_->removeElement( me_i02_[ism-1][j]->getName() );
00180 sprintf(histo, "EBTTT FineGrainVeto Emulated Digis Flag %d %s", j, Numbers::sEB(ism).c_str());
00181 me_i02_[ism-1][j] = dqmStore_->book2D(histo, histo, 17, 0., 17., 4, 0., 4.);
00182 me_i02_[ism-1][j]->setAxisTitle("ieta'", 1);
00183 me_i02_[ism-1][j]->setAxisTitle("iphi'", 2);
00184 if ( me_n01_[ism-1][j] ) dqmStore_->removeElement( me_n01_[ism-1][j]->getName() );
00185 sprintf(histo, "EBTTT EmulFineGrainVetoError Flag %d %s", j, Numbers::sEB(ism).c_str());
00186 me_n01_[ism-1][j] = dqmStore_->book2D(histo, histo, 17, 0., 17., 4, 0., 4.);
00187 me_n01_[ism-1][j]->setAxisTitle("ieta'", 1);
00188 me_n01_[ism-1][j]->setAxisTitle("iphi'", 2);
00189 }
00190 for (int j=0; j<6; j++) {
00191 string bits;
00192 if ( j == 0 ) bits = "Bit 000";
00193 if ( j == 1 ) bits = "Bit 001";
00194 if ( j == 2 ) bits = "Bit 011";
00195 if ( j == 3 ) bits = "Bit 100";
00196 if ( j == 4 ) bits = "Bit 101";
00197 if ( j == 5 ) bits = "Bits 110+111";
00198 if ( me_j01_[ism-1][j] ) dqmStore_->removeElement( me_j01_[ism-1][j]->getName() );
00199 sprintf(histo, "EBTTT Flags Real Digis %s %s", bits.c_str(), Numbers::sEB(ism).c_str());
00200 me_j01_[ism-1][j] = dqmStore_->book2D(histo, histo, 17, 0., 17., 4, 0., 4.);
00201 me_j01_[ism-1][j]->setAxisTitle("ieta'", 1);
00202 me_j01_[ism-1][j]->setAxisTitle("iphi'", 2);
00203 if ( me_j02_[ism-1][j] ) dqmStore_->removeElement( me_j02_[ism-1][j]->getName() );
00204 sprintf(histo, "EBTTT Flags Emulated Digis %s %s", bits.c_str(), Numbers::sEB(ism).c_str());
00205 me_j02_[ism-1][j] = dqmStore_->book2D(histo, histo, 17, 0., 17., 4, 0., 4.);
00206 me_j02_[ism-1][j]->setAxisTitle("ieta'", 1);
00207 me_j02_[ism-1][j]->setAxisTitle("iphi'", 2);
00208 if ( me_m01_[ism-1][j] ) dqmStore_->removeElement( me_m01_[ism-1][j]->getName() );
00209 sprintf(histo, "EBTTT EmulFlagError %s %s", bits.c_str(), Numbers::sEB(ism).c_str());
00210 me_m01_[ism-1][j] = dqmStore_->book2D(histo, histo, 17, 0., 17., 4, 0., 4.);
00211 me_m01_[ism-1][j]->setAxisTitle("ieta'", 1);
00212 me_m01_[ism-1][j]->setAxisTitle("iphi'", 2);
00213 }
00214 if ( me_o01_[ism-1] ) dqmStore_->removeElement( me_o01_[ism-1]->getName() );
00215 sprintf(histo, "EBTTT Trigger Primitives Timing %s", Numbers::sEB(ism).c_str());
00216 me_o01_[ism-1] = dqmStore_->book2D(histo, histo, 17, 0., 17., 4, 0., 4.);
00217 me_o01_[ism-1]->setAxisTitle("ieta'", 1);
00218 me_o01_[ism-1]->setAxisTitle("iphi'", 2);
00219
00220 }
00221
00222 for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00223
00224 int ism = superModules_[i];
00225
00226 if ( me_h01_[ism-1] ) me_h01_[ism-1]->Reset();
00227 if ( me_h02_[ism-1] ) me_h02_[ism-1]->Reset();
00228 for (int j=0; j<2; j++) {
00229 if ( me_i01_[ism-1][j] ) me_i01_[ism-1][j]->Reset();
00230 if ( me_i02_[ism-1][j] ) me_i02_[ism-1][j]->Reset();
00231 if ( me_n01_[ism-1][j] ) me_n01_[ism-1][j]->Reset();
00232 }
00233 for (int j=0; j<6; j++) {
00234 if ( me_j01_[ism-1][j] ) me_j01_[ism-1][j]->Reset();
00235 if ( me_j02_[ism-1][j] ) me_j02_[ism-1][j]->Reset();
00236 if ( me_m01_[ism-1][j] ) me_m01_[ism-1][j]->Reset();
00237 }
00238 if ( me_o01_[ism-1] ) me_o01_[ism-1]->Reset();
00239
00240 }
00241
00242 }
00243
00244 void EBTriggerTowerClient::cleanup(void) {
00245
00246 if ( ! enableCleanup_ ) return;
00247
00248 if ( cloneME_ ) {
00249 if ( h01_ ) delete h01_;
00250 if ( h02_ ) delete h02_;
00251 }
00252
00253 h01_ = 0;
00254 h02_ = 0;
00255
00256 for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00257
00258 int ism = superModules_[i];
00259
00260 if ( cloneME_ ) {
00261 if ( i01_[ism-1] ) delete i01_[ism-1];
00262 if ( i02_[ism-1] ) delete i02_[ism-1];
00263 if ( j01_[ism-1] ) delete j01_[ism-1];
00264 if ( j02_[ism-1] ) delete j02_[ism-1];
00265 if ( l01_[ism-1] ) delete l01_[ism-1];
00266 if ( m01_[ism-1] ) delete m01_[ism-1];
00267 if ( n01_[ism-1] ) delete n01_[ism-1];
00268 if ( o01_[ism-1] ) delete o01_[ism-1];
00269 }
00270
00271 i01_[ism-1] = 0;
00272 i02_[ism-1] = 0;
00273 j01_[ism-1] = 0;
00274 j02_[ism-1] = 0;
00275
00276 l01_[ism-1] = 0;
00277 m01_[ism-1] = 0;
00278 n01_[ism-1] = 0;
00279 o01_[ism-1] = 0;
00280
00281 meh01_ = 0;
00282 meh02_ = 0;
00283
00284 mei01_[ism-1] = 0;
00285 mei02_[ism-1] = 0;
00286 mej01_[ism-1] = 0;
00287 mej02_[ism-1] = 0;
00288
00289 mel01_[ism-1] = 0;
00290 mem01_[ism-1] = 0;
00291 men01_[ism-1] = 0;
00292 meo01_[ism-1] = 0;
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309 }
00310
00311 dqmStore_->setCurrentFolder( prefixME_ + "/EBTriggerTowerClient" );
00312
00313 for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00314
00315 int ism = superModules_[i];
00316
00317 if ( me_h01_[ism-1] ) dqmStore_->removeElement( me_h01_[ism-1]->getName() );
00318 me_h01_[ism-1] = 0;
00319 if ( me_h02_[ism-1] ) dqmStore_->removeElement( me_h02_[ism-1]->getName() );
00320 me_h02_[ism-1] = 0;
00321 for (int j=0; j<2; j++) {
00322 if ( me_i01_[ism-1][j] ) dqmStore_->removeElement( me_i01_[ism-1][j]->getName() );
00323 me_i01_[ism-1][j] = 0;
00324 if ( me_i02_[ism-1][j] ) dqmStore_->removeElement( me_i02_[ism-1][j]->getName() );
00325 me_i02_[ism-1][j] = 0;
00326 if ( me_n01_[ism-1][j] ) dqmStore_->removeElement( me_n01_[ism-1][j]->getName() );
00327 me_n01_[ism-1][j] = 0;
00328 }
00329 for (int j=0; j<6; j++) {
00330 if ( me_j01_[ism-1][j] ) dqmStore_->removeElement( me_j01_[ism-1][j]->getName() );
00331 me_j01_[ism-1][j] = 0;
00332 if ( me_j02_[ism-1][j] ) dqmStore_->removeElement( me_j02_[ism-1][j]->getName() );
00333 me_j02_[ism-1][j] = 0;
00334 if ( me_m01_[ism-1][j] ) dqmStore_->removeElement( me_m01_[ism-1][j]->getName() );
00335 me_m01_[ism-1][j] = 0;
00336 }
00337 if ( me_o01_[ism-1] ) dqmStore_->removeElement( me_o01_[ism-1]->getName() );
00338 me_o01_[ism-1] = 0;
00339
00340 }
00341
00342 }
00343
00344 bool EBTriggerTowerClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status, bool flag) {
00345
00346 status = true;
00347
00348 if ( ! flag ) return false;
00349
00350 for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00351
00352 int ism = superModules_[i];
00353
00354 if ( verbose_ ) {
00355 cout << " " << Numbers::sEB(ism) << " (ism=" << ism << ")" << endl;
00356 cout << endl;
00357 UtilsClient::printBadChannels(mel01_[ism-1], UtilsClient::getHisto<TH2F*>(mel01_[ism-1]), true);
00358 for (int j=0; j<2; j++) {
00359 UtilsClient::printBadChannels(me_n01_[ism-1][j], UtilsClient::getHisto<TH2F*>(me_n01_[ism-1][j]), true);
00360 }
00361 for (int j=0; j<6; j++) {
00362 UtilsClient::printBadChannels(me_m01_[ism-1][j], UtilsClient::getHisto<TH2F*>(me_m01_[ism-1][j]), true);
00363 }
00364 }
00365
00366 }
00367
00368 return true;
00369
00370 }
00371
00372 void EBTriggerTowerClient::analyze(void) {
00373
00374 ievt_++;
00375 jevt_++;
00376 if ( ievt_ % 10 == 0 ) {
00377 if ( debug_ ) cout << "EBTriggerTowerClient: ievt/jevt = " << ievt_ << "/" << jevt_ << endl;
00378 }
00379
00380 analyze("Real Digis",
00381 "EBTriggerTowerTask", false );
00382
00383 analyze("Emulated Digis",
00384 "EBTriggerTowerTask/Emulated", true );
00385
00386 }
00387
00388 void EBTriggerTowerClient::analyze(const char* nameext,
00389 const char* folder,
00390 bool emulated) {
00391 char histo[200];
00392
00393 MonitorElement* me;
00394
00395 sprintf(histo, (prefixME_ + "/%s/EBTTT Et map %s").c_str(), folder, nameext);
00396 me = dqmStore_->get(histo);
00397 if(!emulated) {
00398 h01_ = UtilsClient::getHisto<TH2F*>( me, cloneME_, h01_ );
00399 meh01_ = me;
00400 }
00401 else {
00402 h02_ = UtilsClient::getHisto<TH2F*>( me, cloneME_, h02_ );
00403 meh02_ = me;
00404 }
00405
00406 for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00407
00408 int ism = superModules_[i];
00409
00410 sprintf(histo, (prefixME_ + "/%s/EBTTT FineGrainVeto %s %s").c_str(), folder, nameext, Numbers::sEB(ism).c_str());
00411 me = dqmStore_->get(histo);
00412 if(!emulated) {
00413 i01_[ism-1] = UtilsClient::getHisto<TH3F*>( me, cloneME_, i01_[ism-1] );
00414 mei01_[ism-1] = me;
00415 }
00416 else {
00417 i02_[ism-1] = UtilsClient::getHisto<TH3F*>( me, cloneME_, i02_[ism-1] );
00418 mei02_[ism-1] = me;
00419 }
00420
00421 sprintf(histo, (prefixME_ + "/%s/EBTTT Flags %s %s").c_str(), folder, nameext, Numbers::sEB(ism).c_str());
00422 me = dqmStore_->get(histo);
00423 if(!emulated) {
00424 j01_[ism-1] = UtilsClient::getHisto<TH3F*>( me, cloneME_, j01_[ism-1] );
00425 mej01_[ism-1] = me;
00426 }
00427 else {
00428 j02_[ism-1] = UtilsClient::getHisto<TH3F*>( me, cloneME_, j02_[ism-1] );
00429 mej02_[ism-1] = me;
00430 }
00431
00432 if(!emulated) {
00433 sprintf(histo, (prefixME_ + "/%s/EBTTT EmulError %s").c_str(), folder, Numbers::sEB(ism).c_str());
00434 me = dqmStore_->get(histo);
00435 l01_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, l01_[ism-1] );
00436 mel01_[ism-1] = me;
00437
00438 sprintf(histo, (prefixME_ + "/%s/EBTTT EmulFlagError %s").c_str(), folder, Numbers::sEB(ism).c_str());
00439 me = dqmStore_->get(histo);
00440 m01_[ism-1] = UtilsClient::getHisto<TH3F*>( me, cloneME_, m01_[ism-1] );
00441 mem01_[ism-1] = me;
00442
00443 sprintf(histo, (prefixME_ + "/%s/EBTTT EmulFineGrainVetoError %s").c_str(), folder, Numbers::sEB(ism).c_str());
00444 me = dqmStore_->get(histo);
00445 n01_[ism-1] = UtilsClient::getHisto<TH3F*>( me, cloneME_, n01_[ism-1] );
00446 men01_[ism-1] = me;
00447
00448 sprintf(histo, (prefixME_ + "/%s/EBTTT EmulMatch %s").c_str(), folder, Numbers::sEB(ism).c_str());
00449 me = dqmStore_->get(histo);
00450 o01_[ism-1] = UtilsClient::getHisto<TH3F*>( me, cloneME_, o01_[ism-1] );
00451 meo01_[ism-1] = me;
00452
00453 }
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469 if ( me_h01_[ism-1] ) me_h01_[ism-1]->Reset();
00470 if ( me_h02_[ism-1] ) me_h02_[ism-1]->Reset();
00471 for (int j=0; j<2; j++) {
00472 if ( me_i01_[ism-1][j] ) me_i01_[ism-1][j]->Reset();
00473 if ( me_i02_[ism-1][j] ) me_i02_[ism-1][j]->Reset();
00474 if ( me_n01_[ism-1][j] ) me_n01_[ism-1][j]->Reset();
00475 }
00476 for (int j=0; j<6; j++) {
00477 if ( me_j01_[ism-1][j] ) me_j01_[ism-1][j]->Reset();
00478 if ( me_j02_[ism-1][j] ) me_j02_[ism-1][j]->Reset();
00479 if ( me_m01_[ism-1][j] ) me_m01_[ism-1][j]->Reset();
00480 }
00481 if ( me_o01_[ism-1] ) me_o01_[ism-1]->Reset();
00482
00483 for (int ie = 1; ie <= 17; ie++) {
00484 for (int ip = 1; ip <= 4; ip++) {
00485
00486 for (int j=0; j<2; j++) {
00487 if ( i01_[ism-1] ) me_i01_[ism-1][j]->Fill(ie-0.5, ip-0.5, i01_[ism-1]->GetBinContent(ie, ip, j+1));
00488 if ( i02_[ism-1] ) me_i02_[ism-1][j]->Fill(ie-0.5, ip-0.5, i02_[ism-1]->GetBinContent(ie, ip, j+1));
00489 if ( n01_[ism-1] ) me_n01_[ism-1][j]->Fill(ie-0.5, ip-0.5, n01_[ism-1]->GetBinContent(ie, ip, j+1));
00490 }
00491 for (int j=0; j<6; j++) {
00492 if ( j == 0 ) {
00493 if ( j01_[ism-1] ) me_j01_[ism-1][j]->Fill(ie-0.5, ip-0.5, j01_[ism-1]->GetBinContent(ie, ip, j+1));
00494 if ( j02_[ism-1] ) me_j02_[ism-1][j]->Fill(ie-0.5, ip-0.5, j02_[ism-1]->GetBinContent(ie, ip, j+1));
00495 if ( m01_[ism-1] ) me_m01_[ism-1][j]->Fill(ie-0.5, ip-0.5, m01_[ism-1]->GetBinContent(ie, ip, j+1));
00496 }
00497 if ( j == 1 ) {
00498 if ( j01_[ism-1] ) me_j01_[ism-1][j]->Fill(ie-0.5, ip-0.5, j01_[ism-1]->GetBinContent(ie, ip, j+1));
00499 if ( j02_[ism-1] ) me_j02_[ism-1][j]->Fill(ie-0.5, ip-0.5, j02_[ism-1]->GetBinContent(ie, ip, j+1));
00500 if ( m01_[ism-1] ) me_m01_[ism-1][j]->Fill(ie-0.5, ip-0.5, m01_[ism-1]->GetBinContent(ie, ip, j+1));
00501 }
00502 if ( j == 2 ) {
00503 if ( j01_[ism-1] ) me_j01_[ism-1][j]->Fill(ie-0.5, ip-0.5, j01_[ism-1]->GetBinContent(ie, ip, j+2));
00504 if ( j02_[ism-1] ) me_j02_[ism-1][j]->Fill(ie-0.5, ip-0.5, j02_[ism-1]->GetBinContent(ie, ip, j+2));
00505 if ( m01_[ism-1] ) me_m01_[ism-1][j]->Fill(ie-0.5, ip-0.5, m01_[ism-1]->GetBinContent(ie, ip, j+2));
00506 }
00507 if ( j == 3 ) {
00508 if ( j01_[ism-1] ) me_j01_[ism-1][j]->Fill(ie-0.5, ip-0.5, j01_[ism-1]->GetBinContent(ie, ip, j+2));
00509 if ( j02_[ism-1] ) me_j02_[ism-1][j]->Fill(ie-0.5, ip-0.5, j02_[ism-1]->GetBinContent(ie, ip, j+2));
00510 if ( m01_[ism-1] ) me_m01_[ism-1][j]->Fill(ie-0.5, ip-0.5, m01_[ism-1]->GetBinContent(ie, ip, j+2));
00511 }
00512 if ( j == 4 ) {
00513 if ( j01_[ism-1] ) me_j01_[ism-1][j]->Fill(ie-0.5, ip-0.5, j01_[ism-1]->GetBinContent(ie, ip, j+2));
00514 if ( j02_[ism-1] ) me_j02_[ism-1][j]->Fill(ie-0.5, ip-0.5, j02_[ism-1]->GetBinContent(ie, ip, j+2));
00515 if ( m01_[ism-1] ) me_m01_[ism-1][j]->Fill(ie-0.5, ip-0.5, m01_[ism-1]->GetBinContent(ie, ip, j+2));
00516 }
00517 if ( j == 5 ) {
00518 if ( j01_[ism-1] ) {
00519 me_j01_[ism-1][j]->Fill(ie-0.5, ip-0.5, j01_[ism-1]->GetBinContent(ie, ip, j+2));
00520 me_j01_[ism-1][j]->Fill(ie-0.5, ip-0.5, j01_[ism-1]->GetBinContent(ie, ip, j+3));
00521 }
00522 if ( j02_[ism-1] ) {
00523 me_j02_[ism-1][j]->Fill(ie-0.5, ip-0.5, j02_[ism-1]->GetBinContent(ie, ip, j+2));
00524 me_j02_[ism-1][j]->Fill(ie-0.5, ip-0.5, j02_[ism-1]->GetBinContent(ie, ip, j+3));
00525 }
00526 if ( m01_[ism-1] ) {
00527 me_m01_[ism-1][j]->Fill(ie-0.5, ip-0.5, m01_[ism-1]->GetBinContent(ie, ip, j+2));
00528 me_m01_[ism-1][j]->Fill(ie-0.5, ip-0.5, m01_[ism-1]->GetBinContent(ie, ip, j+3));
00529 }
00530 }
00531 }
00532 if ( o01_[ism-1] ) {
00533 float index=-1;
00534 double max=0;
00535 for (int j=0; j<6; j++) {
00536 double sampleEntries = o01_[ism-1]->GetBinContent(ie, ip, j+1);
00537 if(sampleEntries > max) {
00538 index=j;
00539 max = sampleEntries;
00540 }
00541 }
00542 if ( max > 0 ) {
00543 if ( index == 0 ) me_o01_[ism-1]->setBinContent(ie, ip, -1);
00544 else me_o01_[ism-1]->setBinContent(ie, ip, index );
00545 }
00546 }
00547
00548 }
00549 }
00550
00551 }
00552
00553 for (int xttindex = 0; xttindex<68*36; xttindex++) {
00554
00555 int ttindex = xttindex%68;
00556
00557 int ie = (ttindex-1)/4 + 1;
00558 int ip = (ttindex-1)%4 + 1;
00559
00560 int ism = xttindex/68 + 1;
00561
00562 vector<int>::const_iterator iter = find(superModules_.begin(), superModules_.end(), ism);
00563 if ( iter == superModules_.end() ) continue;
00564
00565 for (int j = 0; j <= 256; j++) {
00566 if ( h01_ ) me_h01_[ism-1]->Fill(ie-0.5, ip-0.5, j-0.5, h01_->GetBinContent(xttindex, j+1));
00567 if ( h02_ ) me_h02_[ism-1]->Fill(ie-0.5, ip-0.5, j-0.5, h02_->GetBinContent(xttindex, j+1));
00568 }
00569
00570 }
00571
00572 }
00573
00574 void EBTriggerTowerClient::softReset(bool flag) {
00575
00576 }
00577
00578 void EBTriggerTowerClient::htmlOutput(int run, string& htmlDir, string& htmlName) {
00579
00580 if ( verbose_ ) cout << "Preparing EBTriggerTowerClient html output ..." << std::endl;
00581
00582 std::ofstream htmlFile[37];
00583
00584 htmlFile[0].open((htmlDir + htmlName).c_str());
00585
00586
00587 htmlFile[0] << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> " << std::endl;
00588 htmlFile[0] << "<html> " << std::endl;
00589 htmlFile[0] << "<head> " << std::endl;
00590 htmlFile[0] << " <meta content=\"text/html; charset=ISO-8859-1\" " << std::endl;
00591 htmlFile[0] << " https-equiv=\"content-type\"> " << std::endl;
00592 htmlFile[0] << " <title>Monitor:TriggerTowerTask output</title> " << std::endl;
00593 htmlFile[0] << "</head> " << std::endl;
00594 htmlFile[0] << "<style type=\"text/css\"> td { font-weight: bold } </style>" << std::endl;
00595 htmlFile[0] << "<body> " << std::endl;
00596
00597 htmlFile[0] << "<a name=""top""></a>" << endl;
00598 htmlFile[0] << "<h2>Run: " << std::endl;
00599 htmlFile[0] << " <span " << std::endl;
00600 htmlFile[0] << " style=\"color: rgb(0, 0, 153);\">" << run << "</span></h2>" << std::endl;
00601 htmlFile[0] << "<h2>Monitoring task: <span " << std::endl;
00602 htmlFile[0] << " style=\"color: rgb(0, 0, 153);\">TRIGGER TOWER</span></h2> " << std::endl;
00603 htmlFile[0] << "<br>" << std::endl;
00604
00605
00606
00607 htmlFile[0] << "<hr>" << std::endl;
00608 htmlFile[0] << "<table border=1>" << std::endl;
00609 for ( unsigned int i=0; i<superModules_.size(); i ++ ) {
00610 htmlFile[0] << "<td bgcolor=white><a href=""#"
00611 << Numbers::sEB(superModules_[i]) << ">"
00612 << setfill( '0' ) << setw(2) << superModules_[i] << "</a></td>";
00613 }
00614 htmlFile[0] << std::endl << "</table>" << std::endl;
00615
00616
00617
00618 const int csize = 250;
00619
00620
00621
00622 int pCol4[10];
00623 for ( int i = 0; i < 10; i++ ) pCol4[i] = 401+i;
00624 int pCol5[10];
00625 for ( int i = 0; i < 10; i++ ) pCol5[i] = 501+i;
00626
00627 TH2C dummy( "dummy", "dummy for sm", 17, 0., 17., 4, 0., 4. );
00628 for ( int i = 0; i < 68; i++ ) {
00629 dummy.Fill( i/4, i%4, i+1 );
00630 }
00631 dummy.SetMarkerSize(2);
00632 dummy.SetMinimum(0.1);
00633
00634 string imgMeName[3], imgName, meName;
00635
00636 TCanvas* cMe1 = new TCanvas("cMe1", "Temp", 3*csize, csize);
00637
00638
00639 TCanvas* cMe2 = new TCanvas("cMe2", "Temp", int(1.8*csize), int(0.9*csize));
00640 TCanvas* cMe3 = new TCanvas("cMe3", "Temp", int(0.9*csize), int(0.9*csize));
00641
00642 TH2F* obj2f;
00643 TProfile2D* obj2p;
00644
00645
00646
00647 for ( unsigned int i=0; i<superModules_.size(); i ++ ) {
00648
00649 int ism = superModules_[i];
00650
00651 if ( i>0 ) htmlFile[0] << "<a href=""#top"">Top</a>" << std::endl;
00652 htmlFile[0] << "<hr>" << std::endl;
00653 htmlFile[0] << "<h3><a name="""
00654 << Numbers::sEB(ism) << """></a><strong>"
00655 << Numbers::sEB(ism) << "</strong></h3>" << endl;
00656
00657
00658
00659
00660 htmlFile[0] << "<h3><strong>Emulator Error</strong></h3>" << std::endl;
00661 htmlFile[0] << "<table border=\"0\" cellspacing=\"0\" " << std::endl;
00662 htmlFile[0] << "cellpadding=\"10\" align=\"center\"> " << std::endl;
00663 htmlFile[0] << "<tr align=\"center\">" << std::endl;
00664
00665
00666 imgMeName[0] = "";
00667
00668 obj2f = l01_[ism-1];
00669
00670 if ( obj2f ) {
00671
00672 meName = obj2f->GetName();
00673
00674 replace(meName.begin(), meName.end(), ' ', '_');
00675 imgMeName[0] = meName + ".png";
00676 imgName = htmlDir + imgMeName[0];
00677
00678 cMe2->cd();
00679 gStyle->SetOptStat(" ");
00680 gStyle->SetPalette(10, pCol5);
00681 cMe2->SetGridx();
00682 cMe2->SetGridy();
00683 obj2f->GetXaxis()->SetNdivisions(17);
00684 obj2f->GetYaxis()->SetNdivisions(4);
00685 obj2f->SetMinimum(0);
00686 obj2f->Draw("colz");
00687 dummy.Draw("text,same");
00688 cMe2->Update();
00689 cMe2->SaveAs(imgName.c_str());
00690 }
00691
00692 htmlFile[0] << "<img src=\"" << imgMeName[0] << "\"><br>" << std::endl;
00693 htmlFile[0] << "</tr>" << std::endl;
00694 htmlFile[0] << "<br><br>" << std::endl;
00695
00696
00697
00698 for(int iemu=0; iemu<2; iemu++) {
00699
00700 imgMeName[iemu] = "";
00701
00702 obj2p = 0;
00703 switch ( iemu ) {
00704 case 0:
00705 obj2p = UtilsClient::getHisto<TProfile2D*>( me_h01_[ism-1] );
00706 break;
00707 case 1:
00708 obj2p = UtilsClient::getHisto<TProfile2D*>( me_h02_[ism-1] );
00709 break;
00710 default:
00711 break;
00712 }
00713
00714 if ( obj2p ) {
00715
00716 meName = obj2p->GetName();
00717
00718 replace(meName.begin(), meName.end(), ' ', '_');
00719 imgMeName[iemu] = meName + ".png";
00720 imgName = htmlDir + imgMeName[iemu];
00721
00722 cMe1->cd();
00723 gStyle->SetOptStat(" ");
00724 gStyle->SetPalette(10, pCol4);
00725 cMe1->SetGridx();
00726 cMe1->SetGridy();
00727 obj2p->GetXaxis()->SetNdivisions(17);
00728 obj2p->GetYaxis()->SetNdivisions(4);
00729 obj2p->Draw("colz");
00730 dummy.Draw("text,same");
00731 cMe1->Update();
00732 cMe1->SaveAs(imgName.c_str());
00733 }
00734 }
00735
00736 htmlFile[0] << "<td><img src=\"" << imgMeName[0] << "\"></td>" << std::endl;
00737 htmlFile[0] << "<td><img src=\"" << imgMeName[1] << "\"></td>" << std::endl;
00738 htmlFile[0] << "</table>" << std::endl;
00739 htmlFile[0] << "<br>" << std::endl;
00740
00741 std::stringstream subpage;
00742 subpage << htmlName.substr( 0, htmlName.find( ".html" ) ) << "_" << Numbers::sEB(ism) << ".html";
00743 htmlFile[0] << "<a href=\"" << subpage.str() << "\">" << Numbers::sEB(ism) << " details</a><br>" << std::endl;
00744 htmlFile[0] << "<hr>" << std::endl;
00745
00746 htmlFile[ism].open((htmlDir + subpage.str()).c_str());
00747
00748
00749 htmlFile[ism] << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> " << std::endl;
00750 htmlFile[ism] << "<html> " << std::endl;
00751 htmlFile[ism] << "<head> " << std::endl;
00752 htmlFile[ism] << " <meta content=\"text/html; charset=ISO-8859-1\" " << std::endl;
00753 htmlFile[ism] << " https-equiv=\"content-type\"> " << std::endl;
00754 htmlFile[ism] << " <title>Monitor:TriggerTowerTask output " << Numbers::sEB(ism) << "</title> " << std::endl;
00755 htmlFile[ism] << "</head> " << std::endl;
00756 htmlFile[ism] << "<style type=\"text/css\"> td { font-weight: bold } </style>" << std::endl;
00757 htmlFile[ism] << "<body> " << std::endl;
00758 htmlFile[ism] << "<br> " << std::endl;
00759 htmlFile[ism] << "<h3>Run: " << std::endl;
00760 htmlFile[ism] << " <span " << std::endl;
00761 htmlFile[ism] << " style=\"color: rgb(0, 0, 153);\">" << run << "</span></h3>" << std::endl;
00762 htmlFile[ism] << "<h3>Monitoring task: <span " << std::endl;
00763 htmlFile[ism] << " style=\"color: rgb(0, 0, 153);\">TRIGGER TOWER</span></h3> " << std::endl;
00764 htmlFile[ism] << "<h3>SM: " << std::endl;
00765 htmlFile[ism] << " <span " << std::endl;
00766 htmlFile[ism] << " style=\"color: rgb(0, 0, 153);\">" << Numbers::sEB(ism) << "</span></h3>" << std::endl;
00767 htmlFile[ism] << "<hr>" << std::endl;
00768
00769
00770
00771 htmlFile[ism] << "<h3><strong>Trigger Tower Flags</strong></h3>" << std::endl;
00772 htmlFile[ism] << "<table border=\"0\" cellspacing=\"0\" " << std::endl;
00773 htmlFile[ism] << "cellpadding=\"10\" align=\"center\"> " << std::endl;
00774 htmlFile[ism] << "<tr align=\"center\">" << std::endl;
00775
00776 int counter = 0;
00777
00778 for (int j=0; j<6; j++) {
00779
00780 for(int iemu=0; iemu<3; iemu++) {
00781
00782 imgMeName[iemu] = "";
00783
00784 obj2f = 0;
00785 switch ( iemu ) {
00786 case 0:
00787 obj2f = UtilsClient::getHisto<TH2F*>( me_m01_[ism-1][j] );
00788 break;
00789 case 1:
00790 obj2f = UtilsClient::getHisto<TH2F*>( me_j01_[ism-1][j] );
00791 break;
00792 case 2:
00793 obj2f = UtilsClient::getHisto<TH2F*>( me_j02_[ism-1][j] );
00794 break;
00795 default:
00796 break;
00797 }
00798
00799 if ( obj2f ) {
00800
00801 meName = obj2f->GetName();
00802
00803 replace(meName.begin(), meName.end(), ' ', '_');
00804 imgMeName[iemu] = meName + ".png";
00805 imgName = htmlDir + imgMeName[iemu];
00806
00807 counter++;
00808
00809 cMe2->cd();
00810 gStyle->SetOptStat(" ");
00811 if (iemu == 0 ) gStyle->SetPalette(10, pCol5);
00812 if (iemu == 1 || iemu == 2) gStyle->SetPalette(10, pCol4);
00813 cMe2->SetGridx();
00814 cMe2->SetGridy();
00815 obj2f->GetXaxis()->SetNdivisions(17);
00816 obj2f->GetYaxis()->SetNdivisions(4);
00817 obj2f->SetMinimum(0);
00818 obj2f->Draw("colz");
00819 dummy.Draw("text,same");
00820 cMe2->Update();
00821 cMe2->SaveAs(imgName.c_str());
00822
00823 htmlFile[ism] << "<td><img src=\"" << imgMeName[iemu] << "\"></td>" << std::endl;
00824 if ( counter%3 == 0 ) htmlFile[ism] << "</tr><tr>" << std::endl;
00825
00826 }
00827 }
00828 }
00829
00830 htmlFile[ism] << "</tr>" << std::endl << "</table>" << std::endl;
00831
00832
00833
00834
00835
00836 htmlFile[ism] << "<h3><strong>Fine Grain Veto</strong></h3>" << std::endl;
00837 htmlFile[ism] << "<table border=\"0\" cellspacing=\"0\" " << std::endl;
00838 htmlFile[ism] << "cellpadding=\"10\" align=\"center\"> " << std::endl;
00839 htmlFile[ism] << "<tr align=\"center\">" << std::endl;
00840
00841
00842 for (int j=0; j<2; j++) {
00843
00844 for(int iemu=0; iemu<3; iemu++) {
00845
00846 imgMeName[iemu] = "";
00847
00848 obj2f = 0;
00849 switch ( iemu ) {
00850 case 0:
00851 obj2f = UtilsClient::getHisto<TH2F*>( me_n01_[ism-1][j] );
00852 break;
00853 case 1:
00854 obj2f = UtilsClient::getHisto<TH2F*>( me_i01_[ism-1][j] );
00855 break;
00856 case 2:
00857 obj2f = UtilsClient::getHisto<TH2F*>( me_i02_[ism-1][j] );
00858 break;
00859 default:
00860 break;
00861 }
00862
00863 if ( obj2f ) {
00864
00865 meName = obj2f->GetName();
00866
00867 replace(meName.begin(), meName.end(), ' ', '_');
00868 imgMeName[iemu] = meName + ".png";
00869 imgName = htmlDir + imgMeName[iemu];
00870
00871 cMe2->cd();
00872 gStyle->SetOptStat(" ");
00873 if (iemu == 0 ) gStyle->SetPalette(10, pCol5);
00874 if (iemu == 1 || iemu == 2) gStyle->SetPalette(10, pCol4);
00875 cMe2->SetGridx();
00876 cMe2->SetGridy();
00877 obj2f->GetXaxis()->SetNdivisions(17);
00878 obj2f->GetYaxis()->SetNdivisions(4);
00879 obj2f->SetMinimum(0);
00880 obj2f->Draw("colz");
00881 dummy.Draw("text,same");
00882 cMe2->Update();
00883 cMe2->SaveAs(imgName.c_str());
00884
00885 htmlFile[ism] << "<td><img src=\"" << imgMeName[iemu] << "\"></td>" << std::endl;
00886 }
00887 }
00888 htmlFile[ism] << "</tr><tr>" << std::endl;
00889 }
00890
00891 htmlFile[ism] << "</tr>" << std::endl << "</table>" << std::endl;
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948 htmlFile[ism] << "</tr>" << std::endl << "</table>" << std::endl;
00949
00950
00951 htmlFile[ism] << "</body> " << std::endl;
00952 htmlFile[ism] << "</html> " << std::endl;
00953 htmlFile[ism].close();
00954 }
00955
00956 delete cMe1;
00957 delete cMe2;
00958 delete cMe3;
00959
00960
00961 htmlFile[0] << "</body> " << std::endl;
00962 htmlFile[0] << "</html> " << std::endl;
00963 htmlFile[0].close();
00964
00965 }
00966