CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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 }
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
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_Ecal_Token_
Definition: TestSuite.h:67
tuple cout
Definition: gather_cfg.py:144
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 
)
overridevirtual

Implements edm::EDAnalyzer.

Definition at line 60 of file TestSuite.cc.

References dqm::implementation::IBooker::book1D(), bunchcr_, cfTrackToken_, cfVertexToken_, dbe_, g4SimHits_Ecal_Token_, g4SimHits_HCal_Token_, g4SimHits_Token_, edm::Event::getByToken(), maxbunch_, minbunch_, and AlCaHLTBitMon_QueryRunRegistry::string.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 54 of file TestSuite.cc.

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

54  {
55  if (!filename_.empty() && dbe_)
57 }
DQMStore * dbe_
Definition: TestSuite.h:62
std::string filename_
Definition: TestSuite.h:58
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
Definition: DQMStore.cc:784

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().