CMS 3D CMS Logo

SiStripLorentzAngleDQM.cc
Go to the documentation of this file.
4 #include "TCanvas.h"
5 
7  edm::RunNumber_t iRun,
8  edm::ParameterSet const &hPSet,
9  edm::ParameterSet const &fPSet,
10  const TrackerTopology *tTopo,
11  const TkDetMap *tkDetMap)
13  if (HistoMaps_On_) {
14  Tk_HM_ = std::make_unique<TkHistoMap>(tkDetMap, "SiStrip/Histo_Map", "LA_TkMap", 0.);
15  }
16 }
17 
19 
21  getConditionObject(eSetup);
22 
23  std::map<uint32_t, float>::const_iterator LAMapIter_;
24  std::map<uint32_t, float> LAMap_ = condObj_->getLorentzAngles();
25 
26  for (LAMapIter_ = LAMap_.begin(); LAMapIter_ != LAMap_.end(); LAMapIter_++) {
27  activeDetIds.push_back((*LAMapIter_).first);
28  }
29 }
30 
31 void SiStripLorentzAngleDQM::fillSummaryMEs(const std::vector<uint32_t> &selectedDetIds) {
32  // -----
33  // LA on layer-level : fill at once all detIds belonging to same layer when
34  // encountering first detID in the layer
35 
36  bool fillNext = true;
37  for (unsigned int i = 0; i < selectedDetIds.size(); i++) {
38  int subDetId_ = DetId(selectedDetIds[i]).subdetId();
39  if (subDetId_ < 3 || subDetId_ > 6) {
40  edm::LogError("SiStripLorentzAngle")
41  << "[SiStripLorentzAngle::fillSummaryMEs] WRONG INPUT : no such "
42  "subdetector type : "
43  << subDetId_ << " and detId " << selectedDetIds[i] << " therefore no filling!" << std::endl;
44  } else if (SummaryOnLayerLevel_On_) {
45  if (fillNext) {
46  fillMEsForLayer(/*SummaryMEsMap_,*/ selectedDetIds[i]);
47  }
48  if (getLayerNameAndId(selectedDetIds[i + 1]) == getLayerNameAndId(selectedDetIds[i])) {
49  fillNext = false;
50  } else {
51  fillNext = true;
52  }
53  } else if (SummaryOnStringLevel_On_) {
54  if (fillNext) {
55  fillMEsForLayer(/*SummaryMEsMap_,*/ selectedDetIds[i]);
56  }
57  if (getStringNameAndId(selectedDetIds[i + 1]) == getStringNameAndId(selectedDetIds[i])) {
58  fillNext = false;
59  } else {
60  fillNext = true;
61  }
62  }
63  }
64 
65  for (std::map<uint32_t, ModMEs>::iterator iter = SummaryMEsMap_.begin(); iter != SummaryMEsMap_.end(); iter++) {
66  ModMEs selME;
67  selME = iter->second;
68 
70  if (fPSet_.getParameter<bool>("OutputSummaryProfileAtLayerLevelAsImage")) {
71  TCanvas c1("c1");
72  selME.SummaryOfProfileDistr->getTProfile()->Draw();
73  std::string name(selME.SummaryOfProfileDistr->getTProfile()->GetTitle());
74  name += ".png";
75  c1.Print(name.c_str());
76  }
77 
78  if (fPSet_.getParameter<bool>("OutputCumulativeSummaryAtLayerLevelAsImage")) {
79  TCanvas c2("c2");
80  selME.SummaryOfCumulDistr->getTH1()->Draw();
82  name2 += ".png";
83  c2.Print(name2.c_str());
84  }
85 
86  } else {
87  if (hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel") &&
88  fPSet_.getParameter<bool>("OutputSummaryProfileAtLayerLevelAsImage")) {
89  TCanvas c1("c1");
90  selME.SummaryOfProfileDistr->getTProfile()->Draw();
91  std::string name(selME.SummaryOfProfileDistr->getTProfile()->GetTitle());
92  name += ".png";
93  c1.Print(name.c_str());
94  }
95 
96  if (hPSet_.getParameter<bool>("FillCumulativeSummaryAtLayerLevel") &&
97  fPSet_.getParameter<bool>("OutputCumulativeSummaryAtLayerLevelAsImage")) {
98  TCanvas c1("c1");
99  selME.SummaryOfCumulDistr->getTH1()->Draw();
101  name += ".png";
102  c1.Print(name.c_str());
103  }
104  }
105  }
106 }
107 
109  /*std::map<uint32_t, ModMEs> selMEsMap_,*/ uint32_t selDetId_) {
111 
112  std::string hSummaryOfProfile_description;
113  hSummaryOfProfile_description = hPSet_.getParameter<std::string>("SummaryOfProfile_description");
114 
115  std::string hSummary_name;
116 
117  int subDetId_ = DetId(selDetId_).subdetId();
118 
119  if (subDetId_ < 3 || subDetId_ > 6) {
120  edm::LogError("SiStripLorentzAngleDQM") << "[SiStripLorentzAngleDQM::fillMEsForLayer] WRONG INPUT : no such "
121  "subdetector type : "
122  << subDetId_ << " no folder set!" << std::endl;
123  return;
124  }
125 
126  std::vector<uint32_t> sameLayerDetIds_;
127  sameLayerDetIds_.clear();
128 
129  if (SummaryOnStringLevel_On_) { // FILLING FOR STRING LEVEL
130 
131  hSummary_name =
132  hidmanager.createHistoLayer(hSummaryOfProfile_description, "layer", getStringNameAndId(selDetId_).first, "");
133  std::map<uint32_t, ModMEs>::iterator selMEsMapIter_ = SummaryMEsMap_.find(getStringNameAndId(selDetId_).second);
134 
135  ModMEs selME_;
136  if (selMEsMapIter_ != SummaryMEsMap_.end())
137  selME_ = selMEsMapIter_->second;
138 
139  getSummaryMEs(selME_, selDetId_);
140 
141  // -----
142  sameLayerDetIds_.clear();
143 
144  switch (DetId(selDetId_).subdetId()) {
146  if (tTopo_->tibIsInternalString(selDetId_)) {
148  activeDetIds, sameLayerDetIds_, tTopo_, tTopo_->tibLayer(selDetId_), 0, 1, tTopo_->tibString(selDetId_));
149  }
150  if (tTopo_->tibIsExternalString(selDetId_)) {
152  activeDetIds, sameLayerDetIds_, tTopo_, tTopo_->tibLayer(selDetId_), 0, 2, tTopo_->tibString(selDetId_));
153  }
154  break;
156  SiStripSubStructure::getTIDDetectors(activeDetIds, sameLayerDetIds_, tTopo_, 0, 0, 0, 0);
157  break;
160  activeDetIds, sameLayerDetIds_, tTopo_, tTopo_->tobLayer(selDetId_), 0, tTopo_->tobRod(selDetId_));
161  break;
163  SiStripSubStructure::getTECDetectors(activeDetIds, sameLayerDetIds_, tTopo_, 0, 0, 0, 0, 0, 0);
164  break;
165  }
166 
167  // -----
168 
169  for (unsigned int i = 0; i < sameLayerDetIds_.size(); i++) {
170  selME_.SummaryOfProfileDistr->Fill(i + 1, condObj_->getLorentzAngle(sameLayerDetIds_[i]));
171 
172  // Fill the Histo_TkMap+TkMap with the LA:
173  if (HistoMaps_On_)
174  Tk_HM_->fill(sameLayerDetIds_[i], condObj_->getLorentzAngle(sameLayerDetIds_[i]));
175 
176  std::cout << sameLayerDetIds_[i] << "\t" << condObj_->getLorentzAngle(sameLayerDetIds_[i]) << std::endl;
177 
178  if (fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On")) {
179  fillTkMap(sameLayerDetIds_[i], condObj_->getLorentzAngle(sameLayerDetIds_[i]));
180  }
181  }
182 
183  std::string hSummaryOfCumul_description;
184  hSummaryOfCumul_description = hPSet_.getParameter<std::string>("SummaryOfCumul_description");
185 
186  std::string hSummaryOfCumul_name;
187 
188  if (subDetId_ < 3 || subDetId_ > 6) {
189  edm::LogError("SiStripLorentzAngleDQM") << "[SiStripLorentzAngleDQM::fillMEsForLayer] WRONG INPUT : no such "
190  "subdetector type : "
191  << subDetId_ << " no folder set!" << std::endl;
192  return;
193  }
194 
195  hSummaryOfCumul_name =
196  hidmanager.createHistoLayer(hSummaryOfCumul_description, "layer", getStringNameAndId(selDetId_).first, "");
197 
198  for (unsigned int i = 0; i < sameLayerDetIds_.size(); i++) {
199  selME_.SummaryOfCumulDistr->Fill(condObj_->getLorentzAngle(sameLayerDetIds_[i]));
200  }
201  } // FILLING FOR STRING LEVEL
202 
203  else { // FILLING FOR LAYER LEVEL
204 
205  std::map<uint32_t, ModMEs>::iterator selMEsMapIter_ = SummaryMEsMap_.find(getLayerNameAndId(selDetId_).second);
206 
207  ModMEs selME_;
208  if (selMEsMapIter_ != SummaryMEsMap_.end())
209  selME_ = selMEsMapIter_->second;
210 
211  getSummaryMEs(selME_, selDetId_);
212 
213  if (hPSet_.getParameter<bool>("FillSummaryProfileAtLayerLevel")) {
214  hSummary_name =
215  hidmanager.createHistoLayer(hSummaryOfProfile_description, "layer", getLayerNameAndId(selDetId_).first, "");
216 
217  // -----
218  sameLayerDetIds_.clear();
219 
220  sameLayerDetIds_ = GetSameLayerDetId(activeDetIds, selDetId_);
221 
222  for (unsigned int i = 0; i < sameLayerDetIds_.size(); i++) {
223  selME_.SummaryOfProfileDistr->Fill(i + 1, condObj_->getLorentzAngle(sameLayerDetIds_[i]));
224 
225  // Fill the Histo_TkMap with LA:
226  if (HistoMaps_On_)
227  Tk_HM_->fill(sameLayerDetIds_[i], condObj_->getLorentzAngle(sameLayerDetIds_[i]));
228 
229  if (fPSet_.getParameter<bool>("TkMap_On") || hPSet_.getParameter<bool>("TkMap_On")) {
230  fillTkMap(sameLayerDetIds_[i], condObj_->getLorentzAngle(sameLayerDetIds_[i]));
231  }
232  }
233  } // if Fill ...
234 
235  if (hPSet_.getParameter<bool>("FillCumulativeSummaryAtLayerLevel")) {
236  std::string hSummaryOfCumul_description;
237  hSummaryOfCumul_description = hPSet_.getParameter<std::string>("SummaryOfCumul_description");
238 
239  std::string hSummaryOfCumul_name;
240 
241  if (subDetId_ < 3 || subDetId_ > 6) {
242  edm::LogError("SiStripLorentzAngleDQM") << "[SiStripLorentzAngleDQM::fillMEsForLayer] WRONG INPUT : no "
243  "such subdetector type : "
244  << subDetId_ << " no folder set!" << std::endl;
245  return;
246  }
247 
248  hSummaryOfCumul_name =
249  hidmanager.createHistoLayer(hSummaryOfCumul_description, "layer", getLayerNameAndId(selDetId_).first, "");
250 
251  for (unsigned int i = 0; i < sameLayerDetIds_.size(); i++) {
252  selME_.SummaryOfCumulDistr->Fill(condObj_->getLorentzAngle(sameLayerDetIds_[i]));
253  }
254  } // if Fill ...
255  } // FILLING FOR LAYER LEVEL
256 }
SiStripHistoId::createHistoLayer
std::string createHistoLayer(std::string description, std::string id_type, std::string path, std::string flag)
Definition: SiStripHistoId.cc:51
SiStripLorentzAngleDQM::getActiveDetIds
void getActiveDetIds(const edm::EventSetup &eSetup) override
Definition: SiStripLorentzAngleDQM.cc:20
edm::RunNumber_t
unsigned int RunNumber_t
Definition: RunLumiEventNumber.h:14
SiStripBaseCondObjDQM::hidmanager
SiStripHistoId hidmanager
Definition: SiStripBaseCondObjDQM.h:141
mps_fire.i
i
Definition: mps_fire.py:428
TrackerTopology::tibIsInternalString
bool tibIsInternalString(const DetId &id) const
Definition: TrackerTopology.h:429
TrackerTopology::tibIsExternalString
bool tibIsExternalString(const DetId &id) const
Definition: TrackerTopology.h:431
SiStripSubStructure::getTIDDetectors
void getTIDDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tidDetRawIds, const TrackerTopology *trackerTopology, uint32_t side=0, uint32_t wheel=0, uint32_t ring=0, uint32_t ster=0)
SiStripSubStructure::getTIBDetectors
void getTIBDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tibDetRawIds, const TrackerTopology *trackerTopology, uint32_t layer=0, uint32_t bkw_frw=0, uint32_t int_ext=0, uint32_t string=0)
TrackerTopology
Definition: TrackerTopology.h:16
SiStripLorentzAngleDQM::~SiStripLorentzAngleDQM
~SiStripLorentzAngleDQM() override
Definition: SiStripLorentzAngleDQM.cc:18
gather_cfg.cout
cout
Definition: gather_cfg.py:144
SiStripBaseCondObjDQM::activeDetIds
std::vector< uint32_t > activeDetIds
Definition: SiStripBaseCondObjDQM.h:114
SiStripLorentzAngleDQM::fillSummaryMEs
void fillSummaryMEs(const std::vector< uint32_t > &selectedDetIds) override
Definition: SiStripLorentzAngleDQM.cc:31
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
SiStripBaseCondObjDQM::ModMEs::SummaryOfProfileDistr
MonitorElement * SummaryOfProfileDistr
Definition: SiStripBaseCondObjDQM.h:75
SiStripBaseCondObjDQM::HistoMaps_On_
bool HistoMaps_On_
Definition: SiStripBaseCondObjDQM.h:100
SiStripLorentzAngleDQM::SiStripLorentzAngleDQM
SiStripLorentzAngleDQM(edm::ESGetToken< SiStripLorentzAngle, SiStripLorentzAngleRcd > token, edm::RunNumber_t iRun, edm::ParameterSet const &hPSet, edm::ParameterSet const &fPSet, const TrackerTopology *tTopo, const TkDetMap *tkDetMap)
Definition: SiStripLorentzAngleDQM.cc:6
SiStripBaseCondObjDQM::SummaryOnLayerLevel_On_
bool SummaryOnLayerLevel_On_
Definition: SiStripBaseCondObjDQM.h:101
SiStripBaseCondObjDQM::SummaryMEsMap_
std::map< uint32_t, ModMEs > SummaryMEsMap_
Definition: SiStripBaseCondObjDQM.h:113
TrackerTopology::tobRod
unsigned int tobRod(const DetId &id) const
Definition: TrackerTopology.h:195
SiStripBaseCondObjDQM::fillTkMap
void fillTkMap(const uint32_t &detid, const float &value)
Definition: SiStripBaseCondObjDQM.cc:1049
DetId
Definition: DetId.h:17
SiStripLorentzAngle
Definition: SiStripLorentzAngle.h:26
SiStripBaseCondObjDQM::getStringNameAndId
std::pair< std::string, uint32_t > getStringNameAndId(const uint32_t &detId_)
Definition: SiStripBaseCondObjDQM.cc:907
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
SiStripBaseCondObjDQM::getLayerNameAndId
std::pair< std::string, uint32_t > getLayerNameAndId(const uint32_t &detId_)
Definition: SiStripBaseCondObjDQM.cc:827
SiStripLorentzAngleDQM.h
SiStripBaseCondObjDQM::Tk_HM_
std::unique_ptr< TkHistoMap > Tk_HM_
Definition: SiStripBaseCondObjDQM.h:117
SiStripSubStructure::getTECDetectors
void getTECDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tecDetRawIds, const TrackerTopology *trackerTopology, uint32_t side=0, uint32_t wheel=0, uint32_t petal_bkw_frw=0, uint32_t petal=0, uint32_t ring=0, uint32_t ster=0)
TkDetMap
Definition: TkDetMap.h:175
StripSubdetector::TIB
static constexpr auto TIB
Definition: StripSubdetector.h:16
dqm::legacy::MonitorElement::getTProfile
virtual TProfile * getTProfile() const
Definition: MonitorElement.h:507
SiStripLorentzAngleDQM::fillMEsForLayer
void fillMEsForLayer(uint32_t selDetId_) override
Definition: SiStripLorentzAngleDQM.cc:108
dqm::legacy::MonitorElement::getTH1
virtual TH1 * getTH1() const
Definition: MonitorElement.h:475
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripBaseCondObjDQMGet
Definition: SiStripBaseCondObjDQM.h:148
TrackerTopology::tibString
unsigned int tibString(const DetId &id) const
Definition: TrackerTopology.h:419
edm::ParameterSet
Definition: ParameterSet.h:47
alignmentValidation.c1
c1
do drawing
Definition: alignmentValidation.py:1025
SiStripLorentzAngleRcd
Definition: SiStripCondDataRecords.h:25
edm::EventSetup
Definition: EventSetup.h:58
dqm::impl::MonitorElement::getTitle
virtual std::string getTitle() const
get MonitorElement title
Definition: MonitorElement.cc:683
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
edm::ESGetToken< SiStripLorentzAngle, SiStripLorentzAngleRcd >
SiStripBaseCondObjDQM::GetSameLayerDetId
std::vector< uint32_t > GetSameLayerDetId(const std::vector< uint32_t > &activeDetIds, uint32_t selDetId)
Definition: SiStripBaseCondObjDQM.cc:1022
SiStripBaseCondObjDQM::ModMEs
Definition: SiStripBaseCondObjDQM.h:64
SiStripLorentzAngle::getLorentzAngle
float getLorentzAngle(const uint32_t &) const
Definition: SiStripLorentzAngle.cc:15
SiStripHistoId
Definition: SiStripHistoId.h:25
TrackerTopology::tobLayer
unsigned int tobLayer(const DetId &id) const
Definition: TrackerTopology.h:147
SiStripLorentzAngle::getLorentzAngles
const std::map< unsigned int, float > & getLorentzAngles() const
Definition: SiStripLorentzAngle.h:32
SiStripSubStructure::getTOBDetectors
void getTOBDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tobDetRawIds, const TrackerTopology *trackerTopology, uint32_t layer=0, uint32_t bkw_frw=0, uint32_t rod=0)
StripSubdetector::TEC
static constexpr auto TEC
Definition: StripSubdetector.h:19
SiStripBaseCondObjDQM::tTopo_
const TrackerTopology * tTopo_
Definition: SiStripBaseCondObjDQM.h:122
SiStripBaseCondObjDQM::getSummaryMEs
void getSummaryMEs(ModMEs &CondObj_ME, const uint32_t &detId_)
Definition: SiStripBaseCondObjDQM.cc:333
SiStripBaseCondObjDQM::SummaryOnStringLevel_On_
bool SummaryOnStringLevel_On_
Definition: SiStripBaseCondObjDQM.h:102
SiStripBaseCondObjDQM::ModMEs::SummaryOfCumulDistr
MonitorElement * SummaryOfCumulDistr
Definition: SiStripBaseCondObjDQM.h:76
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
SiStripBaseCondObjDQM::fPSet_
edm::ParameterSet fPSet_
Definition: SiStripBaseCondObjDQM.h:97
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SiStripBaseCondObjDQM::hPSet_
edm::ParameterSet hPSet_
Definition: SiStripBaseCondObjDQM.h:96
SiStripBaseCondObjDQMGet< SiStripLorentzAngle, SiStripLorentzAngleRcd >::getConditionObject
void getConditionObject(const edm::EventSetup &eSetup) override
Definition: SiStripBaseCondObjDQM.h:159
SiStripBaseCondObjDQMGet< SiStripLorentzAngle, SiStripLorentzAngleRcd >::condObj_
const SiStripLorentzAngle * condObj_
Definition: SiStripBaseCondObjDQM.h:163
hfnoseParametersInitialization_cfi.name2
name2
Definition: hfnoseParametersInitialization_cfi.py:8
StripSubdetector.h
SiStripSubStructure.h
StripSubdetector::TID
static constexpr auto TID
Definition: StripSubdetector.h:17
TrackerTopology::tibLayer
unsigned int tibLayer(const DetId &id) const
Definition: TrackerTopology.h:150
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316