7 #include "StFcsEpdQaMaker.h"
9 #include "StRoot/StEvent/StEvent.h"
10 #include "StRoot/St_base/StMessMgr.h"
11 #include "StRoot/StEvent/StTriggerData.h"
12 #include "StRoot/StEvent/StFcsCollection.h"
13 #include "StRoot/StEvent/StEpdCollection.h"
14 #include "StRoot/StEvent/StFcsHit.h"
15 #include "StRoot/StEvent/StEpdHit.h"
16 #include "StRoot/StFcsDbMaker/StFcsDb.h"
17 #include "StRoot/StSpinPool/StFcsRawDaqReader/StFcsRawDaqReader.h"
28 StFcsEpdQaMaker::StFcsEpdQaMaker(
const Char_t* name) :
StMaker(name) {
29 sprintf(mFilename,
"0.epdqa.root");
32 StFcsEpdQaMaker::~StFcsEpdQaMaker(){};
34 Int_t StFcsEpdQaMaker::Init(){
35 mFcsDb =
static_cast<StFcsDb*
>(GetDataSet(
"fcsDb"));
37 LOG_FATAL <<
"Error finding StFcsDb"<< endm;
41 if(mFilename[0]==
'0' && mRun>0){
43 sprintf(mFilename,
"%d/%d.epdqa.root",yday,mRun);
44 printf(
"StFcsEpdQaMaker::Init - Opening %s\n",mFilename);
46 mFile=
new TFile(mFilename,
"RECREATE");
49 char *cNS[2]={
"N",
"S"};
50 for(
int det=kFcsPresNorthDetId; det<=kFcsPresSouthDetId; det++){
51 for(
int id=0;
id<kFcsPresMaxId;
id++){
55 sprintf(t,
"EPDADC_%1s%03d",cNS[ns],
id);
56 sprintf(n,
"%s; QTADC; DEP Fit Integral",name);
57 mQtDepA[ns][id] =
new TH2F(t,n,64,0,1024,64,0,1024*4);
58 sprintf(t,
"EPDTAC_%1s%03d",cNS[ns],
id);
59 sprintf(n,
"%s; QTTAC; DEP Fit Peak Timebin",name);
60 mQtDepT[ns][id] =
new TH2F(t,n,50,0,3000,50,45,56);
61 sprintf(t,
"EPDRatio_%1s%03d",cNS[ns],
id);
62 sprintf(n,
"%s; DEP Peak Timebin; QTADC/DEPIntg",name);
63 mQtDepR[ns][id] =
new TH2F(t,n,50,44,57,50,0.0,0.8);
66 mQtDepA[0][kFcsPresMaxId] =
new TH2F(
"EPDADCc",
"EPDADC QTc; QTc ADC; DEP Fit Integral",64,0,1024,64,0,1024*4);
67 mQtDepT[0][kFcsPresMaxId] =
new TH2F(
"EPDTACc",
"EPDTAC QTc; QTc TAC; DEP Fit Peak Timebin",50,0,3000,50,45,56);
68 mQtDepR[0][kFcsPresMaxId] =
new TH2F(
"EPDRatioc",
"EPDRatio QTc; DEP Peak Timebin; QTcADC/DEPIntg",50,44,57,50,0.0,0.8);
69 mQtDepA[1][kFcsPresMaxId] =
new TH2F(
"EPDADCbmqtad",
"EPDADC QTb; QTb ADC; DEP Fit Integral",64,0,1024,64,0,1024*4);
70 mQtDepT[1][kFcsPresMaxId] =
new TH2F(
"EPDTACb",
"EPDTAC QTb; QTb TAC; DEP Fit Peak Timebin",50,0,3000,50,45,56);
71 mQtDepR[1][kFcsPresMaxId] =
new TH2F(
"EPDRatiob",
"EPDRatio QTb; DEP Peak Timebin; QTbADC/DEPIntg",50,44,57,50,0.0,0.8);
84 trg = fcsraw->trgdata();
86 LOG_INFO <<
"Canot find Trigger Data from StFcsRawDaqReader" << endm;
89 trg=
event->triggerData();
91 LOG_INFO <<
"Canot find Trigger Data from StEvent" << endm;
99 tofmult = trg->tofMultiplicity();
109 unsigned short lastdsm2 = trg->lastDSM(2);
110 unsigned short lastdsm5 = trg->lastDSM(5);
111 printf(
"lastdsm2=%04x lastdsm5=%04x tofmult=%d\n",lastdsm2,lastdsm5,tofmult);
115 LOG_INFO <<
"No StEvent found" << endm;
117 mFcsCollection=
event->fcsCollection();
118 mEpdCollection=
event->epdCollection();
121 LOG_INFO <<
"No StFcsCollection found" << endm;
125 LOG_INFO <<
"No StEpdCollection found" << endm;
129 for(
int det=kFcsPresNorthDetId; det<kFcsNDet; det++){
130 int nhit=mFcsCollection->numberOfHits(det);
131 printf(
"StFcsEpdQaMaker found %d hits for det=%d\n",nhit,det);
132 if(nhit<=0)
continue;
133 StSPtrVecFcsHit& hits = mFcsCollection->hits(det);
134 for (
int i=0; i<nhit; i++){
135 int id = hits[i]->id();
137 int ns = hits[i]->ns();
138 int dep = hits[i]->dep();
139 int ch = hits[i]->channel();
143 int QTcQRb = tt<=9?0:1;
148 fititeg = hits[i]->adcSum();
149 fitpeak = hits[i]->fitPeak();
154 int nepd = mEpdCollection->epdHits().size();
156 for(
int j=0; j<nepd; j++){
157 StEpdHit* epd = mEpdCollection->epdHits()[j];
158 int ew = epd->
side();
160 int ett = epd->
tile();
161 if(ew==1 && epp==pp && ett==tt){
167 if(Debug()) printf(
" Dep=%02d Ch=%02d PP=%02d TT=%02d QT=%4d DEP=%6.1f TAC=%4d PEAK=%4.2f\n",
168 dep,ch,pp,tt,adc,fititeg,tac,fitpeak);
170 mQtDepA[ns][id]->Fill(adc,fititeg);
171 mQtDepA[QTcQRb][kFcsPresMaxId]->Fill(adc,fititeg);
173 mQtDepT[ns][id]->Fill(tac,fitpeak);
174 mQtDepT[QTcQRb][kFcsPresMaxId]->Fill(tac,fitpeak);
175 mQtDepR[ns][id]->Fill(fitpeak,
float(adc)/fititeg);
176 mQtDepR[QTcQRb][kFcsPresMaxId]->Fill(fitpeak,
float(adc)/fititeg);
187 printf(
"StFcsEpdQaMaker::Finish - Closing %s\n",mFilename);
int northSouth(int det) const
Ecal=0, Hcal=1, Pres=2.
void getName(int det, int id, char name[])
get the DEP/ch id
short side() const
+1 if tile is on West side; -1 if on East side
int position() const
position of supersector on a wheel [1,12]
int adc() const
ADC value [0,4095].
void getEPDfromId(int det, int id, int &pp, int &tt)
Get FCS's EPD map foom EPD mapping.
Stores information for tiles in STAR Event Plane Detector.
int tile() const
tile on the supersector [1,31]
int tac() const
TAC value [0,4095].