CMS 3D CMS Logo

Public Member Functions | Private Attributes | Friends

ESPedestalClient Class Reference

#include <ESPedestalClient.h>

Inheritance diagram for ESPedestalClient:
ESClient

List of all members.

Public Member Functions

void analyze (void)
void beginJob (DQMStore *dqmStore)
void beginRun (void)
void cleanup (void)
void endJob (void)
void endLumiAnalyze (void)
void endRun (void)
 ESPedestalClient (const edm::ParameterSet &ps)
int getEvtPerJob ()
 Get Functions.
int getEvtPerRun ()
void setup (void)
virtual ~ESPedestalClient ()

Private Attributes

bool debug_
DQMStoredqmStore_
bool enableCleanup_
TF1 * fg
bool fitPedestal_
MonitorElementhPed_ [2][2][40][40]
MonitorElementhTotN_ [2][2][40][40]
int ievt_
int jevt_
edm::FileInPath lookup_
int nLines_
std::string prefixME_
int senP_ [4288]
int senX_ [4288]
int senY_ [4288]
int senZ_ [4288]
bool verbose_

Friends

class ESSummaryClient

Detailed Description

Definition at line 20 of file ESPedestalClient.h.


Constructor & Destructor Documentation

ESPedestalClient::ESPedestalClient ( const edm::ParameterSet ps)

Definition at line 17 of file ESPedestalClient.cc.

References edm::ParameterSet::getUntrackedParameter(), i, j, gen::k, and m.

                                                            {
  
  verbose_       = ps.getUntrackedParameter<bool>("verbose", true);
  debug_         = ps.getUntrackedParameter<bool>("debug", true);
  prefixME_       = ps.getUntrackedParameter<string>("prefixME", "EcalPreshower");
  lookup_         = ps.getUntrackedParameter<FileInPath>("LookupTable");
  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
  fitPedestal_   = ps.getUntrackedParameter<bool>("fitPedestal", false);
  
  for (int i=0; i<2; i++) 
    for (int j=0; j<2; j++) 
      for (int k=0; k<40; k++) 
        for (int m=0; m<40; m++) {
          hPed_[i][j][k][m] = 0;
          hTotN_[i][j][k][m] = 0;
        }
  
}
ESPedestalClient::~ESPedestalClient ( ) [virtual]

Definition at line 36 of file ESPedestalClient.cc.

                                    {
}

Member Function Documentation

void ESPedestalClient::analyze ( void  ) [virtual]

Implements ESClient.

Definition at line 183 of file ESPedestalClient.cc.

                               {

   ievt_++;
   jevt_++;

}
void ESPedestalClient::beginJob ( DQMStore dqmStore) [virtual]

Implements ESClient.

Definition at line 39 of file ESPedestalClient.cc.

References gather_cfg::cout.

                                                  {

   dqmStore_ = dqmStore;

   if ( debug_ ) cout << "ESPedestalClient: beginJob" << endl;

   ievt_ = 0;
   jevt_ = 0;

}
void ESPedestalClient::beginRun ( void  ) [virtual]

Implements ESClient.

Definition at line 50 of file ESPedestalClient.cc.

References gather_cfg::cout, and HcalObjRepresent::setup().

                                    {

   if ( debug_ ) cout << "ESPedestalClient: beginRun" << endl;

   jevt_ = 0;

   this->setup();
}
void ESPedestalClient::cleanup ( void  ) [virtual]

Implements ESClient.

Definition at line 167 of file ESPedestalClient.cc.

References gather_cfg::cout, i, j, gen::k, and m.

                                   {

   if( ! enableCleanup_ ) return;

   if ( debug_ ) cout << "ESPedestalClient: cleanup" << endl;

   for (int i=0; i<2; i++)
      for (int j=0; j<2; j++)
         for (int k=0; k<40; k++)
            for (int m=0; m<40; m++) {
               hPed_[i][j][k][m] = 0;
               hTotN_[i][j][k][m] = 0;
            }

}
void ESPedestalClient::endJob ( void  ) [virtual]

Implements ESClient.

Definition at line 59 of file ESPedestalClient.cc.

References edm::cleanup(), gather_cfg::cout, MonitorElement::getTH1F(), and i.

                                  {

   if ( debug_ ) cout << "ESPedestalClient: endJob, ievt = " << ievt_ << endl;

   // Preform pedestal fit
   char hname[300];
   int iz = 0;
   if (fitPedestal_) {

      if ( verbose_ ) cout<<"ESPedestalClient: Fit Pedestal"<<endl;

      for (int i=0; i<nLines_; ++i) {

         iz = (senZ_[i]==1) ? 0:1; 

         for (int is=0; is<32; ++is) {

            string dirname = prefixME_ + "/ESPedestalTask/";
            sprintf(hname, "ADC Z %d P %d X %d Y %d Str %d", senZ_[i], senP_[i], senX_[i], senY_[i], is+1);
            MonitorElement *meFit = dqmStore_->get(dirname+hname);

            if (meFit==0) continue;
            TH1F *rootHisto = meFit->getTH1F();
            rootHisto->Fit("fg", "Q", "", 500, 1800);
            rootHisto->Fit("fg", "RQ", "", fg->GetParameter(1)-2.*fg->GetParameter(2),fg->GetParameter(1)+2.*fg->GetParameter(2));
            hPed_[iz][senP_[i]-1][senX_[i]-1][senY_[i]-1]->setBinContent(is+1, (int)(fg->GetParameter(1)+0.5));
            hTotN_[iz][senP_[i]-1][senX_[i]-1][senY_[i]-1]->setBinContent(is+1, fg->GetParameter(2));

         }
      } 

   } else {

      if ( verbose_ ) cout<<"ESPedestalClient: Use Histogram Mean"<<endl;

      for (int i=0; i<nLines_; ++i) {

         iz = (senZ_[i]==1) ? 0:1; 

         for (int is=0; is<32; ++is) {

            string dirname = prefixME_ + "/ESPedestalTask/";
            sprintf(hname, "ADC Z %d P %d X %d Y %d Str %d", senZ_[i], senP_[i], senX_[i], senY_[i], is+1);
            MonitorElement *meMean = dqmStore_->get(dirname+hname);
            
            if (meMean==0) continue;
            TH1F *rootHisto = meMean->getTH1F();

            hPed_[iz][senP_[i]-1][senX_[i]-1][senY_[i]-1]->setBinContent(is+1, (int)(rootHisto->GetMean()+0.5));
            hTotN_[iz][senP_[i]-1][senX_[i]-1][senY_[i]-1]->setBinContent(is+1, rootHisto->GetRMS());

         } 
      }
   }

   this->cleanup();
}
void ESPedestalClient::endLumiAnalyze ( void  ) [inline, virtual]

Implements ESClient.

Definition at line 34 of file ESPedestalClient.h.

{}
void ESPedestalClient::endRun ( void  ) [virtual]

Implements ESClient.

Definition at line 117 of file ESPedestalClient.cc.

References edm::cleanup(), and gather_cfg::cout.

                                  {

  if ( debug_ ) cout << "ESPedestalClient: endRun, jevt = " << jevt_ << endl;
  
  this->cleanup();
}
int ESPedestalClient::getEvtPerJob ( void  ) [inline]

Get Functions.

Definition at line 37 of file ESPedestalClient.h.

References ievt_.

{ return ievt_; }
int ESPedestalClient::getEvtPerRun ( void  ) [inline]

Definition at line 38 of file ESPedestalClient.h.

References jevt_.

{ return jevt_; }
void ESPedestalClient::setup ( void  ) [virtual]

Implements ESClient.

Definition at line 124 of file ESPedestalClient.cc.

References gather_cfg::cout, mergeVDriftHistosByStation::file, and i.

                                 {

   // read in look-up table
   int iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
   ifstream file;

   file.open(lookup_.fullPath().c_str());
   if( file.is_open() ) {

      file >> nLines_;

      for (int i=0; i<nLines_; ++i) {
         file>> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx;

         senZ_[i] = iz;
         senP_[i] = ip;
         senX_[i] = ix;
         senY_[i] = iy;
      }

   } else {
      cout<<"ESPedestalClient : Look up table file can not be found in "<<lookup_.fullPath().c_str()<<endl;
   }

   // define histograms
   dqmStore_->setCurrentFolder(prefixME_+"/ESPedestalClient");

   char hname[300];
   for (int i=0; i<nLines_; ++i) {

      iz = (senZ_[i]==1) ? 0:1;

      sprintf(hname, "Ped Z %d P %d X %d Y %d", senZ_[i], senP_[i], senX_[i], senY_[i]);
      hPed_[iz][senP_[i]-1][senX_[i]-1][senY_[i]-1] = dqmStore_->book1D(hname, hname, 32, 0, 32);
      
      sprintf(hname, "Total Noise Z %d P %d X %d Y %d", senZ_[i], senP_[i], senX_[i], senY_[i]);
      hTotN_[iz][senP_[i]-1][senX_[i]-1][senY_[i]-1] = dqmStore_->book1D(hname, hname, 32, 0, 32);
   }

   fg = new TF1("fg", "gaus");

}

Friends And Related Function Documentation

friend class ESSummaryClient [friend]

Definition at line 22 of file ESPedestalClient.h.


Member Data Documentation

bool ESPedestalClient::debug_ [private]

Definition at line 47 of file ESPedestalClient.h.

Definition at line 54 of file ESPedestalClient.h.

Definition at line 45 of file ESPedestalClient.h.

TF1* ESPedestalClient::fg [private]

Definition at line 59 of file ESPedestalClient.h.

Definition at line 48 of file ESPedestalClient.h.

MonitorElement* ESPedestalClient::hPed_[2][2][40][40] [private]

Definition at line 56 of file ESPedestalClient.h.

MonitorElement* ESPedestalClient::hTotN_[2][2][40][40] [private]

Definition at line 57 of file ESPedestalClient.h.

int ESPedestalClient::ievt_ [private]

Definition at line 43 of file ESPedestalClient.h.

Referenced by getEvtPerJob().

int ESPedestalClient::jevt_ [private]

Definition at line 44 of file ESPedestalClient.h.

Referenced by getEvtPerRun().

Definition at line 51 of file ESPedestalClient.h.

Definition at line 61 of file ESPedestalClient.h.

std::string ESPedestalClient::prefixME_ [private]

Definition at line 52 of file ESPedestalClient.h.

int ESPedestalClient::senP_[4288] [private]

Definition at line 65 of file ESPedestalClient.h.

int ESPedestalClient::senX_[4288] [private]

Definition at line 65 of file ESPedestalClient.h.

int ESPedestalClient::senY_[4288] [private]

Definition at line 65 of file ESPedestalClient.h.

int ESPedestalClient::senZ_[4288] [private]

Definition at line 65 of file ESPedestalClient.h.

Definition at line 46 of file ESPedestalClient.h.