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 
28 // ----------------------------------------------------------------------
29 void SiPixelModuleStatus::updateDIGI(int iroc, unsigned int nhit) {
30  if (iroc < fNrocs)
31  fRocs[iroc].updateDIGI(nhit);
32 }
33 
34 // ----------------------------------------------------------------------
36  int roc_first = int(ch.roc_first);
37  int roc_last = int(ch.roc_last);
38  for (int iroc = 0; iroc < fNrocs; iroc++) {
39  if (iroc >= roc_first && iroc <= roc_last) {
40  fRocs[iroc].fillFEDerror25();
41  }
42  }
43 }
44 
45 // ----------------------------------------------------------------------
46 unsigned int SiPixelModuleStatus::digiOccROC(int iroc) { return (iroc < fNrocs ? fRocs[iroc].digiOccROC() : -1); }
47 
48 // ----------------------------------------------------------------------
50  unsigned int count(0);
51  for (int iroc = 0; iroc < fNrocs; ++iroc) {
52  count += digiOccROC(iroc);
53  }
54  return count;
55 }
56 
57 // ----------------------------------------------------------------------
59 
60 // ----------------------------------------------------------------------
62 
63 // ----------------------------------------------------------------------
64 void SiPixelModuleStatus::setNrocs(int iroc) { fNrocs = iroc; }
65 
66 // ----------------------------------------------------------------------
68  unsigned int ave(0);
69  for (int iroc = 0; iroc < fNrocs; ++iroc) {
70  unsigned int inc = digiOccROC(iroc);
71  ave += inc;
72  }
73  return (1.0 * ave) / fNrocs;
74 }
75 
77  double fModAverage = SiPixelModuleStatus::perRocDigiOcc();
78 
79  double sig = 1.0;
80  for (int iroc = 0; iroc < fNrocs; ++iroc) {
81  unsigned int inc = digiOccROC(iroc);
82  sig += (fModAverage - inc) * (fModAverage - inc);
83  }
84 
85  double fModSigma = sig / (fNrocs - 1);
86  return TMath::Sqrt(fModSigma);
87 }
88 
89 // ----------------------------------------------------------------------
90 // Be careful : return the address not the value of ROC status
92 
93 // ----------------------------------------------------------------------
94 void SiPixelModuleStatus::updateModuleDIGI(int iroc, unsigned int nhits) { fRocs[iroc].updateDIGI(nhits); }
95 
97  bool isSameModule = true;
98  if (fDetid != newData.detid() || fNrocs != newData.nrocs()) {
99  isSameModule = false;
100  }
101 
102  if (isSameModule) {
103  for (int iroc = 0; iroc < fNrocs; ++iroc) {
104  //update occupancy
105  fRocs[iroc].updateDIGI(newData.digiOccROC(iroc));
106  //update FEDerror25
107  SiPixelRocStatus* rocStatus = newData.getRoc(iroc);
108  if (rocStatus->isFEDerror25()) {
109  fRocs[iroc].fillFEDerror25();
110  }
111  }
112 
113  } // if same module
114 }
mps_fire.i
i
Definition: mps_fire.py:355
PixelFEDChannel
Definition: PixelFEDChannel.h:6
SiPixelModuleStatus::digiOccMOD
unsigned int digiOccMOD()
return module status (= hits on module)
Definition: SiPixelModuleStatus.cc:49
SiPixelModuleStatus::fillDIGI
void fillDIGI(int iroc)
fill with online coordinates
Definition: SiPixelModuleStatus.cc:23
SiPixelModuleStatus::fDetid
int fDetid
Definition: SiPixelModuleStatus.h:47
SiPixelModuleStatus::fNrocs
int fNrocs
Definition: SiPixelModuleStatus.h:47
SiPixelRocStatus
Definition: SiPixelRocStatus.h:5
SiPixelModuleStatus::SiPixelModuleStatus
SiPixelModuleStatus(int det=0, int nrocs=16)
Definition: SiPixelModuleStatus.cc:12
SiPixelRocStatus::isFEDerror25
bool isFEDerror25()
Definition: SiPixelRocStatus.h:14
SiPixelModuleStatus::fillFEDerror25
void fillFEDerror25(PixelFEDChannel ch)
fill FEDerror25
Definition: SiPixelModuleStatus.cc:35
SiPixelModuleStatus
Definition: SiPixelModuleStatus.h:10
SiPixelModuleStatus::updateDIGI
void updateDIGI(int iroc, unsigned int nhit)
fill with online coordinates (nhit > 1)
Definition: SiPixelModuleStatus.cc:29
SiPixelModuleStatus::detid
int detid()
accessors and setters
Definition: SiPixelModuleStatus.cc:58
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:67
a
double a
Definition: hdecay.h:119
SiPixelModuleStatus::getRoc
SiPixelRocStatus * getRoc(int i)
get a ROC
Definition: SiPixelModuleStatus.cc:91
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
createfilelist.int
int
Definition: createfilelist.py:10
SiPixelModuleStatus::perRocDigiOccVar
double perRocDigiOccVar()
Definition: SiPixelModuleStatus.cc:76
SiPixelModuleStatus::digiOccROC
unsigned int digiOccROC(int iroc)
return ROC status (= hits on ROC iroc)
Definition: SiPixelModuleStatus.cc:46
SiPixelModuleStatus::updateModuleStatus
void updateModuleStatus(SiPixelModuleStatus newData)
Definition: SiPixelModuleStatus.cc:96
PixelFEDChannel::roc_last
unsigned int roc_last
Definition: PixelFEDChannel.h:7
SiPixelModuleStatus.h
DeadROCCounter.nrocs
nrocs
Definition: DeadROCCounter.py:57
SiPixelModuleStatus::fRocs
std::vector< SiPixelRocStatus > fRocs
Definition: SiPixelModuleStatus.h:48
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:94
SiPixelModuleStatus::nrocs
int nrocs()
Definition: SiPixelModuleStatus.cc:61
PixelFEDChannel::roc_first
unsigned int roc_first
Definition: PixelFEDChannel.h:7
SiPixelModuleStatus::setNrocs
void setNrocs(int iroc)
Definition: SiPixelModuleStatus.cc:64