CMS 3D CMS Logo

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

#include <CaloTowersClient.h>

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

Public Member Functions

void beginJob (void) override
 
 CaloTowersClient (const edm::ParameterSet &)
 
int CaloTowersEndjob (const std::vector< MonitorElement * > &hcalMEs)
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
 ~CaloTowersClient () override
 
- Public Member Functions inherited from DQMEDHarvester
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 DQMEDHarvester ()
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
void endJob () final
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &, edm::EventSetup const &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- 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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) 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
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
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)
 
- Protected Attributes inherited from DQMEDHarvester
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 37 of file CaloTowersClient.h.

Constructor & Destructor Documentation

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

Definition at line 11 of file CaloTowersClient.cc.

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

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

Definition at line 22 of file CaloTowersClient.cc.

23 {
24 
25 }

Member Function Documentation

void CaloTowersClient::beginJob ( void  )
overridevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 27 of file CaloTowersClient.cc.

28 {
29 
30 
31 }
int CaloTowersClient::CaloTowersEndjob ( const std::vector< MonitorElement * > &  hcalMEs)

Definition at line 69 of file CaloTowersClient.cc.

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

Referenced by dqmEndJob().

69  {
70 
71  int useAllHistos = 0;
72  MonitorElement* Ntowers_vs_ieta =nullptr;
73  MonitorElement* mapEnergy_N =nullptr, *mapEnergy_E =nullptr, *mapEnergy_H =nullptr, *mapEnergy_EH =nullptr;
74  MonitorElement* occupancy_map =nullptr, *occupancy_vs_ieta =nullptr;
75  for(unsigned int ih=0; ih<hcalMEs.size(); ih++){
76  if( strcmp(hcalMEs[ih]->getName().c_str(), "Ntowers_per_event_vs_ieta") ==0 ){
77  Ntowers_vs_ieta = hcalMEs[ih];
78  }
79  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_Nentries") ==0 ){
80  mapEnergy_N = hcalMEs[ih];
81  }
82  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_energy_H") ==0 ){
83  useAllHistos++; mapEnergy_H = hcalMEs[ih];
84  }
85  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_energy_E") ==0 ){
86  useAllHistos++; mapEnergy_E = hcalMEs[ih];
87  }
88  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_energy_EH") ==0 ){
89  useAllHistos++; mapEnergy_EH = hcalMEs[ih];
90  }
91  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_occupancy") ==0 ){
92  occupancy_map = hcalMEs[ih];
93  }
94  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_occupancy_vs_ieta") ==0 ){
95  occupancy_vs_ieta = hcalMEs[ih];
96  }
97 
98  }
99  if( useAllHistos !=0 && useAllHistos !=3 ) return 0;
100 
101  double nevent = mapEnergy_N->getEntries();
102  if(verbose_) std::cout<<"nevent : "<<nevent<<std::endl;
103 
104  // mean number of towers per ieta
105  int nx = Ntowers_vs_ieta->getNbinsX();
106  float cont;
107  float econt;
108  float fev = float(nevent);
109 
110  for (int i = 1; i <= nx; i++) {
111  cont = Ntowers_vs_ieta -> getBinContent(i) / fev ;
112  econt = Ntowers_vs_ieta -> getBinError(i) / fev ;
113  Ntowers_vs_ieta -> setBinContent(i,cont);
114  Ntowers_vs_ieta -> setBinError(i,econt);
115  }
116 
117  // mean energies & occupancies evaluation
118 
119  nx = mapEnergy_N->getNbinsX();
120  int ny = mapEnergy_N->getNbinsY();
121  float cnorm;
122  float enorm;
123  float phi_factor;
124 
125  for (int i = 1; i <= nx; i++) {
126  float sumphi = 0.;
127  float sumphie = 0.;
128 
129  for (int j = 1; j <= ny; j++) {
130 
131  // Emean
132  cnorm = mapEnergy_N -> getBinContent(i,j);
133  //Phi histos are not used in the macros
134  if(cnorm > 0.000001 && useAllHistos) {
135 
136  cont = mapEnergy_E -> getBinContent(i,j) / cnorm ;
137  econt = mapEnergy_E -> getBinError(i,j) / cnorm;
138  mapEnergy_E -> setBinContent(i,j,cont);
139  mapEnergy_E -> setBinError(i,j,econt);
140 
141 
142  cont = mapEnergy_H -> getBinContent(i,j) / cnorm ;
143  econt = mapEnergy_H -> getBinError(i,j) / cnorm;
144  mapEnergy_H -> setBinContent(i,j,cont);
145  mapEnergy_H -> setBinError(i,j,econt);
146 
147  cont = mapEnergy_EH -> getBinContent(i,j) / cnorm ;
148  econt = mapEnergy_EH -> getBinError(i,j) / cnorm;
149  mapEnergy_EH -> setBinContent(i,j,cont);
150  mapEnergy_EH -> setBinError(i,j,econt);
151  }
152 
153 
154  // Occupancy (needed for occupancy vs ieta)
155  cnorm = occupancy_map -> getBinContent(i,j) / fev;
156  enorm = occupancy_map -> getBinError(i,j) / fev;
157  if(cnorm > 1.e-30) occupancy_map -> setBinContent(i,j,cnorm);
158 
159  sumphi += cnorm;
160  sumphie += enorm*enorm;
161 
162  } // end of iphy cycle (j)
163 
164  //Occupancy vs ieta histo is drawn
165  // phi-factor evaluation for occupancy_vs_ieta calculation
166  int ieta = i - 42; // -41,-1,1,41
167  if(ieta >= -20 && ieta <= 20 )
168  {phi_factor = 72.;}
169  else {
170  if(ieta >= 40 || ieta <= -40 ) {phi_factor = 18.;}
171  else
172  phi_factor = 36.;
173  }
174 
175  cnorm = sumphi / phi_factor;
176  enorm = sqrt(sumphie) / phi_factor;
177  occupancy_vs_ieta->setBinContent(i, cnorm);
178  occupancy_vs_ieta->setBinError(i,enorm);
179 
180  } // end of ieta cycle (i)
181 
182  return 1;
183 
184 }
int nevent
Definition: AMPTWrapper.h:74
T sqrt(T t)
Definition: SSEVec.h:18
double getEntries() const
get # of entries
int getNbinsY() const
get # of bins in Y-axis
int getNbinsX() const
get # of bins in X-axis
void CaloTowersClient::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 34 of file CaloTowersClient.cc.

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

35 {
36  igetter.setCurrentFolder(dirName_);
37 
38  if (verbose_) std::cout << "\nrunClient" << std::endl;
39 
40  std::vector<MonitorElement*> hcalMEs;
41 
42  // Since out folders are fixed to three, we can just go over these three folders
43  // i.e., CaloTowersV/CaloTowersTask, HcalRecHitsV/HcalRecHitTask, NoiseRatesV/NoiseRatesTask.
44  std::vector<std::string> fullPathHLTFolders = igetter.getSubdirs();
45  for(unsigned int i=0;i<fullPathHLTFolders.size();i++) {
46 
47  if (verbose_) std::cout <<"\nfullPath: "<< fullPathHLTFolders[i] << std::endl;
48  igetter.setCurrentFolder(fullPathHLTFolders[i]);
49 
50  std::vector<std::string> fullSubPathHLTFolders = igetter.getSubdirs();
51  for(unsigned int j=0;j<fullSubPathHLTFolders.size();j++) {
52 
53  if (verbose_) std::cout <<"fullSub: "<<fullSubPathHLTFolders[j] << std::endl;
54 
55  if( strcmp(fullSubPathHLTFolders[j].c_str(), "CaloTowersV/CaloTowersTask") ==0 ){
56  hcalMEs = igetter.getContents(fullSubPathHLTFolders[j]);
57  if (verbose_) std::cout <<"hltMES size : "<<hcalMEs.size()<<std::endl;
58  if( !CaloTowersEndjob(hcalMEs) ) std::cout<<"\nError in CaloTowersEndjob!"<<std::endl<<std::endl;
59  }
60 
61  }
62 
63  }
64 
65 }
std::vector< MonitorElement * > getContents(Args &&...args)
Definition: DQMStore.h:305
int CaloTowersEndjob(const std::vector< MonitorElement * > &hcalMEs)
std::string dirName_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:344
std::vector< std::string > getSubdirs()
Definition: DQMStore.cc:320

Member Data Documentation

edm::ParameterSet CaloTowersClient::conf_
private

Definition at line 42 of file CaloTowersClient.h.

bool CaloTowersClient::debug_
private

Definition at line 45 of file CaloTowersClient.h.

Referenced by CaloTowersClient().

std::string CaloTowersClient::dirName_
private

Definition at line 47 of file CaloTowersClient.h.

Referenced by CaloTowersClient(), and dqmEndJob().

std::string CaloTowersClient::dirNameJet_
private

Definition at line 48 of file CaloTowersClient.h.

std::string CaloTowersClient::dirNameMET_
private

Definition at line 49 of file CaloTowersClient.h.

std::string CaloTowersClient::outputFile_
private

Definition at line 40 of file CaloTowersClient.h.

Referenced by CaloTowersClient().

bool CaloTowersClient::verbose_
private

Definition at line 44 of file CaloTowersClient.h.

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