CMS 3D CMS Logo

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 &)
 
 ~GlobalTest () override
 
- 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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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_
 
char * labels [nrHistos]
 
int maxbunch_
 
int minbunch_
 
MonitorElementnrPileupsH_ [nMaxH]
 
MonitorElementnrTracksH_ [nMaxH]
 
MonitorElementnrVerticesH_ [nMaxH]
 
MonitorElementtrackPartIdH_ [nMaxH]
 

Static Private Attributes

const static int nMaxH = 10
 
const static int nrHistos = 6
 

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 >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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 38 of file GlobalTest.cc.

39  : filename_(iConfig.getParameter<std::string>("fileName")),
40  minbunch_(iConfig.getParameter<int>("minBunch")),
41  maxbunch_(iConfig.getParameter<int>("maxBunch")),
42  cfTrackToken_(consumes<CrossingFrame<SimTrack>>(iConfig.getParameter<edm::InputTag>("cfTrackTag"))),
43  cfVertexToken_(consumes<CrossingFrame<SimTrack>>(iConfig.getParameter<edm::InputTag>("cfVertexTag"))) {
44  std::string ecalsubdetb("");
45  std::string ecalsubdete("g4SimHitsEcalHitsEE");
46  g4SimHits_EB_Token_ = consumes<CrossingFrame<PCaloHit>>(edm::InputTag("mix", "g4SimHitsEcalHitsEB"));
47  g4SimHits_EE_Token_ = consumes<CrossingFrame<PCaloHit>>(edm::InputTag("mix", "g4SimHitsEcalHitsEE"));
48 
49  std::cout << "Constructed GlobalTest, filename: " << filename_ << " minbunch: " << minbunch_
50  << ", maxbunch: " << maxbunch_ << std::endl;
51 }

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

◆ ~GlobalTest()

GlobalTest::~GlobalTest ( )
override

Definition at line 53 of file GlobalTest.cc.

53  {
54  for (int i = 0; i < 6; i++)
55  delete[] labels[i];
56 }

References mps_fire::i, and labels.

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 113 of file GlobalTest.cc.

113  {
114  using namespace edm;
115  using namespace std;
116 
117  // Get input
122  std::string ecalsubdetb("g4SimHitsEcalHitsEB");
123  std::string ecalsubdete("g4SimHitsEcalHitsEE");
124  iEvent.getByToken(cfTrackToken_, cf_track);
125  iEvent.getByToken(cfVertexToken_, cf_vertex);
126  iEvent.getByToken(g4SimHits_EB_Token_, cf_calohitB);
127  iEvent.getByToken(g4SimHits_EE_Token_, cf_calohitE);
128 
129  // number of events/bcr ??
130 
131  // number of tracks
132  for (int i = minbunch_; i <= maxbunch_; ++i) {
133  nrTracksH_[i - minbunch_]->Fill(cf_track->getNrPileups(i));
134  }
135 
136  // number of vertices
137  for (int i = minbunch_; i <= maxbunch_; ++i) {
138  nrVerticesH_[i - minbunch_]->Fill(cf_vertex->getNrPileups(i));
139  }
140 
141  // part id for each track
142  std::unique_ptr<MixCollection<SimTrack>> coltr(new MixCollection<SimTrack>(cf_track.product()));
144  for (cfitr = coltr->begin(); cfitr != coltr->end(); cfitr++) {
145  trackPartIdH_[cfitr.bunch() - minbunch_]->Fill(cfitr->type());
146  }
147 
148  // energy sum
149  double sumE[10] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
150  std::unique_ptr<MixCollection<PCaloHit>> colecalb(new MixCollection<PCaloHit>(cf_calohitB.product()));
152  for (cfiecalb = colecalb->begin(); cfiecalb != colecalb->end(); cfiecalb++) {
153  sumE[cfiecalb.bunch() - minbunch_] += cfiecalb->energy();
154  // if (cfiecal.getTrigger()) tofecalhist_sig->Fill(cfiecal->time());
155  // else tofecalhist->Fill(cfiecal->time());
156  }
157  for (int i = minbunch_; i <= maxbunch_; ++i) {
158  caloEnergyEBH_[i - minbunch_]->Fill(sumE[i - minbunch_]);
159  }
160  double sumEE[10] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
161  std::unique_ptr<MixCollection<PCaloHit>> colecale(new MixCollection<PCaloHit>(cf_calohitE.product()));
163  for (cfiecale = colecale->begin(); cfiecale != colecale->end(); cfiecale++) {
164  sumEE[cfiecale.bunch() - minbunch_] += cfiecale->energy();
165  // if (cfiecal.getTrigger()) tofecalhist_sig->Fill(cfiecal->time());
166  // else tofecalhist->Fill(cfiecal->time());
167  }
168  for (int i = minbunch_; i <= maxbunch_; ++i) {
169  caloEnergyEEH_[i - minbunch_]->Fill(sumEE[i - minbunch_]);
170  }
171 }

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_.

◆ bookHistograms()

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

Implements DQMEDAnalyzer.

Definition at line 58 of file GlobalTest.cc.

58  {
59  using namespace std;
60 
61  ibooker.setCurrentFolder("MixingV/Mixing");
62  // book histos
63  std::string NrPileupEvts = "NrPileupEvts";
64  size_t NrPileupEvtsSize = NrPileupEvts.size() + 1;
65  std::string NrVertices = "NrVertices";
66  size_t NrVerticesSize = NrVertices.size() + 1;
67  std::string NrTracks = "NrTracks";
68  size_t NrTracksSize = NrTracks.size() + 1;
69  std::string TrackPartId = "TrackPartId";
70  size_t TrackPartIdSize = TrackPartId.size() + 1;
71  std::string CaloEnergyEB = "CaloEnergyEB";
72  size_t CaloEnergyEBSize = CaloEnergyEB.size() + 1;
73  std::string CaloEnergyEE = "CaloEnergyEE";
74  size_t CaloEnergyEESize = CaloEnergyEE.size() + 1;
75 
76  labels[0] = new char[NrPileupEvtsSize];
77  strncpy(labels[0], NrPileupEvts.c_str(), NrPileupEvtsSize);
78  labels[1] = new char[NrVerticesSize];
79  strncpy(labels[1], NrVertices.c_str(), NrVerticesSize);
80  labels[2] = new char[NrTracksSize];
81  strncpy(labels[2], NrTracks.c_str(), NrTracksSize);
82  labels[3] = new char[TrackPartIdSize];
83  strncpy(labels[3], TrackPartId.c_str(), TrackPartIdSize);
84  labels[4] = new char[CaloEnergyEBSize];
85  strncpy(labels[4], CaloEnergyEB.c_str(), CaloEnergyEBSize);
86  labels[5] = new char[CaloEnergyEESize];
87  strncpy(labels[5], CaloEnergyEE.c_str(), CaloEnergyEESize);
88 
89  // FIXME: test for max nr of histos
90  for (int i = minbunch_; i <= maxbunch_; ++i) {
91  int ii = i - minbunch_;
92  char label[50];
93  sprintf(label, "%s_%d", labels[0], i);
94  nrPileupsH_[ii] = ibooker.book1D(label, label, 100, 0, 100);
95  sprintf(label, "%s_%d", labels[1], i);
96  nrVerticesH_[ii] = ibooker.book1D(label, label, 100, 0, 5000);
97  sprintf(label, "%s_%d", labels[2], i);
98  nrTracksH_[ii] = ibooker.book1D(label, label, 100, 0, 10000);
99  sprintf(label, "%s_%d", labels[3], i);
100  trackPartIdH_[ii] = ibooker.book1D(label, label, 100, 0, 100);
101  sprintf(label, "%s_%d", labels[4], i);
102  caloEnergyEBH_[ii] = ibooker.book1D(label, label, 100, 0., 1000.);
103  sprintf(label, "%s_%d", labels[5], i);
104  caloEnergyEEH_[ii] = ibooker.book1D(label, label, 100, 0., 1000.);
105  }
106 }

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

Member Data Documentation

◆ caloEnergyEBH_

MonitorElement* GlobalTest::caloEnergyEBH_[nMaxH]
private

Definition at line 62 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

◆ caloEnergyEEH_

MonitorElement* GlobalTest::caloEnergyEEH_[nMaxH]
private

Definition at line 63 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

◆ cfTrackToken_

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

Definition at line 68 of file GlobalTest.h.

Referenced by analyze().

◆ cfVertexToken_

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

Definition at line 69 of file GlobalTest.h.

Referenced by analyze().

◆ filename_

std::string GlobalTest::filename_
private

Definition at line 52 of file GlobalTest.h.

Referenced by GlobalTest().

◆ g4SimHits_EB_Token_

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

Definition at line 70 of file GlobalTest.h.

Referenced by analyze(), and GlobalTest().

◆ g4SimHits_EE_Token_

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

Definition at line 71 of file GlobalTest.h.

Referenced by analyze(), and GlobalTest().

◆ histfile_

TFile* GlobalTest::histfile_
private

Definition at line 55 of file GlobalTest.h.

◆ labels

char* GlobalTest::labels[nrHistos]
private

Definition at line 66 of file GlobalTest.h.

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

◆ maxbunch_

int GlobalTest::maxbunch_
private

Definition at line 54 of file GlobalTest.h.

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

◆ minbunch_

int GlobalTest::minbunch_
private

Definition at line 53 of file GlobalTest.h.

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

◆ nMaxH

const static int GlobalTest::nMaxH = 10
staticprivate

Definition at line 57 of file GlobalTest.h.

◆ nrHistos

const static int GlobalTest::nrHistos = 6
staticprivate

Definition at line 65 of file GlobalTest.h.

◆ nrPileupsH_

MonitorElement* GlobalTest::nrPileupsH_[nMaxH]
private

Definition at line 58 of file GlobalTest.h.

Referenced by bookHistograms().

◆ nrTracksH_

MonitorElement* GlobalTest::nrTracksH_[nMaxH]
private

Definition at line 60 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

◆ nrVerticesH_

MonitorElement* GlobalTest::nrVerticesH_[nMaxH]
private

Definition at line 59 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

◆ trackPartIdH_

MonitorElement* GlobalTest::trackPartIdH_[nMaxH]
private

Definition at line 61 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

GlobalTest::cfVertexToken_
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfVertexToken_
Definition: GlobalTest.h:69
mps_fire.i
i
Definition: mps_fire.py:355
edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::Handle
Definition: AssociativeIterator.h:50
MixCollection::MixItr
Definition: MixCollection.h:62
GlobalTest::nrVerticesH_
MonitorElement * nrVerticesH_[nMaxH]
Definition: GlobalTest.h:59
CrossingFrame
Definition: CrossingFrame.h:38
MixCollection::MixItr::bunch
int bunch() const
Definition: MixCollection.h:91
MixCollection
Definition: MixCollection.h:11
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
GlobalTest::g4SimHits_EB_Token_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EB_Token_
Definition: GlobalTest.h:70
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
GlobalTest::caloEnergyEEH_
MonitorElement * caloEnergyEEH_[nMaxH]
Definition: GlobalTest.h:63
GlobalTest::maxbunch_
int maxbunch_
Definition: GlobalTest.h:54
iEvent
int iEvent
Definition: GenABIO.cc:224
GlobalTest::minbunch_
int minbunch_
Definition: GlobalTest.h:53
GlobalTest::labels
char * labels[nrHistos]
Definition: GlobalTest.h:66
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
std
Definition: JetResolutionObject.h:76
GlobalTest::filename_
std::string filename_
Definition: GlobalTest.h:52
GlobalTest::caloEnergyEBH_
MonitorElement * caloEnergyEBH_[nMaxH]
Definition: GlobalTest.h:62
GlobalTest::g4SimHits_EE_Token_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EE_Token_
Definition: GlobalTest.h:71
GlobalTest::trackPartIdH_
MonitorElement * trackPartIdH_[nMaxH]
Definition: GlobalTest.h:61
GlobalTest::cfTrackToken_
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfTrackToken_
Definition: GlobalTest.h:68
cuy.ii
ii
Definition: cuy.py:590
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
GlobalTest::nrPileupsH_
MonitorElement * nrPileupsH_[nMaxH]
Definition: GlobalTest.h:58
GlobalTest::nrTracksH_
MonitorElement * nrTracksH_[nMaxH]
Definition: GlobalTest.h:60