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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (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

◆ DQMStore

Definition at line 47 of file TestSuite.h.

◆ MonitorElement

Definition at line 48 of file TestSuite.h.

Constructor & Destructor Documentation

◆ TestSuite()

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

Definition at line 29 of file TestSuite.cc.

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 }

References bunchcr_, gather_cfg::cout, and filename_.

◆ ~TestSuite()

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

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 60 of file TestSuite.cc.

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 }

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

◆ beginJob()

void TestSuite::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 48 of file TestSuite.cc.

48  {
49  // get hold of back-end interface
50  dbe_ = Service<DQMStore>().operator->();
51  dbe_->setCurrentFolder("MixingV/Mixing");
52 }

References dbe_, and dqm::implementation::DQMStore::setCurrentFolder().

◆ endJob()

void TestSuite::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 54 of file TestSuite.cc.

54  {
55  if (!filename_.empty() && dbe_)
57 }

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

Member Data Documentation

◆ bunchcr_

int TestSuite::bunchcr_
private

Definition at line 59 of file TestSuite.h.

Referenced by analyze(), and TestSuite().

◆ cfTrackToken_

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

Definition at line 64 of file TestSuite.h.

Referenced by analyze().

◆ cfVertexToken_

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

Definition at line 65 of file TestSuite.h.

Referenced by analyze().

◆ dbe_

DQMStore* TestSuite::dbe_
private

Definition at line 62 of file TestSuite.h.

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

◆ filename_

std::string TestSuite::filename_
private

Definition at line 58 of file TestSuite.h.

Referenced by endJob(), and TestSuite().

◆ g4SimHits_Ecal_Token_

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

Definition at line 67 of file TestSuite.h.

Referenced by analyze().

◆ g4SimHits_HCal_Token_

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

Definition at line 68 of file TestSuite.h.

Referenced by analyze().

◆ g4SimHits_Token_

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

Definition at line 66 of file TestSuite.h.

Referenced by analyze().

◆ maxbunch_

int TestSuite::maxbunch_
private

Definition at line 61 of file TestSuite.h.

Referenced by analyze().

◆ minbunch_

int TestSuite::minbunch_
private

Definition at line 60 of file TestSuite.h.

Referenced by analyze().

TestSuite::cfVertexToken_
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfVertexToken_
Definition: TestSuite.h:65
edm::Handle::product
T const * product() const
Definition: Handle.h:70
TestSuite::maxbunch_
int maxbunch_
Definition: TestSuite.h:61
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
TestSuite::g4SimHits_HCal_Token_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_HCal_Token_
Definition: TestSuite.h:68
edm::Handle
Definition: AssociativeIterator.h:50
MixCollection::MixItr
Definition: MixCollection.h:62
CrossingFrame
Definition: CrossingFrame.h:38
MixCollection::MixItr::bunch
int bunch() const
Definition: MixCollection.h:91
TestSuite::filename_
std::string filename_
Definition: TestSuite.h:58
TestSuite::dbe_
DQMStore * dbe_
Definition: TestSuite.h:62
MixCollection
Definition: MixCollection.h:11
MixCollection::MixItr::getTrigger
bool getTrigger() const
Definition: MixCollection.h:98
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
dqm::implementation::DQMStore::setCurrentFolder
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:569
TestSuite::bunchcr_
int bunchcr_
Definition: TestSuite.h:59
TestSuite::g4SimHits_Token_
edm::EDGetTokenT< CrossingFrame< PSimHit > > g4SimHits_Token_
Definition: TestSuite.h:66
dqm::implementation::DQMStore::save
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
Definition: DQMStore.cc:761
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TestSuite::g4SimHits_Ecal_Token_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_Ecal_Token_
Definition: TestSuite.h:67
TestSuite::cfTrackToken_
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfTrackToken_
Definition: TestSuite.h:64
edm::Service
Definition: Service.h:30
iEvent
int iEvent
Definition: GenABIO.cc:224
TestSuite::minbunch_
int minbunch_
Definition: TestSuite.h:60
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:153
edm::InputTag
Definition: InputTag.h:15
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98