CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

ESDaqInfoTask Class Reference

#include <ESDaqInfoTask.h>

Inheritance diagram for ESDaqInfoTask:
edm::EDAnalyzer

List of all members.

Public Member Functions

 ESDaqInfoTask (const edm::ParameterSet &ps)
 Constructor.
virtual ~ESDaqInfoTask ()
 Destructor.

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze.
void beginJob (void)
 BeginJob.
void beginLuminosityBlock (const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup)
 BeginLuminosityBlock.
void cleanup (void)
 Cleanup.
void endJob (void)
 EndJob.
void endLuminosityBlock (const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup)
 EndLuminosityBlock.
void reset (void)
 Reset.

Private Member Functions

int getFEDNumber (const int x, const int y)

Private Attributes

DQMStoredqmStore_
bool enableCleanup_
ESElectronicsMapperes_mapping_
int ESFedRangeMax_
int ESFedRangeMin_
bool ESOnFed_ [56]
MonitorElementmeESDaqActive_ [56]
MonitorElementmeESDaqActiveMap_
MonitorElementmeESDaqError_
MonitorElementmeESDaqFraction_
bool mergeRuns_
std::string prefixME_

Detailed Description

Definition at line 9 of file ESDaqInfoTask.h.


Constructor & Destructor Documentation

ESDaqInfoTask::ESDaqInfoTask ( const edm::ParameterSet ps)

Constructor.

Definition at line 30 of file ESDaqInfoTask.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, and cppFunctionSkipper::operator.

                                                   {

   dqmStore_ = Service<DQMStore>().operator->();

   prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");

   enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);

   mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);

   ESFedRangeMin_ = ps.getUntrackedParameter<int>("ESFedRangeMin", 520);
   ESFedRangeMax_ = ps.getUntrackedParameter<int>("ESFedRangeMax", 575);

   meESDaqFraction_ = 0;
   meESDaqActiveMap_ = 0;
   meESDaqError_ = 0;

   for (int i = 0; i < 56; i++) {
      meESDaqActive_[i] = 0;
   }

   if (ps.exists("esMapping")){
      edm::ParameterSet esMap=ps.getParameter<edm::ParameterSet>("esMapping");
      es_mapping_ = new ESElectronicsMapper(esMap);
   }else{
      edm::LogError("ESDaqInfoTask")<<"preshower mapping pointer not initialized. Temporary.";
      es_mapping_=0;
   }



}
ESDaqInfoTask::~ESDaqInfoTask ( ) [virtual]

Destructor.

Definition at line 63 of file ESDaqInfoTask.cc.

                              {
   delete es_mapping_;
}

Member Function Documentation

void ESDaqInfoTask::analyze ( const edm::Event e,
const edm::EventSetup c 
) [protected, virtual]

Analyze.

Implements edm::EDAnalyzer.

Definition at line 227 of file ESDaqInfoTask.cc.

                                                              { 

}
void ESDaqInfoTask::beginJob ( void  ) [protected, virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 67 of file ESDaqInfoTask.cc.

References timingPdfMaker::histo, i, x, and detailsBasic3DVector::y.

                                 {

   char histo[200];

   if ( dqmStore_ ) {

      dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo");

      sprintf(histo, "DAQSummary");
      meESDaqFraction_ = dqmStore_->bookFloat(histo);
      meESDaqFraction_->Fill(0.0);

      sprintf(histo, "DAQSummaryMap");
      meESDaqActiveMap_ = dqmStore_->book2D(histo,histo, 80, 0.5, 80.5, 80, 0.5, 80.5);
      meESDaqActiveMap_->setAxisTitle("Si X", 1);
      meESDaqActiveMap_->setAxisTitle("Si Y", 2);

      dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo/DAQContents");

      for (int i = 0; i < 56; i++) {
         sprintf(histo, "EcalPreshower_%d", ESFedRangeMin_+i);
         meESDaqActive_[i] = dqmStore_->bookFloat(histo);
         meESDaqActive_[i]->Fill(0.0);

         ESOnFed_[i] = false;
         for ( int x = 0; x < 80; x++ ) {
            for ( int y = 0; y < 80; y++ ) {
               if(getFEDNumber(x, y) == ESFedRangeMin_+i){
                  ESOnFed_[i] = true;
                  break;
               }
            }
            if(ESOnFed_[i] == true) break;
         }
      }

      dqmStore_->setCurrentFolder(prefixME_ + "/ESIntegrityTask");
      sprintf(histo, "DAQError");
      meESDaqError_ = dqmStore_->book1D(histo, histo, 56, ESFedRangeMin_-0.5, ESFedRangeMax_+0.5);
      meESDaqError_->setAxisTitle("FedID", 1);

   }

}
void ESDaqInfoTask::beginLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup iSetup 
) [protected, virtual]

BeginLuminosityBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 118 of file ESDaqInfoTask.cc.

References edm::EventSetup::find(), edm::eventsetup::heterocontainer::HCTypeTag::findType(), edm::EventSetup::get(), i, reset(), x, and detailsBasic3DVector::y.

                                                                                                         {

   this->reset();
   
   for (int x = 0; x < 80; ++x) {
     for (int y = 0; y < 80; ++y) {
       if( getFEDNumber(x, y) > 0 ) meESDaqActiveMap_->setBinContent( x+1, y+1, 0.0 );
       else meESDaqActiveMap_->setBinContent( x+1, y+1, -1.0 );
     }
   }
   
   for (int i = 0; i < 56; i++) {
     if ( meESDaqError_ ) meESDaqError_->setBinContent(i, 0.0);
   }
   
   edm::eventsetup::EventSetupRecordKey recordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("RunInfoRcd"));

   if( iSetup.find( recordKey ) ) {

      edm::ESHandle<RunInfo> sumFED;
      iSetup.get<RunInfoRcd>().get(sumFED);    

      std::vector<int> FedsInIds= sumFED->m_fed_in;   

      float ESFedCount = 0.;

      for( unsigned int fedItr=0; fedItr<FedsInIds.size(); ++fedItr ) {

         int fedID=FedsInIds[fedItr];

         if ( fedID >= ESFedRangeMin_ && fedID <= ESFedRangeMax_ ) {

            if( ESOnFed_[fedID - ESFedRangeMin_] ) ESFedCount++;

            if ( meESDaqActive_[fedID-ESFedRangeMin_] ) meESDaqActive_[fedID-ESFedRangeMin_]->Fill(1.0);

            if( meESDaqActiveMap_ ) {

               for (int x = 0; x < 80; x++) {
                  for (int y = 0; y < 80; y++) {
                    if (fedID == getFEDNumber(x, y))
                      meESDaqActiveMap_->setBinContent( x+1, y+1, 1.0 );
                  }
               }

            }

            if( meESDaqFraction_ ) meESDaqFraction_->Fill( ESFedCount/40. );

            if( meESDaqError_ ){
               for( int i = 0; i < 56; i++){
                  if( ESOnFed_[fedID-ESFedRangeMin_] ) meESDaqError_->setBinContent(i+1, 1.0);
                  else meESDaqError_->setBinContent(i+1, 2.0);
               }
            }

         }

      }

 } else {

      LogWarning("ESDaqInfoTask") << "Cannot find any RunInfoRcd" << endl;

   }

}
void ESDaqInfoTask::cleanup ( void  ) [protected]

Cleanup.

Definition at line 205 of file ESDaqInfoTask.cc.

References i.

void ESDaqInfoTask::endJob ( void  ) [protected, virtual]

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 112 of file ESDaqInfoTask.cc.

References edm::cleanup().

                               {

   if ( enableCleanup_ ) this->cleanup();

}
void ESDaqInfoTask::endLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup iSetup 
) [protected, virtual]

EndLuminosityBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 186 of file ESDaqInfoTask.cc.

                                                                                                         {

}
int ESDaqInfoTask::getFEDNumber ( const int  x,
const int  y 
) [inline, private]

Definition at line 65 of file ESDaqInfoTask.h.

                                                 {
        int iz = (x < 40)  ? 1 : 2;
        int ip = (y >= 40) ? 1 : 2;
        int ix = (x < 40) ? x : x - 40;
        int iy = (y < 40) ? y :y - 40;
        return (*es_mapping_).getFED( iz, ip, ix + 1, iy + 1);
      }
void ESDaqInfoTask::reset ( void  ) [protected]

Reset.

Definition at line 190 of file ESDaqInfoTask.cc.

References i.


Member Data Documentation

Definition at line 44 of file ESDaqInfoTask.h.

Definition at line 48 of file ESDaqInfoTask.h.

Definition at line 61 of file ESDaqInfoTask.h.

Definition at line 59 of file ESDaqInfoTask.h.

Definition at line 58 of file ESDaqInfoTask.h.

bool ESDaqInfoTask::ESOnFed_[56] [private]

Definition at line 63 of file ESDaqInfoTask.h.

Definition at line 53 of file ESDaqInfoTask.h.

Definition at line 54 of file ESDaqInfoTask.h.

Definition at line 56 of file ESDaqInfoTask.h.

Definition at line 52 of file ESDaqInfoTask.h.

bool ESDaqInfoTask::mergeRuns_ [private]

Definition at line 50 of file ESDaqInfoTask.h.

std::string ESDaqInfoTask::prefixME_ [private]

Definition at line 46 of file ESDaqInfoTask.h.