CMS 3D CMS Logo

SiPixelModuleStatus.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <map>
3 #include <cmath>
4 #include <vector>
5 
6 #include <TMath.h>
7 #include <TH1.h>
8 
10 
11 // ----------------------------------------------------------------------
12 SiPixelModuleStatus::SiPixelModuleStatus(int detId, int nrocs) : fDetid_(detId), fNrocs_(nrocs) {
13  for (int i = 0; i < fNrocs_; ++i) {
15  fRocs_.push_back(a);
16  }
17 };
18 
19 // ----------------------------------------------------------------------
21 
22 // ----------------------------------------------------------------------
24  if (iroc < fNrocs_)
25  fRocs_[iroc].fillDIGI();
26 }
27 // ----------------------------------------------------------------------
29  int roc_first = int(ch.roc_first);
30  int roc_last = int(ch.roc_last);
31  for (int iroc = 0; iroc < fNrocs_; iroc++) {
32  if (iroc >= roc_first && iroc <= roc_last) {
33  fRocs_[iroc].fillFEDerror25();
34  }
35  }
36 }
37 // ----------------------------------------------------------------------
39 // ----------------------------------------------------------------------
41 // ----------------------------------------------------------------------
43 // ----------------------------------------------------------------------
44 void SiPixelModuleStatus::setNrocs(int nRoc) { fNrocs_ = nRoc; }
45 
46 // ----------------------------------------------------------------------
47 void SiPixelModuleStatus::updateDIGI(int iroc, unsigned int nhit) {
48  if (iroc < fNrocs_)
49  fRocs_[iroc].updateDIGI(nhit);
50 }
51 // ----------------------------------------------------------------------
52 void SiPixelModuleStatus::updateFEDerror25(int iroc, bool fedError25) {
53  if (iroc < fNrocs_)
54  fRocs_[iroc].updateFEDerror25(fedError25);
55 }
56 
57 // ----------------------------------------------------------------------
58 unsigned int SiPixelModuleStatus::digiOccROC(int iroc) { return (iroc < fNrocs_ ? fRocs_[iroc].digiOccROC() : 0); }
59 // ----------------------------------------------------------------------
60 bool SiPixelModuleStatus::fedError25(int iroc) { return (iroc < fNrocs_ ? fRocs_[iroc].isFEDerror25() : false); }
61 // ----------------------------------------------------------------------
63  unsigned int count(0);
64  for (int iroc = 0; iroc < fNrocs_; ++iroc) {
65  count += digiOccROC(iroc);
66  }
67  return count;
68 }
69 
70 // ----------------------------------------------------------------------
72  unsigned int ave(0);
73  for (int iroc = 0; iroc < fNrocs_; ++iroc) {
74  unsigned int inc = digiOccROC(iroc);
75  ave += inc;
76  }
77  return (1.0 * ave) / fNrocs_;
78 }
79 
81  double fModAverage = SiPixelModuleStatus::perRocDigiOcc();
82 
83  double sig = 1.0;
84  for (int iroc = 0; iroc < fNrocs_; ++iroc) {
85  unsigned int inc = digiOccROC(iroc);
86  sig += (fModAverage - inc) * (fModAverage - inc);
87  }
88 
89  double fModSigma = sig / (fNrocs_ - 1);
90  return TMath::Sqrt(fModSigma);
91 }
92 
93 // ----------------------------------------------------------------------
94 // Return the address not the value of ROC status
95 SiPixelRocStatus* SiPixelModuleStatus::getRoc(int iroc) { return (iroc < fNrocs_ ? &fRocs_[iroc] : nullptr); }
96 
97 // ----------------------------------------------------------------------
98 void SiPixelModuleStatus::updateModuleDIGI(int iroc, unsigned int nhits) {
99  if (iroc < fNrocs_)
100  fRocs_[iroc].updateDIGI(nhits);
101 }
102 // ----------------------------------------------------------------------
104  bool isSameModule = true;
105  if (fDetid_ != newData.detid() || fNrocs_ != newData.nrocs()) {
106  isSameModule = false;
107  }
108 
109  if (isSameModule) {
110  for (int iroc = 0; iroc < fNrocs_; ++iroc) { // loop over rocs
111  //update occupancy
112  fRocs_[iroc].updateDIGI(newData.digiOccROC(iroc));
113  //update FEDerror25
114  fRocs_[iroc].updateFEDerror25(newData.fedError25(iroc));
115 
116  } // loop over rocs
117 
118  } // if same module
119 }
mps_fire.i
i
Definition: mps_fire.py:428
SiPixelModuleStatus::fNrocs_
int fNrocs_
Definition: SiPixelModuleStatus.h:52
PixelFEDChannel
Definition: PixelFEDChannel.h:6
SiPixelModuleStatus::digiOccMOD
unsigned int digiOccMOD()
return module status (= hits on module)
Definition: SiPixelModuleStatus.cc:62
SiPixelModuleStatus::fillDIGI
void fillDIGI(int iroc)
fill digi
Definition: SiPixelModuleStatus.cc:23
SiPixelModuleStatus::setDetId
void setDetId(int detid)
Definition: SiPixelModuleStatus.cc:42
SiPixelModuleStatus::fRocs_
std::vector< SiPixelRocStatus > fRocs_
Definition: SiPixelModuleStatus.h:53
SiPixelRocStatus
Definition: SiPixelRocStatus.h:5
SiPixelModuleStatus::SiPixelModuleStatus
SiPixelModuleStatus(int det=0, int nrocs=16)
Definition: SiPixelModuleStatus.cc:12
SiPixelModuleStatus::fillFEDerror25
void fillFEDerror25(PixelFEDChannel ch)
fill FEDerror25
Definition: SiPixelModuleStatus.cc:28
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
SiPixelModuleStatus
Definition: SiPixelModuleStatus.h:10
SiPixelModuleStatus::updateDIGI
void updateDIGI(int iroc, unsigned int nhit)
update digi (nhit > 1)
Definition: SiPixelModuleStatus.cc:47
SiPixelModuleStatus::detid
int detid()
accessors and setters
Definition: SiPixelModuleStatus.cc:38
nhits
Definition: HIMultiTrackSelector.h:42
SiPixelModuleStatus::perRocDigiOcc
double perRocDigiOcc()
calculate (averaged over this module's ROCs) mean hit number and its sigma
Definition: SiPixelModuleStatus.cc:71
a
double a
Definition: hdecay.h:119
SiPixelModuleStatus::getRoc
SiPixelRocStatus * getRoc(int i)
get a ROC
Definition: SiPixelModuleStatus.cc:95
createfilelist.int
int
Definition: createfilelist.py:10
SiPixelModuleStatus::fDetid_
int fDetid_
Definition: SiPixelModuleStatus.h:52
SiPixelModuleStatus::perRocDigiOccVar
double perRocDigiOccVar()
Definition: SiPixelModuleStatus.cc:80
SiPixelModuleStatus::digiOccROC
unsigned int digiOccROC(int iroc)
return ROC status (= hits on ROC iroc)
Definition: SiPixelModuleStatus.cc:58
SiPixelModuleStatus::updateFEDerror25
void updateFEDerror25(int iroc, bool FEDerror25)
update FEDerror25
Definition: SiPixelModuleStatus.cc:52
SiPixelModuleStatus::updateModuleStatus
void updateModuleStatus(SiPixelModuleStatus newData)
Definition: SiPixelModuleStatus.cc:103
PixelFEDChannel::roc_last
unsigned int roc_last
Definition: PixelFEDChannel.h:7
SiPixelModuleStatus.h
DeadROCCounter.nrocs
nrocs
Definition: DeadROCCounter.py:57
SiPixelModuleStatus::~SiPixelModuleStatus
~SiPixelModuleStatus()
Definition: SiPixelModuleStatus.cc:20
SiPixelModuleStatus::updateModuleDIGI
void updateModuleDIGI(int roc, unsigned int nhits)
combine new data to update(topup) module status
Definition: SiPixelModuleStatus.cc:98
SiPixelModuleStatus::nrocs
int nrocs()
Definition: SiPixelModuleStatus.cc:40
SiPixelModuleStatus::fedError25
bool fedError25(int iroc)
return ROC FEDerror25
Definition: SiPixelModuleStatus.cc:60
PixelFEDChannel::roc_first
unsigned int roc_first
Definition: PixelFEDChannel.h:7
SiPixelModuleStatus::setNrocs
void setNrocs(int iroc)
Definition: SiPixelModuleStatus.cc:44