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