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::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

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

static const int nMaxH = 10
 
static const 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::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::ProducerBase
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Description: test suite for Mixing Module

Definition at line 43 of file GlobalTest.h.

Constructor & Destructor Documentation

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

Definition at line 38 of file GlobalTest.cc.

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

39  : filename_(iConfig.getParameter<std::string>("fileName")),
40  minbunch_(iConfig.getParameter<int>("minBunch")),
41  maxbunch_(iConfig.getParameter<int>("maxBunch")),
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 }
T getParameter(std::string const &) const
int maxbunch_
Definition: GlobalTest.h:54
int minbunch_
Definition: GlobalTest.h:53
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EE_Token_
Definition: GlobalTest.h:71
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfTrackToken_
Definition: GlobalTest.h:68
std::string filename_
Definition: GlobalTest.h:52
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfVertexToken_
Definition: GlobalTest.h:69
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EB_Token_
Definition: GlobalTest.h:70
GlobalTest::~GlobalTest ( )
override

Definition at line 53 of file GlobalTest.cc.

References mps_fire::i, and labels.

53  {
54  for (int i = 0; i < 6; i++)
55  delete[] labels[i];
56 }
char * labels[nrHistos]
Definition: GlobalTest.h:66

Member Function Documentation

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

Definition at line 113 of file GlobalTest.cc.

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

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 }
int maxbunch_
Definition: GlobalTest.h:54
MonitorElement * caloEnergyEEH_[nMaxH]
Definition: GlobalTest.h:63
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
int minbunch_
Definition: GlobalTest.h:53
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EE_Token_
Definition: GlobalTest.h:71
MonitorElement * trackPartIdH_[nMaxH]
Definition: GlobalTest.h:61
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfTrackToken_
Definition: GlobalTest.h:68
MonitorElement * caloEnergyEBH_[nMaxH]
Definition: GlobalTest.h:62
void Fill(long long x)
MonitorElement * nrTracksH_[nMaxH]
Definition: GlobalTest.h:60
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfVertexToken_
Definition: GlobalTest.h:69
T const * product() const
Definition: Handle.h:69
MonitorElement * nrVerticesH_[nMaxH]
Definition: GlobalTest.h:59
HLT enums.
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EB_Token_
Definition: GlobalTest.h:70
void GlobalTest::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 58 of file GlobalTest.cc.

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

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 }
int maxbunch_
Definition: GlobalTest.h:54
MonitorElement * caloEnergyEEH_[nMaxH]
Definition: GlobalTest.h:63
char * labels[nrHistos]
Definition: GlobalTest.h:66
int minbunch_
Definition: GlobalTest.h:53
MonitorElement * trackPartIdH_[nMaxH]
Definition: GlobalTest.h:61
MonitorElement * caloEnergyEBH_[nMaxH]
Definition: GlobalTest.h:62
char const * label
MonitorElement * nrPileupsH_[nMaxH]
Definition: GlobalTest.h:58
MonitorElement * nrTracksH_[nMaxH]
Definition: GlobalTest.h:60
ii
Definition: cuy.py:590
MonitorElement * nrVerticesH_[nMaxH]
Definition: GlobalTest.h:59

Member Data Documentation

MonitorElement* GlobalTest::caloEnergyEBH_[nMaxH]
private

Definition at line 62 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GlobalTest::caloEnergyEEH_[nMaxH]
private

Definition at line 63 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 68 of file GlobalTest.h.

Referenced by analyze().

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

Definition at line 69 of file GlobalTest.h.

Referenced by analyze().

std::string GlobalTest::filename_
private

Definition at line 52 of file GlobalTest.h.

Referenced by GlobalTest().

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

Definition at line 70 of file GlobalTest.h.

Referenced by analyze(), and GlobalTest().

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

Definition at line 71 of file GlobalTest.h.

Referenced by analyze(), and GlobalTest().

TFile* GlobalTest::histfile_
private

Definition at line 55 of file GlobalTest.h.

char* GlobalTest::labels[nrHistos]
private

Definition at line 66 of file GlobalTest.h.

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

int GlobalTest::maxbunch_
private

Definition at line 54 of file GlobalTest.h.

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

int GlobalTest::minbunch_
private

Definition at line 53 of file GlobalTest.h.

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

const int GlobalTest::nMaxH = 10
staticprivate

Definition at line 57 of file GlobalTest.h.

const int GlobalTest::nrHistos = 6
staticprivate

Definition at line 65 of file GlobalTest.h.

MonitorElement* GlobalTest::nrPileupsH_[nMaxH]
private

Definition at line 58 of file GlobalTest.h.

Referenced by bookHistograms().

MonitorElement* GlobalTest::nrTracksH_[nMaxH]
private

Definition at line 60 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GlobalTest::nrVerticesH_[nMaxH]
private

Definition at line 59 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GlobalTest::trackPartIdH_[nMaxH]
private

Definition at line 61 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().