CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCALCTDigiValidation.cc
Go to the documentation of this file.
4 
8 
10  : CSCBaseValidation(ps),
11  theNDigisPerChamberPlots(),
12  chambers_(ps.getParameter<std::vector<std::string>>("chambers")),
13  // variables
14  alctVars_(ps.getParameter<std::vector<std::string>>("alctVars")),
15  // binning
16  alctNBin_(ps.getParameter<std::vector<unsigned>>("alctNBin")),
17  alctMinBin_(ps.getParameter<std::vector<double>>("alctMinBin")),
18  alctMaxBin_(ps.getParameter<std::vector<double>>("alctMaxBin")) {
19  const auto &pset = ps.getParameterSet("cscALCT");
20  inputTag_ = pset.getParameter<edm::InputTag>("inputTag");
22 }
23 
25 
27  iBooker.setCurrentFolder("MuonCSCDigisV/CSCDigiTask/ALCT/Occupancy/");
28 
29  theNDigisPerEventPlot = iBooker.book1D(
30  "CSCALCTDigisPerEvent", "ALCT trigger primitives per event; Number of ALCTs; Entries", 100, 0, 100);
31  for (int i = 1; i <= 10; ++i) {
32  const std::string t2("CSCALCTDigisPerChamber_" + CSCDetId::chamberName(i));
33  theNDigisPerChamberPlots[i - 1] = iBooker.book1D(
34  t2, "Number of ALCTs per chamber " + CSCDetId::chamberName(i) + ";Number of ALCTs per chamber;Entries", 4, 0, 4);
35  }
36 
37  // chamber type
38  for (unsigned iType = 0; iType < chambers_.size(); iType++) {
39  // consider CSC+ and CSC- separately
40  for (unsigned iEndcap = 0; iEndcap < 2; iEndcap++) {
41  const std::string eSign(iEndcap == 0 ? "+" : "-");
42  // alct variable
43  for (unsigned iVar = 0; iVar < alctVars_.size(); iVar++) {
44  const std::string key("alct_" + alctVars_[iVar]);
45  const std::string histName(key + "_" + chambers_[iType] + eSign);
46  const std::string histTitle(chambers_[iType] + eSign + " ALCT " + alctVars_[iVar]);
47  const unsigned iTypeCorrected(iEndcap == 0 ? iType : iType + chambers_.size());
48  chamberHistos[iTypeCorrected][key] =
49  iBooker.book1D(histName, histTitle, alctNBin_[iVar], alctMinBin_[iVar], alctMaxBin_[iVar]);
50  chamberHistos[iTypeCorrected][key]->getTH1()->SetMinimum(0);
51  }
52  }
53  }
54 }
55 
58  e.getByToken(alcts_Token_, alcts);
59  if (!alcts.isValid()) {
60  edm::LogError("CSCALCTDigiValidation") << "Cannot get ALCTs by label " << inputTag_.encode();
61  }
62  unsigned nDigisPerEvent = 0;
63 
64  for (auto j = alcts->begin(); j != alcts->end(); j++) {
65  auto beginDigi = (*j).second.first;
66  auto endDigi = (*j).second.second;
67  const CSCDetId &detId((*j).first);
68  int chamberType = detId.iChamberType();
69  int nDigis = endDigi - beginDigi;
70  nDigisPerEvent += nDigis;
71  theNDigisPerChamberPlots[chamberType - 1]->Fill(nDigis);
72 
73  auto range = alcts->get((*j).first);
74  // 1=forward (+Z); 2=backward (-Z)
75  const unsigned typeCorrected(detId.endcap() == 1 ? chamberType - 2 : chamberType - 2 + chambers_.size());
76  for (auto alct = range.first; alct != range.second; alct++) {
77  if (alct->isValid()) {
78  chamberHistos[typeCorrected]["alct_quality"]->Fill(alct->getQuality());
79  chamberHistos[typeCorrected]["alct_wiregroup"]->Fill(alct->getKeyWG());
80  chamberHistos[typeCorrected]["alct_bx"]->Fill(alct->getBX());
81  }
82  }
83  }
84  theNDigisPerEventPlot->Fill(nDigisPerEvent);
85 }
std::vector< std::string > chambers_
MonitorElement * theNDigisPerChamberPlots[10]
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
void bookHistograms(DQMStore::IBooker &)
Log< level::Error, false > LogError
std::string encode() const
Definition: InputTag.cc:159
const uint16_t range(const Frame &aFrame)
int endcap() const
Definition: CSCDetId.h:85
void Fill(long long x)
edm::EDGetTokenT< CSCALCTDigiCollection > alcts_Token_
std::vector< double > alctMinBin_
tuple key
prepare the HTCondor submission files and eventually submit them
unsigned short iChamberType() const
Definition: CSCDetId.h:96
void analyze(const edm::Event &, const edm::EventSetup &) override
bool isValid() const
Definition: HandleBase.h:70
std::string chamberName() const
Definition: CSCDetId.cc:92
ParameterSet const & getParameterSet(std::string const &) const
CSCALCTDigiValidation(const edm::ParameterSet &ps, edm::ConsumesCollector &&iC)
std::vector< std::string > alctVars_
std::vector< double > alctMaxBin_
std::vector< unsigned > alctNBin_
MonitorElement * theNDigisPerEventPlot
std::map< uint32_t, std::map< std::string, MonitorElement * > > chamberHistos
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
virtual TH1 * getTH1() const