1 #include "StFcsMIPMaker.h"
2 #include "TDataSetIter.h"
3 #include "StDAQMaker/StDAQReader.h"
5 #include "StRoot/StEvent/StEvent.h"
6 #include "StRoot/St_base/StMessMgr.h"
7 #include "StRoot/StEvent/StTriggerData.h"
8 #include "StRoot/StEvent/StFcsCollection.h"
9 #include "StRoot/StEvent/StFcsHit.h"
10 #include "StRoot/StEvent/StFcsCluster.h"
11 #include "StRoot/StFcsDbMaker/StFcsDb.h"
12 #include "StRoot/StSpinPool/StFcsRawDaqReader/StFcsRawDaqReader.h"
43 mFcsDb =
static_cast<StFcsDb*
>(GetDataSet(
"fcsDb"));
47 sprintf(mFilename,
"%d_%d.root",mRun,mSub);
48 printf(
"StFcsMIPMaker::Init - Opening %s\n",mFilename);
49 mFile=
new TFile(mFilename,
"RECREATE");
51 const char* nameEHP[kFcsEHP] = {
"Ecal",
"Hcal",
"Pres"};
52 const char* nameNS[kFcsNorthSouth] = {
"N",
"S"};
54 char adcsum_name[100];
55 char adcsum_title[100];
57 hitsperevent=
new TH1F(
"hitsperevent",
"EventHits",100,0,200);
59 for(
int det=0; det<kFcsNDet; det++){
62 int maxid = mFcsDb->
maxId(det);
64 if(maxid==0)
continue;
66 for(
int id=0;
id<maxid;
id++){
68 int ehp2,ns2,crt,sub,dep,ch;
71 sprintf(f,
"%4s_%1s_TbinAdc_id%03d",nameEHP[ehp],nameNS[ns],
id);
72 sprintf(t,
"%4s_%1s_TbinAdc_id%03d",nameEHP[ehp],nameNS[ns],
id);
75 minbias_events=
new TH1F(
"minbias",
"minbias events",5,0,5);
78 sprintf(adcsum_title,
"adcsum det%d_id%d",det,
id);
79 sprintf(adcsum_name,
"adcsum_det%d_id%d",det,
id);
80 towadcsum[det][id]=
new TH1F(adcsum_name,adcsum_title,7000,0,5000);
81 towadcsum[det][id]->Sumw2();
104 trg = fcsraw->trgdata();
106 LOG_INFO <<
"Cannot find Trigger Data from StFcsRawDaqReader" << endm;
109 trg=
event->triggerData();
111 LOG_INFO <<
"Cannot find Trigger Data from StEvent" << endm;
116 LOG_INFO <<
"No StEvent found" << endm;
118 mFcsCollection=
event->fcsCollection();
121 LOG_INFO <<
"No StFcsCollection found" << endm;
125 minbias_events->Fill(1);
127 int nh[kFcsNDet]; memset(nh,0,
sizeof(nh));
128 int sum[kFcsNDet][kFcsEcalMaxId]; memset(sum,0,
sizeof(sum));
129 float etot[kFcsNDet]; memset(etot,0,
sizeof(etot));
130 memset(Hcal_array,0,
sizeof(Hcal_array));
137 if (mFcsCollection-> numberOfHits(1) < 50)
139 StSPtrVecFcsCluster& clusters= mFcsCollection->clusters(1);
140 int nEclu=mFcsCollection->numberOfClusters(1);
143 for(
int i=0; i<nEclu;i++){
146 int ntow=clusterE->nTowers();
147 int nnei=clusterE->nNeighbor();
150 if(ntow==1 and nnei==0){
157 int nHclu=mFcsCollection->numberOfClusters(3);
158 StSPtrVecFcsCluster& Hclusters=mFcsCollection->clusters(3);
161 for(
int j=0; j<nHclu; j++){
164 deltax=xyzH.x()-xyzE.x();
165 deltay=xyzH.y()-xyzE.y();
166 deltar=pow(pow(deltax,2)+pow(deltay,2),0.5);
168 if(deltar<deltarmin){
169 matchHcalClusE=clusterH->energy();
175 StPtrVecFcsHit &EClusterHits=clusterE->hits();
177 if(matchHcalClusE>6){
178 for(
size_t j=0; j<EClusterHits.size(); j++)
180 int id=EClusterHits[j]->id();
181 float adc=EClusterHits[j]->adcSum();
183 towadcsum[1][id]->Fill(adc);
196 printf(
"StFcsMIPMaker::Finish - Closing %s\n",mFilename);
int northSouth(int det) const
Ecal=0, Hcal=1, Pres=2.
StThreeVectorD getStarXYZfromColumnRow(int det, float col, float row, float FcsZ=-1.0) const
get the STAR frame cooridnates from other way
void readPedFromText(const char *file="fcsped.txt")
setting pedestal
StFcsMIPMaker(const char *name="FcsMIP")
constructor
int ecalHcalPres(int det) const
Ecal North=0, Ecal South=1, Hcal North=2, Hcal South=3, Pres=4/5.
virtual Int_t Make()
Make - this method is called in loop for each event.
virtual Int_t Init()
Init - the top level StChain calls to initialize all its makers.
virtual ~StFcsMIPMaker()
destructor
int maxId(int det) const
number of column
void getDepfromId(int detectorId, int id, int &ehp, int &ns, int &crt, int &slt, int &dep, int &ch) const
print ET gain