Commit 392a2e92 authored by dauncey's avatar dauncey

Add occupancy plots

parent 05c4fd45
......@@ -41,6 +41,7 @@
#include "TH1X.hh"
#include "TH2X.hh"
#include "TH1R.hh"
#include "TH2R.hh"
#include "AnalysisBase.hh"
#include "Event.hh"
......@@ -482,8 +483,13 @@ public:
hNumberOfWaferBits[i]=new TH2F((fName+"_"+sNum[i+1]+"NumberOfWaferBits").c_str(),
";Layer;#rho (cm);Data bits/event",
40,0.0,40.0,50,0.0,200.0);
hDaqOccupancy[i]=new TH2R((fName+"_"+sNum[i+1]+"DaqOccupancy").c_str(),
";Layer;#rho (cm);ADC hit occupancy",
Geometry::kNumberOfLayers+2,0.0,Geometry::kNumberOfLayers+2,
60,0.0,300.0);
}
for(unsigned i(kTpgCutLo);i<kTpgCutHi;i++) {
for(unsigned j(0);j<3;j++) {
hFractionOfWaferTrgsMip[j][i]=new TH2A((fName+"_"+sThk[j]+sNum[i+1]+"FractionOfWaferTrgsMip").c_str(),
......@@ -505,6 +511,11 @@ public:
";Layer;#rho (cm);Maximum number",
52,0.0,52.0,60,0.0,300.0);
}
hTrgOccupancy[i]=new TH2R((fName+"_"+sNum[i+1]+"TrgOccupancy").c_str(),
";Layer;#rho (cm);Trigger cell hit occupancy",
Geometry::kNumberOfLayers+2,0.0,Geometry::kNumberOfLayers+2,
60,0.0,300.0);
}
hWaferBitsVsHitsAll=new TH1F((fName+"WaferBitsVsHitsAll").c_str(),
......@@ -1732,7 +1743,8 @@ virtual bool event(Event &event) {
}
for(unsigned a(0);a<Geometry::numberOfAsicsPerWafer(lo);a++) {
unsigned calSc(fEventNumber%Geometry::numberOfSensorCellsPerAsic(lo,a));
//unsigned calSc(fEventNumber%Geometry::numberOfSensorCellsPerAsic(lo,a));
unsigned calSc(999999); // Assume very low rate
a0++;
//if(l==0) std::cout << "Panels p0,p = " << p0 << ", " << p
......@@ -1851,6 +1863,7 @@ virtual bool event(Event &event) {
if(sc==calSc) selected=true;
}
if(!digHit.invalid()) hDaqOccupancy[i]->Fill(l+1,fCellRho[l][w][sc],selected);
hDaqAdcRatioVsRho[i][l]->Fill(fCellRho[l][w][sc],selected);
hDaqAdcRatioVsSensorCell[i][l][nThk]->Fill(sc,selected);
......@@ -1935,6 +1948,8 @@ virtual bool event(Event &event) {
bool selected(trgHit.isSelected());
hTrgOccupancy[i]->Fill(l+1,Geometry::triggerCellToPoint(1,l,w,tc).rho(),selected);
if(selected) {
nAsicTpgHits[i]++;
nWaferTpgHits[i]++;
......@@ -2421,6 +2436,8 @@ TH1F *hDaqAdcPerWafer[kDaqCutHi][Geometry::kMaximumNumberOfWafersPerSextant];
TH2A *hDaqAdcPerAsicVsAsicLayerA[kDaqCutHi];
TH2X *hDaqAdcPerAsicVsAsicLayerX[kDaqCutHi];
TH2R *hDaqOccupancy[kDaqCutHi];
TH1A *hDaqPrePerLayerVsLayerA;
TH1F *hDaqAdcPerLayer[kDaqCutHi][Geometry::kNumberOfLayers];
......@@ -2502,6 +2519,8 @@ TH1A *hTpgHitPerPanelVsPanelA[kTpgCutHi][Geometry::kNumberOfLayers];
TH1X *hTpgHitPerPanelVsPanelX[kTpgCutHi][Geometry::kNumberOfLayers];
TH1F *hTpgHitPerPanel[kTpgCutHi][Geometry::kNumberOfLayers][Geometry::kMaximumNumberOfPanelsPerLayer/6];
TH2R *hTrgOccupancy[kTpgCutHi];
TH2A *hTpgBitPerPanelVsPanelLayerA[kTpgCutHi][kNumberOfTpgMethods][3];
TH2X *hTpgBitPerPanelVsPanelLayerX[kTpgCutHi][kNumberOfTpgMethods][3];
TH1F *hTpgBitPerLayer[kTpgCutHi][Geometry::kNumberOfLayers][kNumberOfTpgMethods][3];
......
......@@ -7,6 +7,7 @@
#include <cmath>
#include "Backtrace.hh"
#include "Random.hh"
#include "SimDetId.hh"
#include "DigHitDetId.hh"
......@@ -56,8 +57,20 @@ public:
return sMax;
}
// RANDOM!
if(method==1) {
return fCell[0].first; // RANDOM!
float fTot(0.0);
for(unsigned i(0);i<fCell.size();i++) fTot+=fCell[i].second;
float fRand(Random::random().Uniform(fTot));
//std::cout << "fTot = " << fTot << ", fRand = " << fRand << std::endl;
for(unsigned i(0);i<fCell.size();i++) {
if(fRand<fCell[i].second) return fCell[i].first;
fRand-=fCell[i].second;
}
return fCell[fCell.size()-1].first;
}
return fCell[0].first;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment