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
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

int bunchcr_
 
edm::InputTag cfTrackTag_
 
edm::InputTag cfVertexTag_
 
DQMStoredbe_
 
std::string filename_
 
int maxbunch_
 
int minbunch_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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 38 of file TestSuite.h.

Constructor & Destructor Documentation

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

Definition at line 41 of file TestSuite.cc.

References bunchcr_, gather_cfg::cout, and filename_.

41  : filename_(iConfig.getParameter<std::string>("fileName")), bunchcr_(iConfig.getParameter<int>("BunchNr")), minbunch_(iConfig.getParameter<int>("minBunch")),maxbunch_(iConfig.getParameter<int>("maxBunch")), dbe_(0),
42  cfTrackTag_(iConfig.getParameter<edm::InputTag>("cfTrackTag")),
43  cfVertexTag_(iConfig.getParameter<edm::InputTag>("cfVertexTag"))
44 {
45  std::cout << "Constructed testSuite , bunchcr "<<bunchcr_<<" filename: "<<filename_<<std::endl;
46 
47 }
T getParameter(std::string const &) const
int maxbunch_
Definition: TestSuite.h:52
int minbunch_
Definition: TestSuite.h:51
DQMStore * dbe_
Definition: TestSuite.h:53
edm::InputTag cfVertexTag_
Definition: TestSuite.h:56
std::string filename_
Definition: TestSuite.h:49
tuple cout
Definition: gather_cfg.py:121
edm::InputTag cfTrackTag_
Definition: TestSuite.h:55
int bunchcr_
Definition: TestSuite.h:50
TestSuite::~TestSuite ( )

Definition at line 50 of file TestSuite.cc.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 73 of file TestSuite.cc.

References DQMStore::book1D(), bunchcr_, cfTrackTag_, cfVertexTag_, dbe_, edm::Event::getByLabel(), maxbunch_, minbunch_, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 57 of file TestSuite.cc.

References dbe_, cppFunctionSkipper::operator, DQMStore::setCurrentFolder(), and DQMStore::showDirStructure().

57  {
58 
59  // get hold of back-end interface
62  dbe_->setCurrentFolder("MixingV/Mixing");
63 }
DQMStore * dbe_
Definition: TestSuite.h:53
void showDirStructure(void) const
Definition: DQMStore.cc:2766
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
void TestSuite::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 65 of file TestSuite.cc.

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

65  {
66  if (filename_.size() != 0 && dbe_ ) dbe_->save(filename_);
67 }
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2118
DQMStore * dbe_
Definition: TestSuite.h:53
std::string filename_
Definition: TestSuite.h:49

Member Data Documentation

int TestSuite::bunchcr_
private

Definition at line 50 of file TestSuite.h.

Referenced by analyze(), and TestSuite().

edm::InputTag TestSuite::cfTrackTag_
private

Definition at line 55 of file TestSuite.h.

Referenced by analyze().

edm::InputTag TestSuite::cfVertexTag_
private

Definition at line 56 of file TestSuite.h.

Referenced by analyze().

DQMStore* TestSuite::dbe_
private

Definition at line 53 of file TestSuite.h.

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

std::string TestSuite::filename_
private

Definition at line 49 of file TestSuite.h.

Referenced by endJob(), and TestSuite().

int TestSuite::maxbunch_
private

Definition at line 52 of file TestSuite.h.

Referenced by analyze().

int TestSuite::minbunch_
private

Definition at line 51 of file TestSuite.h.

Referenced by analyze().