CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Private Attributes

ecaldqm::EnergyTask Class Reference

#include <EnergyTask.h>

Inheritance diagram for ecaldqm::EnergyTask:
ecaldqm::DQWorkerTask ecaldqm::DQWorker

List of all members.

Public Types

enum  MESets {
  kHitMap, kHitMapAll, kHit, kHitAll,
  kMiniCluster, nMESets
}

Public Member Functions

void analyze (const void *, Collections)
void beginRun (const edm::Run &, const edm::EventSetup &)
 EnergyTask (const edm::ParameterSet &, const edm::ParameterSet &)
bool filterRunType (const std::vector< short > &)
void runOnRecHits (const EcalRecHitCollection &)
 ~EnergyTask ()

Static Public Member Functions

static void setMEData (std::vector< MEData > &)

Private Attributes

bool isPhysicsRun_
float threshS9_
const CaloTopologytopology_

Detailed Description

Definition at line 12 of file EnergyTask.h.


Member Enumeration Documentation

Enumerator:
kHitMap 
kHitMapAll 
kHit 
kHitAll 
kMiniCluster 
nMESets 

Reimplemented from ecaldqm::DQWorker.

Definition at line 25 of file EnergyTask.h.

                {
      kHitMap, // profile2d
      kHitMapAll,
      //      k3x3Map, // profile2d 
      kHit, // h1f
      kHitAll,
      kMiniCluster, // h1f
      nMESets
    };

Constructor & Destructor Documentation

data refman pasoursint CMSSW_6_1_2_SLHC2_patch1 src DQM EcalBarrelMonitorTasks src EnergyTask cc ecaldqm::EnergyTask::EnergyTask ( const edm::ParameterSet _params,
const edm::ParameterSet _paths 
)

Definition at line 12 of file EnergyTask.cc.

References edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), ecaldqm::kEBRecHit, ecaldqm::kEERecHit, ecaldqm::kRun, and mergeVDriftHistosByStation::name.

  {
    collectionMask_ = 
      (0x1 << kRun) |
      (0x1 << kEBRecHit) |
      (0x1 << kEERecHit);

    edm::ParameterSet const& taskParams(_params.getUntrackedParameterSet(name_));

    isPhysicsRun_ = taskParams.getUntrackedParameter<bool>("isPhysicsRun");
    threshS9_ = taskParams.getUntrackedParameter<double>("threshS9");

    std::map<std::string, std::string> replacements;
    if(!isPhysicsRun_) replacements["oot"] = " (outOfTime)";
    else replacements["oot"] = "";

    for(unsigned iME(0); iME < nMESets; iME++)
      MEs_[iME]->name(replacements);
  }

ecaldqm::EnergyTask::~EnergyTask ( )

Definition at line 36 of file EnergyTask.cc.

  {
  }


Member Function Documentation

void ecaldqm::EnergyTask::analyze ( const void *  _p,
Collections  _collection 
) [inline, virtual]

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 43 of file EnergyTask.h.

References ecaldqm::kEBRecHit, ecaldqm::kEERecHit, and runOnRecHits().

                                                                        {
    switch(_collection){
    case kEBRecHit:
    case kEERecHit:
      runOnRecHits(*static_cast<const EcalRecHitCollection*>(_p));
      break;
    default:
      break;
    }
  }
void ecaldqm::EnergyTask::beginRun ( const edm::Run ,
const edm::EventSetup _es 
) [virtual]

Reimplemented from ecaldqm::DQWorker.

Definition at line 41 of file EnergyTask.cc.

References Exception, edm::EventSetup::get(), edm::ESHandle< T >::product(), and topology_.

  {
    edm::ESHandle<CaloTopology> topoHndl;
    _es.get<CaloTopologyRecord>().get(topoHndl);
    topology_ = topoHndl.product();
    if(!topology_)
      throw cms::Exception("EventSetup") << "CaloTopology missing" << std::endl;
  }
  
bool ecaldqm::EnergyTask::filterRunType ( const std::vector< short > &  _runType) [virtual]

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 51 of file EnergyTask.cc.

References EcalDCCHeaderBlock::COSMIC, EcalDCCHeaderBlock::COSMICS_GLOBAL, EcalDCCHeaderBlock::COSMICS_LOCAL, EcalDCCHeaderBlock::MTCC, EcalDCCHeaderBlock::PHYSICS_GLOBAL, and EcalDCCHeaderBlock::PHYSICS_LOCAL.

  {
    for(int iFED(0); iFED < 54; iFED++){
      if ( _runType[iFED] == EcalDCCHeaderBlock::COSMIC ||
           _runType[iFED] == EcalDCCHeaderBlock::MTCC ||
           _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
           _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
           _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL ||
           _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL ) return true;
    }

    return false;
  }

void ecaldqm::EnergyTask::runOnRecHits ( const EcalRecHitCollection _hits)

Definition at line 66 of file EnergyTask.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), relval_parameters_module::energy, edm::SortedCollection< T, SORT >::find(), CaloTopology::getWindow(), isPhysicsRun_, EcalRecHit::kGood, kHit, kHitAll, kHitMap, kHitMapAll, kMiniCluster, ecaldqm::DQWorker::MEs_, threshS9_, topology_, and svgfig::window().

Referenced by analyze().

  {
    uint32_t mask(~(0x1 << EcalRecHit::kGood));

    for(EcalRecHitCollection::const_iterator hitItr(_hits.begin()); hitItr != _hits.end(); ++hitItr){

      if(isPhysicsRun_ && hitItr->checkFlagMask(mask)) continue;

      float energy(isPhysicsRun_ ? hitItr->energy() : hitItr->outOfTimeEnergy());

      if ( energy < 0. ) energy = 0.0;

      DetId id(hitItr->id());

      MEs_[kHitMap]->fill(id, energy);
      MEs_[kHitMapAll]->fill(id, energy);
      MEs_[kHit]->fill(id, energy);
      MEs_[kHitAll]->fill(id, energy);

      // look for the seeds
      float e3x3(energy);
      bool isSeed = true;

      EcalRecHitCollection::const_iterator neighborItr;
      float neighborE;
      std::vector<DetId> window(topology_->getWindow(id, 3, 3));
      for(std::vector<DetId>::iterator idItr(window.begin()); idItr != window.end(); ++idItr){
        if((neighborItr = _hits.find(*idItr)) == _hits.end()) continue;
        if(isPhysicsRun_ && neighborItr->checkFlagMask(mask)) continue;
        neighborE = isPhysicsRun_ ? neighborItr->energy() : neighborItr->outOfTimeEnergy();
        if(neighborE > energy){
          isSeed = false;
          break;
        }
        e3x3 += neighborE;
      }

      if(!isSeed) continue;

      if ( e3x3 >= threshS9_ )
        MEs_[kMiniCluster]->fill(id, e3x3);

    }
  }

void ecaldqm::EnergyTask::setMEData ( std::vector< MEData > &  _data) [static]

Member Data Documentation

Definition at line 39 of file EnergyTask.h.

Referenced by runOnRecHits().

Definition at line 40 of file EnergyTask.h.

Referenced by runOnRecHits().

Definition at line 38 of file EnergyTask.h.

Referenced by beginRun(), and runOnRecHits().