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 
13 
19 
26 
28 
31 
44 
47 
50 
52 
55 
56 #include "TFile.h"
57 #include "TObjString.h"
58 #include "TString.h"
59 #include "TH1F.h"
60 #include "TH2F.h"
61 #include "TProfile.h"
62 #include "TF1.h"
63 #include "TROOT.h"
64 
65 #include <unordered_map>
66 #include <memory>
67 
68 using namespace edm;
69 using namespace reco;
70 using namespace std;
71 
72 struct stAPVGain {
73  unsigned int Index;
74  int DetId;
75  int APVId;
76  int SubDet;
77  float Eta;
78  float R;
79  float Phi;
80  float Thickness;
81  double MPV;
82  double Gain;
83  double PreviousGain;
84  char Side;
85 };
86 
87 class SiStripGainFromData : public ConditionDBWriter<SiStripApvGain> {
88 public:
91  explicit SiStripGainFromData(const edm::ParameterSet&);
92  ~SiStripGainFromData() override;
93 
94 private:
95  void algoBeginJob(const edm::EventSetup&) override;
96  void algoEndJob() override;
97  void algoBeginRun(const edm::Run&, const edm::EventSetup&) override;
98  // virtual void algoBeginRun(const edm::Event& iEvent, const edm::EventSetup& iSetup);
99  void algoAnalyze(const edm::Event&, const edm::EventSetup&) override;
100 
101  std::unique_ptr<SiStripApvGain> getNewObject() override;
103 
104  double ComputeChargeOverPath(const SiStripCluster* Cluster,
105  TrajectoryStateOnSurface trajState,
106  const edm::EventSetup* iSetup,
107  const Track* track,
108  double trajChi2OverN);
109  bool IsFarFromBorder(TrajectoryStateOnSurface trajState, const uint32_t detid, const edm::EventSetup* iSetup);
110 
111  void getPeakOfLandau(TH1* InputHisto, double* FitResults, double LowRange = 0, double HighRange = 5400);
112 
115 
117  unsigned int MinNrEntries;
118  double MaxMPVError;
122  double MinTrackEta;
123  double MaxTrackEta;
124  unsigned int MaxNrStrips;
125  unsigned int MinTrackHits;
132 
138 
139  vector<string> VInputFiles;
140 
142 
145 
149  TH1F* HTrackHits;
150 
157 
164 
171 
178 
179  TH1F* Charge_TIB;
180  TH1F* Charge_TID;
181  TH1F* Charge_TIDP;
182  TH1F* Charge_TIDM;
183  TH1F* Charge_TOB;
184  TH1F* Charge_TEC;
185  TH1F* Charge_TEC1;
186  TH1F* Charge_TEC2;
187  TH1F* Charge_TECP;
188  TH1F* Charge_TECM;
189 
190  TH2F* MPV_Vs_Phi;
191  TH2F* MPV_Vs_Eta;
192  TH2F* MPV_Vs_R;
193 
194  // TH2F* PD_Vs_Eta;
195  // TH2F* PD_Vs_R;
196 
197  TH1F* APV_DetId;
198  TH1F* APV_Id;
199  TH1F* APV_Eta;
200  TH1F* APV_R;
201  TH1F* APV_SubDet;
203  TH2F* APV_Charge;
206  TH1F* APV_MPV;
207  TH1F* APV_Gain;
211 
212  TH1F* MPVs;
213  TH1F* MPVs320;
214  TH1F* MPVs500;
215 
216  // TH2F* MPV_vs_10RplusEta;
217 
220  // TH2F* Charge_Vs_PathLength_CS1;
221  // TH2F* Charge_Vs_PathLength_CS2;
222  // TH2F* Charge_Vs_PathLength_CS3;
223  // TH2F* Charge_Vs_PathLength_CS4;
224  // TH2F* Charge_Vs_PathLength_CS5;
225 
226  // TH1F* MPV_Vs_PathLength_CS1;
227  // TH1F* MPV_Vs_PathLength_CS2;
228  // TH1F* MPV_Vs_PathLength_CS3;
229  // TH1F* MPV_Vs_PathLength_CS4;
230  // TH1F* MPV_Vs_PathLength_CS5;
231 
232  // TH1F* FWHM_Vs_PathLength_CS1;
233  // TH1F* FWHM_Vs_PathLength_CS2;
234  // TH1F* FWHM_Vs_PathLength_CS3;
235  // TH1F* FWHM_Vs_PathLength_CS4;
236  // TH1F* FWHM_Vs_PathLength_CS5;
237 
241 
245 
249 
253 
257 
259  TH1F* MPV_Vs_Beta;
261 
266 
268 
271 
272  TH1F* JobInfo;
273 
274  TH1F* HFirstStrip;
275 
276  unsigned int NEvent;
277  unsigned int SRun;
278  unsigned int SEvent;
280  unsigned int ERun;
281  unsigned int EEvent;
283 
284 private:
285  class isEqual {
286  public:
287  template <class T>
288  bool operator()(const T& PseudoDetId1, const T& PseudoDetId2) {
289  return PseudoDetId1 == PseudoDetId2;
290  }
291  };
292 
293  std::vector<stAPVGain*> APVsCollOrdered;
294  std::unordered_map<unsigned int, stAPVGain*> APVsColl;
295 
299 };
300 
302  : ConditionDBWriter<SiStripApvGain>(iConfig) {
303  AlgoMode = iConfig.getParameter<std::string>("AlgoMode");
304 
305  OutputGains = iConfig.getParameter<std::string>("OutputGains");
306  OutputHistos = iConfig.getParameter<std::string>("OutputHistos");
307 
308  TrajToTrackProducer = iConfig.getParameter<std::string>("TrajToTrackProducer");
309  TrajToTrackLabel = iConfig.getParameter<std::string>("TrajToTrackLabel");
310 
311  CheckLocalAngle = iConfig.getUntrackedParameter<bool>("checkLocalAngle", false);
312  MinNrEntries = iConfig.getUntrackedParameter<unsigned>("minNrEntries", 20);
313  MaxMPVError = iConfig.getUntrackedParameter<double>("maxMPVError", 500.0);
314  MaxChi2OverNDF = iConfig.getUntrackedParameter<double>("maxChi2OverNDF", 5.0);
315  MinTrackMomentum = iConfig.getUntrackedParameter<double>("minTrackMomentum", 3.0);
316  MaxTrackMomentum = iConfig.getUntrackedParameter<double>("maxTrackMomentum", 99999.0);
317  MinTrackEta = iConfig.getUntrackedParameter<double>("minTrackEta", -5.0);
318  MaxTrackEta = iConfig.getUntrackedParameter<double>("maxTrackEta", 5.0);
319  MaxNrStrips = iConfig.getUntrackedParameter<unsigned>("maxNrStrips", 2);
320  MinTrackHits = iConfig.getUntrackedParameter<unsigned>("MinTrackHits", 8);
321  MaxTrackChiOverNdf = iConfig.getUntrackedParameter<double>("MaxTrackChiOverNdf", 3);
322  AllowSaturation = iConfig.getUntrackedParameter<bool>("AllowSaturation", false);
323  FirstSetOfConstants = iConfig.getUntrackedParameter<bool>("FirstSetOfConstants", true);
324  Validation = iConfig.getUntrackedParameter<bool>("Validation", false);
325  CheckIfFileExist = iConfig.getUntrackedParameter<bool>("CheckIfFileExist", false);
326 
327  CalibrationLevel = iConfig.getUntrackedParameter<int>("CalibrationLevel", 0);
328 
329  if (strcmp(AlgoMode.c_str(), "WriteOnDB") == 0)
330  VInputFiles = iConfig.getParameter<vector<string> >("VInputFiles");
331 
332  dqmStore_ = edm::Service<DQMStore>().operator->();
333 
334  tTopoToken_ = esConsumes<edm::Transition::BeginRun>();
335  tkGeomToken_ = esConsumes<edm::Transition::BeginRun>();
336  gainToken_ = esConsumes<edm::Transition::BeginRun>();
337 
338  //if( OutputHistos!="" )
339  // dqmStore_->open(OutputHistos.c_str(), true);
340 }
341 
343 
345  const TrackerTopology* const tTopo = &iSetup.getData(tTopoToken_);
346 
347  iSetup_ = &iSetup;
348 
349  // TH1::AddDirectory(kTRUE);
350 
351  tmp = dqmStore_->book1D("JobInfo", "JobInfo", 20, 0, 20);
352  JobInfo = tmp->getTH1F();
353 
354  tmp = dqmStore_->book1D("APV_DetId", "APV_DetId", 72785, 0, 72784);
355  APV_DetId = tmp->getTH1F();
356  tmp = dqmStore_->book1D("APV_Id", "APV_Id", 72785, 0, 72784);
357  APV_Id = tmp->getTH1F();
358  tmp = dqmStore_->book1D("APV_Eta", "APV_Eta", 72785, 0, 72784);
359  APV_Eta = tmp->getTH1F();
360  tmp = dqmStore_->book1D("APV_R", "APV_R", 72785, 0, 72784);
361  APV_R = tmp->getTH1F();
362  tmp = dqmStore_->book1D("APV_SubDet", "APV_SubDet", 72785, 0, 72784);
363  APV_SubDet = tmp->getTH1F();
364  tmp = dqmStore_->book2D("APV_Momentum", "APV_Momentum", 72785, 0, 72784, 50, 0, 200);
365  APV_Momentum = tmp->getTH2F();
366  tmp = dqmStore_->book2D("APV_Charge", "APV_Charge", 72785, 0, 72784, 1000, 0, 2000);
367  APV_Charge = tmp->getTH2F();
368  tmp = dqmStore_->book2D("APV_PathLength", "APV_PathLength", 72785, 0, 72784, 100, 0.2, 1.4);
370  tmp = dqmStore_->book1D("APV_PathLengthM", "APV_PathLengthM", 72785, 0, 72784);
372  tmp = dqmStore_->book1D("APV_MPV", "APV_MPV", 72785, 0, 72784);
373  APV_MPV = tmp->getTH1F();
374  tmp = dqmStore_->book1D("APV_Gain", "APV_Gain", 72785, 0, 72784);
375  APV_Gain = tmp->getTH1F();
376  tmp = dqmStore_->book1D("APV_PrevGain", "APV_PrevGain", 72785, 0, 72784);
377  APV_PrevGain = tmp->getTH1F();
378  tmp = dqmStore_->book1D("APV_CumulGain", "APV_CumulGain", 72785, 0, 72784);
380  tmp = dqmStore_->book1D("APV_Thickness", "APV_Thicknes", 72785, 0, 72784);
382 
383  tmp = dqmStore_->book2D("Tracks_P_Vs_Eta", "Tracks_P_Vs_Eta", 30, 0, 3, 50, 0, 200);
385  tmp = dqmStore_->book2D("Tracks_Pt_Vs_Eta", "Tracks_Pt_Vs_Eta", 30, 0, 3, 50, 0, 200);
387 
388  tmp = dqmStore_->book2D("Charge_Vs_PathTIB", "Charge_Vs_PathTIB", 100, 0.2, 1.4, 500, 0, 2000);
390  tmp = dqmStore_->book2D("Charge_Vs_PathTID", "Charge_Vs_PathTID", 100, 0.2, 1.4, 500, 0, 2000);
392  tmp = dqmStore_->book2D("Charge_Vs_PathTOB", "Charge_Vs_PathTOB", 100, 0.2, 1.4, 500, 0, 2000);
394  tmp = dqmStore_->book2D("Charge_Vs_PathTEC", "Charge_Vs_PathTEC", 100, 0.2, 1.4, 500, 0, 2000);
396  tmp = dqmStore_->book2D("Charge_Vs_PathTEC1", "Charge_Vs_PathTEC1", 100, 0.2, 1.4, 500, 0, 2000);
398  tmp = dqmStore_->book2D("Charge_Vs_PathTEC2", "Charge_Vs_PathTEC2", 100, 0.2, 1.4, 500, 0, 2000);
400 
401  tmp = dqmStore_->book1D("Charge_TIB", "Charge_TIB", 1000, 0, 2000);
402  Charge_TIB = tmp->getTH1F();
403  tmp = dqmStore_->book1D("Charge_TID", "Charge_TID", 1000, 0, 2000);
404  Charge_TID = tmp->getTH1F();
405  tmp = dqmStore_->book1D("Charge_TID+", "Charge_TID+", 1000, 0, 2000);
406  Charge_TIDP = tmp->getTH1F();
407  tmp = dqmStore_->book1D("Charge_TID-", "Charge_TID-", 1000, 0, 2000);
408  Charge_TIDM = tmp->getTH1F();
409  tmp = dqmStore_->book1D("Charge_TOB", "Charge_TOB", 1000, 0, 2000);
410  Charge_TOB = tmp->getTH1F();
411  tmp = dqmStore_->book1D("Charge_TEC", "Charge_TEC", 1000, 0, 2000);
412  Charge_TEC = tmp->getTH1F();
413  tmp = dqmStore_->book1D("Charge_TEC1", "Charge_TEC1", 1000, 0, 2000);
414  Charge_TEC1 = tmp->getTH1F();
415  tmp = dqmStore_->book1D("Charge_TEC2", "Charge_TEC2", 1000, 0, 2000);
416  Charge_TEC2 = tmp->getTH1F();
417  tmp = dqmStore_->book1D("Charge_TEC+", "Charge_TEC+", 1000, 0, 2000);
418  Charge_TECP = tmp->getTH1F();
419  tmp = dqmStore_->book1D("Charge_TEC-", "Charge_TEC-", 1000, 0, 2000);
420  Charge_TECM = tmp->getTH1F();
421 
422  /*
423  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();
424  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();
425  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();
426  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();
427  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();
428 */
429  tmp = dqmStore_->book2D("Charge_Vs_PathLength", "Charge_Vs_PathLength", 100, 0.2, 1.4, 500, 0, 2000);
431  tmp = dqmStore_->book2D("Charge_Vs_PathLength320", "Charge_Vs_PathLength", 100, 0.2, 1.4, 500, 0, 2000);
433  tmp = dqmStore_->book2D("Charge_Vs_PathLength500", "Charge_Vs_PathLength", 100, 0.2, 1.4, 500, 0, 2000);
435 
436  tmp = dqmStore_->book2D("Charge_Vs_TransversAngle", "Charge_Vs_TransversAngle", 220, -20, 200, 500, 0, 2000);
438  tmp = dqmStore_->book2D("Charge_Vs_Alpha", "Charge_Vs_Alpha", 220, -20, 200, 500, 0, 2000);
440  tmp = dqmStore_->book2D("Charge_Vs_Beta", "Charge_Vs_Beta", 220, -20, 200, 500, 0, 2000);
442 
443  tmp = dqmStore_->book2D("NStrips_Vs_TransversAngle", "NStrips_Vs_TransversAngle", 220, -20, 200, 10, 0, 10);
445  tmp = dqmStore_->book2D("NStrips_Vs_Alpha", "NStrips_Vs_Alpha", 220, -20, 200, 10, 0, 10);
447  tmp = dqmStore_->book2D("NStrips_Vs_Beta", "NStrips_Vs_Beta", 220, -20, 200, 10, 0, 10);
449  tmp = dqmStore_->book1D("NHighStripInCluster", "NHighStripInCluster", 15, 0, 14);
451  tmp = dqmStore_->book1D("NSatStripInCluster", "NSatStripInCluster", 50, 0, 50);
453 
454  tmp = dqmStore_->book1D("TrackChi2OverNDF", "TrackChi2OverNDF", 500, 0, 10);
456  tmp = dqmStore_->book1D("TrackHits", "TrackHits", 40, 0, 40);
457  HTrackHits = tmp->getTH1F();
458 
459  tmp = dqmStore_->book1D("FirstStrip", "FirstStrip", 800, 0, 800);
460  HFirstStrip = tmp->getTH1F();
461 
462  if (strcmp(AlgoMode.c_str(), "MultiJob") != 0) {
463  tmp = dqmStore_->book2D("MPV_Vs_EtaTIB", "MPV_Vs_EtaTIB", 50, -3.0, 3.0, 300, 0, 600);
465  tmp = dqmStore_->book2D("MPV_Vs_EtaTID", "MPV_Vs_EtaTID", 50, -3.0, 3.0, 300, 0, 600);
467  tmp = dqmStore_->book2D("MPV_Vs_EtaTOB", "MPV_Vs_EtaTOB", 50, -3.0, 3.0, 300, 0, 600);
469  tmp = dqmStore_->book2D("MPV_Vs_EtaTEC", "MPV_Vs_EtaTEC", 50, -3.0, 3.0, 300, 0, 600);
471  tmp = dqmStore_->book2D("MPV_Vs_EtaTEC1", "MPV_Vs_EtaTEC1", 50, -3.0, 3.0, 300, 0, 600);
473  tmp = dqmStore_->book2D("MPV_Vs_EtaTEC2", "MPV_Vs_EtaTEC2", 50, -3.0, 3.0, 300, 0, 600);
475 
476  tmp = dqmStore_->book2D("MPV_Vs_PhiTIB", "MPV_Vs_PhiTIB", 50, -3.2, 3.2, 300, 0, 600);
478  tmp = dqmStore_->book2D("MPV_Vs_PhiTID", "MPV_Vs_PhiTID", 50, -3.2, 3.2, 300, 0, 600);
480  tmp = dqmStore_->book2D("MPV_Vs_PhiTOB", "MPV_Vs_PhiTOB", 50, -3.2, 3.2, 300, 0, 600);
482  tmp = dqmStore_->book2D("MPV_Vs_PhiTEC", "MPV_Vs_PhiTEC", 50, -3.2, 3.2, 300, 0, 600);
484  tmp = dqmStore_->book2D("MPV_Vs_PhiTEC1", "MPV_Vs_PhiTEC1", 50, -3.2, 3.2, 300, 0, 600);
486  tmp = dqmStore_->book2D("MPV_Vs_PhiTEC2", "MPV_Vs_PhiTEC2", 50, -3.2, 3.2, 300, 0, 600);
488 
489  tmp = dqmStore_->book1D("MPV_Vs_PathTIB", "MPV_Vs_PathTIB", 100, 0.2, 1.4);
491  tmp = dqmStore_->book1D("MPV_Vs_PathTID", "MPV_Vs_PathTID", 100, 0.2, 1.4);
493  tmp = dqmStore_->book1D("MPV_Vs_PathTOB", "MPV_Vs_PathTOB", 100, 0.2, 1.4);
495  tmp = dqmStore_->book1D("MPV_Vs_PathTEC", "MPV_Vs_PathTEC", 100, 0.2, 1.4);
497  tmp = dqmStore_->book1D("MPV_Vs_PathTEC1", "MPV_Vs_PathTEC1", 100, 0.2, 1.4);
499  tmp = dqmStore_->book1D("MPV_Vs_PathTEC2", "MPV_Vs_PathTEC2", 100, 0.2, 1.4);
501 
502  tmp = dqmStore_->book2D("MPV_Vs_Phi", "MPV_Vs_Phi", 50, -3.2, 3.2, 300, 0, 600);
503  MPV_Vs_Phi = tmp->getTH2F();
504  tmp = dqmStore_->book2D("MPV_Vs_Eta", "MPV_Vs_Eta", 50, -3.0, 3.0, 300, 0, 600);
505  MPV_Vs_Eta = tmp->getTH2F();
506  tmp = dqmStore_->book2D("MPV_Vs_R", "MPV_Vs_R", 150, 0.0, 150.0, 300, 0, 600);
507  MPV_Vs_R = tmp->getTH2F();
508  /*
509  tmp = dqmStore_->book1D ("MPV_Vs_PathLength_CS1" , "MPV_Vs_PathLength_CS1" , 250, 0.2, 1.4); MPV_Vs_PathLength_CS1 = tmp->getTH1F();
510  tmp = dqmStore_->book1D ("MPV_Vs_PathLength_CS2" , "MPV_Vs_PathLength_CS2" , 250, 0.2, 1.4); MPV_Vs_PathLength_CS2 = tmp->getTH1F();
511  tmp = dqmStore_->book1D ("MPV_Vs_PathLength_CS3" , "MPV_Vs_PathLength_CS3" , 250, 0.2, 1.4); MPV_Vs_PathLength_CS3 = tmp->getTH1F();
512  tmp = dqmStore_->book1D ("MPV_Vs_PathLength_CS4" , "MPV_Vs_PathLength_CS4" , 250, 0.2, 1.4); MPV_Vs_PathLength_CS4 = tmp->getTH1F();
513  tmp = dqmStore_->book1D ("MPV_Vs_PathLength_CS5" , "MPV_Vs_PathLength_CS5" , 250, 0.2, 1.4); MPV_Vs_PathLength_CS5 = tmp->getTH1F();
514 
515  tmp = dqmStore_->book1D ("FWHM_Vs_PathLength_CS1" , "FWHM_Vs_PathLength_CS1", 250, 0.2, 1.4); FWHM_Vs_PathLength_CS1 = tmp->getTH1F();
516  tmp = dqmStore_->book1D ("FWHM_Vs_PathLength_CS2" , "FWHM_Vs_PathLength_CS2", 250, 0.2, 1.4); FWHM_Vs_PathLength_CS2 = tmp->getTH1F();
517  tmp = dqmStore_->book1D ("FWHM_Vs_PathLength_CS3" , "FWHM_Vs_PathLength_CS3", 250, 0.2, 1.4); FWHM_Vs_PathLength_CS3 = tmp->getTH1F();
518  tmp = dqmStore_->book1D ("FWHM_Vs_PathLength_CS4" , "FWHM_Vs_PathLength_CS4", 250, 0.2, 1.4); FWHM_Vs_PathLength_CS4 = tmp->getTH1F();
519  tmp = dqmStore_->book1D ("FWHM_Vs_PathLength_CS5" , "FWHM_Vs_PathLength_CS5", 250, 0.2, 1.4); FWHM_Vs_PathLength_CS5 = tmp->getTH1F();
520 */
521  tmp = dqmStore_->book1D("MPV_Vs_PathLength", "MPV_Vs_PathLength", 100, 0.2, 1.4);
523  tmp = dqmStore_->book1D("MPV_Vs_PathLength320", "MPV_Vs_PathLength", 100, 0.2, 1.4);
525  tmp = dqmStore_->book1D("MPV_Vs_PathLength500", "MPV_Vs_PathLength", 100, 0.2, 1.4);
527 
528  tmp = dqmStore_->book1D("FWHM_Vs_PathLength", "FWHM_Vs_PathLength", 100, 0.2, 1.4);
530  tmp = dqmStore_->book1D("FWHM_Vs_PathLength320", "FWHM_Vs_PathLength", 100, 0.2, 1.4);
532  tmp = dqmStore_->book1D("FWHM_Vs_PathLength500", "FWHM_Vs_PathLength", 100, 0.2, 1.4);
534 
535  tmp = dqmStore_->book1D("MPV_Vs_TransversAngle", "MPV_Vs_TransversAngle", 220, -20, 200);
537  tmp = dqmStore_->book1D("MPV_Vs_Alpha", "MPV_Vs_Alpha", 220, -20, 200);
538  MPV_Vs_Alpha = tmp->getTH1F();
539  tmp = dqmStore_->book1D("MPV_Vs_Beta", "MPV_Vs_Beta", 220, -20, 200);
540  MPV_Vs_Beta = tmp->getTH1F();
541 
542  tmp = dqmStore_->book2D("Error_Vs_MPV", "Error_Vs_MPV", 600, 0, 600, 100, 0, 50);
543  Error_Vs_MPV = tmp->getTH2F();
544  tmp = dqmStore_->book2D("Error_Vs_Entries", "Error_Vs_Entries", 500, 0, 10000, 100, 0, 50);
546  tmp = dqmStore_->book2D("Error_Vs_Eta", "Error_Vs_Eta", 50, -3.0, 3.0, 100, 0, 50);
547  Error_Vs_Eta = tmp->getTH2F();
548  tmp = dqmStore_->book2D("Error_Vs_Phi", "Error_Vs_Phi", 50, -3.2, 3.2, 100, 0, 50);
549  Error_Vs_Phi = tmp->getTH2F();
550 
551  tmp = dqmStore_->book2D("NoMPV_Vs_EtaPhi", "NoMPV_Vs_EtaPhi", 50, -3.0, 3.0, 50, -3.2, 3.2);
553 
554  tmp = dqmStore_->book1D("NumberOfEntriesByAPV", "NumberOfEntriesByAPV", 1000, 0, 10000);
556  tmp = dqmStore_->book1D("Chi2OverNDF", "Chi2OverNDF", 500, 0, 25);
557  HChi2OverNDF = tmp->getTH1F();
558 
559  tmp = dqmStore_->book1D("MPVs", "MPVs", 600, 0, 600);
560  MPVs = tmp->getTH1F();
561  tmp = dqmStore_->book1D("MPVs320", "MPVs320", 600, 0, 600);
562  MPVs320 = tmp->getTH1F();
563  tmp = dqmStore_->book1D("MPVs500", "MPVs500", 600, 0, 600);
564  MPVs500 = tmp->getTH1F();
565 
566  // MPV_vs_10RplusEta tmp = dqmStore_->book2D ("MPV_vs_10RplusEta","MPV_vs_10RplusEta", 48000,0,2400, 800,100,500);
567  }
568 
569  gROOT->cd();
570 
571  auto const& Det = iSetup.getData(tkGeomToken_).dets();
572 
573  // if(strcmp(AlgoMode.c_str(),"MultiJob")!=0 && !FirstSetOfConstants){
574  if (!iSetup.getHandle(gainToken_)) {
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  if ((strcmp(AlgoMode.c_str(), "MultiJob") != 0 && !FirstSetOfConstants) || Validation) {
1139  const auto gainHandle = iSetup.getHandle(gainToken_);
1140  if (!gainHandle.isValid()) {
1141  printf("\n#####################\n\nERROR --> gainHandle is not valid\n\n#####################\n\n");
1142  exit(0);
1143  }
1144 
1145  for (std::vector<stAPVGain*>::iterator it = APVsCollOrdered.begin(); it != APVsCollOrdered.end(); it++) {
1146  stAPVGain* APV = *it;
1147 
1148  if (gainHandle.isValid()) {
1149  SiStripApvGain::Range detGainRange = gainHandle->getRange(APV->DetId);
1150  APV->PreviousGain = *(detGainRange.first + APV->APVId);
1151  // APV_PrevGain->Fill(APV->Index,APV->PreviousGain);
1152  APV_PrevGain->SetBinContent(APV_PrevGain->GetXaxis()->FindBin(APV->Index), APV->PreviousGain);
1153  if (APV->PreviousGain < 0)
1154  APV->PreviousGain = 1;
1155  } else {
1156  printf("GAIN HANDLE IS NOT VALID\n");
1157  }
1158  }
1159  }
1160 }
1161 
1163  if (strcmp(AlgoMode.c_str(), "WriteOnDB") == 0)
1164  return;
1165 
1166  if (NEvent == 0) {
1167  SRun = iEvent.id().run();
1168  SEvent = iEvent.id().event();
1169  STimestamp = iEvent.time().value();
1170  }
1171  ERun = iEvent.id().run();
1172  EEvent = iEvent.id().event();
1173  ETimestamp = iEvent.time().value();
1174  NEvent++;
1175 
1176  iEvent_ = &iEvent;
1177 
1178  Handle<TrajTrackAssociationCollection> trajTrackAssociationHandle;
1179  iEvent.getByLabel(TrajToTrackProducer, TrajToTrackLabel, trajTrackAssociationHandle);
1180  const TrajTrackAssociationCollection TrajToTrackMap = *trajTrackAssociationHandle.product();
1181 
1182  for (TrajTrackAssociationCollection::const_iterator it = TrajToTrackMap.begin(); it != TrajToTrackMap.end(); ++it) {
1183  const Track track = *it->val;
1184  const Trajectory traj = *it->key;
1185 
1186  if (track.p() < MinTrackMomentum || track.p() > MaxTrackMomentum || track.eta() < MinTrackEta ||
1187  track.eta() > MaxTrackEta)
1188  continue;
1189 
1190  Tracks_Pt_Vs_Eta->Fill(fabs(track.eta()), track.pt());
1191  Tracks_P_Vs_Eta->Fill(fabs(track.eta()), track.p());
1192 
1193  //BEGIN TO COMPUTE NDOF FOR TRACKS NO IMPLEMENTED BEFORE 200pre3
1194  int ndof = 0;
1195  const Trajectory::RecHitContainer transRecHits = traj.recHits();
1196 
1197  for (Trajectory::RecHitContainer::const_iterator rechit = transRecHits.begin(); rechit != transRecHits.end();
1198  ++rechit)
1199  if ((*rechit)->isValid())
1200  ndof += (*rechit)->dimension();
1201  ndof -= 5;
1202  //END TO COMPUTE NDOF FOR TRACKS NO IMPLEMENTED BEFORE 200pre3
1203 
1204  HTrackChi2OverNDF->Fill(traj.chiSquared() / ndof);
1205  if (traj.chiSquared() / ndof > MaxTrackChiOverNdf)
1206  continue;
1207 
1208  vector<TrajectoryMeasurement> measurements = traj.measurements();
1209  HTrackHits->Fill(traj.foundHits());
1210  if (traj.foundHits() < (int)MinTrackHits)
1211  continue;
1212  /*
1213  //BEGIN TO COMPUTE #MATCHEDRECHIT IN THE TRACK
1214  int NMatchedHit = 0;
1215  for(vector<TrajectoryMeasurement>::const_iterator measurement_it = measurements.begin(); measurement_it!=measurements.end(); measurement_it++){
1216  TrajectoryStateOnSurface trajState = measurement_it->updatedState();
1217  if( !trajState.isValid() ) continue;
1218  const TrackingRecHit* hit = (*measurement_it->recHit()).hit();
1219  const SiStripMatchedRecHit2D* sistripmatchedhit = dynamic_cast<const SiStripMatchedRecHit2D*>(hit);
1220  if(sistripmatchedhit)NMatchedHit++;
1221 // NMatchedHit++;
1222 
1223  }
1224  //END TO COMPUTE #MATCHEDRECHIT IN THE TRACK
1225 
1226  if(NMatchedHit<2){
1227  printf("NOT ENOUGH MATCHED RECHITS : %i\n",NMatchedHit);
1228  continue;
1229  }
1230 */
1231 
1232  for (vector<TrajectoryMeasurement>::const_iterator measurement_it = measurements.begin();
1233  measurement_it != measurements.end();
1234  measurement_it++) {
1235  TrajectoryStateOnSurface trajState = measurement_it->updatedState();
1236  if (!trajState.isValid())
1237  continue;
1238 
1239  const TrackingRecHit* hit = (*measurement_it->recHit()).hit();
1240  const SiStripRecHit1D* sistripsimple1dhit = dynamic_cast<const SiStripRecHit1D*>(hit);
1241  const SiStripRecHit2D* sistripsimplehit = dynamic_cast<const SiStripRecHit2D*>(hit);
1242  const SiStripMatchedRecHit2D* sistripmatchedhit = dynamic_cast<const SiStripMatchedRecHit2D*>(hit);
1243 
1244  if (sistripsimplehit) {
1246  (sistripsimplehit->cluster()).get(), trajState, &iSetup, &track, traj.chiSquared() / ndof);
1247  } else if (sistripmatchedhit) {
1248  ComputeChargeOverPath(&sistripmatchedhit->monoCluster(), trajState, &iSetup, &track, traj.chiSquared() / ndof);
1250  &sistripmatchedhit->stereoCluster(), trajState, &iSetup, &track, traj.chiSquared() / ndof);
1251  } else if (sistripsimple1dhit) {
1253  (sistripsimple1dhit->cluster()).get(), trajState, &iSetup, &track, traj.chiSquared() / ndof);
1254  } else {
1255  }
1256  }
1257  }
1258 }
1259 
1261  TrajectoryStateOnSurface trajState,
1262  const edm::EventSetup* iSetup,
1263  const Track* track,
1264  double trajChi2OverN) {
1265  LocalVector trackDirection = trajState.localDirection();
1266  double cosine = trackDirection.z() / trackDirection.mag();
1267  auto const& Ampls = Cluster->amplitudes();
1268  uint32_t DetId = 0; // is 0 since long time Cluster->geographicalId();
1269  int FirstStrip = Cluster->firstStrip();
1270  int APVId = FirstStrip / 128;
1271  stAPVGain* APV = APVsColl[(DetId << 3) | APVId];
1272  int Saturation = 0;
1273  bool Overlaping = false;
1274  int Charge = 0;
1275  unsigned int NHighStrip = 0;
1276 
1277  if (!IsFarFromBorder(trajState, DetId, iSetup))
1278  return -1;
1279 
1280  if (FirstStrip == 0)
1281  Overlaping = true;
1282  if (FirstStrip == 128)
1283  Overlaping = true;
1284  if (FirstStrip == 256)
1285  Overlaping = true;
1286  if (FirstStrip == 384)
1287  Overlaping = true;
1288  if (FirstStrip == 512)
1289  Overlaping = true;
1290  if (FirstStrip == 640)
1291  Overlaping = true;
1292 
1293  if (FirstStrip <= 127 && FirstStrip + Ampls.size() > 127)
1294  Overlaping = true;
1295  if (FirstStrip <= 255 && FirstStrip + Ampls.size() > 255)
1296  Overlaping = true;
1297  if (FirstStrip <= 383 && FirstStrip + Ampls.size() > 383)
1298  Overlaping = true;
1299  if (FirstStrip <= 511 && FirstStrip + Ampls.size() > 511)
1300  Overlaping = true;
1301  if (FirstStrip <= 639 && FirstStrip + Ampls.size() > 639)
1302  Overlaping = true;
1303 
1304  if (FirstStrip + Ampls.size() == 127)
1305  Overlaping = true;
1306  if (FirstStrip + Ampls.size() == 255)
1307  Overlaping = true;
1308  if (FirstStrip + Ampls.size() == 383)
1309  Overlaping = true;
1310  if (FirstStrip + Ampls.size() == 511)
1311  Overlaping = true;
1312  if (FirstStrip + Ampls.size() == 639)
1313  Overlaping = true;
1314  if (FirstStrip + Ampls.size() == 767)
1315  Overlaping = true;
1316  if (Overlaping)
1317  return -1;
1318 
1319  /*
1320  if(FirstStrip==0 )Overlaping=true;
1321  if(FirstStrip<=255 && FirstStrip+Ampls.size()>255)Overlaping=true;
1322  if(FirstStrip<=511 && FirstStrip+Ampls.size()>511)Overlaping=true;
1323  if(FirstStrip+Ampls.size()==511 )Overlaping=true;
1324  if(FirstStrip+Ampls.size()==767 )Overlaping=true;
1325  if(Overlaping)return -1;
1326 */
1327 
1328  for (unsigned int a = 0; a < Ampls.size(); a++) {
1329  Charge += Ampls[a];
1330  if (Ampls[a] >= 254)
1331  Saturation++;
1332  if (Ampls[a] >= 20)
1333  NHighStrip++;
1334  }
1335  double path = (10.0 * APV->Thickness) / fabs(cosine);
1336  double ClusterChargeOverPath = (double)Charge / path;
1337 
1338  NSatStripInCluster->Fill(Saturation);
1339 
1340  if (Ampls.size() > MaxNrStrips)
1341  return -1;
1342  if (Saturation > 0 && !AllowSaturation)
1343  return -1;
1345  if (APV->Thickness < 0.04)
1347  if (APV->Thickness > 0.04)
1349  if (APV->SubDet == StripSubdetector::TIB)
1350  Charge_Vs_PathTIB->Fill(path, Charge);
1351  if (APV->SubDet == StripSubdetector::TID)
1352  Charge_Vs_PathTID->Fill(path, Charge);
1353  if (APV->SubDet == StripSubdetector::TOB)
1354  Charge_Vs_PathTOB->Fill(path, Charge);
1355  if (APV->SubDet == StripSubdetector::TEC) {
1356  Charge_Vs_PathTEC->Fill(path, Charge);
1357  if (APV->Thickness < 0.04)
1358  Charge_Vs_PathTEC1->Fill(path, Charge);
1359  if (APV->Thickness > 0.04)
1360  Charge_Vs_PathTEC2->Fill(path, Charge);
1361  }
1362 
1363  double trans = atan2(trackDirection.y(), trackDirection.x()) * (180 / 3.14159265);
1364  double alpha =
1365  acos(trackDirection.x() / sqrt(pow(trackDirection.x(), 2) + pow(trackDirection.z(), 2))) * (180 / 3.14159265);
1366  double beta =
1367  acos(trackDirection.y() / sqrt(pow(trackDirection.x(), 2) + pow(trackDirection.z(), 2))) * (180 / 3.14159265);
1368 
1369  if (path > 0.4 && path < 0.45) {
1370  Charge_Vs_TransversAngle->Fill(trans, Charge / path);
1371  Charge_Vs_Alpha->Fill(alpha, Charge / path);
1372  Charge_Vs_Beta->Fill(beta, Charge / path);
1373  }
1374 
1375  NStrips_Vs_TransversAngle->Fill(trans, Ampls.size());
1376  NStrips_Vs_Alpha->Fill(alpha, Ampls.size());
1377  NStrips_Vs_Beta->Fill(beta, Ampls.size());
1378 
1379  NHighStripInCluster->Fill(NHighStrip);
1380  // if(NHighStrip==1) Charge_Vs_PathLength_CS1->Fill(path, Charge );
1381  // if(NHighStrip==2) Charge_Vs_PathLength_CS2->Fill(path, Charge );
1382  // if(NHighStrip==3) Charge_Vs_PathLength_CS3->Fill(path, Charge );
1383  // if(NHighStrip==4) Charge_Vs_PathLength_CS4->Fill(path, Charge );
1384  // if(NHighStrip==5) Charge_Vs_PathLength_CS5->Fill(path, Charge );
1385 
1386  HFirstStrip->Fill(FirstStrip);
1387 
1388  if (Validation) {
1389  ClusterChargeOverPath = ClusterChargeOverPath / APV->PreviousGain;
1390  }
1391 
1392  APV_Charge->Fill(APV->Index, ClusterChargeOverPath);
1393  APV_Momentum->Fill(APV->Index, trajState.globalMomentum().mag());
1394  APV_PathLength->Fill(APV->Index, path);
1395 
1396  return ClusterChargeOverPath;
1397 }
1398 
1400  const uint32_t detid,
1401  const edm::EventSetup* iSetup) {
1402  const auto& tkGeom = iSetup->getData(tkGeomToken_);
1403 
1404  LocalPoint HitLocalPos = trajState.localPosition();
1405  LocalError HitLocalError = trajState.localError().positionError();
1406 
1407  const GeomDetUnit* it = tkGeom.idToDetUnit(DetId(detid));
1408  if (dynamic_cast<const StripGeomDetUnit*>(it) == nullptr && dynamic_cast<const PixelGeomDetUnit*>(it) == nullptr) {
1409  std::cout << "this detID doesn't seem to belong to the Tracker" << std::endl;
1410  return false;
1411  }
1412 
1413  const BoundPlane plane = it->surface();
1414  const TrapezoidalPlaneBounds* trapezoidalBounds(dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
1415  const RectangularPlaneBounds* rectangularBounds(dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));
1416 
1417  double DistFromBorder = 1.0;
1418  //double HalfWidth = it->surface().bounds().width() /2.0;
1419  double HalfLength = it->surface().bounds().length() / 2.0;
1420 
1421  if (trapezoidalBounds) {
1422  std::array<const float, 4> const& parameters = (*trapezoidalBounds).parameters();
1423  HalfLength = parameters[3];
1424  //double t = (HalfLength + HitLocalPos.y()) / (2*HalfLength) ;
1425  //HalfWidth = parameters[0] + (parameters[1]-parameters[0]) * t;
1426  } else if (rectangularBounds) {
1427  //HalfWidth = it->surface().bounds().width() /2.0;
1428  HalfLength = it->surface().bounds().length() / 2.0;
1429  } else {
1430  return false;
1431  }
1432 
1433  // if (fabs(HitLocalPos.x())+HitLocalError.xx() >= (HalfWidth - DistFromBorder) ) return false;//Don't think is really necessary
1434  if (fabs(HitLocalPos.y()) + HitLocalError.yy() >= (HalfLength - DistFromBorder))
1435  return false;
1436 
1437  return true;
1438 }
1439 
1440 void SiStripGainFromData::getPeakOfLandau(TH1* InputHisto, double* FitResults, double LowRange, double HighRange) {
1441  double adcs = -0.5;
1442  double adcs_err = 0.;
1443  double width = -0.5;
1444  double width_err = 0;
1445  double chi2overndf = -0.5;
1446 
1447  double nr_of_entries = InputHisto->GetEntries();
1448 
1449  if ((unsigned int)nr_of_entries < MinNrEntries) {
1450  FitResults[0] = adcs;
1451  FitResults[1] = adcs_err;
1452  FitResults[2] = width;
1453  FitResults[3] = width_err;
1454  FitResults[4] = chi2overndf;
1455  return;
1456  }
1457 
1458  // perform fit with standard landau
1459  TF1* MyLandau = new TF1("MyLandau", "landau", LowRange, HighRange);
1460  MyLandau->SetParameter("MPV", 300);
1461 
1462  InputHisto->Fit(MyLandau, "QR WW");
1463 
1464  // MPV is parameter 1 (0=constant, 1=MPV, 2=Sigma)
1465  adcs = MyLandau->GetParameter("MPV");
1466  adcs_err = MyLandau->GetParError(1);
1467  width = MyLandau->GetParameter(2);
1468  width_err = MyLandau->GetParError(2);
1469  chi2overndf = MyLandau->GetChisquare() / MyLandau->GetNDF();
1470 
1471  // if still wrong, give up
1472  if (adcs < 2. || chi2overndf > MaxChi2OverNDF) {
1473  adcs = -0.5;
1474  adcs_err = 0.;
1475  width = -0.5;
1476  width_err = 0;
1477  chi2overndf = -0.5;
1478  }
1479 
1480  FitResults[0] = adcs;
1481  FitResults[1] = adcs_err;
1482  FitResults[2] = width;
1483  FitResults[3] = width_err;
1484  FitResults[4] = chi2overndf;
1485 
1486  delete MyLandau;
1487 }
1488 
1489 std::unique_ptr<SiStripApvGain> SiStripGainFromData::getNewObject() {
1490  cout << "START getNewObject\n";
1491 
1492  // if( !(strcmp(AlgoMode.c_str(),"WriteOnDB")==0 || strcmp(AlgoMode.c_str(),"SingleJob")==0) )return NULL;
1493  if (!(strcmp(AlgoMode.c_str(), "WriteOnDB") == 0 || strcmp(AlgoMode.c_str(), "SingleJob") == 0))
1494  return std::make_unique<SiStripApvGain>();
1495 
1496  auto obj = std::make_unique<SiStripApvGain>();
1497  std::vector<float>* theSiStripVector = nullptr;
1498  int PreviousDetId = -1;
1499  for (unsigned int a = 0; a < APVsCollOrdered.size(); a++) {
1501  if (APV == nullptr) {
1502  printf("Bug\n");
1503  continue;
1504  }
1505  if (APV->DetId != PreviousDetId) {
1506  if (theSiStripVector != nullptr) {
1507  SiStripApvGain::Range range(theSiStripVector->begin(), theSiStripVector->end());
1508  if (!obj->put(PreviousDetId, range))
1509  printf("Bug to put detId = %i\n", PreviousDetId);
1510  }
1511 
1512  theSiStripVector = new std::vector<float>;
1513  PreviousDetId = APV->DetId;
1514  }
1515  printf("%i | %i | PreviousGain = %7.5f NewGain = %7.5f\n", APV->DetId, APV->APVId, APV->PreviousGain, APV->Gain);
1516  theSiStripVector->push_back(APV->Gain);
1517  // theSiStripVector->push_back(APV->Gain);
1518  }
1519 
1520  if (theSiStripVector != nullptr) {
1521  SiStripApvGain::Range range(theSiStripVector->begin(), theSiStripVector->end());
1522  if (!obj->put(PreviousDetId, range))
1523  printf("Bug to put detId = %i\n", PreviousDetId);
1524  }
1525 
1526  cout << "END getNewObject\n";
1527  return obj;
1528 }
1529 
Vector3DBase< float, LocalTag >
SiStripGainFromData::FirstSetOfConstants
bool FirstSetOfConstants
Definition: SiStripGainFromData.cc:128
SiStripGainFromData::Charge_Vs_Alpha
TH2F * Charge_Vs_Alpha
Definition: SiStripGainFromData.cc:254
SiStripGainFromData::CheckLocalAngle
bool CheckLocalAngle
Definition: SiStripGainFromData.cc:116
SiStripGainFromData::Charge_Vs_PathTEC1
TH2F * Charge_Vs_PathTEC1
Definition: SiStripGainFromData.cc:169
FEDNumbering.h
SiStripGainFromData::CalibrationLevel
int CalibrationLevel
Definition: SiStripGainFromData.cc:130
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:30
SiStripRecHit2D::cluster
ClusterRef cluster() const
Definition: SiStripRecHit2D.h:22
stAPVGain::APVId
int APVId
Definition: SiStripGainFromData.cc:75
SiStripGainFromData::Charge_TID
TH1F * Charge_TID
Definition: SiStripGainFromData.cc:180
mps_fire.i
i
Definition: mps_fire.py:428
ProducerES_cfi.HalfLength
HalfLength
Definition: ProducerES_cfi.py:87
SiStripGainFromData::MaxMPVError
double MaxMPVError
Definition: SiStripGainFromData.cc:118
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
SiStripGainFromData::MPV_Vs_PathLength
TH1F * MPV_Vs_PathLength
Definition: SiStripGainFromData.cc:242
SiStripGainFromData::VInputFiles
vector< string > VInputFiles
Definition: SiStripGainFromData.cc:139
SiStripGainFromData::NStrips_Vs_Beta
TH2F * NStrips_Vs_Beta
Definition: SiStripGainFromData.cc:260
StripGeomDetUnit.h
MessageLogger.h
TrackerGeometry.h
GeomDet
Definition: GeomDet.h:27
SiStripGainFromData::FWHM_Vs_PathLength
TH1F * FWHM_Vs_PathLength
Definition: SiStripGainFromData.cc:246
edm::Handle::product
T const * product() const
Definition: Handle.h:70
SiStripGainFromData::Charge_TOB
TH1F * Charge_TOB
Definition: SiStripGainFromData.cc:183
SiStripGainFromData::algoBeginRun
void algoBeginRun(const edm::Run &, const edm::EventSetup &) override
Definition: SiStripGainFromData.cc:1137
SiStripGainFromData::SRun
unsigned int SRun
Definition: SiStripGainFromData.cc:277
SiStripGainFromData::MinNrEntries
unsigned int MinNrEntries
Definition: SiStripGainFromData.cc:117
SiStripGainFromData::getPeakOfLandau
void getPeakOfLandau(TH1 *InputHisto, double *FitResults, double LowRange=0, double HighRange=5400)
Definition: SiStripGainFromData.cc:1440
SiStripGainFromData::APVsCollOrdered
std::vector< stAPVGain * > APVsCollOrdered
Definition: SiStripGainFromData.cc:293
SiStripMatchedRecHit2D::stereoCluster
SiStripCluster const & stereoCluster() const
Definition: SiStripMatchedRecHit2D.h:40
SiStripGainFromData::OutputGains
std::string OutputGains
Definition: SiStripGainFromData.cc:134
LocalTrajectoryError::positionError
LocalError positionError() const
Definition: LocalTrajectoryError.h:81
SiStripGainFromData::tmp
MonitorElement * tmp
Definition: SiStripGainFromData.cc:141
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:274
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
SiStripGainFromData::ETimestamp
TimeValue_t ETimestamp
Definition: SiStripGainFromData.cc:282
edm::Run
Definition: Run.h:45
SiStripGainFromData::MPV_Vs_PathLength500
TH1F * MPV_Vs_PathLength500
Definition: SiStripGainFromData.cc:244
SiStripGainFromData::MinTrackHits
unsigned int MinTrackHits
Definition: SiStripGainFromData.cc:125
HLT_FULL_cff.beta
beta
Definition: HLT_FULL_cff.py:8686
SiStripGainFromData::SiStripGainFromData
SiStripGainFromData(const edm::ParameterSet &)
Definition: SiStripGainFromData.cc:301
SiStripGainFromData::MPVs320
TH1F * MPVs320
Definition: SiStripGainFromData.cc:213
edm
HLT enums.
Definition: AlignableModifier.h:19
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:153
SiStripGainFromData::MaxChi2OverNDF
double MaxChi2OverNDF
Definition: SiStripGainFromData.cc:119
SiStripGainFromData::Error_Vs_Phi
TH2F * Error_Vs_Phi
Definition: SiStripGainFromData.cc:265
stAPVGain
Definition: APVGainStruct.h:7
SiStripGainFromData::Validation
bool Validation
Definition: SiStripGainFromData.cc:129
stAPVGain::DetId
int DetId
Definition: SiStripGainFromData.cc:74
GeomDetType.h
stAPVGain::Side
char Side
Definition: SiStripGainFromData.cc:84
SiStripGainFromData::MPV_Vs_PhiTEC2
TH2F * MPV_Vs_PhiTEC2
Definition: SiStripGainFromData.cc:163
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:1260
DQMStore.h
alpha
float alpha
Definition: AMPTWrapper.h:105
SiStripRecHit2D
Definition: SiStripRecHit2D.h:7
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
IntegrityClient_cfi.Gain
Gain
Definition: IntegrityClient_cfi.py:16
SiStripGainFromData::Tracks_Pt_Vs_Eta
TH2F * Tracks_Pt_Vs_Eta
Definition: SiStripGainFromData.cc:144
SiStripGainFromData::algoBeginJob
void algoBeginJob(const edm::EventSetup &) override
Definition: SiStripGainFromData.cc:344
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EDAnalyzer.h
SiStripGainFromData::MPV_Vs_PhiTEC1
TH2F * MPV_Vs_PhiTEC1
Definition: SiStripGainFromData.cc:162
SiStripGainFromData::APV_CumulGain
TH1F * APV_CumulGain
Definition: SiStripGainFromData.cc:208
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
StripTopology.h
SiStripGainFromData::gainToken_
edm::ESGetToken< SiStripGain, SiStripGainRcd > gainToken_
Definition: SiStripGainFromData.cc:298
SiStripGainFromData::APV_Gain
TH1F * APV_Gain
Definition: SiStripGainFromData.cc:207
Trajectory::foundHits
int foundHits() const
Definition: Trajectory.h:206
SiStripGainFromData::APV_DetId
TH1F * APV_DetId
Definition: SiStripGainFromData.cc:197
SiStripGainFromData::MPV_Vs_EtaTID
TH2F * MPV_Vs_EtaTID
Definition: SiStripGainFromData.cc:152
SiStripGainFromData::Charge_Vs_PathTEC
TH2F * Charge_Vs_PathTEC
Definition: SiStripGainFromData.cc:168
SiStripGainFromData::OutputHistos
std::string OutputHistos
Definition: SiStripGainFromData.cc:135
edm::Handle
Definition: AssociativeIterator.h:50
SiStripGainFromData::Charge_TIDM
TH1F * Charge_TIDM
Definition: SiStripGainFromData.cc:182
SiStripGainFromData::Charge_Vs_Beta
TH2F * Charge_Vs_Beta
Definition: SiStripGainFromData.cc:258
dqm::legacy::MonitorElement::getTH1F
virtual TH1F * getTH1F() const
Definition: MonitorElement.h:479
SiStripGainFromData::Error_Vs_MPV
TH2F * Error_Vs_MPV
Definition: SiStripGainFromData.cc:262
SiStripGainFromData::APVsColl
std::unordered_map< unsigned int, stAPVGain * > APVsColl
Definition: SiStripGainFromData.cc:294
SiStripGainFromData::HChi2OverNDF
TH1F * HChi2OverNDF
Definition: SiStripGainFromData.cc:147
SiStripGainFromData::MinTrackEta
double MinTrackEta
Definition: SiStripGainFromData.cc:122
DeDxTools::IsFarFromBorder
bool IsFarFromBorder(const TrajectoryStateOnSurface &trajState, const GeomDetUnit *it)
Definition: DeDxTools.cc:426
Bounds::length
virtual float length() const =0
SiStripGainFromData::MPV_Vs_PathTID
TH1F * MPV_Vs_PathTID
Definition: SiStripGainFromData.cc:173
SiStripGainFromData::MPV_Vs_Beta
TH1F * MPV_Vs_Beta
Definition: SiStripGainFromData.cc:259
SiStripCluster::firstStrip
uint16_t firstStrip() const
Definition: SiStripCluster.h:46
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
ndof
Definition: HIMultiTrackSelector.h:49
SiStripGainFromData::NumberOfEntriesByAPV
TH1F * NumberOfEntriesByAPV
Definition: SiStripGainFromData.cc:146
SiStripGainFromData::NEvent
unsigned int NEvent
Definition: SiStripGainFromData.cc:276
SiStripGainFromData::APV_R
TH1F * APV_R
Definition: SiStripGainFromData.cc:200
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:148
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:172
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:154
DeDxHit.h
TrajectoryStateOnSurface::localDirection
LocalVector localDirection() const
Definition: TrajectoryStateOnSurface.h:76
TrapezoidalPlaneBounds.h
SiStripGainFromData::Error_Vs_Eta
TH2F * Error_Vs_Eta
Definition: SiStripGainFromData.cc:264
ntupleEnum.SubDet
SubDet
Definition: ntupleEnum.py:15
SiStripGainFromData::Charge_Vs_PathTOB
TH2F * Charge_Vs_PathTOB
Definition: SiStripGainFromData.cc:167
SiStripGainFromData::MPV_Vs_PathLength320
TH1F * MPV_Vs_PathLength320
Definition: SiStripGainFromData.cc:243
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:123
SiStripGainFromData::Charge_TECP
TH1F * Charge_TECP
Definition: SiStripGainFromData.cc:187
SiStripGainFromData::MPV_Vs_PhiTID
TH2F * MPV_Vs_PhiTID
Definition: SiStripGainFromData.cc:159
reco::Track
Definition: Track.h:27
SiStripGainFromData::isEqual
Definition: SiStripGainFromData.cc:285
SiStripGainFromData::TrajToTrackProducer
std::string TrajToTrackProducer
Definition: SiStripGainFromData.cc:136
SiStripGainFromData::Charge_TEC2
TH1F * Charge_TEC2
Definition: SiStripGainFromData.cc:186
SiStripGainFromData::CheckIfFileExist
bool CheckIfFileExist
Definition: SiStripGainFromData.cc:131
SiStripGainFromData::HitLocalPositionBefCut
TH2F * HitLocalPositionBefCut
Definition: SiStripGainFromData.cc:270
RectangularPlaneBounds.h
SiStripGainFromData::tkGeomToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
Definition: SiStripGainFromData.cc:297
SiStripGainFromData::MPVs
TH1F * MPVs
Definition: SiStripGainFromData.cc:212
StripSubdetector::TIB
static constexpr auto TIB
Definition: StripSubdetector.h:16
SiStripGainFromData::AllowSaturation
bool AllowSaturation
Definition: SiStripGainFromData.cc:127
SiStripGainFromData::DQMStore
dqm::legacy::DQMStore DQMStore
Definition: SiStripGainFromData.cc:90
VtxSmearedParameters_cfi.Phi
Phi
Definition: VtxSmearedParameters_cfi.py:112
SiStripGainFromData::MaxNrStrips
unsigned int MaxNrStrips
Definition: SiStripGainFromData.cc:124
Point3DBase< float, LocalTag >
SiStripGainFromData::HTrackHits
TH1F * HTrackHits
Definition: SiStripGainFromData.cc:149
SiStripApvGain.h
dqm::implementation::DQMStore::save
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
Definition: DQMStore.cc:761
b
double b
Definition: hdecay.h:118
SiStripGainFromData::MPV_Vs_PhiTIB
TH2F * MPV_Vs_PhiTIB
Definition: SiStripGainFromData.cc:158
TrajTrackAssociation.h
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
SiStripGainFromData::FWHM_Vs_PathLength500
TH1F * FWHM_Vs_PathLength500
Definition: SiStripGainFromData.cc:248
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:126
SiStripGainFromData::Charge_TEC1
TH1F * Charge_TEC1
Definition: SiStripGainFromData.cc:185
SiStripGainFromData::MPV_Vs_TransversAngle
TH1F * MPV_Vs_TransversAngle
Definition: SiStripGainFromData.cc:251
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:199
SiStripGainFromData::MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: SiStripGainFromData.cc:89
SiStripGainFromData::APV_SubDet
TH1F * APV_SubDet
Definition: SiStripGainFromData.cc:201
TrackerDigiGeometryRecord.h
SiStripGainFromData::JobInfo
TH1F * JobInfo
Definition: SiStripGainFromData.cc:272
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:205
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripGainFromData::~SiStripGainFromData
~SiStripGainFromData() override
Definition: SiStripGainFromData.cc:342
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:239
SiStripGainFromData::Charge_Vs_TransversAngle
TH2F * Charge_Vs_TransversAngle
Definition: SiStripGainFromData.cc:250
Event.h
SiStripGainFromData::algoAnalyze
void algoAnalyze(const edm::Event &, const edm::EventSetup &) override
Definition: SiStripGainFromData.cc:1162
LocalError
Definition: LocalError.h:12
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >
stAPVGain::MPV
double MPV
Definition: SiStripGainFromData.cc:81
SiStripGainFromData::STimestamp
TimeValue_t STimestamp
Definition: SiStripGainFromData.cc:279
SiStripGainFromData::APV_Thickness
TH1F * APV_Thickness
Definition: SiStripGainFromData.cc:210
SiStripGainFromData::APV_Id
TH1F * APV_Id
Definition: SiStripGainFromData.cc:198
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
SiStripGainFromData::Charge_Vs_PathTEC2
TH2F * Charge_Vs_PathTEC2
Definition: SiStripGainFromData.cc:170
sistrip::APV
Definition: ConstantsForGranularity.h:79
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:247
SiStripGainFromData::Tracks_P_Vs_Eta
TH2F * Tracks_P_Vs_Eta
Definition: SiStripGainFromData.cc:143
SiStripGainFromData::ERun
unsigned int ERun
Definition: SiStripGainFromData.cc:280
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
SiStripGainFromData::Charge_Vs_PathLength500
TH2F * Charge_Vs_PathLength500
Definition: SiStripGainFromData.cc:240
SiStripRecHit1D::cluster
ClusterRef cluster() const
Definition: SiStripRecHit1D.h:18
SiStripGainFromData::Charge_TIB
TH1F * Charge_TIB
Definition: SiStripGainFromData.cc:179
edm::EventSetup
Definition: EventSetup.h:58
SiStripRecHit1D
Definition: SiStripRecHit1D.h:8
SiStripCluster::amplitudes
SiStripCluster const & amplitudes() const
Definition: SiStripCluster.h:68
SiStripGainFromData::EEvent
unsigned int EEvent
Definition: SiStripGainFromData.cc:281
GeometricDet.h
TrapezoidalPlaneBounds
Definition: TrapezoidalPlaneBounds.h:15
get
#define get
SiStripGainFromData::MPV_Vs_R
TH2F * MPV_Vs_R
Definition: SiStripGainFromData.cc:192
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd >
ConditionDBWriter.h
SiStripGainFromData::MPV_Vs_PathTEC
TH1F * MPV_Vs_PathTEC
Definition: SiStripGainFromData.cc:175
StripTopology::nstrips
virtual int nstrips() const =0
SiStripGainFromData::MPV_Vs_PathTOB
TH1F * MPV_Vs_PathTOB
Definition: SiStripGainFromData.cc:174
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:1399
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
TrackingRecHit
Definition: TrackingRecHit.h:21
SiStripRecHit1D.h
SiStripGainFromData::MPV_Vs_EtaTEC2
TH2F * MPV_Vs_EtaTEC2
Definition: SiStripGainFromData.cc:156
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
SiStripGainFromData::MPV_Vs_Alpha
TH1F * MPV_Vs_Alpha
Definition: SiStripGainFromData.cc:255
stAPVGain::SubDet
int SubDet
Definition: SiStripGainFromData.cc:76
SiStripGainFromData::iEvent_
const edm::Event * iEvent_
Definition: SiStripGainFromData.cc:114
SiStripGainFromData::algoEndJob
void algoEndJob() override
Definition: SiStripGainFromData.cc:643
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
SiStripGainFromData::Charge_TIDP
TH1F * Charge_TIDP
Definition: SiStripGainFromData.cc:181
SiStripGainFromData::MaxTrackMomentum
double MaxTrackMomentum
Definition: SiStripGainFromData.cc:121
SiStripGainFromData::MPV_Vs_PhiTEC
TH2F * MPV_Vs_PhiTEC
Definition: SiStripGainFromData.cc:161
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:288
SiStripGainFromData::APV_PrevGain
TH1F * APV_PrevGain
Definition: SiStripGainFromData.cc:209
SiStripGainFromData::Charge_Vs_PathTID
TH2F * Charge_Vs_PathTID
Definition: SiStripGainFromData.cc:166
SiStripGainFromData::Charge_TECM
TH1F * Charge_TECM
Definition: SiStripGainFromData.cc:188
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:256
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:263
DetId.h
SiStripGainFromData::MPVs500
TH1F * MPVs500
Definition: SiStripGainFromData.cc:214
Trajectory
Definition: Trajectory.h:38
SiStripGainFromData::MPV_Vs_Phi
TH2F * MPV_Vs_Phi
Definition: SiStripGainFromData.cc:190
Frameworkfwd.h
SiStripGainFromData::iSetup_
const edm::EventSetup * iSetup_
Definition: SiStripGainFromData.cc:113
T
long double T
Definition: Basic3DVectorLD.h:48
SiStripGainFromData::APV_Charge
TH2F * APV_Charge
Definition: SiStripGainFromData.cc:203
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:219
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:165
PixelGeomDetUnit.h
SiStripGainFromData
Definition: SiStripGainFromData.cc:87
SiStripGainFromData::MPV_Vs_EtaTIB
TH2F * MPV_Vs_EtaTIB
Definition: SiStripGainFromData.cc:151
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
PixelTestBeamValidation_cfi.Charge
Charge
Definition: PixelTestBeamValidation_cfi.py:91
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SiStripGainFromData::Charge_TEC
TH1F * Charge_TEC
Definition: SiStripGainFromData.cc:184
Exception.h
SiStripGainFromData::MPV_Vs_PhiTOB
TH2F * MPV_Vs_PhiTOB
Definition: SiStripGainFromData.cc:160
SiStripGainFromData::TrajToTrackLabel
std::string TrajToTrackLabel
Definition: SiStripGainFromData.cc:137
SiStripGainFromData::NSatStripInCluster
TH1F * NSatStripInCluster
Definition: SiStripGainFromData.cc:218
SiStripGainFromData::APV_Momentum
TH2F * APV_Momentum
Definition: SiStripGainFromData.cc:202
SiStripGainFromData::getNewObject
std::unique_ptr< SiStripApvGain > getNewObject() override
Definition: SiStripGainFromData.cc:1489
SiStripGainFromData::NStrips_Vs_TransversAngle
TH2F * NStrips_Vs_TransversAngle
Definition: SiStripGainFromData.cc:252
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
hcaldqm::constants::BAD
const double BAD
Definition: Constants.h:15
SiStripGainFromData::NoMPV_Vs_EtaPhi
TH2F * NoMPV_Vs_EtaPhi
Definition: SiStripGainFromData.cc:267
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:191
SiStripGainFromData::SEvent
unsigned int SEvent
Definition: SiStripGainFromData.cc:278
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
ParameterSet.h
SiStripGainFromData::HitLocalPosition
TH2F * HitLocalPosition
Definition: SiStripGainFromData.cc:269
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:155
SiStripClusterCollection.h
SiStripGainFromData::Charge_Vs_PathLength
TH2F * Charge_Vs_PathLength
Definition: SiStripGainFromData.cc:238
edm::Event
Definition: Event.h:73
SiStripGainFromData::APV_MPV
TH1F * APV_MPV
Definition: SiStripGainFromData.cc:206
SiStripGainFromData::AlgoMode
std::string AlgoMode
Definition: SiStripGainFromData.cc:133
TrajectoryStateOnSurface::localError
const LocalTrajectoryError & localError() const
Definition: TrajectoryStateOnSurface.h:77
SiStripApvGain
Definition: SiStripApvGain.h:25
SiStripCluster
Definition: SiStripCluster.h:8
SiStripGainFromData::dqmStore_
DQMStore * dqmStore_
Definition: SiStripGainFromData.cc:102
SiStripGainFromData::MinTrackMomentum
double MinTrackMomentum
Definition: SiStripGainFromData.cc:120
dttmaxenums::R
Definition: DTTMax.h:29
SiStripRecHit2D.h
SiStripGainFromData::MPV_Vs_PathTEC2
TH1F * MPV_Vs_PathTEC2
Definition: SiStripGainFromData.cc:177
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:176
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:204
SiStripGainFromData::tTopoToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
Definition: SiStripGainFromData.cc:296
dqm::legacy::MonitorElement::getTH2F
virtual TH2F * getTH2F() const
Definition: MonitorElement.h:491
TrackerTopology::tecSide
unsigned int tecSide(const DetId &id) const
Definition: TrackerTopology.h:184