CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Types | Private Member Functions | Private Attributes
TkHistoMap Class Reference

#include <TkHistoMap.h>

Public Member Functions

void add (DetId detid, float value)
 
void dumpInTkMap (TrackerMap *tkmap, bool dumpEntries=false)
 
void fill (DetId detid, float value)
 
void fillFromAscii (const std::string &filename)
 
const std::vector< MonitorElement * > & getAllMaps () const
 
std::vector< MonitorElement * > & getAllMaps ()
 
DetId getDetId (const std::string &title, int ix, int iy)
 
DetId getDetId (int layer, int ix, int iy)
 
DetId getDetId (const MonitorElement *ME, int ix, int iy)
 
float getEntries (DetId detid)
 
std::string getLayerName (std::string title)
 
uint16_t getLayerNum (const std::string &layerName)
 
MonitorElementgetMap (short layerNumber)
 
float getValue (DetId detid)
 
void loadServices ()
 
void loadTkHistoMap (const std::string &path, const std::string &MapName, bool mechanicalView=false)
 
void save (const std::string &filename)
 
void saveAsCanvas (const std::string &filename, const std::string &options="", const std::string &mode="RECREATE")
 
void setBinContent (DetId detid, float value)
 
 TkHistoMap (const TkDetMap *tkDetMap, DQMStore::IBooker &ibooker, const std::string &path, const std::string &MapName, float baseline=0, bool mechanicalView=false, bool isTH2F=false)
 
 TkHistoMap (const TkDetMap *tkDetMap, const std::string &path, const std::string &MapName, float baseline=0, bool mechanicalView=false)
 
 TkHistoMap (const TkDetMap *tkDetMap, const std::string &path, const std::string &MapName, float baseline, bool mechanicalView, bool isTH2F)
 
 TkHistoMap (const TkDetMap *tkDetMap)
 
 ~TkHistoMap ()=default
 

Protected Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
typedef std::vector< MonitorElement * > tkHistoMapVect
 

Private Member Functions

void createTkHistoMap (DQMStore::IBooker &ibooker, const std::string &path, const std::string &MapName, float baseline, bool mechanicalView)
 
std::string folderDefinition (DQMStore::IBooker &ibooker, std::string folder, const std::string &MapName, int layer, bool mechanicalView, std::string &fullName)
 
void load (const TkDetMap *tkDetMap, const std::string &path, float baseline, bool mechanicalView, bool isTH2F, bool createTkMap=true)
 

Private Attributes

DetId cached_detid
 
int16_t cached_layer
 
TkLayerMap::XYbin cached_XYbin
 
DQMStoredqmStore_ {nullptr}
 
int HistoNumber
 
bool isTH2F_
 
std::string MapName_
 
const TkDetMaptkdetmap_
 
std::vector< MonitorElement * > tkHistoMap_
 

Detailed Description

Definition at line 12 of file TkHistoMap.h.

Member Typedef Documentation

◆ DQMStore

Definition at line 14 of file TkHistoMap.h.

◆ MonitorElement

Definition at line 15 of file TkHistoMap.h.

◆ tkHistoMapVect

typedef std::vector<MonitorElement*> TkHistoMap::tkHistoMapVect
protected

Definition at line 16 of file TkHistoMap.h.

Constructor & Destructor Documentation

◆ TkHistoMap() [1/4]

TkHistoMap::TkHistoMap ( const TkDetMap tkDetMap,
DQMStore::IBooker ibooker,
const std::string &  path,
const std::string &  MapName,
float  baseline = 0,
bool  mechanicalView = false,
bool  isTH2F = false 
)

Definition at line 35 of file TkHistoMap.cc.

References createTkHistoMap(), load(), LogTrace, MapName_, and castor_dqm_sourceclient_file_cfg::path.

42  : HistoNumber(35), MapName_(MapName) {
43  LogTrace("TkHistoMap") << "TkHistoMap::constructor with parameters";
44  load(tkDetMap, path, baseline, mechanicalView, isTH2F);
45  createTkHistoMap(ibooker, path, MapName_, baseline, mechanicalView);
46 }
void load(const TkDetMap *tkDetMap, const std::string &path, float baseline, bool mechanicalView, bool isTH2F, bool createTkMap=true)
Definition: TkHistoMap.cc:48
int HistoNumber
Definition: TkHistoMap.h:96
#define LogTrace(id)
std::string MapName_
Definition: TkHistoMap.h:97
void createTkHistoMap(DQMStore::IBooker &ibooker, const std::string &path, const std::string &MapName, float baseline, bool mechanicalView)
Definition: TkHistoMap.cc:106

◆ TkHistoMap() [2/4]

TkHistoMap::TkHistoMap ( const TkDetMap tkDetMap,
const std::string &  path,
const std::string &  MapName,
float  baseline = 0,
bool  mechanicalView = false 
)

Definition at line 11 of file TkHistoMap.cc.

References createTkHistoMap(), dqmStore_, load(), LogTrace, MapName_, dqm::implementation::DQMStore::meBookerGetter(), and castor_dqm_sourceclient_file_cfg::path.

13  : HistoNumber(35), MapName_(MapName) {
14  LogTrace("TkHistoMap") << "TkHistoMap::constructor with parameters";
15  load(tkDetMap, path, baseline, mechanicalView, false);
16  dqmStore_->meBookerGetter([this, &path, &baseline, mechanicalView](DQMStore::IBooker& ibooker, DQMStore::IGetter&) {
17  this->createTkHistoMap(ibooker, path, MapName_, baseline, mechanicalView);
18  });
19 }
void load(const TkDetMap *tkDetMap, const std::string &path, float baseline, bool mechanicalView, bool isTH2F, bool createTkMap=true)
Definition: TkHistoMap.cc:48
int HistoNumber
Definition: TkHistoMap.h:96
DQMStore * dqmStore_
Definition: TkHistoMap.h:89
#define LogTrace(id)
std::string MapName_
Definition: TkHistoMap.h:97
void createTkHistoMap(DQMStore::IBooker &ibooker, const std::string &path, const std::string &MapName, float baseline, bool mechanicalView)
Definition: TkHistoMap.cc:106
void meBookerGetter(iFunc f)
Definition: DQMStore.h:709

◆ TkHistoMap() [3/4]

TkHistoMap::TkHistoMap ( const TkDetMap tkDetMap,
const std::string &  path,
const std::string &  MapName,
float  baseline,
bool  mechanicalView,
bool  isTH2F 
)

Definition at line 21 of file TkHistoMap.cc.

References createTkHistoMap(), dqmStore_, load(), LogTrace, MapName_, dqm::implementation::DQMStore::meBookerGetter(), and castor_dqm_sourceclient_file_cfg::path.

27  : HistoNumber(35), MapName_(MapName) {
28  LogTrace("TkHistoMap") << "TkHistoMap::constructor with parameters";
29  load(tkDetMap, path, baseline, mechanicalView, isTH2F);
30  dqmStore_->meBookerGetter([this, &path, &baseline, mechanicalView](DQMStore::IBooker& ibooker, DQMStore::IGetter&) {
31  this->createTkHistoMap(ibooker, path, MapName_, baseline, mechanicalView);
32  });
33 }
void load(const TkDetMap *tkDetMap, const std::string &path, float baseline, bool mechanicalView, bool isTH2F, bool createTkMap=true)
Definition: TkHistoMap.cc:48
int HistoNumber
Definition: TkHistoMap.h:96
DQMStore * dqmStore_
Definition: TkHistoMap.h:89
#define LogTrace(id)
std::string MapName_
Definition: TkHistoMap.h:97
void createTkHistoMap(DQMStore::IBooker &ibooker, const std::string &path, const std::string &MapName, float baseline, bool mechanicalView)
Definition: TkHistoMap.cc:106
void meBookerGetter(iFunc f)
Definition: DQMStore.h:709

◆ TkHistoMap() [4/4]

TkHistoMap::TkHistoMap ( const TkDetMap tkDetMap)

Definition at line 6 of file TkHistoMap.cc.

References f, load(), and LogTrace.

6  : HistoNumber(35) {
7  LogTrace("TkHistoMap") << "TkHistoMap::constructor without parameters";
8  load(tkDetMap, "", 0.0f, false, false, false);
9 }
void load(const TkDetMap *tkDetMap, const std::string &path, float baseline, bool mechanicalView, bool isTH2F, bool createTkMap=true)
Definition: TkHistoMap.cc:48
int HistoNumber
Definition: TkHistoMap.h:96
#define LogTrace(id)
double f[11][100]

◆ ~TkHistoMap()

TkHistoMap::~TkHistoMap ( )
default

Member Function Documentation

◆ add()

void TkHistoMap::add ( DetId  detid,
float  value 
)

Definition at line 253 of file TkHistoMap.cc.

References cached_detid, cached_layer, cached_XYbin, TkDetMap::findLayer(), TkDetMap::getXY(), TkLayerMap::INVALID, TkLayerMap::XYbin::ix, TkLayerMap::XYbin::iy, CalibrationSummaryClient_cfi::kind, pixelTopology::layer, LogTrace, DetId::rawId(), setBinContent(), MonitorElementData::TH2F, tkdetmap_, tkHistoMap_, and MonitorElementData::TPROFILE2D.

Referenced by counter.Counter::register(), SequenceTypes._TaskBase::remove(), and SequenceTypes._TaskBase::replace().

253  {
254 #ifdef debug_TkHistoMap
255  LogTrace("TkHistoMap") << "[TkHistoMap::add]";
256 #endif
258  if (layer == TkLayerMap::INVALID) {
259  edm::LogError("TkHistoMap") << " could not add for detid " << detid.rawId() << ", as the layer is invalid";
260  return;
261  }
264  setBinContent(detid,
265  tkHistoMap_[layer]->getTProfile2D()->GetBinContent(
266  tkHistoMap_[layer]->getTProfile2D()->GetBin(xybin.ix, xybin.iy)) +
267  value);
270  detid,
271  tkHistoMap_[layer]->getTH2F()->GetBinContent(tkHistoMap_[layer]->getTH2F()->GetBin(xybin.ix, xybin.iy)) +
272  value);
273 }
DetId cached_detid
Definition: TkHistoMap.h:92
void setBinContent(DetId detid, float value)
Definition: TkHistoMap.cc:219
int16_t cached_layer
Definition: TkHistoMap.h:93
Log< level::Error, false > LogError
#define LogTrace(id)
std::vector< MonitorElement * > tkHistoMap_
Definition: TkHistoMap.h:95
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
const TkLayerMap::XYbin & getXY(DetId detid, DetId &cached_detid, int16_t &cached_layer, TkLayerMap::XYbin &cached_XYbin) const
Definition: TkDetMap.cc:548
int16_t findLayer(DetId detid, DetId &cached_detid, int16_t &cached_layer, TkLayerMap::XYbin &cached_XYbin) const
Definition: TkDetMap.cc:568
TkLayerMap::XYbin cached_XYbin
Definition: TkHistoMap.h:94
Definition: value.py:1
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const TkDetMap * tkdetmap_
Definition: TkHistoMap.h:91

◆ createTkHistoMap()

void TkHistoMap::createTkHistoMap ( DQMStore::IBooker ibooker,
const std::string &  path,
const std::string &  MapName,
float  baseline,
bool  mechanicalView 
)
private

Definition at line 106 of file TkHistoMap.cc.

References dqm::implementation::IBooker::book2D(), dqm::implementation::IBooker::bookProfile2D(), printsummarytable::folder, folderDefinition(), newFWLiteAna::fullName, TkDetMap::getComponents(), TkDetMap::getDetFromBin(), HistoNumber, createfilelist::int, isTH2F_, pixelTopology::layer, LogTrace, SiPixelPhase1Summary_cfi::MapName, hlt_dqm_clientPB-live_cfg::me, castor_dqm_sourceclient_file_cfg::path, AlCaHLTBitMon_QueryRunRegistry::string, tkdetmap_, and tkHistoMap_.

Referenced by TkHistoMap().

110  {
111  int nchX;
112  int nchY;
113  double lowX, highX;
114  double lowY, highY;
116 
117  tkHistoMap_.resize(HistoNumber);
118  const bool bookTH2F = isTH2F_;
119  for (int layer = 1; layer < HistoNumber; ++layer) {
120  folder = folderDefinition(ibooker, path, MapName, layer, mechanicalView, fullName);
121  tkdetmap_->getComponents(layer, nchX, lowX, highX, nchY, lowY, highY);
123  if (bookTH2F == false) {
124  me = ibooker.bookProfile2D(fullName.c_str(), fullName.c_str(), nchX, lowX, highX, nchY, lowY, highY, 0.0, 0.0);
125  } else {
126  me = ibooker.book2D(fullName.c_str(), fullName.c_str(), nchX, lowX, highX, nchY, lowY, highY);
127  }
128  //initialize bin content for the not assigned bins
129  if (baseline != 0) {
130  for (size_t ix = 1; ix <= (unsigned int)nchX; ++ix)
131  for (size_t iy = 1; iy <= (unsigned int)nchY; ++iy)
132  if (!tkdetmap_->getDetFromBin(layer, ix, iy))
133  me->Fill(1. * (lowX + ix - .5), 1. * (lowY + iy - .5), baseline);
134  }
135 
136  tkHistoMap_[layer] = me;
137 #ifdef debug_TkHistoMap
138  LogTrace("TkHistoMap") << "[TkHistoMap::createTkHistoMap] folder " << folder << " histoName " << fullName
139  << " layer " << layer << " ptr " << tkHistoMap_[layer];
140 #endif
141  }
142 }
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:476
int HistoNumber
Definition: TkHistoMap.h:96
#define LogTrace(id)
std::vector< MonitorElement * > tkHistoMap_
Definition: TkHistoMap.h:95
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
DetId getDetFromBin(int layer, int ix, int iy) const
Definition: TkDetMap.h:191
void getComponents(int layer, int &nchX, double &lowX, double &highX, int &nchY, double &lowY, double &highY) const
Definition: TkDetMap.cc:594
bool isTH2F_
Definition: TkHistoMap.h:98
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
const TkDetMap * tkdetmap_
Definition: TkHistoMap.h:91
std::string folderDefinition(DQMStore::IBooker &ibooker, std::string folder, const std::string &MapName, int layer, bool mechanicalView, std::string &fullName)
Definition: TkHistoMap.cc:144

◆ dumpInTkMap()

void TkHistoMap::dumpInTkMap ( TrackerMap tkmap,
bool  dumpEntries = false 
)

Definition at line 306 of file TkHistoMap.cc.

References TrackerMap::fill(), TkDetMap::getDetsForLayer(), getEntries(), getValue(), HistoNumber, mps_fire::i, pixelTopology::layer, and tkdetmap_.

Referenced by SiStripDetVOffTkMapPlotter::analyze(), and TkVoltageMapCreator::beginRun().

306  {
307  for (int layer = 1; layer < HistoNumber; ++layer) {
308  // std::vector<uint32_t> dets;
309  // tkdetmap_->getDetsForLayer(layer,dets);
310  std::vector<DetId> dets = tkdetmap_->getDetsForLayer(layer);
311  for (size_t i = 0; i < dets.size(); ++i) {
312  if (dets[i] > 0) {
313  if (getEntries(dets[i]) > 0) {
314  tkmap->fill(dets[i], dumpEntries ? getEntries(dets[i]) : getValue(dets[i]));
315  }
316  }
317  }
318  }
319 }
int HistoNumber
Definition: TkHistoMap.h:96
std::vector< DetId > getDetsForLayer(int layer) const
Definition: TkDetMap.h:196
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
const TkDetMap * tkdetmap_
Definition: TkHistoMap.h:91
float getEntries(DetId detid)
Definition: TkHistoMap.cc:290
float getValue(DetId detid)
Definition: TkHistoMap.cc:275
void fill(int layer, int ring, int nmod, float x)
Definition: TrackerMap.cc:3289

◆ fill()

void TkHistoMap::fill ( DetId  detid,
float  value 
)

Definition at line 187 of file TkHistoMap.cc.

References cached_detid, cached_layer, cached_XYbin, TkDetMap::findLayer(), TkDetMap::getXY(), cuy::ii, TkLayerMap::INVALID, TkLayerMap::XYbin::ix, TkLayerMap::XYbin::iy, findQualityFiles::jj, CalibrationSummaryClient_cfi::kind, pixelTopology::layer, LogTrace, DetId::rawId(), MonitorElementData::TH2F, tkdetmap_, tkHistoMap_, MonitorElementData::TPROFILE2D, TkLayerMap::XYbin::x, and TkLayerMap::XYbin::y.

Referenced by SiStripDetVOffTkMapPlotter::analyze(), TkVoltageMapCreator::beginRun(), SiStripMonitorDigi::FillApvShotsMap(), and fillFromAscii().

187  {
189  if (layer == TkLayerMap::INVALID) {
190  edm::LogError("TkHistoMap") << " could not fill for detid " << detid.rawId() << ", as the layer is invalid";
191  return;
192  }
193 
195 #ifdef debug_TkHistoMap
196  LogTrace("TkHistoMap") << "[TkHistoMap::fill] Fill detid " << detid.rawId() << " Layer " << layer << " value "
197  << value << " ix,iy " << xybin.ix << " " << xybin.iy << " " << xybin.x << " " << xybin.y << " "
198  << tkHistoMap_[layer]->getTProfile2D()->GetName();
199 #endif
201  tkHistoMap_[layer]->getTProfile2D()->Fill(xybin.x, xybin.y, value);
203  tkHistoMap_[layer]->getTH2F()->Fill(xybin.x, xybin.y, value);
204 #ifdef debug_TkHistoMap
205  LogTrace("TkHistoMap") << "[TkHistoMap::fill] "
206  << tkHistoMap_[layer]->getTProfile2D()->GetBinContent(xybin.ix, xybin.iy);
207  for (size_t ii = 0; ii < 4; ii++)
208  for (size_t jj = 0; jj < 11; jj++) {
210  LogTrace("TkHistoMap") << "[TkHistoMap::fill] " << ii << " " << jj << " "
211  << tkHistoMap_[layer]->getTProfile2D()->GetBinContent(ii, jj);
213  LogTrace("TkHistoMap") << "[TkHistoMap::fill] " << ii << " " << jj << " "
214  << tkHistoMap_[layer]->getTH2F()->GetBinContent(ii, jj);
215  }
216 #endif
217 }
DetId cached_detid
Definition: TkHistoMap.h:92
int16_t cached_layer
Definition: TkHistoMap.h:93
Log< level::Error, false > LogError
#define LogTrace(id)
std::vector< MonitorElement * > tkHistoMap_
Definition: TkHistoMap.h:95
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
const TkLayerMap::XYbin & getXY(DetId detid, DetId &cached_detid, int16_t &cached_layer, TkLayerMap::XYbin &cached_XYbin) const
Definition: TkDetMap.cc:548
int16_t findLayer(DetId detid, DetId &cached_detid, int16_t &cached_layer, TkLayerMap::XYbin &cached_XYbin) const
Definition: TkDetMap.cc:568
TkLayerMap::XYbin cached_XYbin
Definition: TkHistoMap.h:94
Definition: value.py:1
ii
Definition: cuy.py:589
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const TkDetMap * tkdetmap_
Definition: TkHistoMap.h:91

◆ fillFromAscii()

void TkHistoMap::fillFromAscii ( const std::string &  filename)

Definition at line 170 of file TkHistoMap.cc.

References Exception, geometryDiff::file, corrVsCorr::filename, fill(), and relativeConstraints::value.

170  {
171  std::ifstream file;
172  file.open(filename.c_str());
173 
174  if (file.fail()) {
175  throw cms::Exception("LogicError") << "failed to open input file" << std::endl;
176  }
177 
178  float value;
179  uint32_t detid;
180  while (file.good()) {
181  file >> detid >> value;
182  fill(detid, value);
183  }
184  file.close();
185 }
Definition: value.py:1
void fill(DetId detid, float value)
Definition: TkHistoMap.cc:187

◆ folderDefinition()

std::string TkHistoMap::folderDefinition ( DQMStore::IBooker ibooker,
std::string  folder,
const std::string &  MapName,
int  layer,
bool  mechanicalView,
std::string &  fullName 
)
private

Definition at line 144 of file TkHistoMap.cc.

References printsummarytable::folder, newFWLiteAna::fullName, TkDetMap::getLayerName(), SiStripFolderOrganizer::getSubDetLayerFolderName(), TkDetMap::getSubDetLayerSide(), pixelTopology::layer, SiPixelPhase1Summary_cfi::MapName, Skims_PA_cff::name, dqm::implementation::NavigatorBase::setCurrentFolder(), SiStripFolderOrganizer::setSiStripFolderName(), contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by createTkHistoMap(), and loadTkHistoMap().

149  {
152 
153  if (mechanicalView) {
154  std::stringstream ss;
155 
156  SiStripFolderOrganizer folderOrg;
157  folderOrg.setSiStripFolderName(folder);
158 
160  uint32_t subdetlayer = 0, side = 0;
161  TkDetMap::getSubDetLayerSide(layer, subDet, subdetlayer, side);
162  folderOrg.getSubDetLayerFolderName(ss, subDet, subdetlayer, side);
163  folder = ss.str();
164  }
165  ibooker.setCurrentFolder(folder);
166  return folder;
167 }
void setSiStripFolderName(std::string name)
static std::string getLayerName(int in)
Definition: TkDetMap.cc:237
static void getSubDetLayerSide(int in, SiStripDetId::SubDetector &, uint32_t &layer, uint32_t &side)
Definition: TkDetMap.cc:383
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
void getSubDetLayerFolderName(std::stringstream &ss, SiStripDetId::SubDetector subDet, uint32_t layer, uint32_t side=0)

◆ getAllMaps() [1/2]

const std::vector<MonitorElement*>& TkHistoMap::getAllMaps ( ) const
inline

Definition at line 45 of file TkHistoMap.h.

References tkHistoMap_.

Referenced by BuildTrackerMapPlugin::subtractMap().

45 { return tkHistoMap_; };
std::vector< MonitorElement * > tkHistoMap_
Definition: TkHistoMap.h:95

◆ getAllMaps() [2/2]

std::vector<MonitorElement*>& TkHistoMap::getAllMaps ( )
inline

Definition at line 46 of file TkHistoMap.h.

References tkHistoMap_.

46 { return tkHistoMap_; };
std::vector< MonitorElement * > tkHistoMap_
Definition: TkHistoMap.h:95

◆ getDetId() [1/3]

DetId TkHistoMap::getDetId ( const std::string &  title,
int  ix,
int  iy 
)
inline

Definition at line 50 of file TkHistoMap.h.

References getLayerName(), getLayerNum(), and runGCPTkAlMap::title.

50  {
51  return getDetId(getLayerNum(getLayerName(title)), ix, iy);
52  }
std::string getLayerName(std::string title)
Definition: TkHistoMap.h:55
DetId getDetId(const std::string &title, int ix, int iy)
Definition: TkHistoMap.h:50
uint16_t getLayerNum(const std::string &layerName)
Definition: TkHistoMap.h:56

◆ getDetId() [2/3]

DetId TkHistoMap::getDetId ( int  layer,
int  ix,
int  iy 
)
inline

Definition at line 53 of file TkHistoMap.h.

References TkDetMap::getDetFromBin(), pixelTopology::layer, and tkdetmap_.

53 { return tkdetmap_->getDetFromBin(layer, ix, iy); }
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
DetId getDetFromBin(int layer, int ix, int iy) const
Definition: TkDetMap.h:191
const TkDetMap * tkdetmap_
Definition: TkHistoMap.h:91

◆ getDetId() [3/3]

DetId TkHistoMap::getDetId ( const MonitorElement ME,
int  ix,
int  iy 
)
inline

Definition at line 54 of file TkHistoMap.h.

References getDetId().

Referenced by getDetId().

54 { return getDetId(ME->getTitle(), ix, iy); }
Definition: ME.h:11
DetId getDetId(const std::string &title, int ix, int iy)
Definition: TkHistoMap.h:50

◆ getEntries()

float TkHistoMap::getEntries ( DetId  detid)

Definition at line 290 of file TkHistoMap.cc.

References cached_detid, cached_layer, cached_XYbin, TkDetMap::findLayer(), TkDetMap::getXY(), TkLayerMap::INVALID, TkLayerMap::XYbin::ix, TkLayerMap::XYbin::iy, CalibrationSummaryClient_cfi::kind, pixelTopology::layer, DetId::rawId(), MonitorElementData::TH2F, tkdetmap_, and tkHistoMap_.

Referenced by dumpInTkMap().

290  {
292  if (layer == TkLayerMap::INVALID) {
293  edm::LogError("TkHistoMap") << " could not getValue for detid " << detid.rawId() << ", as the layer is invalid";
294  return -99999.f;
295  }
296 
298  return 1;
299  } else {
301  return tkHistoMap_[layer]->getTProfile2D()->GetBinEntries(
302  tkHistoMap_[layer]->getTProfile2D()->GetBin(xybin.ix, xybin.iy));
303  }
304 }
DetId cached_detid
Definition: TkHistoMap.h:92
int16_t cached_layer
Definition: TkHistoMap.h:93
Log< level::Error, false > LogError
std::vector< MonitorElement * > tkHistoMap_
Definition: TkHistoMap.h:95
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
const TkLayerMap::XYbin & getXY(DetId detid, DetId &cached_detid, int16_t &cached_layer, TkLayerMap::XYbin &cached_XYbin) const
Definition: TkDetMap.cc:548
int16_t findLayer(DetId detid, DetId &cached_detid, int16_t &cached_layer, TkLayerMap::XYbin &cached_XYbin) const
Definition: TkDetMap.cc:568
TkLayerMap::XYbin cached_XYbin
Definition: TkHistoMap.h:94
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const TkDetMap * tkdetmap_
Definition: TkHistoMap.h:91

◆ getLayerName()

std::string TkHistoMap::getLayerName ( std::string  title)
inline

Definition at line 55 of file TkHistoMap.h.

References MapName_, and runGCPTkAlMap::title.

Referenced by getDetId().

55 { return title.erase(0, MapName_.size() + 1); }
std::string MapName_
Definition: TkHistoMap.h:97

◆ getLayerNum()

uint16_t TkHistoMap::getLayerNum ( const std::string &  layerName)
inline

Definition at line 56 of file TkHistoMap.h.

References TkDetMap::getLayerNum(), and tkdetmap_.

Referenced by getDetId().

56 { return tkdetmap_->getLayerNum(layerName); }
static int getLayerNum(const std::string &in)
Definition: TkDetMap.cc:311
const TkDetMap * tkdetmap_
Definition: TkHistoMap.h:91

◆ getMap()

MonitorElement* TkHistoMap::getMap ( short  layerNumber)
inline

Definition at line 44 of file TkHistoMap.h.

References tkHistoMap_.

44 { return tkHistoMap_[layerNumber]; };
std::vector< MonitorElement * > tkHistoMap_
Definition: TkHistoMap.h:95

◆ getValue()

float TkHistoMap::getValue ( DetId  detid)

Definition at line 275 of file TkHistoMap.cc.

References cached_detid, cached_layer, cached_XYbin, TkDetMap::findLayer(), TkDetMap::getXY(), TkLayerMap::INVALID, TkLayerMap::XYbin::ix, TkLayerMap::XYbin::iy, CalibrationSummaryClient_cfi::kind, pixelTopology::layer, DetId::rawId(), MonitorElementData::TH2F, tkdetmap_, and tkHistoMap_.

Referenced by dumpInTkMap().

275  {
277  if (layer == TkLayerMap::INVALID) {
278  edm::LogError("TkHistoMap") << " could not getValue for detid " << detid.rawId() << ", as the layer is invalid";
279  return -99999.f;
280  }
281 
283 
285  return tkHistoMap_[layer]->getTH2F()->GetBinContent(tkHistoMap_[layer]->getTH2F()->GetBin(xybin.ix, xybin.iy));
286  else
287  return tkHistoMap_[layer]->getTProfile2D()->GetBinContent(
288  tkHistoMap_[layer]->getTProfile2D()->GetBin(xybin.ix, xybin.iy));
289 }
DetId cached_detid
Definition: TkHistoMap.h:92
int16_t cached_layer
Definition: TkHistoMap.h:93
Log< level::Error, false > LogError
std::vector< MonitorElement * > tkHistoMap_
Definition: TkHistoMap.h:95
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
const TkLayerMap::XYbin & getXY(DetId detid, DetId &cached_detid, int16_t &cached_layer, TkLayerMap::XYbin &cached_XYbin) const
Definition: TkDetMap.cc:548
int16_t findLayer(DetId detid, DetId &cached_detid, int16_t &cached_layer, TkLayerMap::XYbin &cached_XYbin) const
Definition: TkDetMap.cc:568
TkLayerMap::XYbin cached_XYbin
Definition: TkHistoMap.h:94
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const TkDetMap * tkdetmap_
Definition: TkHistoMap.h:91

◆ load()

void TkHistoMap::load ( const TkDetMap tkDetMap,
const std::string &  path,
float  baseline,
bool  mechanicalView,
bool  isTH2F,
bool  createTkMap = true 
)
private

Definition at line 48 of file TkHistoMap.cc.

References cached_detid, cached_layer, Exception, isTH2F_, loadServices(), and tkdetmap_.

Referenced by TkHistoMap().

53  {
54  // cannot pass nullptr, otherwise methods making use of TrackerTopology will segfault
55  if (tkDetMap == nullptr) {
56  throw cms::Exception("LogicError") << " expected pointer to TkDetMap is null!\n";
57  }
58 
59  cached_detid = 0;
60  cached_layer = 0;
61  loadServices();
62  tkdetmap_ = tkDetMap;
63  isTH2F_ = isTH2F;
64 }
void loadServices()
Definition: TkHistoMap.cc:66
DetId cached_detid
Definition: TkHistoMap.h:92
int16_t cached_layer
Definition: TkHistoMap.h:93
bool isTH2F_
Definition: TkHistoMap.h:98
const TkDetMap * tkdetmap_
Definition: TkHistoMap.h:91

◆ loadServices()

void TkHistoMap::loadServices ( )

Definition at line 66 of file TkHistoMap.cc.

References dqmStore_, and Utilities::operator.

Referenced by load().

66  {
67  if (!edm::Service<DQMStore>().isAvailable()) {
68  edm::LogError("TkHistoMap")
69  << "\n------------------------------------------"
70  "\nUnAvailable Service DQMStore: please insert in the configuration file an instance like"
71  "\n\tprocess.load(\"DQMServices.Core.DQMStore_cfg\")"
72  "\n------------------------------------------";
73  }
75 }
Log< level::Error, false > LogError
DQMStore * dqmStore_
Definition: TkHistoMap.h:89

◆ loadTkHistoMap()

void TkHistoMap::loadTkHistoMap ( const std::string &  path,
const std::string &  MapName,
bool  mechanicalView = false 
)

Definition at line 82 of file TkHistoMap.cc.

References dqmStore_, printsummarytable::folder, folderDefinition(), newFWLiteAna::fullName, HistoNumber, pixelTopology::layer, LogTrace, SiPixelPhase1Summary_cfi::MapName, MapName_, dqm::implementation::DQMStore::meBookerGetter(), castor_dqm_sourceclient_file_cfg::path, AlCaHLTBitMon_QueryRunRegistry::string, and tkHistoMap_.

Referenced by BuildTrackerMapPlugin::read().

82  {
83  MapName_ = MapName;
84  tkHistoMap_.resize(HistoNumber);
85  auto loadMap = [this, &path, mechanicalView](DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter) {
87  for (int layer = 1; layer < HistoNumber; ++layer) {
88  folder = folderDefinition(ibooker, path, MapName_, layer, mechanicalView, fullName);
89 #ifdef debug_TkHistoMap
90  LogTrace("TkHistoMap") << "[TkHistoMap::loadTkHistoMap] folder " << folder << " histoName " << fullName
91  << " find " << folder.find_last_of("/") << " length " << folder.length();
92 #endif
93  if (folder.find_last_of('/') != folder.length() - 1)
94  folder += "/";
95  tkHistoMap_[layer] = igetter.get(folder + fullName);
96 #ifdef debug_TkHistoMap
97  LogTrace("TkHistoMap") << "[TkHistoMap::loadTkHistoMap] folder " << folder << " histoName " << fullName
98  << " layer " << layer << " ptr " << tkHistoMap_[layer] << " find "
99  << folder.find_last_of("/") << " length " << folder.length();
100 #endif
101  }
102  };
103  dqmStore_->meBookerGetter(loadMap);
104 }
int HistoNumber
Definition: TkHistoMap.h:96
DQMStore * dqmStore_
Definition: TkHistoMap.h:89
#define LogTrace(id)
std::vector< MonitorElement * > tkHistoMap_
Definition: TkHistoMap.h:95
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
std::string MapName_
Definition: TkHistoMap.h:97
void meBookerGetter(iFunc f)
Definition: DQMStore.h:709
std::string folderDefinition(DQMStore::IBooker &ibooker, std::string folder, const std::string &MapName, int layer, bool mechanicalView, std::string &fullName)
Definition: TkHistoMap.cc:144

◆ save()

void TkHistoMap::save ( const std::string &  filename)

Definition at line 77 of file TkHistoMap.cc.

References dqmStore_, corrVsCorr::filename, and dqm::implementation::DQMStore::save().

Referenced by SiStripDetVOffTkMapPlotter::analyze(), and TkVoltageMapCreator::beginRun().

77  {
78  // dqmStore_ only for saving
80 }
DQMStore * dqmStore_
Definition: TkHistoMap.h:89
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
Definition: DQMStore.cc:808

◆ saveAsCanvas()

void TkHistoMap::saveAsCanvas ( const std::string &  filename,
const std::string &  options = "",
const std::string &  mode = "RECREATE" 
)

Definition at line 323 of file TkHistoMap.cc.

References f, corrVsCorr::filename, mps_fire::i, MapName_, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, AlCaHLTBitMon_QueryRunRegistry::string, TkLayerMap::TECM_W1, TkLayerMap::TECM_W2, TkLayerMap::TECM_W3, TkLayerMap::TECM_W4, TkLayerMap::TECM_W5, TkLayerMap::TECM_W6, TkLayerMap::TECM_W7, TkLayerMap::TECM_W8, TkLayerMap::TECM_W9, TkLayerMap::TECP_W1, TkLayerMap::TECP_W2, TkLayerMap::TECP_W3, TkLayerMap::TECP_W4, TkLayerMap::TECP_W5, TkLayerMap::TECP_W6, TkLayerMap::TECP_W7, TkLayerMap::TECP_W8, TkLayerMap::TECP_W9, TkLayerMap::TIB_L1, TkLayerMap::TIB_L2, TkLayerMap::TIB_L3, TkLayerMap::TIB_L4, TkLayerMap::TIDM_D1, TkLayerMap::TIDM_D2, TkLayerMap::TIDM_D3, TkLayerMap::TIDP_D1, TkLayerMap::TIDP_D2, TkLayerMap::TIDP_D3, tkHistoMap_, TkLayerMap::TOB_L1, TkLayerMap::TOB_L2, TkLayerMap::TOB_L3, TkLayerMap::TOB_L4, TkLayerMap::TOB_L5, and TkLayerMap::TOB_L6.

323  {
324  // TCanvas C(MapName_,MapName_,200,10,900,700);
325  TCanvas* CTIB =
326  new TCanvas(std::string("Canvas_" + MapName_ + "TIB").c_str(), std::string("Canvas_" + MapName_ + "TIB").c_str());
327  TCanvas* CTOB =
328  new TCanvas(std::string("Canvas_" + MapName_ + "TOB").c_str(), std::string("Canvas_" + MapName_ + "TOB").c_str());
329  TCanvas* CTIDP = new TCanvas(std::string("Canvas_" + MapName_ + "TIDP").c_str(),
330  std::string("Canvas_" + MapName_ + "TIDP").c_str());
331  TCanvas* CTIDM = new TCanvas(std::string("Canvas_" + MapName_ + "TIDM").c_str(),
332  std::string("Canvas_" + MapName_ + "TIDM").c_str());
333  TCanvas* CTECP = new TCanvas(std::string("Canvas_" + MapName_ + "TECP").c_str(),
334  std::string("Canvas_" + MapName_ + "TECP").c_str());
335  TCanvas* CTECM = new TCanvas(std::string("Canvas_" + MapName_ + "TECM").c_str(),
336  std::string("Canvas_" + MapName_ + "TECM").c_str());
337  CTIB->Divide(2, 2);
338  CTOB->Divide(2, 3);
339  CTIDP->Divide(1, 3);
340  CTIDM->Divide(1, 3);
341  CTECP->Divide(3, 3);
342  CTECM->Divide(3, 3);
343 
344  int i;
345  i = 0;
346  CTIB->cd(++i);
347  tkHistoMap_[TkLayerMap::TIB_L1]->getTProfile2D()->Draw(options.c_str());
348  CTIB->cd(++i);
349  tkHistoMap_[TkLayerMap::TIB_L2]->getTProfile2D()->Draw(options.c_str());
350  CTIB->cd(++i);
351  tkHistoMap_[TkLayerMap::TIB_L3]->getTProfile2D()->Draw(options.c_str());
352  CTIB->cd(++i);
353  tkHistoMap_[TkLayerMap::TIB_L4]->getTProfile2D()->Draw(options.c_str());
354 
355  i = 0;
356  CTIDP->cd(++i);
357  tkHistoMap_[TkLayerMap::TIDP_D1]->getTProfile2D()->Draw(options.c_str());
358  CTIDP->cd(++i);
359  tkHistoMap_[TkLayerMap::TIDP_D2]->getTProfile2D()->Draw(options.c_str());
360  CTIDP->cd(++i);
361  tkHistoMap_[TkLayerMap::TIDP_D3]->getTProfile2D()->Draw(options.c_str());
362 
363  i = 0;
364  CTIDM->cd(++i);
365  tkHistoMap_[TkLayerMap::TIDM_D1]->getTProfile2D()->Draw(options.c_str());
366  CTIDM->cd(++i);
367  tkHistoMap_[TkLayerMap::TIDM_D2]->getTProfile2D()->Draw(options.c_str());
368  CTIDM->cd(++i);
369  tkHistoMap_[TkLayerMap::TIDM_D3]->getTProfile2D()->Draw(options.c_str());
370 
371  i = 0;
372  CTOB->cd(++i);
373  tkHistoMap_[TkLayerMap::TOB_L1]->getTProfile2D()->Draw(options.c_str());
374  CTOB->cd(++i);
375  tkHistoMap_[TkLayerMap::TOB_L2]->getTProfile2D()->Draw(options.c_str());
376  CTOB->cd(++i);
377  tkHistoMap_[TkLayerMap::TOB_L3]->getTProfile2D()->Draw(options.c_str());
378  CTOB->cd(++i);
379  tkHistoMap_[TkLayerMap::TOB_L4]->getTProfile2D()->Draw(options.c_str());
380  CTOB->cd(++i);
381  tkHistoMap_[TkLayerMap::TOB_L5]->getTProfile2D()->Draw(options.c_str());
382  CTOB->cd(++i);
383  tkHistoMap_[TkLayerMap::TOB_L6]->getTProfile2D()->Draw(options.c_str());
384 
385  i = 0;
386  CTECP->cd(++i);
387  tkHistoMap_[TkLayerMap::TECP_W1]->getTProfile2D()->Draw(options.c_str());
388  CTECP->cd(++i);
389  tkHistoMap_[TkLayerMap::TECP_W2]->getTProfile2D()->Draw(options.c_str());
390  CTECP->cd(++i);
391  tkHistoMap_[TkLayerMap::TECP_W3]->getTProfile2D()->Draw(options.c_str());
392  CTECP->cd(++i);
393  tkHistoMap_[TkLayerMap::TECP_W4]->getTProfile2D()->Draw(options.c_str());
394  CTECP->cd(++i);
395  tkHistoMap_[TkLayerMap::TECP_W5]->getTProfile2D()->Draw(options.c_str());
396  CTECP->cd(++i);
397  tkHistoMap_[TkLayerMap::TECP_W6]->getTProfile2D()->Draw(options.c_str());
398  CTECP->cd(++i);
399  tkHistoMap_[TkLayerMap::TECP_W7]->getTProfile2D()->Draw(options.c_str());
400  CTECP->cd(++i);
401  tkHistoMap_[TkLayerMap::TECP_W8]->getTProfile2D()->Draw(options.c_str());
402  CTECP->cd(++i);
403  tkHistoMap_[TkLayerMap::TECP_W9]->getTProfile2D()->Draw(options.c_str());
404 
405  i = 0;
406  CTECM->cd(++i);
407  tkHistoMap_[TkLayerMap::TECM_W1]->getTProfile2D()->Draw(options.c_str());
408  CTECM->cd(++i);
409  tkHistoMap_[TkLayerMap::TECM_W2]->getTProfile2D()->Draw(options.c_str());
410  CTECM->cd(++i);
411  tkHistoMap_[TkLayerMap::TECM_W3]->getTProfile2D()->Draw(options.c_str());
412  CTECM->cd(++i);
413  tkHistoMap_[TkLayerMap::TECM_W4]->getTProfile2D()->Draw(options.c_str());
414  CTECM->cd(++i);
415  tkHistoMap_[TkLayerMap::TECM_W5]->getTProfile2D()->Draw(options.c_str());
416  CTECM->cd(++i);
417  tkHistoMap_[TkLayerMap::TECM_W6]->getTProfile2D()->Draw(options.c_str());
418  CTECM->cd(++i);
419  tkHistoMap_[TkLayerMap::TECM_W7]->getTProfile2D()->Draw(options.c_str());
420  CTECM->cd(++i);
421  tkHistoMap_[TkLayerMap::TECM_W8]->getTProfile2D()->Draw(options.c_str());
422  CTECM->cd(++i);
423  tkHistoMap_[TkLayerMap::TECM_W9]->getTProfile2D()->Draw(options.c_str());
424 
425  TFile* f = new TFile(filename.c_str(), mode.c_str());
426  CTIB->Write();
427  CTIDP->Write();
428  CTIDM->Write();
429  CTOB->Write();
430  CTECP->Write();
431  CTECM->Write();
432  f->Close();
433  delete f;
434 }
std::vector< MonitorElement * > tkHistoMap_
Definition: TkHistoMap.h:95
std::string MapName_
Definition: TkHistoMap.h:97
double f[11][100]

◆ setBinContent()

void TkHistoMap::setBinContent ( DetId  detid,
float  value 
)

Definition at line 219 of file TkHistoMap.cc.

References cached_detid, cached_layer, cached_XYbin, TkDetMap::findLayer(), TkDetMap::getXY(), cuy::ii, TkLayerMap::INVALID, TkLayerMap::XYbin::ix, TkLayerMap::XYbin::iy, findQualityFiles::jj, CalibrationSummaryClient_cfi::kind, pixelTopology::layer, LogTrace, DetId::rawId(), MonitorElementData::TH2F, tkdetmap_, tkHistoMap_, MonitorElementData::TPROFILE2D, TkLayerMap::XYbin::x, and TkLayerMap::XYbin::y.

Referenced by add().

219  {
221  if (layer == TkLayerMap::INVALID) {
222  edm::LogError("TkHistoMap") << " could not setBinContent for detid " << detid.rawId()
223  << ", as the layer is invalid";
224  return;
225  }
227 
229  tkHistoMap_[layer]->getTProfile2D()->SetBinEntries(tkHistoMap_[layer]->getTProfile2D()->GetBin(xybin.ix, xybin.iy),
230  1);
231  tkHistoMap_[layer]->getTProfile2D()->SetBinContent(tkHistoMap_[layer]->getTProfile2D()->GetBin(xybin.ix, xybin.iy),
232  value);
233  } else if (tkHistoMap_[layer]->kind() == MonitorElement::Kind::TH2F) {
234  tkHistoMap_[layer]->setBinContent(xybin.ix, xybin.iy, value);
235  }
236 
237 #ifdef debug_TkHistoMap
238  LogTrace("TkHistoMap") << "[TkHistoMap::setbincontent] setBinContent detid " << detid.rawId() << " Layer " << layer
239  << " value " << value << " ix,iy " << xybin.ix << " " << xybin.iy << " " << xybin.x << " "
240  << xybin.y << " " << tkHistoMap_[layer]->getTProfile2D()->GetName() << " bin "
241  << tkHistoMap_[layer]->getTProfile2D()->GetBin(xybin.ix, xybin.iy);
242 
243  LogTrace("TkHistoMap") << "[TkHistoMap::setbincontent] "
244  << tkHistoMap_[layer]->getTProfile2D()->GetBinContent(xybin.ix, xybin.iy);
245  for (size_t ii = 0; ii < 4; ii++)
246  for (size_t jj = 0; jj < 11; jj++) {
247  LogTrace("TkHistoMap") << "[TkHistoMap::setbincontent] " << ii << " " << jj << " "
248  << tkHistoMap_[layer]->getTProfile2D()->GetBinContent(ii, jj);
249  }
250 #endif
251 }
DetId cached_detid
Definition: TkHistoMap.h:92
int16_t cached_layer
Definition: TkHistoMap.h:93
Log< level::Error, false > LogError
#define LogTrace(id)
std::vector< MonitorElement * > tkHistoMap_
Definition: TkHistoMap.h:95
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
const TkLayerMap::XYbin & getXY(DetId detid, DetId &cached_detid, int16_t &cached_layer, TkLayerMap::XYbin &cached_XYbin) const
Definition: TkDetMap.cc:548
int16_t findLayer(DetId detid, DetId &cached_detid, int16_t &cached_layer, TkLayerMap::XYbin &cached_XYbin) const
Definition: TkDetMap.cc:568
TkLayerMap::XYbin cached_XYbin
Definition: TkHistoMap.h:94
Definition: value.py:1
ii
Definition: cuy.py:589
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const TkDetMap * tkdetmap_
Definition: TkHistoMap.h:91

Member Data Documentation

◆ cached_detid

DetId TkHistoMap::cached_detid
private

Definition at line 92 of file TkHistoMap.h.

Referenced by add(), fill(), getEntries(), getValue(), load(), and setBinContent().

◆ cached_layer

int16_t TkHistoMap::cached_layer
private

Definition at line 93 of file TkHistoMap.h.

Referenced by add(), fill(), getEntries(), getValue(), load(), and setBinContent().

◆ cached_XYbin

TkLayerMap::XYbin TkHistoMap::cached_XYbin
private

Definition at line 94 of file TkHistoMap.h.

Referenced by add(), fill(), getEntries(), getValue(), and setBinContent().

◆ dqmStore_

DQMStore* TkHistoMap::dqmStore_ {nullptr}
private

Definition at line 89 of file TkHistoMap.h.

Referenced by loadServices(), loadTkHistoMap(), save(), and TkHistoMap().

◆ HistoNumber

int TkHistoMap::HistoNumber
private

Definition at line 96 of file TkHistoMap.h.

Referenced by createTkHistoMap(), dumpInTkMap(), and loadTkHistoMap().

◆ isTH2F_

bool TkHistoMap::isTH2F_
private

Definition at line 98 of file TkHistoMap.h.

Referenced by createTkHistoMap(), and load().

◆ MapName_

std::string TkHistoMap::MapName_
private

Definition at line 97 of file TkHistoMap.h.

Referenced by getLayerName(), loadTkHistoMap(), saveAsCanvas(), and TkHistoMap().

◆ tkdetmap_

const TkDetMap* TkHistoMap::tkdetmap_
private

◆ tkHistoMap_

std::vector<MonitorElement*> TkHistoMap::tkHistoMap_
private