CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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

Public Types

enum  MESets {
  kHitMap, kHitMapAll, kHit, kHitAll,
  kMiniCluster, nMESets
}
 
- Public Types inherited from ecaldqm::DQWorker
enum  MESets { 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 ()
 
- Public Member Functions inherited from ecaldqm::DQWorkerTask
virtual void beginEvent (const edm::Event &, const edm::EventSetup &)
 
 DQWorkerTask (const edm::ParameterSet &, const edm::ParameterSet &, std::string const &)
 
virtual void endEvent (const edm::Event &, const edm::EventSetup &)
 
virtual bool filterTrigger (const edm::TriggerResultsByName &)
 
virtual const std::vector
< std::pair< Collections,
Collections > > & 
getDependencies ()
 
virtual bool runsOn (unsigned)
 
virtual ~DQWorkerTask ()
 
- Public Member Functions inherited from ecaldqm::DQWorker
virtual void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
 
virtual void bookMEs ()
 
 DQWorker (const edm::ParameterSet &, const edm::ParameterSet &, std::string const &)
 
virtual void endLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
 
virtual void endRun (const edm::Run &, const edm::EventSetup &)
 
const std::vector< MESet * > & getMEs ()
 
virtual std::string const & getName ()
 
virtual bool isInitialized ()
 
virtual void reset ()
 
virtual void setInitialized (bool _init)
 
virtual void setVerbosity (int _verbosity)
 
virtual ~DQWorker ()
 

Static Public Member Functions

static void setMEData (std::vector< MEData > &)
 
- Static Public Member Functions inherited from ecaldqm::DQWorker
static void setMEData (std::vector< MEData > &)
 

Private Attributes

bool isPhysicsRun_
 
float threshS9_
 
const CaloTopologytopology_
 

Additional Inherited Members

- Static Public Attributes inherited from ecaldqm::DQWorker
static std::map< std::string,
std::vector< MEData > > 
meData
 
- Protected Member Functions inherited from ecaldqm::DQWorker
MESetcreateMESet_ (std::string const &, MEData const &, bool _readOnly=false) const
 
void meSet_ (unsigned, edm::ParameterSet const &)
 
- Protected Attributes inherited from ecaldqm::DQWorkerTask
uint32_t collectionMask_
 
std::vector< std::pair
< Collections, Collections > > 
dependencies_
 
- Protected Attributes inherited from ecaldqm::DQWorker
bool initialized_
 
std::vector< MESet * > MEs_
 
std::string name_
 
int verbosity_
 

Detailed Description

Definition at line 12 of file EnergyTask.h.

Member Enumeration Documentation

Enumerator
kHitMap 
kHitMapAll 
kHit 
kHitAll 
kMiniCluster 
nMESets 

Definition at line 25 of file EnergyTask.h.

Constructor & Destructor Documentation

ecaldqm::EnergyTask::EnergyTask ( const edm::ParameterSet _params,
const edm::ParameterSet _paths 
)

Definition at line 11 of file EnergyTask.cc.

References ecaldqm::DQWorkerTask::collectionMask_, edm::ParameterSet::getUntrackedParameterSet(), isPhysicsRun_, ecaldqm::kEBRecHit, ecaldqm::kEERecHit, ecaldqm::kRun, ecaldqm::DQWorker::MEs_, mergeVDriftHistosByStation::name, ecaldqm::DQWorker::name_, nMESets, and threshS9_.

11  :
12  DQWorkerTask(_params, _paths, "EnergyTask"),
13  topology_(0),
14  isPhysicsRun_(false),
15  threshS9_(0.)
16  {
18  (0x1 << kRun) |
19  (0x1 << kEBRecHit) |
20  (0x1 << kEERecHit);
21 
22  edm::ParameterSet const& taskParams(_params.getUntrackedParameterSet(name_));
23 
24  isPhysicsRun_ = taskParams.getUntrackedParameter<bool>("isPhysicsRun");
25  threshS9_ = taskParams.getUntrackedParameter<double>("threshS9");
26 
27  std::map<std::string, std::string> replacements;
28  if(!isPhysicsRun_) replacements["oot"] = " (outOfTime)";
29  else replacements["oot"] = "";
30 
31  for(unsigned iME(0); iME < nMESets; iME++)
32  MEs_[iME]->name(replacements);
33  }
DQWorkerTask(const edm::ParameterSet &, const edm::ParameterSet &, std::string const &)
Definition: DQWorkerTask.cc:5
ParameterSet const & getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
const CaloTopology * topology_
Definition: EnergyTask.h:38
std::vector< MESet * > MEs_
Definition: DQWorker.h:56
std::string name_
Definition: DQWorker.h:55
ecaldqm::EnergyTask::~EnergyTask ( )

Definition at line 35 of file EnergyTask.cc.

36  {
37  }

Member Function Documentation

void ecaldqm::EnergyTask::analyze ( const void *  _p,
Collections  _collection 
)
inlinevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 43 of file EnergyTask.h.

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

43  {
44  switch(_collection){
45  case kEBRecHit:
46  case kEERecHit:
47  runOnRecHits(*static_cast<const EcalRecHitCollection*>(_p));
48  break;
49  default:
50  break;
51  }
52  }
void runOnRecHits(const EcalRecHitCollection &)
Definition: EnergyTask.cc:65
void ecaldqm::EnergyTask::beginRun ( const edm::Run ,
const edm::EventSetup _es 
)
virtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 40 of file EnergyTask.cc.

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

41  {
43  _es.get<CaloTopologyRecord>().get(topoHndl);
44  topology_ = topoHndl.product();
45  if(!topology_)
46  throw cms::Exception("EventSetup") << "CaloTopology missing" << std::endl;
47  }
const CaloTopology * topology_
Definition: EnergyTask.h:38
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
bool ecaldqm::EnergyTask::filterRunType ( const std::vector< short > &  _runType)
virtual
void ecaldqm::EnergyTask::runOnRecHits ( const EcalRecHitCollection _hits)

Definition at line 65 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().

66  {
67  uint32_t mask(~(0x1 << EcalRecHit::kGood));
68 
69  for(EcalRecHitCollection::const_iterator hitItr(_hits.begin()); hitItr != _hits.end(); ++hitItr){
70 
71  if(isPhysicsRun_ && hitItr->checkFlagMask(mask)) continue;
72 
73  float energy(isPhysicsRun_ ? hitItr->energy() : hitItr->outOfTimeEnergy());
74 
75  if ( energy < 0. ) energy = 0.0;
76 
77  DetId id(hitItr->id());
78 
79  MEs_[kHitMap]->fill(id, energy);
80  MEs_[kHitMapAll]->fill(id, energy);
81  MEs_[kHit]->fill(id, energy);
82  MEs_[kHitAll]->fill(id, energy);
83 
84  // look for the seeds
85  float e3x3(energy);
86  bool isSeed = true;
87 
89  float neighborE;
90  std::vector<DetId> window(topology_->getWindow(id, 3, 3));
91  for(std::vector<DetId>::iterator idItr(window.begin()); idItr != window.end(); ++idItr){
92  if((neighborItr = _hits.find(*idItr)) == _hits.end()) continue;
93  if(isPhysicsRun_ && neighborItr->checkFlagMask(mask)) continue;
94  neighborE = isPhysicsRun_ ? neighborItr->energy() : neighborItr->outOfTimeEnergy();
95  if(neighborE > energy){
96  isSeed = false;
97  break;
98  }
99  e3x3 += neighborE;
100  }
101 
102  if(!isSeed) continue;
103 
104  if ( e3x3 >= threshS9_ )
105  MEs_[kMiniCluster]->fill(id, e3x3);
106 
107  }
108  }
def window
Definition: svgfig.py:642
std::vector< EcalRecHit >::const_iterator const_iterator
std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
Get the neighbors of the given cell in a window of given size.
Definition: CaloTopology.cc:73
const CaloTopology * topology_
Definition: EnergyTask.h:38
const_iterator end() const
Definition: DetId.h:20
std::vector< MESet * > MEs_
Definition: DQWorker.h:56
iterator find(key_type k)
const_iterator begin() const
void ecaldqm::EnergyTask::setMEData ( std::vector< MEData > &  _data)
static

Definition at line 112 of file EnergyTask.cc.

References MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TPROFILE2D, EcalDQMBinningService::AxisSpecs::high, EcalDQMBinningService::kCrystal, EcalDQMBinningService::kEcal2P, kHit, kHitAll, kHitMap, kHitMapAll, kMiniCluster, EcalDQMBinningService::kSM, EcalDQMBinningService::kSuperCrystal, EcalDQMBinningService::kUser, EcalDQMBinningService::AxisSpecs::low, and EcalDQMBinningService::AxisSpecs::nbins.

113  {
114  BinService::AxisSpecs xaxis, zaxis;
115 
116  zaxis.low = 0.;
117  zaxis.high = 10.;
118  _data[kHitMap] = MEData("HitMap", BinService::kSM, BinService::kCrystal, MonitorElement::DQM_KIND_TPROFILE2D, 0, 0, &zaxis);
120 
121  xaxis.nbins = 50;
122  xaxis.low = 0.;
123  xaxis.high = 20.;
124  _data[kHit] = MEData("Hit", BinService::kSM, BinService::kUser, MonitorElement::DQM_KIND_TH1F, &xaxis);
126 
127  _data[kMiniCluster] = MEData("MiniCluster", BinService::kSM, BinService::kUser, MonitorElement::DQM_KIND_TH1F, &xaxis);
128  }

Member Data Documentation

bool ecaldqm::EnergyTask::isPhysicsRun_
private

Definition at line 39 of file EnergyTask.h.

Referenced by EnergyTask(), and runOnRecHits().

float ecaldqm::EnergyTask::threshS9_
private

Definition at line 40 of file EnergyTask.h.

Referenced by EnergyTask(), and runOnRecHits().

const CaloTopology* ecaldqm::EnergyTask::topology_
private

Definition at line 38 of file EnergyTask.h.

Referenced by beginRun(), and runOnRecHits().