CMS 3D CMS Logo

EECosmicClient Class Reference

#include <DQM/EcalEndcapMonitorClient/interface/EECosmicClient.h>

Inheritance diagram for EECosmicClient:

EEClient

List of all members.

Public Member Functions

void analyze (void)
 Analyze.
void beginJob (DQMStore *dqmStore)
 BeginJob.
void beginRun (void)
 BeginRun.
void cleanup (void)
 Cleanup.
 EECosmicClient (const edm::ParameterSet &ps)
 Constructor.
void endJob (void)
 EndJob.
void endRun (void)
 EndRun.
int getEvtPerJob ()
 Get Functions.
int getEvtPerRun ()
 Returns the number of processed events in this Run.
void htmlOutput (int run, std::string &htmlDir, std::string &htmlName)
 HtmlOutput.
void setup (void)
 Setup.
void softReset (bool flag)
 SoftReset.
bool writeDb (EcalCondDBInterface *econn, RunIOV *runiov, MonRunIOV *moniov, bool &status, bool flag)
 WriteDB.
virtual ~EECosmicClient ()
 Destructor.

Private Attributes

bool cloneME_
bool debug_
DQMStoredqmStore_
bool enableCleanup_
TProfile2D * h01_ [18]
TProfile2D * h02_ [18]
TH1F * h03_ [18]
TH1F * h04_ [18]
int ievt_
int jevt_
MonitorElementmeh01_ [18]
MonitorElementmeh02_ [18]
MonitorElementmeh03_ [18]
MonitorElementmeh04_ [18]
std::string prefixME_
std::vector< intsuperModules_
bool verbose_

Friends

class EESummaryClient


Detailed Description

Definition at line 31 of file EECosmicClient.h.


Constructor & Destructor Documentation

EECosmicClient::EECosmicClient ( const edm::ParameterSet ps  ) 

Constructor.

Definition at line 37 of file EECosmicClient.cc.

References cloneME_, debug_, enableCleanup_, edm::ParameterSet::getUntrackedParameter(), h01_, h02_, h03_, h04_, i, meh01_, meh02_, meh03_, meh04_, prefixME_, superModules_, and verbose_.

00037                                                      {
00038 
00039   // cloneME switch
00040   cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00041 
00042   // verbose switch
00043   verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
00044 
00045   // debug switch
00046   debug_ = ps.getUntrackedParameter<bool>("debug", false);
00047 
00048   // prefixME path
00049   prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
00050 
00051   // enableCleanup_ switch
00052   enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00053 
00054   // vector of selected Super Modules (Defaults to all 18).
00055   superModules_.reserve(18);
00056   for ( unsigned int i = 1; i <= 18; i++ ) superModules_.push_back(i);
00057   superModules_ = ps.getUntrackedParameter<vector<int> >("superModules", superModules_);
00058 
00059   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00060 
00061     int ism = superModules_[i];
00062 
00063     h01_[ism-1] = 0;
00064     h02_[ism-1] = 0;
00065     h03_[ism-1] = 0;
00066     h04_[ism-1] = 0;
00067 
00068     meh01_[ism-1] = 0;
00069     meh02_[ism-1] = 0;
00070     meh03_[ism-1] = 0;
00071     meh04_[ism-1] = 0;
00072 
00073   }
00074 
00075 }

EECosmicClient::~EECosmicClient (  )  [virtual]

Destructor.

Definition at line 77 of file EECosmicClient.cc.

00077                                 {
00078 
00079 }


Member Function Documentation

void EECosmicClient::analyze ( void   )  [virtual]

Analyze.

Implements EEClient.

Definition at line 260 of file EECosmicClient.cc.

References cloneME_, GenMuonPlsPt100GeV_cfg::cout, debug_, dqmStore_, lat::endl(), DQMStore::get(), h01_, h02_, h03_, h04_, histo, i, ievt_, jevt_, me, meh01_, meh02_, meh03_, meh04_, prefixME_, Numbers::sEE(), and superModules_.

00260                                  {
00261 
00262   ievt_++;
00263   jevt_++;
00264   if ( ievt_ % 10 == 0 ) {
00265     if ( debug_ ) cout << "EECosmicClient: ievt/jevt = " << ievt_ << "/" << jevt_ << endl;
00266   }
00267 
00268   char histo[200];
00269 
00270   MonitorElement* me;
00271 
00272   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00273 
00274     int ism = superModules_[i];
00275 
00276     sprintf(histo, (prefixME_ + "/EECosmicTask/Cut/EECT energy cut %s").c_str(), Numbers::sEE(ism).c_str());
00277     me = dqmStore_->get(histo);
00278     h01_[ism-1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h01_[ism-1] );
00279     meh01_[ism-1] = me;
00280 
00281     sprintf(histo, (prefixME_ + "/EECosmicTask/Sel/EECT energy sel %s").c_str(), Numbers::sEE(ism).c_str());
00282     me = dqmStore_->get(histo);
00283     h02_[ism-1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h02_[ism-1] );
00284     meh02_[ism-1] = me;
00285 
00286     sprintf(histo, (prefixME_ + "/EECosmicTask/Spectrum/EECT 1x1 energy spectrum %s").c_str(), Numbers::sEE(ism).c_str());
00287     me = dqmStore_->get(histo);
00288     h03_[ism-1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h03_[ism-1] );
00289     meh03_[ism-1] = me;
00290 
00291     sprintf(histo, (prefixME_ + "/EECosmicTask/Spectrum/EECT 3x3 energy spectrum %s").c_str(), Numbers::sEE(ism).c_str());
00292     me = dqmStore_->get(histo);
00293     h04_[ism-1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h04_[ism-1] );
00294     meh04_[ism-1] = me;
00295 
00296   }
00297 
00298 }

void EECosmicClient::beginJob ( DQMStore dqmStore  )  [virtual]

BeginJob.

Implements EEClient.

Definition at line 81 of file EECosmicClient.cc.

References GenMuonPlsPt100GeV_cfg::cout, debug_, dqmStore_, lat::endl(), ievt_, and jevt_.

00081                                                 {
00082 
00083   dqmStore_ = dqmStore;
00084 
00085   if ( debug_ ) cout << "EECosmicClient: beginJob" << endl;
00086 
00087   ievt_ = 0;
00088   jevt_ = 0;
00089 
00090 }

void EECosmicClient::beginRun ( void   )  [virtual]

BeginRun.

Implements EEClient.

Definition at line 92 of file EECosmicClient.cc.

References GenMuonPlsPt100GeV_cfg::cout, debug_, lat::endl(), jevt_, and setup().

00092                                   {
00093 
00094   if ( debug_ ) cout << "EECosmicClient: beginRun" << endl;
00095 
00096   jevt_ = 0;
00097 
00098   this->setup();
00099 
00100 }

void EECosmicClient::cleanup ( void   )  [virtual]

Cleanup.

Implements EEClient.

Definition at line 122 of file EECosmicClient.cc.

References cloneME_, enableCleanup_, h01_, h02_, h03_, h04_, i, meh01_, meh02_, meh03_, meh04_, and superModules_.

Referenced by endJob(), and endRun().

00122                                  {
00123 
00124   if ( ! enableCleanup_ ) return;
00125 
00126   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00127 
00128     int ism = superModules_[i];
00129 
00130     if ( cloneME_ ) {
00131       if ( h01_[ism-1] ) delete h01_[ism-1];
00132       if ( h02_[ism-1] ) delete h02_[ism-1];
00133       if ( h03_[ism-1] ) delete h03_[ism-1];
00134       if ( h04_[ism-1] ) delete h04_[ism-1];
00135     }
00136 
00137     h01_[ism-1] = 0;
00138     h02_[ism-1] = 0;
00139     h03_[ism-1] = 0;
00140     h04_[ism-1] = 0;
00141 
00142     meh01_[ism-1] = 0;
00143     meh02_[ism-1] = 0;
00144     meh03_[ism-1] = 0;
00145     meh04_[ism-1] = 0;
00146 
00147   }
00148 
00149 }

void EECosmicClient::endJob ( void   )  [virtual]

EndJob.

Implements EEClient.

Definition at line 102 of file EECosmicClient.cc.

References cleanup(), GenMuonPlsPt100GeV_cfg::cout, debug_, lat::endl(), and ievt_.

00102                                 {
00103 
00104   if ( debug_ ) cout << "EECosmicClient: endJob, ievt = " << ievt_ << endl;
00105 
00106   this->cleanup();
00107 
00108 }

void EECosmicClient::endRun ( void   )  [virtual]

EndRun.

Implements EEClient.

Definition at line 110 of file EECosmicClient.cc.

References cleanup(), GenMuonPlsPt100GeV_cfg::cout, debug_, lat::endl(), and jevt_.

00110                                 {
00111 
00112   if ( debug_ ) cout << "EECosmicClient: endRun, jevt = " << jevt_ << endl;
00113 
00114   this->cleanup();
00115 
00116 }

int EECosmicClient::getEvtPerJob ( void   )  [inline, virtual]

Get Functions.

Implements EEClient.

Definition at line 74 of file EECosmicClient.h.

References ievt_.

00074 { return ievt_; }

int EECosmicClient::getEvtPerRun ( void   )  [inline, virtual]

Returns the number of processed events in this Run.

Implements EEClient.

Definition at line 75 of file EECosmicClient.h.

References jevt_.

00075 { return jevt_; }

void EECosmicClient::htmlOutput ( int  run,
std::string &  htmlDir,
std::string &  htmlName 
) [virtual]

HtmlOutput.

Implements EEClient.

void EECosmicClient::setup ( void   )  [virtual]

Setup.

Implements EEClient.

Definition at line 118 of file EECosmicClient.cc.

Referenced by beginRun().

00118                                {
00119 
00120 }

void EECosmicClient::softReset ( bool  flag  )  [virtual]

SoftReset.

Implements EEClient.

Definition at line 300 of file EECosmicClient.cc.

00300                                         {
00301 
00302 }

bool EECosmicClient::writeDb ( EcalCondDBInterface econn,
RunIOV runiov,
MonRunIOV moniov,
bool status,
bool  flag 
) [virtual]

WriteDB.

Implements EEClient.

Definition at line 151 of file EECosmicClient.cc.

References TestMuL1L2Filter_cff::cerr, GenMuonPlsPt100GeV_cfg::cout, ttbarGen_cfg::dataset, e, EcalEndcap, lat::endl(), LogicID::getEcalLogicID(), h01_, h02_, i, Numbers::icEE(), Numbers::indexEE(), EcalCondDBInterface::insertDataArraySet(), Numbers::iSM(), Numbers::ix0EE(), Numbers::iy0EE(), Numbers::sEE(), MonOccupancyDat::setAvgEnergy(), MonOccupancyDat::setEventsOverHighThreshold(), MonOccupancyDat::setEventsOverLowThreshold(), superModules_, Numbers::validEE(), and verbose_.

00151                                                                                                                    {
00152 
00153   status = true;
00154 
00155   if ( ! flag ) return false;
00156 
00157   EcalLogicID ecid;
00158 
00159   MonOccupancyDat o;
00160   map<EcalLogicID, MonOccupancyDat> dataset;
00161 
00162   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00163 
00164     int ism = superModules_[i];
00165 
00166     if ( verbose_ ) {
00167       cout << " " << Numbers::sEE(ism) << " (ism=" << ism << ")" << endl;
00168       cout << endl;
00169     }
00170 
00171     const float n_min_tot = 1000.;
00172     const float n_min_bin = 10.;
00173 
00174     float num01, num02;
00175     float mean01, mean02;
00176     float rms01, rms02;
00177 
00178     for ( int ix = 1; ix <= 50; ix++ ) {
00179       for ( int iy = 1; iy <= 50; iy++ ) {
00180 
00181         int jx = ix + Numbers::ix0EE(ism);
00182         int jy = iy + Numbers::iy0EE(ism);
00183 
00184         if ( ism >= 1 && ism <= 9 ) jx = 101 - jx;
00185 
00186         if ( ! Numbers::validEE(ism, jx, jy) ) continue;
00187 
00188         num01  = num02  = -1.;
00189         mean01 = mean02 = -1.;
00190         rms01  = rms02  = -1.;
00191 
00192         bool update_channel = false;
00193 
00194         if ( h01_[ism-1] && h01_[ism-1]->GetEntries() >= n_min_tot ) {
00195           num01 = h01_[ism-1]->GetBinEntries(h01_[ism-1]->GetBin(ix, iy));
00196           if ( num01 >= n_min_bin ) {
00197             mean01 = h01_[ism-1]->GetBinContent(ix, iy);
00198             rms01  = h01_[ism-1]->GetBinError(ix, iy);
00199             update_channel = true;
00200           }
00201         }
00202 
00203         if ( h02_[ism-1] && h02_[ism-1]->GetEntries() >= n_min_tot ) {
00204           num02 = h02_[ism-1]->GetBinEntries(h02_[ism-1]->GetBin(ix, iy));
00205           if ( num02 >= n_min_bin ) {
00206             mean02 = h02_[ism-1]->GetBinContent(ix, iy);
00207             rms02  = h02_[ism-1]->GetBinError(ix, iy);
00208             update_channel = true;
00209           }
00210         }
00211 
00212         if ( update_channel ) {
00213 
00214           if ( Numbers::icEE(ism, jx, jy) == 1 ) {
00215 
00216             if ( verbose_ ) {
00217               cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << endl;
00218               cout << "Cut (" << Numbers::ix0EE(i+1)+ix << "," << Numbers::iy0EE(i+1)+iy << ") " << num01  << " " << mean01 << " " << rms01  << endl;
00219               cout << "Sel (" << Numbers::ix0EE(i+1)+ix << "," << Numbers::iy0EE(i+1)+iy << ") " << num02  << " " << mean02 << " " << rms02  << endl;
00220               cout << endl;
00221             }
00222 
00223           }
00224 
00225           o.setEventsOverLowThreshold(int(num01));
00226           o.setEventsOverHighThreshold(int(num02));
00227 
00228           o.setAvgEnergy(mean01);
00229 
00230           int ic = Numbers::indexEE(ism, jx, jy);
00231 
00232           if ( ic == -1 ) continue;
00233 
00234           if ( econn ) {
00235             ecid = LogicID::getEcalLogicID("EE_crystal_number", Numbers::iSM(ism, EcalEndcap), ic);
00236             dataset[ecid] = o;
00237           }
00238 
00239         }
00240 
00241       }
00242     }
00243 
00244   }
00245 
00246   if ( econn ) {
00247     try {
00248       if ( verbose_ ) cout << "Inserting MonOccupancyDat ..." << endl;
00249       if ( dataset.size() != 0 ) econn->insertDataArraySet(&dataset, moniov);
00250       if ( verbose_ ) cout << "done." << endl;
00251     } catch (runtime_error &e) {
00252       cerr << e.what() << endl;
00253     }
00254   }
00255 
00256   return true;
00257 
00258 }


Friends And Related Function Documentation

friend class EESummaryClient [friend]

Definition at line 33 of file EECosmicClient.h.


Member Data Documentation

bool EECosmicClient::cloneME_ [private]

Definition at line 82 of file EECosmicClient.h.

Referenced by analyze(), cleanup(), and EECosmicClient().

bool EECosmicClient::debug_ [private]

Definition at line 85 of file EECosmicClient.h.

Referenced by analyze(), beginJob(), beginRun(), EECosmicClient(), endJob(), and endRun().

DQMStore* EECosmicClient::dqmStore_ [private]

Definition at line 93 of file EECosmicClient.h.

Referenced by analyze(), and beginJob().

bool EECosmicClient::enableCleanup_ [private]

Definition at line 89 of file EECosmicClient.h.

Referenced by cleanup(), and EECosmicClient().

TProfile2D* EECosmicClient::h01_[18] [private]

Definition at line 100 of file EECosmicClient.h.

Referenced by analyze(), cleanup(), EECosmicClient(), and writeDb().

TProfile2D* EECosmicClient::h02_[18] [private]

Definition at line 101 of file EECosmicClient.h.

Referenced by EESummaryClient::analyze(), analyze(), cleanup(), EECosmicClient(), and writeDb().

TH1F* EECosmicClient::h03_[18] [private]

Definition at line 102 of file EECosmicClient.h.

Referenced by analyze(), cleanup(), and EECosmicClient().

TH1F* EECosmicClient::h04_[18] [private]

Definition at line 103 of file EECosmicClient.h.

Referenced by analyze(), cleanup(), and EECosmicClient().

int EECosmicClient::ievt_ [private]

Definition at line 79 of file EECosmicClient.h.

Referenced by analyze(), beginJob(), endJob(), and getEvtPerJob().

int EECosmicClient::jevt_ [private]

Definition at line 80 of file EECosmicClient.h.

Referenced by analyze(), beginJob(), beginRun(), endRun(), and getEvtPerRun().

MonitorElement* EECosmicClient::meh01_[18] [private]

Definition at line 95 of file EECosmicClient.h.

Referenced by analyze(), cleanup(), and EECosmicClient().

MonitorElement* EECosmicClient::meh02_[18] [private]

Definition at line 96 of file EECosmicClient.h.

Referenced by analyze(), cleanup(), and EECosmicClient().

MonitorElement* EECosmicClient::meh03_[18] [private]

Definition at line 97 of file EECosmicClient.h.

Referenced by analyze(), cleanup(), and EECosmicClient().

MonitorElement* EECosmicClient::meh04_[18] [private]

Definition at line 98 of file EECosmicClient.h.

Referenced by analyze(), cleanup(), and EECosmicClient().

std::string EECosmicClient::prefixME_ [private]

Definition at line 87 of file EECosmicClient.h.

Referenced by analyze(), and EECosmicClient().

std::vector<int> EECosmicClient::superModules_ [private]

Definition at line 91 of file EECosmicClient.h.

Referenced by analyze(), cleanup(), EECosmicClient(), and writeDb().

bool EECosmicClient::verbose_ [private]

Definition at line 84 of file EECosmicClient.h.

Referenced by EECosmicClient(), and writeDb().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:20:05 2009 for CMSSW by  doxygen 1.5.4