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:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

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 one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

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
 

Detailed Description

Description: test suite for Mixing Module

Definition at line 45 of file GlobalTest.h.

Constructor & Destructor Documentation

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_, 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 }
T getParameter(std::string const &) const
int maxbunch_
Definition: GlobalTest.h:56
int minbunch_
Definition: GlobalTest.h:55
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EE_Token_
Definition: GlobalTest.h:73
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfTrackToken_
Definition: GlobalTest.h:70
std::string filename_
Definition: GlobalTest.h:54
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfVertexToken_
Definition: GlobalTest.h:71
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EB_Token_
Definition: GlobalTest.h:72
GlobalTest::~GlobalTest ( )
override

Definition at line 54 of file GlobalTest.cc.

References mps_fire::i, and labels.

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

Member Function Documentation

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

Definition at line 114 of file GlobalTest.cc.

References MixCollection< T >::MixItr::bunch(), caloEnergyEBH_, caloEnergyEEH_, cfTrackToken_, cfVertexToken_, 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_.

114  {
115  using namespace edm;
116  using namespace std;
117 
118  // Get input
123  std::string ecalsubdetb("g4SimHitsEcalHitsEB");
124  std::string ecalsubdete("g4SimHitsEcalHitsEE");
125  iEvent.getByToken(cfTrackToken_, cf_track);
126  iEvent.getByToken(cfVertexToken_, cf_vertex);
127  iEvent.getByToken(g4SimHits_EB_Token_, cf_calohitB);
128  iEvent.getByToken(g4SimHits_EE_Token_, cf_calohitE);
129 
130  // number of events/bcr ??
131 
132  // number of tracks
133  for (int i = minbunch_; i <= maxbunch_; ++i) {
134  nrTracksH_[i - minbunch_]->Fill(cf_track->getNrPileups(i));
135  }
136 
137  // number of vertices
138  for (int i = minbunch_; i <= maxbunch_; ++i) {
139  nrVerticesH_[i - minbunch_]->Fill(cf_vertex->getNrPileups(i));
140  }
141 
142  // part id for each track
143  std::unique_ptr<MixCollection<SimTrack>> coltr(new MixCollection<SimTrack>(cf_track.product()));
145  for (cfitr = coltr->begin(); cfitr != coltr->end(); cfitr++) {
146  trackPartIdH_[cfitr.bunch() - minbunch_]->Fill(cfitr->type());
147  }
148 
149  // energy sum
150  double sumE[10] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
151  std::unique_ptr<MixCollection<PCaloHit>> colecalb(new MixCollection<PCaloHit>(cf_calohitB.product()));
153  for (cfiecalb = colecalb->begin(); cfiecalb != colecalb->end(); cfiecalb++) {
154  sumE[cfiecalb.bunch() - minbunch_] += cfiecalb->energy();
155  // if (cfiecal.getTrigger()) tofecalhist_sig->Fill(cfiecal->time());
156  // else tofecalhist->Fill(cfiecal->time());
157  }
158  for (int i = minbunch_; i <= maxbunch_; ++i) {
159  caloEnergyEBH_[i - minbunch_]->Fill(sumE[i - minbunch_]);
160  }
161  double sumEE[10] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
162  std::unique_ptr<MixCollection<PCaloHit>> colecale(new MixCollection<PCaloHit>(cf_calohitE.product()));
164  for (cfiecale = colecale->begin(); cfiecale != colecale->end(); cfiecale++) {
165  sumEE[cfiecale.bunch() - minbunch_] += cfiecale->energy();
166  // if (cfiecal.getTrigger()) tofecalhist_sig->Fill(cfiecal->time());
167  // else tofecalhist->Fill(cfiecal->time());
168  }
169  for (int i = minbunch_; i <= maxbunch_; ++i) {
170  caloEnergyEEH_[i - minbunch_]->Fill(sumEE[i - minbunch_]);
171  }
172 }
int maxbunch_
Definition: GlobalTest.h:56
MonitorElement * caloEnergyEEH_[nMaxH]
Definition: GlobalTest.h:65
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
int minbunch_
Definition: GlobalTest.h:55
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EE_Token_
Definition: GlobalTest.h:73
MonitorElement * trackPartIdH_[nMaxH]
Definition: GlobalTest.h:63
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfTrackToken_
Definition: GlobalTest.h:70
MonitorElement * caloEnergyEBH_[nMaxH]
Definition: GlobalTest.h:64
void Fill(long long x)
MonitorElement * nrTracksH_[nMaxH]
Definition: GlobalTest.h:62
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfVertexToken_
Definition: GlobalTest.h:71
T const * product() const
Definition: Handle.h:74
MonitorElement * nrVerticesH_[nMaxH]
Definition: GlobalTest.h:61
HLT enums.
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EB_Token_
Definition: GlobalTest.h:72
void GlobalTest::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  ,
edm::EventSetup const &   
)
override

Definition at line 59 of file GlobalTest.cc.

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

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

Member Data Documentation

MonitorElement* GlobalTest::caloEnergyEBH_[nMaxH]
private

Definition at line 64 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GlobalTest::caloEnergyEEH_[nMaxH]
private

Definition at line 65 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 70 of file GlobalTest.h.

Referenced by analyze().

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

Definition at line 71 of file GlobalTest.h.

Referenced by analyze().

std::string GlobalTest::filename_
private

Definition at line 54 of file GlobalTest.h.

Referenced by GlobalTest().

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

Definition at line 72 of file GlobalTest.h.

Referenced by analyze(), and GlobalTest().

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

Definition at line 73 of file GlobalTest.h.

Referenced by analyze(), and GlobalTest().

TFile* GlobalTest::histfile_
private

Definition at line 57 of file GlobalTest.h.

char* GlobalTest::labels[nrHistos]
private

Definition at line 68 of file GlobalTest.h.

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

int GlobalTest::maxbunch_
private

Definition at line 56 of file GlobalTest.h.

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

int GlobalTest::minbunch_
private

Definition at line 55 of file GlobalTest.h.

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

const int GlobalTest::nMaxH = 10
staticprivate

Definition at line 59 of file GlobalTest.h.

const int GlobalTest::nrHistos = 6
staticprivate

Definition at line 67 of file GlobalTest.h.

MonitorElement* GlobalTest::nrPileupsH_[nMaxH]
private

Definition at line 60 of file GlobalTest.h.

Referenced by bookHistograms().

MonitorElement* GlobalTest::nrTracksH_[nMaxH]
private

Definition at line 62 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GlobalTest::nrVerticesH_[nMaxH]
private

Definition at line 61 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GlobalTest::trackPartIdH_[nMaxH]
private

Definition at line 63 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().