CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
TestSuite Class Reference

#include <TestSuite.h>

Inheritance diagram for TestSuite:
edm::EDAnalyzer edm::EDConsumerBase

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
 TestSuite (const edm::ParameterSet &)
 
 ~TestSuite () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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

int bunchcr_
 
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfTrackToken_
 
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfVertexToken_
 
DQMStoredbe_
 
std::string filename_
 
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_Ecal_Token_
 
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_HCal_Token_
 
edm::EDGetTokenT< CrossingFrame< PSimHit > > g4SimHits_Token_
 
int maxbunch_
 
int minbunch_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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)
 

Detailed Description

Description: test suite for Mixing Module

Description: global physics test for Mixing Module

Definition at line 45 of file TestSuite.h.

Member Typedef Documentation

Definition at line 47 of file TestSuite.h.

Definition at line 48 of file TestSuite.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file TestSuite.cc.

References bunchcr_, gather_cfg::cout, and filename_.

30  : filename_(iConfig.getParameter<std::string>("fileName")),
31  bunchcr_(iConfig.getParameter<int>("BunchNr")),
32  minbunch_(iConfig.getParameter<int>("minBunch")),
33  maxbunch_(iConfig.getParameter<int>("maxBunch")),
34  dbe_(nullptr),
37  g4SimHits_Token_(consumes<CrossingFrame<PSimHit>>(edm::InputTag("mix", "g4SimHitsTrackerHitsTECLowTof"))),
40  std::cout << "Constructed testSuite , bunchcr " << bunchcr_ << " filename: " << filename_ << std::endl;
41 }
T getParameter(std::string const &) const
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfVertexToken_
Definition: TestSuite.h:65
int maxbunch_
Definition: TestSuite.h:61
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
int minbunch_
Definition: TestSuite.h:60
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfTrackToken_
Definition: TestSuite.h:64
DQMStore * dbe_
Definition: TestSuite.h:62
edm::EDGetTokenT< CrossingFrame< PSimHit > > g4SimHits_Token_
Definition: TestSuite.h:66
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_HCal_Token_
Definition: TestSuite.h:68
std::string filename_
Definition: TestSuite.h:58
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_Ecal_Token_
Definition: TestSuite.h:67
int bunchcr_
Definition: TestSuite.h:59
TestSuite::~TestSuite ( )
override

Definition at line 43 of file TestSuite.cc.

43  {
44  // do anything here that needs to be done at desctruction time
45  // (e.g. close files, deallocate resources etc.)
46 }

Member Function Documentation

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

Definition at line 61 of file TestSuite.cc.

References dqm::dqmstoreimpl::DQMStore::book1D(), MixCollection< T >::MixItr::bunch(), bunchcr_, cfTrackToken_, cfVertexToken_, dbe_, dqm::impl::MonitorElement::Fill(), g4SimHits_Ecal_Token_, g4SimHits_HCal_Token_, g4SimHits_Token_, edm::Event::getByToken(), MixCollection< T >::MixItr::getTrigger(), maxbunch_, minbunch_, edm::Handle< T >::product(), and AlCaHLTBitMon_QueryRunRegistry::string.

61  {
62  using namespace edm;
63 
64  // Get input
70  std::string subdetTracker("g4SimHitsTrackerHitsTECLowTof");
71  std::string ecalsubdet("g4SimHitsEcalHitsEB");
72  std::string hcalsubdet("g4SimHitsHcalHits");
73  iEvent.getByToken(cfTrackToken_, cf_track);
74  iEvent.getByToken(cfVertexToken_, cf_vertex);
75  iEvent.getByToken(g4SimHits_Token_, cf_simhit);
76  iEvent.getByToken(g4SimHits_Ecal_Token_, cf_calohitEcal);
77  iEvent.getByToken(g4SimHits_HCal_Token_, cf_calohitHcal);
78 
79  // use MixCollection and its iterator
80  // Please note that bunch() and getTrigger() are methods of the iterator
81  // itself while operator-> points to the templated objects!!!!
82 
83  // track histo
84  char histotracks[30], sighistotracks[30], histotracksindsig[30], histotracksind[30];
85  sprintf(histotracks, "Tracks_bcr_%d", bunchcr_);
86  sprintf(sighistotracks, "SignalTracks_bcr_%d", bunchcr_);
87  sprintf(histotracksind, "VtxPointers_%d", bunchcr_);
88  sprintf(histotracksindsig, "VtxPointers_signal_%d", bunchcr_);
89  MonitorElement *trhist =
90  dbe_->book1D(histotracks, "Bunchcrossings", maxbunch_ - minbunch_ + 1, minbunch_, maxbunch_ + 1);
91  MonitorElement *trhistsig =
92  dbe_->book1D(sighistotracks, "Bunchcrossings", maxbunch_ - minbunch_ + 1, minbunch_, maxbunch_ + 1);
93  MonitorElement *trindhist = dbe_->book1D(histotracksind, "Track to Vertex indices", 100, 0, 500);
94  MonitorElement *trindhistsig = dbe_->book1D(histotracksindsig, "Signal Track to Vertex indices", 100, 0, 500);
95  std::unique_ptr<MixCollection<SimTrack>> col1(new MixCollection<SimTrack>(cf_track.product()));
97  for (cfi1 = col1->begin(); cfi1 != col1->end(); cfi1++) {
98  if (cfi1.getTrigger() == 0) {
99  trhist->Fill(cfi1.bunch());
100  trindhist->Fill(cfi1->vertIndex());
101  } else {
102  trindhistsig->Fill(cfi1->vertIndex());
103  trhistsig->Fill(cfi1.bunch());
104  }
105  }
106 
107  // vertex histo
108  char histovertices[30], sighistovertices[30], histovertexindices[30], histovertexindicessig[30];
109  sprintf(histovertices, "Vertices_bcr_%d", bunchcr_);
110  sprintf(sighistovertices, "SignalVertices_bcr_%d", bunchcr_);
111  sprintf(histovertexindices, "TrackPointers_%d", bunchcr_);
112  sprintf(histovertexindicessig, "TrackPointers_signal_%d", bunchcr_);
113  MonitorElement *vtxhist =
114  dbe_->book1D(histovertices, "Bunchcrossings", maxbunch_ - minbunch_ + 1, minbunch_, maxbunch_ + 1);
115  MonitorElement *vtxhistsig =
116  dbe_->book1D(sighistovertices, "Bunchcrossings", maxbunch_ - minbunch_ + 1, minbunch_, maxbunch_ + 1);
117  MonitorElement *vtxindhist = dbe_->book1D(histovertexindices, "Vertex to Track Indices", 100, 0, 300);
118  MonitorElement *vtxindhistsig = dbe_->book1D(histovertexindicessig, "Signal Vertex to Track Indices", 100, 0, 300);
119  std::unique_ptr<MixCollection<SimVertex>> col2(new MixCollection<SimVertex>(cf_vertex.product()));
121  for (cfi2 = col2->begin(); cfi2 != col2->end(); cfi2++) {
122  if (cfi2.getTrigger() == 0) {
123  vtxhist->Fill(cfi2.bunch());
124  if (!cfi2->noParent())
125  vtxindhist->Fill(cfi2->parentIndex());
126  } else {
127  vtxhistsig->Fill(cfi2.bunch());
128  if (!cfi2->noParent())
129  vtxindhistsig->Fill(cfi2->parentIndex());
130  }
131  }
132 
133  // tracker
134  int bsp = cf_simhit->getBunchSpace();
135  char tof[30];
136 
137  sprintf(tof, "TrackerHit_Tof_bcr_%d", bunchcr_);
138  MonitorElement *tofhist =
139  dbe_->book1D(tof, "TrackerHit_ToF", 100, float(bsp * minbunch_), float(bsp * maxbunch_) + 50.);
140  sprintf(tof, "SignalTrackerHit_Tof_bcr_%d", bunchcr_);
141  MonitorElement *tofhist_sig =
142  dbe_->book1D(tof, "TrackerHit_ToF", 100, float(bsp * minbunch_), float(bsp * maxbunch_) + 50.);
143  std::unique_ptr<MixCollection<PSimHit>> colsh(new MixCollection<PSimHit>(cf_simhit.product()));
145  for (cfish = colsh->begin(); cfish != colsh->end(); cfish++) {
146  if (cfish.getTrigger()) {
147  tofhist_sig->Fill(cfish->timeOfFlight());
148  } else {
149  tofhist->Fill(cfish->timeOfFlight());
150  }
151  }
152 
153  // Ecal
154  sprintf(tof, "EcalEBHit_Tof_bcr_%d", bunchcr_);
155  MonitorElement *tofecalhist =
156  dbe_->book1D(tof, "EcalEBHit_ToF", 100, float(bsp * minbunch_), float(bsp * maxbunch_) + 50.);
157  sprintf(tof, "SignalEcalEBHit_Tof_bcr_%d", bunchcr_);
158  MonitorElement *tofecalhist_sig =
159  dbe_->book1D(tof, "EcalEBHit_ToF", 100, float(bsp * minbunch_), float(bsp * maxbunch_) + 50.);
160  // std::string ecalsubdet("EcalHitsEB");
161  std::unique_ptr<MixCollection<PCaloHit>> colecal(new MixCollection<PCaloHit>(cf_calohitEcal.product()));
163  for (cfiecal = colecal->begin(); cfiecal != colecal->end(); cfiecal++) {
164  if (cfiecal.getTrigger())
165  tofecalhist_sig->Fill(cfiecal->time());
166  else
167  tofecalhist->Fill(cfiecal->time());
168  }
169 
170  // Hcal
171  sprintf(tof, "HcalHit_Tof_bcr_%d", bunchcr_);
172  MonitorElement *tofhcalhist =
173  dbe_->book1D(tof, "HcalHit_ToF", 100, float(bsp * minbunch_), float(bsp * maxbunch_) + 50.);
174  sprintf(tof, "SignalHcalHit_Tof_bcr_%d", bunchcr_);
175  MonitorElement *tofhcalhist_sig =
176  dbe_->book1D(tof, "HcalHit_ToF", 100, float(bsp * minbunch_), float(bsp * maxbunch_) + 50.);
177  // std::string hcalsubdet("HcalHits");
178  std::unique_ptr<MixCollection<PCaloHit>> colhcal(new MixCollection<PCaloHit>(cf_calohitHcal.product()));
180 
181  for (cfihcal = colhcal->begin(); cfihcal != colhcal->end(); cfihcal++) {
182  if (cfihcal.getTrigger())
183  tofhcalhist_sig->Fill(cfihcal->time());
184  else
185  tofhcalhist->Fill(cfihcal->time());
186  }
187 }
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfVertexToken_
Definition: TestSuite.h:65
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
int maxbunch_
Definition: TestSuite.h:61
bool getTrigger() const
Definition: MixCollection.h:98
void Fill(long long x)
int minbunch_
Definition: TestSuite.h:60
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfTrackToken_
Definition: TestSuite.h:64
DQMStore * dbe_
Definition: TestSuite.h:62
edm::EDGetTokenT< CrossingFrame< PSimHit > > g4SimHits_Token_
Definition: TestSuite.h:66
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_HCal_Token_
Definition: TestSuite.h:68
T const * product() const
Definition: Handle.h:69
HLT enums.
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_Ecal_Token_
Definition: TestSuite.h:67
MonitorElement * book1D(char_string const &name, char_string const &title, int const nchX, double const lowX, double const highX)
Book 1D histogram.
Definition: DQMStore.cc:1121
int bunchcr_
Definition: TestSuite.h:59
void TestSuite::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 48 of file TestSuite.cc.

References dbe_, Utilities::operator, dqm::dqmstoreimpl::DQMStore::setCurrentFolder(), and dqm::dqmstoreimpl::DQMStore::showDirStructure().

48  {
49  // get hold of back-end interface
52  dbe_->setCurrentFolder("MixingV/Mixing");
53 }
DQMStore * dbe_
Definition: TestSuite.h:62
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:639
void showDirStructure() const
Definition: DQMStore.cc:2926
void TestSuite::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 55 of file TestSuite.cc.

References dbe_, filename_, and dqm::dqmstoreimpl::DQMStore::save().

55  {
56  if (!filename_.empty() && dbe_)
58 }
DQMStore * dbe_
Definition: TestSuite.h:62
std::string filename_
Definition: TestSuite.h:58
void save(std::string const &filename, std::string const &path="", std::string const &pattern="", std::string const &rewrite="", uint32_t run=0, uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, std::string const &fileupdate="RECREATE")
Definition: DQMStore.cc:2244

Member Data Documentation

int TestSuite::bunchcr_
private

Definition at line 59 of file TestSuite.h.

Referenced by analyze(), and TestSuite().

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

Definition at line 64 of file TestSuite.h.

Referenced by analyze().

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

Definition at line 65 of file TestSuite.h.

Referenced by analyze().

DQMStore* TestSuite::dbe_
private

Definition at line 62 of file TestSuite.h.

Referenced by analyze(), beginJob(), and endJob().

std::string TestSuite::filename_
private

Definition at line 58 of file TestSuite.h.

Referenced by endJob(), and TestSuite().

edm::EDGetTokenT<CrossingFrame<PCaloHit> > TestSuite::g4SimHits_Ecal_Token_
private

Definition at line 67 of file TestSuite.h.

Referenced by analyze().

edm::EDGetTokenT<CrossingFrame<PCaloHit> > TestSuite::g4SimHits_HCal_Token_
private

Definition at line 68 of file TestSuite.h.

Referenced by analyze().

edm::EDGetTokenT<CrossingFrame<PSimHit> > TestSuite::g4SimHits_Token_
private

Definition at line 66 of file TestSuite.h.

Referenced by analyze().

int TestSuite::maxbunch_
private

Definition at line 61 of file TestSuite.h.

Referenced by analyze().

int TestSuite::minbunch_
private

Definition at line 60 of file TestSuite.h.

Referenced by analyze().