CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
SiStripHitResolFromCalibTree Class Reference
Inheritance diagram for SiStripHitResolFromCalibTree:
ConditionDBWriter< SiStripBadStrip > edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 SiStripHitResolFromCalibTree (const edm::ParameterSet &)
 
 ~SiStripHitResolFromCalibTree () override=default
 
- Public Member Functions inherited from ConditionDBWriter< SiStripBadStrip >
 ConditionDBWriter (const edm::ParameterSet &iConfig)
 
 ~ConditionDBWriter () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void algoAnalyze (const edm::Event &e, const edm::EventSetup &c) override
 
void algoBeginJob (const edm::EventSetup &) override
 
void algoEndJob () override
 
float calcPhi (float x, float y)
 
void ComputeEff (const edm::Service< TFileService > &fs, vector< TH1F *> &vhfound, vector< TH1F *> &vhtotal, string name)
 
TString GetLayerName (Long_t k)
 
TString GetLayerSideName (Long_t k)
 
std::unique_ptr< SiStripBadStripgetNewObject () override
 
void makeHotColdMaps (const edm::Service< TFileService > &fs)
 
void makeSQLite ()
 
void makeSummary (const edm::Service< TFileService > &fs)
 
void makeSummaryVsBx (const edm::Service< TFileService > &fs)
 
void makeSummaryVsCM (const edm::Service< TFileService > &fs)
 
void makeSummaryVsLumi (const edm::Service< TFileService > &fs)
 
void makeTKMap (const edm::Service< TFileService > &fs, bool autoTagging)
 
void SetBadComponents (int i, int component, SiStripQuality::BadComponent &BC, std::stringstream ssV[4][19], int NBadComponent[4][19][4])
 
void totalStatistics ()
 

Private Attributes

int alllayerfound [::k_END_OF_LAYS_AND_RINGS]
 
int alllayertotal [::k_END_OF_LAYS_AND_RINGS]
 
bool autoIneffModTagging_
 
map< unsigned int, double > BadModules
 
string badModulesFile_
 
unsigned int bunchx_
 
TH1F * bxHisto
 
TTree * CalibTree
 
vector< string > calibTreeFileNames_
 
unsigned int clusterMatchingMethod_
 
float clusterTrajDist_
 
SiStripDetInfo detInfo_
 
unsigned int doSummary_
 
float effPlotMin_
 
map< pair< unsigned int, unsigned int >, array< double, 3 > > eventInfos
 
edm::FileInPath FileInPath_
 
int goodlayerfound [::k_END_OF_LAYS_AND_RINGS]
 
int goodlayertotal [::k_END_OF_LAYS_AND_RINGS]
 
vector< hithits [::k_END_OF_LAYERS]
 
vector< TH2F * > HotColdMaps
 
TH1F * instLumiHisto
 
long layerfound [::k_END_OF_LAYERS]
 
map< unsigned int, vector< int > > layerfound_perBx
 
vector< TH1F * > layerfound_vsBX
 
vector< TH1F * > layerfound_vsCM
 
vector< TH1F * > layerfound_vsLumi
 
vector< TH1F * > layerfound_vsPU
 
long layertotal [::k_END_OF_LAYERS]
 
map< unsigned int, vector< int > > layertotal_perBx
 
vector< TH1F * > layertotal_vsBX
 
vector< TH1F * > layertotal_vsCM
 
vector< TH1F * > layertotal_vsLumi
 
vector< TH1F * > layertotal_vsPU
 
map< unsigned int, pair< unsigned int, unsigned int > > modCounter [::k_END_OF_LAYERS]
 
unsigned int nModsMin_
 
unsigned int nTEClayers_
 
TH1F * PUHisto
 
SiStripQualityquality_
 
float resXSig_
 
bool showEndcapSides_
 
bool showOnlyGoodModules_
 
bool showRings_
 
bool showTOB6TEC9_
 
unsigned int spaceBetweenTrains_
 
float stripsApvEdge_
 
float threshold_
 
TString title_
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtkGeomToken_
 
TrackerMaptkmap
 
TrackerMaptkmapbad
 
TrackerMaptkmapden
 
TrackerMaptkmapeff
 
float tkMapMin_
 
TrackerMaptkmapnum
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoToken_
 
bool useCM_
 
bool useOnlyHighPurityTracks_
 

Static Private Attributes

static constexpr double nBxInAnOrbit = 3565
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from ConditionDBWriter< SiStripBadStrip >
static void fillPSetDescription (edm::ParameterSetDescription &desc)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from ConditionDBWriter< SiStripBadStrip >
void setDoStore (const bool doStore)
 When set to false the payload will not be written to the db. More...
 
void storeOnDbNow ()
 
cond::Time_t timeOfLastIOV ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 73 of file SiStripHitResolFromCalibTree.cc.

Constructor & Destructor Documentation

◆ SiStripHitResolFromCalibTree()

SiStripHitResolFromCalibTree::SiStripHitResolFromCalibTree ( const edm::ParameterSet conf)
explicit

Definition at line 169 of file SiStripHitResolFromCalibTree.cc.

References autoIneffModTagging_, badModulesFile_, bunchx_, calibTreeFileNames_, clusterMatchingMethod_, clusterTrajDist_, detInfo_, doSummary_, effPlotMin_, edm::EDConsumerBase::esConsumes(), FileInPath_, edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), TFileService::kSharedResource, nModsMin_, nTEClayers_, quality_, SiStripDetInfoFileReader::read(), resXSig_, showEndcapSides_, showOnlyGoodModules_, showRings_, showTOB6TEC9_, AlCaHarvesting_cff::SiStripQuality, spaceBetweenTrains_, AlCaHLTBitMon_QueryRunRegistry::string, stripsApvEdge_, threshold_, title_, tkGeomToken_, tkMapMin_, tTopoToken_, useCM_, and useOnlyHighPurityTracks_.

170  : ConditionDBWriter<SiStripBadStrip>(conf), FileInPath_("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat") {
171  usesResource(TFileService::kSharedResource);
172  calibTreeFileNames_ = conf.getUntrackedParameter<vector<std::string> >("CalibTreeFilenames");
173  threshold_ = conf.getParameter<double>("Threshold");
174  nModsMin_ = conf.getParameter<int>("nModsMin");
175  doSummary_ = conf.getParameter<int>("doSummary");
176  badModulesFile_ = conf.getUntrackedParameter<std::string>("BadModulesFile", "");
177  autoIneffModTagging_ = conf.getUntrackedParameter<bool>("AutoIneffModTagging", false);
178  clusterMatchingMethod_ = conf.getUntrackedParameter<int>("ClusterMatchingMethod", 0);
179  resXSig_ = conf.getUntrackedParameter<double>("ResXSig", -1);
180  clusterTrajDist_ = conf.getUntrackedParameter<double>("ClusterTrajDist", 64.0);
181  stripsApvEdge_ = conf.getUntrackedParameter<double>("StripsApvEdge", 10.0);
182  useOnlyHighPurityTracks_ = conf.getUntrackedParameter<bool>("UseOnlyHighPurityTracks", true);
183  bunchx_ = conf.getUntrackedParameter<int>("BunchCrossing", 0);
184  spaceBetweenTrains_ = conf.getUntrackedParameter<int>("SpaceBetweenTrains", 25);
185  useCM_ = conf.getUntrackedParameter<bool>("UseCommonMode", false);
186  showEndcapSides_ = conf.getUntrackedParameter<bool>("ShowEndcapSides", true);
187  showRings_ = conf.getUntrackedParameter<bool>("ShowRings", false);
188  showTOB6TEC9_ = conf.getUntrackedParameter<bool>("ShowTOB6TEC9", false);
189  showOnlyGoodModules_ = conf.getUntrackedParameter<bool>("ShowOnlyGoodModules", false);
190  tkMapMin_ = conf.getUntrackedParameter<double>("TkMapMin", 0.9);
191  effPlotMin_ = conf.getUntrackedParameter<double>("EffPlotMin", 0.9);
192  title_ = conf.getParameter<std::string>("Title");
196 
197  nTEClayers_ = 9; // number of wheels
198  if (showRings_)
199  nTEClayers_ = 7; // number of rings
200 
202 }
static const std::string kSharedResource
Definition: TFileService.h:76
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::string fullPath() const
Definition: FileInPath.cc:161
T getUntrackedParameter(std::string const &, T const &) const
SiStripDetInfo read(std::string filePath)
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_

◆ ~SiStripHitResolFromCalibTree()

SiStripHitResolFromCalibTree::~SiStripHitResolFromCalibTree ( )
overridedefault

Member Function Documentation

◆ algoAnalyze()

void SiStripHitResolFromCalibTree::algoAnalyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprivatevirtual

Reimplemented from ConditionDBWriter< SiStripBadStrip >.

Definition at line 208 of file SiStripHitResolFromCalibTree.cc.

References a, funct::abs(), accept(), alllayerfound, alllayertotal, autoIneffModTagging_, badModulesFile_, nano_mu_local_reco_cff::bool, Surface::bounds(), bunchx_, nano_mu_digi_cff::bx, bxHisto, HltBtagPostValidation_cff::c, CalibTree, calibTreeFileNames_, clusterMatchingMethod_, clusterTrajDist_, SiStripBadStrip::decode(), detInfo_, MillePedeFileConverter_cfg::e, mps_fire::end, eventInfos, cppFunctionSkipper::exception, compareTotals::fs, SiStripQuality::getBadComponentList(), SiStripBadStrip::getDataVectorBegin(), GetLayerName(), SiStripDetInfo::getNumberOfApvsAndStripLength(), SiStripBadStrip::getRegistryVectorBegin(), SiStripBadStrip::getRegistryVectorEnd(), goodlayerfound, goodlayertotal, muons_cff::highPurity, hits, mps_fire::i, l1ctLayer2EG_cff::id, hit::id, compare_using_db::ifile, nano_mu_global_cff::instLumi, instLumiHisto, createfilelist::int, dqmiolumiharvest::j, dqmdumpme::k, MainPageGenerator::l, nano_mu_digi_cff::layer, layerfound, layerfound_perBx, layerfound_vsBX, layerfound_vsCM, layerfound_vsLumi, layerfound_vsPU, layertotal, layertotal_perBx, layertotal_vsBX, layertotal_vsCM, layertotal_vsLumi, layertotal_vsPU, mps_splice::line, makeHotColdMaps(), makeSQLite(), makeSummary(), makeSummaryVsBx(), makeSummaryVsCM(), makeSummaryVsLumi(), makeTKMap(), modCounter, mps_splice::mods, nBxInAnOrbit, createIOVlist::nevents, nevt, nModsMin_, StripTopology::nstrips(), nTEClayers_, funct::pow(), MLClient_cfi::PU, PUHisto, quality, quality_, SiStripBadStrip::data::range, FastTimerService_cff::range, Resolution, resXSig_, writedatasetfile::run, SetBadComponents(), showRings_, showTOB6TEC9_, StripGeomDetUnit::specificTopology(), mathSSE::sqrt(), contentValuesCheck::ss, str, AlCaHLTBitMon_QueryRunRegistry::string, TrackingMonitor_cfi::stripCluster, stripsApvEdge_, GeomDet::surface(), StripSubdetector::TEC, threshold_, StripSubdetector::TIB, StripSubdetector::TID, tkGeomToken_, to_string(), StripSubdetector::TOB, totalStatistics(), tTopoToken_, useCM_, useOnlyHighPurityTracks_, Bounds::width(), x, hit::x, testProducerWithPsetDescEmpty_cfi::x1, y, hit::y, z, and hit::z.

208  {
210 
211  const auto& tkgeom = c.getData(tkGeomToken_);
212  const auto& tTopo = c.getData(tTopoToken_);
213 
214  // read bad modules to mask
215  ifstream badModules_file;
216  set<uint32_t> badModules_list;
217  if (!badModulesFile_.empty()) {
218  badModules_file.open(badModulesFile_.c_str());
219  uint32_t badmodule_detid;
220  int mods, fiber1, fiber2, fiber3;
221  if (badModules_file.is_open()) {
222  string line;
223  while (getline(badModules_file, line)) {
224  if (badModules_file.eof())
225  continue;
226  stringstream ss(line);
227  ss >> badmodule_detid >> mods >> fiber1 >> fiber2 >> fiber3;
228  if (badmodule_detid != 0 && mods == 1 && (fiber1 == 1 || fiber2 == 1 || fiber3 == 1))
229  badModules_list.insert(badmodule_detid);
230  }
231  badModules_file.close();
232  }
233  }
234  if (!badModules_list.empty())
235  edm::LogInfo("SiStripHitResolFromCalibTree") << "Remove additionnal bad modules from the analysis: " << endl;
236  set<uint32_t>::iterator itBadMod;
237  for (itBadMod = badModules_list.begin(); itBadMod != badModules_list.end(); ++itBadMod)
238  edm::LogInfo("SiStripHitResolFromCalibTree") << " " << *itBadMod << endl;
239 
240  // initialze counters and histos
241 
242  bxHisto = fs->make<TH1F>("bx", "bx", 3600, 0, 3600);
243  instLumiHisto = fs->make<TH1F>("instLumi", "inst. lumi.", 250, 0, 25000);
244  PUHisto = fs->make<TH1F>("PU", "PU", 200, 0, 200);
245 
246  for (int l = 0; l < ::k_END_OF_LAYS_AND_RINGS; l++) {
247  goodlayertotal[l] = 0;
248  goodlayerfound[l] = 0;
249  alllayertotal[l] = 0;
250  alllayerfound[l] = 0;
251  }
252 
253  TH1F* PredPlots_m[::k_END_OF_LAYERS];
254  TH1F* PredPlots_p[::k_END_OF_LAYERS];
255  TH1F* MeasPlots_m[::k_END_OF_LAYERS];
256  TH1F* MeasPlots_p[::k_END_OF_LAYERS];
257  TH1F* ResidPlots_m[::k_END_OF_LAYERS];
258  TH1F* ResidPlots_p[::k_END_OF_LAYERS];
259 
260  //std::string UnitString = "cm";
261  std::string UnitString = "strip unit";
262  std::string PlotTitleClusX;
263  std::string PlotTitleTrajX;
264  std::string FileNameEnding;
265 
266  if (UnitString == "cm") {
267  PlotTitleClusX = "clusX [cm]";
268  PlotTitleTrajX = "trajX [cm]";
269  FileNameEnding = "CM";
270  } else if (UnitString == "strip unit") {
271  PlotTitleClusX = "clusX [strip unit]";
272  PlotTitleTrajX = "trajX [strip unit]";
273  FileNameEnding = "StripUnit";
274  } else {
275  edm::LogInfo("SiStripHitResolFromCalibTree") << "ERROR: Unit must either be cm or strip unit." << std::endl;
276  }
277 
278  for (Long_t ilayer = 0; ilayer < ::k_END_OF_LAYERS; ilayer++) {
279  MeasPlots_m[ilayer] =
280  fs->make<TH1F>(Form("MeasPlots_m_layer_%i", (int)(ilayer)), GetLayerName(ilayer), 1000, -5., 5.);
281  MeasPlots_m[ilayer]->GetXaxis()->SetTitle("clusX [cm]");
282  MeasPlots_p[ilayer] =
283  fs->make<TH1F>(Form("MeasPlots_p_layer_%i", (int)(ilayer)), GetLayerName(ilayer), 1000, -400, 400);
284  MeasPlots_p[ilayer]->GetXaxis()->SetTitle("clusX [strip]");
285 
286  PredPlots_m[ilayer] =
287  fs->make<TH1F>(Form("PredPlots_m_layer_%i", (int)(ilayer)), GetLayerName(ilayer), 1000, -5., 5.);
288  PredPlots_m[ilayer]->GetXaxis()->SetTitle("trajX [cm]");
289  PredPlots_p[ilayer] =
290  fs->make<TH1F>(Form("PredPlots_p_layer_%i", (int)(ilayer)), GetLayerName(ilayer), 1000, -400, 400);
291  PredPlots_p[ilayer]->GetXaxis()->SetTitle("trajX [strip]");
292 
293  ResidPlots_m[ilayer] =
294  fs->make<TH1F>(Form("ResidPlots_m_layer_%i", (int)(ilayer)), GetLayerName(ilayer), 250, -.125, .125);
295  ResidPlots_m[ilayer]->GetXaxis()->SetTitle("trajX [cm]");
296  ResidPlots_p[ilayer] =
297  fs->make<TH1F>(Form("ResidPlots_p_layer_%i", (int)(ilayer)), GetLayerName(ilayer), 200, -10., 10);
298  ResidPlots_p[ilayer]->GetXaxis()->SetTitle("trajX [strip]");
299 
300  layerfound_vsLumi.push_back(
301  fs->make<TH1F>(Form("layerfound_vsLumi_layer_%i", (int)(ilayer)), GetLayerName(ilayer), 100, 0, 25000));
302  layertotal_vsLumi.push_back(
303  fs->make<TH1F>(Form("layertotal_vsLumi_layer_%i", (int)(ilayer)), GetLayerName(ilayer), 100, 0, 25000));
304  layerfound_vsPU.push_back(
305  fs->make<TH1F>(Form("layerfound_vsPU_layer_%i", (int)(ilayer)), GetLayerName(ilayer), 45, 0, 90));
306  layertotal_vsPU.push_back(
307  fs->make<TH1F>(Form("layertotal_vsPU_layer_%i", (int)(ilayer)), GetLayerName(ilayer), 45, 0, 90));
308 
309  layerfound_vsBX.push_back(fs->make<TH1F>(
310  Form("foundVsBx_layer%i", (int)ilayer), Form("layer %i", (int)ilayer), nBxInAnOrbit, 0, nBxInAnOrbit));
311  layertotal_vsBX.push_back(fs->make<TH1F>(
312  Form("totalVsBx_layer%i", (int)ilayer), Form("layer %i", (int)ilayer), nBxInAnOrbit, 0, nBxInAnOrbit));
313 
314  if (useCM_) {
315  layerfound_vsCM.push_back(
316  fs->make<TH1F>(Form("layerfound_vsCM_layer_%i", (int)(ilayer)), GetLayerName(ilayer), 20, 0, 400));
317  layertotal_vsCM.push_back(
318  fs->make<TH1F>(Form("layertotal_vsCM_layer_%i", (int)(ilayer)), GetLayerName(ilayer), 20, 0, 400));
319  }
320  layertotal[ilayer] = 0;
321  layerfound[ilayer] = 0;
322  }
323 
325  edm::LogInfo("SiStripHitResolFromCalibTree") << "A module is bad if efficiency < " << threshold_
326  << " and has at least " << nModsMin_ << " nModsMin." << endl;
327  else
328  edm::LogInfo("SiStripHitResolFromCalibTree") << "A module is bad if efficiency < the avg in layer - " << threshold_
329  << " and has at least " << nModsMin_ << " nModsMin." << endl;
330 
331  unsigned int run, evt, bx;
332  double instLumi, PU;
333 
334  //Open the ROOT Calib Tree
335  for (unsigned int ifile = 0; ifile < calibTreeFileNames_.size(); ifile++) {
336  edm::LogInfo("SiStripHitResolFromCalibTree") << "Loading file: " << calibTreeFileNames_[ifile] << endl;
337  TFile* CalibTreeFile = TFile::Open(calibTreeFileNames_[ifile].c_str(), "READ");
338 
339  // Get event infos
340  bool foundEventInfos = false;
341  try {
342  CalibTreeFile->cd("eventInfo");
343  } catch (exception& e) {
344  edm::LogInfo("SiStripHitResolFromCalibTree") << "No event infos tree" << endl;
345  }
346  TTree* EventTree = (TTree*)(gDirectory->Get("tree"));
347 
348  TLeaf* runLf;
349  TLeaf* evtLf;
350  TLeaf* BunchLf;
351  TLeaf* InstLumiLf;
352  TLeaf* PULf;
353  if (EventTree) {
354  edm::LogInfo("SiStripHitResolFromCalibTree") << "Found event infos tree" << endl;
355 
356  runLf = EventTree->GetLeaf("run");
357  evtLf = EventTree->GetLeaf("event");
358 
359  BunchLf = EventTree->GetLeaf("bx");
360  InstLumiLf = EventTree->GetLeaf("instLumi");
361  PULf = EventTree->GetLeaf("PU");
362 
363  int nevt = EventTree->GetEntries();
364  if (nevt)
365  foundEventInfos = true;
366 
367  for (int j = 0; j < nevt; j++) {
368  EventTree->GetEntry(j);
369  run = runLf->GetValue();
370  evt = evtLf->GetValue();
371  bx = BunchLf->GetValue();
372  instLumi = InstLumiLf->GetValue();
373  PU = PULf->GetValue();
374 
375  bxHisto->Fill(bx);
376  instLumiHisto->Fill(instLumi);
377  PUHisto->Fill(PU);
378 
379  eventInfos[make_pair(run, evt)] = array<double, 3>{{(double)bx, instLumi, PU}};
380  }
381  }
382 
383  // Get hit infos
384  CalibTreeFile->cd("anEff");
385  CalibTree = (TTree*)(gDirectory->Get("traj"));
386 
387  runLf = CalibTree->GetLeaf("run");
388  evtLf = CalibTree->GetLeaf("event");
389  TLeaf* BadLf = CalibTree->GetLeaf("ModIsBad");
390  TLeaf* sistripLf = CalibTree->GetLeaf("SiStripQualBad");
391  TLeaf* idLf = CalibTree->GetLeaf("Id");
392  TLeaf* acceptLf = CalibTree->GetLeaf("withinAcceptance");
393  TLeaf* layerLf = CalibTree->GetLeaf("layer");
394  //TLeaf* nHitsLf = CalibTree->GetLeaf("nHits");
395  TLeaf* highPurityLf = CalibTree->GetLeaf("highPurity");
396  TLeaf* xLf = CalibTree->GetLeaf("TrajGlbX");
397  TLeaf* yLf = CalibTree->GetLeaf("TrajGlbY");
398  TLeaf* zLf = CalibTree->GetLeaf("TrajGlbZ");
399  TLeaf* ResXSigLf = CalibTree->GetLeaf("ResXSig");
400  TLeaf* TrajLocXLf = CalibTree->GetLeaf("TrajLocX");
401  TLeaf* TrajLocYLf = CalibTree->GetLeaf("TrajLocY");
402  TLeaf* ClusterLocXLf = CalibTree->GetLeaf("ClusterLocX");
403  BunchLf = CalibTree->GetLeaf("bunchx");
404  InstLumiLf = CalibTree->GetLeaf("instLumi");
405  PULf = CalibTree->GetLeaf("PU");
406  TLeaf* CMLf = nullptr;
407  if (useCM_)
408  CMLf = CalibTree->GetLeaf("commonMode");
409 
410  int nevents = CalibTree->GetEntries();
411  edm::LogInfo("SiStripHitResolFromCalibTree")
412  << "Successfully loaded analyze function with " << nevents << " events!\n";
413 
414  map<pair<unsigned int, unsigned int>, array<double, 3> >::iterator itEventInfos;
415 
416  //Loop through all of the events
417  for (int j = 0; j < nevents; j++) {
418  CalibTree->GetEntry(j);
419  run = (unsigned int)runLf->GetValue();
420  evt = (unsigned int)evtLf->GetValue();
421  unsigned int isBad = (unsigned int)BadLf->GetValue();
422  unsigned int quality = (unsigned int)sistripLf->GetValue();
423  unsigned int id = (unsigned int)idLf->GetValue();
424  unsigned int accept = (unsigned int)acceptLf->GetValue();
425  unsigned int layer_wheel = (unsigned int)layerLf->GetValue();
426  unsigned int layer = layer_wheel;
427  if (showRings_ && layer > 10) { // use rings instead of wheels
428  if (layer < 14)
429  layer = 10 + ((id >> 9) & 0x3); //TID 3 disks and also 3 rings -> use the same container
430  else
431  layer = 13 + ((id >> 5) & 0x7); //TEC
432  }
433  //unsigned int nHits = (unsigned int)nHitsLf->GetValue();
434  bool highPurity = (bool)highPurityLf->GetValue();
435  double x = xLf->GetValue();
436  double y = yLf->GetValue();
437  double z = zLf->GetValue();
438  double resxsig = ResXSigLf->GetValue();
439  double TrajLocX = TrajLocXLf->GetValue();
440  double TrajLocY = TrajLocYLf->GetValue();
441  double ClusterLocX = ClusterLocXLf->GetValue();
442  double TrajLocXMid;
443  double stripTrajMid;
444  double stripCluster;
445  bool badquality = false;
446 
447  instLumi = 0;
448  PU = 0;
449 
450  // if no special tree with event infos, they may be stored in the hit eff tree
451  if (!foundEventInfos) {
452  bx = (unsigned int)BunchLf->GetValue();
453  if (InstLumiLf != nullptr)
454  instLumi = InstLumiLf->GetValue(); // branch not filled by default
455  if (PULf != nullptr)
456  PU = PULf->GetValue(); // branch not filled by default
457  }
458  int CM = -100;
459  if (useCM_)
460  CM = CMLf->GetValue();
461 
462  // Get infos from eventInfos if they exist
463  if (foundEventInfos) {
464  itEventInfos = eventInfos.find(make_pair(run, evt));
465  if (itEventInfos != eventInfos.end()) {
466  bx = itEventInfos->second[0];
467  instLumi = itEventInfos->second[1];
468  PU = itEventInfos->second[2];
469  }
470  }
471 
472  //We have two things we want to do, both an XY color plot, and the efficiency measurement
473  //First, ignore anything that isn't in acceptance and isn't good quality
474 
475  if (bunchx_ > 0 && bunchx_ != bx)
476  continue;
477 
478  //if(quality == 1 || accept != 1 || nHits < 8) continue;
479  if (accept != 1)
480  continue;
482  continue;
483  if (quality == 1)
484  badquality = true;
485 
486  // don't compute efficiencies in modules from TOB6 and TEC9
487  if (!showTOB6TEC9_ && (layer_wheel == 10 || layer_wheel == 22))
488  continue;
489 
490  // don't use bad modules given in the bad module list
491  itBadMod = badModules_list.find(id);
492  if (itBadMod != badModules_list.end())
493  continue;
494 
495  //Now that we have a good event, we need to look at if we expected it or not, and the location
496  //if we didn't
497  //Fill the missing hit information first
498  bool badflag = false;
499 
500  // By default uses the old matching method
501  if (resXSig_ < 0) {
502  if (isBad == 1)
503  badflag = true; // isBad set to false in the tree when resxsig<999.0
504  } else {
505  if (isBad == 1 || resxsig > resXSig_)
506  badflag = true;
507  }
508 
509  // Conversion of positions in strip unit
510  int nstrips = -9;
511  float Pitch = -9.0;
512 
513  //For converting from pitch units into micrometres
514  //const StripGeomDetUnit * conversion = dynamic_cast<const StripGeomDetUnit*>(tkgeom->idToDetUnit(DetId));
515  //auto SpecTopo = conversion->specificTopology();
516 
517  //const StripGeomDetUnit * conversion=(const StripGeomDetUnit*)tkgeom->idToDetUnit(DetId);
518  //auto SpecTopo = conversion->specificTopology();
519 
520  //edm::LogInfo("SiStripHitResolFromCalibTree") << '\n' << std::endl;
521  //edm::LogInfo("SiStripHitResolFromCalibTree") << "SpecTopo = " << SpecTopo << std::endl;
522  //edm::LogInfo("SiStripHitResolFromCalibTree") << '\n' << std::endl;
523 
524  if (resxsig == 1000.0) { // special treatment, no GeomDetUnit associated in some cases when no cluster found
525  Pitch = 0.0205; // maximum
526  nstrips = 768; // maximum
527  stripTrajMid = TrajLocX / Pitch + nstrips / 2.0;
528  stripCluster = ClusterLocX / Pitch + nstrips / 2.0;
529  } else {
530  DetId ClusterDetId(id);
531  const StripGeomDetUnit* stripdet = (const StripGeomDetUnit*)tkgeom.idToDetUnit(ClusterDetId);
532  const StripTopology& Topo = stripdet->specificTopology();
533  nstrips = Topo.nstrips();
534  Pitch = stripdet->surface().bounds().width() / Topo.nstrips();
535  stripTrajMid = TrajLocX / Pitch + nstrips / 2.0; //layer01->10
536  stripCluster = ClusterLocX / Pitch + nstrips / 2.0;
537 
538  // For trapezoidal modules: extrapolation of x trajectory position to the y middle of the module
539  // for correct comparison with cluster position
540  float hbedge = 0;
541  float htedge = 0;
542  float hapoth = 0;
543  if (layer >= 11) {
544  const BoundPlane& plane = stripdet->surface();
545  const TrapezoidalPlaneBounds* trapezoidalBounds(
546  dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
547  std::array<const float, 4> const& parameters = (*trapezoidalBounds).parameters();
548  hbedge = parameters[0];
549  htedge = parameters[1];
550  hapoth = parameters[3];
551  TrajLocXMid = TrajLocX / (1 + (htedge - hbedge) * TrajLocY / (htedge + hbedge) /
552  hapoth); // radialy extrapolated x loc position at middle
553  stripTrajMid = TrajLocXMid / Pitch + nstrips / 2.0;
554  }
555  }
556 
557  /*
558  double MeasPlotsVariable;
559  double PredPlotsVariable;
560 
561  if(UnitString == "cm"){MeasPlotsVariable = ClusterLocX; PredPlotsVariable = TrajLocX;}
562  else if(UnitString == "strip unit"){MeasPlotsVariable = ClusterLocX/Pitch; PredPlotsVariable = TrajLocX/Pitch;}
563  else{edm::LogInfo("SiStripHitResolFromCalibTree") << "ERROR: Unit must be cm or strip unit" << std::endl;}
564  */
565 
566  if (!badquality && layer < ::k_END_OF_LAYERS) {
567  if (resxsig != 1000.0) {
568  MeasPlots_m[layer]->Fill(ClusterLocX);
569  MeasPlots_p[layer]->Fill(ClusterLocX / Pitch);
570  PredPlots_m[layer]->Fill(TrajLocX);
571  PredPlots_p[layer]->Fill(TrajLocX / Pitch);
572  ResidPlots_m[layer]->Fill(ClusterLocX - TrajLocX);
573  ResidPlots_p[layer]->Fill((ClusterLocX - TrajLocX) / Pitch);
574  } else {
575  MeasPlots_m[layer]->Fill(1000);
576  MeasPlots_p[layer]->Fill(1000);
577  PredPlots_m[layer]->Fill(1000);
578  PredPlots_p[layer]->Fill(1000);
579  }
580  }
581 
582  // New matching methods
583  int tapv = -9;
584  int capv = -9;
585  float stripInAPV = 64.;
586 
587  if (clusterMatchingMethod_ >= 1) {
588  badflag = false; // reset
589  if (resxsig == 1000.0) { // default value when no cluster found in the module
590  badflag = true; // consider the module inefficient in this case
591  } else {
592  if (clusterMatchingMethod_ == 2 ||
593  clusterMatchingMethod_ == 4) { // check the distance between cluster and trajectory position
594  if (abs(stripCluster - stripTrajMid) > clusterTrajDist_)
595  badflag = true;
596  }
597  if (clusterMatchingMethod_ == 3 ||
599  4) { // cluster and traj have to be in the same APV (don't take edges into accounts)
600  tapv = (int)stripTrajMid / 128;
601  capv = (int)stripCluster / 128;
602  stripInAPV = stripTrajMid - tapv * 128;
603 
604  if (stripInAPV < stripsApvEdge_ || stripInAPV > 128 - stripsApvEdge_)
605  continue;
606  if (tapv != capv)
607  badflag = true;
608  }
609  }
610  }
611 
612  if (badflag && !badquality) {
613  hit temphit;
614  temphit.x = x;
615  temphit.y = y;
616  temphit.z = z;
617  temphit.id = id;
618  hits[layer].push_back(temphit);
619  }
620  pair<unsigned int, unsigned int> newgoodpair(1, 1);
621  pair<unsigned int, unsigned int> newbadpair(1, 0);
622  //First, figure out if the module already exists in the map of maps
623  map<unsigned int, pair<unsigned int, unsigned int> >::iterator it = modCounter[layer].find(id);
624  if (!badquality) {
625  if (it == modCounter[layer].end()) {
626  if (badflag)
627  modCounter[layer][id] = newbadpair;
628  else
629  modCounter[layer][id] = newgoodpair;
630  } else {
631  ((*it).second.first)++;
632  if (!badflag)
633  ((*it).second.second)++;
634  }
635 
636  if (layerfound_perBx.find(bx) == layerfound_perBx.end()) {
637  layerfound_perBx[bx] = vector<int>(::k_END_OF_LAYERS, 0);
638  layertotal_perBx[bx] = vector<int>(::k_END_OF_LAYERS, 0);
639  }
640  if (!badflag)
643 
644  if (!badflag)
647  if (!badflag)
648  layerfound_vsPU[layer]->Fill(PU);
649  layertotal_vsPU[layer]->Fill(PU);
650 
651  if (useCM_) {
652  if (!badflag)
653  layerfound_vsCM[layer]->Fill(CM);
654  layertotal_vsCM[layer]->Fill(CM);
655  }
656 
657  //Have to do the decoding for which side to go on (ugh)
658  if (layer <= 10) {
659  if (!badflag)
662  } else if (layer > 10 && layer < 14) {
663  if (((id >> 13) & 0x3) == 1) {
664  if (!badflag)
667  } else if (((id >> 13) & 0x3) == 2) {
668  if (!badflag)
669  goodlayerfound[layer + 3]++;
670  goodlayertotal[layer + 3]++;
671  }
672  } else if (layer > 13 && layer <= 22) {
673  if (((id >> 18) & 0x3) == 1) {
674  if (!badflag)
675  goodlayerfound[layer + 3]++;
676  goodlayertotal[layer + 3]++;
677  } else if (((id >> 18) & 0x3) == 2) {
678  if (!badflag)
681  }
682  }
683  }
684  //Do the one where we don't exclude bad modules!
685  if (layer <= 10) {
686  if (!badflag)
687  alllayerfound[layer]++;
688  alllayertotal[layer]++;
689  } else if (layer > 10 && layer < 14) {
690  if (((id >> 13) & 0x3) == 1) {
691  if (!badflag)
692  alllayerfound[layer]++;
693  alllayertotal[layer]++;
694  } else if (((id >> 13) & 0x3) == 2) {
695  if (!badflag)
696  alllayerfound[layer + 3]++;
697  alllayertotal[layer + 3]++;
698  }
699  } else if (layer > 13 && layer <= 22) {
700  if (((id >> 18) & 0x3) == 1) {
701  if (!badflag)
702  alllayerfound[layer + 3]++;
703  alllayertotal[layer + 3]++;
704  } else if (((id >> 18) & 0x3) == 2) {
705  if (!badflag)
708  }
709  }
710  //At this point, both of our maps are loaded with the correct information
711  }
712  } // go to next CalibTreeFile
713 
716  makeSQLite();
717  totalStatistics();
718  makeSummary(fs);
721  if (useCM_)
723 
725  //try to write out what's in the quality record
727  int NTkBadComponent[4]; //k: 0=BadModule, 1=BadFiber, 2=BadApv, 3=BadStrips
728  int NBadComponent[4][19][4];
729  //legend: NBadComponent[i][j][k]= SubSystem i, layer/disk/wheel j, BadModule/Fiber/Apv k
730  // i: 0=TIB, 1=TID, 2=TOB, 3=TEC
731  // k: 0=BadModule, 1=BadFiber, 2=BadApv, 3=BadStrips
732  std::stringstream ssV[4][19];
733 
734  for (int i = 0; i < 4; ++i) {
735  NTkBadComponent[i] = 0;
736  for (int j = 0; j < 19; ++j) {
737  ssV[i][j].str("");
738  for (int k = 0; k < 4; ++k)
739  NBadComponent[i][j][k] = 0;
740  }
741  }
742 
743  std::vector<SiStripQuality::BadComponent> BC = quality_->getBadComponentList();
744 
745  for (size_t i = 0; i < BC.size(); ++i) {
746  //&&&&&&&&&&&&&
747  //Full Tk
748  //&&&&&&&&&&&&&
749 
750  if (BC[i].BadModule)
751  NTkBadComponent[0]++;
752  if (BC[i].BadFibers)
753  NTkBadComponent[1] += ((BC[i].BadFibers >> 2) & 0x1) + ((BC[i].BadFibers >> 1) & 0x1) + ((BC[i].BadFibers) & 0x1);
754  if (BC[i].BadApvs)
755  NTkBadComponent[2] += ((BC[i].BadApvs >> 5) & 0x1) + ((BC[i].BadApvs >> 4) & 0x1) + ((BC[i].BadApvs >> 3) & 0x1) +
756  ((BC[i].BadApvs >> 2) & 0x1) + ((BC[i].BadApvs >> 1) & 0x1) + ((BC[i].BadApvs) & 0x1);
757 
758  //&&&&&&&&&&&&&&&&&
759  //Single SubSystem
760  //&&&&&&&&&&&&&&&&&
761 
762  int component;
763  DetId a(BC[i].detid);
764  if (a.subdetId() == StripSubdetector::TIB) {
765  //&&&&&&&&&&&&&&&&&
766  //TIB
767  //&&&&&&&&&&&&&&&&&
768 
769  component = tTopo.tibLayer(BC[i].detid);
770  SetBadComponents(0, component, BC[i], ssV, NBadComponent);
771 
772  } else if (a.subdetId() == StripSubdetector::TID) {
773  //&&&&&&&&&&&&&&&&&
774  //TID
775  //&&&&&&&&&&&&&&&&&
776 
777  component = tTopo.tidSide(BC[i].detid) == 2 ? tTopo.tidWheel(BC[i].detid) : tTopo.tidWheel(BC[i].detid) + 3;
778  SetBadComponents(1, component, BC[i], ssV, NBadComponent);
779 
780  } else if (a.subdetId() == StripSubdetector::TOB) {
781  //&&&&&&&&&&&&&&&&&
782  //TOB
783  //&&&&&&&&&&&&&&&&&
784 
785  component = tTopo.tobLayer(BC[i].detid);
786  SetBadComponents(2, component, BC[i], ssV, NBadComponent);
787 
788  } else if (a.subdetId() == StripSubdetector::TEC) {
789  //&&&&&&&&&&&&&&&&&
790  //TEC
791  //&&&&&&&&&&&&&&&&&
792 
793  component = tTopo.tecSide(BC[i].detid) == 2 ? tTopo.tecWheel(BC[i].detid) : tTopo.tecWheel(BC[i].detid) + 9;
794  SetBadComponents(3, component, BC[i], ssV, NBadComponent);
795  }
796  }
797 
798  //&&&&&&&&&&&&&&&&&&
799  // Single Strip Info
800  //&&&&&&&&&&&&&&&&&&
801  float percentage = 0;
802 
805 
806  for (SiStripBadStrip::RegistryIterator rp = rbegin; rp != rend; ++rp) {
807  unsigned int detid = rp->detid;
808 
809  int subdet = -999;
810  int component = -999;
811  DetId a(detid);
812  if (a.subdetId() == 3) {
813  subdet = 0;
814  component = tTopo.tibLayer(detid);
815  } else if (a.subdetId() == 4) {
816  subdet = 1;
817  component = tTopo.tidSide(detid) == 2 ? tTopo.tidWheel(detid) : tTopo.tidWheel(detid) + 3;
818  } else if (a.subdetId() == 5) {
819  subdet = 2;
820  component = tTopo.tobLayer(detid);
821  } else if (a.subdetId() == 6) {
822  subdet = 3;
823  component = tTopo.tecSide(detid) == 2 ? tTopo.tecWheel(detid) : tTopo.tecWheel(detid) + 9;
824  }
825 
826  SiStripQuality::Range sqrange =
828 
829  percentage = 0;
830  for (int it = 0; it < sqrange.second - sqrange.first; it++) {
831  unsigned int range = quality_->decode(*(sqrange.first + it)).range;
832  NTkBadComponent[3] += range;
833  NBadComponent[subdet][0][3] += range;
834  NBadComponent[subdet][component][3] += range;
835  percentage += range;
836  }
837  if (percentage != 0)
838  percentage /= 128. * detInfo_.getNumberOfApvsAndStripLength(detid).first;
839  if (percentage > 1)
840  edm::LogError("SiStripQualityStatistics") << "PROBLEM detid " << detid << " value " << percentage << std::endl;
841  }
842  //&&&&&&&&&&&&&&&&&&
843  // printout
844  //&&&&&&&&&&&&&&&&&&
845 
846  std::ofstream ResolutionValues;
847  int RunNumInt = e.id().run();
848  std::string RunNumString = std::to_string(RunNumInt);
849  edm::LogInfo("SiStripHitResolFromCalibTree") << "RunNumString" << RunNumString << std::endl;
850  std::string ResolutionTextFileString = "ResolutionValues_" + RunNumString + "_" + FileNameEnding + ".txt";
851 
852  ResolutionValues.open(ResolutionTextFileString.c_str());
853 
854  for (Long_t ilayer = 0; ilayer < ::k_END_OF_LAYERS; ilayer++) {
855  //Calculating and printing out the resolution values
856 
857  float Meas = MeasPlots_p[ilayer]->GetStdDev();
858  float Pred = PredPlots_p[ilayer]->GetStdDev();
859 
860  float PredMinusMeas = pow(Meas, 2) + pow(Pred, 2); //width^2= sigma(deltaX_pred)^2 + sigma(deltaX_hit)^2
861 
862  float Resolution = sqrt(Pred / 2);
863 
864  //Saving the resolution values to a text file
865  ResolutionValues << '\n'
866  << "Resolution for layer number " << ilayer << " (" << GetLayerName(ilayer) << ")"
867  << " is: " << Resolution << '\n'
868  << "Double difference of the measured and predicted position between the two sensors under "
869  "consideration for layer number "
870  << ilayer << " (" << GetLayerName(ilayer) << ")"
871  << " is: " << PredMinusMeas << '\n'
872  << "The difference between the two positions of the hit measurements for layer number " << ilayer
873  << " (" << GetLayerName(ilayer) << ")"
874  << " is: " << Meas << '\n'
875  << std::endl;
876  }
877 
878  edm::LogInfo("SiStripHitResolFromCalibTree")
879  << "\n-----------------\nNew IOV starting from run " << e.id().run() << " event " << e.id().event()
880  << " lumiBlock " << e.luminosityBlock() << " time " << e.time().value() << "\n-----------------\n";
881  edm::LogInfo("SiStripHitResolFromCalibTree") << "\n-----------------\nGlobal Info\n-----------------";
882  edm::LogInfo("SiStripHitResolFromCalibTree")
883  << "\nBadComponent \t Modules \tFibers "
884  "\tApvs\tStrips\n----------------------------------------------------------------";
885  edm::LogInfo("SiStripHitResolFromCalibTree") << "\nTracker:\t\t" << NTkBadComponent[0] << "\t" << NTkBadComponent[1]
886  << "\t" << NTkBadComponent[2] << "\t" << NTkBadComponent[3];
887  edm::LogInfo("SiStripHitResolFromCalibTree") << endl;
888  edm::LogInfo("SiStripHitResolFromCalibTree")
889  << "\nTIB:\t\t\t" << NBadComponent[0][0][0] << "\t" << NBadComponent[0][0][1] << "\t" << NBadComponent[0][0][2]
890  << "\t" << NBadComponent[0][0][3];
891  edm::LogInfo("SiStripHitResolFromCalibTree")
892  << "\nTID:\t\t\t" << NBadComponent[1][0][0] << "\t" << NBadComponent[1][0][1] << "\t" << NBadComponent[1][0][2]
893  << "\t" << NBadComponent[1][0][3];
894  edm::LogInfo("SiStripHitResolFromCalibTree")
895  << "\nTOB:\t\t\t" << NBadComponent[2][0][0] << "\t" << NBadComponent[2][0][1] << "\t" << NBadComponent[2][0][2]
896  << "\t" << NBadComponent[2][0][3];
897  edm::LogInfo("SiStripHitResolFromCalibTree")
898  << "\nTEC:\t\t\t" << NBadComponent[3][0][0] << "\t" << NBadComponent[3][0][1] << "\t" << NBadComponent[3][0][2]
899  << "\t" << NBadComponent[3][0][3];
900  edm::LogInfo("SiStripHitResolFromCalibTree") << "\n";
901 
902  for (int i = 1; i < 5; ++i)
903  edm::LogInfo("SiStripHitResolFromCalibTree")
904  << "\nTIB Layer " << i << " :\t\t" << NBadComponent[0][i][0] << "\t" << NBadComponent[0][i][1] << "\t"
905  << NBadComponent[0][i][2] << "\t" << NBadComponent[0][i][3];
906  edm::LogInfo("SiStripHitResolFromCalibTree") << "\n";
907  for (int i = 1; i < 4; ++i)
908  edm::LogInfo("SiStripHitResolFromCalibTree")
909  << "\nTID+ Disk " << i << " :\t\t" << NBadComponent[1][i][0] << "\t" << NBadComponent[1][i][1] << "\t"
910  << NBadComponent[1][i][2] << "\t" << NBadComponent[1][i][3];
911  for (int i = 4; i < 7; ++i)
912  edm::LogInfo("SiStripHitResolFromCalibTree")
913  << "\nTID- Disk " << i - 3 << " :\t\t" << NBadComponent[1][i][0] << "\t" << NBadComponent[1][i][1] << "\t"
914  << NBadComponent[1][i][2] << "\t" << NBadComponent[1][i][3];
915  edm::LogInfo("SiStripHitResolFromCalibTree") << "\n";
916  for (int i = 1; i < 7; ++i)
917  edm::LogInfo("SiStripHitResolFromCalibTree")
918  << "\nTOB Layer " << i << " :\t\t" << NBadComponent[2][i][0] << "\t" << NBadComponent[2][i][1] << "\t"
919  << NBadComponent[2][i][2] << "\t" << NBadComponent[2][i][3];
920  edm::LogInfo("SiStripHitResolFromCalibTree") << "\n";
921  for (int i = 1; i < 10; ++i)
922  edm::LogInfo("SiStripHitResolFromCalibTree")
923  << "\nTEC+ Disk " << i << " :\t\t" << NBadComponent[3][i][0] << "\t" << NBadComponent[3][i][1] << "\t"
924  << NBadComponent[3][i][2] << "\t" << NBadComponent[3][i][3];
925  for (int i = 10; i < 19; ++i)
926  edm::LogInfo("SiStripHitResolFromCalibTree")
927  << "\nTEC- Disk " << i - 9 << " :\t\t" << NBadComponent[3][i][0] << "\t" << NBadComponent[3][i][1] << "\t"
928  << NBadComponent[3][i][2] << "\t" << NBadComponent[3][i][3];
929  edm::LogInfo("SiStripHitResolFromCalibTree") << "\n";
930 
931  edm::LogInfo("SiStripHitResolFromCalibTree")
932  << "\n----------------------------------------------------------------\n\t\t Detid \tModules Fibers "
933  "Apvs\n----------------------------------------------------------------";
934  for (int i = 1; i < 5; ++i)
935  edm::LogInfo("SiStripHitResolFromCalibTree") << "\nTIB Layer " << i << " :" << ssV[0][i].str();
936  edm::LogInfo("SiStripHitResolFromCalibTree") << "\n";
937  for (int i = 1; i < 4; ++i)
938  edm::LogInfo("SiStripHitResolFromCalibTree") << "\nTID+ Disk " << i << " :" << ssV[1][i].str();
939  for (int i = 4; i < 7; ++i)
940  edm::LogInfo("SiStripHitResolFromCalibTree") << "\nTID- Disk " << i - 3 << " :" << ssV[1][i].str();
941  edm::LogInfo("SiStripHitResolFromCalibTree") << "\n";
942  for (int i = 1; i < 7; ++i)
943  edm::LogInfo("SiStripHitResolFromCalibTree") << "\nTOB Layer " << i << " :" << ssV[2][i].str();
944  edm::LogInfo("SiStripHitResolFromCalibTree") << "\n";
945  for (int i = 1; i < 10; ++i)
946  edm::LogInfo("SiStripHitResolFromCalibTree") << "\nTEC+ Disk " << i << " :" << ssV[3][i].str();
947  for (int i = 10; i < 19; ++i)
948  edm::LogInfo("SiStripHitResolFromCalibTree") << "\nTEC- Disk " << i - 9 << " :" << ssV[3][i].str();
949 
950  // store also bad modules in log file
951  ofstream badModules;
952  badModules.open("BadModules.log");
953  badModules << "\n----------------------------------------------------------------\n\t\t Detid \tModules Fibers "
954  "Apvs\n----------------------------------------------------------------";
955  for (int i = 1; i < 5; ++i)
956  badModules << "\nTIB Layer " << i << " :" << ssV[0][i].str();
957  badModules << "\n";
958  for (int i = 1; i < 4; ++i)
959  badModules << "\nTID+ Disk " << i << " :" << ssV[1][i].str();
960  for (int i = 4; i < 7; ++i)
961  badModules << "\nTID- Disk " << i - 3 << " :" << ssV[1][i].str();
962  badModules << "\n";
963  for (int i = 1; i < 7; ++i)
964  badModules << "\nTOB Layer " << i << " :" << ssV[2][i].str();
965  badModules << "\n";
966  for (int i = 1; i < 10; ++i)
967  badModules << "\nTEC+ Disk " << i << " :" << ssV[3][i].str();
968  for (int i = 10; i < 19; ++i)
969  badModules << "\nTEC- Disk " << i - 9 << " :" << ssV[3][i].str();
970  badModules.close();
971 }
unsigned short range
static constexpr auto TEC
virtual int nstrips() const =0
ContainerIterator getDataVectorBegin() const
map< unsigned int, vector< int > > layertotal_perBx
map< unsigned int, vector< int > > layerfound_perBx
int goodlayertotal[::k_END_OF_LAYS_AND_RINGS]
void makeSummaryVsBx(const edm::Service< TFileService > &fs)
Registry::const_iterator RegistryIterator
Log< level::Error, false > LogError
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
static std::string to_string(const XMLCh *ch)
const std::vector< BadComponent > & getBadComponentList() const
void makeSummary(const edm::Service< TFileService > &fs)
string quality
T sqrt(T t)
Definition: SSEVec.h:19
map< pair< unsigned int, unsigned int >, array< double, 3 > > eventInfos
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
RegistryIterator getRegistryVectorEnd() const
static constexpr auto TOB
map< unsigned int, pair< unsigned int, unsigned int > > modCounter[::k_END_OF_LAYERS]
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
vector< hit > hits[::k_END_OF_LAYERS]
unsigned int id
Log< level::Info, false > LogInfo
int alllayerfound[::k_END_OF_LAYS_AND_RINGS]
Definition: DetId.h:17
static constexpr auto TIB
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
void makeTKMap(const edm::Service< TFileService > &fs, bool autoTagging)
double a
Definition: hdecay.h:121
std::pair< ContainerIterator, ContainerIterator > Range
void makeSummaryVsCM(const edm::Service< TFileService > &fs)
int goodlayerfound[::k_END_OF_LAYS_AND_RINGS]
int alllayertotal[::k_END_OF_LAYS_AND_RINGS]
data decode(const unsigned int &value) const
void makeSummaryVsLumi(const edm::Service< TFileService > &fs)
#define str(s)
void SetBadComponents(int i, int component, SiStripQuality::BadComponent &BC, std::stringstream ssV[4][19], int NBadComponent[4][19][4])
virtual float width() const =0
static constexpr auto TID
RegistryIterator getRegistryVectorBegin() const
void makeHotColdMaps(const edm::Service< TFileService > &fs)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
const Bounds & bounds() const
Definition: Surface.h:87

◆ algoBeginJob()

void SiStripHitResolFromCalibTree::algoBeginJob ( const edm::EventSetup )
overrideprivatevirtual

Reimplemented from ConditionDBWriter< SiStripBadStrip >.

Definition at line 204 of file SiStripHitResolFromCalibTree.cc.

204 {}

◆ algoEndJob()

void SiStripHitResolFromCalibTree::algoEndJob ( )
overrideprivatevirtual

Reimplemented from ConditionDBWriter< SiStripBadStrip >.

Definition at line 206 of file SiStripHitResolFromCalibTree.cc.

206 {}

◆ calcPhi()

float SiStripHitResolFromCalibTree::calcPhi ( float  x,
float  y 
)
private

Definition at line 1694 of file SiStripHitResolFromCalibTree.cc.

References phi, Pi, x, and y.

Referenced by makeHotColdMaps().

1694  {
1695  float phi = 0;
1696  float Pi = 3.14159;
1697  if ((x >= 0) && (y >= 0))
1698  phi = atan(y / x);
1699  else if ((x >= 0) && (y <= 0))
1700  phi = atan(y / x) + 2 * Pi;
1701  else if ((x <= 0) && (y >= 0))
1702  phi = atan(y / x) + Pi;
1703  else
1704  phi = atan(y / x) + Pi;
1705  phi = phi * 180.0 / Pi;
1706 
1707  return phi;
1708 }
const double Pi

◆ ComputeEff()

void SiStripHitResolFromCalibTree::ComputeEff ( const edm::Service< TFileService > &  fs,
vector< TH1F *> &  vhfound,
vector< TH1F *> &  vhtotal,
string  name 
)
private

Definition at line 1570 of file SiStripHitResolFromCalibTree.cc.

References MillePedeFileConverter_cfg::e, compareTotals::fs, GetLayerName(), mps_fire::i, Skims_PA_cff::name, MuonTCMETValueMapProducer_cff::nLayers, and showRings_.

Referenced by makeSummaryVsCM(), and makeSummaryVsLumi().

1573  {
1574  unsigned int nLayers = 22;
1575  if (showRings_)
1576  nLayers = 20;
1577 
1578  TH1F* hfound;
1579  TH1F* htotal;
1580 
1581  for (unsigned int ilayer = 1; ilayer < nLayers; ilayer++) {
1582  hfound = vhfound[ilayer];
1583  htotal = vhtotal[ilayer];
1584 
1585  hfound->Sumw2();
1586  htotal->Sumw2();
1587 
1588  // new ROOT version: TGraph::Divide don't handle null or negative values
1589  for (Long_t i = 0; i < hfound->GetNbinsX() + 1; ++i) {
1590  if (hfound->GetBinContent(i) == 0)
1591  hfound->SetBinContent(i, 1e-6);
1592  if (htotal->GetBinContent(i) == 0)
1593  htotal->SetBinContent(i, 1);
1594  }
1595 
1596  TGraphAsymmErrors* geff = fs->make<TGraphAsymmErrors>(hfound->GetNbinsX());
1597  geff->SetName(Form("%s_layer%i", name.c_str(), ilayer));
1598  geff->BayesDivide(hfound, htotal);
1599  if (name == "effVsLumi")
1600  geff->SetTitle("Hit Efficiency vs inst. lumi. - " + GetLayerName(ilayer));
1601  if (name == "effVsPU")
1602  geff->SetTitle("Hit Efficiency vs pileup - " + GetLayerName(ilayer));
1603  if (name == "effVsCM")
1604  geff->SetTitle("Hit Efficiency vs common Mode - " + GetLayerName(ilayer));
1605  geff->SetMarkerStyle(20);
1606  }
1607 }

◆ GetLayerName()

TString SiStripHitResolFromCalibTree::GetLayerName ( Long_t  k)
private

Definition at line 1552 of file SiStripHitResolFromCalibTree.cc.

References dqmdumpme::k, nTEClayers_, and showRings_.

Referenced by algoAnalyze(), ComputeEff(), makeSummary(), makeSummaryVsBx(), makeTKMap(), and totalStatistics().

1552  {
1553  TString layername = "";
1554  TString ringlabel = "D";
1555  if (showRings_)
1556  ringlabel = "R";
1557  if (k > 0 && k < 5) {
1558  layername = TString("TIB L") + k;
1559  } else if (k > 4 && k < 11) {
1560  layername = TString("TOB L") + (k - 4);
1561  } else if (k > 10 && k < 14) {
1562  layername = TString("TID ") + ringlabel + (k - 10);
1563  } else if (k > 13 && k < 14 + nTEClayers_) {
1564  layername = TString("TEC ") + ringlabel + (k - 13);
1565  }
1566 
1567  return layername;
1568 }

◆ GetLayerSideName()

TString SiStripHitResolFromCalibTree::GetLayerSideName ( Long_t  k)
private

Definition at line 1653 of file SiStripHitResolFromCalibTree.cc.

References dqmdumpme::k, nTEClayers_, and showRings_.

Referenced by makeSummary().

1653  {
1654  TString layername = "";
1655  TString ringlabel = "D";
1656  if (showRings_)
1657  ringlabel = "R";
1658  if (k > 0 && k < 5) {
1659  layername = TString("TIB L") + k;
1660  } else if (k > 4 && k < 11) {
1661  layername = TString("TOB L") + (k - 4);
1662  } else if (k > 10 && k < 14) {
1663  layername = TString("TID- ") + ringlabel + (k - 10);
1664  } else if (k > 13 && k < 17) {
1665  layername = TString("TID+ ") + ringlabel + (k - 13);
1666  } else if (k > 16 && k < 17 + nTEClayers_) {
1667  layername = TString("TEC- ") + ringlabel + (k - 16);
1668  } else if (k > 16 + nTEClayers_) {
1669  layername = TString("TEC+ ") + ringlabel + (k - 16 - nTEClayers_);
1670  }
1671 
1672  return layername;
1673 }

◆ getNewObject()

std::unique_ptr< SiStripBadStrip > SiStripHitResolFromCalibTree::getNewObject ( )
overrideprivatevirtual

Implements ConditionDBWriter< SiStripBadStrip >.

Definition at line 1675 of file SiStripHitResolFromCalibTree.cc.

References SiStripBadStrip::getDataVectorBegin(), SiStripBadStrip::getRegistryVectorBegin(), SiStripBadStrip::getRegistryVectorEnd(), getGTfromDQMFile::obj, quality_, and FastTimerService_cff::range.

1675  {
1676  //Need this for a Condition DB Writer
1677  //Initialize a return variable
1678  auto obj = std::make_unique<SiStripBadStrip>();
1679 
1682 
1683  for (; rIter != rIterEnd; ++rIter) {
1685  quality_->getDataVectorBegin() + rIter->iend);
1686  if (!obj->put(rIter->detid, range))
1687  edm::LogError("SiStripHitResolFromCalibTree")
1688  << "[SiStripHitResolFromCalibTree::getNewObject] detid already exists" << std::endl;
1689  }
1690 
1691  return obj;
1692 }
ContainerIterator getDataVectorBegin() const
Registry::const_iterator RegistryIterator
RegistryIterator getRegistryVectorEnd() const
std::pair< ContainerIterator, ContainerIterator > Range
RegistryIterator getRegistryVectorBegin() const

◆ makeHotColdMaps()

void SiStripHitResolFromCalibTree::makeHotColdMaps ( const edm::Service< TFileService > &  fs)
private

Definition at line 973 of file SiStripHitResolFromCalibTree.cc.

References calcPhi(), compareTotals::fs, hits, HotColdMaps, and phi.

Referenced by algoAnalyze().

973  {
974  edm::LogInfo("SiStripHitResolFromCalibTree") << "Entering hot cold map generation!\n";
975  TStyle* gStyle = new TStyle("gStyle", "myStyle");
976  gStyle->cd();
977  gStyle->SetPalette(1);
978  gStyle->SetCanvasColor(kWhite);
979  gStyle->SetOptStat(0);
980  //Here we make the hot/cold color maps that we love so very much
981  //Already have access to the data as a private variable
982  //Create all of the histograms in the TFileService
983  TH2F* temph2;
984  for (Long_t maplayer = 1; maplayer <= 22; maplayer++) {
985  //Initialize all of the histograms
986  if (maplayer > 0 && maplayer <= 4) {
987  //We are in the TIB
988  temph2 = fs->make<TH2F>(Form("%s%i", "TIB", (int)(maplayer)), "TIB", 100, -1, 361, 100, -100, 100);
989  temph2->GetXaxis()->SetTitle("Phi");
990  temph2->GetXaxis()->SetBinLabel(1, TString("360"));
991  temph2->GetXaxis()->SetBinLabel(50, TString("180"));
992  temph2->GetXaxis()->SetBinLabel(100, TString("0"));
993  temph2->GetYaxis()->SetTitle("Global Z");
994  temph2->SetOption("colz");
995  HotColdMaps.push_back(temph2);
996  } else if (maplayer > 4 && maplayer <= 10) {
997  //We are in the TOB
998  temph2 = fs->make<TH2F>(Form("%s%i", "TOB", (int)(maplayer - 4)), "TOB", 100, -1, 361, 100, -120, 120);
999  temph2->GetXaxis()->SetTitle("Phi");
1000  temph2->GetXaxis()->SetBinLabel(1, TString("360"));
1001  temph2->GetXaxis()->SetBinLabel(50, TString("180"));
1002  temph2->GetXaxis()->SetBinLabel(100, TString("0"));
1003  temph2->GetYaxis()->SetTitle("Global Z");
1004  temph2->SetOption("colz");
1005  HotColdMaps.push_back(temph2);
1006  } else if (maplayer > 10 && maplayer <= 13) {
1007  //We are in the TID
1008  //Split by +/-
1009  temph2 = fs->make<TH2F>(Form("%s%i", "TID-", (int)(maplayer - 10)), "TID-", 100, -100, 100, 100, -100, 100);
1010  temph2->GetXaxis()->SetTitle("Global Y");
1011  temph2->GetXaxis()->SetBinLabel(1, TString("+Y"));
1012  temph2->GetXaxis()->SetBinLabel(50, TString("0"));
1013  temph2->GetXaxis()->SetBinLabel(100, TString("-Y"));
1014  temph2->GetYaxis()->SetTitle("Global X");
1015  temph2->GetYaxis()->SetBinLabel(1, TString("-X"));
1016  temph2->GetYaxis()->SetBinLabel(50, TString("0"));
1017  temph2->GetYaxis()->SetBinLabel(100, TString("+X"));
1018  temph2->SetOption("colz");
1019  HotColdMaps.push_back(temph2);
1020  temph2 = fs->make<TH2F>(Form("%s%i", "TID+", (int)(maplayer - 10)), "TID+", 100, -100, 100, 100, -100, 100);
1021  temph2->GetXaxis()->SetTitle("Global Y");
1022  temph2->GetXaxis()->SetBinLabel(1, TString("+Y"));
1023  temph2->GetXaxis()->SetBinLabel(50, TString("0"));
1024  temph2->GetXaxis()->SetBinLabel(100, TString("-Y"));
1025  temph2->GetYaxis()->SetTitle("Global X");
1026  temph2->GetYaxis()->SetBinLabel(1, TString("-X"));
1027  temph2->GetYaxis()->SetBinLabel(50, TString("0"));
1028  temph2->GetYaxis()->SetBinLabel(100, TString("+X"));
1029  temph2->SetOption("colz");
1030  HotColdMaps.push_back(temph2);
1031  } else if (maplayer > 13) {
1032  //We are in the TEC
1033  //Split by +/-
1034  temph2 = fs->make<TH2F>(Form("%s%i", "TEC-", (int)(maplayer - 13)), "TEC-", 100, -120, 120, 100, -120, 120);
1035  temph2->GetXaxis()->SetTitle("Global Y");
1036  temph2->GetXaxis()->SetBinLabel(1, TString("+Y"));
1037  temph2->GetXaxis()->SetBinLabel(50, TString("0"));
1038  temph2->GetXaxis()->SetBinLabel(100, TString("-Y"));
1039  temph2->GetYaxis()->SetTitle("Global X");
1040  temph2->GetYaxis()->SetBinLabel(1, TString("-X"));
1041  temph2->GetYaxis()->SetBinLabel(50, TString("0"));
1042  temph2->GetYaxis()->SetBinLabel(100, TString("+X"));
1043  temph2->SetOption("colz");
1044  HotColdMaps.push_back(temph2);
1045  temph2 = fs->make<TH2F>(Form("%s%i", "TEC+", (int)(maplayer - 13)), "TEC+", 100, -120, 120, 100, -120, 120);
1046  temph2->GetXaxis()->SetTitle("Global Y");
1047  temph2->GetXaxis()->SetBinLabel(1, TString("+Y"));
1048  temph2->GetXaxis()->SetBinLabel(50, TString("0"));
1049  temph2->GetXaxis()->SetBinLabel(100, TString("-Y"));
1050  temph2->GetYaxis()->SetTitle("Global X");
1051  temph2->GetYaxis()->SetBinLabel(1, TString("-X"));
1052  temph2->GetYaxis()->SetBinLabel(50, TString("0"));
1053  temph2->GetYaxis()->SetBinLabel(100, TString("+X"));
1054  temph2->SetOption("colz");
1055  HotColdMaps.push_back(temph2);
1056  }
1057  }
1058  for (Long_t mylayer = 1; mylayer <= 22; mylayer++) {
1059  //Determine what kind of plot we want to write out
1060  //Loop through the entirety of each layer
1061  //Create an array of the histograms
1062  vector<hit>::const_iterator iter;
1063  for (iter = hits[mylayer].begin(); iter != hits[mylayer].end(); iter++) {
1064  //Looping over the particular layer
1065  //Fill by 360-x to get the proper location to compare with TKMaps of phi
1066  //Also global xy is messed up
1067  if (mylayer > 0 && mylayer <= 4) {
1068  //We are in the TIB
1069  float phi = calcPhi(iter->x, iter->y);
1070  HotColdMaps[mylayer - 1]->Fill(360. - phi, iter->z, 1.);
1071  } else if (mylayer > 4 && mylayer <= 10) {
1072  //We are in the TOB
1073  float phi = calcPhi(iter->x, iter->y);
1074  HotColdMaps[mylayer - 1]->Fill(360. - phi, iter->z, 1.);
1075  } else if (mylayer > 10 && mylayer <= 13) {
1076  //We are in the TID
1077  //There are 2 different maps here
1078  int side = (((iter->id) >> 13) & 0x3);
1079  if (side == 1)
1080  HotColdMaps[(mylayer - 1) + (mylayer - 11)]->Fill(-iter->y, iter->x, 1.);
1081  else if (side == 2)
1082  HotColdMaps[(mylayer - 1) + (mylayer - 10)]->Fill(-iter->y, iter->x, 1.);
1083  //if(side == 1) HotColdMaps[(mylayer - 1) + (mylayer - 11)]->Fill(iter->x,iter->y,1.);
1084  //else if(side == 2) HotColdMaps[(mylayer - 1) + (mylayer - 10)]->Fill(iter->x,iter->y,1.);
1085  } else if (mylayer > 13) {
1086  //We are in the TEC
1087  //There are 2 different maps here
1088  int side = (((iter->id) >> 18) & 0x3);
1089  if (side == 1)
1090  HotColdMaps[(mylayer + 2) + (mylayer - 14)]->Fill(-iter->y, iter->x, 1.);
1091  else if (side == 2)
1092  HotColdMaps[(mylayer + 2) + (mylayer - 13)]->Fill(-iter->y, iter->x, 1.);
1093  //if(side == 1) HotColdMaps[(mylayer + 2) + (mylayer - 14)]->Fill(iter->x,iter->y,1.);
1094  //else if(side == 2) HotColdMaps[(mylayer + 2) + (mylayer - 13)]->Fill(iter->x,iter->y,1.);
1095  }
1096  }
1097  }
1098  edm::LogInfo("SiStripHitResolFromCalibTree") << "Finished HotCold Map Generation\n";
1099 }
vector< hit > hits[::k_END_OF_LAYERS]
Log< level::Info, false > LogInfo

◆ makeSQLite()

void SiStripHitResolFromCalibTree::makeSQLite ( )
private

Definition at line 1204 of file SiStripHitResolFromCalibTree.cc.

References BadModules, SiStripQuality::compact(), detInfo_, SiStripQuality::fillBadComponents(), SiStripDetInfo::getNumberOfApvsAndStripLength(), globals_cff::id1, createfilelist::int, SiStripBadStrip::put(), quality_, and FastTimerService_cff::range.

Referenced by algoAnalyze().

1204  {
1205  //Generate the SQLite file for use in the Database of the bad modules!
1206  edm::LogInfo("SiStripHitResolFromCalibTree") << "Entering SQLite file generation!\n";
1207  std::vector<unsigned int> BadStripList;
1208  unsigned short NStrips;
1209  unsigned int id1;
1210  std::unique_ptr<SiStripQuality> pQuality = std::make_unique<SiStripQuality>(detInfo_);
1211  //This is the list of the bad strips, use to mask out entire APVs
1212  //Now simply go through the bad hit list and mask out things that
1213  //are bad!
1214  map<unsigned int, double>::const_iterator it;
1215  for (it = BadModules.begin(); it != BadModules.end(); it++) {
1216  //We need to figure out how many strips are in this particular module
1217  //To Mask correctly!
1218  NStrips = detInfo_.getNumberOfApvsAndStripLength((*it).first).first * 128;
1219  edm::LogInfo("SiStripHitResolFromCalibTree")
1220  << "Number of strips module " << (*it).first << " is " << NStrips << endl;
1221  BadStripList.push_back(pQuality->encode(0, NStrips, 0));
1222  //Now compact into a single bad module
1223  id1 = (unsigned int)(*it).first;
1224  edm::LogInfo("SiStripHitResolFromCalibTree") << "ID1 shoudl match list of modules above " << id1 << endl;
1225  quality_->compact(id1, BadStripList);
1226  SiStripQuality::Range range(BadStripList.begin(), BadStripList.end());
1227  quality_->put(id1, range);
1228  BadStripList.clear();
1229  }
1230  //Fill all the bad components now
1232 }
map< unsigned int, double > BadModules
void compact(uint32_t detid, std::vector< unsigned int > &)
void fillBadComponents()
Log< level::Info, false > LogInfo
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
std::pair< ContainerIterator, ContainerIterator > Range
bool put(const uint32_t &detID, const InputVector &vect)

◆ makeSummary()

void SiStripHitResolFromCalibTree::makeSummary ( const edm::Service< TFileService > &  fs)
private

Definition at line 1284 of file SiStripHitResolFromCalibTree.cc.

References python.cmstools::all(), alllayerfound, alllayertotal, MillePedeFileConverter_cfg::e, effPlotMin_, newFWLiteAna::found, compareTotals::fs, GetLayerName(), GetLayerSideName(), goodlayerfound, goodlayertotal, mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, label, MuonTCMETValueMapProducer_cff::nLayers, nTEClayers_, compare::overlay(), showEndcapSides_, showOnlyGoodModules_, showRings_, showTOB6TEC9_, and title_.

Referenced by algoAnalyze().

1284  {
1285  //setTDRStyle();
1286 
1287  int nLayers = 34;
1288  if (showRings_)
1289  nLayers = 30;
1290  if (!showEndcapSides_) {
1291  if (!showRings_)
1292  nLayers = 22;
1293  else
1294  nLayers = 20;
1295  }
1296 
1297  TH1F* found = fs->make<TH1F>("found", "found", nLayers + 1, 0, nLayers + 1);
1298  TH1F* all = fs->make<TH1F>("all", "all", nLayers + 1, 0, nLayers + 1);
1299  TH1F* found2 = fs->make<TH1F>("found2", "found2", nLayers + 1, 0, nLayers + 1);
1300  TH1F* all2 = fs->make<TH1F>("all2", "all2", nLayers + 1, 0, nLayers + 1);
1301  // first bin only to keep real data off the y axis so set to -1
1302  found->SetBinContent(0, -1);
1303  all->SetBinContent(0, 1);
1304 
1305  // new ROOT version: TGraph::Divide don't handle null or negative values
1306  for (Long_t i = 1; i < nLayers + 2; ++i) {
1307  found->SetBinContent(i, 1e-6);
1308  all->SetBinContent(i, 1);
1309  found2->SetBinContent(i, 1e-6);
1310  all2->SetBinContent(i, 1);
1311  }
1312 
1313  TCanvas* c7 = new TCanvas("c7", " test ", 10, 10, 800, 600);
1314  c7->SetFillColor(0);
1315  c7->SetGrid();
1316 
1317  int nLayers_max = nLayers + 1; // barrel+endcap
1318  if (!showEndcapSides_)
1319  nLayers_max = 11; // barrel
1320  for (Long_t i = 1; i < nLayers_max; ++i) {
1321  edm::LogInfo("SiStripHitResolFromCalibTree")
1322  << "Fill only good modules layer " << i << ": S = " << goodlayerfound[i] << " B = " << goodlayertotal[i]
1323  << endl;
1324  if (goodlayertotal[i] > 5) {
1325  found->SetBinContent(i, goodlayerfound[i]);
1326  all->SetBinContent(i, goodlayertotal[i]);
1327  }
1328 
1329  edm::LogInfo("SiStripHitResolFromCalibTree")
1330  << "Filling all modules layer " << i << ": S = " << alllayerfound[i] << " B = " << alllayertotal[i] << endl;
1331  if (alllayertotal[i] > 5) {
1332  found2->SetBinContent(i, alllayerfound[i]);
1333  all2->SetBinContent(i, alllayertotal[i]);
1334  }
1335  }
1336 
1337  // endcap - merging sides
1338  if (!showEndcapSides_) {
1339  for (Long_t i = 11; i < 14; ++i) { // TID disks
1340  edm::LogInfo("SiStripHitResolFromCalibTree")
1341  << "Fill only good modules layer " << i << ": S = " << goodlayerfound[i] + goodlayerfound[i + 3]
1342  << " B = " << goodlayertotal[i] + goodlayertotal[i + 3] << endl;
1343  if (goodlayertotal[i] + goodlayertotal[i + 3] > 5) {
1344  found->SetBinContent(i, goodlayerfound[i] + goodlayerfound[i + 3]);
1345  all->SetBinContent(i, goodlayertotal[i] + goodlayertotal[i + 3]);
1346  }
1347  edm::LogInfo("SiStripHitResolFromCalibTree")
1348  << "Filling all modules layer " << i << ": S = " << alllayerfound[i] + alllayerfound[i + 3]
1349  << " B = " << alllayertotal[i] + alllayertotal[i + 3] << endl;
1350  if (alllayertotal[i] + alllayertotal[i + 3] > 5) {
1351  found2->SetBinContent(i, alllayerfound[i] + alllayerfound[i + 3]);
1352  all2->SetBinContent(i, alllayertotal[i] + alllayertotal[i + 3]);
1353  }
1354  }
1355  for (Long_t i = 17; i < 17 + nTEClayers_; ++i) { // TEC disks
1356  edm::LogInfo("SiStripHitResolFromCalibTree")
1357  << "Fill only good modules layer " << i - 3
1358  << ": S = " << goodlayerfound[i] + goodlayerfound[i + nTEClayers_]
1359  << " B = " << goodlayertotal[i] + goodlayertotal[i + nTEClayers_] << endl;
1360  if (goodlayertotal[i] + goodlayertotal[i + nTEClayers_] > 5) {
1361  found->SetBinContent(i - 3, goodlayerfound[i] + goodlayerfound[i + nTEClayers_]);
1362  all->SetBinContent(i - 3, goodlayertotal[i] + goodlayertotal[i + nTEClayers_]);
1363  }
1364  edm::LogInfo("SiStripHitResolFromCalibTree")
1365  << "Filling all modules layer " << i - 3 << ": S = " << alllayerfound[i] + alllayerfound[i + nTEClayers_]
1366  << " B = " << alllayertotal[i] + alllayertotal[i + nTEClayers_] << endl;
1367  if (alllayertotal[i] + alllayertotal[i + nTEClayers_] > 5) {
1368  found2->SetBinContent(i - 3, alllayerfound[i] + alllayerfound[i + nTEClayers_]);
1369  all2->SetBinContent(i - 3, alllayertotal[i] + alllayertotal[i + nTEClayers_]);
1370  }
1371  }
1372  }
1373 
1374  found->Sumw2();
1375  all->Sumw2();
1376 
1377  found2->Sumw2();
1378  all2->Sumw2();
1379 
1380  TGraphAsymmErrors* gr = fs->make<TGraphAsymmErrors>(nLayers + 1);
1381  gr->SetName("eff_good");
1382  gr->BayesDivide(found, all);
1383 
1384  TGraphAsymmErrors* gr2 = fs->make<TGraphAsymmErrors>(nLayers + 1);
1385  gr2->SetName("eff_all");
1386  gr2->BayesDivide(found2, all2);
1387 
1388  for (int j = 0; j < nLayers + 1; j++) {
1389  gr->SetPointError(j, 0., 0., gr->GetErrorYlow(j), gr->GetErrorYhigh(j));
1390  gr2->SetPointError(j, 0., 0., gr2->GetErrorYlow(j), gr2->GetErrorYhigh(j));
1391  }
1392 
1393  gr->GetXaxis()->SetLimits(0, nLayers);
1394  gr->SetMarkerColor(2);
1395  gr->SetMarkerSize(1.2);
1396  gr->SetLineColor(2);
1397  gr->SetLineWidth(4);
1398  gr->SetMarkerStyle(20);
1399  gr->SetMinimum(effPlotMin_);
1400  gr->SetMaximum(1.001);
1401  gr->GetYaxis()->SetTitle("Efficiency");
1402  gStyle->SetTitleFillColor(0);
1403  gStyle->SetTitleBorderSize(0);
1404  gr->SetTitle(title_);
1405 
1406  gr2->GetXaxis()->SetLimits(0, nLayers);
1407  gr2->SetMarkerColor(1);
1408  gr2->SetMarkerSize(1.2);
1409  gr2->SetLineColor(1);
1410  gr2->SetLineWidth(4);
1411  gr2->SetMarkerStyle(21);
1412  gr2->SetMinimum(effPlotMin_);
1413  gr2->SetMaximum(1.001);
1414  gr2->GetYaxis()->SetTitle("Efficiency");
1415  gr2->SetTitle(title_);
1416 
1417  for (Long_t k = 1; k < nLayers + 1; k++) {
1418  TString label;
1419  if (showEndcapSides_)
1421  else
1422  label = GetLayerName(k);
1423  if (!showTOB6TEC9_) {
1424  if (k == 10)
1425  label = "";
1426  if (!showRings_ && k == nLayers)
1427  label = "";
1428  if (!showRings_ && showEndcapSides_ && k == 25)
1429  label = "";
1430  }
1431  if (!showRings_) {
1432  if (showEndcapSides_) {
1433  gr->GetXaxis()->SetBinLabel(((k + 1) * 100 + 2) / (nLayers)-4, label);
1434  gr2->GetXaxis()->SetBinLabel(((k + 1) * 100 + 2) / (nLayers)-4, label);
1435  } else {
1436  gr->GetXaxis()->SetBinLabel((k + 1) * 100 / (nLayers)-6, label);
1437  gr2->GetXaxis()->SetBinLabel((k + 1) * 100 / (nLayers)-6, label);
1438  }
1439  } else {
1440  if (showEndcapSides_) {
1441  gr->GetXaxis()->SetBinLabel((k + 1) * 100 / (nLayers)-4, label);
1442  gr2->GetXaxis()->SetBinLabel((k + 1) * 100 / (nLayers)-4, label);
1443  } else {
1444  gr->GetXaxis()->SetBinLabel((k + 1) * 100 / (nLayers)-7, label);
1445  gr2->GetXaxis()->SetBinLabel((k + 1) * 100 / (nLayers)-7, label);
1446  }
1447  }
1448  }
1449 
1450  gr->Draw("AP");
1451  gr->GetXaxis()->SetNdivisions(36);
1452 
1453  c7->cd();
1454  TPad* overlay = new TPad("overlay", "", 0, 0, 1, 1);
1455  overlay->SetFillStyle(4000);
1456  overlay->SetFillColor(0);
1457  overlay->SetFrameFillStyle(4000);
1458  overlay->Draw("same");
1459  overlay->cd();
1460  if (!showOnlyGoodModules_)
1461  gr2->Draw("AP");
1462 
1463  TLegend* leg = new TLegend(0.70, 0.27, 0.88, 0.40);
1464  leg->AddEntry(gr, "Good Modules", "p");
1465  if (!showOnlyGoodModules_)
1466  leg->AddEntry(gr2, "All Modules", "p");
1467  leg->SetTextSize(0.020);
1468  leg->SetFillColor(0);
1469  leg->Draw("same");
1470 
1471  c7->SaveAs("Summary.png");
1472 }
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:25
int goodlayertotal[::k_END_OF_LAYS_AND_RINGS]
char const * label
def overlay(hists, ytitle, header, addon)
Definition: compare.py:122
Log< level::Info, false > LogInfo
int alllayerfound[::k_END_OF_LAYS_AND_RINGS]
int goodlayerfound[::k_END_OF_LAYS_AND_RINGS]
int alllayertotal[::k_END_OF_LAYS_AND_RINGS]

◆ makeSummaryVsBx()

void SiStripHitResolFromCalibTree::makeSummaryVsBx ( const edm::Service< TFileService > &  fs)
private

Definition at line 1474 of file SiStripHitResolFromCalibTree.cc.

References MillePedeFileConverter_cfg::e, nano_mu_digi_cff::float, newFWLiteAna::found, compareTotals::fs, GetLayerName(), layerfound_perBx, layerfound_vsBX, layertotal_perBx, layertotal_vsBX, LaserClient_cfi::low, nBxInAnOrbit, MuonTCMETValueMapProducer_cff::nLayers, showRings_, spaceBetweenTrains_, dqmMemoryStats::total, and up.

Referenced by algoAnalyze().

1474  {
1475  edm::LogInfo("SiStripHitResolFromCalibTree") << "Computing efficiency vs bx" << endl;
1476 
1477  unsigned int nLayers = 22;
1478  if (showRings_)
1479  nLayers = 20;
1480 
1481  for (unsigned int ilayer = 1; ilayer < nLayers; ilayer++) {
1482  for (unsigned int ibx = 0; ibx <= nBxInAnOrbit; ibx++) {
1483  layerfound_vsBX[ilayer]->SetBinContent(ibx, 1e-6);
1484  layertotal_vsBX[ilayer]->SetBinContent(ibx, 1);
1485  }
1486 
1487  map<unsigned int, vector<int> >::iterator iterMapvsBx;
1488  for (iterMapvsBx = layerfound_perBx.begin(); iterMapvsBx != layerfound_perBx.end(); ++iterMapvsBx)
1489  layerfound_vsBX[ilayer]->SetBinContent(iterMapvsBx->first, iterMapvsBx->second[ilayer]);
1490  for (iterMapvsBx = layertotal_perBx.begin(); iterMapvsBx != layertotal_perBx.end(); ++iterMapvsBx)
1491  if (iterMapvsBx->second[ilayer] > 0)
1492  layertotal_vsBX[ilayer]->SetBinContent(iterMapvsBx->first, iterMapvsBx->second[ilayer]);
1493 
1494  layerfound_vsBX[ilayer]->Sumw2();
1495  layertotal_vsBX[ilayer]->Sumw2();
1496 
1497  TGraphAsymmErrors* geff = fs->make<TGraphAsymmErrors>(nBxInAnOrbit - 1);
1498  geff->SetName(Form("effVsBx_layer%i", ilayer));
1499  geff->SetTitle("Hit Efficiency vs bx - " + GetLayerName(ilayer));
1500  geff->BayesDivide(layerfound_vsBX[ilayer], layertotal_vsBX[ilayer]);
1501 
1502  //Average over trains
1503  TGraphAsymmErrors* geff_avg = fs->make<TGraphAsymmErrors>();
1504  geff_avg->SetName(Form("effVsBxAvg_layer%i", ilayer));
1505  geff_avg->SetTitle("Hit Efficiency vs bx - " + GetLayerName(ilayer));
1506  geff_avg->SetMarkerStyle(20);
1507  int ibx = 0;
1508  int previous_bx = -80;
1509  int delta_bx = 0;
1510  int nbx = 0;
1511  int found = 0;
1512  int total = 0;
1513  double sum_bx = 0;
1514  int ipt = 0;
1515  float low, up, eff;
1516  int firstbx = 0;
1517  for (iterMapvsBx = layertotal_perBx.begin(); iterMapvsBx != layertotal_perBx.end(); ++iterMapvsBx) {
1518  ibx = iterMapvsBx->first;
1519  delta_bx = ibx - previous_bx;
1520  // consider a new train
1521  if (delta_bx > (int)spaceBetweenTrains_ && nbx > 0 && total > 0) {
1522  eff = found / (float)total;
1523  //edm::LogInfo("SiStripHitResolFromCalibTree")<<"new train "<<ipt<<" "<<sum_bx/nbx<<" "<<eff<<endl;
1524  geff_avg->SetPoint(ipt, sum_bx / nbx, eff);
1525  low = TEfficiency::Bayesian(total, found, .683, 1, 1, false);
1526  up = TEfficiency::Bayesian(total, found, .683, 1, 1, true);
1527  geff_avg->SetPointError(ipt, sum_bx / nbx - firstbx, previous_bx - sum_bx / nbx, eff - low, up - eff);
1528  ipt++;
1529  sum_bx = 0;
1530  found = 0;
1531  total = 0;
1532  nbx = 0;
1533  firstbx = ibx;
1534  }
1535  sum_bx += ibx;
1536  found += layerfound_vsBX[ilayer]->GetBinContent(ibx);
1537  total += layertotal_vsBX[ilayer]->GetBinContent(ibx);
1538  nbx++;
1539 
1540  previous_bx = ibx;
1541  }
1542  //last train
1543  eff = found / (float)total;
1544  //edm::LogInfo("SiStripHitResolFromCalibTree")<<"new train "<<ipt<<" "<<sum_bx/nbx<<" "<<eff<<endl;
1545  geff_avg->SetPoint(ipt, sum_bx / nbx, eff);
1546  low = TEfficiency::Bayesian(total, found, .683, 1, 1, false);
1547  up = TEfficiency::Bayesian(total, found, .683, 1, 1, true);
1548  geff_avg->SetPointError(ipt, sum_bx / nbx - firstbx, previous_bx - sum_bx / nbx, eff - low, up - eff);
1549  }
1550 }
Definition: BitonicSort.h:7
map< unsigned int, vector< int > > layertotal_perBx
map< unsigned int, vector< int > > layerfound_perBx
Log< level::Info, false > LogInfo

◆ makeSummaryVsCM()

void SiStripHitResolFromCalibTree::makeSummaryVsCM ( const edm::Service< TFileService > &  fs)
private

Definition at line 1648 of file SiStripHitResolFromCalibTree.cc.

References ComputeEff(), compareTotals::fs, layerfound_vsCM, and layertotal_vsCM.

Referenced by algoAnalyze().

1648  {
1649  edm::LogInfo("SiStripHitResolFromCalibTree") << "Computing efficiency vs CM" << endl;
1651 }
Log< level::Info, false > LogInfo
void ComputeEff(const edm::Service< TFileService > &fs, vector< TH1F *> &vhfound, vector< TH1F *> &vhtotal, string name)

◆ makeSummaryVsLumi()

void SiStripHitResolFromCalibTree::makeSummaryVsLumi ( const edm::Service< TFileService > &  fs)
private

Definition at line 1609 of file SiStripHitResolFromCalibTree.cc.

References ComputeEff(), compareTotals::fs, instLumiHisto, layerfound_vsLumi, layerfound_vsPU, layertotal_vsLumi, layertotal_vsPU, MuonTCMETValueMapProducer_cff::nLayers, PUHisto, and showRings_.

Referenced by algoAnalyze().

1609  {
1610  edm::LogInfo("SiStripHitResolFromCalibTree") << "Computing efficiency vs lumi" << endl;
1611 
1612  if (instLumiHisto->GetEntries()) // from infos per event
1613  edm::LogInfo("SiStripHitResolFromCalibTree")
1614  << "Avg conditions (avg+/-rms): lumi :" << instLumiHisto->GetMean() << "+/-" << instLumiHisto->GetRMS()
1615  << " pu: " << PUHisto->GetMean() << "+/-" << PUHisto->GetRMS() << endl;
1616 
1617  else { // from infos per hit
1618 
1619  unsigned int nLayers = 22;
1620  if (showRings_)
1621  nLayers = 20;
1622  unsigned int nLayersForAvg = 0;
1623  float layerLumi = 0;
1624  float layerPU = 0;
1625  float avgLumi = 0;
1626  float avgPU = 0;
1627 
1628  edm::LogInfo("SiStripHitResolFromCalibTree") << "Lumi summary: (avg over trajectory measurements)" << endl;
1629  for (unsigned int ilayer = 1; ilayer < nLayers; ilayer++) {
1630  layerLumi = layertotal_vsLumi[ilayer]->GetMean();
1631  layerPU = layertotal_vsPU[ilayer]->GetMean();
1632  //edm::LogInfo("SiStripHitResolFromCalibTree")<<" layer "<<ilayer<<" lumi: "<<layerLumi<<" pu: "<<layerPU<<endl;
1633  if (layerLumi != 0 && layerPU != 0) {
1634  avgLumi += layerLumi;
1635  avgPU += layerPU;
1636  nLayersForAvg++;
1637  }
1638  }
1639  avgLumi /= nLayersForAvg;
1640  avgPU /= nLayersForAvg;
1641  edm::LogInfo("SiStripHitResolFromCalibTree") << "Avg conditions: lumi :" << avgLumi << " pu: " << avgPU << endl;
1642  }
1643 
1646 }
Log< level::Info, false > LogInfo
void ComputeEff(const edm::Service< TFileService > &fs, vector< TH1F *> &vhfound, vector< TH1F *> &vhtotal, string name)

◆ makeTKMap()

void SiStripHitResolFromCalibTree::makeTKMap ( const edm::Service< TFileService > &  fs,
bool  autoTagging = false 
)
private

Definition at line 1101 of file SiStripHitResolFromCalibTree.cc.

References BadModules, TrackerMap::fill(), TrackerMap::fillc(), compareTotals::fs, GetLayerName(), mps_fire::i, layerfound, layertotal, modCounter, nModsMin_, TrackerMap::save(), threshold_, title_, tkmap, tkmapbad, tkmapden, tkmapeff, tkMapMin_, and tkmapnum.

Referenced by algoAnalyze().

1101  {
1102  edm::LogInfo("SiStripHitResolFromCalibTree") << "Entering TKMap generation!\n";
1103  tkmap = new TrackerMap(" Detector Inefficiency ");
1104  tkmapbad = new TrackerMap(" Inefficient Modules ");
1105  tkmapeff = new TrackerMap(title_.Data());
1106  tkmapnum = new TrackerMap(" Detector numerator ");
1107  tkmapden = new TrackerMap(" Detector denominator ");
1108 
1109  double myeff, mynum, myden;
1110  double eff_limit = 0;
1111 
1112  for (Long_t i = 1; i <= 22; i++) {
1113  //Loop over every layer, extracting the information from
1114  //the map of the efficiencies
1115  layertotal[i] = 0;
1116  layerfound[i] = 0;
1117  TH1F* hEffInLayer =
1118  fs->make<TH1F>(Form("eff_layer%i", int(i)), Form("Module efficiency in layer %i", int(i)), 201, 0, 1.005);
1119 
1120  map<unsigned int, pair<unsigned int, unsigned int> >::const_iterator ih;
1121  for (ih = modCounter[i].begin(); ih != modCounter[i].end(); ih++) {
1122  //We should be in the layer in question, and looping over all of the modules in said layer
1123  //Generate the list for the TKmap, and the bad module list
1124  mynum = (double)(((*ih).second).second);
1125  myden = (double)(((*ih).second).first);
1126  if (myden > 0)
1127  myeff = mynum / myden;
1128  else
1129  myeff = 0;
1130  hEffInLayer->Fill(myeff);
1131 
1132  if (!autoTagging) {
1133  if ((myden >= nModsMin_) && (myeff < threshold_)) {
1134  //We have a bad module, put it in the list!
1135  BadModules[(*ih).first] = myeff;
1136  tkmapbad->fillc((*ih).first, 255, 0, 0);
1137  edm::LogInfo("SiStripHitResolFromCalibTree")
1138  << "Layer " << i << " (" << GetLayerName(i) << ") module " << (*ih).first << " efficiency: " << myeff
1139  << " , " << mynum << "/" << myden << endl;
1140  } else {
1141  //Fill the bad list with empty results for every module
1142  tkmapbad->fillc((*ih).first, 255, 255, 255);
1143  }
1144  if (myden < nModsMin_) {
1145  edm::LogInfo("SiStripHitResolFromCalibTree") << "Layer " << i << " (" << GetLayerName(i) << ") module "
1146  << (*ih).first << " is under occupancy at " << myden << endl;
1147  }
1148  }
1149 
1150  //Put any module into the TKMap
1151  tkmap->fill((*ih).first, 1. - myeff);
1152  tkmapeff->fill((*ih).first, myeff);
1153  tkmapnum->fill((*ih).first, mynum);
1154  tkmapden->fill((*ih).first, myden);
1155 
1156  //Add the number of hits in the layer
1157  layertotal[i] += long(myden);
1158  layerfound[i] += long(mynum);
1159  }
1160 
1161  if (autoTagging) {
1162  //Compute threshold to use for each layer
1163  hEffInLayer->GetXaxis()->SetRange(3, hEffInLayer->GetNbinsX() + 1); // Remove from the avg modules below 1%
1164  eff_limit = hEffInLayer->GetMean() - threshold_;
1165  edm::LogInfo("SiStripHitResolFromCalibTree")
1166  << "Layer " << i << " threshold for bad modules: " << eff_limit << endl;
1167  hEffInLayer->GetXaxis()->SetRange(1, hEffInLayer->GetNbinsX() + 1);
1168 
1169  for (ih = modCounter[i].begin(); ih != modCounter[i].end(); ih++) {
1170  // Second loop over modules to tag inefficient ones
1171  mynum = (double)(((*ih).second).second);
1172  myden = (double)(((*ih).second).first);
1173  if (myden > 0)
1174  myeff = mynum / myden;
1175  else
1176  myeff = 0;
1177  if ((myden >= nModsMin_) && (myeff < eff_limit)) {
1178  //We have a bad module, put it in the list!
1179  BadModules[(*ih).first] = myeff;
1180  tkmapbad->fillc((*ih).first, 255, 0, 0);
1181  edm::LogInfo("SiStripHitResolFromCalibTree")
1182  << "Layer " << i << " (" << GetLayerName(i) << ") module " << (*ih).first << " efficiency: " << myeff
1183  << " , " << mynum << "/" << myden << endl;
1184  } else {
1185  //Fill the bad list with empty results for every module
1186  tkmapbad->fillc((*ih).first, 255, 255, 255);
1187  }
1188  if (myden < nModsMin_) {
1189  edm::LogInfo("SiStripHitResolFromCalibTree")
1190  << "Layer " << i << " (" << GetLayerName(i) << ") module " << (*ih).first << " layer " << i
1191  << " is under occupancy at " << myden << endl;
1192  }
1193  }
1194  }
1195  }
1196  tkmap->save(true, 0, 0, "SiStripHitResolTKMap.png");
1197  tkmapbad->save(true, 0, 0, "SiStripHitResolTKMapBad.png");
1198  tkmapeff->save(true, tkMapMin_, 1., "SiStripHitResolTKMapEff.png");
1199  tkmapnum->save(true, 0, 0, "SiStripHitResolTKMapNum.png");
1200  tkmapden->save(true, 0, 0, "SiStripHitResolTKMapDen.png");
1201  edm::LogInfo("SiStripHitResolFromCalibTree") << "Finished TKMap Generation\n";
1202 }
map< unsigned int, double > BadModules
void save(bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap.svg", int width=1500, int height=800)
Definition: TrackerMap.cc:844
map< unsigned int, pair< unsigned int, unsigned int > > modCounter[::k_END_OF_LAYERS]
void fillc(int idmod, int RGBcode)
Definition: TrackerMap.h:134
Log< level::Info, false > LogInfo
void fill(int layer, int ring, int nmod, float x)
Definition: TrackerMap.cc:3442

◆ SetBadComponents()

void SiStripHitResolFromCalibTree::SetBadComponents ( int  i,
int  component,
SiStripQuality::BadComponent BC,
std::stringstream  ssV[4][19],
int  NBadComponent[4][19][4] 
)
private

Definition at line 1710 of file SiStripHitResolFromCalibTree.cc.

References SiStripQuality::BadComponent::BadApvs, SiStripQuality::BadComponent::BadFibers, SiStripQuality::BadComponent::BadModule, SiStripQuality::BadComponent::detid, detInfo_, SiStripDetInfo::getNumberOfApvsAndStripLength(), mps_fire::i, and testProducerWithPsetDescEmpty_cfi::x1.

Referenced by algoAnalyze().

1711  {
1712  int napv = detInfo_.getNumberOfApvsAndStripLength(BC.detid).first;
1713 
1714  ssV[i][component] << "\n\t\t " << BC.detid << " \t " << BC.BadModule << " \t " << ((BC.BadFibers) & 0x1) << " ";
1715  if (napv == 4)
1716  ssV[i][component] << "x " << ((BC.BadFibers >> 1) & 0x1);
1717 
1718  if (napv == 6)
1719  ssV[i][component] << ((BC.BadFibers >> 1) & 0x1) << " " << ((BC.BadFibers >> 2) & 0x1);
1720  ssV[i][component] << " \t " << ((BC.BadApvs) & 0x1) << " " << ((BC.BadApvs >> 1) & 0x1) << " ";
1721  if (napv == 4)
1722  ssV[i][component] << "x x " << ((BC.BadApvs >> 2) & 0x1) << " " << ((BC.BadApvs >> 3) & 0x1);
1723  if (napv == 6)
1724  ssV[i][component] << ((BC.BadApvs >> 2) & 0x1) << " " << ((BC.BadApvs >> 3) & 0x1) << " "
1725  << ((BC.BadApvs >> 4) & 0x1) << " " << ((BC.BadApvs >> 5) & 0x1) << " ";
1726 
1727  if (BC.BadApvs) {
1728  NBadComponent[i][0][2] += ((BC.BadApvs >> 5) & 0x1) + ((BC.BadApvs >> 4) & 0x1) + ((BC.BadApvs >> 3) & 0x1) +
1729  ((BC.BadApvs >> 2) & 0x1) + ((BC.BadApvs >> 1) & 0x1) + ((BC.BadApvs) & 0x1);
1730  NBadComponent[i][component][2] += ((BC.BadApvs >> 5) & 0x1) + ((BC.BadApvs >> 4) & 0x1) +
1731  ((BC.BadApvs >> 3) & 0x1) + ((BC.BadApvs >> 2) & 0x1) +
1732  ((BC.BadApvs >> 1) & 0x1) + ((BC.BadApvs) & 0x1);
1733  }
1734  if (BC.BadFibers) {
1735  NBadComponent[i][0][1] += ((BC.BadFibers >> 2) & 0x1) + ((BC.BadFibers >> 1) & 0x1) + ((BC.BadFibers) & 0x1);
1736  NBadComponent[i][component][1] +=
1737  ((BC.BadFibers >> 2) & 0x1) + ((BC.BadFibers >> 1) & 0x1) + ((BC.BadFibers) & 0x1);
1738  }
1739  if (BC.BadModule) {
1740  NBadComponent[i][0][0]++;
1741  NBadComponent[i][component][0]++;
1742  }
1743 }
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const

◆ totalStatistics()

void SiStripHitResolFromCalibTree::totalStatistics ( )
private

Definition at line 1234 of file SiStripHitResolFromCalibTree.cc.

References GetLayerName(), mps_fire::i, layerfound, and layertotal.

Referenced by algoAnalyze().

1234  {
1235  //Calculate the statistics by layer
1236  int totalfound = 0;
1237  int totaltotal = 0;
1238  double layereff;
1239  int subdetfound[5];
1240  int subdettotal[5];
1241 
1242  for (Long_t i = 1; i < 5; i++) {
1243  subdetfound[i] = 0;
1244  subdettotal[i] = 0;
1245  }
1246 
1247  for (Long_t i = 1; i <= 22; i++) {
1248  layereff = double(layerfound[i]) / double(layertotal[i]);
1249  edm::LogInfo("SiStripHitResolFromCalibTree")
1250  << "Layer " << i << " (" << GetLayerName(i) << ") has total efficiency " << layereff << " " << layerfound[i]
1251  << "/" << layertotal[i] << endl;
1252  totalfound += layerfound[i];
1253  totaltotal += layertotal[i];
1254  if (i < 5) {
1255  subdetfound[1] += layerfound[i];
1256  subdettotal[1] += layertotal[i];
1257  }
1258  if (i >= 5 && i < 11) {
1259  subdetfound[2] += layerfound[i];
1260  subdettotal[2] += layertotal[i];
1261  }
1262  if (i >= 11 && i < 14) {
1263  subdetfound[3] += layerfound[i];
1264  subdettotal[3] += layertotal[i];
1265  }
1266  if (i >= 14) {
1267  subdetfound[4] += layerfound[i];
1268  subdettotal[4] += layertotal[i];
1269  }
1270  }
1271 
1272  edm::LogInfo("SiStripHitResolFromCalibTree")
1273  << "The total efficiency is " << double(totalfound) / double(totaltotal) << endl;
1274  edm::LogInfo("SiStripHitResolFromCalibTree") << " TIB: " << double(subdetfound[1]) / subdettotal[1] << " "
1275  << subdetfound[1] << "/" << subdettotal[1] << endl;
1276  edm::LogInfo("SiStripHitResolFromCalibTree") << " TOB: " << double(subdetfound[2]) / subdettotal[2] << " "
1277  << subdetfound[2] << "/" << subdettotal[2] << endl;
1278  edm::LogInfo("SiStripHitResolFromCalibTree") << " TID: " << double(subdetfound[3]) / subdettotal[3] << " "
1279  << subdetfound[3] << "/" << subdettotal[3] << endl;
1280  edm::LogInfo("SiStripHitResolFromCalibTree") << " TEC: " << double(subdetfound[4]) / subdettotal[4] << " "
1281  << subdetfound[4] << "/" << subdettotal[4] << endl;
1282 }
Log< level::Info, false > LogInfo

Member Data Documentation

◆ alllayerfound

int SiStripHitResolFromCalibTree::alllayerfound[::k_END_OF_LAYS_AND_RINGS]
private

Definition at line 165 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummary().

◆ alllayertotal

int SiStripHitResolFromCalibTree::alllayertotal[::k_END_OF_LAYS_AND_RINGS]
private

Definition at line 164 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummary().

◆ autoIneffModTagging_

bool SiStripHitResolFromCalibTree::autoIneffModTagging_
private

Definition at line 113 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitResolFromCalibTree().

◆ BadModules

map<unsigned int, double> SiStripHitResolFromCalibTree::BadModules
private

Definition at line 166 of file SiStripHitResolFromCalibTree.cc.

Referenced by makeSQLite(), and makeTKMap().

◆ badModulesFile_

string SiStripHitResolFromCalibTree::badModulesFile_
private

Definition at line 112 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitResolFromCalibTree().

◆ bunchx_

unsigned int SiStripHitResolFromCalibTree::bunchx_
private

Definition at line 119 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitResolFromCalibTree().

◆ bxHisto

TH1F* SiStripHitResolFromCalibTree::bxHisto
private

Definition at line 135 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze().

◆ CalibTree

TTree* SiStripHitResolFromCalibTree::CalibTree
private

Definition at line 107 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze().

◆ calibTreeFileNames_

vector<string> SiStripHitResolFromCalibTree::calibTreeFileNames_
private

Definition at line 108 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitResolFromCalibTree().

◆ clusterMatchingMethod_

unsigned int SiStripHitResolFromCalibTree::clusterMatchingMethod_
private

Definition at line 114 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitResolFromCalibTree().

◆ clusterTrajDist_

float SiStripHitResolFromCalibTree::clusterTrajDist_
private

Definition at line 116 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitResolFromCalibTree().

◆ detInfo_

SiStripDetInfo SiStripHitResolFromCalibTree::detInfo_
private

◆ doSummary_

unsigned int SiStripHitResolFromCalibTree::doSummary_
private

Definition at line 111 of file SiStripHitResolFromCalibTree.cc.

Referenced by SiStripHitResolFromCalibTree().

◆ effPlotMin_

float SiStripHitResolFromCalibTree::effPlotMin_
private

Definition at line 127 of file SiStripHitResolFromCalibTree.cc.

Referenced by makeSummary(), and SiStripHitResolFromCalibTree().

◆ eventInfos

map<pair<unsigned int, unsigned int>, array<double, 3> > SiStripHitResolFromCalibTree::eventInfos
private

Definition at line 140 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze().

◆ FileInPath_

edm::FileInPath SiStripHitResolFromCalibTree::FileInPath_
private

Definition at line 103 of file SiStripHitResolFromCalibTree.cc.

Referenced by SiStripHitResolFromCalibTree().

◆ goodlayerfound

int SiStripHitResolFromCalibTree::goodlayerfound[::k_END_OF_LAYS_AND_RINGS]
private

Definition at line 163 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummary().

◆ goodlayertotal

int SiStripHitResolFromCalibTree::goodlayertotal[::k_END_OF_LAYS_AND_RINGS]
private

Definition at line 162 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummary().

◆ hits

vector<hit> SiStripHitResolFromCalibTree::hits[::k_END_OF_LAYERS]
private

Definition at line 142 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and makeHotColdMaps().

◆ HotColdMaps

vector<TH2F*> SiStripHitResolFromCalibTree::HotColdMaps
private

Definition at line 143 of file SiStripHitResolFromCalibTree.cc.

Referenced by makeHotColdMaps().

◆ instLumiHisto

TH1F* SiStripHitResolFromCalibTree::instLumiHisto
private

Definition at line 136 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsLumi().

◆ layerfound

long SiStripHitResolFromCalibTree::layerfound[::k_END_OF_LAYERS]
private

Definition at line 150 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), makeTKMap(), and totalStatistics().

◆ layerfound_perBx

map<unsigned int, vector<int> > SiStripHitResolFromCalibTree::layerfound_perBx
private

Definition at line 152 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsBx().

◆ layerfound_vsBX

vector<TH1F*> SiStripHitResolFromCalibTree::layerfound_vsBX
private

Definition at line 160 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsBx().

◆ layerfound_vsCM

vector<TH1F*> SiStripHitResolFromCalibTree::layerfound_vsCM
private

Definition at line 158 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsCM().

◆ layerfound_vsLumi

vector<TH1F*> SiStripHitResolFromCalibTree::layerfound_vsLumi
private

Definition at line 154 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsLumi().

◆ layerfound_vsPU

vector<TH1F*> SiStripHitResolFromCalibTree::layerfound_vsPU
private

Definition at line 156 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsLumi().

◆ layertotal

long SiStripHitResolFromCalibTree::layertotal[::k_END_OF_LAYERS]
private

Definition at line 151 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), makeTKMap(), and totalStatistics().

◆ layertotal_perBx

map<unsigned int, vector<int> > SiStripHitResolFromCalibTree::layertotal_perBx
private

Definition at line 153 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsBx().

◆ layertotal_vsBX

vector<TH1F*> SiStripHitResolFromCalibTree::layertotal_vsBX
private

Definition at line 161 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsBx().

◆ layertotal_vsCM

vector<TH1F*> SiStripHitResolFromCalibTree::layertotal_vsCM
private

Definition at line 159 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsCM().

◆ layertotal_vsLumi

vector<TH1F*> SiStripHitResolFromCalibTree::layertotal_vsLumi
private

Definition at line 155 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsLumi().

◆ layertotal_vsPU

vector<TH1F*> SiStripHitResolFromCalibTree::layertotal_vsPU
private

Definition at line 157 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsLumi().

◆ modCounter

map<unsigned int, pair<unsigned int, unsigned int> > SiStripHitResolFromCalibTree::modCounter[::k_END_OF_LAYERS]
private

Definition at line 144 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and makeTKMap().

◆ nBxInAnOrbit

constexpr double SiStripHitResolFromCalibTree::nBxInAnOrbit = 3565
staticprivate

Definition at line 100 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsBx().

◆ nModsMin_

unsigned int SiStripHitResolFromCalibTree::nModsMin_
private

◆ nTEClayers_

unsigned int SiStripHitResolFromCalibTree::nTEClayers_
private

◆ PUHisto

TH1F* SiStripHitResolFromCalibTree::PUHisto
private

Definition at line 137 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsLumi().

◆ quality_

SiStripQuality* SiStripHitResolFromCalibTree::quality_
private

◆ resXSig_

float SiStripHitResolFromCalibTree::resXSig_
private

Definition at line 115 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitResolFromCalibTree().

◆ showEndcapSides_

bool SiStripHitResolFromCalibTree::showEndcapSides_
private

Definition at line 122 of file SiStripHitResolFromCalibTree.cc.

Referenced by makeSummary(), and SiStripHitResolFromCalibTree().

◆ showOnlyGoodModules_

bool SiStripHitResolFromCalibTree::showOnlyGoodModules_
private

Definition at line 125 of file SiStripHitResolFromCalibTree.cc.

Referenced by makeSummary(), and SiStripHitResolFromCalibTree().

◆ showRings_

bool SiStripHitResolFromCalibTree::showRings_
private

◆ showTOB6TEC9_

bool SiStripHitResolFromCalibTree::showTOB6TEC9_
private

◆ spaceBetweenTrains_

unsigned int SiStripHitResolFromCalibTree::spaceBetweenTrains_
private

◆ stripsApvEdge_

float SiStripHitResolFromCalibTree::stripsApvEdge_
private

Definition at line 117 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitResolFromCalibTree().

◆ threshold_

float SiStripHitResolFromCalibTree::threshold_
private

◆ title_

TString SiStripHitResolFromCalibTree::title_
private

◆ tkGeomToken_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiStripHitResolFromCalibTree::tkGeomToken_
private

Definition at line 130 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitResolFromCalibTree().

◆ tkmap

TrackerMap* SiStripHitResolFromCalibTree::tkmap
private

Definition at line 145 of file SiStripHitResolFromCalibTree.cc.

Referenced by makeTKMap().

◆ tkmapbad

TrackerMap* SiStripHitResolFromCalibTree::tkmapbad
private

Definition at line 146 of file SiStripHitResolFromCalibTree.cc.

Referenced by makeTKMap().

◆ tkmapden

TrackerMap* SiStripHitResolFromCalibTree::tkmapden
private

Definition at line 149 of file SiStripHitResolFromCalibTree.cc.

Referenced by makeTKMap().

◆ tkmapeff

TrackerMap* SiStripHitResolFromCalibTree::tkmapeff
private

Definition at line 147 of file SiStripHitResolFromCalibTree.cc.

Referenced by makeTKMap().

◆ tkMapMin_

float SiStripHitResolFromCalibTree::tkMapMin_
private

Definition at line 126 of file SiStripHitResolFromCalibTree.cc.

Referenced by makeTKMap(), and SiStripHitResolFromCalibTree().

◆ tkmapnum

TrackerMap* SiStripHitResolFromCalibTree::tkmapnum
private

Definition at line 148 of file SiStripHitResolFromCalibTree.cc.

Referenced by makeTKMap().

◆ tTopoToken_

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SiStripHitResolFromCalibTree::tTopoToken_
private

Definition at line 131 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitResolFromCalibTree().

◆ useCM_

bool SiStripHitResolFromCalibTree::useCM_
private

Definition at line 121 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitResolFromCalibTree().

◆ useOnlyHighPurityTracks_

bool SiStripHitResolFromCalibTree::useOnlyHighPurityTracks_
private

Definition at line 118 of file SiStripHitResolFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitResolFromCalibTree().