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 | Static Private Attributes
GlobalTest Class Reference

#include <GlobalTest.h>

Inheritance diagram for GlobalTest:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
void beginJob ()
 
void endJob ()
 
 GlobalTest (const edm::ParameterSet &)
 
 ~GlobalTest ()
 
- 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

MonitorElementcaloEnergyEBH_ [nMaxH]
 
MonitorElementcaloEnergyEEH_ [nMaxH]
 
edm::InputTag cfTrackTag_
 
edm::InputTag cfVertexTag_
 
DQMStoredbe_
 
std::string filename_
 
TFile * histfile_
 
char * labels [nrHistos]
 
int maxbunch_
 
int minbunch_
 
MonitorElementnrPileupsH_ [nMaxH]
 
MonitorElementnrTracksH_ [nMaxH]
 
MonitorElementnrVerticesH_ [nMaxH]
 
MonitorElementtrackPartIdH_ [nMaxH]
 

Static Private Attributes

static const int nMaxH =10
 
static const int nrHistos =6
 

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

Definition at line 40 of file GlobalTest.h.

Constructor & Destructor Documentation

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

Definition at line 47 of file GlobalTest.cc.

References gather_cfg::cout, filename_, maxbunch_, and minbunch_.

47  :
48 filename_(iConfig.getParameter<std::string>("fileName")),
49 minbunch_(iConfig.getParameter<int>("minBunch")),maxbunch_(iConfig.getParameter<int>("maxBunch")), dbe_(0),
50 cfTrackTag_(iConfig.getParameter<edm::InputTag>("cfTrackTag")),
51 cfVertexTag_(iConfig.getParameter<edm::InputTag>("cfVertexTag"))
52 {
53  std::cout << "Constructed GlobalTest, filename: "<<filename_<<" minbunch: "<<minbunch_<<", maxbunch: "<<maxbunch_<<std::endl;
54 
55 }
T getParameter(std::string const &) const
int maxbunch_
Definition: GlobalTest.h:53
DQMStore * dbe_
Definition: GlobalTest.h:64
int minbunch_
Definition: GlobalTest.h:52
std::string filename_
Definition: GlobalTest.h:51
edm::InputTag cfVertexTag_
Definition: GlobalTest.h:70
tuple cout
Definition: gather_cfg.py:121
edm::InputTag cfTrackTag_
Definition: GlobalTest.h:69
GlobalTest::~GlobalTest ( )

Definition at line 57 of file GlobalTest.cc.

58 {
59 
60  // do anything here that needs to be done at desctruction time
61  // (e.g. close files, deallocate resources etc.)
62 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 130 of file GlobalTest.cc.

References caloEnergyEBH_, caloEnergyEEH_, cfTrackTag_, cfVertexTag_, MonitorElement::Fill(), edm::Event::getByLabel(), i, maxbunch_, minbunch_, nrTracksH_, nrVerticesH_, AlCaHLTBitMon_QueryRunRegistry::string, and trackPartIdH_.

131 {
132  using namespace edm;
133  using namespace std;
134 
135 // Get input
140  std::string ecalsubdetb("g4SimHitsEcalHitsEB");
141  std::string ecalsubdete("g4SimHitsEcalHitsEE");
142  iEvent.getByLabel(cfTrackTag_, cf_track);
143  iEvent.getByLabel(cfVertexTag_, cf_vertex);
144  iEvent.getByLabel("mix",ecalsubdetb,cf_calohitB);
145  iEvent.getByLabel("mix",ecalsubdete,cf_calohitE);
146 
147  // number of events/bcr ??
148 
149  // number of tracks
150  for (int i=minbunch_;i<=maxbunch_;++i) {
151  nrTracksH_[i-minbunch_]->Fill(cf_track->getNrPileups(i));
152  }
153 
154  // number of vertices
155  for (int i=minbunch_;i<=maxbunch_;++i) {
156  nrVerticesH_[i-minbunch_]->Fill(cf_vertex->getNrPileups(i));
157  }
158 
159  // part id for each track
160  std::auto_ptr<MixCollection<SimTrack> > coltr(new MixCollection<SimTrack>(cf_track.product()));
162  for (cfitr=coltr->begin(); cfitr!=coltr->end();cfitr++) {
163  trackPartIdH_[cfitr.bunch()-minbunch_]->Fill(cfitr->type());
164  }
165 
166  // energy sum
167  double sumE[10]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
168  std::auto_ptr<MixCollection<PCaloHit> > colecalb(new MixCollection<PCaloHit>(cf_calohitB.product()));
170  for (cfiecalb=colecalb->begin(); cfiecalb!=colecalb->end();cfiecalb++) {
171  sumE[cfiecalb.bunch()-minbunch_]+=cfiecalb->energy();
172  // if (cfiecal.getTrigger()) tofecalhist_sig->Fill(cfiecal->time());
173  // else tofecalhist->Fill(cfiecal->time());
174  }
175  for (int i=minbunch_;i<=maxbunch_;++i) {
177  }
178  double sumEE[10]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
179  std::auto_ptr<MixCollection<PCaloHit> > colecale(new MixCollection<PCaloHit>(cf_calohitE.product()));
181  for (cfiecale=colecale->begin(); cfiecale!=colecale->end();cfiecale++) {
182  sumEE[cfiecale.bunch()-minbunch_]+=cfiecale->energy();
183  // if (cfiecal.getTrigger()) tofecalhist_sig->Fill(cfiecal->time());
184  // else tofecalhist->Fill(cfiecal->time());
185  }
186  for (int i=minbunch_;i<=maxbunch_;++i) {
188  }
189 }
int i
Definition: DBlmapReader.cc:9
int maxbunch_
Definition: GlobalTest.h:53
MonitorElement * caloEnergyEEH_[nMaxH]
Definition: GlobalTest.h:62
int minbunch_
Definition: GlobalTest.h:52
MonitorElement * trackPartIdH_[nMaxH]
Definition: GlobalTest.h:60
MonitorElement * caloEnergyEBH_[nMaxH]
Definition: GlobalTest.h:61
void Fill(long long x)
MonitorElement * nrTracksH_[nMaxH]
Definition: GlobalTest.h:59
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
MonitorElement * nrVerticesH_[nMaxH]
Definition: GlobalTest.h:58
edm::InputTag cfVertexTag_
Definition: GlobalTest.h:70
edm::InputTag cfTrackTag_
Definition: GlobalTest.h:69
void GlobalTest::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 64 of file GlobalTest.cc.

References DQMStore::book1D(), caloEnergyEBH_, caloEnergyEEH_, dbe_, i, cuy::ii, diffTwoXMLs::label, labels, maxbunch_, minbunch_, nrPileupsH_, nrTracksH_, nrVerticesH_, cppFunctionSkipper::operator, DQMStore::setCurrentFolder(), DQMStore::showDirStructure(), AlCaHLTBitMon_QueryRunRegistry::string, and trackPartIdH_.

64  {
65  using namespace std;
66 
67  // get hold of back-end interface
70  dbe_->setCurrentFolder("MixingV/Mixing");
71  //book histos
72  std::string NrPileupEvts = "NrPileupEvts";
73  size_t NrPileupEvtsSize = NrPileupEvts.size() + 1;
74  std::string NrVertices = "NrVertices";
75  size_t NrVerticesSize = NrVertices.size() + 1;
76  std::string NrTracks = "NrTracks";
77  size_t NrTracksSize = NrTracks.size() + 1;
78  std::string TrackPartId = "TrackPartId";
79  size_t TrackPartIdSize = TrackPartId.size() + 1;
80  std::string CaloEnergyEB = "CaloEnergyEB";
81  size_t CaloEnergyEBSize = CaloEnergyEB.size() + 1;
82  std::string CaloEnergyEE = "CaloEnergyEE";
83  size_t CaloEnergyEESize = CaloEnergyEE.size() + 1;
84 
85  labels[0] = new char [NrPileupEvtsSize];
86  strncpy(labels[0], NrPileupEvts.c_str(), NrPileupEvtsSize);
87  labels[1] = new char [NrVerticesSize];
88  strncpy(labels[1], NrVertices.c_str(), NrVerticesSize);
89  labels[2] = new char [NrTracksSize];
90  strncpy(labels[2], NrTracks.c_str(), NrTracksSize);
91  labels[3] = new char [TrackPartIdSize];
92  strncpy(labels[3], TrackPartId.c_str(), TrackPartIdSize);
93  labels[4] = new char [CaloEnergyEBSize];
94  strncpy(labels[4], CaloEnergyEB.c_str(), CaloEnergyEBSize);
95  labels[5] = new char [CaloEnergyEESize];
96  strncpy(labels[5], CaloEnergyEE.c_str(), CaloEnergyEESize);
97 
98  //FIXME: test for max nr of histos
99  for (int i=minbunch_;i<=maxbunch_;++i) {
100  int ii=i-minbunch_;
101  char label[50];
102  sprintf(label,"%s_%d",labels[0],i);
103  nrPileupsH_[ii] = dbe_->book1D(label,label,100,0,100);
104  sprintf(label,"%s_%d",labels[1],i);
105  nrVerticesH_[ii] = dbe_->book1D(label,label,100,0,5000);
106  sprintf(label,"%s_%d",labels[2],i);
107  nrTracksH_[ii] = dbe_->book1D(label,label,100,0,10000);
108  sprintf(label,"%s_%d",labels[3],i);
109  trackPartIdH_[ii] = dbe_->book1D(label,label,100,0,100);
110  sprintf(label,"%s_%d",labels[4],i);
111  caloEnergyEBH_ [ii] = dbe_->book1D(label,label,100,0.,1000.);
112  sprintf(label,"%s_%d",labels[5],i);
113  caloEnergyEEH_ [ii] = dbe_->book1D(label,label,100,0.,1000.);
114  }
115 }
int i
Definition: DBlmapReader.cc:9
int maxbunch_
Definition: GlobalTest.h:53
DQMStore * dbe_
Definition: GlobalTest.h:64
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
MonitorElement * caloEnergyEEH_[nMaxH]
Definition: GlobalTest.h:62
char * labels[nrHistos]
Definition: GlobalTest.h:67
int minbunch_
Definition: GlobalTest.h:52
int ii
Definition: cuy.py:588
MonitorElement * trackPartIdH_[nMaxH]
Definition: GlobalTest.h:60
MonitorElement * caloEnergyEBH_[nMaxH]
Definition: GlobalTest.h:61
MonitorElement * nrPileupsH_[nMaxH]
Definition: GlobalTest.h:57
MonitorElement * nrTracksH_[nMaxH]
Definition: GlobalTest.h:59
MonitorElement * nrVerticesH_[nMaxH]
Definition: GlobalTest.h:58
void showDirStructure(void) const
Definition: DQMStore.cc:2766
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
void GlobalTest::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 118 of file GlobalTest.cc.

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

118  {
119  if (filename_.size() != 0 && dbe_ ) dbe_->save(filename_);
120 
121  for (int i = 0; i < 6; i++) delete[] labels[i];
122 }
int i
Definition: DBlmapReader.cc:9
DQMStore * dbe_
Definition: GlobalTest.h:64
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
char * labels[nrHistos]
Definition: GlobalTest.h:67
std::string filename_
Definition: GlobalTest.h:51

Member Data Documentation

MonitorElement* GlobalTest::caloEnergyEBH_[nMaxH]
private

Definition at line 61 of file GlobalTest.h.

Referenced by analyze(), and beginJob().

MonitorElement* GlobalTest::caloEnergyEEH_[nMaxH]
private

Definition at line 62 of file GlobalTest.h.

Referenced by analyze(), and beginJob().

edm::InputTag GlobalTest::cfTrackTag_
private

Definition at line 69 of file GlobalTest.h.

Referenced by analyze().

edm::InputTag GlobalTest::cfVertexTag_
private

Definition at line 70 of file GlobalTest.h.

Referenced by analyze().

DQMStore* GlobalTest::dbe_
private

Definition at line 64 of file GlobalTest.h.

Referenced by beginJob(), and endJob().

std::string GlobalTest::filename_
private

Definition at line 51 of file GlobalTest.h.

Referenced by endJob(), and GlobalTest().

TFile* GlobalTest::histfile_
private

Definition at line 54 of file GlobalTest.h.

char* GlobalTest::labels[nrHistos]
private

Definition at line 67 of file GlobalTest.h.

Referenced by beginJob(), and endJob().

int GlobalTest::maxbunch_
private

Definition at line 53 of file GlobalTest.h.

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

int GlobalTest::minbunch_
private

Definition at line 52 of file GlobalTest.h.

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

const int GlobalTest::nMaxH =10
staticprivate

Definition at line 56 of file GlobalTest.h.

const int GlobalTest::nrHistos =6
staticprivate

Definition at line 66 of file GlobalTest.h.

MonitorElement* GlobalTest::nrPileupsH_[nMaxH]
private

Definition at line 57 of file GlobalTest.h.

Referenced by beginJob().

MonitorElement* GlobalTest::nrTracksH_[nMaxH]
private

Definition at line 59 of file GlobalTest.h.

Referenced by analyze(), and beginJob().

MonitorElement* GlobalTest::nrVerticesH_[nMaxH]
private

Definition at line 58 of file GlobalTest.h.

Referenced by analyze(), and beginJob().

MonitorElement* GlobalTest::trackPartIdH_[nMaxH]
private

Definition at line 60 of file GlobalTest.h.

Referenced by analyze(), and beginJob().