CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

ESOccupancyTask Class Reference

#include <ESOccupancyTask.h>

Inheritance diagram for ESOccupancyTask:
edm::EDAnalyzer

List of all members.

Public Member Functions

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

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob (void)
virtual void endJob (void)

Private Attributes

edm::InputTag digilabel_
DQMStoredqmStore_
int eCount_
MonitorElementhDigiNHit_ [2][2]
MonitorElementhE1E2_ [2]
MonitorElementhEnDensity_ [2][2]
MonitorElementhEng_ [2][2]
MonitorElementhEvEng_ [2][2]
MonitorElementhRecNHit_ [2][2]
MonitorElementhRecOCC_ [2][2]
MonitorElementhSelEnDensity_ [2][2]
MonitorElementhSelEng_ [2][2]
MonitorElementhSelOCC_ [2][2]
std::string prefixME_
edm::InputTag rechitlabel_
int runNum_

Detailed Description

Definition at line 11 of file ESOccupancyTask.h.


Constructor & Destructor Documentation

ESOccupancyTask::ESOccupancyTask ( const edm::ParameterSet ps)

Definition at line 26 of file ESOccupancyTask.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), interpolateCardsSimple::histo, i, j, and cppFunctionSkipper::operator.

                                                          {

  rechitlabel_ = ps.getParameter<InputTag>("RecHitLabel");
  digilabel_   = ps.getParameter<InputTag>("DigiLabel");
  prefixME_     = ps.getUntrackedParameter<string>("prefixME", "EcalPreshower"); 
  
  dqmStore_     = Service<DQMStore>().operator->();
  eCount_ = 0;
  
  //Histogram init  
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 2; ++j) {
      hRecOCC_[i][j] = 0;
      hRecNHit_[i][j] = 0;
      hEng_[i][j] = 0;
      hEvEng_[i][j] = 0;
      hEnDensity_[i][i] = 0;
      hDigiNHit_[i][j] = 0;

      hSelEng_[i][j] = 0;
      hSelOCC_[i][j] = 0;
      hSelEnDensity_[i][j] = 0;
    }
  
  for (int i = 0; i<2; ++i) 
    hE1E2_[i]=0;
  
  dqmStore_->setCurrentFolder(prefixME_ + "/ESOccupancyTask");
  
  //Booking Histograms
  //Notice: Change ESRenderPlugin under DQM/RenderPlugins/src if you change this histogram name.
  char histo[200];
  for (int i=0 ; i<2; ++i) 
    for (int j=0 ; j<2; ++j) {
      int iz = (i==0)? 1:-1;
      sprintf(histo, "ES RecHit 2D Occupancy Z %d P %d", iz, j+1);
      hRecOCC_[i][j] = dqmStore_->book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
      hRecOCC_[i][j]->setAxisTitle("Si X", 1);
      hRecOCC_[i][j]->setAxisTitle("Si Y", 2);
      
      //Bin 40,40 is used to save eumber of event for scaling.
      sprintf(histo, "ES Energy Density Z %d P %d", iz, j+1);
      hEnDensity_[i][j] = dqmStore_->book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
      hEnDensity_[i][j]->setAxisTitle("Si X", 1);
      hEnDensity_[i][j]->setAxisTitle("Si Y", 2);
      
      sprintf(histo, "ES Num of RecHits Z %d P %d", iz, j+1);
      hRecNHit_[i][j] = dqmStore_->book1DD(histo, histo, 60, 0, 1920);
      hRecNHit_[i][j]->setAxisTitle("# of RecHits", 1);
      hRecNHit_[i][j]->setAxisTitle("Num of Events", 2);
      
      sprintf(histo, "ES Num of Good RecHits Z %d P %d", iz, j+1);
      hDigiNHit_[i][j] = dqmStore_->book1DD(histo, histo, 60, 0, 1920);
      hDigiNHit_[i][j]->setAxisTitle("# of good RecHits", 1);
      hDigiNHit_[i][j]->setAxisTitle("Num of Events", 2);
      
      sprintf(histo, "ES RecHit Energy Z %d P %d", iz, j+1);
      hEng_[i][j] = dqmStore_->book1DD(histo, histo, 50, 0, 0.001);
      hEng_[i][j]->setAxisTitle("RecHit Energy", 1);
      hEng_[i][j]->setAxisTitle("Num of ReHits", 2);
      
      sprintf(histo, "ES Event Energy Z %d P %d", iz, j+1);
      hEvEng_[i][j] = dqmStore_->book1DD(histo, histo, 50, 0, 0.1);
      hEvEng_[i][j]->setAxisTitle("Event Energy", 1);
      hEvEng_[i][j]->setAxisTitle("Num of Events", 2);

      // histograms with selected hits
      sprintf(histo, "ES RecHit Energy with selected hits Z %d P %d", iz, j+1);
      hSelEng_[i][j] = dqmStore_->book1DD(histo, histo, 50, 0, 0.001);
      hSelEng_[i][j]->setAxisTitle("RecHit Energy", 1);
      hSelEng_[i][j]->setAxisTitle("Num of ReHits", 2);

      sprintf(histo, "ES Occupancy with selected hits Z %d P %d", iz, j+1);
      hSelOCC_[i][j] = dqmStore_->book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
      hSelOCC_[i][j]->setAxisTitle("Si X", 1);
      hSelOCC_[i][j]->setAxisTitle("Si Y", 2);

      sprintf(histo, "ES Energy Density with selected hits Z %d P %d", iz, j+1);
      hSelEnDensity_[i][j] = dqmStore_->book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
      hSelEnDensity_[i][j]->setAxisTitle("Si X", 1);
      hSelEnDensity_[i][j]->setAxisTitle("Si Y", 2);
    }

   hE1E2_[0] = dqmStore_->book2D("ES+ EP1 vs EP2", "ES+ EP1 vs EP2", 50, 0, 0.1, 50, 0, 0.1);
   hE1E2_[1] = dqmStore_->book2D("ES- EP1 vs EP2", "ES- EP1 vs EP2", 50, 0, 0.1, 50, 0, 0.1);

}
ESOccupancyTask::~ESOccupancyTask ( ) [virtual]

Definition at line 114 of file ESOccupancyTask.cc.

                                  {
}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 123 of file ESOccupancyTask.cc.

References edm::Event::getByLabel(), i, edm::EventBase::id(), j, edm::EventID::run(), and ESDetId::zside().

                                                                            {

   runNum_ = e.id().run();
   eCount_++;

   // RecHits
   int zside, plane, ix, iy;
   int sum_RecHits[2][2], sum_DigiHits[2][2];
   float sum_Energy[2][2];

   for (int i = 0; i < 2; ++i) 
     for (int j = 0; j < 2; ++j) {
       sum_RecHits[i][j] = 0;
       sum_DigiHits[i][j] = 0;
       sum_Energy[i][j] = 0;
     }
   
   Handle<ESRecHitCollection> ESRecHit;
   if ( e.getByLabel(rechitlabel_, ESRecHit) ) {
     
     for (ESRecHitCollection::const_iterator hitItr = ESRecHit->begin(); hitItr != ESRecHit->end(); ++hitItr) {
       
       ESDetId id = ESDetId(hitItr->id());
       
       zside = id.zside();
       plane = id.plane();
       ix    = id.six();
       iy    = id.siy();
 
       int i = (zside==1)? 0:1;
       int j = plane-1;
       
       sum_RecHits[i][j]++;
       sum_Energy[i][j] += hitItr->energy();
       hRecOCC_[i][j]->Fill(ix, iy);
       if (hitItr->energy() != 0) {
         hEng_[i][j]->Fill(hitItr->energy());
         hEnDensity_[i][j]->Fill(ix, iy, hitItr->energy());

         if (hitItr->recoFlag()==14 || hitItr->recoFlag()==1 || (hitItr->recoFlag()<=10 && hitItr->recoFlag()>=5)) continue;
         hSelEng_[i][j]->Fill(hitItr->energy());
         hSelEnDensity_[i][j]->Fill(ix, iy, hitItr->energy());
         hSelOCC_[i][j]->Fill(ix, iy);
       }
       
     }
   } else {
     LogWarning("ESOccupancyTask") << rechitlabel_ << " not available";
   }

   //Fill histograms after a event
   for (int i = 0; i < 2; ++i) 
     for (int j = 0; j < 2; ++j) {

       hRecNHit_[i][j]->Fill(sum_RecHits[i][j]);
       hDigiNHit_[i][j]->Fill(sum_DigiHits[i][j]);
       hEvEng_[i][j]->Fill(sum_Energy[i][j]);
       
       //Save eCount_ for Scaling
       hRecOCC_[i][j]->setBinContent(40,40,eCount_);
       hEnDensity_[i][j]->setBinContent(40,40,eCount_);

       hSelOCC_[i][j]->setBinContent(40,40,eCount_);
       hSelEnDensity_[i][j]->setBinContent(40,40,eCount_);
     }

   hE1E2_[0]->Fill(sum_Energy[0][0], sum_Energy[0][1]);
   hE1E2_[1]->Fill(sum_Energy[1][0], sum_Energy[1][1]);

}
void ESOccupancyTask::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 117 of file ESOccupancyTask.cc.

                                   {
}
void ESOccupancyTask::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 120 of file ESOccupancyTask.cc.

                             {
}

Member Data Documentation

Definition at line 26 of file ESOccupancyTask.h.

Definition at line 29 of file ESOccupancyTask.h.

int ESOccupancyTask::eCount_ [private]

Definition at line 41 of file ESOccupancyTask.h.

Definition at line 35 of file ESOccupancyTask.h.

Definition at line 39 of file ESOccupancyTask.h.

Definition at line 33 of file ESOccupancyTask.h.

Definition at line 37 of file ESOccupancyTask.h.

Definition at line 38 of file ESOccupancyTask.h.

Definition at line 32 of file ESOccupancyTask.h.

Definition at line 30 of file ESOccupancyTask.h.

Definition at line 34 of file ESOccupancyTask.h.

Definition at line 36 of file ESOccupancyTask.h.

Definition at line 31 of file ESOccupancyTask.h.

std::string ESOccupancyTask::prefixME_ [private]

Definition at line 27 of file ESOccupancyTask.h.

Definition at line 25 of file ESOccupancyTask.h.

int ESOccupancyTask::runNum_ [private]

Definition at line 41 of file ESOccupancyTask.h.