31 minbunch_(iConfig.getParameter<int>(
"minBunch")),
32 maxbunch_(iConfig.getParameter<int>(
"maxBunch")),
33 verbose_(iConfig.getUntrackedParameter<bool>(
"verbose",
false)),
34 dbe_(0),nbin_(maxbunch_-minbunch_+1)
40 edm::LogInfo(
"OutputInfo") <<
" Ecal SimHits Task histograms will NOT be saved";
64 for (std::vector<std::string>::iterator it=names_.begin();it!= names_.end();++it)
67 if (!pset.
exists(
"type"))
continue;
68 std::string
object = pset.
getParameter<std::string>(
"type");
69 std::vector<InputTag>
tags=pset.
getParameter<std::vector<InputTag> >(
"input");
71 if (
object ==
"HepMCProduct" ) {
73 std::string
title =
"Log10 Number of GenParticle in " +
object;
80 else if (
object ==
"SimTrack" ) {
89 else if (
object ==
"SimVertex" ) {
98 else if (
object ==
"PSimHit" ) {
100 for (
unsigned int ii=0;ii<subdets.size();ii++) {
102 std::string
title =
"Log10 Number of " + subdets[ii];
103 std::string
name =
"NumberOf" + subdets[ii];
106 title =
"Time of " + subdets[ii];
107 name =
"TimeOf" + subdets[ii];
115 else if (
object ==
"PCaloHit" ) {
117 for (
unsigned int ii=0;ii<subdets.size();ii++) {
119 std::string
title =
"Log10 Number of " + subdets[ii];
120 std::string
name =
"NumberOf" + subdets[ii];
123 title =
"Time of " + subdets[ii];
124 name =
"TimeOf" + subdets[ii];
162 bool gotHepMCProduct;
165 gotHepMCProduct = iEvent.
getByLabel(
"mix",HepMCProductLabel,crossingFrame);
167 if (gotHepMCProduct){
168 std::auto_ptr<MixCollection<HepMCProduct> >
180 gotSimTrack = iEvent.
getByLabel(
"mix",SimTrackLabel,crossingFrame);
183 std::auto_ptr<MixCollection<SimTrack> >
195 gotSimVertex = iEvent.
getByLabel(
"mix",SimVertexLabel,crossingFrame);
198 std::auto_ptr<MixCollection<SimVertex> >
213 gotPSimHit = iEvent.
getByLabel(
"mix",PSimHitLabel,crossingFrame);
216 std::auto_ptr<MixCollection<PSimHit> >
235 gotPCaloHit = iEvent.
getByLabel(
"mix",PCaloHitLabel,crossingFrame);
238 std::auto_ptr<MixCollection<PCaloHit> >
254 std::vector<int> theMult(
nbin_);
256 for ( theItr_ = theColl_->begin() ; theItr_ != theColl_->end() ; ++theItr_) {
258 int bunch = (*theItr_).eventId().bunchCrossing();
260 if ( index >= 0 && index <
nbin_ ) { theMult[
index] += 1; }
261 else {
edm::LogWarning(
"MixCollectionValidation") <<
"fillMultiplicity: bunch number " << bunch <<
" out of range"; }
273 std::vector<int> theMult(
nbin_);
275 for ( theItr_ = theColl_->begin() ; theItr_ != theColl_->end() ; ++theItr_) {
277 int bunch = theItr_.bunch();
279 if ( index >= 0 && index <
nbin_ ) { theMult[
index] += (*theItr_).GetEvent()->particles_size(); }
280 else {
edm::LogWarning(
"MixCollectionValidation") <<
"fillMultiplicity: bunch number " << bunch <<
" out of range"; }
291 for ( theItr_ = theColl_->begin() ; theItr_ != theColl_->end() ; ++theItr_) {
293 int bunch = (*theItr_).eventId().bunchCrossing();
294 float time = (*theItr_).timeOfFlight();
296 if ( index >= 0 && index <
nbin_ ) { theProfile_->
Fill(
float(bunch+0.5),time); }
297 else {
edm::LogWarning(
"MixCollectionValidation") <<
"fillSimHitTime: bunch number " << bunch <<
" out of range"; }
305 for ( theItr_ = theColl_->begin() ; theItr_ != theColl_->end() ; ++theItr_) {
307 int bunch = (*theItr_).eventId().bunchCrossing();
308 float time = (*theItr_).time();
310 if ( index >= 0 && index <
nbin_ ) { theProfile_->
Fill(
float(bunch+0.5),time); }
311 else {
edm::LogWarning(
"MixCollectionValidation") <<
"fillCaloHitTime: bunch number " << bunch <<
" out of range"; }
T getParameter(std::string const &) const
std::map< std::string, MonitorElement * > CaloHitNrmap_
std::vector< edm::InputTag > HepMCProductTags_
MixCollectionValidation(const edm::ParameterSet &)
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")
bool exists(std::string const ¶meterName) const
checks if a parameter exists
MonitorElement * nrSimTrackH_
std::map< std::string, MonitorElement * > SimHitTimemap_
~MixCollectionValidation()
MonitorElement * nrHepMCProductH_
static std::string subdets[11]
const T & max(const T &a, const T &b)
void fillCaloHitTime(T1 &theItr_, T2 &theColl_, MonitorElement *theProfile_)
void fillMultiplicity(T1 &theItr_, T2 &theColl_, MonitorElement *theProfile_)
std::vector< edm::InputTag > PSimHitTags_
std::map< std::string, MonitorElement * > SimHitNrmap_
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
void setVerbose(unsigned level)
void fillSimHitTime(T1 &theItr_, T2 &theColl_, MonitorElement *theProfile_)
std::vector< std::string > getParameterNames() const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
std::vector< edm::InputTag > PCaloHitTags_
std::vector< edm::InputTag > SimTrackTags_
T const * product() const
std::vector< edm::InputTag > SimVertexTags_
std::map< std::string, MonitorElement * > CaloHitTimemap_
MonitorElement * nrSimVertexH_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void showDirStructure(void) const
void setCurrentFolder(const std::string &fullpath)
void fillGenParticleMulti(T1 &theItr_, T2 &theColl_, MonitorElement *theProfile_)
std::vector< std::string > names_