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

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

Private Attributes

int bunchcr_
 
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)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Description: test suite for Mixing Module

Description: global physics test for Mixing Module

Definition at line 37 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 {
43  std::cout << "Constructed testSuite , bunchcr "<<bunchcr_<<" filename: "<<filename_<<std::endl;
44 
45 }
T getParameter(std::string const &) const
int maxbunch_
Definition: TestSuite.h:51
int minbunch_
Definition: TestSuite.h:50
DQMStore * dbe_
Definition: TestSuite.h:52
std::string filename_
Definition: TestSuite.h:48
tuple cout
Definition: gather_cfg.py:41
int bunchcr_
Definition: TestSuite.h:49
TestSuite::~TestSuite ( )

Definition at line 48 of file TestSuite.cc.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 71 of file TestSuite.cc.

References DQMStore::book1D(), bunchcr_, dbe_, edm::Event::getByLabel(), edm::Event::getByType(), maxbunch_, and minbunch_.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 55 of file TestSuite.cc.

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

55  {
56 
57  // get hold of back-end interface
60  dbe_->setCurrentFolder("MixingV/Mixing");
61 }
DQMStore * dbe_
Definition: TestSuite.h:52
void showDirStructure(void) const
Definition: DQMStore.cc:2554
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:232
void TestSuite::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 63 of file TestSuite.cc.

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

63  {
64  if (filename_.size() != 0 && dbe_ ) dbe_->save(filename_);
65 }
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:1898
DQMStore * dbe_
Definition: TestSuite.h:52
std::string filename_
Definition: TestSuite.h:48

Member Data Documentation

int TestSuite::bunchcr_
private

Definition at line 49 of file TestSuite.h.

Referenced by analyze(), and TestSuite().

DQMStore* TestSuite::dbe_
private

Definition at line 52 of file TestSuite.h.

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

std::string TestSuite::filename_
private

Definition at line 48 of file TestSuite.h.

Referenced by endJob(), and TestSuite().

int TestSuite::maxbunch_
private

Definition at line 51 of file TestSuite.h.

Referenced by analyze().

int TestSuite::minbunch_
private

Definition at line 50 of file TestSuite.h.

Referenced by analyze().