1 #include "StFmsBsQaMaker.h"
5 #include "StEventTypes.h"
6 #include "StEvent/StEvent.h"
7 #include "StEvent/StFmsCollection.h"
8 #include "StEvent/StFmsHit.h"
9 #include "StEvent/StFmsPoint.h"
10 #include "StEvent/StFmsPointPair.h"
11 #include "StEvent/StTriggerData.h"
12 #include "StEvent/StTriggerId.h"
13 #include "StFmsDbMaker/StFmsDbMaker.h"
14 #include "StMessMgr.h"
15 #include "StMuDSTMaker/COMMON/StMuEvent.h"
16 #include "StMuDSTMaker/COMMON/StMuTypes.hh"
30 StFmsBsQaMaker::StFmsBsQaMaker(
const char* name) :
StMaker(name) {}
33 Int_t StFmsBsQaMaker::Init()
35 mFmsDbMk =
static_cast<StFmsDbMaker*
>(GetMaker(
"fmsDb"));
36 if (!mFmsDbMk) { LOG_ERROR <<
"StFmsBsQaMaker::InitRun - !StFmsDbMaker" <<endl;
return kStFatal; }
42 Int_t StFmsBsQaMaker::InitRun(
int runNo)
44 Info(
"InitRun",
"Start run %d...", runNo);
46 mFile =
new TFile(mOutputName,
"RECREATE");
47 mFile->SetCompressionLevel(9);
74 for (
int a=0; a<nDet; a++)
77 const int detId = a+8;
79 for (
int b=0; b<maxCh; b++)
82 const float gain = mFmsDbMk->getGain(detId, ch);
83 if (gain <= 0.)
continue;
86 nToCh[a].insert(std::pair<int, int>(index, ch));
87 chToN[a].insert(std::pair<int, int>(ch, index));
95 for (
int a=0; a<nDet; a++)
97 const int nCh = (a<2)?nChLg:nChSm;
98 mH2_adc[a] =
new TH2F(Form(
"Adc_d%i",a+8), Form(
"detId = %i;ch;ADC",a+8), nCh,0.5,nCh+0.5, 5000,0,5000);
105 for (
int a=0; a<nDet; a++)
107 const int nCh = (a<2)?nChLg:nChSm;
108 mH2_bs_DB[a] =
new TH2F(Form(
"BitShift_DB_d%i", a+8),
"", nCh,0.5,nCh+0.5, nBit,0.5,nBit+0.5);
109 mH2_bs_DB[a]->SetTitle(Form(
"DB, detId = %i;ch;bit", a+8));
111 for (
unsigned int x=0; x<nToCh[a].size(); x++)
112 for (
int y=0; y<nBit; y++)
114 const int ch = nToCh[a][x];
119 if ((bs>0 && y<bs) || (bs<0 && y>=(bs+nBit))) mH2_bs_DB[a]->SetBinContent(ch, y+1, 1);
126 for (
int a=0; a<nDet; a++)
128 const int nCh = (a<2)?nChLg:nChSm;
129 mH2_bs_data[a] =
new TH2F(Form(
"BitShift_data_d%i", a+8),
"", nCh,0.5,nCh+0.5, nBit,0.5,nBit+0.5);
130 mH2_bs_data[a]->SetTitle(Form(
"Data, detId = %i;ch;bit", a+8));
133 for (
unsigned int x=0; x<nToCh[a].size(); x++)
134 for (
int y=0; y<nBit; y++)
136 const int ch = nToCh[a][x];
137 mH2_bs_data[a]->SetBinContent(ch, y+1, 1);
144 for (
int a=0; a<nDet; a++)
146 const int nCh = (a<2)?nChLg:nChSm;
147 mH2_chMap[a] =
new TH2F(Form(
"ChMap_d%i", a+8),
"", nCh,0.5,nCh+0.5, 1,0,1);
148 mH2_chMap[a]->SetTitle(Form(
"Map of valid channels, detId = %i;ch", a+8));
150 for (
unsigned int x=0; x<nToCh[a].size(); x++)
152 const int ch = nToCh[a][x];
153 mH2_chMap[a]->SetBinContent(ch, 1, 1);
164 if (mEvent%1000 == 0) cout <<Form(
"%5i processed...", mEvent) <<endl;
167 if (!event) { LOG_ERROR <<
"StFmsOfflineQaMakerNew::Make - !StEvent" <<endl;
return kStErr; }
170 StSPtrVecFmsHit& hits = mFmsColl->hits();
171 const int nHits = mFmsColl->numberOfHits();
172 for (
int a=0; a<nHits; a++)
174 const int adc = hits[a]->adc();
175 const int ch = hits[a]->channel();
176 const int det = hits[a]->detectorId();
177 if (det<8 || det>11)
continue;
180 mH2_adc[det-8]->Fill(ch, adc);
183 for (
int b=0; b<nBit; b++) {
if (adc & (1 << b)) mH2_bs_data[det-8]->SetBinContent(ch, b+1, 0); }
Short_t getBitShiftGain(Int_t detectorId, Int_t ch) const
get the gain correction for the channel
UShort_t maxChannel(Int_t detectorId) const
number of column