23 minbunch_(iConfig.getParameter<int>(
"minBunch")),
24 maxbunch_(iConfig.getParameter<int>(
"maxBunch")),
25 verbose_(iConfig.getUntrackedParameter<bool>(
"verbose",
false)),
26 dbe_(0),nbin_(maxbunch_-minbunch_+1)
32 edm::LogInfo(
"OutputInfo") <<
" Ecal SimHits Task histograms will NOT be saved";
56 for (std::vector<std::string>::iterator it=names_.begin();it!= names_.end();++it)
59 if (!pset.
exists(
"type"))
continue;
61 std::vector<InputTag>
tags=pset.
getParameter<std::vector<InputTag> >(
"input");
63 if (
object ==
"HepMCProduct" ) {
75 else if (
object ==
"SimTrack" ) {
87 else if (
object ==
"SimVertex" ) {
99 else if (
object ==
"PSimHit" ) {
101 for (
unsigned int ii=0;
ii<subdets.size();
ii++) {
107 title =
"Time of " + subdets[
ii];
108 name =
"TimeOf" + subdets[
ii];
118 else if (
object ==
"PCaloHit" ) {
120 for (
unsigned int ii=0;
ii<subdets.size();
ii++) {
126 title =
"Time of " + subdets[
ii];
127 name =
"TimeOf" + subdets[
ii];
168 bool gotHepMCProduct;
172 if (gotHepMCProduct){
173 std::auto_ptr<MixCollection<HepMCProduct> >
187 std::auto_ptr<MixCollection<SimTrack> >
202 std::auto_ptr<MixCollection<SimVertex> >
219 std::auto_ptr<MixCollection<PSimHit> >
241 std::auto_ptr<MixCollection<PCaloHit> >
257 std::vector<int> theMult(
nbin_);
259 for ( theItr_ = theColl_->begin() ; theItr_ != theColl_->end() ; ++theItr_) {
261 int bunch = (*theItr_).eventId().bunchCrossing();
263 if ( index >= 0 && index <
nbin_ ) { theMult[
index] += 1; }
264 else {
edm::LogWarning(
"MixCollectionValidation") <<
"fillMultiplicity: bunch number " << bunch <<
" out of range"; }
276 std::vector<int> theMult(
nbin_);
278 for ( theItr_ = theColl_->begin() ; theItr_ != theColl_->end() ; ++theItr_) {
280 int bunch = theItr_.bunch();
282 if ( index >= 0 && index <
nbin_ ) { theMult[
index] += (*theItr_).GetEvent()->particles_size(); }
283 else {
edm::LogWarning(
"MixCollectionValidation") <<
"fillMultiplicity: bunch number " << bunch <<
" out of range"; }
294 for ( theItr_ = theColl_->begin() ; theItr_ != theColl_->end() ; ++theItr_) {
296 int bunch = (*theItr_).eventId().bunchCrossing();
297 float time = (*theItr_).timeOfFlight();
299 if ( index >= 0 && index <
nbin_ ) { theProfile_->
Fill(
float(bunch+0.5),time); }
300 else {
edm::LogWarning(
"MixCollectionValidation") <<
"fillSimHitTime: bunch number " << bunch <<
" out of range"; }
308 for ( theItr_ = theColl_->begin() ; theItr_ != theColl_->end() ; ++theItr_) {
310 int bunch = (*theItr_).eventId().bunchCrossing();
311 float time = (*theItr_).time();
313 if ( index >= 0 && index <
nbin_ ) { theProfile_->
Fill(
float(bunch+0.5),time); }
314 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::EDGetTokenT< CrossingFrame< PCaloHit > > > crossingFrame_PCaloHit_Tokens_
std::vector< edm::InputTag > HepMCProductTags_
MixCollectionValidation(const edm::ParameterSet &)
static PFTauRenderPlugin instance
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< edm::EDGetTokenT< CrossingFrame< PSimHit > > > crossingFrame_PSimHit_Tokens_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
MonitorElement * nrSimTrackH_
std::map< std::string, MonitorElement * > SimHitTimemap_
~MixCollectionValidation()
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
MonitorElement * nrHepMCProductH_
const T & max(const T &a, const T &b)
void fillCaloHitTime(T1 &theItr_, T2 &theColl_, MonitorElement *theProfile_)
edm::EDGetTokenT< CrossingFrame< SimVertex > > crossingFrame_SimVtx_Token_
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_)
edm::EDGetTokenT< CrossingFrame< SimTrack > > crossingFrame_SimTr_Token_
std::vector< std::string > getParameterNames() const
std::vector< edm::InputTag > PCaloHitTags_
std::vector< edm::InputTag > SimTrackTags_
edm::EDGetTokenT< CrossingFrame< edm::HepMCProduct > > crossingFrame_Hep_Token_
constexpr char const * subdets[11]
T const * product() const
std::vector< edm::InputTag > SimVertexTags_
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)
std::map< std::string, MonitorElement * > CaloHitTimemap_
MonitorElement * nrSimVertexH_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
volatile std::atomic< bool > shutdown_flag false
void showDirStructure(void) const
void setCurrentFolder(const std::string &fullpath)
void fillGenParticleMulti(T1 &theItr_, T2 &theColl_, MonitorElement *theProfile_)
std::vector< std::string > names_