CMS 3D CMS Logo

SiStripGainFromCalibTree.cc
Go to the documentation of this file.
1 // Original Author: Loic QUERTENMONT
2 // Created: Mon Nov 16 08:55:18 CET 2009
3 
4 #include <memory>
5 #include <iostream>
6 
16 
18 
24 
32 
34 
37 
50 
53 
56 
60 
63 
66 
67 #include "TFile.h"
68 #include "TObjString.h"
69 #include "TString.h"
70 #include "TH1F.h"
71 #include "TH2S.h"
72 #include "TProfile.h"
73 #include "TF1.h"
74 #include "TROOT.h"
75 #include "TTree.h"
76 #include "TChain.h"
77 
78 // user includes
81 
82 #include <unordered_map>
83 #include <array>
84 
85 using namespace edm;
86 using namespace reco;
87 using namespace std;
88 using namespace APVGain;
89 
90 class SiStripGainFromCalibTree : public ConditionDBWriter<SiStripApvGain> {
91 public:
95  ~SiStripGainFromCalibTree() override;
96 
97 private:
98  void algoBeginRun(const edm::Run& run, const edm::EventSetup& iSetup) override;
99  void algoEndRun(const edm::Run& run, const edm::EventSetup& iSetup) override;
100  void algoBeginJob(const edm::EventSetup& iSetup) override;
101  void algoEndJob() override;
102  void algoAnalyze(const edm::Event&, const edm::EventSetup&) override;
103 
104  int statCollectionFromMode(const char* tag) const;
105  void bookDQMHistos(const char* dqm_dir, const char* tag);
106 
107  bool isBFieldConsistentWithMode(const edm::EventSetup& iSetup) const;
108  void swapBFieldMode(void);
109 
110  void merge(TH2* A, TH2* B); //needed to add histograms with different number of bins
111  void algoAnalyzeTheTree();
112  void algoComputeMPVandGain();
113  void processEvent(); //what really does the job
114 
115  void getPeakOfLandau(TH1* InputHisto, double* FitResults, double LowRange = 50, double HighRange = 5400);
116  bool IsGoodLandauFit(double* FitResults);
117  void storeOnTree(TFileService* tfs);
118  void qualityMonitor();
119  void MakeCalibrationMap();
120  bool produceTagFilter();
121 
122  template <typename T>
123  inline edm::Handle<T> connect(const T*& ptr, edm::EDGetTokenT<T> token, const edm::Event& evt) {
125  evt.getByToken(token, handle);
126  ptr = handle.product();
127  return handle; //return handle to keep alive pointer (safety first)
128  }
129 
130  std::unique_ptr<SiStripApvGain> getNewObject() override;
131 
135  double MinNrEntries;
136  double MaxMPVError;
140  double MinTrackEta;
141  double MaxTrackEta;
142  unsigned int MaxNrStrips;
143  unsigned int MinTrackHits;
151 
160  std::vector<std::string> VChargeHisto;
164 
167  vector<string> VInputFiles;
168 
169  //enum statistic_type {None=-1, StdBunch, StdBunch0T, FaABunch, FaABunch0T, IsoBunch, IsoBunch0T, Harvest};
170 
171  std::vector<string> dqm_tag_;
173 
174  std::vector<MonitorElement*> Charge_Vs_Index;
175  std::array<std::vector<APVGain::APVmon>, 7> Charge_1;
176  std::array<std::vector<APVGain::APVmon>, 7> Charge_2;
177  std::array<std::vector<APVGain::APVmon>, 7> Charge_3;
178  std::array<std::vector<APVGain::APVmon>, 7> Charge_4;
180  std::vector<MonitorElement*> Charge_Vs_PathlengthTIB;
181  std::vector<MonitorElement*> Charge_Vs_PathlengthTOB;
182  std::vector<MonitorElement*> Charge_Vs_PathlengthTIDP;
183  std::vector<MonitorElement*> Charge_Vs_PathlengthTIDM;
184  std::vector<MonitorElement*> Charge_Vs_PathlengthTECP1;
185  std::vector<MonitorElement*> Charge_Vs_PathlengthTECP2;
186  std::vector<MonitorElement*> Charge_Vs_PathlengthTECM1;
187  std::vector<MonitorElement*> Charge_Vs_PathlengthTECM2;
189  //std::vector<MonitorElement*> Charge_Vs_Index_Absolute;
190 
191  //Validation histograms
244  std::vector<APVGain::APVmon> newCharge;
245 
246  unsigned int NEvent;
247  unsigned int NTrack;
248  unsigned int NClusterStrip;
249  unsigned int NClusterPixel;
252  unsigned int SRun;
253  unsigned int ERun;
254  unsigned int GOOD;
255  unsigned int BAD;
256  unsigned int MASKED;
257 
258  //Data members for processing
259 
260  //Event data
261  unsigned int eventnumber = 0;
262  unsigned int runnumber = 0;
263  const std::vector<bool>* TrigTech = nullptr;
265 
266  // Track data
267  const std::vector<double>* trackchi2ndof = nullptr;
269  const std::vector<float>* trackp = nullptr;
271  const std::vector<float>* trackpt = nullptr;
273  const std::vector<double>* tracketa = nullptr;
275  const std::vector<double>* trackphi = nullptr;
277  const std::vector<unsigned int>* trackhitsvalid = nullptr;
279  const std::vector<int>* trackalgo = nullptr;
281 
282  // CalibTree data
283  const std::vector<int>* trackindex = nullptr;
285  const std::vector<unsigned int>* rawid = nullptr;
287  const std::vector<double>* localdirx = nullptr;
289  const std::vector<double>* localdiry = nullptr;
291  const std::vector<double>* localdirz = nullptr;
293  const std::vector<unsigned short>* firststrip = nullptr;
295  const std::vector<unsigned short>* nstrips = nullptr;
297  const std::vector<bool>* saturation = nullptr;
299  const std::vector<bool>* overlapping = nullptr;
301  const std::vector<bool>* farfromedge = nullptr;
303  const std::vector<unsigned int>* charge = nullptr;
305  const std::vector<double>* path = nullptr;
307  const std::vector<double>* chargeoverpath = nullptr;
309  const std::vector<unsigned char>* amplitude = nullptr;
311  const std::vector<double>* gainused = nullptr;
313  const std::vector<double>* gainusedTick = nullptr;
315 
316  string EventPrefix_; //("");
317  string EventSuffix_; //("");
318  string TrackPrefix_; //("track");
319  string TrackSuffix_; //("");
320  string CalibPrefix_; //("GainCalibration");
321  string CalibSuffix_; //("");
322 
323 private:
324  std::vector<stAPVGain*> APVsCollOrdered;
325  std::unordered_map<unsigned int, stAPVGain*> APVsColl;
327 };
328 
330  std::vector<string>::const_iterator it = dqm_tag_.begin();
331  while (it != dqm_tag_.end()) {
332  if (*it == std::string(tag))
333  return it - dqm_tag_.begin();
334  it++;
335  }
336 
337  if (std::string(tag).empty())
338  return 0; // return StdBunch calibration mode for backward compatibility
339 
340  return None;
341 }
342 
344  if (A->GetNbinsX() == B->GetNbinsX()) {
345  A->Add(B);
346  } else {
347  for (int x = 0; x <= B->GetNbinsX() + 1; x++) {
348  for (int y = 0; y <= B->GetNbinsY() + 1; y++) {
349  A->SetBinContent(x, y, A->GetBinContent(x, y) + B->GetBinContent(x, y));
350  }
351  }
352  }
353 }
354 
356  : ConditionDBWriter<SiStripApvGain>(iConfig) {
357  OutputGains = iConfig.getParameter<std::string>("OutputGains");
358 
359  AlgoMode = iConfig.getUntrackedParameter<std::string>("AlgoMode", "CalibTree");
360  MagFieldCurrentTh = iConfig.getUntrackedParameter<double>("MagFieldCurrentTh", 2000.);
361  MinNrEntries = iConfig.getUntrackedParameter<double>("minNrEntries", 20);
362  MaxMPVError = iConfig.getUntrackedParameter<double>("maxMPVError", 500.0);
363  MaxChi2OverNDF = iConfig.getUntrackedParameter<double>("maxChi2OverNDF", 5.0);
364  MinTrackMomentum = iConfig.getUntrackedParameter<double>("minTrackMomentum", 3.0);
365  MaxTrackMomentum = iConfig.getUntrackedParameter<double>("maxTrackMomentum", 99999.0);
366  MinTrackEta = iConfig.getUntrackedParameter<double>("minTrackEta", -5.0);
367  MaxTrackEta = iConfig.getUntrackedParameter<double>("maxTrackEta", 5.0);
368  MaxNrStrips = iConfig.getUntrackedParameter<unsigned>("maxNrStrips", 2);
369  MinTrackHits = iConfig.getUntrackedParameter<unsigned>("MinTrackHits", 8);
370  MaxTrackChiOverNdf = iConfig.getUntrackedParameter<double>("MaxTrackChiOverNdf", 3);
371  MaxTrackingIteration = iConfig.getUntrackedParameter<int>("MaxTrackingIteration", 7);
372  AllowSaturation = iConfig.getUntrackedParameter<bool>("AllowSaturation", false);
373  FirstSetOfConstants = iConfig.getUntrackedParameter<bool>("FirstSetOfConstants", true);
374  Validation = iConfig.getUntrackedParameter<bool>("Validation", false);
375  OldGainRemoving = iConfig.getUntrackedParameter<bool>("OldGainRemoving", false);
376 
377  CalibrationLevel = iConfig.getUntrackedParameter<int>("CalibrationLevel", 0);
378  VInputFiles = iConfig.getUntrackedParameter<vector<string>>("InputFiles");
379  VChargeHisto = iConfig.getUntrackedParameter<vector<string>>("ChargeHisto");
380 
381  useCalibration = iConfig.getUntrackedParameter<bool>("UseCalibration", false);
382  m_harvestingMode = iConfig.getUntrackedParameter<bool>("harvestingMode", false);
383  m_splitDQMstat = iConfig.getUntrackedParameter<bool>("splitDQMstat", false);
384  m_calibrationMode = iConfig.getUntrackedParameter<string>("calibrationMode", "StdBunch");
385  m_calibrationPath = iConfig.getUntrackedParameter<string>("calibrationPath");
386  m_DQMdir = iConfig.getUntrackedParameter<string>("DQMdir", "AlCaReco/SiStripGains");
387 
388  tagCondition_NClusters = iConfig.getUntrackedParameter<double>("NClustersForTagProd", 2E8);
389  tagCondition_GoodFrac = iConfig.getUntrackedParameter<double>("GoodFracForTagProd", 0.95);
390 
391  saveSummary = iConfig.getUntrackedParameter<bool>("saveSummary", false);
392 
393  doChargeMonitorPerPlane = iConfig.getUntrackedParameter<bool>("doChargeMonitorPerPlane", false);
394 
395  // Gather DQM Service
396  dbe = edm::Service<DQMStore>().operator->();
397 
398  //Set the monitoring element tag and store
399  dqm_tag_.reserve(7);
400  dqm_tag_.clear();
401  dqm_tag_.push_back("StdBunch"); // statistic collection from Standard Collision Bunch @ 3.8 T
402  dqm_tag_.push_back("StdBunch0T"); // statistic collection from Standard Collision Bunch @ 0 T
403  dqm_tag_.push_back("AagBunch"); // statistic collection from First Collision After Abort Gap @ 3.8 T
404  dqm_tag_.push_back("AagBunch0T"); // statistic collection from First Collision After Abort Gap @ 0 T
405  dqm_tag_.push_back("IsoMuon"); // statistic collection from Isolated Muon @ 3.8 T
406  dqm_tag_.push_back("IsoMuon0T"); // statistic collection from Isolated Muon @ 0 T
407  dqm_tag_.push_back("Harvest"); // statistic collection: Harvest
408 
409  Charge_Vs_Index.insert(Charge_Vs_Index.begin(), dqm_tag_.size(), nullptr);
410  //Charge_Vs_Index_Absolute.insert( Charge_Vs_Index_Absolute.begin(), dqm_tag_.size(), 0);
411  Charge_Vs_PathlengthTIB.insert(Charge_Vs_PathlengthTIB.begin(), dqm_tag_.size(), nullptr);
412  Charge_Vs_PathlengthTOB.insert(Charge_Vs_PathlengthTOB.begin(), dqm_tag_.size(), nullptr);
413  Charge_Vs_PathlengthTIDP.insert(Charge_Vs_PathlengthTIDP.begin(), dqm_tag_.size(), nullptr);
414  Charge_Vs_PathlengthTIDM.insert(Charge_Vs_PathlengthTIDM.begin(), dqm_tag_.size(), nullptr);
415  Charge_Vs_PathlengthTECP1.insert(Charge_Vs_PathlengthTECP1.begin(), dqm_tag_.size(), nullptr);
416  Charge_Vs_PathlengthTECP2.insert(Charge_Vs_PathlengthTECP2.begin(), dqm_tag_.size(), nullptr);
417  Charge_Vs_PathlengthTECM1.insert(Charge_Vs_PathlengthTECM1.begin(), dqm_tag_.size(), nullptr);
418  Charge_Vs_PathlengthTECM2.insert(Charge_Vs_PathlengthTECM2.begin(), dqm_tag_.size(), nullptr);
419 
420  // configure token for gathering the ntuple variables
421  edm::ParameterSet swhallowgain_pset = iConfig.getUntrackedParameter<edm::ParameterSet>("gain");
422 
423  string label = swhallowgain_pset.getUntrackedParameter<string>("label");
424  CalibPrefix_ = swhallowgain_pset.getUntrackedParameter<string>("prefix");
425  CalibSuffix_ = swhallowgain_pset.getUntrackedParameter<string>("suffix");
426 
427  trackindex_token_ = consumes<std::vector<int>>(edm::InputTag(label, CalibPrefix_ + "trackindex" + CalibSuffix_));
428  rawid_token_ = consumes<std::vector<unsigned int>>(edm::InputTag(label, CalibPrefix_ + "rawid" + CalibSuffix_));
429  localdirx_token_ = consumes<std::vector<double>>(edm::InputTag(label, CalibPrefix_ + "localdirx" + CalibSuffix_));
430  localdiry_token_ = consumes<std::vector<double>>(edm::InputTag(label, CalibPrefix_ + "localdiry" + CalibSuffix_));
431  localdirz_token_ = consumes<std::vector<double>>(edm::InputTag(label, CalibPrefix_ + "localdirz" + CalibSuffix_));
433  consumes<std::vector<unsigned short>>(edm::InputTag(label, CalibPrefix_ + "firststrip" + CalibSuffix_));
434  nstrips_token_ = consumes<std::vector<unsigned short>>(edm::InputTag(label, CalibPrefix_ + "nstrips" + CalibSuffix_));
435  saturation_token_ = consumes<std::vector<bool>>(edm::InputTag(label, CalibPrefix_ + "saturation" + CalibSuffix_));
436  overlapping_token_ = consumes<std::vector<bool>>(edm::InputTag(label, CalibPrefix_ + "overlapping" + CalibSuffix_));
437  farfromedge_token_ = consumes<std::vector<bool>>(edm::InputTag(label, CalibPrefix_ + "farfromedge" + CalibSuffix_));
438  charge_token_ = consumes<std::vector<unsigned int>>(edm::InputTag(label, CalibPrefix_ + "charge" + CalibSuffix_));
439  path_token_ = consumes<std::vector<double>>(edm::InputTag(label, CalibPrefix_ + "path" + CalibSuffix_));
441  consumes<std::vector<double>>(edm::InputTag(label, CalibPrefix_ + "chargeoverpath" + CalibSuffix_));
443  consumes<std::vector<unsigned char>>(edm::InputTag(label, CalibPrefix_ + "amplitude" + CalibSuffix_));
444  gainused_token_ = consumes<std::vector<double>>(edm::InputTag(label, CalibPrefix_ + "gainused" + CalibSuffix_));
446  consumes<std::vector<double>>(edm::InputTag(label, CalibPrefix_ + "gainusedTick" + CalibSuffix_));
447 
448  edm::ParameterSet evtinfo_pset = iConfig.getUntrackedParameter<edm::ParameterSet>("evtinfo");
449  label = evtinfo_pset.getUntrackedParameter<string>("label");
450  EventPrefix_ = evtinfo_pset.getUntrackedParameter<string>("prefix");
451  EventSuffix_ = evtinfo_pset.getUntrackedParameter<string>("suffix");
452  TrigTech_token_ = consumes<std::vector<bool>>(edm::InputTag(label, EventPrefix_ + "TrigTech" + EventSuffix_));
453 
454  edm::ParameterSet track_pset = iConfig.getUntrackedParameter<edm::ParameterSet>("tracks");
455  label = track_pset.getUntrackedParameter<string>("label");
456  TrackPrefix_ = track_pset.getUntrackedParameter<string>("prefix");
457  TrackSuffix_ = track_pset.getUntrackedParameter<string>("suffix");
458 
459  trackchi2ndof_token_ = consumes<std::vector<double>>(edm::InputTag(label, TrackPrefix_ + "chi2ndof" + TrackSuffix_));
460  trackp_token_ = consumes<std::vector<float>>(edm::InputTag(label, TrackPrefix_ + "momentum" + TrackSuffix_));
461  trackpt_token_ = consumes<std::vector<float>>(edm::InputTag(label, TrackPrefix_ + "pt" + TrackSuffix_));
462  tracketa_token_ = consumes<std::vector<double>>(edm::InputTag(label, TrackPrefix_ + "eta" + TrackSuffix_));
463  trackphi_token_ = consumes<std::vector<double>>(edm::InputTag(label, TrackPrefix_ + "phi" + TrackSuffix_));
465  consumes<std::vector<unsigned int>>(edm::InputTag(label, TrackPrefix_ + "hitsvalid" + TrackSuffix_));
466  trackalgo_token_ = consumes<std::vector<int>>(edm::InputTag(label, TrackPrefix_ + "algo" + TrackSuffix_));
467 
468  tTopo_ = nullptr;
469 }
470 
471 void SiStripGainFromCalibTree::bookDQMHistos(const char* dqm_dir, const char* tag) {
472  edm::LogInfo("SiStripGainFromCalibTree")
473  << "Setting " << dqm_dir << "in DQM and booking histograms for tag " << tag << std::endl;
474 
475  if (strcmp(booked_dir_.c_str(), dqm_dir) != 0) {
476  booked_dir_ = dqm_dir;
477  dbe->setCurrentFolder(dqm_dir);
478  }
479 
480  std::string stag(tag);
481  if (!stag.empty() && stag[0] != '_')
482  stag.insert(0, 1, '_');
483 
484  std::string cvi = std::string("Charge_Vs_Index") + stag;
485  //std::string cviA = std::string("Charge_Vs_Index_Absolute") + stag;
486  std::string cvpTIB = std::string("Charge_Vs_PathlengthTIB") + stag;
487  std::string cvpTOB = std::string("Charge_Vs_PathlengthTOB") + stag;
488  std::string cvpTIDP = std::string("Charge_Vs_PathlengthTIDP") + stag;
489  std::string cvpTIDM = std::string("Charge_Vs_PathlengthTIDM") + stag;
490  std::string cvpTECP1 = std::string("Charge_Vs_PathlengthTECP1") + stag;
491  std::string cvpTECP2 = std::string("Charge_Vs_PathlengthTECP2") + stag;
492  std::string cvpTECM1 = std::string("Charge_Vs_PathlengthTECM1") + stag;
493  std::string cvpTECM2 = std::string("Charge_Vs_PathlengthTECM2") + stag;
494 
495  int elepos = (m_harvestingMode && AlgoMode == "PCL") ? Harvest : statCollectionFromMode(tag);
496 
497  // The cluster charge is stored by exploiting a non uniform binning in order
498  // reduce the histogram memory size. The bin width is relaxed with a falling
499  // exponential function and the bin boundaries are stored in the binYarray.
500  // The binXarray is used to provide as many bins as the APVs.
501  //
502  // More details about this implementations are here:
503  // https://indico.cern.ch/event/649344/contributions/2672267/attachments/1498323/2332518/OptimizeChHisto.pdf
504 
505  std::vector<float> binXarray;
506  binXarray.reserve(NStripAPVs + 1);
507  for (int a = 0; a <= NStripAPVs; a++) {
508  binXarray.push_back((float)a);
509  }
510 
511  std::array<float, 688> binYarray;
512  double p0 = 5.445;
513  double p1 = 0.002113;
514  double p2 = 69.01576;
515  double y = 0.;
516  for (int b = 0; b < 687; b++) {
517  binYarray[b] = y;
518  if (y <= 902.)
519  y = y + 2.;
520  else
521  y = (p0 - log(exp(p0 - p1 * y) - p2 * p1)) / p1;
522  }
523  binYarray[687] = 4000.;
524 
525  Charge_Vs_Index[elepos] = dbe->book2S(cvi.c_str(), cvi.c_str(), NStripAPVs, &binXarray[0], 687, binYarray.data());
526  //Charge_Vs_Index_Absolute[elepos] = dbe->book2S(cviA.c_str() , cviA.c_str() , 88625, 0 , 88624,1000,0,4000);
527  Charge_Vs_PathlengthTIB[elepos] = dbe->book2S(cvpTIB.c_str(), cvpTIB.c_str(), 20, 0.3, 1.3, 250, 0, 2000);
528  Charge_Vs_PathlengthTOB[elepos] = dbe->book2S(cvpTOB.c_str(), cvpTOB.c_str(), 20, 0.3, 1.3, 250, 0, 2000);
529  Charge_Vs_PathlengthTIDP[elepos] = dbe->book2S(cvpTIDP.c_str(), cvpTIDP.c_str(), 20, 0.3, 1.3, 250, 0, 2000);
530  Charge_Vs_PathlengthTIDM[elepos] = dbe->book2S(cvpTIDM.c_str(), cvpTIDM.c_str(), 20, 0.3, 1.3, 250, 0, 2000);
531  Charge_Vs_PathlengthTECP1[elepos] = dbe->book2S(cvpTECP1.c_str(), cvpTECP1.c_str(), 20, 0.3, 1.3, 250, 0, 2000);
532  Charge_Vs_PathlengthTECP2[elepos] = dbe->book2S(cvpTECP2.c_str(), cvpTECP2.c_str(), 20, 0.3, 1.3, 250, 0, 2000);
533  Charge_Vs_PathlengthTECM1[elepos] = dbe->book2S(cvpTECM1.c_str(), cvpTECM1.c_str(), 20, 0.3, 1.3, 250, 0, 2000);
534  Charge_Vs_PathlengthTECM2[elepos] = dbe->book2S(cvpTECM2.c_str(), cvpTECM2.c_str(), 20, 0.3, 1.3, 250, 0, 2000);
535 
536  //Book Charge monitoring histograms
537  std::vector<std::pair<std::string, std::string>> hnames =
539  for (unsigned int i = 0; i < hnames.size(); i++) {
540  std::string htag = (hnames[i]).first + stag;
541  MonitorElement* monitor = dbe->book1DD(htag.c_str(), (hnames[i]).second.c_str(), 100, 0., 1000.);
542  int id = APVGain::subdetectorId((hnames[i]).first);
543  int side = APVGain::subdetectorSide((hnames[i]).first);
544  int plane = APVGain::subdetectorPlane((hnames[i]).first);
545  Charge_1[elepos].push_back(APVGain::APVmon(id, side, plane, monitor));
546  }
547 
549  for (unsigned int i = 0; i < hnames.size(); i++) {
550  std::string htag = (hnames[i]).first + stag;
551  MonitorElement* monitor = dbe->book1DD(htag.c_str(), (hnames[i]).second.c_str(), 100, 0., 1000.);
552  int id = APVGain::subdetectorId((hnames[i]).first);
553  int side = APVGain::subdetectorSide((hnames[i]).first);
554  int plane = APVGain::subdetectorPlane((hnames[i]).first);
555  Charge_2[elepos].push_back(APVGain::APVmon(id, side, plane, monitor));
556  }
557 
559  for (unsigned int i = 0; i < hnames.size(); i++) {
560  std::string htag = (hnames[i]).first + stag;
561  MonitorElement* monitor = dbe->book1DD(htag.c_str(), (hnames[i]).second.c_str(), 100, 0., 1000.);
562  int id = APVGain::subdetectorId((hnames[i]).first);
563  int side = APVGain::subdetectorSide((hnames[i]).first);
564  int plane = APVGain::subdetectorPlane((hnames[i]).first);
565  Charge_3[elepos].push_back(APVGain::APVmon(id, side, plane, monitor));
566  }
567 
569  for (unsigned int i = 0; i < hnames.size(); i++) {
570  std::string htag = (hnames[i]).first + stag;
571  MonitorElement* monitor = dbe->book1DD(htag.c_str(), (hnames[i]).second.c_str(), 100, 0., 1000.);
572  int id = APVGain::subdetectorId((hnames[i]).first);
573  int side = APVGain::subdetectorSide((hnames[i]).first);
574  int plane = APVGain::subdetectorPlane((hnames[i]).first);
575  Charge_4[elepos].push_back(APVGain::APVmon(id, side, plane, monitor));
576  }
577 
578  //Book validation histograms
579  if (m_harvestingMode) {
580  int MPVbin = 300;
581  float MPVmin = 0.;
582  float MPVmax = 600.;
583 
584  MPV_Vs_EtaTIB = dbe->book2DD("MPV_vs_EtaTIB", "MPV vs Eta TIB", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
585  MPV_Vs_EtaTID = dbe->book2DD("MPV_vs_EtaTID", "MPV vs Eta TID", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
586  MPV_Vs_EtaTOB = dbe->book2DD("MPV_vs_EtaTOB", "MPV vs Eta TOB", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
587  MPV_Vs_EtaTEC = dbe->book2DD("MPV_vs_EtaTEC", "MPV vs Eta TEC", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
588  MPV_Vs_EtaTECthin = dbe->book2DD("MPV_vs_EtaTEC1", "MPV vs Eta TEC-thin", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
589  MPV_Vs_EtaTECthick = dbe->book2DD("MPV_vs_EtaTEC2", "MPV vs Eta TEC-thick", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
590 
591  MPV_Vs_PhiTIB = dbe->book2DD("MPV_vs_PhiTIB", "MPV vs Phi TIB", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
592  MPV_Vs_PhiTID = dbe->book2DD("MPV_vs_PhiTID", "MPV vs Phi TID", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
593  MPV_Vs_PhiTOB = dbe->book2DD("MPV_vs_PhiTOB", "MPV vs Phi TOB", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
594  MPV_Vs_PhiTEC = dbe->book2DD("MPV_vs_PhiTEC", "MPV vs Phi TEC", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
595  MPV_Vs_PhiTECthin = dbe->book2DD("MPV_vs_PhiTEC1", "MPV vs Phi TEC-thin", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
596  MPV_Vs_PhiTECthick = dbe->book2DD("MPV_vs_PhiTEC2", "MPV vs Phi TEC-thick", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
597 
598  NoMPVfit = dbe->book2DD("NoMPVfit", "Modules with bad Landau Fit", 350, -350, 350, 240, 0, 120);
599  NoMPVmasked = dbe->book2DD("NoMPVmasked", "Masked Modules", 350, -350, 350, 240, 0, 120);
600 
601  Gains = dbe->book1DD("Gains", "Gains", 300, 0, 2);
602  MPVs = dbe->book1DD("MPVs", "MPVs", MPVbin, MPVmin, MPVmax);
603  MPVs320 = dbe->book1DD("MPV_320", "MPV 320 thickness", MPVbin, MPVmin, MPVmax);
604  MPVs500 = dbe->book1DD("MPV_500", "MPV 500 thickness", MPVbin, MPVmin, MPVmax);
605  MPVsTIB = dbe->book1DD("MPV_TIB", "MPV TIB", MPVbin, MPVmin, MPVmax);
606  MPVsTID = dbe->book1DD("MPV_TID", "MPV TID", MPVbin, MPVmin, MPVmax);
607  MPVsTIDP = dbe->book1DD("MPV_TIDP", "MPV TIDP", MPVbin, MPVmin, MPVmax);
608  MPVsTIDM = dbe->book1DD("MPV_TIDM", "MPV TIDM", MPVbin, MPVmin, MPVmax);
609  MPVsTOB = dbe->book1DD("MPV_TOB", "MPV TOB", MPVbin, MPVmin, MPVmax);
610  MPVsTEC = dbe->book1DD("MPV_TEC", "MPV TEC", MPVbin, MPVmin, MPVmax);
611  MPVsTECP = dbe->book1DD("MPV_TECP", "MPV TECP", MPVbin, MPVmin, MPVmax);
612  MPVsTECM = dbe->book1DD("MPV_TECM", "MPV TECM", MPVbin, MPVmin, MPVmax);
613  MPVsTECthin = dbe->book1DD("MPV_TEC1", "MPV TEC1", MPVbin, MPVmin, MPVmax);
614  MPVsTECthick = dbe->book1DD("MPV_TEC2", "MPV TEC2", MPVbin, MPVmin, MPVmax);
615  MPVsTECP1 = dbe->book1DD("MPV_TECP1", "MPV TECP1", MPVbin, MPVmin, MPVmax);
616  MPVsTECP2 = dbe->book1DD("MPV_TECP2", "MPV TECP2", MPVbin, MPVmin, MPVmax);
617  MPVsTECM1 = dbe->book1DD("MPV_TECM1", "MPV TECM1", MPVbin, MPVmin, MPVmax);
618  MPVsTECM2 = dbe->book1DD("MPV_TECM2", "MPV TECM2", MPVbin, MPVmin, MPVmax);
619 
620  MPVError = dbe->book1DD("MPVError", "MPV Error", 150, 0, 150);
621  MPVErrorVsMPV = dbe->book2DD("MPVErrorVsMPV", "MPV Error vs MPV", 300, 0, 600, 150, 0, 150);
622  MPVErrorVsEta = dbe->book2DD("MPVErrorVsEta", "MPV Error vs Eta", 50, -3.0, 3.0, 150, 0, 150);
623  MPVErrorVsPhi = dbe->book2DD("MPVErrorVsPhi", "MPV Error vs Phi", 50, -3.4, 3.4, 150, 0, 150);
624  MPVErrorVsN = dbe->book2DD("MPVErrorVsN", "MPV Error vs N", 500, 0, 1000, 150, 0, 150);
625 
626  DiffWRTPrevGainTIB = dbe->book1DD("DiffWRTPrevGainTIB", "Diff w.r.t. PrevGain TIB", 250, 0, 2);
627  DiffWRTPrevGainTID = dbe->book1DD("DiffWRTPrevGainTID", "Diff w.r.t. PrevGain TID", 250, 0, 2);
628  DiffWRTPrevGainTOB = dbe->book1DD("DiffWRTPrevGainTOB", "Diff w.r.t. PrevGain TOB", 250, 0, 2);
629  DiffWRTPrevGainTEC = dbe->book1DD("DiffWRTPrevGainTEC", "Diff w.r.t. PrevGain TEC", 250, 0, 2);
630 
631  GainVsPrevGainTIB = dbe->book2DD("GainVsPrevGainTIB", "Gain vs PrevGain TIB", 100, 0, 2, 100, 0, 2);
632  GainVsPrevGainTID = dbe->book2DD("GainVsPrevGainTID", "Gain vs PrevGain TID", 100, 0, 2, 100, 0, 2);
633  GainVsPrevGainTOB = dbe->book2DD("GainVsPrevGainTOB", "Gain vs PrevGain TOB", 100, 0, 2, 100, 0, 2);
634  GainVsPrevGainTEC = dbe->book2DD("GainVsPrevGainTEC", "Gain vs PrevGain TEC", 100, 0, 2, 100, 0, 2);
635 
636  std::vector<std::pair<std::string, std::string>> hnames =
638  for (unsigned int i = 0; i < hnames.size(); i++) {
639  MonitorElement* monitor = dbe->book1DD((hnames[i]).first.c_str(), (hnames[i]).second.c_str(), 100, 0., 1000.);
640  int id = APVGain::subdetectorId((hnames[i]).first);
641  int side = APVGain::subdetectorSide((hnames[i]).first);
642  int plane = APVGain::subdetectorPlane((hnames[i]).first);
643  newCharge.push_back(APVGain::APVmon(id, side, plane, monitor));
644  }
645  }
646 }
647 
649  edm::LogInfo("SiStripGainFromCalibTree") << "AlgoMode : " << AlgoMode << "\n"
650  << "CalibrationMode : " << m_calibrationMode << "\n"
651  << "HarvestingMode : " << m_harvestingMode << std::endl;
652  //Setup DQM histograms
653  if (AlgoMode != "PCL" or m_harvestingMode) {
654  const char* dqm_dir = "AlCaReco/SiStripGainsHarvesting/";
655  this->bookDQMHistos(dqm_dir, dqm_tag_[statCollectionFromMode(m_calibrationMode.c_str())].c_str());
656  } else {
657  //Check consistency of calibration Mode and BField only for the ALCAPROMPT in the PCL workflow
658  if (!isBFieldConsistentWithMode(iSetup)) {
659  string prevMode = m_calibrationMode;
660  swapBFieldMode();
661  edm::LogInfo("SiStripGainFromCalibTree") << "Switching calibration mode for endorsing BField status: " << prevMode
662  << " ==> " << m_calibrationMode << std::endl;
663  }
664  std::string dqm_dir = m_DQMdir + ((m_splitDQMstat) ? m_calibrationMode : "") + "/";
665  int elem = statCollectionFromMode(m_calibrationMode.c_str());
666  this->bookDQMHistos(dqm_dir.c_str(), dqm_tag_[elem].c_str());
667  }
668 
670  iSetup.get<TrackerTopologyRcd>().get(TopoHandle);
671  tTopo_ = TopoHandle.product();
672 
674  iSetup.get<TrackerDigiGeometryRecord>().get(tkGeom);
675  auto const& Det = tkGeom->dets();
676 
677  NPixelDets = 0;
678  NStripAPVs = 0;
679  unsigned int Index = 0;
680  for (unsigned int i = 0; i < Det.size(); i++) {
681  DetId Detid = Det[i]->geographicalId();
682  int SubDet = Detid.subdetId();
683 
686  auto DetUnit = dynamic_cast<const StripGeomDetUnit*>(Det[i]);
687  if (!DetUnit)
688  continue;
689 
690  const StripTopology& Topo = DetUnit->specificTopology();
691  unsigned int NAPV = Topo.nstrips() / 128;
692 
693  for (unsigned int j = 0; j < NAPV; j++) {
694  stAPVGain* APV = new stAPVGain;
695  APV->Index = Index;
696  APV->Bin = -1;
697  APV->DetId = Detid.rawId();
698  APV->APVId = j;
699  APV->SubDet = SubDet;
700  APV->FitMPV = -1;
701  APV->FitMPVErr = -1;
702  APV->FitWidth = -1;
703  APV->FitWidthErr = -1;
704  APV->FitChi2 = -1;
705  APV->FitNorm = -1;
706  APV->Gain = -1;
707  APV->PreviousGain = 1;
708  APV->PreviousGainTick = 1;
709  APV->x = DetUnit->position().basicVector().x();
710  APV->y = DetUnit->position().basicVector().y();
711  APV->z = DetUnit->position().basicVector().z();
712  APV->Eta = DetUnit->position().basicVector().eta();
713  APV->Phi = DetUnit->position().basicVector().phi();
714  APV->R = DetUnit->position().basicVector().transverse();
715  APV->Thickness = DetUnit->surface().bounds().thickness();
716  APV->NEntries = 0;
717  APV->isMasked = false;
718 
719  APVsCollOrdered.push_back(APV);
720  APVsColl[(APV->DetId << 4) | APV->APVId] = APV;
721  Index++;
722  NStripAPVs++;
723  }
724  }
725  }
726 
727  for (unsigned int i = 0; i < Det.size();
728  i++) { //Make two loop such that the Pixel information is added at the end --> make transition simpler
729  DetId Detid = Det[i]->geographicalId();
730  int SubDet = Detid.subdetId();
732  auto DetUnit = dynamic_cast<const PixelGeomDetUnit*>(Det[i]);
733  if (!DetUnit)
734  continue;
735 
736  const PixelTopology& Topo = DetUnit->specificTopology();
737  unsigned int NROCRow = Topo.nrows() / (80.);
738  unsigned int NROCCol = Topo.ncolumns() / (52.);
739 
740  for (unsigned int j = 0; j < NROCRow; j++) {
741  for (unsigned int i = 0; i < NROCCol; i++) {
742  stAPVGain* APV = new stAPVGain;
743  APV->Index = Index;
744  APV->Bin = -1;
745  APV->DetId = Detid.rawId();
746  APV->APVId = (j << 3 | i);
747  APV->SubDet = SubDet;
748  APV->FitMPV = -1;
749  APV->FitMPVErr = -1;
750  APV->FitWidth = -1;
751  APV->FitWidthErr = -1;
752  APV->FitChi2 = -1;
753  APV->Gain = -1;
754  APV->PreviousGain = 1;
755  APV->PreviousGainTick = 1;
756  APV->x = DetUnit->position().basicVector().x();
757  APV->y = DetUnit->position().basicVector().y();
758  APV->z = DetUnit->position().basicVector().z();
759  APV->Eta = DetUnit->position().basicVector().eta();
760  APV->Phi = DetUnit->position().basicVector().phi();
761  APV->R = DetUnit->position().basicVector().transverse();
762  APV->Thickness = DetUnit->surface().bounds().thickness();
763  APV->isMasked = false; //SiPixelQuality_->IsModuleBad(Detid.rawId());
764  APV->NEntries = 0;
765 
766  APVsCollOrdered.push_back(APV);
767  APVsColl[(APV->DetId << 4) | APV->APVId] = APV;
768  Index++;
769  NPixelDets++;
770  }
771  }
772  }
773  }
774 
776 
777  NEvent = 0;
778  NTrack = 0;
779  NClusterStrip = 0;
780  NClusterPixel = 0;
781  SRun = 1 << 31;
782  ERun = 0;
783  GOOD = 0;
784  BAD = 0;
785  MASKED = 0;
786 }
787 
789  edm::ESHandle<RunInfo> runInfo;
790  iSetup.get<RunInfoRcd>().get(runInfo);
791 
792  double average_current = runInfo.product()->m_avg_current;
793  bool isOn = (average_current > MagFieldCurrentTh);
794  bool is0T = (m_calibrationMode.substr(m_calibrationMode.length() - 2) == "0T");
795 
796  return ((isOn && !is0T) || (!isOn && is0T));
797 }
798 
800  if (m_calibrationMode.substr(m_calibrationMode.length() - 2) == "0T") {
801  m_calibrationMode.erase(m_calibrationMode.length() - 2, 2);
802  } else {
803  m_calibrationMode.append("0T");
804  }
805 }
806 
808  if (!m_harvestingMode && AlgoMode == "PCL") {
809  //Check consistency of calibration Mode and BField only for the ALCAPROMPT in the PCL workflow
810  if (!isBFieldConsistentWithMode(iSetup)) {
811  string prevMode = m_calibrationMode;
812  swapBFieldMode();
813  edm::LogInfo("SiStripGainFromCalibTree") << "Switching calibration mode for endorsing BField status: " << prevMode
814  << " ==> " << m_calibrationMode << std::endl;
815  }
816  }
817 
818  edm::ESHandle<SiStripGain> gainHandle;
819  iSetup.get<SiStripGainRcd>().get(gainHandle);
820  if (!gainHandle.isValid()) {
821  edm::LogError("SiStripGainFromCalibTree") << "gainHandle is not valid\n";
822  exit(0);
823  }
824 
825  edm::ESHandle<SiStripQuality> SiStripQuality_;
826  iSetup.get<SiStripQualityRcd>().get(SiStripQuality_);
827 
828  for (unsigned int a = 0; a < APVsCollOrdered.size(); a++) {
830 
831  // MM. 03/03/2017 all of this makes sense only for SiStrip (i.e. get me out of here if I am on a pixel ROC)
833  continue;
834 
835  APV->isMasked = SiStripQuality_->IsApvBad(APV->DetId, APV->APVId);
836  // if(!FirstSetOfConstants){
837 
838  if (gainHandle->getNumberOfTags() != 2) {
839  edm::LogError("SiStripGainFromCalibTree") << "NUMBER OF GAIN TAG IS EXPECTED TO BE 2\n";
840  fflush(stdout);
841  exit(0);
842  };
843  float newPreviousGain = gainHandle->getApvGain(APV->APVId, gainHandle->getRange(APV->DetId, 1), 1);
844  if (APV->PreviousGain != 1 and newPreviousGain != APV->PreviousGain)
845  edm::LogWarning("SiStripGainFromCalibTree") << "WARNING: ParticleGain in the global tag changed\n";
846  APV->PreviousGain = newPreviousGain;
847 
848  float newPreviousGainTick = gainHandle->getApvGain(APV->APVId, gainHandle->getRange(APV->DetId, 0), 0);
849  if (APV->PreviousGainTick != 1 and newPreviousGainTick != APV->PreviousGainTick) {
850  edm::LogWarning("SiStripGainFromCalibTree")
851  << "WARNING: TickMarkGain in the global tag changed\n"
852  << std::endl
853  << " APV->SubDet: " << APV->SubDet << " APV->APVId:" << APV->APVId << std::endl
854  << " APV->PreviousGainTick: " << APV->PreviousGainTick << " newPreviousGainTick: " << newPreviousGainTick
855  << std::endl;
856  }
857  APV->PreviousGainTick = newPreviousGainTick;
858 
859  //printf("DETID = %7i APVID=%1i Previous Gain=%8.4f (G1) x %8.4f (G2)\n",APV->DetId,APV->APVId,APV->PreviousGainTick, APV->PreviousGain);
860  // }
861  }
862 }
863 
865  if (AlgoMode == "PCL" && !m_harvestingMode)
866  return; //nothing to do in that case
867 
868  if (AlgoMode == "PCL" and m_harvestingMode) {
869  // Load the 2D histograms from the DQM objects
870  // When running in AlCaHarvesting mode the histos are already booked and should be just retrieved from
871  // DQMStore so that they can be used in the fit
872 
873  edm::LogInfo("SiStripGainFromCalibTree") << "Starting harvesting statistics" << std::endl;
874 
875  // check the required tag before adding histograms
876  int elepos = statCollectionFromMode(m_calibrationMode.c_str());
877  if (elepos != Harvest) {
878  //collect statistics from DQM into the related monitored elements
880  if (!stag.empty() && stag[0] != '_')
881  stag.insert(0, 1, '_');
882 
883  if (elepos == -1) {
884  //implememt backward compatibility
885  elepos = 0;
886  stag = "";
887  }
888 
889  std::string DQM_dir = m_DQMdir + ((m_splitDQMstat) ? m_calibrationMode : "");
890 
891  std::string cvi = DQM_dir + std::string("/Charge_Vs_Index") + stag;
892  //std::string cviA = DQM_dir + std::string("/Charge_Vs_Index_Absolute") + stag;
893  std::string cvpTIB = DQM_dir + std::string("/Charge_Vs_PathlengthTIB") + stag;
894  std::string cvpTOB = DQM_dir + std::string("/Charge_Vs_PathlengthTOB") + stag;
895  std::string cvpTIDP = DQM_dir + std::string("/Charge_Vs_PathlengthTIDP") + stag;
896  std::string cvpTIDM = DQM_dir + std::string("/Charge_Vs_PathlengthTIDM") + stag;
897  std::string cvpTECP1 = DQM_dir + std::string("/Charge_Vs_PathlengthTECP1") + stag;
898  std::string cvpTECP2 = DQM_dir + std::string("/Charge_Vs_PathlengthTECP2") + stag;
899  std::string cvpTECM1 = DQM_dir + std::string("/Charge_Vs_PathlengthTECM1") + stag;
900  std::string cvpTECM2 = DQM_dir + std::string("/Charge_Vs_PathlengthTECM2") + stag;
901 
902  Charge_Vs_Index[elepos] = dbe->get(cvi);
903  //Charge_Vs_Index_Absolute[elepos] = dbe->get(cviA.c_str());
904  Charge_Vs_PathlengthTIB[elepos] = dbe->get(cvpTIB);
905  Charge_Vs_PathlengthTOB[elepos] = dbe->get(cvpTOB);
906  Charge_Vs_PathlengthTIDP[elepos] = dbe->get(cvpTIDP);
907  Charge_Vs_PathlengthTIDM[elepos] = dbe->get(cvpTIDM);
908  Charge_Vs_PathlengthTECP1[elepos] = dbe->get(cvpTECP1);
909  Charge_Vs_PathlengthTECP2[elepos] = dbe->get(cvpTECP2);
910  Charge_Vs_PathlengthTECM1[elepos] = dbe->get(cvpTECM1);
911  Charge_Vs_PathlengthTECM2[elepos] = dbe->get(cvpTECM2);
912 
913  if (Charge_Vs_Index[elepos] == nullptr) {
914  edm::LogError("SiStripGainFromCalibTree")
915  << "Harvesting: could not retrieve " << cvi.c_str() << ", statistics will not be summed!" << std::endl;
916  } else {
917  merge((Charge_Vs_Index[Harvest])->getTH2S(), (Charge_Vs_Index[elepos])->getTH2S());
918  edm::LogInfo("SiStripGainFromCalibTree")
919  << "Harvesting " << (Charge_Vs_Index[elepos])->getTH2S()->GetEntries() << " more clusters" << std::endl;
920  }
921 
922  //if (Charge_Vs_Index_Absolute[elepos]==0) {
923  // edm::LogError("SiStripGainFromCalibTree") << "Harvesting: could not retrieve " << cviA.c_str()
924  // << ", statistics will not be summed!" << std::endl;
925  //} else merge( (Charge_Vs_Index_Absolute[Harvest])->getTH2S(), (Charge_Vs_Index_Absolute[elepos])->getTH2S() );
926 
927  if (Charge_Vs_PathlengthTIB[elepos] == nullptr) {
928  edm::LogError("SiStripGainFromCalibTree")
929  << "Harvesting: could not retrieve " << cvpTIB.c_str() << ", statistics will not be summed!" << std::endl;
930  } else
931  (Charge_Vs_PathlengthTIB[Harvest])->getTH2S()->Add((Charge_Vs_PathlengthTIB[elepos])->getTH2S());
932 
933  if (Charge_Vs_PathlengthTOB[elepos] == nullptr) {
934  edm::LogError("SiStripGainFromCalibTree")
935  << "Harvesting: could not retrieve " << cvpTOB.c_str() << ", statistics will not be summed!" << std::endl;
936  } else
937  (Charge_Vs_PathlengthTOB[Harvest])->getTH2S()->Add((Charge_Vs_PathlengthTOB[elepos])->getTH2S());
938 
939  if (Charge_Vs_PathlengthTIDP[elepos] == nullptr) {
940  edm::LogError("SiStripGainFromCalibTree")
941  << "Harvesting: could not retrieve " << cvpTIDP.c_str() << ", statistics will not be summed!" << std::endl;
942  } else
943  (Charge_Vs_PathlengthTIDP[Harvest])->getTH2S()->Add((Charge_Vs_PathlengthTIDP[elepos])->getTH2S());
944 
945  if (Charge_Vs_PathlengthTIDM[elepos] == nullptr) {
946  edm::LogError("SiStripGainFromCalibTree")
947  << "Harvesting: could not retrieve " << cvpTIDM.c_str() << ", statistics will not be summed!" << std::endl;
948  } else
949  (Charge_Vs_PathlengthTIDM[Harvest])->getTH2S()->Add((Charge_Vs_PathlengthTIDM[elepos])->getTH2S());
950 
951  if (Charge_Vs_PathlengthTECP1[elepos] == nullptr) {
952  edm::LogError("SiStripGainFromCalibTree")
953  << "Harvesting: could not retrieve " << cvpTECP1.c_str() << ", statistics will not be summed!" << std::endl;
954  } else
955  (Charge_Vs_PathlengthTECP1[Harvest])->getTH2S()->Add((Charge_Vs_PathlengthTECP1[elepos])->getTH2S());
956 
957  if (Charge_Vs_PathlengthTECP2[elepos] == nullptr) {
958  edm::LogError("SiStripGainFromCalibTree")
959  << "Harvesting: could not retrieve " << cvpTECP2.c_str() << ", statistics will not be summed!" << std::endl;
960  } else
961  (Charge_Vs_PathlengthTECP2[Harvest])->getTH2S()->Add((Charge_Vs_PathlengthTECP2[elepos])->getTH2S());
962 
963  if (Charge_Vs_PathlengthTECM1[elepos] == nullptr) {
964  edm::LogError("SiStripGainFromCalibTree")
965  << "Harvesting: could not retrieve " << cvpTECM1.c_str() << ", statistics will not be summed!" << std::endl;
966  } else
967  (Charge_Vs_PathlengthTECM1[Harvest])->getTH2S()->Add((Charge_Vs_PathlengthTECM1[elepos])->getTH2S());
968 
969  if (Charge_Vs_PathlengthTECM2[elepos] == nullptr) {
970  edm::LogError("SiStripGainFromCalibTree")
971  << "Harvesting: could not retrieve " << cvpTECM2.c_str() << ", statistics will not be summed!" << std::endl;
972  } else
973  (Charge_Vs_PathlengthTECM2[Harvest])->getTH2S()->Add((Charge_Vs_PathlengthTECM2[elepos])->getTH2S());
974 
975  // Gather Charge monitoring histograms
976  std::vector<std::pair<std::string, std::string>> tags =
978  for (unsigned int i = 0; i < tags.size(); i++) {
979  std::string tag = DQM_dir + "/" + (tags[i]).first + stag;
980  Charge_1[elepos].push_back(APVGain::APVmon(0, 0, 0, dbe->get(tag)));
981  if ((Charge_1[elepos][i]).getMonitor() == nullptr) {
982  edm::LogError("SiStripGainFromCalibTree")
983  << "Harvesting: could not retrieve " << tag.c_str() << ", statistics will not be summed!" << std::endl;
984  } else
985  (Charge_1[Harvest][i]).getMonitor()->getTH1D()->Add((Charge_1[elepos][i]).getMonitor()->getTH1D());
986  }
987 
989  for (unsigned int i = 0; i < tags.size(); i++) {
990  std::string tag = DQM_dir + "/" + (tags[i]).first + stag;
991  Charge_2[elepos].push_back(APVGain::APVmon(0, 0, 0, dbe->get(tag)));
992  if ((Charge_2[elepos][i]).getMonitor() == nullptr) {
993  edm::LogError("SiStripGainFromCalibTree")
994  << "Harvesting: could not retrieve " << tag.c_str() << ", statistics will not be summed!" << std::endl;
995  } else
996  (Charge_2[Harvest][i]).getMonitor()->getTH1D()->Add((Charge_2[elepos][i]).getMonitor()->getTH1D());
997  }
998 
1000  for (unsigned int i = 0; i < tags.size(); i++) {
1001  std::string tag = DQM_dir + "/" + (tags[i]).first + stag;
1002  Charge_3[elepos].push_back(APVGain::APVmon(0, 0, 0, dbe->get(tag)));
1003  if ((Charge_3[elepos][i]).getMonitor() == nullptr) {
1004  edm::LogError("SiStripGainFromCalibTree")
1005  << "Harvesting: could not retrieve " << tag.c_str() << ", statistics will not be summed!" << std::endl;
1006  } else
1007  (Charge_3[Harvest][i]).getMonitor()->getTH1D()->Add((Charge_3[elepos][i]).getMonitor()->getTH1D());
1008  }
1009 
1011  for (unsigned int i = 0; i < tags.size(); i++) {
1012  std::string tag = DQM_dir + "/" + (tags[i]).first + stag;
1013  Charge_4[elepos].push_back(APVGain::APVmon(0, 0, 0, dbe->get(tag)));
1014  if ((Charge_4[elepos][i]).getMonitor() == nullptr) {
1015  edm::LogError("SiStripGainFromCalibTree")
1016  << "Harvesting: could not retrieve " << tag.c_str() << ", statistics will not be summed!" << std::endl;
1017  } else
1018  (Charge_4[Harvest][i]).getMonitor()->getTH1D()->Add((Charge_4[elepos][i]).getMonitor()->getTH1D());
1019  }
1020  }
1021  }
1022 }
1023 
1025  if (AlgoMode == "PCL" && !m_harvestingMode)
1026  return; //nothing to do in that case
1027 
1028  if (AlgoMode == "CalibTree") {
1029  edm::LogInfo("SiStripGainFromCalibTree") << "Analyzing calibration tree" << std::endl;
1030  // Loop on calibTrees to fill the 2D histograms
1032  } else if (m_harvestingMode) {
1033  NClusterStrip = (Charge_Vs_Index[Harvest])->getTH2S()->Integral(0, NStripAPVs + 1, 0, 99999);
1034  //NClusterPixel = (Charge_Vs_Index[Harvest])->getTH2S()->Integral(NStripAPVs+2, NStripAPVs+NPixelDets+2, 0, 99999 );
1035  }
1036 
1037  // Now that we have the full statistics we can extract the information of the 2D histograms
1039 
1040  // Result monitoring
1041  qualityMonitor();
1042 
1043  // Force the DB object writing,
1044  // thus setting the IOV as the first processed run (if timeFromEndRun is set to false)
1045  storeOnDbNow();
1046 
1047  if (AlgoMode != "PCL" or saveSummary) {
1048  edm::LogInfo("SiStripGainFromCalibTree") << "Saving summary into root file" << std::endl;
1049 
1050  //also save the 2D monitor elements to this file as TH2D tfs
1051  tfs = edm::Service<TFileService>().operator->();
1052 
1053  //save only the statistics for the calibrationTag
1054  int elepos = statCollectionFromMode(m_calibrationMode.c_str());
1055 
1056  if (Charge_Vs_Index[elepos] != nullptr)
1057  tfs->make<TH2S>(*(Charge_Vs_Index[elepos])->getTH2S());
1058  //if( Charge_Vs_Index_Absolute[elepos]!=0 ) tfs->make<TH2S> ( *(Charge_Vs_Index_Absolute[elepos])->getTH2S() );
1059  if (Charge_Vs_PathlengthTIB[elepos] != nullptr)
1060  tfs->make<TH2S>(*(Charge_Vs_PathlengthTIB[elepos])->getTH2S());
1061  if (Charge_Vs_PathlengthTOB[elepos] != nullptr)
1062  tfs->make<TH2S>(*(Charge_Vs_PathlengthTOB[elepos])->getTH2S());
1063  if (Charge_Vs_PathlengthTIDP[elepos] != nullptr)
1064  tfs->make<TH2S>(*(Charge_Vs_PathlengthTIDP[elepos])->getTH2S());
1065  if (Charge_Vs_PathlengthTIDM[elepos] != nullptr)
1066  tfs->make<TH2S>(*(Charge_Vs_PathlengthTIDM[elepos])->getTH2S());
1067  if (Charge_Vs_PathlengthTECP1[elepos] != nullptr)
1068  tfs->make<TH2S>(*(Charge_Vs_PathlengthTECP1[elepos])->getTH2S());
1069  if (Charge_Vs_PathlengthTECP2[elepos] != nullptr)
1070  tfs->make<TH2S>(*(Charge_Vs_PathlengthTECP2[elepos])->getTH2S());
1071  if (Charge_Vs_PathlengthTECM1[elepos] != nullptr)
1072  tfs->make<TH2S>(*(Charge_Vs_PathlengthTECM1[elepos])->getTH2S());
1073  if (Charge_Vs_PathlengthTECM2[elepos] != nullptr)
1074  tfs->make<TH2S>(*(Charge_Vs_PathlengthTECM2[elepos])->getTH2S());
1075 
1076  storeOnTree(tfs);
1077  }
1078 }
1079 
1080 void SiStripGainFromCalibTree::getPeakOfLandau(TH1* InputHisto, double* FitResults, double LowRange, double HighRange) {
1081  FitResults[0] = -0.5; //MPV
1082  FitResults[1] = 0; //MPV error
1083  FitResults[2] = -0.5; //Width
1084  FitResults[3] = 0; //Width error
1085  FitResults[4] = -0.5; //Fit Chi2/NDF
1086  FitResults[5] = 0; //Normalization
1087 
1088  if (InputHisto->GetEntries() < MinNrEntries)
1089  return;
1090 
1091  // perform fit with standard landau
1092  TF1* MyLandau = new TF1("MyLandau", "landau", LowRange, HighRange);
1093  MyLandau->SetParameter(1, 300);
1094  InputHisto->Fit(MyLandau, "0QR WW");
1095 
1096  // MPV is parameter 1 (0=constant, 1=MPV, 2=Sigma)
1097  FitResults[0] = MyLandau->GetParameter(1); //MPV
1098  FitResults[1] = MyLandau->GetParError(1); //MPV error
1099  FitResults[2] = MyLandau->GetParameter(2); //Width
1100  FitResults[3] = MyLandau->GetParError(2); //Width error
1101  FitResults[4] = MyLandau->GetChisquare() / MyLandau->GetNDF(); //Fit Chi2/NDF
1102  FitResults[5] = MyLandau->GetParameter(0);
1103 
1104  delete MyLandau;
1105 }
1106 
1108  if (FitResults[0] <= 0)
1109  return false;
1110  // if(FitResults[1] > MaxMPVError )return false;
1111  // if(FitResults[4] > MaxChi2OverNDF)return false;
1112  return true;
1113 }
1114 
1116  edm::LogInfo("SiStripGainFromCalibTree") << "Processing run " << runnumber << " and event " << eventnumber << " for "
1117  << m_calibrationMode << " calibration." << std::endl;
1118 
1119  if (runnumber < SRun)
1120  SRun = runnumber;
1121  if (runnumber > ERun)
1122  ERun = runnumber;
1123 
1124  NEvent++;
1125  NTrack += (*trackp).size();
1126 
1127  int elepos = statCollectionFromMode(m_calibrationMode.c_str());
1128 
1129  unsigned int FirstAmplitude = 0;
1130  for (unsigned int i = 0; i < (*chargeoverpath).size(); i++) {
1131  FirstAmplitude += (*nstrips)[i];
1132  int TI = (*trackindex)[i];
1133 
1134  //printf("%i - %i - %i %i %i\n", (int)(*rawid)[i], (int)(*firststrip)[i]/128, (int)(*farfromedge)[i], (int)(*overlapping)[i], (int)(*saturation )[i] );
1135  if ((*tracketa)[TI] < MinTrackEta)
1136  continue;
1137  if ((*tracketa)[TI] > MaxTrackEta)
1138  continue;
1139  if ((*trackp)[TI] < MinTrackMomentum)
1140  continue;
1141  if ((*trackp)[TI] > MaxTrackMomentum)
1142  continue;
1143  if ((*trackhitsvalid)[TI] < MinTrackHits)
1144  continue;
1145  if ((*trackchi2ndof)[TI] > MaxTrackChiOverNdf)
1146  continue;
1147  if ((*trackalgo)[TI] > MaxTrackingIteration)
1148  continue;
1149 
1150  stAPVGain* APV =
1151  APVsColl[((*rawid)[i] << 4) |
1152  ((*firststrip)[i] /
1153  128)]; //works for both strip and pixel thanks to firstStrip encoding for pixel in the calibTree
1154 
1155  if (APV->SubDet > 2 && (*farfromedge)[i] == false)
1156  continue;
1157  if (APV->SubDet > 2 && (*overlapping)[i] == true)
1158  continue;
1159  if (APV->SubDet > 2 && (*saturation)[i] && !AllowSaturation)
1160  continue;
1161  if (APV->SubDet > 2 && (*nstrips)[i] > MaxNrStrips)
1162  continue;
1163 
1164  //printf("detId=%7i run=%7i event=%9i charge=%5i cs=%3i\n",(*rawid)[i],runnumber,eventnumber,(*charge)[i],(*nstrips)[i]);
1165 
1166  //double trans = atan2((*localdiry)[i],(*localdirx)[i])*(180/3.14159265);
1167  //double alpha = acos ((*localdirx)[i] / sqrt( pow((*localdirx)[i],2) + pow((*localdirz)[i],2) ) ) * (180/3.14159265);
1168  //double beta = acos ((*localdiry)[i] / sqrt( pow((*localdirx)[i],2) + pow((*localdirz)[i],2) ) ) * (180/3.14159265);
1169 
1170  //printf("NStrip = %i : Charge = %i --> Path = %f --> ChargeOverPath=%f\n",(*nstrips)[i],(*charge)[i],(*path)[i],(*chargeoverpath)[i]);
1171  //printf("Amplitudes: ");
1172  //for(unsigned int a=0;a<(*nstrips)[i];a++){printf("%i ",(*amplitude)[FirstAmplitude+a]);}
1173  //printf("\n");
1174 
1175  if (APV->SubDet > 2) {
1176  NClusterStrip++;
1177  } else {
1178  NClusterPixel++;
1179  }
1180 
1181  int Charge = 0;
1182  if (APV->SubDet > 2 && (useCalibration || !FirstSetOfConstants)) {
1183  bool Saturation = false;
1184  for (unsigned int s = 0; s < (*nstrips)[i]; s++) {
1185  int StripCharge = (*amplitude)[FirstAmplitude - (*nstrips)[i] + s];
1187  StripCharge = (int)(StripCharge * (APV->PreviousGain / APV->CalibGain));
1188  } else if (useCalibration) {
1189  StripCharge = (int)(StripCharge / APV->CalibGain);
1190  } else if (!FirstSetOfConstants) {
1191  StripCharge = (int)(StripCharge * APV->PreviousGain);
1192  }
1193  if (StripCharge > 1024) {
1194  StripCharge = 255;
1195  Saturation = true;
1196  } else if (StripCharge > 254) {
1197  StripCharge = 254;
1198  Saturation = true;
1199  }
1200  Charge += StripCharge;
1201  }
1202  if (Saturation && !AllowSaturation)
1203  continue;
1204  } else if (APV->SubDet > 2) {
1205  Charge = (*charge)[i];
1206  } else {
1207  Charge = (*charge)[i] / 265.0; //expected scale factor between pixel and strip charge
1208  }
1209 
1210  //printf("ChargeDifference = %i Vs %i with Gain = %f\n",(*charge)[i],Charge,APV->CalibGain);
1211 
1212  double ClusterChargeOverPath = ((double)Charge) / (*path)[i];
1213  if (APV->SubDet > 2) {
1214  if (Validation) {
1215  ClusterChargeOverPath /= (*gainused)[i];
1216  }
1217  if (OldGainRemoving) {
1218  ClusterChargeOverPath *= (*gainused)[i];
1219  }
1220  }
1221 
1222  // keep pixel cluster charge processing until here
1223  if (APV->SubDet <= 2)
1224  continue;
1225 
1226  (Charge_Vs_Index[elepos])->Fill(APV->Index, ClusterChargeOverPath);
1227 
1228  // Compute the charge for monitoring and fill the relative histograms
1229  int mCharge1 = 0;
1230  int mCharge2 = 0;
1231  int mCharge3 = 0;
1232  int mCharge4 = 0;
1233  if (APV->SubDet > 2) {
1234  for (unsigned int s = 0; s < (*nstrips)[i]; s++) {
1235  int StripCharge = (*amplitude)[FirstAmplitude - (*nstrips)[i] + s];
1236  if (StripCharge > 1024)
1237  StripCharge = 255;
1238  else if (StripCharge > 254)
1239  StripCharge = 254;
1240  mCharge1 += StripCharge;
1241  mCharge2 += StripCharge;
1242  mCharge3 += StripCharge;
1243  mCharge4 += StripCharge;
1244  }
1245  // Revome gains for monitoring
1246  mCharge2 *= (*gainused)[i]; // remove G2
1247  mCharge3 *= (*gainusedTick)[i]; // remove G1
1248  mCharge4 *= ((*gainused)[i] * (*gainusedTick)[i]); // remove G1 and G2
1249  }
1250  std::vector<APVGain::APVmon>& v1 = Charge_1[elepos];
1251  std::vector<MonitorElement*> cmon1 = APVGain::FetchMonitor(v1, (*rawid)[i], tTopo_);
1252  for (unsigned int m = 0; m < cmon1.size(); m++)
1253  cmon1[m]->Fill(((double)mCharge1) / (*path)[i]);
1254 
1255  std::vector<APVGain::APVmon>& v2 = Charge_2[elepos];
1256  std::vector<MonitorElement*> cmon2 = APVGain::FetchMonitor(v2, (*rawid)[i], tTopo_);
1257  for (unsigned int m = 0; m < cmon2.size(); m++)
1258  cmon2[m]->Fill(((double)mCharge2) / (*path)[i]);
1259 
1260  std::vector<APVGain::APVmon>& v3 = Charge_3[elepos];
1261  std::vector<MonitorElement*> cmon3 = APVGain::FetchMonitor(v3, (*rawid)[i], tTopo_);
1262  for (unsigned int m = 0; m < cmon3.size(); m++)
1263  cmon3[m]->Fill(((double)mCharge3) / (*path)[i]);
1264 
1265  std::vector<APVGain::APVmon>& v4 = Charge_4[elepos];
1266  std::vector<MonitorElement*> cmon4 = APVGain::FetchMonitor(v4, (*rawid)[i], tTopo_);
1267  for (unsigned int m = 0; m < cmon4.size(); m++)
1268  cmon4[m]->Fill(((double)mCharge4) / (*path)[i]);
1269 
1270  // Fill Charge Vs pathLenght histograms
1271  if (APV->SubDet == StripSubdetector::TIB) {
1272  (Charge_Vs_PathlengthTIB[elepos])->Fill((*path)[i], Charge); // TIB
1273 
1274  } else if (APV->SubDet == StripSubdetector::TOB) {
1275  (Charge_Vs_PathlengthTOB[elepos])->Fill((*path)[i], Charge); // TOB
1276 
1277  } else if (APV->SubDet == StripSubdetector::TID) {
1278  if (APV->Eta < 0) {
1279  (Charge_Vs_PathlengthTIDM[elepos])->Fill((*path)[i], Charge);
1280  } // TID minus
1281  else if (APV->Eta > 0) {
1282  (Charge_Vs_PathlengthTIDP[elepos])->Fill((*path)[i], Charge);
1283  } // TID plus
1284 
1285  } else if (APV->SubDet == StripSubdetector::TEC) {
1286  if (APV->Eta < 0) {
1287  if (APV->Thickness < 0.04) {
1288  (Charge_Vs_PathlengthTECM1[elepos])->Fill((*path)[i], Charge);
1289  } // TEC minus, type 1
1290  else if (APV->Thickness > 0.04) {
1291  (Charge_Vs_PathlengthTECM2[elepos])->Fill((*path)[i], Charge);
1292  } // TEC minus, type 2
1293  } else if (APV->Eta > 0) {
1294  if (APV->Thickness < 0.04) {
1295  (Charge_Vs_PathlengthTECP1[elepos])->Fill((*path)[i], Charge);
1296  } // TEC plus, type 1
1297  else if (APV->Thickness > 0.04) {
1298  (Charge_Vs_PathlengthTECP2[elepos])->Fill((*path)[i], Charge);
1299  } // TEC plus, type 2
1300  }
1301  }
1302 
1303  } // END OF ON-CLUSTER LOOP
1304 } //END OF processEvent()
1305 
1307  for (unsigned int i = 0; i < VInputFiles.size(); i++) {
1308  printf("Openning file %3i/%3i --> %s\n", i + 1, (int)VInputFiles.size(), (char*)(VInputFiles[i].c_str()));
1309  fflush(stdout);
1310  TFile* tfile = TFile::Open(VInputFiles[i].c_str());
1311  TString tree_path = TString::Format("gainCalibrationTree%s/tree", m_calibrationMode.c_str());
1312  TTree* tree = dynamic_cast<TTree*>(tfile->Get(tree_path.Data()));
1313 
1314  tree->SetBranchAddress((EventPrefix_ + "event" + EventSuffix_).c_str(), &eventnumber, nullptr);
1315  tree->SetBranchAddress((EventPrefix_ + "run" + EventSuffix_).c_str(), &runnumber, nullptr);
1316  tree->SetBranchAddress((EventPrefix_ + "TrigTech" + EventSuffix_).c_str(), &TrigTech, nullptr);
1317 
1318  tree->SetBranchAddress((TrackPrefix_ + "chi2ndof" + TrackSuffix_).c_str(), &trackchi2ndof, nullptr);
1319  tree->SetBranchAddress((TrackPrefix_ + "momentum" + TrackSuffix_).c_str(), &trackp, nullptr);
1320  tree->SetBranchAddress((TrackPrefix_ + "pt" + TrackSuffix_).c_str(), &trackpt, nullptr);
1321  tree->SetBranchAddress((TrackPrefix_ + "eta" + TrackSuffix_).c_str(), &tracketa, nullptr);
1322  tree->SetBranchAddress((TrackPrefix_ + "phi" + TrackSuffix_).c_str(), &trackphi, nullptr);
1323  tree->SetBranchAddress((TrackPrefix_ + "hitsvalid" + TrackSuffix_).c_str(), &trackhitsvalid, nullptr);
1324  tree->SetBranchAddress((TrackPrefix_ + "algo" + TrackSuffix_).c_str(), &trackalgo, nullptr);
1325 
1326  tree->SetBranchAddress((CalibPrefix_ + "trackindex" + CalibSuffix_).c_str(), &trackindex, nullptr);
1327  tree->SetBranchAddress((CalibPrefix_ + "rawid" + CalibSuffix_).c_str(), &rawid, nullptr);
1328  tree->SetBranchAddress((CalibPrefix_ + "localdirx" + CalibSuffix_).c_str(), &localdirx, nullptr);
1329  tree->SetBranchAddress((CalibPrefix_ + "localdiry" + CalibSuffix_).c_str(), &localdiry, nullptr);
1330  tree->SetBranchAddress((CalibPrefix_ + "localdirz" + CalibSuffix_).c_str(), &localdirz, nullptr);
1331  tree->SetBranchAddress((CalibPrefix_ + "firststrip" + CalibSuffix_).c_str(), &firststrip, nullptr);
1332  tree->SetBranchAddress((CalibPrefix_ + "nstrips" + CalibSuffix_).c_str(), &nstrips, nullptr);
1333  tree->SetBranchAddress((CalibPrefix_ + "saturation" + CalibSuffix_).c_str(), &saturation, nullptr);
1334  tree->SetBranchAddress((CalibPrefix_ + "overlapping" + CalibSuffix_).c_str(), &overlapping, nullptr);
1335  tree->SetBranchAddress((CalibPrefix_ + "farfromedge" + CalibSuffix_).c_str(), &farfromedge, nullptr);
1336  tree->SetBranchAddress((CalibPrefix_ + "charge" + CalibSuffix_).c_str(), &charge, nullptr);
1337  tree->SetBranchAddress((CalibPrefix_ + "path" + CalibSuffix_).c_str(), &path, nullptr);
1338  tree->SetBranchAddress((CalibPrefix_ + "chargeoverpath" + CalibSuffix_).c_str(), &chargeoverpath, nullptr);
1339  tree->SetBranchAddress((CalibPrefix_ + "amplitude" + CalibSuffix_).c_str(), &amplitude, nullptr);
1340  tree->SetBranchAddress((CalibPrefix_ + "gainused" + CalibSuffix_).c_str(), &gainused, nullptr);
1341  tree->SetBranchAddress((CalibPrefix_ + "gainusedTick" + CalibSuffix_).c_str(), &gainusedTick, nullptr);
1342 
1343  unsigned int nentries = tree->GetEntries();
1344  printf("Number of Events = %i + %i = %i\n", NEvent, nentries, (NEvent + nentries));
1345  printf("Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
1346  printf("Looping on the Tree :");
1347  int TreeStep = nentries / 50;
1348  if (TreeStep <= 1)
1349  TreeStep = 1;
1350  for (unsigned int ientry = 0; ientry < tree->GetEntries(); ientry++) {
1351  if (ientry % TreeStep == 0) {
1352  printf(".");
1353  fflush(stdout);
1354  }
1355  tree->GetEntry(ientry);
1356  processEvent();
1357  }
1358  printf("\n"); // END OF EVENT LOOP
1359  }
1360 }
1361 
1363  unsigned int I = 0;
1364  TH1F* Proj = nullptr;
1365  double FitResults[6];
1366  double MPVmean = 300;
1367 
1368  int elepos = (AlgoMode == "PCL") ? Harvest : statCollectionFromMode(m_calibrationMode.c_str());
1369 
1370  if (Charge_Vs_Index[elepos] == nullptr) {
1371  edm::LogError("SiStripGainFromCalibTree")
1372  << "Harvesting: could not execute algoComputeMPVandGain method because " << m_calibrationMode.c_str()
1373  << " statistics cannot be retrieved.\n"
1374  << "Please check if input contains " << m_calibrationMode.c_str() << " data." << std::endl;
1375  return;
1376  }
1377 
1378  TH2S* chvsidx = (Charge_Vs_Index[elepos])->getTH2S();
1379 
1380  printf("Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
1381  printf("Fitting Charge Distribution :");
1382  int TreeStep = APVsColl.size() / 50;
1383  for (auto it = APVsColl.begin(); it != APVsColl.end(); it++, I++) {
1384  if (I % TreeStep == 0) {
1385  printf(".");
1386  fflush(stdout);
1387  }
1388  stAPVGain* APV = it->second;
1389  if (APV->Bin < 0)
1390  APV->Bin = chvsidx->GetXaxis()->FindBin(APV->Index);
1391 
1392  if (APV->isMasked) {
1393  APV->Gain = APV->PreviousGain;
1394  MASKED++;
1395  continue;
1396  }
1397 
1398  Proj = (TH1F*)(chvsidx->ProjectionY(
1399  "", chvsidx->GetXaxis()->FindBin(APV->Index), chvsidx->GetXaxis()->FindBin(APV->Index), "e"));
1400  if (!Proj)
1401  continue;
1402 
1403  if (CalibrationLevel == 0) {
1404  } else if (CalibrationLevel == 1) {
1405  int SecondAPVId = APV->APVId;
1406  if (SecondAPVId % 2 == 0) {
1407  SecondAPVId = SecondAPVId + 1;
1408  } else {
1409  SecondAPVId = SecondAPVId - 1;
1410  }
1411  stAPVGain* APV2 = APVsColl[(APV->DetId << 4) | SecondAPVId];
1412  if (APV2->Bin < 0)
1413  APV2->Bin = chvsidx->GetXaxis()->FindBin(APV2->Index);
1414  TH1F* Proj2 = (TH1F*)(chvsidx->ProjectionY("", APV2->Bin, APV2->Bin, "e"));
1415  if (Proj2) {
1416  Proj->Add(Proj2, 1);
1417  delete Proj2;
1418  }
1419  } else if (CalibrationLevel == 2) {
1420  for (unsigned int i = 0; i < 16; i++) { //loop up to 6APV for Strip and up to 16 for Pixels
1421  auto tmpit = APVsColl.find((APV->DetId << 4) | i);
1422  if (tmpit == APVsColl.end())
1423  continue;
1424  stAPVGain* APV2 = tmpit->second;
1425  if (APV2->DetId != APV->DetId || APV2->APVId == APV->APVId)
1426  continue;
1427  if (APV2->Bin < 0)
1428  APV2->Bin = chvsidx->GetXaxis()->FindBin(APV2->Index);
1429  TH1F* Proj2 = (TH1F*)(chvsidx->ProjectionY("", APV2->Bin, APV2->Bin, "e"));
1430  if (Proj2) {
1431  Proj->Add(Proj2, 1);
1432  delete Proj2;
1433  }
1434  }
1435  } else {
1436  CalibrationLevel = 0;
1437  printf("Unknown Calibration Level, will assume %i\n", CalibrationLevel);
1438  }
1439 
1440  getPeakOfLandau(Proj, FitResults);
1441  APV->FitMPV = FitResults[0];
1442  APV->FitMPVErr = FitResults[1];
1443  APV->FitWidth = FitResults[2];
1444  APV->FitWidthErr = FitResults[3];
1445  APV->FitChi2 = FitResults[4];
1446  APV->FitNorm = FitResults[5];
1447  APV->NEntries = Proj->GetEntries();
1448 
1449  if (IsGoodLandauFit(FitResults)) {
1450  APV->Gain = APV->FitMPV / MPVmean;
1451  if (APV->SubDet > 2)
1452  GOOD++;
1453  } else {
1454  APV->Gain = APV->PreviousGain;
1455  if (APV->SubDet > 2)
1456  BAD++;
1457  }
1458  if (APV->Gain <= 0)
1459  APV->Gain = 1;
1460 
1461  //printf("%5i/%5i: %6i - %1i %5E Entries --> MPV = %f +- %f\n",I,APVsColl.size(),APV->DetId, APV->APVId, Proj->GetEntries(), FitResults[0], FitResults[1]);fflush(stdout);
1462  delete Proj;
1463  }
1464  printf("\n");
1465 }
1466 
1468  int elepos = (AlgoMode == "PCL") ? Harvest : statCollectionFromMode(m_calibrationMode.c_str());
1469 
1470  for (unsigned int a = 0; a < APVsCollOrdered.size(); a++) {
1472  if (APV == nullptr)
1473  continue;
1474 
1475  unsigned int Index = APV->Index;
1476  unsigned int SubDet = APV->SubDet;
1477  unsigned int DetId = APV->DetId;
1478  float z = APV->z;
1479  float Eta = APV->Eta;
1480  float R = APV->R;
1481  float Phi = APV->Phi;
1482  float Thickness = APV->Thickness;
1483  double FitMPV = APV->FitMPV;
1484  double FitMPVErr = APV->FitMPVErr;
1485  double Gain = APV->Gain;
1486  double NEntries = APV->NEntries;
1487  double PreviousGain = APV->PreviousGain;
1488 
1489  if (SubDet < 3)
1490  continue; // avoid to loop over Pixel det id
1491 
1492  if (Gain != 1.) {
1493  std::vector<MonitorElement*> charge_histos = APVGain::FetchMonitor(newCharge, DetId, tTopo_);
1494  TH2S* chvsidx = (Charge_Vs_Index[elepos])->getTH2S();
1495  int bin = chvsidx->GetXaxis()->FindBin(Index);
1496  TH1D* Proj = chvsidx->ProjectionY("proj", bin, bin);
1497  for (int binId = 0; binId < Proj->GetXaxis()->GetNbins(); binId++) {
1498  double new_charge = Proj->GetXaxis()->GetBinCenter(binId) / Gain;
1499  if (Proj->GetBinContent(binId) != 0.) {
1500  for (unsigned int h = 0; h < charge_histos.size(); h++) {
1501  TH1D* chisto = (charge_histos[h])->getTH1D();
1502  for (int e = 0; e < Proj->GetBinContent(binId); e++)
1503  chisto->Fill(new_charge);
1504  }
1505  }
1506  }
1507  }
1508 
1509  if (FitMPV <= 0.) { // No fit of MPV
1510  if (APV->isMasked)
1511  NoMPVmasked->Fill(z, R);
1512  else
1513  NoMPVfit->Fill(z, R);
1514 
1515  } else { // Fit of MPV
1516  if (FitMPV > 0.)
1517  Gains->Fill(Gain);
1518 
1519  MPVs->Fill(FitMPV);
1520  if (Thickness < 0.04)
1521  MPVs320->Fill(FitMPV);
1522  if (Thickness > 0.04)
1523  MPVs500->Fill(FitMPV);
1524 
1525  MPVError->Fill(FitMPVErr);
1526  MPVErrorVsMPV->Fill(FitMPV, FitMPVErr);
1527  MPVErrorVsEta->Fill(Eta, FitMPVErr);
1528  MPVErrorVsPhi->Fill(Phi, FitMPVErr);
1529  MPVErrorVsN->Fill(NEntries, FitMPVErr);
1530 
1531  if (SubDet == 3) {
1532  MPV_Vs_EtaTIB->Fill(Eta, FitMPV);
1533  MPV_Vs_PhiTIB->Fill(Phi, FitMPV);
1534  MPVsTIB->Fill(FitMPV);
1535 
1536  } else if (SubDet == 4) {
1537  MPV_Vs_EtaTID->Fill(Eta, FitMPV);
1538  MPV_Vs_PhiTID->Fill(Phi, FitMPV);
1539  MPVsTID->Fill(FitMPV);
1540  if (Eta < 0.)
1541  MPVsTIDM->Fill(FitMPV);
1542  if (Eta > 0.)
1543  MPVsTIDP->Fill(FitMPV);
1544 
1545  } else if (SubDet == 5) {
1546  MPV_Vs_EtaTOB->Fill(Eta, FitMPV);
1547  MPV_Vs_PhiTOB->Fill(Phi, FitMPV);
1548  MPVsTOB->Fill(FitMPV);
1549 
1550  } else if (SubDet == 6) {
1551  MPV_Vs_EtaTEC->Fill(Eta, FitMPV);
1552  MPV_Vs_PhiTEC->Fill(Phi, FitMPV);
1553  MPVsTEC->Fill(FitMPV);
1554  if (Eta < 0.)
1555  MPVsTECM->Fill(FitMPV);
1556  if (Eta > 0.)
1557  MPVsTECP->Fill(FitMPV);
1558  if (Thickness < 0.04) {
1559  MPV_Vs_EtaTECthin->Fill(Eta, FitMPV);
1560  MPV_Vs_PhiTECthin->Fill(Phi, FitMPV);
1561  MPVsTECthin->Fill(FitMPV);
1562  if (Eta > 0.)
1563  MPVsTECP1->Fill(FitMPV);
1564  if (Eta < 0.)
1565  MPVsTECM1->Fill(FitMPV);
1566  }
1567  if (Thickness > 0.04) {
1568  MPV_Vs_EtaTECthick->Fill(Eta, FitMPV);
1569  MPV_Vs_PhiTECthick->Fill(Phi, FitMPV);
1570  MPVsTECthick->Fill(FitMPV);
1571  if (Eta > 0.)
1572  MPVsTECP2->Fill(FitMPV);
1573  if (Eta < 0.)
1574  MPVsTECM2->Fill(FitMPV);
1575  }
1576  }
1577  }
1578 
1579  if (SubDet == 3 && PreviousGain != 0.)
1580  DiffWRTPrevGainTIB->Fill(Gain / PreviousGain);
1581  else if (SubDet == 4 && PreviousGain != 0.)
1582  DiffWRTPrevGainTID->Fill(Gain / PreviousGain);
1583  else if (SubDet == 5 && PreviousGain != 0.)
1584  DiffWRTPrevGainTOB->Fill(Gain / PreviousGain);
1585  else if (SubDet == 6 && PreviousGain != 0.)
1586  DiffWRTPrevGainTEC->Fill(Gain / PreviousGain);
1587 
1588  if (SubDet == 3)
1589  GainVsPrevGainTIB->Fill(PreviousGain, Gain);
1590  else if (SubDet == 4)
1591  GainVsPrevGainTID->Fill(PreviousGain, Gain);
1592  else if (SubDet == 5)
1593  GainVsPrevGainTOB->Fill(PreviousGain, Gain);
1594  else if (SubDet == 6)
1595  GainVsPrevGainTEC->Fill(PreviousGain, Gain);
1596  }
1597 }
1598 
1600  unsigned int tree_Index;
1601  unsigned int tree_Bin;
1602  unsigned int tree_DetId;
1603  unsigned char tree_APVId;
1604  unsigned char tree_SubDet;
1605  float tree_x;
1606  float tree_y;
1607  float tree_z;
1608  float tree_Eta;
1609  float tree_R;
1610  float tree_Phi;
1611  float tree_Thickness;
1612  float tree_FitMPV;
1613  float tree_FitMPVErr;
1614  float tree_FitWidth;
1615  float tree_FitWidthErr;
1616  float tree_FitChi2NDF;
1617  float tree_FitNorm;
1618  double tree_Gain;
1619  double tree_PrevGain;
1620  double tree_PrevGainTick;
1621  double tree_NEntries;
1622  bool tree_isMasked;
1623 
1624  TTree* MyTree;
1625  MyTree = tfs->make<TTree>("APVGain", "APVGain");
1626  MyTree->Branch("Index", &tree_Index, "Index/i");
1627  MyTree->Branch("Bin", &tree_Bin, "Bin/i");
1628  MyTree->Branch("DetId", &tree_DetId, "DetId/i");
1629  MyTree->Branch("APVId", &tree_APVId, "APVId/b");
1630  MyTree->Branch("SubDet", &tree_SubDet, "SubDet/b");
1631  MyTree->Branch("x", &tree_x, "x/F");
1632  MyTree->Branch("y", &tree_y, "y/F");
1633  MyTree->Branch("z", &tree_z, "z/F");
1634  MyTree->Branch("Eta", &tree_Eta, "Eta/F");
1635  MyTree->Branch("R", &tree_R, "R/F");
1636  MyTree->Branch("Phi", &tree_Phi, "Phi/F");
1637  MyTree->Branch("Thickness", &tree_Thickness, "Thickness/F");
1638  MyTree->Branch("FitMPV", &tree_FitMPV, "FitMPV/F");
1639  MyTree->Branch("FitMPVErr", &tree_FitMPVErr, "FitMPVErr/F");
1640  MyTree->Branch("FitWidth", &tree_FitWidth, "FitWidth/F");
1641  MyTree->Branch("FitWidthErr", &tree_FitWidthErr, "FitWidthErr/F");
1642  MyTree->Branch("FitChi2NDF", &tree_FitChi2NDF, "FitChi2NDF/F");
1643  MyTree->Branch("FitNorm", &tree_FitNorm, "FitNorm/F");
1644  MyTree->Branch("Gain", &tree_Gain, "Gain/D");
1645  MyTree->Branch("PrevGain", &tree_PrevGain, "PrevGain/D");
1646  MyTree->Branch("PrevGainTick", &tree_PrevGainTick, "PrevGainTick/D");
1647  MyTree->Branch("NEntries", &tree_NEntries, "NEntries/D");
1648  MyTree->Branch("isMasked", &tree_isMasked, "isMasked/O");
1649 
1650  FILE* Gains = stdout;
1651  fprintf(Gains, "NEvents = %i\n", NEvent);
1652  fprintf(Gains, "NTracks = %i\n", NTrack);
1653  //fprintf(Gains,"NClustersPixel = %i\n",NClusterPixel);
1654  fprintf(Gains, "NClustersStrip = %i\n", NClusterStrip);
1655  //fprintf(Gains,"Number of Pixel Dets = %lu\n",static_cast<unsigned long>(NPixelDets));
1656  fprintf(Gains, "Number of Strip APVs = %lu\n", static_cast<unsigned long>(NStripAPVs));
1657  fprintf(Gains,
1658  "GoodFits = %i BadFits = %i ratio = %f%% (MASKED=%i)\n",
1659  GOOD,
1660  BAD,
1661  (100.0 * GOOD) / (GOOD + BAD),
1662  MASKED);
1663 
1664  Gains = fopen(OutputGains.c_str(), "w");
1665  fprintf(Gains, "NEvents = %i\n", NEvent);
1666  fprintf(Gains, "NTracks = %i\n", NTrack);
1667  //fprintf(Gains,"NClustersPixel = %i\n",NClusterPixel);
1668  fprintf(Gains, "NClustersStrip = %i\n", NClusterStrip);
1669  fprintf(Gains, "Number of Strip APVs = %lu\n", static_cast<unsigned long>(NStripAPVs));
1670  //fprintf(Gains,"Number of Pixel Dets = %lu\n",static_cast<unsigned long>(NPixelDets));
1671  fprintf(Gains,
1672  "GoodFits = %i BadFits = %i ratio = %f%% (MASKED=%i)\n",
1673  GOOD,
1674  BAD,
1675  (100.0 * GOOD) / (GOOD + BAD),
1676  MASKED);
1677 
1678  int elepos = statCollectionFromMode(m_calibrationMode.c_str());
1679 
1680  for (unsigned int a = 0; a < APVsCollOrdered.size(); a++) {
1682  if (APV == nullptr)
1683  continue;
1684  // printf( "%i | %i | PreviousGain = %7.5f NewGain = %7.5f (#clusters=%8.0f)\n", APV->DetId,APV->APVId,APV->PreviousGain,APV->Gain, APV->NEntries);
1685  fprintf(Gains,
1686  "%i | %i | PreviousGain = %7.5f(tick) x %7.5f(particle) NewGain (particle) = %7.5f (#clusters=%8.0f)\n",
1687  APV->DetId,
1688  APV->APVId,
1689  APV->PreviousGainTick,
1690  APV->PreviousGain,
1691  APV->Gain,
1692  APV->NEntries);
1693 
1694  tree_Index = APV->Index;
1695  tree_Bin = (Charge_Vs_Index[elepos])->getTH2S()->GetXaxis()->FindBin(APV->Index);
1696  tree_DetId = APV->DetId;
1697  tree_APVId = APV->APVId;
1698  tree_SubDet = APV->SubDet;
1699  tree_x = APV->x;
1700  tree_y = APV->y;
1701  tree_z = APV->z;
1702  tree_Eta = APV->Eta;
1703  tree_R = APV->R;
1704  tree_Phi = APV->Phi;
1705  tree_Thickness = APV->Thickness;
1706  tree_FitMPV = APV->FitMPV;
1707  tree_FitMPVErr = APV->FitMPVErr;
1708  tree_FitWidth = APV->FitWidth;
1709  tree_FitWidthErr = APV->FitWidthErr;
1710  tree_FitChi2NDF = APV->FitChi2;
1711  tree_FitNorm = APV->FitNorm;
1712  tree_Gain = APV->Gain;
1713  tree_PrevGain = APV->PreviousGain;
1714  tree_PrevGainTick = APV->PreviousGainTick;
1715  tree_NEntries = APV->NEntries;
1716  tree_isMasked = APV->isMasked;
1717 
1718  if (tree_DetId == 402673324) {
1719  printf("%i | %i : %f --> %f (%f)\n", tree_DetId, tree_APVId, tree_PrevGain, tree_Gain, tree_NEntries);
1720  }
1721 
1722  MyTree->Fill();
1723  }
1724  if (Gains)
1725  fclose(Gains);
1726 }
1727 
1729  // The goal of this function is to check wether or not there is enough statistics
1730  // to produce a meaningful tag for the DB
1731  int elepos = (AlgoMode == "PCL") ? Harvest : statCollectionFromMode(m_calibrationMode.c_str());
1732  if (Charge_Vs_Index[elepos] == nullptr) {
1733  edm::LogError("SiStripGainFromCalibTree")
1734  << "produceTagFilter -> Return false: could not retrieve the " << m_calibrationMode.c_str() << " statistics.\n"
1735  << "Please check if input contains " << m_calibrationMode.c_str() << " data." << std::endl;
1736  return false;
1737  }
1738 
1739  float integral = (Charge_Vs_Index[elepos])->getTH2S()->Integral();
1740  if ((Charge_Vs_Index[elepos])->getTH2S()->Integral(0, NStripAPVs + 1, 0, 99999) < tagCondition_NClusters) {
1741  edm::LogWarning("SiStripGainFromCalibTree")
1742  << "calibrationMode -> " << m_calibrationMode << "\n"
1743  << "produceTagFilter -> Return false: Statistics is too low : " << integral << endl;
1744  return false;
1745  }
1746  if ((1.0 * GOOD) / (GOOD + BAD) < tagCondition_GoodFrac) {
1747  edm::LogWarning("SiStripGainFromCalibTree")
1748  << "calibrationMode -> " << m_calibrationMode << "\n"
1749  << "produceTagFilter -> Return false: ratio of GOOD/TOTAL is too low: " << (1.0 * GOOD) / (GOOD + BAD) << endl;
1750  return false;
1751  }
1752  return true;
1753 }
1754 
1755 std::unique_ptr<SiStripApvGain> SiStripGainFromCalibTree::getNewObject() {
1756  auto obj = std::make_unique<SiStripApvGain>();
1757  if (!m_harvestingMode)
1758  return obj;
1759 
1760  if (!produceTagFilter()) {
1761  edm::LogWarning("SiStripGainFromCalibTree")
1762  << "getNewObject -> will not produce a paylaod because produceTagFilter returned false " << endl;
1763  setDoStore(false);
1764  return obj;
1765  }
1766 
1767  std::vector<float>* theSiStripVector = nullptr;
1768  unsigned int PreviousDetId = 0;
1769  for (unsigned int a = 0; a < APVsCollOrdered.size(); a++) {
1771  if (APV == nullptr) {
1772  printf("Bug\n");
1773  continue;
1774  }
1775  if (APV->SubDet <= 2)
1776  continue;
1777  if (APV->DetId != PreviousDetId) {
1778  if (theSiStripVector != nullptr) {
1779  SiStripApvGain::Range range(theSiStripVector->begin(), theSiStripVector->end());
1780  if (!obj->put(PreviousDetId, range))
1781  printf("Bug to put detId = %i\n", PreviousDetId);
1782  }
1783  theSiStripVector = new std::vector<float>;
1784  PreviousDetId = APV->DetId;
1785  }
1786  theSiStripVector->push_back(APV->Gain);
1787  }
1788  if (theSiStripVector != nullptr) {
1789  SiStripApvGain::Range range(theSiStripVector->begin(), theSiStripVector->end());
1790  if (!obj->put(PreviousDetId, range))
1791  printf("Bug to put detId = %i\n", PreviousDetId);
1792  }
1793 
1794  if (theSiStripVector != nullptr)
1795  delete theSiStripVector;
1796 
1797  return obj;
1798 }
1799 
1801  APVsColl.clear();
1802  for (unsigned int a = 0; a < APVsCollOrdered.size(); a++) {
1804  if (APV != nullptr)
1805  delete APV;
1806  }
1807  APVsCollOrdered.clear();
1808 }
1809 
1811  if (!useCalibration)
1812  return;
1813 
1814  TChain* t1 = new TChain("SiStripCalib/APVGain");
1815  t1->Add(m_calibrationPath.c_str());
1816 
1817  unsigned int tree_DetId;
1818  unsigned char tree_APVId;
1819  double tree_Gain;
1820 
1821  t1->SetBranchAddress("DetId", &tree_DetId);
1822  t1->SetBranchAddress("APVId", &tree_APVId);
1823  t1->SetBranchAddress("Gain", &tree_Gain);
1824 
1825  for (unsigned int ientry = 0; ientry < t1->GetEntries(); ientry++) {
1826  t1->GetEntry(ientry);
1827  stAPVGain* APV = APVsColl[(tree_DetId << 4) | (unsigned int)tree_APVId];
1828  APV->CalibGain = tree_Gain;
1829  }
1830 
1831  delete t1;
1832 }
1833 
1835  // in AlCaHarvesting mode we just need to run the logic in the endJob step
1836  if (m_harvestingMode)
1837  return;
1838 
1839  if (AlgoMode == "CalibTree")
1840  return;
1841 
1842  eventnumber = iEvent.id().event();
1843  runnumber = iEvent.id().run();
1844  auto handle01 = connect(TrigTech, TrigTech_token_, iEvent);
1845  auto handle02 = connect(trackchi2ndof, trackchi2ndof_token_, iEvent);
1846  auto handle03 = connect(trackp, trackp_token_, iEvent);
1847  auto handle04 = connect(trackpt, trackpt_token_, iEvent);
1848  auto handle05 = connect(tracketa, tracketa_token_, iEvent);
1849  auto handle06 = connect(trackphi, trackphi_token_, iEvent);
1851  auto handle08 = connect(trackindex, trackindex_token_, iEvent);
1852  auto handle09 = connect(rawid, rawid_token_, iEvent);
1853  auto handle11 = connect(localdirx, localdirx_token_, iEvent);
1854  auto handle12 = connect(localdiry, localdiry_token_, iEvent);
1855  auto handle13 = connect(localdirz, localdirz_token_, iEvent);
1856  auto handle14 = connect(firststrip, firststrip_token_, iEvent);
1857  auto handle15 = connect(nstrips, nstrips_token_, iEvent);
1858  auto handle16 = connect(saturation, saturation_token_, iEvent);
1859  auto handle17 = connect(overlapping, overlapping_token_, iEvent);
1860  auto handle18 = connect(farfromedge, farfromedge_token_, iEvent);
1861  auto handle19 = connect(charge, charge_token_, iEvent);
1862  auto handle21 = connect(path, path_token_, iEvent);
1864  auto handle23 = connect(amplitude, amplitude_token_, iEvent);
1865  auto handle24 = connect(gainused, gainused_token_, iEvent);
1866  auto handle25 = connect(gainusedTick, gainusedTick_token_, iEvent);
1867  auto handle26 = connect(trackalgo, trackalgo_token_, iEvent);
1868 
1869  processEvent();
1870 }
1871 
SiStripGainFromCalibTree::overlapping
const std::vector< bool > * overlapping
Definition: SiStripGainFromCalibTree.cc:299
SiStripGainFromCalibTree::saturation_token_
edm::EDGetTokenT< std::vector< bool > > saturation_token_
Definition: SiStripGainFromCalibTree.cc:298
SiStripGainFromCalibTree::NTrack
unsigned int NTrack
Definition: SiStripGainFromCalibTree.cc:247
FEDNumbering.h
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
SiStripGainFromCalibTree::trackindex_token_
edm::EDGetTokenT< std::vector< int > > trackindex_token_
Definition: SiStripGainFromCalibTree.cc:284
SiStripGainFromCalibTree::getPeakOfLandau
void getPeakOfLandau(TH1 *InputHisto, double *FitResults, double LowRange=50, double HighRange=5400)
Definition: SiStripGainFromCalibTree.cc:1080
SiStripGainFromCalibTree::statCollectionFromMode
int statCollectionFromMode(const char *tag) const
Definition: SiStripGainFromCalibTree.cc:329
SiStripGainFromCalibTree::OutputGains
std::string OutputGains
Definition: SiStripGainFromCalibTree.cc:166
SiStripGainFromCalibTree::Charge_Vs_Index
std::vector< MonitorElement * > Charge_Vs_Index
Definition: SiStripGainFromCalibTree.cc:174
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
SiStripGainRcd
Definition: SiStripDependentRecords.h:29
DDAxes::y
SiStripGainFromCalibTree::dqm_tag_
std::vector< string > dqm_tag_
Definition: SiStripGainFromCalibTree.cc:171
SiStripGainFromCalibTree::farfromedge_token_
edm::EDGetTokenT< std::vector< bool > > farfromedge_token_
Definition: SiStripGainFromCalibTree.cc:302
mps_fire.i
i
Definition: mps_fire.py:355
SiStripGainFromCalibTree::trackalgo_token_
edm::EDGetTokenT< std::vector< int > > trackalgo_token_
Definition: SiStripGainFromCalibTree.cc:280
SiStripGainFromCalibTree::Charge_3
std::array< std::vector< APVGain::APVmon >, 7 > Charge_3
Definition: SiStripGainFromCalibTree.cc:177
SiStripGainFromCalibTree::tagCondition_GoodFrac
double tagCondition_GoodFrac
Definition: SiStripGainFromCalibTree.cc:163
CustomPhysics_cfi.amplitude
amplitude
Definition: CustomPhysics_cfi.py:12
ConditionDBWriter< SiStripApvGain >::setDoStore
void setDoStore(const bool doStore)
When set to false the payload will not be written to the db.
Definition: ConditionDBWriter.h:385
Harvest
Definition: APVGainStruct.h:52
StripGeomDetUnit.h
MessageLogger.h
SiStripGainFromCalibTree::MPVsTECM2
MonitorElement * MPVsTECM2
Definition: SiStripGainFromCalibTree.cc:226
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
SiStripGainFromCalibTree::trackphi
const std::vector< double > * trackphi
Definition: SiStripGainFromCalibTree.cc:275
TrackerGeometry.h
SiStripGainFromCalibTree::TrackPrefix_
string TrackPrefix_
Definition: SiStripGainFromCalibTree.cc:318
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
dqm::implementation::IBooker::book2S
MonitorElement * book2S(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:219
ESHandle.h
SiStripGainFromCalibTree::MPVs500
MonitorElement * MPVs500
Definition: SiStripGainFromCalibTree.cc:212
SiStripGain.h
SiStripGainFromCalibTree::DiffWRTPrevGainTID
MonitorElement * DiffWRTPrevGainTID
Definition: SiStripGainFromCalibTree.cc:235
SiStripGainFromCalibTree::NEvent
unsigned int NEvent
Definition: SiStripGainFromCalibTree.cc:246
SiStripGainFromCalibTree::m_harvestingMode
bool m_harvestingMode
Definition: SiStripGainFromCalibTree.cc:154
SiStripGainFromCalibTree::m_calibrationMode
std::string m_calibrationMode
Definition: SiStripGainFromCalibTree.cc:157
SiStripGainFromCalibTree::MPV_Vs_PhiTECthin
MonitorElement * MPV_Vs_PhiTECthin
Definition: SiStripGainFromCalibTree.cc:203
SiStripGainFromCalibTree::MPVsTEC
MonitorElement * MPVsTEC
Definition: SiStripGainFromCalibTree.cc:218
patZpeak.handle
handle
Definition: patZpeak.py:23
edm::Run
Definition: Run.h:45
SiStripGainFromCalibTree::tagCondition_NClusters
double tagCondition_NClusters
Definition: SiStripGainFromCalibTree.cc:162
edm::EDGetTokenT
Definition: EDGetToken.h:33
SiStripGainFromCalibTree::booked_dir_
std::string booked_dir_
Definition: SiStripGainFromCalibTree.cc:172
edm
HLT enums.
Definition: AlignableModifier.h:19
SiStripGainFromCalibTree::NClusterStrip
unsigned int NClusterStrip
Definition: SiStripGainFromCalibTree.cc:248
TrackerTopology
Definition: TrackerTopology.h:16
SiStripGainFromCalibTree::trackchi2ndof
const std::vector< double > * trackchi2ndof
Definition: SiStripGainFromCalibTree.cc:267
SiStripGainFromCalibTree::MASKED
unsigned int MASKED
Definition: SiStripGainFromCalibTree.cc:256
tree
Definition: tree.py:1
h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: L1TUtmAlgorithmRcd.h:4
SiStripGainFromCalibTree::eventnumber
unsigned int eventnumber
Definition: SiStripGainFromCalibTree.cc:261
SiStripGainFromCalibTree::qualityMonitor
void qualityMonitor()
Definition: SiStripGainFromCalibTree.cc:1467
SiStripGainFromCalibTree::trackhitsvalid_token_
edm::EDGetTokenT< std::vector< unsigned int > > trackhitsvalid_token_
Definition: SiStripGainFromCalibTree.cc:278
SiStripGainFromCalibTree::trackchi2ndof_token_
edm::EDGetTokenT< std::vector< double > > trackchi2ndof_token_
Definition: SiStripGainFromCalibTree.cc:268
SiStripGainFromCalibTree::MPVError
MonitorElement * MPVError
Definition: SiStripGainFromCalibTree.cc:228
edm::LogInfo
Definition: MessageLogger.h:254
SiStripGainFromCalibTree::DQMStore
dqm::legacy::DQMStore DQMStore
Definition: SiStripGainFromCalibTree.cc:93
SiStripGainFromCalibTree::newCharge
std::vector< APVGain::APVmon > newCharge
Definition: SiStripGainFromCalibTree.cc:244
SiStripGainFromCalibTree::chargeoverpath
const std::vector< double > * chargeoverpath
Definition: SiStripGainFromCalibTree.cc:307
stAPVGain
Definition: APVGainStruct.h:7
SiStripGainFromCalibTree::Gains
MonitorElement * Gains
Definition: SiStripGainFromCalibTree.cc:209
SiStripGainFromCalibTree::trackp_token_
edm::EDGetTokenT< std::vector< float > > trackp_token_
Definition: SiStripGainFromCalibTree.cc:270
stAPVGain::Bin
int Bin
Definition: APVGainStruct.h:9
SiStripGainFromCalibTree::useCalibration
bool useCalibration
Definition: SiStripGainFromCalibTree.cc:153
GeomDetType.h
SiStripGainFromCalibTree::MPV_Vs_EtaTOB
MonitorElement * MPV_Vs_EtaTOB
Definition: SiStripGainFromCalibTree.cc:194
SiStripGainFromCalibTree::rawid
const std::vector< unsigned int > * rawid
Definition: SiStripGainFromCalibTree.cc:285
stAPVGain::DetId
unsigned int DetId
Definition: APVGainStruct.h:10
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
TrackingGeometry.h
SiStripGainRcd.h
DQMStore.h
SiStripGainFromCalibTree::Charge_Vs_PathlengthTIDP
std::vector< MonitorElement * > Charge_Vs_PathlengthTIDP
Definition: SiStripGainFromCalibTree.cc:182
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
IntegrityClient_cfi.Gain
Gain
Definition: IntegrityClient_cfi.py:16
APVGain::APVmon
Definition: APVGainHelpers.h:28
SiStripGainFromCalibTree::MPV_Vs_EtaTID
MonitorElement * MPV_Vs_EtaTID
Definition: SiStripGainFromCalibTree.cc:193
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
SiStripGainFromCalibTree::MPVsTECthick
MonitorElement * MPVsTECthick
Definition: SiStripGainFromCalibTree.cc:222
SiStripGainFromCalibTree::Charge_Vs_PathlengthTOB
std::vector< MonitorElement * > Charge_Vs_PathlengthTOB
Definition: SiStripGainFromCalibTree.cc:181
EDAnalyzer.h
SiStripGainFromCalibTree::MaxTrackingIteration
int MaxTrackingIteration
Definition: SiStripGainFromCalibTree.cc:145
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
SiStripGainFromCalibTree::trackp
const std::vector< float > * trackp
Definition: SiStripGainFromCalibTree.cc:269
StripTopology.h
SiStripGainFromCalibTree::MPVsTECP
MonitorElement * MPVsTECP
Definition: SiStripGainFromCalibTree.cc:219
APVGain::subdetectorPlane
int subdetectorPlane(uint32_t, const TrackerTopology *)
Definition: APVGainHelpers.cc:76
SiStripGainFromCalibTree::CalibrationLevel
int CalibrationLevel
Definition: SiStripGainFromCalibTree.cc:150
SiStripGainFromCalibTree::BAD
unsigned int BAD
Definition: SiStripGainFromCalibTree.cc:255
APVGainStruct.h
SiStripGainFromCalibTree::MPVs
MonitorElement * MPVs
Definition: SiStripGainFromCalibTree.cc:210
SiStripGainFromCalibTree::dbe
DQMStore * dbe
Definition: SiStripGainFromCalibTree.cc:133
tools.TF1
TF1
Definition: tools.py:23
edm::Handle
Definition: AssociativeIterator.h:50
SiStripGainFromCalibTree::VInputFiles
vector< string > VInputFiles
Definition: SiStripGainFromCalibTree.cc:167
SiStripGainFromCalibTree::nstrips_token_
edm::EDGetTokenT< std::vector< unsigned short > > nstrips_token_
Definition: SiStripGainFromCalibTree.cc:296
dqmdumpme.first
first
Definition: dqmdumpme.py:55
SiStripGainFromCalibTree::APVsCollOrdered
std::vector< stAPVGain * > APVsCollOrdered
Definition: SiStripGainFromCalibTree.cc:324
SiStripGainFromCalibTree::nstrips
const std::vector< unsigned short > * nstrips
Definition: SiStripGainFromCalibTree.cc:295
SiStripGainFromCalibTree::MaxMPVError
double MaxMPVError
Definition: SiStripGainFromCalibTree.cc:136
SiStripGainFromCalibTree::MPV_Vs_PhiTID
MonitorElement * MPV_Vs_PhiTID
Definition: SiStripGainFromCalibTree.cc:200
SiStripGainFromCalibTree::m_splitDQMstat
bool m_splitDQMstat
Definition: SiStripGainFromCalibTree.cc:155
SiStripGainFromCalibTree::charge_token_
edm::EDGetTokenT< std::vector< unsigned int > > charge_token_
Definition: SiStripGainFromCalibTree.cc:304
SiStripGainFromCalibTree::MakeCalibrationMap
void MakeCalibrationMap()
Definition: SiStripGainFromCalibTree.cc:1810
SiStripGainFromCalibTree::Charge_Vs_PathlengthTECP2
std::vector< MonitorElement * > Charge_Vs_PathlengthTECP2
Definition: SiStripGainFromCalibTree.cc:185
stAPVGain::APVId
unsigned int APVId
Definition: APVGainStruct.h:11
SiStripGain::getNumberOfTags
size_t getNumberOfTags() const
Definition: SiStripGain.h:95
DetId
Definition: DetId.h:17
SiStripGainFromCalibTree::GainVsPrevGainTOB
MonitorElement * GainVsPrevGainTOB
Definition: SiStripGainFromCalibTree.cc:241
SiStripGainFromCalibTree::path_token_
edm::EDGetTokenT< std::vector< double > > path_token_
Definition: SiStripGainFromCalibTree.cc:306
SiStripGainFromCalibTree::algoEndRun
void algoEndRun(const edm::Run &run, const edm::EventSetup &iSetup) override
Definition: SiStripGainFromCalibTree.cc:864
MakerMacros.h
SiStripGainFromCalibTree::rawid_token_
edm::EDGetTokenT< std::vector< unsigned int > > rawid_token_
Definition: SiStripGainFromCalibTree.cc:286
TrackerTopology.h
alignCSCRings.s
s
Definition: alignCSCRings.py:92
SiStripGainFromCalibTree::GainVsPrevGainTIB
MonitorElement * GainVsPrevGainTIB
Definition: SiStripGainFromCalibTree.cc:239
SiStripGainFromCalibTree::MPVErrorVsN
MonitorElement * MPVErrorVsN
Definition: SiStripGainFromCalibTree.cc:232
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
SiStripDetCabling.h
APVGain
Definition: APVGainHelpers.h:15
SiStripGainFromCalibTree::gainusedTick
const std::vector< double > * gainusedTick
Definition: SiStripGainFromCalibTree.cc:313
SiStripGainFromCalibTree::isBFieldConsistentWithMode
bool isBFieldConsistentWithMode(const edm::EventSetup &iSetup) const
Definition: SiStripGainFromCalibTree.cc:788
SiStripGainFromCalibTree::MPV_Vs_PhiTIB
MonitorElement * MPV_Vs_PhiTIB
Definition: SiStripGainFromCalibTree.cc:199
SiStripGainFromCalibTree::MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: SiStripGainFromCalibTree.cc:92
TrackDeDxHits.h
h
TrackerTopologyRcd.h
Track.h
None
Definition: APVGainStruct.h:52
SiStripGainFromCalibTree::chargeoverpath_token_
edm::EDGetTokenT< std::vector< double > > chargeoverpath_token_
Definition: SiStripGainFromCalibTree.cc:308
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
TrackFwd.h
ConditionDBWriter
Definition: ConditionDBWriter.h:149
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
dqm::legacy::DQMStore
Definition: DQMStore.h:727
SiStripGainFromCalibTree::MPV_Vs_PhiTECthick
MonitorElement * MPV_Vs_PhiTECthick
Definition: SiStripGainFromCalibTree.cc:204
Exhume::I
const std::complex< double > I
Definition: I.h:8
SiStripGainFromCalibTree::CalibPrefix_
string CalibPrefix_
Definition: SiStripGainFromCalibTree.cc:320
SiStripGainFromCalibTree::MaxTrackMomentum
double MaxTrackMomentum
Definition: SiStripGainFromCalibTree.cc:139
DeDxHit.h
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
TrapezoidalPlaneBounds.h
funct::integral
Integral< F, X >::type integral(const F &f)
Definition: Integral.h:70
ntupleEnum.SubDet
SubDet
Definition: ntupleEnum.py:15
Service.h
SiStripGainFromCalibTree::algoComputeMPVandGain
void algoComputeMPVandGain()
Definition: SiStripGainFromCalibTree.cc:1362
SiStripGain::getRange
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:71
SiStripGainFromCalibTree::MPVsTOB
MonitorElement * MPVsTOB
Definition: SiStripGainFromCalibTree.cc:217
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
SiStripGainFromCalibTree::APVsColl
std::unordered_map< unsigned int, stAPVGain * > APVsColl
Definition: SiStripGainFromCalibTree.cc:325
SiStripGainFromCalibTree
Definition: SiStripGainFromCalibTree.cc:90
SiStripQualityRcd
Definition: SiStripDependentRecords.h:56
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
SiStripGainFromCalibTree::MPVsTECM
MonitorElement * MPVsTECM
Definition: SiStripGainFromCalibTree.cc:220
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
tfile
Definition: tfile.py:1
SiStripGainFromCalibTree::amplitude_token_
edm::EDGetTokenT< std::vector< unsigned char > > amplitude_token_
Definition: SiStripGainFromCalibTree.cc:310
DDAxes::z
SiStripGainFromCalibTree::EventSuffix_
string EventSuffix_
Definition: SiStripGainFromCalibTree.cc:317
SiStripGainFromCalibTree::GainVsPrevGainTEC
MonitorElement * GainVsPrevGainTEC
Definition: SiStripGainFromCalibTree.cc:242
edm::ESHandle< TrackerTopology >
p2
double p2[4]
Definition: TauolaWrapper.h:90
SiStripGainFromCalibTree::trackalgo
const std::vector< int > * trackalgo
Definition: SiStripGainFromCalibTree.cc:279
RectangularPlaneBounds.h
SiStripGainFromCalibTree::MPVsTIDP
MonitorElement * MPVsTIDP
Definition: SiStripGainFromCalibTree.cc:215
PixelTopology::ncolumns
virtual int ncolumns() const =0
SiStripGainFromCalibTree::MPVErrorVsEta
MonitorElement * MPVErrorVsEta
Definition: SiStripGainFromCalibTree.cc:230
SiStripGainFromCalibTree::storeOnTree
void storeOnTree(TFileService *tfs)
Definition: SiStripGainFromCalibTree.cc:1599
TFileService
Definition: TFileService.h:30
dqm::implementation::DQMStore::setCurrentFolder
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:569
SiStripGainFromCalibTree::IsGoodLandauFit
bool IsGoodLandauFit(double *FitResults)
Definition: SiStripGainFromCalibTree.cc:1107
StripSubdetector::TIB
static constexpr auto TIB
Definition: StripSubdetector.h:16
SiStripGainFromCalibTree::MaxTrackChiOverNdf
double MaxTrackChiOverNdf
Definition: SiStripGainFromCalibTree.cc:144
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
VtxSmearedParameters_cfi.Phi
Phi
Definition: VtxSmearedParameters_cfi.py:112
SiStripGainFromCalibTree::MinTrackEta
double MinTrackEta
Definition: SiStripGainFromCalibTree.cc:140
SiStripGainFromCalibTree::tfs
TFileService * tfs
Definition: SiStripGainFromCalibTree.cc:132
SiStripApvGain.h
processEvent
dispatcher processEvent(e, inputTag, standby)
SiPixelRecHit.h
PixelTopology
Definition: PixelTopology.h:10
b
double b
Definition: hdecay.h:118
SiStripGainFromCalibTree::MPVsTECM1
MonitorElement * MPVsTECM1
Definition: SiStripGainFromCalibTree.cc:225
EDGetToken.h
TrajTrackAssociation.h
SiStripGainFromCalibTree::NoMPVmasked
MonitorElement * NoMPVmasked
Definition: SiStripGainFromCalibTree.cc:206
SiStripGainFromCalibTree::Charge_Vs_PathlengthTECM2
std::vector< MonitorElement * > Charge_Vs_PathlengthTECM2
Definition: SiStripGainFromCalibTree.cc:187
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
RunInfoRcd
Definition: RunSummaryRcd.h:26
SiStripGainFromCalibTree::saveSummary
bool saveSummary
Definition: SiStripGainFromCalibTree.cc:152
SiStripGainFromCalibTree::MPVs320
MonitorElement * MPVs320
Definition: SiStripGainFromCalibTree.cc:211
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripGain::getApvGain
static float getApvGain(const uint16_t &apv, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:76
dqm::implementation::IBooker::book1DD
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:155
SiStripGainFromCalibTree::trackpt
const std::vector< float > * trackpt
Definition: SiStripGainFromCalibTree.cc:271
SiStripGainFromCalibTree::getNewObject
std::unique_ptr< SiStripApvGain > getNewObject() override
Definition: SiStripGainFromCalibTree.cc:1755
edm::LogWarning
Definition: MessageLogger.h:141
TFileService.h
SiStripGainFromCalibTree::algoAnalyzeTheTree
void algoAnalyzeTheTree()
Definition: SiStripGainFromCalibTree.cc:1306
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
SiStripGainFromCalibTree::connect
edm::Handle< T > connect(const T *&ptr, edm::EDGetTokenT< T > token, const edm::Event &evt)
Definition: SiStripGainFromCalibTree.cc:123
SiStripGainFromCalibTree::TrigTech_token_
edm::EDGetTokenT< std::vector< bool > > TrigTech_token_
Definition: SiStripGainFromCalibTree.cc:264
SiStripGainFromCalibTree::MPVErrorVsPhi
MonitorElement * MPVErrorVsPhi
Definition: SiStripGainFromCalibTree.cc:231
TrackerDigiGeometryRecord.h
SiStripGainFromCalibTree::gainused
const std::vector< double > * gainused
Definition: SiStripGainFromCalibTree.cc:311
stAPVGain::Index
unsigned int Index
Definition: APVGainStruct.h:8
dqm::implementation::IBooker::book2DD
MonitorElement * book2DD(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:261
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
SiStripGainFromCalibTree::saturation
const std::vector< bool > * saturation
Definition: SiStripGainFromCalibTree.cc:297
SiStripGainFromCalibTree::NClusterPixel
unsigned int NClusterPixel
Definition: SiStripGainFromCalibTree.cc:249
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
a
double a
Definition: hdecay.h:119
APVGain::subdetectorSide
int subdetectorSide(uint32_t, const TrackerTopology *)
Definition: APVGainHelpers.cc:48
Event.h
SiStripGainFromCalibTree::localdiry_token_
edm::EDGetTokenT< std::vector< double > > localdiry_token_
Definition: SiStripGainFromCalibTree.cc:290
SiStripGainFromCalibTree::MaxTrackEta
double MaxTrackEta
Definition: SiStripGainFromCalibTree.cc:141
SiStripGainFromCalibTree::MaxNrStrips
unsigned int MaxNrStrips
Definition: SiStripGainFromCalibTree.cc:142
SiStripGainFromCalibTree::OldGainRemoving
bool OldGainRemoving
Definition: SiStripGainFromCalibTree.cc:149
mps_setup.stdout
stdout
Definition: mps_setup.py:250
SiStripGainFromCalibTree::localdiry
const std::vector< double > * localdiry
Definition: SiStripGainFromCalibTree.cc:289
SiStripGainFromCalibTree::tTopo_
const TrackerTopology * tTopo_
Definition: SiStripGainFromCalibTree.cc:326
beam_dqm_sourceclient-live_cfg.monitor
monitor
Definition: beam_dqm_sourceclient-live_cfg.py:237
APVGain::FetchMonitor
std::vector< MonitorElement * > FetchMonitor(std::vector< APVmon >, uint32_t, const TrackerTopology *topo=nullptr)
Definition: APVGainHelpers.cc:108
cond::runnumber
Definition: Time.h:19
SiStripGainFromCalibTree::localdirx_token_
edm::EDGetTokenT< std::vector< double > > localdirx_token_
Definition: SiStripGainFromCalibTree.cc:288
SiStripGainFromCalibTree::GainVsPrevGainTID
MonitorElement * GainVsPrevGainTID
Definition: SiStripGainFromCalibTree.cc:240
SiStripGainFromCalibTree::ERun
unsigned int ERun
Definition: SiStripGainFromCalibTree.cc:253
SiStripGainFromCalibTree::MPV_Vs_PhiTOB
MonitorElement * MPV_Vs_PhiTOB
Definition: SiStripGainFromCalibTree.cc:201
SiStripGainFromCalibTree::EventPrefix_
string EventPrefix_
Definition: SiStripGainFromCalibTree.cc:316
SiStripGainFromCalibTree::farfromedge
const std::vector< bool > * farfromedge
Definition: SiStripGainFromCalibTree.cc:301
SiStripGainFromCalibTree::Charge_4
std::array< std::vector< APVGain::APVmon >, 7 > Charge_4
Definition: SiStripGainFromCalibTree.cc:178
sistrip::APV
Definition: ConstantsForGranularity.h:79
SiStripGainFromCalibTree::AllowSaturation
bool AllowSaturation
Definition: SiStripGainFromCalibTree.cc:146
SiStripGainFromCalibTree::Charge_Vs_PathlengthTECP1
std::vector< MonitorElement * > Charge_Vs_PathlengthTECP1
Definition: SiStripGainFromCalibTree.cc:184
edm::Service
Definition: Service.h:30
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
SiStripGainFromCalibTree::MinTrackMomentum
double MinTrackMomentum
Definition: SiStripGainFromCalibTree.cc:138
SiStripGainFromCalibTree::trackpt_token_
edm::EDGetTokenT< std::vector< float > > trackpt_token_
Definition: SiStripGainFromCalibTree.cc:272
SiStripGainFromCalibTree::Charge_Vs_PathlengthTIDM
std::vector< MonitorElement * > Charge_Vs_PathlengthTIDM
Definition: SiStripGainFromCalibTree.cc:183
SiStripGainFromCalibTree::runnumber
unsigned int runnumber
Definition: SiStripGainFromCalibTree.cc:262
SiStripGainFromCalibTree::m_calibrationPath
std::string m_calibrationPath
Definition: SiStripGainFromCalibTree.cc:158
p1
double p1[4]
Definition: TauolaWrapper.h:89
edm::EventSetup
Definition: EventSetup.h:57
TrackerGeometry::dets
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: TrackerGeometry.h:62
GeometricDet.h
get
#define get
edm::ESHandleBase::isValid
bool isValid() const
Definition: ESHandle.h:44
ConditionDBWriter.h
HcalObjRepresent::Fill
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Definition: HcalObjRepresent.h:1053
SiStripGainFromCalibTree::Charge_1
std::array< std::vector< APVGain::APVmon >, 7 > Charge_1
Definition: SiStripGainFromCalibTree.cc:175
SiStripGainFromCalibTree::MinTrackHits
unsigned int MinTrackHits
Definition: SiStripGainFromCalibTree.cc:143
SiStripGainFromCalibTree::SRun
unsigned int SRun
Definition: SiStripGainFromCalibTree.cc:252
SiStripGainFromCalibTree::MPV_Vs_EtaTECthick
MonitorElement * MPV_Vs_EtaTECthick
Definition: SiStripGainFromCalibTree.cc:197
SiStripGainFromCalibTree::MinNrEntries
double MinNrEntries
Definition: SiStripGainFromCalibTree.cc:135
StripTopology::nstrips
virtual int nstrips() const =0
SiStripGainFromCalibTree::MPVsTID
MonitorElement * MPVsTID
Definition: SiStripGainFromCalibTree.cc:214
SiStripRecHit1D.h
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
SiStripGainFromCalibTree::tracketa
const std::vector< double > * tracketa
Definition: SiStripGainFromCalibTree.cc:273
SiStripGainFromCalibTree::localdirz_token_
edm::EDGetTokenT< std::vector< double > > localdirz_token_
Definition: SiStripGainFromCalibTree.cc:292
SiStripQuality::IsApvBad
bool IsApvBad(const uint32_t &detid, const short &apvNb) const
Definition: SiStripQuality.cc:620
SiStripGainFromCalibTree::FirstSetOfConstants
bool FirstSetOfConstants
Definition: SiStripGainFromCalibTree.cc:147
SiStripGainFromCalibTree::AlgoMode
std::string AlgoMode
Definition: SiStripGainFromCalibTree.cc:165
SiStripGainFromCalibTree::DiffWRTPrevGainTIB
MonitorElement * DiffWRTPrevGainTIB
Definition: SiStripGainFromCalibTree.cc:234
SiStripGainFromCalibTree::algoBeginJob
void algoBeginJob(const edm::EventSetup &iSetup) override
Definition: SiStripGainFromCalibTree.cc:648
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
ConditionDBWriter< SiStripApvGain >::storeOnDbNow
void storeOnDbNow()
Definition: ConditionDBWriter.h:354
SiStripGainFromCalibTree::MagFieldCurrentTh
double MagFieldCurrentTh
Definition: SiStripGainFromCalibTree.cc:134
Trajectory.h
RunInfo.h
SiStripGainFromCalibTree::CalibSuffix_
string CalibSuffix_
Definition: SiStripGainFromCalibTree.cc:321
GeomDet.h
TtFullHadDaughter::B
static const std::string B
Definition: TtFullHadronicEvent.h:9
SiStripGainFromCalibTree::NoMPVfit
MonitorElement * NoMPVfit
Definition: SiStripGainFromCalibTree.cc:207
SiStripGainFromCalibTree::gainusedTick_token_
edm::EDGetTokenT< std::vector< double > > gainusedTick_token_
Definition: SiStripGainFromCalibTree.cc:314
SiStripGainFromCalibTree::charge
const std::vector< unsigned int > * charge
Definition: SiStripGainFromCalibTree.cc:303
SiStripGainFromCalibTree::processEvent
void processEvent()
Definition: SiStripGainFromCalibTree.cc:1115
edm::merge
bool merge(LuminosityBlockRange &lh, LuminosityBlockRange &rh)
Definition: LuminosityBlockRange.cc:72
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
writedatasetfile.run
run
Definition: writedatasetfile.py:27
SiStripGainFromCalibTree::path
const std::vector< double > * path
Definition: SiStripGainFromCalibTree.cc:305
SiStripGainFromCalibTree::bookDQMHistos
void bookDQMHistos(const char *dqm_dir, const char *tag)
Definition: SiStripGainFromCalibTree.cc:471
StripSubdetector::TEC
static constexpr auto TEC
Definition: StripSubdetector.h:19
SiStripGainFromCalibTree::DiffWRTPrevGainTEC
MonitorElement * DiffWRTPrevGainTEC
Definition: SiStripGainFromCalibTree.cc:237
SiStripGainFromCalibTree::VChargeHisto
std::vector< std::string > VChargeHisto
Definition: SiStripGainFromCalibTree.cc:160
SiStripGainFromCalibTree::GOOD
unsigned int GOOD
Definition: SiStripGainFromCalibTree.cc:254
DetId.h
Frameworkfwd.h
T
long double T
Definition: Basic3DVectorLD.h:48
SiStripApvGain::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripApvGain.h:28
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
SiStripGainFromCalibTree::doChargeMonitorPerPlane
bool doChargeMonitorPerPlane
Definition: SiStripGainFromCalibTree.cc:156
SiStripQuality.h
SiStripGainFromCalibTree::MPVsTECthin
MonitorElement * MPVsTECthin
Definition: SiStripGainFromCalibTree.cc:221
PixelGeomDetUnit.h
SiStripGainFromCalibTree::MaxChi2OverNDF
double MaxChi2OverNDF
Definition: SiStripGainFromCalibTree.cc:137
SiStripGainFromCalibTree::MPVsTIDM
MonitorElement * MPVsTIDM
Definition: SiStripGainFromCalibTree.cc:216
SiStripQualityRcd.h
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
SiStripGainFromCalibTree::MPVErrorVsMPV
MonitorElement * MPVErrorVsMPV
Definition: SiStripGainFromCalibTree.cc:229
SiStripGainFromCalibTree::firststrip
const std::vector< unsigned short > * firststrip
Definition: SiStripGainFromCalibTree.cc:293
PixelTestBeamValidation_cfi.Charge
Charge
Definition: PixelTestBeamValidation_cfi.py:78
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
SiStripGainFromCalibTree::merge
void merge(TH2 *A, TH2 *B)
Definition: SiStripGainFromCalibTree.cc:343
SiStripGainFromCalibTree::MPV_Vs_EtaTEC
MonitorElement * MPV_Vs_EtaTEC
Definition: SiStripGainFromCalibTree.cc:195
SiStripGainFromCalibTree::MPVsTECP2
MonitorElement * MPVsTECP2
Definition: SiStripGainFromCalibTree.cc:224
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
SiStripGainFromCalibTree::TrigTech
const std::vector< bool > * TrigTech
Definition: SiStripGainFromCalibTree.cc:263
SiStripGainFromCalibTree::m_DQMdir
std::string m_DQMdir
Definition: SiStripGainFromCalibTree.cc:159
Exception.h
SiStripGainFromCalibTree::localdirx
const std::vector< double > * localdirx
Definition: SiStripGainFromCalibTree.cc:287
SiStripGainFromCalibTree::produceTagFilter
bool produceTagFilter()
Definition: SiStripGainFromCalibTree.cc:1728
SiStripGainFromCalibTree::overlapping_token_
edm::EDGetTokenT< std::vector< bool > > overlapping_token_
Definition: SiStripGainFromCalibTree.cc:300
SiStripGainFromCalibTree::trackindex
const std::vector< int > * trackindex
Definition: SiStripGainFromCalibTree.cc:283
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
triggerMatcherToHLTDebug_cfi.tags
tags
Definition: triggerMatcherToHLTDebug_cfi.py:9
SiStripGainFromCalibTree::MPV_Vs_EtaTECthin
MonitorElement * MPV_Vs_EtaTECthin
Definition: SiStripGainFromCalibTree.cc:196
SiStripGainFromCalibTree::MPVsTIB
MonitorElement * MPVsTIB
Definition: SiStripGainFromCalibTree.cc:213
APVGain::monHnames
std::vector< std::pair< std::string, std::string > > monHnames(std::vector< std::string >, bool, const char *tag)
Definition: APVGainHelpers.cc:166
SiStripGainFromCalibTree::MPV_Vs_PhiTEC
MonitorElement * MPV_Vs_PhiTEC
Definition: SiStripGainFromCalibTree.cc:202
SiStripGainFromCalibTree::swapBFieldMode
void swapBFieldMode(void)
Definition: SiStripGainFromCalibTree.cc:799
SiStripGainFromCalibTree::Validation
bool Validation
Definition: SiStripGainFromCalibTree.cc:148
SiStripGainFromCalibTree::NPixelDets
int NPixelDets
Definition: SiStripGainFromCalibTree.cc:251
SiStripGainFromCalibTree::MPV_Vs_EtaTIB
MonitorElement * MPV_Vs_EtaTIB
Definition: SiStripGainFromCalibTree.cc:192
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
SiStripDetCablingRcd.h
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
SiStripGainFromCalibTree::algoEndJob
void algoEndJob() override
Definition: SiStripGainFromCalibTree.cc:1024
ParameterSet.h
GeometricSearchDet
Definition: GeometricSearchDet.h:17
SiStripMatchedRecHit2D.h
SiStripGainFromCalibTree::tracketa_token_
edm::EDGetTokenT< std::vector< double > > tracketa_token_
Definition: SiStripGainFromCalibTree.cc:274
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
SiStripGainFromCalibTree::Charge_Vs_PathlengthTIB
std::vector< MonitorElement * > Charge_Vs_PathlengthTIB
Definition: SiStripGainFromCalibTree.cc:180
SiStripGainFromCalibTree::~SiStripGainFromCalibTree
~SiStripGainFromCalibTree() override
Definition: SiStripGainFromCalibTree.cc:1800
SiStripGainFromCalibTree::firststrip_token_
edm::EDGetTokenT< std::vector< unsigned short > > firststrip_token_
Definition: SiStripGainFromCalibTree.cc:294
RunInfo::m_avg_current
float m_avg_current
Definition: RunInfo.h:28
SiStripClusterCollection.h
edm::Event
Definition: Event.h:73
PixelTopology::nrows
virtual int nrows() const =0
SiStripGainFromCalibTree::algoAnalyze
void algoAnalyze(const edm::Event &, const edm::EventSetup &) override
Definition: SiStripGainFromCalibTree.cc:1834
SiStripApvGain
Definition: SiStripApvGain.h:25
SiStripGainFromCalibTree::gainused_token_
edm::EDGetTokenT< std::vector< double > > gainused_token_
Definition: SiStripGainFromCalibTree.cc:312
SiStripGainFromCalibTree::trackhitsvalid
const std::vector< unsigned int > * trackhitsvalid
Definition: SiStripGainFromCalibTree.cc:277
SiStripGainFromCalibTree::localdirz
const std::vector< double > * localdirz
Definition: SiStripGainFromCalibTree.cc:291
APVGainHelpers.h
A
dttmaxenums::R
Definition: DTTMax.h:29
SiStripRecHit2D.h
StripTopology
Definition: StripTopology.h:11
SiStripGainFromCalibTree::algoBeginRun
void algoBeginRun(const edm::Run &run, const edm::EventSetup &iSetup) override
Definition: SiStripGainFromCalibTree.cc:807
StripSubdetector.h
SiStripGainFromCalibTree::NStripAPVs
int NStripAPVs
Definition: SiStripGainFromCalibTree.cc:250
SiStripGainFromCalibTree::SiStripGainFromCalibTree
SiStripGainFromCalibTree(const edm::ParameterSet &)
Definition: SiStripGainFromCalibTree.cc:355
SiStripGainFromCalibTree::MPVsTECP1
MonitorElement * MPVsTECP1
Definition: SiStripGainFromCalibTree.cc:223
label
const char * label
Definition: PFTauDecayModeTools.cc:11
SiStripGainFromCalibTree::TrackSuffix_
string TrackSuffix_
Definition: SiStripGainFromCalibTree.cc:319
StripSubdetector::TID
static constexpr auto TID
Definition: StripSubdetector.h:17
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
SiStripGainFromCalibTree::trackphi_token_
edm::EDGetTokenT< std::vector< double > > trackphi_token_
Definition: SiStripGainFromCalibTree.cc:276
APVGain::subdetectorId
int subdetectorId(uint32_t)
Definition: APVGainHelpers.cc:15
SiStripGainFromCalibTree::amplitude
const std::vector< unsigned char > * amplitude
Definition: SiStripGainFromCalibTree.cc:309
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
SiStripGainFromCalibTree::DiffWRTPrevGainTOB
MonitorElement * DiffWRTPrevGainTOB
Definition: SiStripGainFromCalibTree.cc:236
SiStripGainFromCalibTree::Charge_Vs_PathlengthTECM1
std::vector< MonitorElement * > Charge_Vs_PathlengthTECM1
Definition: SiStripGainFromCalibTree.cc:186
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316
SiStripGainFromCalibTree::Charge_2
std::array< std::vector< APVGain::APVmon >, 7 > Charge_2
Definition: SiStripGainFromCalibTree.cc:176