CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CaloTowersDQMClient Class Reference

#include <CaloTowersDQMClient.h>

Inheritance diagram for CaloTowersDQMClient:
DQMEDHarvester edm::one::EDProducer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources, edm::EndLuminosityBlockProducer > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginJob (void) override
 
virtual void beginRun (const edm::Run &run, const edm::EventSetup &c) override
 
 CaloTowersDQMClient (const edm::ParameterSet &)
 
int CaloTowersEndjob (const std::vector< MonitorElement * > &hcalMEs)
 
virtual void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
virtual ~CaloTowersDQMClient ()
 
- Public Member Functions inherited from DQMEDHarvester
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override final
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 DQMEDHarvester (void)
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endJob () override final
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override final
 
virtual void endRun (edm::Run const &, edm::EventSetup const &) override
 
virtual void produce (edm::Event &, edm::EventSetup const &) override final
 
virtual ~DQMEDHarvester ()=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources, edm::EndLuminosityBlockProducer >
 EDProducer ()=default
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::ParameterSet conf_
 
bool debug_
 
std::string dirName_
 
std::string dirNameJet_
 
std::string dirNameMET_
 
std::string outputFile_
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 40 of file CaloTowersDQMClient.h.

Constructor & Destructor Documentation

CaloTowersDQMClient::CaloTowersDQMClient ( const edm::ParameterSet iConfig)
explicit

Definition at line 12 of file CaloTowersDQMClient.cc.

References debug_, dirName_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), outputFile_, AlCaHLTBitMon_QueryRunRegistry::string, and verbose_.

12  :conf_(iConfig)
13 {
14 
15  outputFile_ = iConfig.getUntrackedParameter<std::string>("outputFile", "myfile.root");
16  debug_ = false;
17  verbose_ = false;
18  dirName_=iConfig.getParameter<std::string>("DQMDirName");
19 
20  }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet conf_
CaloTowersDQMClient::~CaloTowersDQMClient ( )
virtual

Definition at line 23 of file CaloTowersDQMClient.cc.

24 {
25 
26 }

Member Function Documentation

void CaloTowersDQMClient::beginJob ( void  )
overridevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 28 of file CaloTowersDQMClient.cc.

29 {
30 
31 
32 }
void CaloTowersDQMClient::beginRun ( const edm::Run run,
const edm::EventSetup c 
)
overridevirtual

Definition at line 35 of file CaloTowersDQMClient.cc.

36 {
37 
38 }
int CaloTowersDQMClient::CaloTowersEndjob ( const std::vector< MonitorElement * > &  hcalMEs)

Definition at line 43 of file CaloTowersDQMClient.cc.

References gather_cfg::cout, MillePedeFileConverter_cfg::e, objects.autophobj::float, MonitorElement::getEntries(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), mps_fire::i, nevent, and verbose_.

Referenced by dqmEndJob().

43  {
44 
45  int useAllHistos = 0;
46  MonitorElement* Ntowers_vs_ieta =0;
47  MonitorElement* mapEnergy_N =0, *mapEnergy_E =0, *mapEnergy_H =0, *mapEnergy_EH =0;
48  MonitorElement* occupancy_map =0, *occupancy_vs_ieta =0;
49  for(unsigned int ih=0; ih<hcalMEs.size(); ih++){
50  if( strcmp(hcalMEs[ih]->getName().c_str(), "Ntowers_per_event_vs_ieta") ==0 ){
51  Ntowers_vs_ieta = hcalMEs[ih];
52  }
53  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_Nentries") ==0 ){
54  mapEnergy_N = hcalMEs[ih];
55  }
56  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_energy_H") ==0 ){
57  useAllHistos++; mapEnergy_H = hcalMEs[ih];
58  }
59  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_energy_E") ==0 ){
60  useAllHistos++; mapEnergy_E = hcalMEs[ih];
61  }
62  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_energy_EH") ==0 ){
63  useAllHistos++; mapEnergy_EH = hcalMEs[ih];
64  }
65  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_occupancy") ==0 ){
66  occupancy_map = hcalMEs[ih];
67  }
68  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_occupancy_vs_ieta") ==0 ){
69  occupancy_vs_ieta = hcalMEs[ih];
70  }
71 
72  }
73  if( useAllHistos !=0 && useAllHistos !=3 ) return 0;
74 
75  double nevent = mapEnergy_N->getEntries();
76  if(verbose_) std::cout<<"nevent : "<<nevent<<std::endl;
77 
78  // mean number of towers per ieta
79  int nx = Ntowers_vs_ieta->getNbinsX();
80  float cont;
81  float fev = float(nevent);
82 
83  for (int i = 1; i <= nx; i++) {
84  cont = Ntowers_vs_ieta -> getBinContent(i) / fev ;
85  Ntowers_vs_ieta -> setBinContent(i,cont);
86  }
87 
88  // mean energies & occupancies evaluation
89 
90  nx = mapEnergy_N->getNbinsX();
91  int ny = mapEnergy_N->getNbinsY();
92  float cnorm;
93  float phi_factor;
94 
95  for (int i = 1; i <= nx; i++) {
96  float sumphi = 0.;
97 
98  for (int j = 1; j <= ny; j++) {
99 
100  // Emean
101  cnorm = mapEnergy_N -> getBinContent(i,j);
102  //Phi histos are not used in the macros
103  if(cnorm > 0.000001 && useAllHistos) {
104 
105  cont = mapEnergy_E -> getBinContent(i,j) / cnorm ;
106  mapEnergy_E -> setBinContent(i,j,cont);
107 
108  cont = mapEnergy_H -> getBinContent(i,j) / cnorm ;
109  mapEnergy_H -> setBinContent(i,j,cont);
110 
111  cont = mapEnergy_EH -> getBinContent(i,j) / cnorm ;
112  mapEnergy_EH -> setBinContent(i,j,cont);
113  }
114 
115  // Occupancy (needed for occupancy vs ieta)
116  cnorm = occupancy_map -> getBinContent(i,j) / fev;
117  if(cnorm > 1.e-30) occupancy_map -> setBinContent(i,j,cnorm);
118 
119  sumphi += cnorm;
120 
121  } // end of iphy cycle (j)
122 
123  //Occupancy vs ieta histo is drawn
124  // phi-factor evaluation for occupancy_vs_ieta calculation
125  int ieta = i - 42; // -41 -1, 0 40
126  if(ieta >=0 ) ieta +=1; // -41 -1, 1 41 - to make it detector-like
127 
128  if(ieta >= -20 && ieta <= 20 )
129  {phi_factor = 72.;}
130  else {
131  if(ieta >= 40 || ieta <= -40 ) {phi_factor = 18.;}
132  else
133  phi_factor = 36.;
134  }
135  if(ieta >= 0) ieta -= 1; // -41 -1, 0 40 - to bring back to histo num
136 
137  cnorm = sumphi / phi_factor;
138  occupancy_vs_ieta->Fill(double(ieta), cnorm);
139 
140  } // end of ieta cycle (i)
141 
142  return 1;
143 
144 }
double getEntries(void) const
get # of entries
int getNbinsY(void) const
get # of bins in Y-axis
int nevent
Definition: AMPTWrapper.h:74
int getNbinsX(void) const
get # of bins in X-axis
void CaloTowersDQMClient::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 146 of file CaloTowersDQMClient.cc.

References CaloTowersEndjob(), gather_cfg::cout, DEFINE_FWK_MODULE, dirName_, DQMStore::IGetter::getContents(), DQMStore::IGetter::getSubdirs(), mps_fire::i, DQMStore::IGetter::setCurrentFolder(), and verbose_.

147 {
148 
149  igetter.setCurrentFolder(dirName_);
150  if (verbose_) std::cout << "\nrunClient" << std::endl;
151 
152  std::vector<MonitorElement*> hcalMEs;
153 
154  // Since out folders are fixed to three, we can just go over these three folders
155  // i.e., CaloTowersD/CaloTowersTask, HcalRecHitsD/HcalRecHitTask, NoiseRatesV/NoiseRatesTask.
156  std::vector<std::string> fullPathHLTFolders = igetter.getSubdirs();
157  for(unsigned int i=0;i<fullPathHLTFolders.size();i++) {
158 
159  if (verbose_) std::cout <<"\nfullPath: "<< fullPathHLTFolders[i] << std::endl;
160  igetter.setCurrentFolder(fullPathHLTFolders[i]);
161 
162  std::vector<std::string> fullSubPathHLTFolders = igetter.getSubdirs();
163  for(unsigned int j=0;j<fullSubPathHLTFolders.size();j++) {
164 
165  if (verbose_) std::cout <<"fullSub: "<<fullSubPathHLTFolders[j] << std::endl;
166 
167  if( strcmp(fullSubPathHLTFolders[j].c_str(), "CaloTowersD/CaloTowersTask") ==0 ){
168  hcalMEs = igetter.getContents(fullSubPathHLTFolders[j]);
169  if (verbose_) std::cout <<"hltMES size : "<<hcalMEs.size()<<std::endl;
170  if( !CaloTowersEndjob(hcalMEs) ) std::cout<<"\nError in CaloTowersEndjob!"<<std::endl<<std::endl;
171  }
172 
173  }
174 
175  }
176 
177 }
std::vector< MonitorElement * > getContents(Args &&...args)
Definition: DQMStore.h:197
int CaloTowersEndjob(const std::vector< MonitorElement * > &hcalMEs)
std::vector< std::string > getSubdirs(void)
Definition: DQMStore.cc:323
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:347

Member Data Documentation

edm::ParameterSet CaloTowersDQMClient::conf_
private

Definition at line 44 of file CaloTowersDQMClient.h.

bool CaloTowersDQMClient::debug_
private

Definition at line 47 of file CaloTowersDQMClient.h.

Referenced by CaloTowersDQMClient().

std::string CaloTowersDQMClient::dirName_
private

Definition at line 49 of file CaloTowersDQMClient.h.

Referenced by CaloTowersDQMClient(), and dqmEndJob().

std::string CaloTowersDQMClient::dirNameJet_
private

Definition at line 50 of file CaloTowersDQMClient.h.

std::string CaloTowersDQMClient::dirNameMET_
private

Definition at line 51 of file CaloTowersDQMClient.h.

std::string CaloTowersDQMClient::outputFile_
private

Definition at line 43 of file CaloTowersDQMClient.h.

Referenced by CaloTowersDQMClient().

bool CaloTowersDQMClient::verbose_
private

Definition at line 46 of file CaloTowersDQMClient.h.

Referenced by CaloTowersDQMClient(), CaloTowersEndjob(), and dqmEndJob().