CMS 3D CMS Logo

GEMDQMSourceDigi.cc
Go to the documentation of this file.
9 
14 
16 
19 
20 #include <string>
21 
22 //----------------------------------------------------------------------------------------------------
23 
25 {
26 public:
28  ~GEMDQMSourceDigi() override {};
29  static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
30 protected:
31  void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override {};
32  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
33  void analyze(edm::Event const& e, edm::EventSetup const& eSetup) override;
34  void beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& eSetup) override {};
35  void endLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& eSetup) override {};
36  void endRun(edm::Run const& run, edm::EventSetup const& eSetup) override {};
37 
38 private:
40 
41  const GEMGeometry* initGeometry(edm::EventSetup const & iSetup);
42  int findVFAT(float min_, float max_, float x_, int roll_);
43 
45 
46  std::vector<GEMChamber> gemChambers_;
47 
48  std::unordered_map<UInt_t, MonitorElement*> Digi_2D_;
49  std::unordered_map<UInt_t, MonitorElement*> Digi_1D_;
50 
51 };
52 
53 using namespace std;
54 using namespace edm;
55 
56 int GEMDQMSourceDigi::findVFAT(float min_, float max_, float x_, int roll_) {
57  float step = max_/3;
58  if ( x_ < (min_+step) ) { return 8 - roll_;}
59  else if ( x_ < (min_+2*step) ) { return 16 - roll_;}
60  else { return 24 - roll_;}
61 }
62 
64  const GEMGeometry* GEMGeometry_ = nullptr;
65  try {
67  iSetup.get<MuonGeometryRecord>().get(hGeom);
68  GEMGeometry_ = &*hGeom;
69  }
71  edm::LogError("MuonGEMBaseValidation") << "+++ Error : GEM geometry is unavailable on event loop. +++\n";
72  return nullptr;
73  }
74 
75  return GEMGeometry_;
76 }
77 
79 {
80  tagDigi_ = consumes<GEMDigiCollection>(cfg.getParameter<edm::InputTag>("digisInputLabel"));
81 }
82 
84 {
86  desc.add<edm::InputTag>("digisInputLabel", edm::InputTag("muonGEMDigis", ""));
87  descriptions.add("GEMDQMSourceDigi", desc);
88 }
89 
91 {
92  GEMGeometry_ = initGeometry(iSetup);
93  if ( GEMGeometry_ == nullptr) return ;
94 
95  const std::vector<const GEMSuperChamber*>& superChambers_ = GEMGeometry_->superChambers();
96  for (auto sch : superChambers_){
97  int n_lay = sch->nChambers();
98  for (int l=0;l<n_lay;l++){
99  gemChambers_.push_back(*sch->chamber(l+1));
100  }
101  }
102  ibooker.cd();
103  ibooker.setCurrentFolder("GEM/digi");
104  for (auto ch : gemChambers_){
105  GEMDetId gid = ch.id();
106  string hName_digi = "Digi_Strips_Gemini_"+to_string(gid.chamber())+"_l_"+to_string(gid.layer());
107  string hTitle_digi = "Digi Strip GEMINIm"+to_string(gid.chamber())+"l"+to_string(gid.layer());
108  Digi_2D_[ ch.id() ] = ibooker.book2D(hName_digi, hTitle_digi, 384, 1, 385, 8, 0.5,8.5);
109  Digi_1D_[ ch.id() ] = ibooker.book1D(hName_digi+"_VFAT", hTitle_digi+" VFAT", 24, 0, 24);
110  }
111 }
112 
114 {
115  const GEMGeometry* GEMGeometry_ = initGeometry(eventSetup);
116  if ( GEMGeometry_ == nullptr) return;
117 
119  event.getByToken( this->tagDigi_, gemDigis);
120  for (auto ch : gemChambers_){
121  GEMDetId cId = ch.id();
122  for(auto roll : ch.etaPartitions()){
123  GEMDetId rId = roll->id();
124  const auto& digis_in_det = gemDigis->get(rId);
125  for (auto d = digis_in_det.first; d != digis_in_det.second; ++d){
126  Digi_2D_[ cId ]->Fill(d->strip(), rId.roll());
127  Digi_1D_[ cId ]->Fill(findVFAT(1, roll->nstrips(), d->strip(), rId.roll()));
128  }
129  }
130  }
131 }
132 
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup) override
T getParameter(std::string const &) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int roll() const
Definition: GEMDetId.h:80
void endLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup) override
void endRun(edm::Run const &run, edm::EventSetup const &eSetup) override
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: GEMDetId.h:74
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const GEMGeometry * initGeometry(edm::EventSetup const &iSetup)
std::vector< GEMChamber > gemChambers_
int findVFAT(float min_, float max_, float x_, int roll_)
int layer() const
Layer id: each station have two layers of chambers: layer 1 is the inner chamber and layer 2 is the o...
Definition: GEMDetId.h:69
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
const GEMGeometry * GEMGeometry_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const std::vector< const GEMSuperChamber * > & superChambers() const
Return a vector of all GEM super chambers.
Definition: GEMGeometry.cc:55
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:279
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:136
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
const T & get() const
Definition: EventSetup.h:59
void add(std::string const &label, ParameterSetDescription const &psetDescription)
return(e1-e2)*(e1-e2)+dp *dp
HLT enums.
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
std::unordered_map< UInt_t, MonitorElement * > Digi_1D_
step
~GEMDQMSourceDigi() override
GEMDQMSourceDigi(const edm::ParameterSet &cfg)
edm::EDGetToken tagDigi_
Definition: event.py:1
Definition: Run.h:43
std::unordered_map< UInt_t, MonitorElement * > Digi_2D_