CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CSCCLCTDigiValidation Class Reference

#include <CSCCLCTDigiValidation.h>

Inheritance diagram for CSCCLCTDigiValidation:
CSCBaseValidation

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &)
 
 CSCCLCTDigiValidation (const edm::ParameterSet &ps, edm::ConsumesCollector &&iC)
 
 ~CSCCLCTDigiValidation () override
 
- Public Member Functions inherited from CSCBaseValidation
 CSCBaseValidation (const edm::ParameterSet &ps)
 
void setGeometry (const CSCGeometry *geom)
 
void setSimHitMap (const PSimHitMap *simHitMap)
 
virtual ~CSCBaseValidation ()
 

Private Attributes

std::map< uint32_t, std::map< std::string, MonitorElement * > > chamberHistos
 
std::vector< std::string > chambers_
 
std::vector< unsigned > chambersRun3_
 
std::vector< double > clctMaxBin_
 
std::vector< double > clctMinBin_
 
std::vector< unsigned > clctNBin_
 
edm::EDGetTokenT< CSCCLCTDigiCollectionclcts_Token_
 
std::vector< std::string > clctVars_
 
edm::InputTag inputTag_
 
bool isRun3_
 
MonitorElementtheNDigisPerChamberPlots [10]
 
MonitorElementtheNDigisPerEventPlot
 

Additional Inherited Members

- Public Types inherited from CSCBaseValidation
typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Protected Member Functions inherited from CSCBaseValidation
const CSCLayerfindLayer (int detId) const
 
bool isSimTrackGood (const SimTrack &t) const
 
- Protected Attributes inherited from CSCBaseValidation
bool doSim_
 
double simTrackMaxEta_
 
double simTrackMinEta_
 
double simTrackMinPt_
 
const CSCGeometrytheCSCGeometry
 
const PSimHitMaptheSimHitMap
 

Detailed Description

Definition at line 10 of file CSCCLCTDigiValidation.h.

Constructor & Destructor Documentation

◆ CSCCLCTDigiValidation()

CSCCLCTDigiValidation::CSCCLCTDigiValidation ( const edm::ParameterSet ps,
edm::ConsumesCollector &&  iC 
)

Definition at line 9 of file CSCCLCTDigiValidation.cc.

References clcts_Token_, edm::ParameterSet::getParameterSet(), inputTag_, and muonDTDigis_cfi::pset.

10  : CSCBaseValidation(ps),
12  chambers_(ps.getParameter<std::vector<std::string>>("chambers")),
13  chambersRun3_(ps.getParameter<std::vector<unsigned>>("chambersRun3")),
14  // variables
15  clctVars_(ps.getParameter<std::vector<std::string>>("clctVars")),
16  // binning
17  clctNBin_(ps.getParameter<std::vector<unsigned>>("clctNBin")),
18  clctMinBin_(ps.getParameter<std::vector<double>>("clctMinBin")),
19  clctMaxBin_(ps.getParameter<std::vector<double>>("clctMaxBin")),
20  isRun3_(ps.getParameter<bool>("isRun3")) {
21  const auto &pset = ps.getParameterSet("cscCLCT");
22  inputTag_ = pset.getParameter<edm::InputTag>("inputTag");
24 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
MonitorElement * theNDigisPerChamberPlots[10]
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
ParameterSet const & getParameterSet(std::string const &) const
std::vector< double > clctMaxBin_
CSCBaseValidation(const edm::ParameterSet &ps)
std::vector< std::string > chambers_
std::vector< unsigned > chambersRun3_
std::vector< unsigned > clctNBin_
std::vector< double > clctMinBin_
edm::EDGetTokenT< CSCCLCTDigiCollection > clcts_Token_
std::vector< std::string > clctVars_

◆ ~CSCCLCTDigiValidation()

CSCCLCTDigiValidation::~CSCCLCTDigiValidation ( )
override

Definition at line 26 of file CSCCLCTDigiValidation.cc.

26 {}

Member Function Documentation

◆ analyze()

void CSCCLCTDigiValidation::analyze ( const edm::Event e,
const edm::EventSetup  
)
overridevirtual

Implements CSCBaseValidation.

Definition at line 67 of file CSCCLCTDigiValidation.cc.

References chamberHistos, chambers_, chambersRun3_, clcts_Token_, MillePedeFileConverter_cfg::e, edm::InputTag::encode(), CSCDetId::endcap(), dqm::impl::MonitorElement::Fill(), spr::find(), CSCDetId::iChamberType(), inputTag_, isRun3_, edm::HandleBase::isValid(), dqmiolumiharvest::j, FastTimerService_cff::range, theNDigisPerChamberPlots, and theNDigisPerEventPlot.

67  {
69  e.getByToken(clcts_Token_, clcts);
70  if (!clcts.isValid()) {
71  edm::LogError("CSCDigiDump") << "Cannot get CLCTs by label " << inputTag_.encode();
72  }
73 
74  unsigned nDigisPerEvent = 0;
75 
76  for (auto j = clcts->begin(); j != clcts->end(); j++) {
77  auto beginDigi = (*j).second.first;
78  auto endDigi = (*j).second.second;
79  const CSCDetId &detId((*j).first);
80  int chamberType = detId.iChamberType();
81  int nDigis = endDigi - beginDigi;
82  nDigisPerEvent += nDigis;
83  theNDigisPerChamberPlots[chamberType - 1]->Fill(nDigis);
84 
85  auto range = clcts->get((*j).first);
86  // 1=forward (+Z); 2=backward (-Z)
87  const unsigned typeCorrected(detId.endcap() == 1 ? chamberType - 2 : chamberType - 2 + chambers_.size());
88  for (auto clct = range.first; clct != range.second; clct++) {
89  if (clct->isValid()) {
90  chamberHistos[typeCorrected]["clct_pattern"]->Fill(clct->getPattern());
91  chamberHistos[typeCorrected]["clct_quality"]->Fill(clct->getQuality());
92  chamberHistos[typeCorrected]["clct_halfstrip"]->Fill(clct->getKeyStrip());
93  chamberHistos[typeCorrected]["clct_bend"]->Fill(clct->getBend());
94  chamberHistos[typeCorrected]["clct_bx"]->Fill(clct->getBX());
95  if (isRun3_) {
96  // ignore these fields for chambers that do not enable the Run-3 algorithm
97  if (std::find(chambersRun3_.begin(), chambersRun3_.end(), chamberType - 2) == chambersRun3_.end())
98  continue;
99  chamberHistos[typeCorrected]["clct_run3pattern"]->Fill(clct->getRun3Pattern());
100  chamberHistos[typeCorrected]["clct_quartstrip"]->Fill(clct->getKeyStrip(4));
101  chamberHistos[typeCorrected]["clct_eighthstrip"]->Fill(clct->getKeyStrip(8));
102  chamberHistos[typeCorrected]["clct_slope"]->Fill(clct->getSlope());
103  chamberHistos[typeCorrected]["clct_compcode"]->Fill(clct->getCompCode());
104  }
105  }
106  }
107  }
108  theNDigisPerEventPlot->Fill(nDigisPerEvent);
109 }
MonitorElement * theNDigisPerChamberPlots[10]
std::string encode() const
Definition: InputTag.cc:159
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
void Fill(long long x)
std::map< uint32_t, std::map< std::string, MonitorElement * > > chamberHistos
std::vector< std::string > chambers_
std::vector< unsigned > chambersRun3_
MonitorElement * theNDigisPerEventPlot
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< CSCCLCTDigiCollection > clcts_Token_

◆ bookHistograms()

void CSCCLCTDigiValidation::bookHistograms ( DQMStore::IBooker iBooker)

Definition at line 28 of file CSCCLCTDigiValidation.cc.

References dqm::implementation::IBooker::book1D(), chamberHistos, CSCDetId::chamberName(), chambers_, chambersRun3_, clctMaxBin_, clctMinBin_, clctNBin_, clctVars_, spr::find(), B2GTnPMonitor_cfi::histTitle, mps_fire::i, isRun3_, crabWrapper::key, dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, RandomServiceHelper::t2, theNDigisPerChamberPlots, and theNDigisPerEventPlot.

28  {
29  iBooker.setCurrentFolder("MuonCSCDigisV/CSCDigiTask/CLCT/Occupancy/");
30 
31  theNDigisPerEventPlot = iBooker.book1D(
32  "CSCCLCTDigisPerEvent", "CLCT trigger primitives per event; Number of CLCTs; Entries", 100, 0, 100);
33  for (int i = 1; i <= 10; ++i) {
34  const std::string t2("CSCCLCTDigisPerChamber_" + CSCDetId::chamberName(i));
35  theNDigisPerChamberPlots[i - 1] = iBooker.book1D(
36  t2, "Number of CLCTs per chamber " + CSCDetId::chamberName(i) + ";Number of CLCTs per chamber;Entries", 4, 0, 4);
37  }
38 
39  // do not analyze Run-3 properties in Run-1 and Run-2 eras
40  if (!isRun3_) {
41  clctVars_.resize(5);
42  }
43 
44  // chamber type
45  for (unsigned iType = 0; iType < chambers_.size(); iType++) {
46  // consider CSC+ and CSC- separately
47  for (unsigned iEndcap = 0; iEndcap < 2; iEndcap++) {
48  const std::string eSign(iEndcap == 0 ? "+" : "-");
49  // clct variable
50  for (unsigned iVar = 0; iVar < clctVars_.size(); iVar++) {
51  if (std::find(chambersRun3_.begin(), chambersRun3_.end(), iType) == chambersRun3_.end()) {
52  if (iVar > 4)
53  continue;
54  }
55  const std::string key("clct_" + clctVars_[iVar]);
56  const std::string histName(key + "_" + chambers_[iType] + eSign);
57  const std::string histTitle(chambers_[iType] + eSign + " CLCT " + clctVars_[iVar]);
58  const unsigned iTypeCorrected(iEndcap == 0 ? iType : iType + chambers_.size());
59  chamberHistos[iTypeCorrected][key] =
60  iBooker.book1D(histName, histTitle, clctNBin_[iVar], clctMinBin_[iVar], clctMaxBin_[iVar]);
61  chamberHistos[iTypeCorrected][key]->getTH1()->SetMinimum(0);
62  }
63  }
64  }
65 }
MonitorElement * theNDigisPerChamberPlots[10]
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::map< uint32_t, std::map< std::string, MonitorElement * > > chamberHistos
std::string chamberName() const
Definition: CSCDetId.cc:92
std::vector< double > clctMaxBin_
std::vector< std::string > chambers_
std::vector< unsigned > chambersRun3_
MonitorElement * theNDigisPerEventPlot
std::vector< unsigned > clctNBin_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
std::vector< double > clctMinBin_
std::vector< std::string > clctVars_

Member Data Documentation

◆ chamberHistos

std::map<uint32_t, std::map<std::string, MonitorElement *> > CSCCLCTDigiValidation::chamberHistos
private

Definition at line 36 of file CSCCLCTDigiValidation.h.

Referenced by analyze(), and bookHistograms().

◆ chambers_

std::vector<std::string> CSCCLCTDigiValidation::chambers_
private

Definition at line 24 of file CSCCLCTDigiValidation.h.

Referenced by analyze(), and bookHistograms().

◆ chambersRun3_

std::vector<unsigned> CSCCLCTDigiValidation::chambersRun3_
private

Definition at line 25 of file CSCCLCTDigiValidation.h.

Referenced by analyze(), and bookHistograms().

◆ clctMaxBin_

std::vector<double> CSCCLCTDigiValidation::clctMaxBin_
private

Definition at line 30 of file CSCCLCTDigiValidation.h.

Referenced by bookHistograms().

◆ clctMinBin_

std::vector<double> CSCCLCTDigiValidation::clctMinBin_
private

Definition at line 29 of file CSCCLCTDigiValidation.h.

Referenced by bookHistograms().

◆ clctNBin_

std::vector<unsigned> CSCCLCTDigiValidation::clctNBin_
private

Definition at line 28 of file CSCCLCTDigiValidation.h.

Referenced by bookHistograms().

◆ clcts_Token_

edm::EDGetTokenT<CSCCLCTDigiCollection> CSCCLCTDigiValidation::clcts_Token_
private

Definition at line 18 of file CSCCLCTDigiValidation.h.

Referenced by analyze(), and CSCCLCTDigiValidation().

◆ clctVars_

std::vector<std::string> CSCCLCTDigiValidation::clctVars_
private

Definition at line 27 of file CSCCLCTDigiValidation.h.

Referenced by bookHistograms().

◆ inputTag_

edm::InputTag CSCCLCTDigiValidation::inputTag_
private

Definition at line 19 of file CSCCLCTDigiValidation.h.

Referenced by analyze(), and CSCCLCTDigiValidation().

◆ isRun3_

bool CSCCLCTDigiValidation::isRun3_
private

Definition at line 32 of file CSCCLCTDigiValidation.h.

Referenced by analyze(), and bookHistograms().

◆ theNDigisPerChamberPlots

MonitorElement* CSCCLCTDigiValidation::theNDigisPerChamberPlots[10]
private

Definition at line 20 of file CSCCLCTDigiValidation.h.

Referenced by analyze(), and bookHistograms().

◆ theNDigisPerEventPlot

MonitorElement* CSCCLCTDigiValidation::theNDigisPerEventPlot
private

Definition at line 21 of file CSCCLCTDigiValidation.h.

Referenced by analyze(), and bookHistograms().