CMS 3D CMS Logo

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

#include <TestSuite.h>

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

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

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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.

Constructor & Destructor Documentation

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

Definition at line 30 of file TestSuite.cc.

References bunchcr_, gather_cfg::cout, and filename_.

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

Definition at line 44 of file TestSuite.cc.

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

Member Function Documentation

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

Definition at line 62 of file TestSuite.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 49 of file TestSuite.cc.

References dbe_, and Utilities::operator.

49  {
50  // get hold of back-end interface
52  dbe_->showDirStructure();
53  dbe_->setCurrentFolder("MixingV/Mixing");
54 }
DQMStore * dbe_
Definition: TestSuite.h:59
void TestSuite::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 56 of file TestSuite.cc.

References dbe_, and filename_.

56  {
57  if (!filename_.empty() && dbe_)
58  dbe_->save(filename_);
59 }
DQMStore * dbe_
Definition: TestSuite.h:59
std::string filename_
Definition: TestSuite.h:55

Member Data Documentation

int TestSuite::bunchcr_
private

Definition at line 56 of file TestSuite.h.

Referenced by analyze(), and TestSuite().

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

Definition at line 61 of file TestSuite.h.

Referenced by analyze().

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

Definition at line 62 of file TestSuite.h.

Referenced by analyze().

DQMStore* TestSuite::dbe_
private

Definition at line 59 of file TestSuite.h.

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

std::string TestSuite::filename_
private

Definition at line 55 of file TestSuite.h.

Referenced by endJob(), and TestSuite().

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

Definition at line 64 of file TestSuite.h.

Referenced by analyze().

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

Definition at line 65 of file TestSuite.h.

Referenced by analyze().

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

Definition at line 63 of file TestSuite.h.

Referenced by analyze().

int TestSuite::maxbunch_
private

Definition at line 58 of file TestSuite.h.

Referenced by analyze().

int TestSuite::minbunch_
private

Definition at line 57 of file TestSuite.h.

Referenced by analyze().