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::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

virtual 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 ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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 & itemsToGetFromEvent () 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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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 edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
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
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr< dqmDetails::NoCacheglobalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr< dqmDetails::NoCacheglobalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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)
 

Detailed Description

Description: test suite for Mixing Module

Definition at line 46 of file GlobalTest.h.

Constructor & Destructor Documentation

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

Definition at line 40 of file GlobalTest.cc.

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

40  :
41  filename_(iConfig.getParameter<std::string>("fileName")),
42  minbunch_(iConfig.getParameter<int>("minBunch")),
43  maxbunch_(iConfig.getParameter<int>("maxBunch")),
45  iConfig.getParameter<edm::InputTag>("cfTrackTag"))),
47  iConfig.getParameter<edm::InputTag>("cfVertexTag")))
48 {
49  std::string ecalsubdetb("");
50  std::string ecalsubdete("g4SimHitsEcalHitsEE");
51  g4SimHits_EB_Token_ = consumes<CrossingFrame<PCaloHit> > (
52  edm::InputTag("mix", "g4SimHitsEcalHitsEB"));
53  g4SimHits_EE_Token_ = consumes<CrossingFrame<PCaloHit> > (
54  edm::InputTag("mix", "g4SimHitsEcalHitsEE"));
55 
56  std::cout << "Constructed GlobalTest, filename: "
57  << filename_ << " minbunch: "
58  << minbunch_ << ", maxbunch: "
59  << maxbunch_ << std::endl;
60 
61 }
T getParameter(std::string const &) const
int maxbunch_
Definition: GlobalTest.h:58
int minbunch_
Definition: GlobalTest.h:57
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EE_Token_
Definition: GlobalTest.h:75
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfTrackToken_
Definition: GlobalTest.h:72
std::string filename_
Definition: GlobalTest.h:56
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfVertexToken_
Definition: GlobalTest.h:73
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EB_Token_
Definition: GlobalTest.h:74
GlobalTest::~GlobalTest ( )

Definition at line 63 of file GlobalTest.cc.

References mps_fire::i, and labels.

64 {
65  for (int i = 0; i < 6; i++) delete[] labels[i];
66 }
char * labels[nrHistos]
Definition: GlobalTest.h:70

Member Function Documentation

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

Definition at line 126 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_.

127 {
128  using namespace edm;
129  using namespace std;
130 
131  // Get input
136  std::string ecalsubdetb("g4SimHitsEcalHitsEB");
137  std::string ecalsubdete("g4SimHitsEcalHitsEE");
138  iEvent.getByToken(cfTrackToken_, cf_track);
139  iEvent.getByToken(cfVertexToken_, cf_vertex);
140  iEvent.getByToken(g4SimHits_EB_Token_, cf_calohitB);
141  iEvent.getByToken(g4SimHits_EE_Token_, cf_calohitE);
142 
143  // number of events/bcr ??
144 
145  // number of tracks
146  for (int i=minbunch_;i<=maxbunch_;++i) {
147  nrTracksH_[i-minbunch_]->Fill(cf_track->getNrPileups(i));
148  }
149 
150  // number of vertices
151  for (int i=minbunch_;i<=maxbunch_;++i) {
152  nrVerticesH_[i-minbunch_]->Fill(cf_vertex->getNrPileups(i));
153  }
154 
155  // part id for each track
156  std::auto_ptr<MixCollection<SimTrack> > coltr(new MixCollection<SimTrack>(cf_track.product()));
158  for (cfitr=coltr->begin(); cfitr!=coltr->end();cfitr++) {
159  trackPartIdH_[cfitr.bunch()-minbunch_]->Fill(cfitr->type());
160  }
161 
162  // energy sum
163  double sumE[10]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
164  std::auto_ptr<MixCollection<PCaloHit> > colecalb(new MixCollection<PCaloHit>(cf_calohitB.product()));
166  for (cfiecalb=colecalb->begin(); cfiecalb!=colecalb->end();cfiecalb++) {
167  sumE[cfiecalb.bunch()-minbunch_]+=cfiecalb->energy();
168  // if (cfiecal.getTrigger()) tofecalhist_sig->Fill(cfiecal->time());
169  // else tofecalhist->Fill(cfiecal->time());
170  }
171  for (int i=minbunch_;i<=maxbunch_;++i) {
173  }
174  double sumEE[10]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
175  std::auto_ptr<MixCollection<PCaloHit> > colecale(new MixCollection<PCaloHit>(cf_calohitE.product()));
177  for (cfiecale=colecale->begin(); cfiecale!=colecale->end();cfiecale++) {
178  sumEE[cfiecale.bunch()-minbunch_]+=cfiecale->energy();
179  // if (cfiecal.getTrigger()) tofecalhist_sig->Fill(cfiecal->time());
180  // else tofecalhist->Fill(cfiecal->time());
181  }
182  for (int i=minbunch_;i<=maxbunch_;++i) {
184  }
185 }
int maxbunch_
Definition: GlobalTest.h:58
MonitorElement * caloEnergyEEH_[nMaxH]
Definition: GlobalTest.h:67
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
int minbunch_
Definition: GlobalTest.h:57
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EE_Token_
Definition: GlobalTest.h:75
MonitorElement * trackPartIdH_[nMaxH]
Definition: GlobalTest.h:65
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfTrackToken_
Definition: GlobalTest.h:72
MonitorElement * caloEnergyEBH_[nMaxH]
Definition: GlobalTest.h:66
void Fill(long long x)
MonitorElement * nrTracksH_[nMaxH]
Definition: GlobalTest.h:64
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfVertexToken_
Definition: GlobalTest.h:73
T const * product() const
Definition: Handle.h:81
MonitorElement * nrVerticesH_[nMaxH]
Definition: GlobalTest.h:63
HLT enums.
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EB_Token_
Definition: GlobalTest.h:74
void GlobalTest::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 68 of file GlobalTest.cc.

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

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

Member Data Documentation

MonitorElement* GlobalTest::caloEnergyEBH_[nMaxH]
private

Definition at line 66 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GlobalTest::caloEnergyEEH_[nMaxH]
private

Definition at line 67 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 72 of file GlobalTest.h.

Referenced by analyze().

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

Definition at line 73 of file GlobalTest.h.

Referenced by analyze().

std::string GlobalTest::filename_
private

Definition at line 56 of file GlobalTest.h.

Referenced by GlobalTest().

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

Definition at line 74 of file GlobalTest.h.

Referenced by analyze(), and GlobalTest().

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

Definition at line 75 of file GlobalTest.h.

Referenced by analyze(), and GlobalTest().

TFile* GlobalTest::histfile_
private

Definition at line 59 of file GlobalTest.h.

char* GlobalTest::labels[nrHistos]
private

Definition at line 70 of file GlobalTest.h.

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

int GlobalTest::maxbunch_
private

Definition at line 58 of file GlobalTest.h.

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

int GlobalTest::minbunch_
private

Definition at line 57 of file GlobalTest.h.

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

const int GlobalTest::nMaxH =10
staticprivate

Definition at line 61 of file GlobalTest.h.

const int GlobalTest::nrHistos =6
staticprivate

Definition at line 69 of file GlobalTest.h.

MonitorElement* GlobalTest::nrPileupsH_[nMaxH]
private

Definition at line 62 of file GlobalTest.h.

Referenced by bookHistograms().

MonitorElement* GlobalTest::nrTracksH_[nMaxH]
private

Definition at line 64 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GlobalTest::nrVerticesH_[nMaxH]
private

Definition at line 63 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GlobalTest::trackPartIdH_[nMaxH]
private

Definition at line 65 of file GlobalTest.h.

Referenced by analyze(), and bookHistograms().