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
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
 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

MonitorElementcaloEnergyEBH_ [nMaxH]
 
MonitorElementcaloEnergyEEH_ [nMaxH]
 
edm::EDGetTokenT
< CrossingFrame< SimTrack > > 
cfTrackToken_
 
edm::EDGetTokenT
< CrossingFrame< SimTrack > > 
cfVertexToken_
 
DQMStoredbe_
 
std::string filename_
 
edm::EDGetTokenT
< CrossingFrame< PCaloHit > > 
g4SimHits_EB_Token_
 
edm::EDGetTokenT
< CrossingFrame< PCaloHit > > 
g4SimHits_EE_Token_
 
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
 
- 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

Definition at line 46 of file GlobalTest.h.

Constructor & Destructor Documentation

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

Definition at line 40 of file GlobalTest.cc.

References gather_cfg::cout, filename_, g4SimHits_EB_Token_, g4SimHits_EE_Token_, maxbunch_, minbunch_, and AlCaHLTBitMon_QueryRunRegistry::string.

40  :
41  filename_(iConfig.getParameter<std::string>("fileName")),
42  minbunch_(iConfig.getParameter<int>("minBunch")),maxbunch_(iConfig.getParameter<int>("maxBunch")), dbe_(0),
44  iConfig.getParameter<edm::InputTag>("cfTrackTag"))),
46  iConfig.getParameter<edm::InputTag>("cfVertexTag")))
47 {
48  std::string ecalsubdetb();
49  std::string ecalsubdete("g4SimHitsEcalHitsEE");
50  g4SimHits_EB_Token_ = consumes<CrossingFrame<PCaloHit> > (
51  edm::InputTag("mix", "g4SimHitsEcalHitsEB"));
52  g4SimHits_EE_Token_ = consumes<CrossingFrame<PCaloHit> > (
53  edm::InputTag("mix", "g4SimHitsEcalHitsEE"));
54 
55  std::cout << "Constructed GlobalTest, filename: "
56  << filename_ << " minbunch: "
57  << minbunch_ << ", maxbunch: "
58  << maxbunch_ << std::endl;
59 
60 }
T getParameter(std::string const &) const
int maxbunch_
Definition: GlobalTest.h:59
DQMStore * dbe_
Definition: GlobalTest.h:70
int minbunch_
Definition: GlobalTest.h:58
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EE_Token_
Definition: GlobalTest.h:78
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfTrackToken_
Definition: GlobalTest.h:75
std::string filename_
Definition: GlobalTest.h:57
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfVertexToken_
Definition: GlobalTest.h:76
tuple cout
Definition: gather_cfg.py:121
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EB_Token_
Definition: GlobalTest.h:77
GlobalTest::~GlobalTest ( )

Definition at line 62 of file GlobalTest.cc.

63 {
64 
65  // do anything here that needs to be done at desctruction time
66  // (e.g. close files, deallocate resources etc.)
67 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 135 of file GlobalTest.cc.

References caloEnergyEBH_, caloEnergyEEH_, cfTrackToken_, cfVertexToken_, MonitorElement::Fill(), g4SimHits_EB_Token_, g4SimHits_EE_Token_, edm::Event::getByToken(), i, maxbunch_, minbunch_, nrTracksH_, nrVerticesH_, AlCaHLTBitMon_QueryRunRegistry::string, and trackPartIdH_.

136 {
137  using namespace edm;
138  using namespace std;
139 
140  // Get input
145  std::string ecalsubdetb("g4SimHitsEcalHitsEB");
146  std::string ecalsubdete("g4SimHitsEcalHitsEE");
147  iEvent.getByToken(cfTrackToken_, cf_track);
148  iEvent.getByToken(cfVertexToken_, cf_vertex);
149  iEvent.getByToken(g4SimHits_EB_Token_, cf_calohitB);
150  iEvent.getByToken(g4SimHits_EE_Token_, cf_calohitE);
151 
152  // number of events/bcr ??
153 
154  // number of tracks
155  for (int i=minbunch_;i<=maxbunch_;++i) {
156  nrTracksH_[i-minbunch_]->Fill(cf_track->getNrPileups(i));
157  }
158 
159  // number of vertices
160  for (int i=minbunch_;i<=maxbunch_;++i) {
161  nrVerticesH_[i-minbunch_]->Fill(cf_vertex->getNrPileups(i));
162  }
163 
164  // part id for each track
165  std::auto_ptr<MixCollection<SimTrack> > coltr(new MixCollection<SimTrack>(cf_track.product()));
167  for (cfitr=coltr->begin(); cfitr!=coltr->end();cfitr++) {
168  trackPartIdH_[cfitr.bunch()-minbunch_]->Fill(cfitr->type());
169  }
170 
171  // energy sum
172  double sumE[10]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
173  std::auto_ptr<MixCollection<PCaloHit> > colecalb(new MixCollection<PCaloHit>(cf_calohitB.product()));
175  for (cfiecalb=colecalb->begin(); cfiecalb!=colecalb->end();cfiecalb++) {
176  sumE[cfiecalb.bunch()-minbunch_]+=cfiecalb->energy();
177  // if (cfiecal.getTrigger()) tofecalhist_sig->Fill(cfiecal->time());
178  // else tofecalhist->Fill(cfiecal->time());
179  }
180  for (int i=minbunch_;i<=maxbunch_;++i) {
182  }
183  double sumEE[10]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
184  std::auto_ptr<MixCollection<PCaloHit> > colecale(new MixCollection<PCaloHit>(cf_calohitE.product()));
186  for (cfiecale=colecale->begin(); cfiecale!=colecale->end();cfiecale++) {
187  sumEE[cfiecale.bunch()-minbunch_]+=cfiecale->energy();
188  // if (cfiecal.getTrigger()) tofecalhist_sig->Fill(cfiecal->time());
189  // else tofecalhist->Fill(cfiecal->time());
190  }
191  for (int i=minbunch_;i<=maxbunch_;++i) {
193  }
194 }
int i
Definition: DBlmapReader.cc:9
int maxbunch_
Definition: GlobalTest.h:59
MonitorElement * caloEnergyEEH_[nMaxH]
Definition: GlobalTest.h:68
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
int minbunch_
Definition: GlobalTest.h:58
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EE_Token_
Definition: GlobalTest.h:78
MonitorElement * trackPartIdH_[nMaxH]
Definition: GlobalTest.h:66
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfTrackToken_
Definition: GlobalTest.h:75
MonitorElement * caloEnergyEBH_[nMaxH]
Definition: GlobalTest.h:67
void Fill(long long x)
MonitorElement * nrTracksH_[nMaxH]
Definition: GlobalTest.h:65
edm::EDGetTokenT< CrossingFrame< SimTrack > > cfVertexToken_
Definition: GlobalTest.h:76
MonitorElement * nrVerticesH_[nMaxH]
Definition: GlobalTest.h:64
edm::EDGetTokenT< CrossingFrame< PCaloHit > > g4SimHits_EB_Token_
Definition: GlobalTest.h:77
void GlobalTest::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 123 of file GlobalTest.cc.

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

123  {
124  if (filename_.size() != 0 && dbe_ ) dbe_->save(filename_);
125 
126  for (int i = 0; i < 6; i++) delete[] labels[i];
127 }
int i
Definition: DBlmapReader.cc:9
DQMStore * dbe_
Definition: GlobalTest.h:70
char * labels[nrHistos]
Definition: GlobalTest.h:73
std::string filename_
Definition: GlobalTest.h:57
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2540

Member Data Documentation

MonitorElement* GlobalTest::caloEnergyEBH_[nMaxH]
private

Definition at line 67 of file GlobalTest.h.

Referenced by analyze(), and beginJob().

MonitorElement* GlobalTest::caloEnergyEEH_[nMaxH]
private

Definition at line 68 of file GlobalTest.h.

Referenced by analyze(), and beginJob().

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

Definition at line 75 of file GlobalTest.h.

Referenced by analyze().

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

Definition at line 76 of file GlobalTest.h.

Referenced by analyze().

DQMStore* GlobalTest::dbe_
private

Definition at line 70 of file GlobalTest.h.

Referenced by beginJob(), and endJob().

std::string GlobalTest::filename_
private

Definition at line 57 of file GlobalTest.h.

Referenced by endJob(), and GlobalTest().

edm::EDGetTokenT<CrossingFrame<PCaloHit> > GlobalTest::g4SimHits_EB_Token_
private

Definition at line 77 of file GlobalTest.h.

Referenced by analyze(), and GlobalTest().

edm::EDGetTokenT<CrossingFrame<PCaloHit> > GlobalTest::g4SimHits_EE_Token_
private

Definition at line 78 of file GlobalTest.h.

Referenced by analyze(), and GlobalTest().

TFile* GlobalTest::histfile_
private

Definition at line 60 of file GlobalTest.h.

char* GlobalTest::labels[nrHistos]
private

Definition at line 73 of file GlobalTest.h.

Referenced by beginJob(), and endJob().

int GlobalTest::maxbunch_
private

Definition at line 59 of file GlobalTest.h.

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

int GlobalTest::minbunch_
private

Definition at line 58 of file GlobalTest.h.

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

const int GlobalTest::nMaxH =10
staticprivate

Definition at line 62 of file GlobalTest.h.

const int GlobalTest::nrHistos =6
staticprivate

Definition at line 72 of file GlobalTest.h.

MonitorElement* GlobalTest::nrPileupsH_[nMaxH]
private

Definition at line 63 of file GlobalTest.h.

Referenced by beginJob().

MonitorElement* GlobalTest::nrTracksH_[nMaxH]
private

Definition at line 65 of file GlobalTest.h.

Referenced by analyze(), and beginJob().

MonitorElement* GlobalTest::nrVerticesH_[nMaxH]
private

Definition at line 64 of file GlobalTest.h.

Referenced by analyze(), and beginJob().

MonitorElement* GlobalTest::trackPartIdH_[nMaxH]
private

Definition at line 66 of file GlobalTest.h.

Referenced by analyze(), and beginJob().