CMS 3D CMS Logo

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

#include <DQMSourceExample.h>

Inheritance diagram for DQMSourceExample:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 DQMSourceExample (const edm::ParameterSet &)
 
 ~DQMSourceExample () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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)
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
void beginJob () override
 
void beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
 
void beginRun (const edm::Run &r, const edm::EventSetup &c) override
 
void endJob () override
 
void endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
 
void endRun (const edm::Run &r, const edm::EventSetup &c) override
 
- 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)
 

Private Member Functions

void initialize ()
 

Private Attributes

int counterEvt_
 
int counterLS_
 
DQMStoredbe_
 
MonitorElementdeadFalse
 
MonitorElementdeadTrue
 
MonitorElementf1
 
MonitorElementh1
 
MonitorElementh1hist
 
MonitorElementh2
 
MonitorElementh3
 
MonitorElementh4
 
MonitorElementi1
 
MonitorElementmeanFalse
 
MonitorElementmeanTrue
 
std::string monitorName_
 
int NBINS
 
MonitorElementnoisyFalse
 
MonitorElementnoisyTrue
 
MonitorElementp1
 
MonitorElementp2
 
edm::ParameterSet parameters_
 
int prescaleEvt_
 
int prescaleLS_
 
MonitorElements1
 
MonitorElementsumm
 
MonitorElementwExpFalse
 
MonitorElementwExpTrue
 
MonitorElementxFalse
 
float XMAX
 
float XMIN
 
MonitorElementxTrue
 
MonitorElementyFalse
 
MonitorElementyTrue
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Detailed Description

Definition at line 21 of file DQMSourceExample.h.

Constructor & Destructor Documentation

DQMSourceExample::DQMSourceExample ( const edm::ParameterSet ps)

Definition at line 22 of file DQMSourceExample.cc.

References initialize().

22  {
23  parameters_ = ps;
24  initialize();
25 }
edm::ParameterSet parameters_
DQMSourceExample::~DQMSourceExample ( )
override

Definition at line 27 of file DQMSourceExample.cc.

27  {
28 }

Member Function Documentation

void DQMSourceExample::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotected

Definition at line 159 of file DQMSourceExample.cc.

References gather_cfg::cout, connectstrParser::f1, mps_fire::i, cmsBatch::log, p1, p2, and w.

159  {
160  counterEvt_++;
161  if (prescaleEvt_<1) return;
162  if (prescaleEvt_ > 0 && counterEvt_%prescaleEvt_!=0) return;
163  // cout << " processing conterEvt_: " << counterEvt_ <<endl;
164 
165  // fill integer and float
166 // number exceeding 32 bits
167  i1->Fill(400000000000000LL); // FIXME use double
168  f1->Fill(-3.14);
169 
170  //----------------------------------------
171  // Filling the histograms with random data
172  //----------------------------------------
173 
174  srand( 0 );
175  // fill summ histo
176  if(counterEvt_%1000 == 0) {
177  cout << " # of events = " << counterEvt_ << endl;
178  summ->Fill(counterEvt_/1000., counterEvt_);
179  }
180  // fill summ histo
181  if(counterEvt_%100 == 0) {
182  h1hist->ShiftFillLast(gRandom->Gaus(12,1.),1.,5);
183  }
184 
185  float z = gRandom->Uniform(XMAX);
186  xTrue->Fill( z, 1./log(z+1.) );
187  xFalse->Fill( z+(XMAX/2.), z );
188  yTrue->Fill( z, 1./log(z+1.) );
189  yFalse->Fill( z, z );
190  meanTrue->Fill( gRandom->Gaus(10, 2), 1.);
191  meanFalse->Fill( gRandom->Gaus(12, 3), 1.);
192  wExpTrue->Fill( gRandom->Gaus(12, 1), gRandom->Gaus(12, 1), 1.);
193  wExpFalse->Fill( gRandom->Gaus(20, 2), gRandom->Gaus(20, 2), 1.);
194  deadTrue->Fill( gRandom->Gaus(20, 10), 2.);
195  deadFalse->Fill( gRandom->Gaus(20, 4), 1.);
196  h2->Fill( gRandom->Gaus(20, 4), 1.);
197 // h3->Fill( XMIN, 0xffff00000000LL);
198 // h4->Fill( XMIN, XMIN, 0xffff00000000LL);
199 
200  //h1hist->Print();
201  //h1hist->Print();
202 
203  for ( int i = 0; i != 10; ++i ) {
204  float w = gRandom->Uniform(XMAX);
205  noisyTrue->Fill( w, 1.);
206  noisyFalse->Fill( z, 1.);
207  float x = gRandom->Gaus(12, 1);
208  float y = gRandom->Gaus(20, 2);
209  p1->Fill(x, y);
210  p2->Fill(x, y, (x+y)/2.);
211  h1->Fill(y, 1.);
212  }
213 
214  // usleep(100);
215 
216 }
MonitorElement * deadTrue
const double w
Definition: UKUtility.cc:23
MonitorElement * xTrue
MonitorElement * wExpFalse
MonitorElement * xFalse
MonitorElement * yFalse
MonitorElement * h2
MonitorElement * i1
MonitorElement * summ
void Fill(long long x)
void ShiftFillLast(double y, double ye=0., int32_t xscale=1)
MonitorElement * h1hist
MonitorElement * meanTrue
MonitorElement * noisyTrue
MonitorElement * h1
MonitorElement * noisyFalse
MonitorElement * deadFalse
MonitorElement * f1
MonitorElement * p1
MonitorElement * wExpTrue
MonitorElement * yTrue
MonitorElement * meanFalse
MonitorElement * p2
void DQMSourceExample::beginJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 60 of file DQMSourceExample.cc.

References dbe_, connectstrParser::f1, mps_fire::i, NBINS, Utilities::operator, p1, p2, and groupFilesInBlocks::temp.

60  {
63 
65  dbe_->setCurrentFolder(monitorName_+"DQMsource/Summary");
66  summ = dbe_->book1D("summary", "Run Summary", 100, 0, 100);
67 
68  //-------------------------------------
69  // testing of Quality Tests
70  //-------------------------------------
71 
73  dbe_->setCurrentFolder(monitorName_+"DQMsource/QTests");
74 
76  NBINS = 40 ; XMIN = 0.; XMAX = 40.;
77 
81  xTrue = dbe_->book1D("XTrue", "X Range QTest", NBINS, XMIN, XMAX);
82  xFalse = dbe_->book1D("XFalse", "X Range QTest", NBINS, XMIN, XMAX);
83  yTrue = dbe_->book1D("YTrue", "Y Range QTest", NBINS, XMIN, XMAX);
84  yFalse = dbe_->book1D("YFalse", "Y Range QTest", NBINS, XMIN, XMAX);
85  wExpTrue = dbe_->book2D("WExpTrue", "Contents Within Expected QTest", NBINS, XMIN, XMAX, NBINS, XMIN, XMAX);
86  wExpFalse = dbe_->book2D("WExpFalse", "Contents Within Expected QTest", NBINS, XMIN, XMAX, NBINS, XMIN, XMAX);
87  meanTrue = dbe_->book1D("MeanTrue", "Mean Within Expected QTest", NBINS, XMIN, XMAX);
88  meanFalse = dbe_->book1D("MeanFalse", "Mean Within Expected QTest", NBINS, XMIN, XMAX);
89  deadTrue = dbe_->book1D("DeadTrue", "Dead Channel QTest", NBINS, XMIN, XMAX);
90  deadFalse = dbe_->book1D("DeadFalse", "Dead Channel QTest", NBINS, XMIN, XMAX);
91  noisyTrue = dbe_->book1D("NoisyTrue", "Noisy Channel QTest", NBINS, XMIN, XMAX);
92  noisyFalse = dbe_->book1D("NoisyFalse", "Noisy Channel QTest", NBINS, XMIN, XMAX);
93 
94 
95  //-------------------------------------
96  // book several ME more
97  //-------------------------------------
98 
100  dbe_->setCurrentFolder(monitorName_+"DQMsource/C1");
101  const int NBINS2 = 10;
102 
103  i1 = dbe_->bookInt("int1");
104  f1 = dbe_->bookFloat("float1");
105  s1 = dbe_->bookString("s1", "My string");
106  h1 = dbe_->book1D("h1f", "Example TH1F 1D histogram.", NBINS2, XMIN, XMAX);
107  h2 = dbe_->book1S("h1s", "Example TH1S histogram.", NBINS, XMIN, XMAX);
108 // h3 = dbe_->book1DD("h1d", "Example TH1D histogram.", NBINS, XMIN, XMAX);
109 // h4 = dbe_->book2DD("h2d", "Example TH2D histogram.", NBINS, XMIN, XMAX,NBINS, XMIN, XMAX);
110  p1 = dbe_->bookProfile( "prof1", "My profile 1D", NBINS,XMIN,XMAX,NBINS,XMIN,XMAX,"");
111  p2 = dbe_->bookProfile2D("prof2", "My profile 2D", NBINS,XMIN,XMAX,NBINS,XMIN,XMAX,NBINS,XMIN,XMAX,"");
112  h1hist = dbe_->book1D("history 1D","Example 1 1D history plot", 30, 0.,30.);
113 
114  // set labels for h1
115  char temp[1024];
116  for(int i = 1; i <= NBINS2; ++i) {
117  sprintf(temp, " bin no. %d", i);
118  h1->setBinLabel(i, temp);
119  }
120 
121  // assign tag to MEs h1
122  const unsigned int detector_id = 17;
123  dbe_->tag(h1, detector_id);
124 
125  // tag full directory
126  dbe_->tagContents(monitorName_+"DQMsource/C1", detector_id);
127 
128  /*
129  // contents of h5 & h6 will be reset at end of monitoring cycle
130  h5->setResetMe(true);
131  h6->setResetMe(true);
132  dbe_->showDirStructure();
133  std::vector<std::string> tags;
134  for (size_t i = 0, e = tags.size(); i < e; ++i)
135  std::cout << "TAGS [" << i << "] = " << tags[i] << std::endl;
136  */
137 
138  dbe_->showDirStructure ();
139 }
MonitorElement * deadTrue
MonitorElement * xTrue
MonitorElement * s1
MonitorElement * wExpFalse
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * xFalse
MonitorElement * yFalse
MonitorElement * h2
MonitorElement * i1
MonitorElement * summ
MonitorElement * h1hist
MonitorElement * meanTrue
MonitorElement * noisyTrue
MonitorElement * h1
MonitorElement * noisyFalse
MonitorElement * deadFalse
MonitorElement * f1
MonitorElement * p1
MonitorElement * wExpTrue
std::string monitorName_
MonitorElement * yTrue
MonitorElement * meanFalse
MonitorElement * p2
void DQMSourceExample::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
)
overrideprotected

Definition at line 151 of file DQMSourceExample.cc.

152  {
153 }
void DQMSourceExample::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
overrideprotected

Definition at line 144 of file DQMSourceExample.cc.

144  {
145 }
void DQMSourceExample::endJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 236 of file DQMSourceExample.cc.

References gather_cfg::cout.

236  {
237  std::cout << "DQMSourceExample::endJob()" << std::endl;
238 }
void DQMSourceExample::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
)
overrideprotected

Definition at line 221 of file DQMSourceExample.cc.

222  {
223 
224 }
void DQMSourceExample::endRun ( const edm::Run r,
const edm::EventSetup c 
)
overrideprotected

Definition at line 229 of file DQMSourceExample.cc.

229  {
230 
231 }
void DQMSourceExample::initialize ( )
private

Definition at line 33 of file DQMSourceExample.cc.

References gather_cfg::cout, dbe_, and Utilities::operator.

33  {
34 
36  counterEvt_ = 0; counterLS_ = 0;
37 
40 
42  monitorName_ = parameters_.getUntrackedParameter<string>("monitorName","YourSubsystemName");
43  cout << "DQMSourceExample: Monitor name = " << monitorName_ << endl;
44  if (!monitorName_.empty() ) monitorName_ = monitorName_+"/" ;
45 
47  prescaleLS_ = parameters_.getUntrackedParameter<int>("prescaleLS", -1);
48  cout << "DQMSourceExample: DQM lumi section prescale = " << prescaleLS_ << " lumi section(s)"<< endl;
49  prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", -1);
50  cout << "DQMSourceExample: DQM event prescale = " << prescaleEvt_ << " events(s)"<< endl;
51 
52 // read in files (use DQMStore.collateHistograms = True for summing
53 // dbe_->load("ref.root");
54 // dbe_->load("ref.root");
55 }
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet parameters_
std::string monitorName_

Member Data Documentation

int DQMSourceExample::counterEvt_
private

Definition at line 59 of file DQMSourceExample.h.

int DQMSourceExample::counterLS_
private

Definition at line 60 of file DQMSourceExample.h.

DQMStore* DQMSourceExample::dbe_
private

Definition at line 56 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::deadFalse
private

Definition at line 82 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::deadTrue
private

Definition at line 81 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::f1
private

Definition at line 88 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::h1
private
MonitorElement* DQMSourceExample::h1hist
private

Definition at line 93 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::h2
private
MonitorElement* DQMSourceExample::h3
private

Definition at line 95 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::h4
private

Definition at line 96 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::i1
private

Definition at line 87 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::meanFalse
private

Definition at line 79 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::meanTrue
private

Definition at line 78 of file DQMSourceExample.h.

std::string DQMSourceExample::monitorName_
private

Definition at line 57 of file DQMSourceExample.h.

int DQMSourceExample::NBINS
private

Definition at line 67 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::noisyFalse
private

Definition at line 84 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::noisyTrue
private

Definition at line 83 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::p1
private

Definition at line 90 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::p2
private

Definition at line 91 of file DQMSourceExample.h.

edm::ParameterSet DQMSourceExample::parameters_
private
int DQMSourceExample::prescaleEvt_
private

Definition at line 62 of file DQMSourceExample.h.

int DQMSourceExample::prescaleLS_
private

Definition at line 63 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::s1
private

Definition at line 89 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::summ
private

Definition at line 97 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::wExpFalse
private

Definition at line 77 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::wExpTrue
private

Definition at line 76 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::xFalse
private

Definition at line 72 of file DQMSourceExample.h.

float DQMSourceExample::XMAX
private

Definition at line 68 of file DQMSourceExample.h.

float DQMSourceExample::XMIN
private

Definition at line 68 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::xTrue
private

Definition at line 71 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::yFalse
private

Definition at line 74 of file DQMSourceExample.h.

MonitorElement* DQMSourceExample::yTrue
private

Definition at line 73 of file DQMSourceExample.h.