CMS 3D CMS Logo

SiStripGainFromData.cc
Go to the documentation of this file.
1 // Original Author: Loic QUERTENMONT
2 // Created: Wed Feb 6 08:55:18 CET 2008
3 
4 #include <memory>
5 
14 
20 
27 
29 
32 
45 
48 
51 
53 
56 
57 #include "TFile.h"
58 #include "TObjString.h"
59 #include "TString.h"
60 #include "TH1F.h"
61 #include "TH2F.h"
62 #include "TProfile.h"
63 #include "TF1.h"
64 #include "TROOT.h"
65 
66 #include <unordered_map>
67 #include <memory>
68 
69 using namespace edm;
70 using namespace reco;
71 using namespace std;
72 
73 struct stAPVGain {
74  unsigned int Index;
75  int DetId;
76  int APVId;
77  int SubDet;
78  float Eta;
79  float R;
80  float Phi;
81  float Thickness;
82  double MPV;
83  double Gain;
84  double PreviousGain;
85  char Side;
86 };
87 
88 class SiStripGainFromData : public ConditionDBWriter<SiStripApvGain> {
89 public:
92  explicit SiStripGainFromData(const edm::ParameterSet&);
93  ~SiStripGainFromData() override;
94 
95 private:
96  void algoBeginJob(const edm::EventSetup&) override;
97  void algoEndJob() override;
98  void algoBeginRun(const edm::Run&, const edm::EventSetup&) override;
99  // virtual void algoBeginRun(const edm::Event& iEvent, const edm::EventSetup& iSetup);
100  void algoAnalyze(const edm::Event&, const edm::EventSetup&) override;
101 
102  std::unique_ptr<SiStripApvGain> getNewObject() override;
104 
105  double ComputeChargeOverPath(const SiStripCluster* Cluster,
106  TrajectoryStateOnSurface trajState,
107  const edm::EventSetup* iSetup,
108  const Track* track,
109  double trajChi2OverN);
110  bool IsFarFromBorder(TrajectoryStateOnSurface trajState, const uint32_t detid, const edm::EventSetup* iSetup);
111 
112  void getPeakOfLandau(TH1* InputHisto, double* FitResults, double LowRange = 0, double HighRange = 5400);
113 
116 
118  unsigned int MinNrEntries;
119  double MaxMPVError;
123  double MinTrackEta;
124  double MaxTrackEta;
125  unsigned int MaxNrStrips;
126  unsigned int MinTrackHits;
133 
139 
140  vector<string> VInputFiles;
141 
143 
146 
150  TH1F* HTrackHits;
151 
158 
165 
172 
179 
180  TH1F* Charge_TIB;
181  TH1F* Charge_TID;
182  TH1F* Charge_TIDP;
183  TH1F* Charge_TIDM;
184  TH1F* Charge_TOB;
185  TH1F* Charge_TEC;
186  TH1F* Charge_TEC1;
187  TH1F* Charge_TEC2;
188  TH1F* Charge_TECP;
189  TH1F* Charge_TECM;
190 
191  TH2F* MPV_Vs_Phi;
192  TH2F* MPV_Vs_Eta;
193  TH2F* MPV_Vs_R;
194 
195  // TH2F* PD_Vs_Eta;
196  // TH2F* PD_Vs_R;
197 
198  TH1F* APV_DetId;
199  TH1F* APV_Id;
200  TH1F* APV_Eta;
201  TH1F* APV_R;
202  TH1F* APV_SubDet;
204  TH2F* APV_Charge;
207  TH1F* APV_MPV;
208  TH1F* APV_Gain;
212 
213  TH1F* MPVs;
214  TH1F* MPVs320;
215  TH1F* MPVs500;
216 
217  // TH2F* MPV_vs_10RplusEta;
218 
221  // TH2F* Charge_Vs_PathLength_CS1;
222  // TH2F* Charge_Vs_PathLength_CS2;
223  // TH2F* Charge_Vs_PathLength_CS3;
224  // TH2F* Charge_Vs_PathLength_CS4;
225  // TH2F* Charge_Vs_PathLength_CS5;
226 
227  // TH1F* MPV_Vs_PathLength_CS1;
228  // TH1F* MPV_Vs_PathLength_CS2;
229  // TH1F* MPV_Vs_PathLength_CS3;
230  // TH1F* MPV_Vs_PathLength_CS4;
231  // TH1F* MPV_Vs_PathLength_CS5;
232 
233  // TH1F* FWHM_Vs_PathLength_CS1;
234  // TH1F* FWHM_Vs_PathLength_CS2;
235  // TH1F* FWHM_Vs_PathLength_CS3;
236  // TH1F* FWHM_Vs_PathLength_CS4;
237  // TH1F* FWHM_Vs_PathLength_CS5;
238 
242 
246 
250 
254 
258 
260  TH1F* MPV_Vs_Beta;
262 
267 
269 
272 
273  TH1F* JobInfo;
274 
275  TH1F* HFirstStrip;
276 
277  unsigned int NEvent;
278  unsigned int SRun;
279  unsigned int SEvent;
281  unsigned int ERun;
282  unsigned int EEvent;
284 
285 private:
286  class isEqual {
287  public:
288  template <class T>
289  bool operator()(const T& PseudoDetId1, const T& PseudoDetId2) {
290  return PseudoDetId1 == PseudoDetId2;
291  }
292  };
293 
294  std::vector<stAPVGain*> APVsCollOrdered;
295  std::unordered_map<unsigned int, stAPVGain*> APVsColl;
296 };
297 
299  : ConditionDBWriter<SiStripApvGain>(iConfig) {
300  AlgoMode = iConfig.getParameter<std::string>("AlgoMode");
301 
302  OutputGains = iConfig.getParameter<std::string>("OutputGains");
303  OutputHistos = iConfig.getParameter<std::string>("OutputHistos");
304 
305  TrajToTrackProducer = iConfig.getParameter<std::string>("TrajToTrackProducer");
306  TrajToTrackLabel = iConfig.getParameter<std::string>("TrajToTrackLabel");
307 
308  CheckLocalAngle = iConfig.getUntrackedParameter<bool>("checkLocalAngle", false);
309  MinNrEntries = iConfig.getUntrackedParameter<unsigned>("minNrEntries", 20);
310  MaxMPVError = iConfig.getUntrackedParameter<double>("maxMPVError", 500.0);
311  MaxChi2OverNDF = iConfig.getUntrackedParameter<double>("maxChi2OverNDF", 5.0);
312  MinTrackMomentum = iConfig.getUntrackedParameter<double>("minTrackMomentum", 3.0);
313  MaxTrackMomentum = iConfig.getUntrackedParameter<double>("maxTrackMomentum", 99999.0);
314  MinTrackEta = iConfig.getUntrackedParameter<double>("minTrackEta", -5.0);
315  MaxTrackEta = iConfig.getUntrackedParameter<double>("maxTrackEta", 5.0);
316  MaxNrStrips = iConfig.getUntrackedParameter<unsigned>("maxNrStrips", 2);
317  MinTrackHits = iConfig.getUntrackedParameter<unsigned>("MinTrackHits", 8);
318  MaxTrackChiOverNdf = iConfig.getUntrackedParameter<double>("MaxTrackChiOverNdf", 3);
319  AllowSaturation = iConfig.getUntrackedParameter<bool>("AllowSaturation", false);
320  FirstSetOfConstants = iConfig.getUntrackedParameter<bool>("FirstSetOfConstants", true);
321  Validation = iConfig.getUntrackedParameter<bool>("Validation", false);
322  CheckIfFileExist = iConfig.getUntrackedParameter<bool>("CheckIfFileExist", false);
323 
324  CalibrationLevel = iConfig.getUntrackedParameter<int>("CalibrationLevel", 0);
325 
326  if (strcmp(AlgoMode.c_str(), "WriteOnDB") == 0)
327  VInputFiles = iConfig.getParameter<vector<string> >("VInputFiles");
328 
329  dqmStore_ = edm::Service<DQMStore>().operator->();
330 
331  //if( OutputHistos!="" )
332  // dqmStore_->open(OutputHistos.c_str(), true);
333 }
334 
336 
338  //Retrieve tracker topology from geometry
339  edm::ESHandle<TrackerTopology> tTopoHandle;
340  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
341  const TrackerTopology* const tTopo = tTopoHandle.product();
342 
343  iSetup_ = &iSetup;
344 
345  // TH1::AddDirectory(kTRUE);
346 
347  tmp = dqmStore_->book1D("JobInfo", "JobInfo", 20, 0, 20);
348  JobInfo = tmp->getTH1F();
349 
350  tmp = dqmStore_->book1D("APV_DetId", "APV_DetId", 72785, 0, 72784);
351  APV_DetId = tmp->getTH1F();
352  tmp = dqmStore_->book1D("APV_Id", "APV_Id", 72785, 0, 72784);
353  APV_Id = tmp->getTH1F();
354  tmp = dqmStore_->book1D("APV_Eta", "APV_Eta", 72785, 0, 72784);
355  APV_Eta = tmp->getTH1F();
356  tmp = dqmStore_->book1D("APV_R", "APV_R", 72785, 0, 72784);
357  APV_R = tmp->getTH1F();
358  tmp = dqmStore_->book1D("APV_SubDet", "APV_SubDet", 72785, 0, 72784);
359  APV_SubDet = tmp->getTH1F();
360  tmp = dqmStore_->book2D("APV_Momentum", "APV_Momentum", 72785, 0, 72784, 50, 0, 200);
361  APV_Momentum = tmp->getTH2F();
362  tmp = dqmStore_->book2D("APV_Charge", "APV_Charge", 72785, 0, 72784, 1000, 0, 2000);
363  APV_Charge = tmp->getTH2F();
364  tmp = dqmStore_->book2D("APV_PathLength", "APV_PathLength", 72785, 0, 72784, 100, 0.2, 1.4);
366  tmp = dqmStore_->book1D("APV_PathLengthM", "APV_PathLengthM", 72785, 0, 72784);
368  tmp = dqmStore_->book1D("APV_MPV", "APV_MPV", 72785, 0, 72784);
369  APV_MPV = tmp->getTH1F();
370  tmp = dqmStore_->book1D("APV_Gain", "APV_Gain", 72785, 0, 72784);
371  APV_Gain = tmp->getTH1F();
372  tmp = dqmStore_->book1D("APV_PrevGain", "APV_PrevGain", 72785, 0, 72784);
373  APV_PrevGain = tmp->getTH1F();
374  tmp = dqmStore_->book1D("APV_CumulGain", "APV_CumulGain", 72785, 0, 72784);
376  tmp = dqmStore_->book1D("APV_Thickness", "APV_Thicknes", 72785, 0, 72784);
378 
379  tmp = dqmStore_->book2D("Tracks_P_Vs_Eta", "Tracks_P_Vs_Eta", 30, 0, 3, 50, 0, 200);
381  tmp = dqmStore_->book2D("Tracks_Pt_Vs_Eta", "Tracks_Pt_Vs_Eta", 30, 0, 3, 50, 0, 200);
383 
384  tmp = dqmStore_->book2D("Charge_Vs_PathTIB", "Charge_Vs_PathTIB", 100, 0.2, 1.4, 500, 0, 2000);
386  tmp = dqmStore_->book2D("Charge_Vs_PathTID", "Charge_Vs_PathTID", 100, 0.2, 1.4, 500, 0, 2000);
388  tmp = dqmStore_->book2D("Charge_Vs_PathTOB", "Charge_Vs_PathTOB", 100, 0.2, 1.4, 500, 0, 2000);
390  tmp = dqmStore_->book2D("Charge_Vs_PathTEC", "Charge_Vs_PathTEC", 100, 0.2, 1.4, 500, 0, 2000);
392  tmp = dqmStore_->book2D("Charge_Vs_PathTEC1", "Charge_Vs_PathTEC1", 100, 0.2, 1.4, 500, 0, 2000);
394  tmp = dqmStore_->book2D("Charge_Vs_PathTEC2", "Charge_Vs_PathTEC2", 100, 0.2, 1.4, 500, 0, 2000);
396 
397  tmp = dqmStore_->book1D("Charge_TIB", "Charge_TIB", 1000, 0, 2000);
398  Charge_TIB = tmp->getTH1F();
399  tmp = dqmStore_->book1D("Charge_TID", "Charge_TID", 1000, 0, 2000);
400  Charge_TID = tmp->getTH1F();
401  tmp = dqmStore_->book1D("Charge_TID+", "Charge_TID+", 1000, 0, 2000);
402  Charge_TIDP = tmp->getTH1F();
403  tmp = dqmStore_->book1D("Charge_TID-", "Charge_TID-", 1000, 0, 2000);
404  Charge_TIDM = tmp->getTH1F();
405  tmp = dqmStore_->book1D("Charge_TOB", "Charge_TOB", 1000, 0, 2000);
406  Charge_TOB = tmp->getTH1F();
407  tmp = dqmStore_->book1D("Charge_TEC", "Charge_TEC", 1000, 0, 2000);
408  Charge_TEC = tmp->getTH1F();
409  tmp = dqmStore_->book1D("Charge_TEC1", "Charge_TEC1", 1000, 0, 2000);
410  Charge_TEC1 = tmp->getTH1F();
411  tmp = dqmStore_->book1D("Charge_TEC2", "Charge_TEC2", 1000, 0, 2000);
412  Charge_TEC2 = tmp->getTH1F();
413  tmp = dqmStore_->book1D("Charge_TEC+", "Charge_TEC+", 1000, 0, 2000);
414  Charge_TECP = tmp->getTH1F();
415  tmp = dqmStore_->book1D("Charge_TEC-", "Charge_TEC-", 1000, 0, 2000);
416  Charge_TECM = tmp->getTH1F();
417 
418  /*
419  tmp = dqmStore_->book2D ("Charge_Vs_PathLength_CS1", "Charge_Vs_PathLength_CS1" , 250,0.2,1.4, 500,0,2000); Charge_Vs_PathLength_CS1 = tmp->getTH2F();
420  tmp = dqmStore_->book2D ("Charge_Vs_PathLength_CS2", "Charge_Vs_PathLength_CS2" , 250,0.2,1.4, 500,0,2000); Charge_Vs_PathLength_CS2 = tmp->getTH2F();
421  tmp = dqmStore_->book2D ("Charge_Vs_PathLength_CS3", "Charge_Vs_PathLength_CS3" , 250,0.2,1.4, 500,0,2000); Charge_Vs_PathLength_CS3 = tmp->getTH2F();
422  tmp = dqmStore_->book2D ("Charge_Vs_PathLength_CS4", "Charge_Vs_PathLength_CS4" , 250,0.2,1.4, 500,0,2000); Charge_Vs_PathLength_CS4 = tmp->getTH2F();
423  tmp = dqmStore_->book2D ("Charge_Vs_PathLength_CS5", "Charge_Vs_PathLength_CS5" , 250,0.2,1.4, 500,0,2000); Charge_Vs_PathLength_CS5 = tmp->getTH2F();
424 */
425  tmp = dqmStore_->book2D("Charge_Vs_PathLength", "Charge_Vs_PathLength", 100, 0.2, 1.4, 500, 0, 2000);
427  tmp = dqmStore_->book2D("Charge_Vs_PathLength320", "Charge_Vs_PathLength", 100, 0.2, 1.4, 500, 0, 2000);
429  tmp = dqmStore_->book2D("Charge_Vs_PathLength500", "Charge_Vs_PathLength", 100, 0.2, 1.4, 500, 0, 2000);
431 
432  tmp = dqmStore_->book2D("Charge_Vs_TransversAngle", "Charge_Vs_TransversAngle", 220, -20, 200, 500, 0, 2000);
434  tmp = dqmStore_->book2D("Charge_Vs_Alpha", "Charge_Vs_Alpha", 220, -20, 200, 500, 0, 2000);
436  tmp = dqmStore_->book2D("Charge_Vs_Beta", "Charge_Vs_Beta", 220, -20, 200, 500, 0, 2000);
438 
439  tmp = dqmStore_->book2D("NStrips_Vs_TransversAngle", "NStrips_Vs_TransversAngle", 220, -20, 200, 10, 0, 10);
441  tmp = dqmStore_->book2D("NStrips_Vs_Alpha", "NStrips_Vs_Alpha", 220, -20, 200, 10, 0, 10);
443  tmp = dqmStore_->book2D("NStrips_Vs_Beta", "NStrips_Vs_Beta", 220, -20, 200, 10, 0, 10);
445  tmp = dqmStore_->book1D("NHighStripInCluster", "NHighStripInCluster", 15, 0, 14);
447  tmp = dqmStore_->book1D("NSatStripInCluster", "NSatStripInCluster", 50, 0, 50);
449 
450  tmp = dqmStore_->book1D("TrackChi2OverNDF", "TrackChi2OverNDF", 500, 0, 10);
452  tmp = dqmStore_->book1D("TrackHits", "TrackHits", 40, 0, 40);
453  HTrackHits = tmp->getTH1F();
454 
455  tmp = dqmStore_->book1D("FirstStrip", "FirstStrip", 800, 0, 800);
456  HFirstStrip = tmp->getTH1F();
457 
458  if (strcmp(AlgoMode.c_str(), "MultiJob") != 0) {
459  tmp = dqmStore_->book2D("MPV_Vs_EtaTIB", "MPV_Vs_EtaTIB", 50, -3.0, 3.0, 300, 0, 600);
461  tmp = dqmStore_->book2D("MPV_Vs_EtaTID", "MPV_Vs_EtaTID", 50, -3.0, 3.0, 300, 0, 600);
463  tmp = dqmStore_->book2D("MPV_Vs_EtaTOB", "MPV_Vs_EtaTOB", 50, -3.0, 3.0, 300, 0, 600);
465  tmp = dqmStore_->book2D("MPV_Vs_EtaTEC", "MPV_Vs_EtaTEC", 50, -3.0, 3.0, 300, 0, 600);
467  tmp = dqmStore_->book2D("MPV_Vs_EtaTEC1", "MPV_Vs_EtaTEC1", 50, -3.0, 3.0, 300, 0, 600);
469  tmp = dqmStore_->book2D("MPV_Vs_EtaTEC2", "MPV_Vs_EtaTEC2", 50, -3.0, 3.0, 300, 0, 600);
471 
472  tmp = dqmStore_->book2D("MPV_Vs_PhiTIB", "MPV_Vs_PhiTIB", 50, -3.2, 3.2, 300, 0, 600);
474  tmp = dqmStore_->book2D("MPV_Vs_PhiTID", "MPV_Vs_PhiTID", 50, -3.2, 3.2, 300, 0, 600);
476  tmp = dqmStore_->book2D("MPV_Vs_PhiTOB", "MPV_Vs_PhiTOB", 50, -3.2, 3.2, 300, 0, 600);
478  tmp = dqmStore_->book2D("MPV_Vs_PhiTEC", "MPV_Vs_PhiTEC", 50, -3.2, 3.2, 300, 0, 600);
480  tmp = dqmStore_->book2D("MPV_Vs_PhiTEC1", "MPV_Vs_PhiTEC1", 50, -3.2, 3.2, 300, 0, 600);
482  tmp = dqmStore_->book2D("MPV_Vs_PhiTEC2", "MPV_Vs_PhiTEC2", 50, -3.2, 3.2, 300, 0, 600);
484 
485  tmp = dqmStore_->book1D("MPV_Vs_PathTIB", "MPV_Vs_PathTIB", 100, 0.2, 1.4);
487  tmp = dqmStore_->book1D("MPV_Vs_PathTID", "MPV_Vs_PathTID", 100, 0.2, 1.4);
489  tmp = dqmStore_->book1D("MPV_Vs_PathTOB", "MPV_Vs_PathTOB", 100, 0.2, 1.4);
491  tmp = dqmStore_->book1D("MPV_Vs_PathTEC", "MPV_Vs_PathTEC", 100, 0.2, 1.4);
493  tmp = dqmStore_->book1D("MPV_Vs_PathTEC1", "MPV_Vs_PathTEC1", 100, 0.2, 1.4);
495  tmp = dqmStore_->book1D("MPV_Vs_PathTEC2", "MPV_Vs_PathTEC2", 100, 0.2, 1.4);
497 
498  tmp = dqmStore_->book2D("MPV_Vs_Phi", "MPV_Vs_Phi", 50, -3.2, 3.2, 300, 0, 600);
499  MPV_Vs_Phi = tmp->getTH2F();
500  tmp = dqmStore_->book2D("MPV_Vs_Eta", "MPV_Vs_Eta", 50, -3.0, 3.0, 300, 0, 600);
501  MPV_Vs_Eta = tmp->getTH2F();
502  tmp = dqmStore_->book2D("MPV_Vs_R", "MPV_Vs_R", 150, 0.0, 150.0, 300, 0, 600);
503  MPV_Vs_R = tmp->getTH2F();
504  /*
505  tmp = dqmStore_->book1D ("MPV_Vs_PathLength_CS1" , "MPV_Vs_PathLength_CS1" , 250, 0.2, 1.4); MPV_Vs_PathLength_CS1 = tmp->getTH1F();
506  tmp = dqmStore_->book1D ("MPV_Vs_PathLength_CS2" , "MPV_Vs_PathLength_CS2" , 250, 0.2, 1.4); MPV_Vs_PathLength_CS2 = tmp->getTH1F();
507  tmp = dqmStore_->book1D ("MPV_Vs_PathLength_CS3" , "MPV_Vs_PathLength_CS3" , 250, 0.2, 1.4); MPV_Vs_PathLength_CS3 = tmp->getTH1F();
508  tmp = dqmStore_->book1D ("MPV_Vs_PathLength_CS4" , "MPV_Vs_PathLength_CS4" , 250, 0.2, 1.4); MPV_Vs_PathLength_CS4 = tmp->getTH1F();
509  tmp = dqmStore_->book1D ("MPV_Vs_PathLength_CS5" , "MPV_Vs_PathLength_CS5" , 250, 0.2, 1.4); MPV_Vs_PathLength_CS5 = tmp->getTH1F();
510 
511  tmp = dqmStore_->book1D ("FWHM_Vs_PathLength_CS1" , "FWHM_Vs_PathLength_CS1", 250, 0.2, 1.4); FWHM_Vs_PathLength_CS1 = tmp->getTH1F();
512  tmp = dqmStore_->book1D ("FWHM_Vs_PathLength_CS2" , "FWHM_Vs_PathLength_CS2", 250, 0.2, 1.4); FWHM_Vs_PathLength_CS2 = tmp->getTH1F();
513  tmp = dqmStore_->book1D ("FWHM_Vs_PathLength_CS3" , "FWHM_Vs_PathLength_CS3", 250, 0.2, 1.4); FWHM_Vs_PathLength_CS3 = tmp->getTH1F();
514  tmp = dqmStore_->book1D ("FWHM_Vs_PathLength_CS4" , "FWHM_Vs_PathLength_CS4", 250, 0.2, 1.4); FWHM_Vs_PathLength_CS4 = tmp->getTH1F();
515  tmp = dqmStore_->book1D ("FWHM_Vs_PathLength_CS5" , "FWHM_Vs_PathLength_CS5", 250, 0.2, 1.4); FWHM_Vs_PathLength_CS5 = tmp->getTH1F();
516 */
517  tmp = dqmStore_->book1D("MPV_Vs_PathLength", "MPV_Vs_PathLength", 100, 0.2, 1.4);
519  tmp = dqmStore_->book1D("MPV_Vs_PathLength320", "MPV_Vs_PathLength", 100, 0.2, 1.4);
521  tmp = dqmStore_->book1D("MPV_Vs_PathLength500", "MPV_Vs_PathLength", 100, 0.2, 1.4);
523 
524  tmp = dqmStore_->book1D("FWHM_Vs_PathLength", "FWHM_Vs_PathLength", 100, 0.2, 1.4);
526  tmp = dqmStore_->book1D("FWHM_Vs_PathLength320", "FWHM_Vs_PathLength", 100, 0.2, 1.4);
528  tmp = dqmStore_->book1D("FWHM_Vs_PathLength500", "FWHM_Vs_PathLength", 100, 0.2, 1.4);
530 
531  tmp = dqmStore_->book1D("MPV_Vs_TransversAngle", "MPV_Vs_TransversAngle", 220, -20, 200);
533  tmp = dqmStore_->book1D("MPV_Vs_Alpha", "MPV_Vs_Alpha", 220, -20, 200);
534  MPV_Vs_Alpha = tmp->getTH1F();
535  tmp = dqmStore_->book1D("MPV_Vs_Beta", "MPV_Vs_Beta", 220, -20, 200);
536  MPV_Vs_Beta = tmp->getTH1F();
537 
538  tmp = dqmStore_->book2D("Error_Vs_MPV", "Error_Vs_MPV", 600, 0, 600, 100, 0, 50);
539  Error_Vs_MPV = tmp->getTH2F();
540  tmp = dqmStore_->book2D("Error_Vs_Entries", "Error_Vs_Entries", 500, 0, 10000, 100, 0, 50);
542  tmp = dqmStore_->book2D("Error_Vs_Eta", "Error_Vs_Eta", 50, -3.0, 3.0, 100, 0, 50);
543  Error_Vs_Eta = tmp->getTH2F();
544  tmp = dqmStore_->book2D("Error_Vs_Phi", "Error_Vs_Phi", 50, -3.2, 3.2, 100, 0, 50);
545  Error_Vs_Phi = tmp->getTH2F();
546 
547  tmp = dqmStore_->book2D("NoMPV_Vs_EtaPhi", "NoMPV_Vs_EtaPhi", 50, -3.0, 3.0, 50, -3.2, 3.2);
549 
550  tmp = dqmStore_->book1D("NumberOfEntriesByAPV", "NumberOfEntriesByAPV", 1000, 0, 10000);
552  tmp = dqmStore_->book1D("Chi2OverNDF", "Chi2OverNDF", 500, 0, 25);
553  HChi2OverNDF = tmp->getTH1F();
554 
555  tmp = dqmStore_->book1D("MPVs", "MPVs", 600, 0, 600);
556  MPVs = tmp->getTH1F();
557  tmp = dqmStore_->book1D("MPVs320", "MPVs320", 600, 0, 600);
558  MPVs320 = tmp->getTH1F();
559  tmp = dqmStore_->book1D("MPVs500", "MPVs500", 600, 0, 600);
560  MPVs500 = tmp->getTH1F();
561 
562  // MPV_vs_10RplusEta tmp = dqmStore_->book2D ("MPV_vs_10RplusEta","MPV_vs_10RplusEta", 48000,0,2400, 800,100,500);
563  }
564 
565  gROOT->cd();
566 
568  iSetup.get<TrackerDigiGeometryRecord>().get(tkGeom);
569  auto const& Det = tkGeom->dets();
570 
571  edm::ESHandle<SiStripGain> gainHandle;
572  // if(strcmp(AlgoMode.c_str(),"MultiJob")!=0 && !FirstSetOfConstants){
573  iSetup.get<SiStripGainRcd>().get(gainHandle);
574  if (!gainHandle.isValid()) {
575  printf("\n#####################\n\nERROR --> gainHandle is not valid\n\n#####################\n\n");
576  exit(0);
577  }
578  // }
579 
580  unsigned int Id = 0;
581  for (unsigned int i = 0; i < Det.size(); i++) {
582  DetId Detid = Det[i]->geographicalId();
583  int SubDet = Detid.subdetId();
584 
587  auto DetUnit = dynamic_cast<StripGeomDetUnit const*>(Det[i]);
588  if (!DetUnit)
589  continue;
590 
591  const StripTopology& Topo = DetUnit->specificTopology();
592  unsigned int NAPV = Topo.nstrips() / 128;
593 
594  double Phi = DetUnit->position().basicVector().phi();
595  double Eta = DetUnit->position().basicVector().eta();
596  double R = DetUnit->position().basicVector().transverse();
597  double Thick = DetUnit->surface().bounds().thickness();
598 
599  for (unsigned int j = 0; j < NAPV; j++) {
600  stAPVGain* APV = new stAPVGain;
601  APV->Index = Id;
602  APV->DetId = Detid.rawId();
603  APV->APVId = j;
604  APV->SubDet = SubDet;
605  APV->MPV = -1;
606  APV->Gain = -1;
607  APV->PreviousGain = 1;
608  APV->Eta = Eta;
609  APV->Phi = Phi;
610  APV->R = R;
611  APV->Thickness = Thick;
612  APV->Side = 0;
613 
614  if (SubDet == StripSubdetector::TID) {
615  APV->Side = tTopo->tecSide(Detid);
616  } else if (SubDet == StripSubdetector::TEC) {
617  APV->Side = tTopo->tecSide(Detid);
618  }
619 
620  APVsCollOrdered.push_back(APV);
621  APVsColl[(APV->DetId << 3) | APV->APVId] = APV;
622  Id++;
623 
624  APV_DetId->Fill(Id, APV->DetId);
625  APV_Id->Fill(Id, APV->APVId);
626  APV_Eta->Fill(Id, APV->Eta);
627  APV_R->Fill(Id, APV->R);
628  APV_SubDet->Fill(Id, APV->SubDet);
629  APV_Thickness->Fill(Id, APV->Thickness);
630  }
631  }
632  }
633 
634  NEvent = 0;
635  SRun = 0;
636  SEvent = 0;
637  STimestamp = 0;
638  ERun = 0;
639  EEvent = 0;
640  ETimestamp = 0;
641 }
642 
644  unsigned int I = 0;
645 
646  if (strcmp(AlgoMode.c_str(), "WriteOnDB") == 0 || strcmp(AlgoMode.c_str(), "Merge") == 0) {
647  TH1::AddDirectory(kTRUE);
648 
649  TFile* file = nullptr;
650  for (unsigned int f = 0; f < VInputFiles.size(); f++) {
651  printf("Loading New Input File : %s\n", VInputFiles[f].c_str());
652  if (CheckIfFileExist) {
653  FILE* doesFileExist = fopen(VInputFiles[f].c_str(), "r");
654  if (!doesFileExist) {
655  printf("File %s doesn't exist\n", VInputFiles[f].c_str());
656  continue;
657  } else {
658  fclose(doesFileExist);
659  }
660  }
661  file = new TFile(VInputFiles[f].c_str());
662  if (!file || file->IsZombie()) {
663  printf("### Bug With File %s\n### File will be skipped \n", VInputFiles[f].c_str());
664  continue;
665  }
666  APV_Charge->Add((TH1*)file->FindObjectAny("APV_Charge"), 1);
667  APV_Momentum->Add((TH1*)file->FindObjectAny("APV_Momentum"), 1);
668  APV_PathLength->Add((TH1*)file->FindObjectAny("APV_PathLength"), 1);
669 
670  Tracks_P_Vs_Eta->Add((TH1*)file->FindObjectAny("Tracks_P_Vs_Eta"), 1);
671  Tracks_Pt_Vs_Eta->Add((TH1*)file->FindObjectAny("Tracks_Pt_Vs_Eta"), 1);
672 
673  Charge_Vs_PathTIB->Add((TH1*)file->FindObjectAny("Charge_Vs_PathTIB"), 1);
674  Charge_Vs_PathTID->Add((TH1*)file->FindObjectAny("Charge_Vs_PathTID"), 1);
675  Charge_Vs_PathTOB->Add((TH1*)file->FindObjectAny("Charge_Vs_PathTOB"), 1);
676  Charge_Vs_PathTEC->Add((TH1*)file->FindObjectAny("Charge_Vs_PathTEC"), 1);
677  Charge_Vs_PathTEC1->Add((TH1*)file->FindObjectAny("Charge_Vs_PathTEC1"), 1);
678  Charge_Vs_PathTEC2->Add((TH1*)file->FindObjectAny("Charge_Vs_PathTEC2"), 1);
679 
680  HTrackChi2OverNDF->Add((TH1*)file->FindObjectAny("TrackChi2OverNDF"), 1);
681  HTrackHits->Add((TH1*)file->FindObjectAny("TrackHits"), 1);
682 
683  NHighStripInCluster->Add((TH1*)file->FindObjectAny("NHighStripInCluster"), 1);
684  NSatStripInCluster->Add((TH1*)file->FindObjectAny("NSatStripInCluster"), 1);
685  Charge_Vs_PathLength->Add((TH1*)file->FindObjectAny("Charge_Vs_PathLength"), 1);
686  Charge_Vs_PathLength320->Add((TH1*)file->FindObjectAny("Charge_Vs_PathLength320"), 1);
687  Charge_Vs_PathLength500->Add((TH1*)file->FindObjectAny("Charge_Vs_PathLength500"), 1);
688  Charge_Vs_TransversAngle->Add((TH1*)file->FindObjectAny("Charge_Vs_TransversAngle"), 1);
689  NStrips_Vs_TransversAngle->Add((TH1*)file->FindObjectAny("NStrips_Vs_TransversAngle"), 1);
690  Charge_Vs_Alpha->Add((TH1*)file->FindObjectAny("Charge_Vs_Alpha"), 1);
691  NStrips_Vs_Alpha->Add((TH1*)file->FindObjectAny("NStrips_Vs_Alpha"), 1);
692  HFirstStrip->Add((TH1*)file->FindObjectAny("FirstStrip"), 1);
693 
694  TH1F* JobInfo_tmp = (TH1F*)file->FindObjectAny("JobInfo");
695  NEvent += (unsigned int)JobInfo_tmp->GetBinContent(JobInfo_tmp->GetXaxis()->FindBin(1));
696  unsigned int tmp_SRun = (unsigned int)JobInfo_tmp->GetBinContent(JobInfo_tmp->GetXaxis()->FindBin(3));
697  unsigned int tmp_SEvent = (unsigned int)JobInfo_tmp->GetBinContent(JobInfo_tmp->GetXaxis()->FindBin(4));
698  unsigned int tmp_ERun = (unsigned int)JobInfo_tmp->GetBinContent(JobInfo_tmp->GetXaxis()->FindBin(6));
699  unsigned int tmp_EEvent = (unsigned int)JobInfo_tmp->GetBinContent(JobInfo_tmp->GetXaxis()->FindBin(7));
700 
701  if (SRun == 0)
702  SRun = tmp_SRun;
703 
704  if (tmp_SRun < SRun) {
705  SRun = tmp_SRun;
706  SEvent = tmp_SEvent;
707  } else if (tmp_SRun == SRun && tmp_SEvent < SEvent) {
708  SEvent = tmp_SEvent;
709  }
710 
711  if (tmp_ERun > ERun) {
712  ERun = tmp_ERun;
713  EEvent = tmp_EEvent;
714  } else if (tmp_ERun == ERun && tmp_EEvent > EEvent) {
715  EEvent = tmp_EEvent;
716  }
717 
718  printf("Deleting Current Input File\n");
719  file->Close();
720  delete file;
721  }
722  }
723 
724  JobInfo->Fill(1, NEvent);
725  JobInfo->Fill(3, SRun);
726  JobInfo->Fill(4, SEvent);
727  JobInfo->Fill(6, ERun);
728  JobInfo->Fill(7, EEvent);
729 
730  if (strcmp(AlgoMode.c_str(), "MultiJob") != 0) {
731  TH1D* Proj = nullptr;
732  double FitResults[5];
733  I = 0;
734  for (auto it = APVsColl.begin(); it != APVsColl.end(); it++) {
735  if (I % 3650 == 0)
736  printf("Fitting Histograms \t %6.2f%%\n", (100.0 * I) / APVsColl.size());
737  I++;
738  stAPVGain* APV = it->second;
739 
740  int bin = APV_Charge->GetXaxis()->FindBin(APV->Index);
741  Proj = APV_Charge->ProjectionY(" ", bin, bin, "e");
742  Proj = (TH1D*)Proj->Clone();
743  if (Proj == nullptr)
744  continue;
745 
746  // ADD PROJECTTIONS COMMING FROM THE SECOND APV IN THE PAIR
747  if (CalibrationLevel == 1) {
748  int SecondAPVId = APV->APVId;
749  if (SecondAPVId % 2 == 0) {
750  SecondAPVId = SecondAPVId + 1;
751  } else {
752  SecondAPVId = SecondAPVId - 1;
753  }
754  stAPVGain* APV2 = APVsColl[(APV->DetId << 3) | SecondAPVId];
755 
756  int bin2 = APV_Charge->GetXaxis()->FindBin(APV2->Index);
757  TH1D* Proj2 = APV_Charge->ProjectionY(" ", bin2, bin2, "e");
758  if (Proj2 != nullptr) {
759  Proj->Add(Proj2, 1);
760  }
761  } else if (CalibrationLevel > 1) {
762  // printf("%8i %i--> %4.0f + %4.0f\n",APV->DetId, APV->APVId, 0.0, Proj->GetEntries());
763  for (auto it2 = APVsColl.begin(); it2 != APVsColl.end(); it2++) {
764  stAPVGain* APV2 = it2->second;
765 
766  if (APV2->DetId != APV->DetId)
767  continue;
768  if (APV2->APVId == APV->APVId)
769  continue;
770 
771  int bin2 = APV_Charge->GetXaxis()->FindBin(APV2->Index);
772  TH1D* Proj2 = APV_Charge->ProjectionY(" ", bin2, bin2, "e");
773  if (Proj2 != nullptr) {
774  // printf("%8i %i--> %4.0f + %4.0f\n",APV2->DetId, APV2->APVId, Proj->GetEntries(), Proj2->GetEntries());
775  Proj->Add(Proj2, 1);
776  }
777  }
778  // printf("%8i %i--> %4.0f Full\n",APV->DetId, APV->APVId, Proj->GetEntries());
779  }
780 
781  //std::cout << "Proj->GetEntries(): " << Proj->GetEntries() << ", Proj->GetMean(): " << Proj->GetMean() << std::endl;
782 
783  getPeakOfLandau(Proj, FitResults);
784  APV->MPV = FitResults[0];
785  // printf("MPV = %f - %f\n",FitResults[0], FitResults[1]);
786  if (FitResults[0] != -0.5 && FitResults[1] < MaxMPVError) {
787  APV_MPV->Fill(APV->Index, APV->MPV);
788  MPVs->Fill(APV->MPV);
789  if (APV->Thickness < 0.04)
790  MPVs320->Fill(APV->MPV);
791  if (APV->Thickness > 0.04)
792  MPVs500->Fill(APV->MPV);
793 
794  MPV_Vs_R->Fill(APV->R, APV->MPV);
795  MPV_Vs_Eta->Fill(APV->Eta, APV->MPV);
796  if (APV->SubDet == StripSubdetector::TIB)
797  MPV_Vs_EtaTIB->Fill(APV->Eta, APV->MPV);
798  if (APV->SubDet == StripSubdetector::TID)
799  MPV_Vs_EtaTID->Fill(APV->Eta, APV->MPV);
800  if (APV->SubDet == StripSubdetector::TOB)
801  MPV_Vs_EtaTOB->Fill(APV->Eta, APV->MPV);
802  if (APV->SubDet == StripSubdetector::TEC) {
803  MPV_Vs_EtaTEC->Fill(APV->Eta, APV->MPV);
804  if (APV->Thickness < 0.04)
805  MPV_Vs_EtaTEC1->Fill(APV->Eta, APV->MPV);
806  if (APV->Thickness > 0.04)
807  MPV_Vs_EtaTEC2->Fill(APV->Eta, APV->MPV);
808  }
809  MPV_Vs_Phi->Fill(APV->Phi, APV->MPV);
810  if (APV->SubDet == StripSubdetector::TIB)
811  MPV_Vs_PhiTIB->Fill(APV->Phi, APV->MPV);
812  if (APV->SubDet == StripSubdetector::TID)
813  MPV_Vs_PhiTID->Fill(APV->Phi, APV->MPV);
814  if (APV->SubDet == StripSubdetector::TOB)
815  MPV_Vs_PhiTOB->Fill(APV->Phi, APV->MPV);
816  if (APV->SubDet == StripSubdetector::TEC) {
817  MPV_Vs_PhiTEC->Fill(APV->Phi, APV->MPV);
818  if (APV->Thickness < 0.04)
819  MPV_Vs_PhiTEC1->Fill(APV->Phi, APV->MPV);
820  if (APV->Thickness > 0.04)
821  MPV_Vs_PhiTEC2->Fill(APV->Phi, APV->MPV);
822  }
823 
824  if (APV->SubDet == StripSubdetector::TIB)
825  Charge_TIB->Add(Proj, 1);
826  if (APV->SubDet == StripSubdetector::TID) {
827  Charge_TID->Add(Proj, 1);
828  if (APV->Side == 1)
829  Charge_TIDM->Add(Proj, 1);
830  if (APV->Side == 2)
831  Charge_TIDP->Add(Proj, 1);
832  }
833  if (APV->SubDet == StripSubdetector::TOB)
834  Charge_TOB->Add(Proj, 1);
835  if (APV->SubDet == StripSubdetector::TEC) {
836  Charge_TEC->Add(Proj, 1);
837  if (APV->Thickness < 0.04)
838  Charge_TEC1->Add(Proj, 1);
839  if (APV->Thickness > 0.04)
840  Charge_TEC2->Add(Proj, 1);
841  if (APV->Side == 1)
842  Charge_TECM->Add(Proj, 1);
843  if (APV->Side == 2)
844  Charge_TECP->Add(Proj, 1);
845  }
846  }
847 
848  if (APV->SubDet == StripSubdetector::TIB)
849  Charge_TIB->Add(Proj, 1);
850  if (APV->SubDet == StripSubdetector::TID) {
851  Charge_TID->Add(Proj, 1);
852  if (APV->Side == 1)
853  Charge_TIDM->Add(Proj, 1);
854  if (APV->Side == 2)
855  Charge_TIDP->Add(Proj, 1);
856  }
857  if (APV->SubDet == StripSubdetector::TOB)
858  Charge_TOB->Add(Proj, 1);
859  if (APV->SubDet == StripSubdetector::TEC) {
860  Charge_TEC->Add(Proj, 1);
861  if (APV->Thickness < 0.04)
862  Charge_TEC1->Add(Proj, 1);
863  if (APV->Thickness > 0.04)
864  Charge_TEC2->Add(Proj, 1);
865  if (APV->Side == 1)
866  Charge_TECM->Add(Proj, 1);
867  if (APV->Side == 2)
868  Charge_TECP->Add(Proj, 1);
869  }
870 
871  if (FitResults[0] != -0.5) {
872  HChi2OverNDF->Fill(FitResults[4]);
873  Error_Vs_MPV->Fill(FitResults[0], FitResults[1]);
874  Error_Vs_Entries->Fill(Proj->GetEntries(), FitResults[1]);
875  Error_Vs_Eta->Fill(APV->Eta, FitResults[1]);
876  Error_Vs_Phi->Fill(APV->Phi, FitResults[1]);
877  }
878  NumberOfEntriesByAPV->Fill(Proj->GetEntries());
879  delete Proj;
880 
881  Proj = APV_PathLength->ProjectionY(" ", bin, bin, "e");
882  if (Proj == nullptr)
883  continue;
884 
885  APV_PathLengthM->SetBinContent(APV->Index, Proj->GetMean(1));
886  APV_PathLengthM->SetBinError(APV->Index, Proj->GetMeanError(1));
887  // delete Proj;
888  }
889 
890  unsigned int GOOD = 0;
891  unsigned int BAD = 0;
892  double MPVmean = MPVs->GetMean();
893  MPVmean = 300;
894  for (auto it = APVsColl.begin(); it != APVsColl.end(); it++) {
895  stAPVGain* APV = it->second;
896  if (APV->MPV > 0) {
897  APV->Gain = APV->MPV / MPVmean; // APV->MPV;
898  GOOD++;
899  } else {
900  NoMPV_Vs_EtaPhi->Fill(APV->Eta, APV->Phi);
901  APV->Gain = 1;
902  BAD++;
903  }
904  if (APV->Gain <= 0)
905  APV->Gain = 1;
906  APV_Gain->Fill(APV->Index, APV->Gain);
907 
908  if (!FirstSetOfConstants)
909  APV->Gain *= APV->PreviousGain;
910  APV_CumulGain->Fill(APV->Index, APV->Gain);
911  }
912 
913  for (int j = 0; j < Charge_Vs_PathLength->GetXaxis()->GetNbins(); j++) {
914  Proj = Charge_Vs_PathLength->ProjectionY(" ", j, j, "e");
915  getPeakOfLandau(Proj, FitResults);
916  if (FitResults[0] == -0.5)
917  continue;
918  MPV_Vs_PathLength->SetBinContent(j, FitResults[0] / Charge_Vs_PathLength->GetXaxis()->GetBinCenter(j));
919  MPV_Vs_PathLength->SetBinError(j, FitResults[1] / Charge_Vs_PathLength->GetXaxis()->GetBinCenter(j));
920  FWHM_Vs_PathLength->SetBinContent(
921  j, FitResults[2] / (FitResults[0] / Charge_Vs_PathLength->GetXaxis()->GetBinCenter(j)));
922  FWHM_Vs_PathLength->SetBinError(
923  j, FitResults[3] / (FitResults[0] / Charge_Vs_PathLength->GetXaxis()->GetBinCenter(j)));
924  delete Proj;
925  }
926 
927  for (int j = 0; j < Charge_Vs_PathLength320->GetXaxis()->GetNbins(); j++) {
928  Proj = Charge_Vs_PathLength320->ProjectionY(" ", j, j, "e");
929  getPeakOfLandau(Proj, FitResults);
930  if (FitResults[0] == -0.5)
931  continue;
932  MPV_Vs_PathLength320->SetBinContent(j, FitResults[0] / Charge_Vs_PathLength320->GetXaxis()->GetBinCenter(j));
933  MPV_Vs_PathLength320->SetBinError(j, FitResults[1] / Charge_Vs_PathLength320->GetXaxis()->GetBinCenter(j));
934  FWHM_Vs_PathLength320->SetBinContent(
935  j, FitResults[2] / (FitResults[0] / Charge_Vs_PathLength320->GetXaxis()->GetBinCenter(j)));
936  FWHM_Vs_PathLength320->SetBinError(
937  j, FitResults[3] / (FitResults[0] / Charge_Vs_PathLength320->GetXaxis()->GetBinCenter(j)));
938  delete Proj;
939  }
940 
941  for (int j = 0; j < Charge_Vs_PathLength500->GetXaxis()->GetNbins(); j++) {
942  Proj = Charge_Vs_PathLength500->ProjectionY(" ", j, j, "e");
943  getPeakOfLandau(Proj, FitResults);
944  if (FitResults[0] == -0.5)
945  continue;
946  MPV_Vs_PathLength500->SetBinContent(j, FitResults[0] / Charge_Vs_PathLength500->GetXaxis()->GetBinCenter(j));
947  MPV_Vs_PathLength500->SetBinError(j, FitResults[1] / Charge_Vs_PathLength500->GetXaxis()->GetBinCenter(j));
948  FWHM_Vs_PathLength500->SetBinContent(
949  j, FitResults[2] / (FitResults[0] / Charge_Vs_PathLength500->GetXaxis()->GetBinCenter(j)));
950  FWHM_Vs_PathLength500->SetBinError(
951  j, FitResults[3] / (FitResults[0] / Charge_Vs_PathLength500->GetXaxis()->GetBinCenter(j)));
952  delete Proj;
953  }
954  /*
955  for(int j=0;j<Charge_Vs_PathLength_CS1->GetXaxis()->GetNbins();j++){
956  Proj = Charge_Vs_PathLength_CS1->ProjectionY(" ",j,j,"e");
957  getPeakOfLandau(Proj,FitResults); if(FitResults[0] ==-0.5)continue;
958  MPV_Vs_PathLength_CS1->SetBinContent (j, FitResults[0]/Charge_Vs_PathLength_CS1->GetXaxis()->GetBinCenter(j));
959  MPV_Vs_PathLength_CS1->SetBinError (j, FitResults[1]/Charge_Vs_PathLength_CS1->GetXaxis()->GetBinCenter(j));
960  FWHM_Vs_PathLength_CS1->SetBinContent(j, FitResults[2]/(FitResults[0]/Charge_Vs_PathLength_CS1->GetXaxis()->GetBinCenter(j) ));
961  FWHM_Vs_PathLength_CS1->SetBinError (j, FitResults[3]/(FitResults[0]/Charge_Vs_PathLength_CS1->GetXaxis()->GetBinCenter(j) ));
962  delete Proj;
963  }
964 
965  for(int j=0;j<Charge_Vs_PathLength_CS2->GetXaxis()->GetNbins();j++){
966  Proj = Charge_Vs_PathLength_CS2->ProjectionY(" ",j,j,"e");
967  getPeakOfLandau(Proj,FitResults); if(FitResults[0] ==-0.5)continue;
968  MPV_Vs_PathLength_CS2->SetBinContent (j, FitResults[0]/Charge_Vs_PathLength_CS2->GetXaxis()->GetBinCenter(j));
969  MPV_Vs_PathLength_CS2->SetBinError (j, FitResults[1]/Charge_Vs_PathLength_CS2->GetXaxis()->GetBinCenter(j));
970  FWHM_Vs_PathLength_CS2->SetBinContent(j, FitResults[2]/(FitResults[0]/Charge_Vs_PathLength_CS2->GetXaxis()->GetBinCenter(j) ));
971  FWHM_Vs_PathLength_CS2->SetBinError (j, FitResults[3]/(FitResults[0]/Charge_Vs_PathLength_CS2->GetXaxis()->GetBinCenter(j) ));
972  delete Proj;
973  }
974 
975  for(int j=0;j<Charge_Vs_PathLength_CS3->GetXaxis()->GetNbins();j++){
976  Proj = Charge_Vs_PathLength_CS3->ProjectionY(" ",j,j,"e");
977  getPeakOfLandau(Proj,FitResults); if(FitResults[0] ==-0.5)continue;
978  MPV_Vs_PathLength_CS3->SetBinContent (j, FitResults[0]/Charge_Vs_PathLength_CS3->GetXaxis()->GetBinCenter(j));
979  MPV_Vs_PathLength_CS3->SetBinError (j, FitResults[1]/Charge_Vs_PathLength_CS3->GetXaxis()->GetBinCenter(j));
980  FWHM_Vs_PathLength_CS3->SetBinContent(j, FitResults[2]/(FitResults[0]/Charge_Vs_PathLength_CS3->GetXaxis()->GetBinCenter(j) ));
981  FWHM_Vs_PathLength_CS3->SetBinError (j, FitResults[3]/(FitResults[0]/Charge_Vs_PathLength_CS3->GetXaxis()->GetBinCenter(j) ));
982  delete Proj;
983  }
984 
985  for(int j=0;j<Charge_Vs_PathLength_CS4->GetXaxis()->GetNbins();j++){
986  Proj = Charge_Vs_PathLength_CS4->ProjectionY(" ",j,j,"e");
987  getPeakOfLandau(Proj,FitResults); if(FitResults[0] ==-0.5)continue;
988  MPV_Vs_PathLength_CS4->SetBinContent (j, FitResults[0]/Charge_Vs_PathLength_CS4->GetXaxis()->GetBinCenter(j));
989  MPV_Vs_PathLength_CS4->SetBinError (j, FitResults[1]/Charge_Vs_PathLength_CS4->GetXaxis()->GetBinCenter(j));
990  FWHM_Vs_PathLength_CS4->SetBinContent(j, FitResults[2]/(FitResults[0]/Charge_Vs_PathLength_CS4->GetXaxis()->GetBinCenter(j) ));
991  FWHM_Vs_PathLength_CS4->SetBinError (j, FitResults[3]/(FitResults[0]/Charge_Vs_PathLength_CS4->GetXaxis()->GetBinCenter(j) ));
992  delete Proj;
993  }
994 
995  for(int j=0;j<Charge_Vs_PathLength_CS5->GetXaxis()->GetNbins();j++){
996  Proj = Charge_Vs_PathLength_CS5->ProjectionY(" ",j,j,"e");
997  getPeakOfLandau(Proj,FitResults); if(FitResults[0] ==-0.5)continue;
998  MPV_Vs_PathLength_CS5->SetBinContent (j, FitResults[0]/Charge_Vs_PathLength_CS5->GetXaxis()->GetBinCenter(j));
999  MPV_Vs_PathLength_CS5->SetBinError (j, FitResults[1]/Charge_Vs_PathLength_CS5->GetXaxis()->GetBinCenter(j));
1000  FWHM_Vs_PathLength_CS5->SetBinContent(j, FitResults[2]/(FitResults[0]/Charge_Vs_PathLength_CS5->GetXaxis()->GetBinCenter(j) ));
1001  FWHM_Vs_PathLength_CS5->SetBinError (j, FitResults[3]/(FitResults[0]/Charge_Vs_PathLength_CS5->GetXaxis()->GetBinCenter(j) ));
1002  delete Proj;
1003  }
1004 */
1005 
1006  for (int j = 0; j < Charge_Vs_PathTIB->GetXaxis()->GetNbins(); j++) {
1007  Proj = Charge_Vs_PathTIB->ProjectionY(" ", j, j, "e");
1008  getPeakOfLandau(Proj, FitResults);
1009  if (FitResults[0] == -0.5)
1010  continue;
1011  MPV_Vs_PathTIB->SetBinContent(j, FitResults[0] / Charge_Vs_PathTIB->GetXaxis()->GetBinCenter(j));
1012  MPV_Vs_PathTIB->SetBinError(j, FitResults[1] / Charge_Vs_PathTIB->GetXaxis()->GetBinCenter(j));
1013  delete Proj;
1014  }
1015 
1016  for (int j = 0; j < Charge_Vs_PathTID->GetXaxis()->GetNbins(); j++) {
1017  Proj = Charge_Vs_PathTID->ProjectionY(" ", j, j, "e");
1018  getPeakOfLandau(Proj, FitResults);
1019  if (FitResults[0] == -0.5)
1020  continue;
1021  MPV_Vs_PathTID->SetBinContent(j, FitResults[0] / Charge_Vs_PathTID->GetXaxis()->GetBinCenter(j));
1022  MPV_Vs_PathTID->SetBinError(j, FitResults[1] / Charge_Vs_PathTID->GetXaxis()->GetBinCenter(j));
1023  delete Proj;
1024  }
1025 
1026  for (int j = 0; j < Charge_Vs_PathTOB->GetXaxis()->GetNbins(); j++) {
1027  Proj = Charge_Vs_PathTOB->ProjectionY(" ", j, j, "e");
1028  getPeakOfLandau(Proj, FitResults);
1029  if (FitResults[0] == -0.5)
1030  continue;
1031  MPV_Vs_PathTOB->SetBinContent(j, FitResults[0] / Charge_Vs_PathTOB->GetXaxis()->GetBinCenter(j));
1032  MPV_Vs_PathTOB->SetBinError(j, FitResults[1] / Charge_Vs_PathTOB->GetXaxis()->GetBinCenter(j));
1033  delete Proj;
1034  }
1035 
1036  for (int j = 0; j < Charge_Vs_PathTEC->GetXaxis()->GetNbins(); j++) {
1037  Proj = Charge_Vs_PathTEC->ProjectionY(" ", j, j, "e");
1038  getPeakOfLandau(Proj, FitResults);
1039  if (FitResults[0] == -0.5)
1040  continue;
1041  MPV_Vs_PathTEC->SetBinContent(j, FitResults[0] / Charge_Vs_PathTEC->GetXaxis()->GetBinCenter(j));
1042  MPV_Vs_PathTEC->SetBinError(j, FitResults[1] / Charge_Vs_PathTEC->GetXaxis()->GetBinCenter(j));
1043  delete Proj;
1044  }
1045 
1046  for (int j = 0; j < Charge_Vs_PathTEC1->GetXaxis()->GetNbins(); j++) {
1047  Proj = Charge_Vs_PathTEC1->ProjectionY(" ", j, j, "e");
1048  getPeakOfLandau(Proj, FitResults);
1049  if (FitResults[0] == -0.5)
1050  continue;
1051  MPV_Vs_PathTEC1->SetBinContent(j, FitResults[0] / Charge_Vs_PathTEC1->GetXaxis()->GetBinCenter(j));
1052  MPV_Vs_PathTEC1->SetBinError(j, FitResults[1] / Charge_Vs_PathTEC1->GetXaxis()->GetBinCenter(j));
1053  delete Proj;
1054  }
1055 
1056  for (int j = 0; j < Charge_Vs_PathTEC2->GetXaxis()->GetNbins(); j++) {
1057  Proj = Charge_Vs_PathTEC2->ProjectionY(" ", j, j, "e");
1058  getPeakOfLandau(Proj, FitResults);
1059  if (FitResults[0] == -0.5)
1060  continue;
1061  MPV_Vs_PathTEC2->SetBinContent(j, FitResults[0] / Charge_Vs_PathTEC2->GetXaxis()->GetBinCenter(j));
1062  MPV_Vs_PathTEC2->SetBinError(j, FitResults[1] / Charge_Vs_PathTEC2->GetXaxis()->GetBinCenter(j));
1063  delete Proj;
1064  }
1065 
1066  for (int j = 1; j < Charge_Vs_TransversAngle->GetXaxis()->GetNbins(); j++) {
1067  Proj = Charge_Vs_TransversAngle->ProjectionY(" ", j, j, "e");
1068  getPeakOfLandau(Proj, FitResults);
1069  if (FitResults[0] == -0.5)
1070  continue;
1071  MPV_Vs_TransversAngle->SetBinContent(j, FitResults[0]);
1072  MPV_Vs_TransversAngle->SetBinError(j, FitResults[1]);
1073  delete Proj;
1074  }
1075 
1076  for (int j = 1; j < Charge_Vs_Alpha->GetXaxis()->GetNbins(); j++) {
1077  Proj = Charge_Vs_Alpha->ProjectionY(" ", j, j, "e");
1078  getPeakOfLandau(Proj, FitResults);
1079  if (FitResults[0] == -0.5)
1080  continue;
1081  MPV_Vs_Alpha->SetBinContent(j, FitResults[0]);
1082  MPV_Vs_Alpha->SetBinError(j, FitResults[1]);
1083  delete Proj;
1084  }
1085 
1086  for (int j = 1; j < Charge_Vs_Beta->GetXaxis()->GetNbins(); j++) {
1087  Proj = Charge_Vs_Beta->ProjectionY(" ", j, j, "e");
1088  getPeakOfLandau(Proj, FitResults);
1089  if (FitResults[0] == -0.5)
1090  continue;
1091  MPV_Vs_Beta->SetBinContent(j, FitResults[0]);
1092  MPV_Vs_Beta->SetBinError(j, FitResults[1]);
1093  delete Proj;
1094  }
1095 
1096  FILE* Gains = fopen(OutputGains.c_str(), "w");
1097  fprintf(Gains, "NEvents = %i\n", NEvent);
1098  fprintf(Gains, "Number of APVs = %lu\n", static_cast<unsigned long>(APVsColl.size()));
1099  fprintf(Gains, "GoodFits = %i BadFits = %i ratio = %f\n", GOOD, BAD, (100.0 * GOOD) / (GOOD + BAD));
1100  for (std::vector<stAPVGain*>::iterator it = APVsCollOrdered.begin(); it != APVsCollOrdered.end(); it++) {
1101  stAPVGain* APV = *it;
1102  fprintf(Gains,
1103  "%i | %i | PreviousGain = %7.5f NewGain = %7.5f\n",
1104  APV->DetId,
1105  APV->APVId,
1106  APV->PreviousGain,
1107  APV->Gain);
1108  }
1109 
1110  std::vector<int> DetIdOfBuggedAPV;
1111  fprintf(Gains, "----------------------------------------------------------------------\n");
1112  for (std::vector<stAPVGain*>::iterator it = APVsCollOrdered.begin(); it != APVsCollOrdered.end(); it++) {
1113  stAPVGain* APV = *it;
1114  if (APV->MPV > 0 && APV->MPV < 200) {
1115  bool tmpBug = false;
1116  for (unsigned int b = 0; b < DetIdOfBuggedAPV.size() && !tmpBug; b++) {
1117  if (DetIdOfBuggedAPV[b] == APV->DetId)
1118  tmpBug = true;
1119  }
1120  if (!tmpBug) {
1121  fprintf(Gains, "%i,\n", APV->DetId);
1122  DetIdOfBuggedAPV.push_back(APV->DetId);
1123  }
1124  }
1125  }
1126 
1127  fclose(Gains);
1128 
1129  // delete [] FitResults;
1130  // delete Proj;
1131  }
1132 
1133  dqmStore_->cd();
1135 }
1136 
1138  edm::ESHandle<SiStripGain> gainHandle;
1139  if ((strcmp(AlgoMode.c_str(), "MultiJob") != 0 && !FirstSetOfConstants) || Validation) {
1140  iSetup.get<SiStripGainRcd>().get(gainHandle);
1141  if (!gainHandle.isValid()) {
1142  printf("\n#####################\n\nERROR --> gainHandle is not valid\n\n#####################\n\n");
1143  exit(0);
1144  }
1145 
1146  for (std::vector<stAPVGain*>::iterator it = APVsCollOrdered.begin(); it != APVsCollOrdered.end(); it++) {
1147  stAPVGain* APV = *it;
1148 
1149  if (gainHandle.isValid()) {
1150  SiStripApvGain::Range detGainRange = gainHandle->getRange(APV->DetId);
1151  APV->PreviousGain = *(detGainRange.first + APV->APVId);
1152  // APV_PrevGain->Fill(APV->Index,APV->PreviousGain);
1153  APV_PrevGain->SetBinContent(APV_PrevGain->GetXaxis()->FindBin(APV->Index), APV->PreviousGain);
1154  if (APV->PreviousGain < 0)
1155  APV->PreviousGain = 1;
1156  } else {
1157  printf("GAIN HANDLE IS NOT VALID\n");
1158  }
1159  }
1160  }
1161 }
1162 
1164  if (strcmp(AlgoMode.c_str(), "WriteOnDB") == 0)
1165  return;
1166 
1167  if (NEvent == 0) {
1168  SRun = iEvent.id().run();
1169  SEvent = iEvent.id().event();
1170  STimestamp = iEvent.time().value();
1171  }
1172  ERun = iEvent.id().run();
1173  EEvent = iEvent.id().event();
1174  ETimestamp = iEvent.time().value();
1175  NEvent++;
1176 
1177  iEvent_ = &iEvent;
1178 
1179  Handle<TrajTrackAssociationCollection> trajTrackAssociationHandle;
1180  iEvent.getByLabel(TrajToTrackProducer, TrajToTrackLabel, trajTrackAssociationHandle);
1181  const TrajTrackAssociationCollection TrajToTrackMap = *trajTrackAssociationHandle.product();
1182 
1183  for (TrajTrackAssociationCollection::const_iterator it = TrajToTrackMap.begin(); it != TrajToTrackMap.end(); ++it) {
1184  const Track track = *it->val;
1185  const Trajectory traj = *it->key;
1186 
1187  if (track.p() < MinTrackMomentum || track.p() > MaxTrackMomentum || track.eta() < MinTrackEta ||
1188  track.eta() > MaxTrackEta)
1189  continue;
1190 
1191  Tracks_Pt_Vs_Eta->Fill(fabs(track.eta()), track.pt());
1192  Tracks_P_Vs_Eta->Fill(fabs(track.eta()), track.p());
1193 
1194  //BEGIN TO COMPUTE NDOF FOR TRACKS NO IMPLEMENTED BEFORE 200pre3
1195  int ndof = 0;
1196  const Trajectory::RecHitContainer transRecHits = traj.recHits();
1197 
1198  for (Trajectory::RecHitContainer::const_iterator rechit = transRecHits.begin(); rechit != transRecHits.end();
1199  ++rechit)
1200  if ((*rechit)->isValid())
1201  ndof += (*rechit)->dimension();
1202  ndof -= 5;
1203  //END TO COMPUTE NDOF FOR TRACKS NO IMPLEMENTED BEFORE 200pre3
1204 
1205  HTrackChi2OverNDF->Fill(traj.chiSquared() / ndof);
1206  if (traj.chiSquared() / ndof > MaxTrackChiOverNdf)
1207  continue;
1208 
1209  vector<TrajectoryMeasurement> measurements = traj.measurements();
1210  HTrackHits->Fill(traj.foundHits());
1211  if (traj.foundHits() < (int)MinTrackHits)
1212  continue;
1213  /*
1214  //BEGIN TO COMPUTE #MATCHEDRECHIT IN THE TRACK
1215  int NMatchedHit = 0;
1216  for(vector<TrajectoryMeasurement>::const_iterator measurement_it = measurements.begin(); measurement_it!=measurements.end(); measurement_it++){
1217  TrajectoryStateOnSurface trajState = measurement_it->updatedState();
1218  if( !trajState.isValid() ) continue;
1219  const TrackingRecHit* hit = (*measurement_it->recHit()).hit();
1220  const SiStripMatchedRecHit2D* sistripmatchedhit = dynamic_cast<const SiStripMatchedRecHit2D*>(hit);
1221  if(sistripmatchedhit)NMatchedHit++;
1222 // NMatchedHit++;
1223 
1224  }
1225  //END TO COMPUTE #MATCHEDRECHIT IN THE TRACK
1226 
1227  if(NMatchedHit<2){
1228  printf("NOT ENOUGH MATCHED RECHITS : %i\n",NMatchedHit);
1229  continue;
1230  }
1231 */
1232 
1233  for (vector<TrajectoryMeasurement>::const_iterator measurement_it = measurements.begin();
1234  measurement_it != measurements.end();
1235  measurement_it++) {
1236  TrajectoryStateOnSurface trajState = measurement_it->updatedState();
1237  if (!trajState.isValid())
1238  continue;
1239 
1240  const TrackingRecHit* hit = (*measurement_it->recHit()).hit();
1241  const SiStripRecHit1D* sistripsimple1dhit = dynamic_cast<const SiStripRecHit1D*>(hit);
1242  const SiStripRecHit2D* sistripsimplehit = dynamic_cast<const SiStripRecHit2D*>(hit);
1243  const SiStripMatchedRecHit2D* sistripmatchedhit = dynamic_cast<const SiStripMatchedRecHit2D*>(hit);
1244 
1245  if (sistripsimplehit) {
1247  (sistripsimplehit->cluster()).get(), trajState, &iSetup, &track, traj.chiSquared() / ndof);
1248  } else if (sistripmatchedhit) {
1249  ComputeChargeOverPath(&sistripmatchedhit->monoCluster(), trajState, &iSetup, &track, traj.chiSquared() / ndof);
1251  &sistripmatchedhit->stereoCluster(), trajState, &iSetup, &track, traj.chiSquared() / ndof);
1252  } else if (sistripsimple1dhit) {
1254  (sistripsimple1dhit->cluster()).get(), trajState, &iSetup, &track, traj.chiSquared() / ndof);
1255  } else {
1256  }
1257  }
1258  }
1259 }
1260 
1262  TrajectoryStateOnSurface trajState,
1263  const edm::EventSetup* iSetup,
1264  const Track* track,
1265  double trajChi2OverN) {
1266  LocalVector trackDirection = trajState.localDirection();
1267  double cosine = trackDirection.z() / trackDirection.mag();
1268  auto const& Ampls = Cluster->amplitudes();
1269  uint32_t DetId = 0; // is 0 since long time Cluster->geographicalId();
1270  int FirstStrip = Cluster->firstStrip();
1271  int APVId = FirstStrip / 128;
1272  stAPVGain* APV = APVsColl[(DetId << 3) | APVId];
1273  int Saturation = 0;
1274  bool Overlaping = false;
1275  int Charge = 0;
1276  unsigned int NHighStrip = 0;
1277 
1278  if (!IsFarFromBorder(trajState, DetId, iSetup))
1279  return -1;
1280 
1281  if (FirstStrip == 0)
1282  Overlaping = true;
1283  if (FirstStrip == 128)
1284  Overlaping = true;
1285  if (FirstStrip == 256)
1286  Overlaping = true;
1287  if (FirstStrip == 384)
1288  Overlaping = true;
1289  if (FirstStrip == 512)
1290  Overlaping = true;
1291  if (FirstStrip == 640)
1292  Overlaping = true;
1293 
1294  if (FirstStrip <= 127 && FirstStrip + Ampls.size() > 127)
1295  Overlaping = true;
1296  if (FirstStrip <= 255 && FirstStrip + Ampls.size() > 255)
1297  Overlaping = true;
1298  if (FirstStrip <= 383 && FirstStrip + Ampls.size() > 383)
1299  Overlaping = true;
1300  if (FirstStrip <= 511 && FirstStrip + Ampls.size() > 511)
1301  Overlaping = true;
1302  if (FirstStrip <= 639 && FirstStrip + Ampls.size() > 639)
1303  Overlaping = true;
1304 
1305  if (FirstStrip + Ampls.size() == 127)
1306  Overlaping = true;
1307  if (FirstStrip + Ampls.size() == 255)
1308  Overlaping = true;
1309  if (FirstStrip + Ampls.size() == 383)
1310  Overlaping = true;
1311  if (FirstStrip + Ampls.size() == 511)
1312  Overlaping = true;
1313  if (FirstStrip + Ampls.size() == 639)
1314  Overlaping = true;
1315  if (FirstStrip + Ampls.size() == 767)
1316  Overlaping = true;
1317  if (Overlaping)
1318  return -1;
1319 
1320  /*
1321  if(FirstStrip==0 )Overlaping=true;
1322  if(FirstStrip<=255 && FirstStrip+Ampls.size()>255)Overlaping=true;
1323  if(FirstStrip<=511 && FirstStrip+Ampls.size()>511)Overlaping=true;
1324  if(FirstStrip+Ampls.size()==511 )Overlaping=true;
1325  if(FirstStrip+Ampls.size()==767 )Overlaping=true;
1326  if(Overlaping)return -1;
1327 */
1328 
1329  for (unsigned int a = 0; a < Ampls.size(); a++) {
1330  Charge += Ampls[a];
1331  if (Ampls[a] >= 254)
1332  Saturation++;
1333  if (Ampls[a] >= 20)
1334  NHighStrip++;
1335  }
1336  double path = (10.0 * APV->Thickness) / fabs(cosine);
1337  double ClusterChargeOverPath = (double)Charge / path;
1338 
1339  NSatStripInCluster->Fill(Saturation);
1340 
1341  if (Ampls.size() > MaxNrStrips)
1342  return -1;
1343  if (Saturation > 0 && !AllowSaturation)
1344  return -1;
1346  if (APV->Thickness < 0.04)
1348  if (APV->Thickness > 0.04)
1350  if (APV->SubDet == StripSubdetector::TIB)
1351  Charge_Vs_PathTIB->Fill(path, Charge);
1352  if (APV->SubDet == StripSubdetector::TID)
1353  Charge_Vs_PathTID->Fill(path, Charge);
1354  if (APV->SubDet == StripSubdetector::TOB)
1355  Charge_Vs_PathTOB->Fill(path, Charge);
1356  if (APV->SubDet == StripSubdetector::TEC) {
1357  Charge_Vs_PathTEC->Fill(path, Charge);
1358  if (APV->Thickness < 0.04)
1359  Charge_Vs_PathTEC1->Fill(path, Charge);
1360  if (APV->Thickness > 0.04)
1361  Charge_Vs_PathTEC2->Fill(path, Charge);
1362  }
1363 
1364  double trans = atan2(trackDirection.y(), trackDirection.x()) * (180 / 3.14159265);
1365  double alpha =
1366  acos(trackDirection.x() / sqrt(pow(trackDirection.x(), 2) + pow(trackDirection.z(), 2))) * (180 / 3.14159265);
1367  double beta =
1368  acos(trackDirection.y() / sqrt(pow(trackDirection.x(), 2) + pow(trackDirection.z(), 2))) * (180 / 3.14159265);
1369 
1370  if (path > 0.4 && path < 0.45) {
1371  Charge_Vs_TransversAngle->Fill(trans, Charge / path);
1372  Charge_Vs_Alpha->Fill(alpha, Charge / path);
1373  Charge_Vs_Beta->Fill(beta, Charge / path);
1374  }
1375 
1376  NStrips_Vs_TransversAngle->Fill(trans, Ampls.size());
1377  NStrips_Vs_Alpha->Fill(alpha, Ampls.size());
1378  NStrips_Vs_Beta->Fill(beta, Ampls.size());
1379 
1380  NHighStripInCluster->Fill(NHighStrip);
1381  // if(NHighStrip==1) Charge_Vs_PathLength_CS1->Fill(path, Charge );
1382  // if(NHighStrip==2) Charge_Vs_PathLength_CS2->Fill(path, Charge );
1383  // if(NHighStrip==3) Charge_Vs_PathLength_CS3->Fill(path, Charge );
1384  // if(NHighStrip==4) Charge_Vs_PathLength_CS4->Fill(path, Charge );
1385  // if(NHighStrip==5) Charge_Vs_PathLength_CS5->Fill(path, Charge );
1386 
1387  HFirstStrip->Fill(FirstStrip);
1388 
1389  if (Validation) {
1390  ClusterChargeOverPath = ClusterChargeOverPath / APV->PreviousGain;
1391  }
1392 
1393  APV_Charge->Fill(APV->Index, ClusterChargeOverPath);
1394  APV_Momentum->Fill(APV->Index, trajState.globalMomentum().mag());
1395  APV_PathLength->Fill(APV->Index, path);
1396 
1397  return ClusterChargeOverPath;
1398 }
1399 
1401  const uint32_t detid,
1402  const edm::EventSetup* iSetup) {
1404  iSetup->get<TrackerDigiGeometryRecord>().get(tkGeom);
1405 
1406  LocalPoint HitLocalPos = trajState.localPosition();
1407  LocalError HitLocalError = trajState.localError().positionError();
1408 
1409  const GeomDetUnit* it = tkGeom->idToDetUnit(DetId(detid));
1410  if (dynamic_cast<const StripGeomDetUnit*>(it) == nullptr && dynamic_cast<const PixelGeomDetUnit*>(it) == nullptr) {
1411  std::cout << "this detID doesn't seem to belong to the Tracker" << std::endl;
1412  return false;
1413  }
1414 
1415  const BoundPlane plane = it->surface();
1416  const TrapezoidalPlaneBounds* trapezoidalBounds(dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
1417  const RectangularPlaneBounds* rectangularBounds(dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));
1418 
1419  double DistFromBorder = 1.0;
1420  //double HalfWidth = it->surface().bounds().width() /2.0;
1421  double HalfLength = it->surface().bounds().length() / 2.0;
1422 
1423  if (trapezoidalBounds) {
1424  std::array<const float, 4> const& parameters = (*trapezoidalBounds).parameters();
1425  HalfLength = parameters[3];
1426  //double t = (HalfLength + HitLocalPos.y()) / (2*HalfLength) ;
1427  //HalfWidth = parameters[0] + (parameters[1]-parameters[0]) * t;
1428  } else if (rectangularBounds) {
1429  //HalfWidth = it->surface().bounds().width() /2.0;
1430  HalfLength = it->surface().bounds().length() / 2.0;
1431  } else {
1432  return false;
1433  }
1434 
1435  // if (fabs(HitLocalPos.x())+HitLocalError.xx() >= (HalfWidth - DistFromBorder) ) return false;//Don't think is really necessary
1436  if (fabs(HitLocalPos.y()) + HitLocalError.yy() >= (HalfLength - DistFromBorder))
1437  return false;
1438 
1439  return true;
1440 }
1441 
1442 void SiStripGainFromData::getPeakOfLandau(TH1* InputHisto, double* FitResults, double LowRange, double HighRange) {
1443  double adcs = -0.5;
1444  double adcs_err = 0.;
1445  double width = -0.5;
1446  double width_err = 0;
1447  double chi2overndf = -0.5;
1448 
1449  double nr_of_entries = InputHisto->GetEntries();
1450 
1451  if ((unsigned int)nr_of_entries < MinNrEntries) {
1452  FitResults[0] = adcs;
1453  FitResults[1] = adcs_err;
1454  FitResults[2] = width;
1455  FitResults[3] = width_err;
1456  FitResults[4] = chi2overndf;
1457  return;
1458  }
1459 
1460  // perform fit with standard landau
1461  TF1* MyLandau = new TF1("MyLandau", "landau", LowRange, HighRange);
1462  MyLandau->SetParameter("MPV", 300);
1463 
1464  InputHisto->Fit(MyLandau, "QR WW");
1465 
1466  // MPV is parameter 1 (0=constant, 1=MPV, 2=Sigma)
1467  adcs = MyLandau->GetParameter("MPV");
1468  adcs_err = MyLandau->GetParError(1);
1469  width = MyLandau->GetParameter(2);
1470  width_err = MyLandau->GetParError(2);
1471  chi2overndf = MyLandau->GetChisquare() / MyLandau->GetNDF();
1472 
1473  // if still wrong, give up
1474  if (adcs < 2. || chi2overndf > MaxChi2OverNDF) {
1475  adcs = -0.5;
1476  adcs_err = 0.;
1477  width = -0.5;
1478  width_err = 0;
1479  chi2overndf = -0.5;
1480  }
1481 
1482  FitResults[0] = adcs;
1483  FitResults[1] = adcs_err;
1484  FitResults[2] = width;
1485  FitResults[3] = width_err;
1486  FitResults[4] = chi2overndf;
1487 
1488  delete MyLandau;
1489 }
1490 
1491 std::unique_ptr<SiStripApvGain> SiStripGainFromData::getNewObject() {
1492  cout << "START getNewObject\n";
1493 
1494  // if( !(strcmp(AlgoMode.c_str(),"WriteOnDB")==0 || strcmp(AlgoMode.c_str(),"SingleJob")==0) )return NULL;
1495  if (!(strcmp(AlgoMode.c_str(), "WriteOnDB") == 0 || strcmp(AlgoMode.c_str(), "SingleJob") == 0))
1496  return std::make_unique<SiStripApvGain>();
1497 
1498  auto obj = std::make_unique<SiStripApvGain>();
1499  std::vector<float>* theSiStripVector = nullptr;
1500  int PreviousDetId = -1;
1501  for (unsigned int a = 0; a < APVsCollOrdered.size(); a++) {
1503  if (APV == nullptr) {
1504  printf("Bug\n");
1505  continue;
1506  }
1507  if (APV->DetId != PreviousDetId) {
1508  if (theSiStripVector != nullptr) {
1509  SiStripApvGain::Range range(theSiStripVector->begin(), theSiStripVector->end());
1510  if (!obj->put(PreviousDetId, range))
1511  printf("Bug to put detId = %i\n", PreviousDetId);
1512  }
1513 
1514  theSiStripVector = new std::vector<float>;
1515  PreviousDetId = APV->DetId;
1516  }
1517  printf("%i | %i | PreviousGain = %7.5f NewGain = %7.5f\n", APV->DetId, APV->APVId, APV->PreviousGain, APV->Gain);
1518  theSiStripVector->push_back(APV->Gain);
1519  // theSiStripVector->push_back(APV->Gain);
1520  }
1521 
1522  if (theSiStripVector != nullptr) {
1523  SiStripApvGain::Range range(theSiStripVector->begin(), theSiStripVector->end());
1524  if (!obj->put(PreviousDetId, range))
1525  printf("Bug to put detId = %i\n", PreviousDetId);
1526  }
1527 
1528  cout << "END getNewObject\n";
1529  return obj;
1530 }
1531 
Vector3DBase< float, LocalTag >
SiStripGainFromData::FirstSetOfConstants
bool FirstSetOfConstants
Definition: SiStripGainFromData.cc:129
SiStripGainFromData::Charge_Vs_Alpha
TH2F * Charge_Vs_Alpha
Definition: SiStripGainFromData.cc:255
SiStripGainFromData::CheckLocalAngle
bool CheckLocalAngle
Definition: SiStripGainFromData.cc:117
SiStripGainFromData::Charge_Vs_PathTEC1
TH2F * Charge_Vs_PathTEC1
Definition: SiStripGainFromData.cc:170
FEDNumbering.h
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
SiStripGainFromData::CalibrationLevel
int CalibrationLevel
Definition: SiStripGainFromData.cc:131
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
SiStripGainRcd
Definition: SiStripDependentRecords.h:29
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
SiStripRecHit2D::cluster
ClusterRef cluster() const
Definition: SiStripRecHit2D.h:22
stAPVGain::APVId
int APVId
Definition: SiStripGainFromData.cc:76
SiStripGainFromData::Charge_TID
TH1F * Charge_TID
Definition: SiStripGainFromData.cc:181
mps_fire.i
i
Definition: mps_fire.py:355
ProducerES_cfi.HalfLength
HalfLength
Definition: ProducerES_cfi.py:87
SiStripGainFromData::MaxMPVError
double MaxMPVError
Definition: SiStripGainFromData.cc:119
SiStripGainFromData::MPV_Vs_PathLength
TH1F * MPV_Vs_PathLength
Definition: SiStripGainFromData.cc:243
SiStripGainFromData::VInputFiles
vector< string > VInputFiles
Definition: SiStripGainFromData.cc:140
SiStripGainFromData::NStrips_Vs_Beta
TH2F * NStrips_Vs_Beta
Definition: SiStripGainFromData.cc:261
StripGeomDetUnit.h
MessageLogger.h
TrackerGeometry.h
GeomDet
Definition: GeomDet.h:27
SiStripGainFromData::FWHM_Vs_PathLength
TH1F * FWHM_Vs_PathLength
Definition: SiStripGainFromData.cc:247
edm::Handle::product
T const * product() const
Definition: Handle.h:70
SiStripGainFromData::Charge_TOB
TH1F * Charge_TOB
Definition: SiStripGainFromData.cc:184
SiStripGainFromData::algoBeginRun
void algoBeginRun(const edm::Run &, const edm::EventSetup &) override
Definition: SiStripGainFromData.cc:1137
SiStripGainFromData::SRun
unsigned int SRun
Definition: SiStripGainFromData.cc:278
SiStripGainFromData::MinNrEntries
unsigned int MinNrEntries
Definition: SiStripGainFromData.cc:118
SiStripGainFromData::getPeakOfLandau
void getPeakOfLandau(TH1 *InputHisto, double *FitResults, double LowRange=0, double HighRange=5400)
Definition: SiStripGainFromData.cc:1442
SiStripGainFromData::APVsCollOrdered
std::vector< stAPVGain * > APVsCollOrdered
Definition: SiStripGainFromData.cc:294
ESHandle.h
SiStripMatchedRecHit2D::stereoCluster
SiStripCluster const & stereoCluster() const
Definition: SiStripMatchedRecHit2D.h:40
SiStripGainFromData::OutputGains
std::string OutputGains
Definition: SiStripGainFromData.cc:135
LocalTrajectoryError::positionError
LocalError positionError() const
Definition: LocalTrajectoryError.h:81
SiStripGainFromData::tmp
MonitorElement * tmp
Definition: SiStripGainFromData.cc:142
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
SiStripGain.h
Trajectory::chiSquared
float chiSquared() const
Definition: Trajectory.h:241
SiStripGainFromData::HFirstStrip
TH1F * HFirstStrip
Definition: SiStripGainFromData.cc:275
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
SiStripGainFromData::ETimestamp
TimeValue_t ETimestamp
Definition: SiStripGainFromData.cc:283
edm::Run
Definition: Run.h:45
SiStripGainFromData::MPV_Vs_PathLength500
TH1F * MPV_Vs_PathLength500
Definition: SiStripGainFromData.cc:245
zMuMuMuonUserData.alpha
alpha
zGenParticlesMatch = cms.InputTag(""),
Definition: zMuMuMuonUserData.py:9
SiStripGainFromData::MinTrackHits
unsigned int MinTrackHits
Definition: SiStripGainFromData.cc:126
SiStripGainFromData::SiStripGainFromData
SiStripGainFromData(const edm::ParameterSet &)
Definition: SiStripGainFromData.cc:298
SiStripGainFromData::MPVs320
TH1F * MPVs320
Definition: SiStripGainFromData.cc:214
edm
HLT enums.
Definition: AlignableModifier.h:19
zMuMuMuonUserData.beta
beta
Definition: zMuMuMuonUserData.py:10
TrackerTopology
Definition: TrackerTopology.h:16
gather_cfg.cout
cout
Definition: gather_cfg.py:144
hcaldqm::constants::GOOD
const double GOOD
Definition: Constants.h:13
SiStripGainFromData::MPV_Vs_EtaTOB
TH2F * MPV_Vs_EtaTOB
Definition: SiStripGainFromData.cc:154
SiStripGainFromData::MaxChi2OverNDF
double MaxChi2OverNDF
Definition: SiStripGainFromData.cc:120
SiStripGainFromData::Error_Vs_Phi
TH2F * Error_Vs_Phi
Definition: SiStripGainFromData.cc:266
stAPVGain
Definition: APVGainStruct.h:7
SiStripGainFromData::Validation
bool Validation
Definition: SiStripGainFromData.cc:130
stAPVGain::DetId
int DetId
Definition: SiStripGainFromData.cc:75
GeomDetType.h
stAPVGain::Side
char Side
Definition: SiStripGainFromData.cc:85
SiStripGainFromData::MPV_Vs_PhiTEC2
TH2F * MPV_Vs_PhiTEC2
Definition: SiStripGainFromData.cc:164
stAPVGain::DetId
unsigned int DetId
Definition: APVGainStruct.h:10
TrackingGeometry.h
SiStripGainRcd.h
SiStripGainFromData::ComputeChargeOverPath
double ComputeChargeOverPath(const SiStripCluster *Cluster, TrajectoryStateOnSurface trajState, const edm::EventSetup *iSetup, const Track *track, double trajChi2OverN)
Definition: SiStripGainFromData.cc:1261
DQMStore.h
SiStripRecHit2D
Definition: SiStripRecHit2D.h:7
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
IntegrityClient_cfi.Gain
Gain
Definition: IntegrityClient_cfi.py:16
SiStripGainFromData::Tracks_Pt_Vs_Eta
TH2F * Tracks_Pt_Vs_Eta
Definition: SiStripGainFromData.cc:145
SiStripGainFromData::algoBeginJob
void algoBeginJob(const edm::EventSetup &) override
Definition: SiStripGainFromData.cc:337
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EDAnalyzer.h
SiStripGainFromData::MPV_Vs_PhiTEC1
TH2F * MPV_Vs_PhiTEC1
Definition: SiStripGainFromData.cc:163
SiStripGainFromData::APV_CumulGain
TH1F * APV_CumulGain
Definition: SiStripGainFromData.cc:209
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
StripTopology.h
SiStripGainFromData::APV_Gain
TH1F * APV_Gain
Definition: SiStripGainFromData.cc:208
Trajectory::foundHits
int foundHits() const
Definition: Trajectory.h:206
SiStripGainFromData::APV_DetId
TH1F * APV_DetId
Definition: SiStripGainFromData.cc:198
SiStripGainFromData::MPV_Vs_EtaTID
TH2F * MPV_Vs_EtaTID
Definition: SiStripGainFromData.cc:153
tools.TF1
TF1
Definition: tools.py:23
SiStripGainFromData::Charge_Vs_PathTEC
TH2F * Charge_Vs_PathTEC
Definition: SiStripGainFromData.cc:169
SiStripGainFromData::OutputHistos
std::string OutputHistos
Definition: SiStripGainFromData.cc:136
edm::Handle
Definition: AssociativeIterator.h:50
SiStripGainFromData::Charge_TIDM
TH1F * Charge_TIDM
Definition: SiStripGainFromData.cc:183
SiStripGainFromData::Charge_Vs_Beta
TH2F * Charge_Vs_Beta
Definition: SiStripGainFromData.cc:259
dqm::legacy::MonitorElement::getTH1F
virtual TH1F * getTH1F() const
Definition: MonitorElement.h:478
SiStripGainFromData::Error_Vs_MPV
TH2F * Error_Vs_MPV
Definition: SiStripGainFromData.cc:263
SiStripGainFromData::APVsColl
std::unordered_map< unsigned int, stAPVGain * > APVsColl
Definition: SiStripGainFromData.cc:295
SiStripGainFromData::HChi2OverNDF
TH1F * HChi2OverNDF
Definition: SiStripGainFromData.cc:148
SiStripGainFromData::MinTrackEta
double MinTrackEta
Definition: SiStripGainFromData.cc:123
DeDxTools::IsFarFromBorder
bool IsFarFromBorder(const TrajectoryStateOnSurface &trajState, const GeomDetUnit *it)
Definition: DeDxTools.cc:404
Bounds::length
virtual float length() const =0
parameters
parameters
Definition: BeamSpot_PayloadInspector.cc:14
SiStripGainFromData::MPV_Vs_PathTID
TH1F * MPV_Vs_PathTID
Definition: SiStripGainFromData.cc:174
SiStripGainFromData::MPV_Vs_Beta
TH1F * MPV_Vs_Beta
Definition: SiStripGainFromData.cc:260
SiStripCluster::firstStrip
uint16_t firstStrip() const
Definition: SiStripCluster.h:38
TrackerGeometry::idToDetUnit
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: TrackerGeometry.cc:183
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
ndof
Definition: HIMultiTrackSelector.h:49
SiStripGainFromData::NumberOfEntriesByAPV
TH1F * NumberOfEntriesByAPV
Definition: SiStripGainFromData.cc:147
SiStripGainFromData::NEvent
unsigned int NEvent
Definition: SiStripGainFromData.cc:277
SiStripGainFromData::APV_R
TH1F * APV_R
Definition: SiStripGainFromData.cc:201
stAPVGain::APVId
unsigned int APVId
Definition: APVGainStruct.h:11
DetId
Definition: DetId.h:17
edm::AssociationMap::end
const_iterator end() const
last iterator over the map (read only)
Definition: AssociationMap.h:171
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
SiStripGainFromData::HTrackChi2OverNDF
TH1F * HTrackChi2OverNDF
Definition: SiStripGainFromData.cc:149
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
MakerMacros.h
TrackerTopology.h
SiStripDetCabling.h
TrackDeDxHits.h
TrackerTopologyRcd.h
Track.h
SiStripGainFromData::MPV_Vs_PathTIB
TH1F * MPV_Vs_PathTIB
Definition: SiStripGainFromData.cc:173
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
TrackFwd.h
ConditionDBWriter
Definition: ConditionDBWriter.h:149
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
dqm::legacy::DQMStore
Definition: DQMStore.h:727
Exhume::I
const std::complex< double > I
Definition: I.h:8
SiStripGainFromData::MPV_Vs_EtaTEC
TH2F * MPV_Vs_EtaTEC
Definition: SiStripGainFromData.cc:155
DeDxHit.h
TrajectoryStateOnSurface::localDirection
LocalVector localDirection() const
Definition: TrajectoryStateOnSurface.h:76
TrapezoidalPlaneBounds.h
SiStripGainFromData::Error_Vs_Eta
TH2F * Error_Vs_Eta
Definition: SiStripGainFromData.cc:265
ntupleEnum.SubDet
SubDet
Definition: ntupleEnum.py:15
SiStripGain::getRange
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:71
SiStripGainFromData::Charge_Vs_PathTOB
TH2F * Charge_Vs_PathTOB
Definition: SiStripGainFromData.cc:168
SiStripGainFromData::MPV_Vs_PathLength320
TH1F * MPV_Vs_PathLength320
Definition: SiStripGainFromData.cc:244
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
Surface::bounds
const Bounds & bounds() const
Definition: Surface.h:87
SiStripGainFromData::MaxTrackEta
double MaxTrackEta
Definition: SiStripGainFromData.cc:124
SiStripGainFromData::Charge_TECP
TH1F * Charge_TECP
Definition: SiStripGainFromData.cc:188
SiStripGainFromData::MPV_Vs_PhiTID
TH2F * MPV_Vs_PhiTID
Definition: SiStripGainFromData.cc:160
reco::Track
Definition: Track.h:27
SiStripGainFromData::isEqual
Definition: SiStripGainFromData.cc:286
edm::ESHandle< TrackerTopology >
SiStripGainFromData::TrajToTrackProducer
std::string TrajToTrackProducer
Definition: SiStripGainFromData.cc:137
SiStripGainFromData::Charge_TEC2
TH1F * Charge_TEC2
Definition: SiStripGainFromData.cc:187
SiStripGainFromData::CheckIfFileExist
bool CheckIfFileExist
Definition: SiStripGainFromData.cc:132
SiStripGainFromData::HitLocalPositionBefCut
TH2F * HitLocalPositionBefCut
Definition: SiStripGainFromData.cc:271
RectangularPlaneBounds.h
SiStripGainFromData::MPVs
TH1F * MPVs
Definition: SiStripGainFromData.cc:213
StripSubdetector::TIB
static constexpr auto TIB
Definition: StripSubdetector.h:16
SiStripGainFromData::AllowSaturation
bool AllowSaturation
Definition: SiStripGainFromData.cc:128
SiStripGainFromData::DQMStore
dqm::legacy::DQMStore DQMStore
Definition: SiStripGainFromData.cc:91
VtxSmearedParameters_cfi.Phi
Phi
Definition: VtxSmearedParameters_cfi.py:112
SiStripGainFromData::MaxNrStrips
unsigned int MaxNrStrips
Definition: SiStripGainFromData.cc:125
Point3DBase< float, LocalTag >
SiStripGainFromData::HTrackHits
TH1F * HTrackHits
Definition: SiStripGainFromData.cc:150
SiStripApvGain.h
dqm::implementation::DQMStore::save
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
Definition: DQMStore.cc:760
b
double b
Definition: hdecay.h:118
SiStripGainFromData::MPV_Vs_PhiTIB
TH2F * MPV_Vs_PhiTIB
Definition: SiStripGainFromData.cc:159
TrajTrackAssociation.h
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
SiStripGainFromData::FWHM_Vs_PathLength500
TH1F * FWHM_Vs_PathLength500
Definition: SiStripGainFromData.cc:249
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripGainFromData::MaxTrackChiOverNdf
double MaxTrackChiOverNdf
Definition: SiStripGainFromData.cc:127
SiStripGainFromData::Charge_TEC1
TH1F * Charge_TEC1
Definition: SiStripGainFromData.cc:186
SiStripGainFromData::MPV_Vs_TransversAngle
TH1F * MPV_Vs_TransversAngle
Definition: SiStripGainFromData.cc:252
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator
friend struct const_iterator
Definition: AssociationMap.h:274
SiStripGainFromData::APV_Eta
TH1F * APV_Eta
Definition: SiStripGainFromData.cc:200
SiStripGainFromData::MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: SiStripGainFromData.cc:90
SiStripGainFromData::APV_SubDet
TH1F * APV_SubDet
Definition: SiStripGainFromData.cc:202
TrackerDigiGeometryRecord.h
SiStripGainFromData::JobInfo
TH1F * JobInfo
Definition: SiStripGainFromData.cc:273
TrajectoryStateOnSurface::localPosition
LocalPoint localPosition() const
Definition: TrajectoryStateOnSurface.h:74
stAPVGain::Index
unsigned int Index
Definition: APVGainStruct.h:8
SiStripGainFromData::APV_PathLengthM
TH1F * APV_PathLengthM
Definition: SiStripGainFromData.cc:206
edm::ParameterSet
Definition: ParameterSet.h:36
SiStripGainFromData::~SiStripGainFromData
~SiStripGainFromData() override
Definition: SiStripGainFromData.cc:335
Trajectory::RecHitContainer
ConstRecHitContainer RecHitContainer
Definition: Trajectory.h:42
a
double a
Definition: hdecay.h:119
SiStripGainFromData::Charge_Vs_PathLength320
TH2F * Charge_Vs_PathLength320
Definition: SiStripGainFromData.cc:240
SiStripGainFromData::Charge_Vs_TransversAngle
TH2F * Charge_Vs_TransversAngle
Definition: SiStripGainFromData.cc:251
Event.h
SiStripGainFromData::algoAnalyze
void algoAnalyze(const edm::Event &, const edm::EventSetup &) override
Definition: SiStripGainFromData.cc:1163
LocalError
Definition: LocalError.h:12
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >
stAPVGain::MPV
double MPV
Definition: SiStripGainFromData.cc:82
SiStripGainFromData::STimestamp
TimeValue_t STimestamp
Definition: SiStripGainFromData.cc:280
SiStripGainFromData::APV_Thickness
TH1F * APV_Thickness
Definition: SiStripGainFromData.cc:211
SiStripGainFromData::APV_Id
TH1F * APV_Id
Definition: SiStripGainFromData.cc:199
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
SiStripGainFromData::Charge_Vs_PathTEC2
TH2F * Charge_Vs_PathTEC2
Definition: SiStripGainFromData.cc:171
sistrip::APV
Definition: ConstantsForGranularity.h:79
SiStripCluster::amplitudes
const std::vector< uint8_t > & amplitudes() const
Definition: SiStripCluster.h:51
edm::Service
Definition: Service.h:30
createfilelist.int
int
Definition: createfilelist.py:10
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
iEvent
int iEvent
Definition: GenABIO.cc:224
SiStripGainFromData::FWHM_Vs_PathLength320
TH1F * FWHM_Vs_PathLength320
Definition: SiStripGainFromData.cc:248
SiStripGainFromData::Tracks_P_Vs_Eta
TH2F * Tracks_P_Vs_Eta
Definition: SiStripGainFromData.cc:144
SiStripGainFromData::ERun
unsigned int ERun
Definition: SiStripGainFromData.cc:281
SiStripGainFromData::Charge_Vs_PathLength500
TH2F * Charge_Vs_PathLength500
Definition: SiStripGainFromData.cc:241
SiStripRecHit1D::cluster
ClusterRef cluster() const
Definition: SiStripRecHit1D.h:18
SiStripGainFromData::Charge_TIB
TH1F * Charge_TIB
Definition: SiStripGainFromData.cc:180
edm::EventSetup
Definition: EventSetup.h:57
TrackerGeometry::dets
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: TrackerGeometry.h:62
SiStripRecHit1D
Definition: SiStripRecHit1D.h:8
SiStripGainFromData::EEvent
unsigned int EEvent
Definition: SiStripGainFromData.cc:282
GeometricDet.h
TrapezoidalPlaneBounds
Definition: TrapezoidalPlaneBounds.h:15
get
#define get
SiStripGainFromData::MPV_Vs_R
TH2F * MPV_Vs_R
Definition: SiStripGainFromData.cc:193
edm::ESHandleBase::isValid
bool isValid() const
Definition: ESHandle.h:44
ConditionDBWriter.h
SiStripGainFromData::MPV_Vs_PathTEC
TH1F * MPV_Vs_PathTEC
Definition: SiStripGainFromData.cc:176
StripTopology::nstrips
virtual int nstrips() const =0
SiStripGainFromData::MPV_Vs_PathTOB
TH1F * MPV_Vs_PathTOB
Definition: SiStripGainFromData.cc:175
Trajectory::measurements
DataContainer const & measurements() const
Definition: Trajectory.h:178
SiStripGainFromData::IsFarFromBorder
bool IsFarFromBorder(TrajectoryStateOnSurface trajState, const uint32_t detid, const edm::EventSetup *iSetup)
Definition: SiStripGainFromData.cc:1400
TrackingRecHit
Definition: TrackingRecHit.h:21
SiStripRecHit1D.h
SiStripGainFromData::MPV_Vs_EtaTEC2
TH2F * MPV_Vs_EtaTEC2
Definition: SiStripGainFromData.cc:157
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
SiStripGainFromData::MPV_Vs_Alpha
TH1F * MPV_Vs_Alpha
Definition: SiStripGainFromData.cc:256
stAPVGain::SubDet
int SubDet
Definition: SiStripGainFromData.cc:77
SiStripGainFromData::iEvent_
const edm::Event * iEvent_
Definition: SiStripGainFromData.cc:115
SiStripGainFromData::algoEndJob
void algoEndJob() override
Definition: SiStripGainFromData.cc:643
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
SiStripGainFromData::Charge_TIDP
TH1F * Charge_TIDP
Definition: SiStripGainFromData.cc:182
SiStripGainFromData::MaxTrackMomentum
double MaxTrackMomentum
Definition: SiStripGainFromData.cc:122
SiStripGainFromData::MPV_Vs_PhiTEC
TH2F * MPV_Vs_PhiTEC
Definition: SiStripGainFromData.cc:162
Trajectory.h
TrajectoryStateOnSurface::globalMomentum
GlobalVector globalMomentum() const
Definition: TrajectoryStateOnSurface.h:66
GeomDet.h
Trajectory::recHits
ConstRecHitContainer recHits() const
Definition: Trajectory.h:186
SiStripGainFromData::isEqual::operator()
bool operator()(const T &PseudoDetId1, const T &PseudoDetId2)
Definition: SiStripGainFromData.cc:289
SiStripGainFromData::APV_PrevGain
TH1F * APV_PrevGain
Definition: SiStripGainFromData.cc:210
SiStripGainFromData::Charge_Vs_PathTID
TH2F * Charge_Vs_PathTID
Definition: SiStripGainFromData.cc:167
SiStripGainFromData::Charge_TECM
TH1F * Charge_TECM
Definition: SiStripGainFromData.cc:189
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
SiStripGainFromData::NStrips_Vs_Alpha
TH2F * NStrips_Vs_Alpha
Definition: SiStripGainFromData.cc:257
RectangularPlaneBounds
Definition: RectangularPlaneBounds.h:12
StripSubdetector::TEC
static constexpr auto TEC
Definition: StripSubdetector.h:19
SiStripMatchedRecHit2D
Definition: SiStripMatchedRecHit2D.h:8
SiStripGainFromData::Error_Vs_Entries
TH2F * Error_Vs_Entries
Definition: SiStripGainFromData.cc:264
DetId.h
SiStripGainFromData::MPVs500
TH1F * MPVs500
Definition: SiStripGainFromData.cc:215
Trajectory
Definition: Trajectory.h:38
SiStripGainFromData::MPV_Vs_Phi
TH2F * MPV_Vs_Phi
Definition: SiStripGainFromData.cc:191
Frameworkfwd.h
SiStripGainFromData::iSetup_
const edm::EventSetup * iSetup_
Definition: SiStripGainFromData.cc:114
T
long double T
Definition: Basic3DVectorLD.h:48
SiStripGainFromData::APV_Charge
TH2F * APV_Charge
Definition: SiStripGainFromData.cc:204
SiStripApvGain::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripApvGain.h:28
SiStripMatchedRecHit2D::monoCluster
SiStripCluster const & monoCluster() const
Definition: SiStripMatchedRecHit2D.h:41
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
SiStripGainFromData::NHighStripInCluster
TH1F * NHighStripInCluster
Definition: SiStripGainFromData.cc:220
edm::AssociationMap::begin
const_iterator begin() const
first iterator over the map (read only)
Definition: AssociationMap.h:169
BoundPlane
SiStripGainFromData::Charge_Vs_PathTIB
TH2F * Charge_Vs_PathTIB
Definition: SiStripGainFromData.cc:166
PixelGeomDetUnit.h
SiStripGainFromData
Definition: SiStripGainFromData.cc:88
SiStripGainFromData::MPV_Vs_EtaTIB
TH2F * MPV_Vs_EtaTIB
Definition: SiStripGainFromData.cc:152
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
PixelTestBeamValidation_cfi.Charge
Charge
Definition: PixelTestBeamValidation_cfi.py:78
SiStripGainFromData::Charge_TEC
TH1F * Charge_TEC
Definition: SiStripGainFromData.cc:185
Exception.h
SiStripGainFromData::MPV_Vs_PhiTOB
TH2F * MPV_Vs_PhiTOB
Definition: SiStripGainFromData.cc:161
SiStripGainFromData::TrajToTrackLabel
std::string TrajToTrackLabel
Definition: SiStripGainFromData.cc:138
SiStripGainFromData::NSatStripInCluster
TH1F * NSatStripInCluster
Definition: SiStripGainFromData.cc:219
SiStripGainFromData::APV_Momentum
TH2F * APV_Momentum
Definition: SiStripGainFromData.cc:203
SiStripGainFromData::getNewObject
std::unique_ptr< SiStripApvGain > getNewObject() override
Definition: SiStripGainFromData.cc:1491
SiStripGainFromData::NStrips_Vs_TransversAngle
TH2F * NStrips_Vs_TransversAngle
Definition: SiStripGainFromData.cc:253
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
hcaldqm::constants::BAD
const double BAD
Definition: Constants.h:15
SiStripGainFromData::NoMPV_Vs_EtaPhi
TH2F * NoMPV_Vs_EtaPhi
Definition: SiStripGainFromData.cc:268
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
SiStripDetCablingRcd.h
SiStripGainFromData::MPV_Vs_Eta
TH2F * MPV_Vs_Eta
Definition: SiStripGainFromData.cc:192
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
SiStripGainFromData::SEvent
unsigned int SEvent
Definition: SiStripGainFromData.cc:279
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
ParameterSet.h
SiStripGainFromData::HitLocalPosition
TH2F * HitLocalPosition
Definition: SiStripGainFromData.cc:270
GeometricSearchDet
Definition: GeometricSearchDet.h:17
SiStripMatchedRecHit2D.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
SiStripGainFromData::MPV_Vs_EtaTEC1
TH2F * MPV_Vs_EtaTEC1
Definition: SiStripGainFromData.cc:156
SiStripClusterCollection.h
SiStripGainFromData::Charge_Vs_PathLength
TH2F * Charge_Vs_PathLength
Definition: SiStripGainFromData.cc:239
edm::Event
Definition: Event.h:73
SiStripGainFromData::APV_MPV
TH1F * APV_MPV
Definition: SiStripGainFromData.cc:207
SiStripGainFromData::AlgoMode
std::string AlgoMode
Definition: SiStripGainFromData.cc:134
TrajectoryStateOnSurface::localError
const LocalTrajectoryError & localError() const
Definition: TrajectoryStateOnSurface.h:77
SiStripApvGain
Definition: SiStripApvGain.h:25
SiStripCluster
Definition: SiStripCluster.h:9
SiStripGainFromData::dqmStore_
DQMStore * dqmStore_
Definition: SiStripGainFromData.cc:103
SiStripGainFromData::MinTrackMomentum
double MinTrackMomentum
Definition: SiStripGainFromData.cc:121
dttmaxenums::R
Definition: DTTMax.h:29
SiStripRecHit2D.h
SiStripGainFromData::MPV_Vs_PathTEC2
TH1F * MPV_Vs_PathTEC2
Definition: SiStripGainFromData.cc:178
StripTopology
Definition: StripTopology.h:11
StripSubdetector.h
LocalError::yy
float yy() const
Definition: LocalError.h:24
SiStripGainFromData::MPV_Vs_PathTEC1
TH1F * MPV_Vs_PathTEC1
Definition: SiStripGainFromData.cc:177
StripSubdetector::TID
static constexpr auto TID
Definition: StripSubdetector.h:17
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
hit
Definition: SiStripHitEffFromCalibTree.cc:88
edm::TimeValue_t
unsigned long long TimeValue_t
Definition: Timestamp.h:28
dqm::implementation::DQMStore::cd
void cd() override
Definition: DQMStore.h:564
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
SiStripGainFromData::APV_PathLength
TH2F * APV_PathLength
Definition: SiStripGainFromData.cc:205
dqm::legacy::MonitorElement::getTH2F
virtual TH2F * getTH2F() const
Definition: MonitorElement.h:490
TrackerTopology::tecSide
unsigned int tecSide(const DetId &id) const
Definition: TrackerTopology.h:184