CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCCLCTPreTriggerDigiValidation.cc
Go to the documentation of this file.
4 
8 
11  : CSCBaseValidation(ps),
12  chambers_(ps.getParameter<std::vector<std::string>>("chambers")),
13  // variables
14  preclctVars_(ps.getParameter<std::vector<std::string>>("preclctVars")),
15  // binning
16  preclctNBin_(ps.getParameter<std::vector<unsigned>>("preclctNBin")),
17  preclctMinBin_(ps.getParameter<std::vector<double>>("preclctMinBin")),
18  preclctMaxBin_(ps.getParameter<std::vector<double>>("preclctMaxBin")) {
19  const auto &pset = ps.getParameterSet("cscCLCTPreTrigger");
20  inputTag_ = pset.getParameter<edm::InputTag>("inputTag");
22 }
23 
25 
27  iBooker.setCurrentFolder("MuonCSCDigisV/CSCDigiTask/PreCLCT/Occupancy/");
28 
29  // chamber type
30  for (unsigned iType = 0; iType < chambers_.size(); iType++) {
31  // consider CSC+ and CSC- separately
32  for (unsigned iEndcap = 0; iEndcap < 2; iEndcap++) {
33  const std::string eSign(iEndcap == 0 ? "+" : "-");
34  // preclct variable
35  for (unsigned iVar = 0; iVar < preclctVars_.size(); iVar++) {
36  const std::string key("preclct_" + preclctVars_[iVar]);
37  const std::string histName(key + "_" + chambers_[iType] + eSign);
38  const std::string histTitle(chambers_[iType] + eSign + " CLCTPreTrigger " + preclctVars_[iVar]);
39  const unsigned iTypeCorrected(iEndcap == 0 ? iType : iType + chambers_.size());
40  chamberHistos[iTypeCorrected][key] =
41  iBooker.book1D(histName, histTitle, preclctNBin_[iVar], preclctMinBin_[iVar], preclctMaxBin_[iVar]);
42  chamberHistos[iTypeCorrected][key]->getTH1()->SetMinimum(0);
43  }
44  }
45  }
46 }
47 
50  e.getByToken(preclcts_Token_, preclcts);
51  if (!preclcts.isValid()) {
52  edm::LogError("CSCCLCTPreTriggerDigiValidation") << "Cannot get CLCTPreTriggers by label " << inputTag_.encode();
53  }
54 
55  for (auto j = preclcts->begin(); j != preclcts->end(); j++) {
56  const CSCDetId &detId((*j).first);
57  int chamberType = detId.iChamberType();
58 
59  auto range = preclcts->get((*j).first);
60  // 1=forward (+Z); 2=backward (-Z)
61  const unsigned typeCorrected(detId.endcap() == 1 ? chamberType - 2 : chamberType - 2 + chambers_.size());
62  for (auto preclct = range.first; preclct != range.second; preclct++) {
63  if (preclct->isValid()) {
64  chamberHistos[typeCorrected]["preclct_cfeb"]->Fill(preclct->getCFEB());
65  chamberHistos[typeCorrected]["preclct_halfstrip"]->Fill(preclct->getKeyStrip());
66  chamberHistos[typeCorrected]["preclct_bx"]->Fill(preclct->getBX());
67  }
68  }
69  }
70 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
CSCCLCTPreTriggerDigiValidation(const edm::ParameterSet &ps, edm::ConsumesCollector &&iC)
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
edm::EDGetTokenT< CSCCLCTPreTriggerDigiCollection > preclcts_Token_
tuple key
prepare the HTCondor submission files and eventually submit them
unsigned short iChamberType() const
Definition: CSCDetId.h:96
bool isValid() const
Definition: HandleBase.h:70
ParameterSet const & getParameterSet(std::string const &) const
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
void analyze(const edm::Event &, const edm::EventSetup &) override
std::map< uint32_t, std::map< std::string, MonitorElement * > > chamberHistos
virtual TH1 * getTH1() const
A container for a generic type of digis indexed by some index, implemented with a map&lt;IndexType...