CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Private Attributes | Static Private Attributes
GlobalTest Class Reference

#include <GlobalTest.h>

Inheritance diagram for GlobalTest:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
 GlobalTest (const edm::ParameterSet &)
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

MonitorElementcaloEnergyEBH_ [nMaxH]
 
MonitorElementcaloEnergyEEH_ [nMaxH]
 
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfTrackToken_
 
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfVertexToken_
 
std::string filename_
 
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EB_Token_
 
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EE_Token_
 
TFile * histfile_
 
int maxbunch_
 
int minbunch_
 
MonitorElementnrPileupsH_ [nMaxH]
 
MonitorElementnrTracksH_ [nMaxH]
 
MonitorElementnrVerticesH_ [nMaxH]
 
MonitorElementtrackPartIdH_ [nMaxH]
 

Static Private Attributes

static const int nMaxH = 10
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Description: test suite for Mixing Module

Definition at line 43 of file GlobalTest.h.

Constructor & Destructor Documentation

◆ GlobalTest()

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

Definition at line 39 of file GlobalTest.cc.

References gather_cfg::cout, filename_, g4SimHits_EB_Token_, g4SimHits_EE_Token_, ProducerED_cfi::InputTag, maxbunch_, minbunch_, and AlCaHLTBitMon_QueryRunRegistry::string.

40  : filename_(iConfig.getParameter<std::string>("fileName")),
41  minbunch_(iConfig.getParameter<int>("minBunch")),
42  maxbunch_(iConfig.getParameter<int>("maxBunch")),
43  cfTrackToken_(consumes<CrossingFrame<SimTrack>>(iConfig.getParameter<edm::InputTag>("cfTrackTag"))),
44  cfVertexToken_(consumes<CrossingFrame<SimTrack>>(iConfig.getParameter<edm::InputTag>("cfVertexTag"))) {
45  std::string ecalsubdetb("");
46  std::string ecalsubdete("g4SimHitsEcalHitsEE");
47  g4SimHits_EB_Token_ = consumes<CrossingFrame<PCaloHit>>(edm::InputTag("mix", "g4SimHitsEcalHitsEB"));
48  g4SimHits_EE_Token_ = consumes<CrossingFrame<PCaloHit>>(edm::InputTag("mix", "g4SimHitsEcalHitsEE"));
49 
50  std::cout << "Constructed GlobalTest, filename: " << filename_ << " minbunch: " << minbunch_
51  << ", maxbunch: " << maxbunch_ << std::endl;
52 }
int maxbunch_
Definition: GlobalTest.h:53
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
int minbunch_
Definition: GlobalTest.h:52
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EE_Token_
Definition: GlobalTest.h:67
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfTrackToken_
Definition: GlobalTest.h:64
std::string filename_
Definition: GlobalTest.h:51
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfVertexToken_
Definition: GlobalTest.h:65
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EB_Token_
Definition: GlobalTest.h:66

Member Function Documentation

◆ analyze()

void GlobalTest::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 82 of file GlobalTest.cc.

References MixCollection< T >::MixItr::bunch(), caloEnergyEBH_, caloEnergyEEH_, cfTrackToken_, cfVertexToken_, dqm::impl::MonitorElement::Fill(), g4SimHits_EB_Token_, g4SimHits_EE_Token_, mps_fire::i, iEvent, maxbunch_, minbunch_, nrTracksH_, nrVerticesH_, edm::Handle< T >::product(), AlCaHLTBitMon_QueryRunRegistry::string, and trackPartIdH_.

82  {
83  using namespace edm;
84  using namespace std;
85 
86  // Get input
91  std::string ecalsubdetb("g4SimHitsEcalHitsEB");
92  std::string ecalsubdete("g4SimHitsEcalHitsEE");
93  iEvent.getByToken(cfTrackToken_, cf_track);
94  iEvent.getByToken(cfVertexToken_, cf_vertex);
95  iEvent.getByToken(g4SimHits_EB_Token_, cf_calohitB);
96  iEvent.getByToken(g4SimHits_EE_Token_, cf_calohitE);
97 
98  // number of events/bcr ??
99 
100  // number of tracks
101  for (int i = minbunch_; i <= maxbunch_; ++i) {
102  nrTracksH_[i - minbunch_]->Fill(cf_track->getNrPileups(i));
103  }
104 
105  // number of vertices
106  for (int i = minbunch_; i <= maxbunch_; ++i) {
107  nrVerticesH_[i - minbunch_]->Fill(cf_vertex->getNrPileups(i));
108  }
109 
110  // part id for each track
111  std::unique_ptr<MixCollection<SimTrack>> coltr(new MixCollection<SimTrack>(cf_track.product()));
113  for (cfitr = coltr->begin(); cfitr != coltr->end(); cfitr++) {
114  trackPartIdH_[cfitr.bunch() - minbunch_]->Fill(cfitr->type());
115  }
116 
117  // energy sum
118  double sumE[10] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
119  std::unique_ptr<MixCollection<PCaloHit>> colecalb(new MixCollection<PCaloHit>(cf_calohitB.product()));
121  for (cfiecalb = colecalb->begin(); cfiecalb != colecalb->end(); cfiecalb++) {
122  sumE[cfiecalb.bunch() - minbunch_] += cfiecalb->energy();
123  // if (cfiecal.getTrigger()) tofecalhist_sig->Fill(cfiecal->time());
124  // else tofecalhist->Fill(cfiecal->time());
125  }
126  for (int i = minbunch_; i <= maxbunch_; ++i) {
127  caloEnergyEBH_[i - minbunch_]->Fill(sumE[i - minbunch_]);
128  }
129  double sumEE[10] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
130  std::unique_ptr<MixCollection<PCaloHit>> colecale(new MixCollection<PCaloHit>(cf_calohitE.product()));
132  for (cfiecale = colecale->begin(); cfiecale != colecale->end(); cfiecale++) {
133  sumEE[cfiecale.bunch() - minbunch_] += cfiecale->energy();
134  // if (cfiecal.getTrigger()) tofecalhist_sig->Fill(cfiecal->time());
135  // else tofecalhist->Fill(cfiecal->time());
136  }
137  for (int i = minbunch_; i <= maxbunch_; ++i) {
138  caloEnergyEEH_[i - minbunch_]->Fill(sumEE[i - minbunch_]);
139  }
140 }
int maxbunch_
Definition: GlobalTest.h:53
MonitorElement * caloEnergyEEH_[nMaxH]
Definition: GlobalTest.h:62
T const * product() const
Definition: Handle.h:70
int minbunch_
Definition: GlobalTest.h:52
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EE_Token_
Definition: GlobalTest.h:67
MonitorElement * trackPartIdH_[nMaxH]
Definition: GlobalTest.h:60
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfTrackToken_
Definition: GlobalTest.h:64
MonitorElement * caloEnergyEBH_[nMaxH]
Definition: GlobalTest.h:61
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
MonitorElement * nrTracksH_[nMaxH]
Definition: GlobalTest.h:59
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfVertexToken_
Definition: GlobalTest.h:65
MonitorElement * nrVerticesH_[nMaxH]
Definition: GlobalTest.h:58
HLT enums.
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EB_Token_
Definition: GlobalTest.h:66

◆ bookHistograms()

void GlobalTest::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 54 of file GlobalTest.cc.

References dqm::implementation::IBooker::book1D(), caloEnergyEBH_, caloEnergyEEH_, dqm-mbProfile::format, mps_fire::i, cuy::ii, label, maxbunch_, minbunch_, nrPileupsH_, nrTracksH_, nrVerticesH_, dqm::implementation::NavigatorBase::setCurrentFolder(), and trackPartIdH_.

54  {
55  using namespace std;
56 
57  ibooker.setCurrentFolder("MixingV/Mixing");
58  // book histos
59 
60  for (int i = minbunch_; i <= maxbunch_; ++i) {
61  int ii = i - minbunch_;
62  auto label = fmt::format("NrPileupEvts_{}", i);
63  nrPileupsH_[ii] = ibooker.book1D(label, label, 100, 0, 100);
64  label = fmt::format("NrVertices_{}", i);
65  nrVerticesH_[ii] = ibooker.book1D(label, label, 100, 0, 5000);
66  label = fmt::format("NrTracks_{}", i);
67  nrTracksH_[ii] = ibooker.book1D(label, label, 100, 0, 10000);
68  label = fmt::format("TrackPartId", i);
69  trackPartIdH_[ii] = ibooker.book1D(label, label, 100, 0, 100);
70  label = fmt::format("CaloEnergyEB", i);
71  caloEnergyEBH_[ii] = ibooker.book1D(label, label, 100, 0., 1000.);
72  label = fmt::format("CaloEnergyEE", i);
73  caloEnergyEEH_[ii] = ibooker.book1D(label, label, 100, 0., 1000.);
74  }
75 }
int maxbunch_
Definition: GlobalTest.h:53
MonitorElement * caloEnergyEEH_[nMaxH]
Definition: GlobalTest.h:62
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
int minbunch_
Definition: GlobalTest.h:52
MonitorElement * trackPartIdH_[nMaxH]
Definition: GlobalTest.h:60
MonitorElement * caloEnergyEBH_[nMaxH]
Definition: GlobalTest.h:61
char const * label
MonitorElement * nrPileupsH_[nMaxH]
Definition: GlobalTest.h:57
MonitorElement * nrTracksH_[nMaxH]
Definition: GlobalTest.h:59
ii
Definition: cuy.py:589
MonitorElement * nrVerticesH_[nMaxH]
Definition: GlobalTest.h:58
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

Member Data Documentation

◆ caloEnergyEBH_

MonitorElement* GlobalTest::caloEnergyEBH_[nMaxH]
private

Definition at line 61 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

◆ caloEnergyEEH_

MonitorElement* GlobalTest::caloEnergyEEH_[nMaxH]
private

Definition at line 62 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

◆ cfTrackToken_

edm::EDGetTokenT<CrossingFrame<SimTrack> > GlobalTest::cfTrackToken_
private

Definition at line 64 of file GlobalTest.h.

Referenced by analyze().

◆ cfVertexToken_

edm::EDGetTokenT<CrossingFrame<SimTrack> > GlobalTest::cfVertexToken_
private

Definition at line 65 of file GlobalTest.h.

Referenced by analyze().

◆ filename_

std::string GlobalTest::filename_
private

Definition at line 51 of file GlobalTest.h.

Referenced by GlobalTest().

◆ g4SimHits_EB_Token_

edm::EDGetTokenT<CrossingFrame<PCaloHit> > GlobalTest::g4SimHits_EB_Token_
private

Definition at line 66 of file GlobalTest.h.

Referenced by analyze(), and GlobalTest().

◆ g4SimHits_EE_Token_

edm::EDGetTokenT<CrossingFrame<PCaloHit> > GlobalTest::g4SimHits_EE_Token_
private

Definition at line 67 of file GlobalTest.h.

Referenced by analyze(), and GlobalTest().

◆ histfile_

TFile* GlobalTest::histfile_
private

Definition at line 54 of file GlobalTest.h.

◆ maxbunch_

int GlobalTest::maxbunch_
private

Definition at line 53 of file GlobalTest.h.

Referenced by analyze(), bookHistograms(), and GlobalTest().

◆ minbunch_

int GlobalTest::minbunch_
private

Definition at line 52 of file GlobalTest.h.

Referenced by analyze(), bookHistograms(), and GlobalTest().

◆ nMaxH

const int GlobalTest::nMaxH = 10
staticprivate

Definition at line 56 of file GlobalTest.h.

◆ nrPileupsH_

MonitorElement* GlobalTest::nrPileupsH_[nMaxH]
private

Definition at line 57 of file GlobalTest.h.

Referenced by bookHistograms().

◆ nrTracksH_

MonitorElement* GlobalTest::nrTracksH_[nMaxH]
private

Definition at line 59 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

◆ nrVerticesH_

MonitorElement* GlobalTest::nrVerticesH_[nMaxH]
private

Definition at line 58 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

◆ trackPartIdH_

MonitorElement* GlobalTest::trackPartIdH_[nMaxH]
private

Definition at line 60 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().