7 #include "StFcsCosmicMaker.h"
9 #include "StRoot/StEvent/StEvent.h"
10 #include "StRoot/St_base/StMessMgr.h"
11 #include "StRoot/StEvent/StFcsCollection.h"
12 #include "StRoot/StEvent/StFcsHit.h"
13 #include "StRoot/StEvent/StFcsCluster.h"
14 #include "StRoot/StFcsDbMaker/StFcsDb.h"
21 StFcsCosmicMaker::StFcsCosmicMaker(
const Char_t* name) :
StMaker(name) {
32 StFcsCosmicMaker::~StFcsCosmicMaker(){};
34 Int_t StFcsCosmicMaker::Init(){
35 SetAttr(
".Privilege",1);
37 mFcsDb =
static_cast<StFcsDb*
>(GetDataSet(
"fcsDb"));
39 LOG_FATAL <<
"Error finding StFcsDb"<< endm;
45 sprintf(mFilename,
"%d/%d.cosmic.root",yday,mRun);
46 printf(
"StFcsCosmicMaker::Init - Opening %s\n",mFilename);
48 sprintf(mFilename,
"%s",mSetFile);
50 mFile=
new TFile(mFilename,
"RECREATE");
52 const char* nameEHP[kFcsEHP] = {
"Ecal",
"Hcal",
"Pres"};
54 for(
int ehp=0; ehp<2; ehp++){
55 sprintf(t,
"%4s_ADC",nameEHP[ehp]);
56 mAdc[ehp] =
new TH1F(t,t,100,0.0,100.0);
57 sprintf(t,
"%4s_NTower",nameEHP[ehp]);
58 mNTower[ehp] =
new TH1F(t,t,100,0.0,100.0);
59 sprintf(t,
"%4s_SigmaMax",nameEHP[ehp]);
60 mSigmaMax[ehp] =
new TH1F(t,t,100,0.0,10.0);
61 sprintf(t,
"%4s_SigmaMin",nameEHP[ehp]);
62 mSigmaMin[ehp] =
new TH1F(t,t,100,0.0,3.0);
63 sprintf(t,
"%4s_Sigma",nameEHP[ehp]);
64 sprintf(t2,
"%4s; SigmaMax; SigmaMin",nameEHP[ehp]);
65 mSigma[ehp] =
new TH2F(t,t2,100,0.0,10.0,100,0.0,3.0);
66 sprintf(t,
"%4s_SigmaNtow",nameEHP[ehp]);
67 sprintf(t2,
"%4s; SigmaMax; NTower",nameEHP[ehp]);
68 mSigmaNtow[ehp] =
new TH2F(t,t2,100,0.0,10.0,100,0.0,100.0);
74 LOG_INFO <<
"StFcsCosmicMaker::Make()" << endm;
79 LOG_INFO <<
"No StEvent found" << endm;
81 mFcsCollection=
event->fcsCollection();
84 LOG_INFO <<
"No StFcsCollection found" << endm;
91 for(
int det=0; det<4; det++){
93 int nCluster=mFcsCollection->numberOfClusters(det);
94 StSPtrVecFcsCluster& clusters = mFcsCollection->clusters(det);
95 for (
int i=0; i<nCluster; i++){
97 int nt = clu->nTowers();
98 float smax = clu->sigmaMax();
99 float smin= clu->sigmaMin();
100 float theta = clu->theta() * 180.0 / 3.141592654;
101 while(theta>90.0) theta-=180.0;
103 mNTower[ehp]->Fill(
float(nt));
104 mSigmaMax[ehp]->Fill(smax);
105 mSigmaMin[ehp]->Fill(smin);
106 mSigma[ehp]->Fill(smax,smin);
107 mSigmaNtow[ehp]->Fill(smax,nt);
108 if(nt > mNTowerThre[ehp]){
109 LOG_INFO << Form(
"StFcsCosmicMaker NTow=%3d SMax=%8.5f SMin=%8.5f",nt,smax,smin)<<endm;
110 if(smax > mSigmaMaxThre[ehp] && smin < mSigmaMinThre[ehp] && theta>mThetaThre[ehp]){
112 for(
int j=0; j<nt; j++){
114 int adc = hit->adcSum();
115 mAdc[ehp]->Fill(adc);
125 LOG_INFO << Form(
"StFcsCosmicMaker found cosmic candidate %d / %d events",nCosmic,nEvent)<<endm;
128 LOG_INFO << Form(
"StFcsCosmicMaker did not found cosmic candidate %d / %d events, skipping",nCosmic,nEvent)<<endm;
136 printf(
"StFcsCosmicMaker::Finish - Closing %s\n",mFilename);