CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 
 TestSuite (const edm::ParameterSet &)
 
 ~TestSuite ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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 &)
 
- 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

Description: global physics test for Mixing Module

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

30  : filename_(iConfig.getParameter<std::string>("fileName")), bunchcr_(iConfig.getParameter<int>("BunchNr")), minbunch_(iConfig.getParameter<int>("minBunch")),maxbunch_(iConfig.getParameter<int>("maxBunch")), dbe_(0),
32  iConfig.getParameter<edm::InputTag>("cfTrackTag"))),
34  iConfig.getParameter<edm::InputTag>("cfVertexTag"))),
36  edm::InputTag("mix", "g4SimHitsTrackerHitsTECLowTof"))),
38  edm::InputTag("mix", "g4SimHitsEcalHitsEB"))),
40  edm::InputTag("mix", "g4SimHitsHcalHits")))
41 {
42  std::cout << "Constructed testSuite , bunchcr " << bunchcr_
43  << " filename: " << filename_ << std::endl;
44 }
T getParameter(std::string const &) const
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfVertexToken_
Definition: TestSuite.h:64
int maxbunch_
Definition: TestSuite.h:60
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
int minbunch_
Definition: TestSuite.h:59
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfTrackToken_
Definition: TestSuite.h:63
DQMStore * dbe_
Definition: TestSuite.h:61
edm::EDGetTokenT< CrossingFrame< PSimHit > > g4SimHits_Token_
Definition: TestSuite.h:65
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_HCal_Token_
Definition: TestSuite.h:67
std::string filename_
Definition: TestSuite.h:57
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_Ecal_Token_
Definition: TestSuite.h:66
tuple cout
Definition: gather_cfg.py:121
int bunchcr_
Definition: TestSuite.h:58
TestSuite::~TestSuite ( )

Definition at line 47 of file TestSuite.cc.

48 {
49 
50  // do anything here that needs to be done at desctruction time
51  // (e.g. close files, deallocate resources etc.)
52 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 70 of file TestSuite.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 54 of file TestSuite.cc.

References dbe_, and cppFunctionSkipper::operator.

54  {
55 
56  // get hold of back-end interface
58  dbe_->showDirStructure();
59  dbe_->setCurrentFolder("MixingV/Mixing");
60 }
DQMStore * dbe_
Definition: TestSuite.h:61
void TestSuite::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 62 of file TestSuite.cc.

References dbe_, and filename_.

62  {
63  if (filename_.size() != 0 && dbe_ ) dbe_->save(filename_);
64 }
DQMStore * dbe_
Definition: TestSuite.h:61
std::string filename_
Definition: TestSuite.h:57

Member Data Documentation

int TestSuite::bunchcr_
private

Definition at line 58 of file TestSuite.h.

Referenced by analyze(), and TestSuite().

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

Definition at line 63 of file TestSuite.h.

Referenced by analyze().

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

Definition at line 64 of file TestSuite.h.

Referenced by analyze().

DQMStore* TestSuite::dbe_
private

Definition at line 61 of file TestSuite.h.

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

std::string TestSuite::filename_
private

Definition at line 57 of file TestSuite.h.

Referenced by endJob(), and TestSuite().

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

Definition at line 66 of file TestSuite.h.

Referenced by analyze().

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

Definition at line 67 of file TestSuite.h.

Referenced by analyze().

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

Definition at line 65 of file TestSuite.h.

Referenced by analyze().

int TestSuite::maxbunch_
private

Definition at line 60 of file TestSuite.h.

Referenced by analyze().

int TestSuite::minbunch_
private

Definition at line 59 of file TestSuite.h.

Referenced by analyze().