CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

ESPedestalTask Class Reference

#include <ESPedestalTask.h>

Inheritance diagram for ESPedestalTask:
edm::EDAnalyzer

List of all members.

Public Member Functions

 ESPedestalTask (const edm::ParameterSet &ps)
virtual ~ESPedestalTask ()

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &)
void beginJob (void)
void beginRun (const edm::Run &r, const edm::EventSetup &c)
void cleanup (void)
void endJob (void)
void endRun (const edm::Run &r, const edm::EventSetup &c)
void reset (void)
void setup (void)

Private Attributes

int dac_
edm::InputTag digilabel_
DQMStoredqmStore_
bool enableCleanup_
int firstDAC_
int gain_
int ievt_
bool init_
int isPed_
edm::FileInPath lookup_
MonitorElementmeADC_ [4288][32]
bool mergeRuns_
int nDAC_
int nLines_
std::string outputFile_
int precision_
std::string prefixME_
int runNum_
int runtype_
int senCount_ [2][2][40][40]
int seqtype_
int vDAC_ [5]

Detailed Description

Definition at line 11 of file ESPedestalTask.h.


Constructor & Destructor Documentation

ESPedestalTask::ESPedestalTask ( const edm::ParameterSet ps)

Definition at line 27 of file ESPedestalTask.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, j, gen::k, prof2calltree::l, and cppFunctionSkipper::operator.

                                                        {

  init_ = false;

  dqmStore_     = Service<DQMStore>().operator->();
  
  digilabel_    = ps.getParameter<InputTag>("DigiLabel");
  lookup_       = ps.getUntrackedParameter<FileInPath>("LookupTable");
  outputFile_   = ps.getUntrackedParameter<string>("OutputFile","");
  prefixME_     = ps.getUntrackedParameter<string>("prefixME", "EcalPreshower"); 

  for (int i=0; i<2; ++i) 
    for (int j=0; j<2; ++j) 
      for (int k=0; k<40; ++k)
        for (int l=0; l<40; ++l)
          senCount_[i][j][k][l] = -1;
  
}
ESPedestalTask::~ESPedestalTask ( ) [virtual]

Definition at line 46 of file ESPedestalTask.cc.

                                {
}

Member Function Documentation

void ESPedestalTask::analyze ( const edm::Event e,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 126 of file ESPedestalTask.cc.

References ESSample::adc(), edm::Event::getByLabel(), edm::EventBase::id(), ESDataFrame::id(), edm::HandleBase::isValid(), edm::EventID::run(), ESDataFrame::sample(), HcalObjRepresent::setup(), strip(), and ESDetId::zside().

                                                                           {
  
  if ( ! init_ ) this->setup();

  ievt_++;  
  runNum_ = e.id().run();
  
  Handle<ESDigiCollection> digis;
  e.getByLabel(digilabel_, digis);
  
  runtype_ = 1; // Let runtype_ = 1
  
  // Digis
  int zside, plane, ix, iy, strip, iz;
  if (digis.isValid()) {
    for (ESDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr) {
      
      ESDataFrame dataframe = (*digiItr);
      ESDetId id = dataframe.id();
      
      zside = id.zside();
      plane = id.plane();
      ix    = id.six();
      iy    = id.siy();
      strip = id.strip();
      iz = (zside==1) ? 0:1;
      
      if (meADC_[senCount_[iz][plane-1][ix-1][iy-1]][strip-1]) {
        if(runtype_ == 1){              
          meADC_[senCount_[iz][plane-1][ix-1][iy-1]][strip-1]->Fill(dataframe.sample(0).adc());
          meADC_[senCount_[iz][plane-1][ix-1][iy-1]][strip-1]->Fill(dataframe.sample(1).adc());
          meADC_[senCount_[iz][plane-1][ix-1][iy-1]][strip-1]->Fill(dataframe.sample(2).adc());
        } else if(runtype_ == 3) {
          meADC_[senCount_[iz][plane-1][ix-1][iy-1]][strip-1]->Fill(dataframe.sample(1).adc());
        }
      } 
      
    }
  }
 
}
void ESPedestalTask::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 49 of file ESPedestalTask.cc.

                                  {
  ievt_ = 0;
}
void ESPedestalTask::beginRun ( const edm::Run r,
const edm::EventSetup c 
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 53 of file ESPedestalTask.cc.

References reset().

                                                               {

  if ( ! mergeRuns_ ) this->reset();

}
void ESPedestalTask::cleanup ( void  ) [private]

Definition at line 111 of file ESPedestalTask.cc.

                                {

  if ( ! init_ ) return;

  init_ = false;
}
void ESPedestalTask::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 118 of file ESPedestalTask.cc.

References edm::cleanup().

                                {

  LogInfo("ESPedestalTask") << "analyzed " << ievt_ << " events";

  if ( enableCleanup_ ) this->cleanup();

}
void ESPedestalTask::endRun ( const edm::Run r,
const edm::EventSetup c 
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 59 of file ESPedestalTask.cc.

                                                             {
}
void ESPedestalTask::reset ( void  ) [private]

Definition at line 62 of file ESPedestalTask.cc.

                               {

}
void ESPedestalTask::setup ( void  ) [private]

Definition at line 66 of file ESPedestalTask.cc.

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

                               {
  
  init_ = true;

  int iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
  int senZ_[4288], senP_[4288], senX_[4288], senY_[4288];
  
  // read in look-up table
  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;

      iz = (senZ_[i]==1) ? 0:1;
      senCount_[iz][senP_[i]-1][senX_[i]-1][senY_[i]-1] = i; 
    }
  } 
  else {
    cout<<"ESPedestalTask : Look up table file can not be found in "<<lookup_.fullPath().c_str()<<endl;
  }
 
  char hname[300];
  
  if (dqmStore_) {
    dqmStore_->setCurrentFolder(prefixME_ + "/ESPedestalTask");
    
    for (int i=0; i<nLines_; ++i) {
      for (int is=0; is<32; ++is) {
        sprintf(hname, "ADC Z %d P %d X %d Y %d Str %d", senZ_[i], senP_[i], senX_[i], senY_[i], is+1);
        meADC_[i][is] = dqmStore_->book1D(hname, hname, 1000, 899.5, 1899.5);
      }
    }
  }

}

Member Data Documentation

int ESPedestalTask::dac_ [private]

Definition at line 42 of file ESPedestalTask.h.

Definition at line 29 of file ESPedestalTask.h.

Definition at line 37 of file ESPedestalTask.h.

Definition at line 34 of file ESPedestalTask.h.

Definition at line 43 of file ESPedestalTask.h.

int ESPedestalTask::gain_ [private]

Definition at line 42 of file ESPedestalTask.h.

int ESPedestalTask::ievt_ [private]

Definition at line 41 of file ESPedestalTask.h.

bool ESPedestalTask::init_ [private]

Definition at line 40 of file ESPedestalTask.h.

int ESPedestalTask::isPed_ [private]

Definition at line 43 of file ESPedestalTask.h.

Definition at line 30 of file ESPedestalTask.h.

MonitorElement* ESPedestalTask::meADC_[4288][32] [private]

Definition at line 38 of file ESPedestalTask.h.

Definition at line 35 of file ESPedestalTask.h.

int ESPedestalTask::nDAC_ [private]

Definition at line 43 of file ESPedestalTask.h.

int ESPedestalTask::nLines_ [private]

Definition at line 41 of file ESPedestalTask.h.

std::string ESPedestalTask::outputFile_ [private]

Definition at line 31 of file ESPedestalTask.h.

Definition at line 42 of file ESPedestalTask.h.

std::string ESPedestalTask::prefixME_ [private]

Definition at line 32 of file ESPedestalTask.h.

int ESPedestalTask::runNum_ [private]

Definition at line 41 of file ESPedestalTask.h.

int ESPedestalTask::runtype_ [private]

Definition at line 42 of file ESPedestalTask.h.

int ESPedestalTask::senCount_[2][2][40][40] [private]

Definition at line 41 of file ESPedestalTask.h.

int ESPedestalTask::seqtype_ [private]

Definition at line 42 of file ESPedestalTask.h.

int ESPedestalTask::vDAC_[5] [private]

Definition at line 43 of file ESPedestalTask.h.