Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:32:42

0001 #ifndef MixCollectionValidation_H
0002 #define MixCollectionValidation_H
0003 
0004 // system include files
0005 #include "FWCore/Framework/interface/Frameworkfwd.h"
0006 
0007 #include "FWCore/Framework/interface/Event.h"
0008 #include "FWCore/Framework/interface/MakerMacros.h"
0009 
0010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0011 #include "FWCore/ServiceRegistry/interface/Service.h"
0012 #include "FWCore/Utilities/interface/InputTag.h"
0013 
0014 #include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h"
0015 #include "SimDataFormats/CrossingFrame/interface/MixCollection.h"
0016 
0017 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
0018 #include "SimDataFormats/TrackingHit/interface/PSimHit.h"
0019 
0020 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
0021 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0022 
0023 // DQM services for histogram
0024 #include <DQMServices/Core/interface/DQMEDAnalyzer.h>
0025 #include <DQMServices/Core/interface/DQMStore.h>
0026 
0027 #include <string>
0028 
0029 //
0030 // class declaration
0031 //
0032 
0033 class MixCollectionValidation : public DQMEDAnalyzer {
0034 public:
0035   explicit MixCollectionValidation(const edm::ParameterSet &);
0036   ~MixCollectionValidation() override;
0037   void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
0038   void analyze(const edm::Event &, const edm::EventSetup &) override;
0039 
0040 private:
0041   edm::ParameterSet mixObjextsSet_;
0042 
0043   template <class T1, class T2>
0044   void fillMultiplicity(T1 &theItr_, T2 &theColl_, MonitorElement *theProfile_);
0045 
0046   template <class T1, class T2>
0047   void fillGenParticleMulti(T1 &theItr_, T2 &theColl_, MonitorElement *theProfile_);
0048 
0049   template <class T1, class T2>
0050   void fillSimHitTime(T1 &theItr_, T2 &theColl_, MonitorElement *theProfile_);
0051 
0052   template <class T1, class T2>
0053   void fillCaloHitTime(T1 &theItr_, T2 &theColl_, MonitorElement *theProfile_);
0054 
0055   /* N.B. I see vector<InputTag> as private members of this class, but
0056      in the corresponding C++ only the first element, if present, is
0057      used to get products from the event. Hence I did implement a
0058      single Token for each kind of objects, not a vector of
0059      Tokens. For all but PSimHitTags_ and PCaloHitTags_, which have a
0060      corresponding vector of Tokens. */
0061 
0062   edm::EDGetTokenT<CrossingFrame<edm::HepMCProduct>> crossingFrame_Hep_Token_;
0063   edm::EDGetTokenT<CrossingFrame<SimTrack>> crossingFrame_SimTr_Token_;
0064   edm::EDGetTokenT<CrossingFrame<SimVertex>> crossingFrame_SimVtx_Token_;
0065   std::vector<edm::EDGetTokenT<CrossingFrame<PSimHit>>> crossingFrame_PSimHit_Tokens_;
0066   std::vector<edm::EDGetTokenT<CrossingFrame<PCaloHit>>> crossingFrame_PCaloHit_Tokens_;
0067 
0068   std::string outputFile_;
0069   int minbunch_;
0070   int maxbunch_;
0071 
0072   bool verbose_;
0073 
0074   MonitorElement *nrHepMCProductH_;
0075   MonitorElement *nrSimTrackH_;
0076   MonitorElement *nrSimVertexH_;
0077 
0078   std::map<std::string, MonitorElement *> SimHitNrmap_;
0079   std::map<std::string, MonitorElement *> SimHitTimemap_;
0080 
0081   std::map<std::string, MonitorElement *> CaloHitNrmap_;
0082   std::map<std::string, MonitorElement *> CaloHitTimemap_;
0083 
0084   std::vector<edm::InputTag> HepMCProductTags_;
0085   std::vector<edm::InputTag> SimTrackTags_;
0086   std::vector<edm::InputTag> SimVertexTags_;
0087   std::vector<edm::InputTag> PSimHitTags_;
0088   std::vector<edm::InputTag> PCaloHitTags_;
0089 
0090   int nbin_;
0091 };
0092 
0093 #endif