7 #include "StFcsTrackMatchMaker.h"
10 #include "StEvent/StEvent.h"
11 #include "StEvent/StFcsCollection.h"
12 #include "StEvent/StFcsCluster.h"
13 #include "StEvent/StFwdTrackCollection.h"
14 #include "StEvent/StFwdTrack.h"
16 #include "StThreeVectorF.hh"
17 #include "StFcsDbMaker/StFcsDb.h"
18 #include "StRoot/StEpdUtil/StEpdGeom.h"
30 mMaxDistance[0] = 6.0;
31 mMaxDistance[1] = 10.0;
34 StFcsTrackMatchMaker::~StFcsTrackMatchMaker() {
36 if (mHdx[0]) {
delete mHdx[0]; mHdx[0]=
nullptr;}
37 if (mHdy[0]) {
delete mHdy[0]; mHdy[0]=
nullptr;}
38 if (mHdr[0]) {
delete mHdr[0]; mHdr[0]=
nullptr;}
39 if (mNtrk[0]) {
delete mNtrk[0]; mNtrk[0]=
nullptr;}
40 if (mNclu[0]) {
delete mNclu[0]; mNclu[0]=
nullptr;}
41 if (mHdx[1]) {
delete mHdx[1]; mHdx[1]=
nullptr;}
42 if (mHdy[1]) {
delete mHdy[1]; mHdy[1]=
nullptr;}
43 if (mHdr[1]) {
delete mHdr[1]; mHdr[1]=
nullptr;}
44 if (mNtrk[1]) {
delete mNtrk[1]; mNtrk[1]=
nullptr;}
45 if (mNclu[1]) {
delete mNclu[1]; mNclu[1]=
nullptr;}
46 if (mNtrk[2]) {
delete mNtrk[2]; mNtrk[2]=
nullptr;}
47 if (mNtrk[3]) {
delete mNtrk[3]; mNtrk[3]=
nullptr;}
48 if (mNclu[2]) {
delete mNclu[2]; mNclu[2]=
nullptr;}
49 if (mNclu[3]) {
delete mNclu[3]; mNclu[3]=
nullptr;}
50 if (mPtEt[0]) {
delete mPtEt[0]; mPtEt[0]=
nullptr;}
51 if (mPtEt[1]) {
delete mPtEt[1]; mPtEt[1]=
nullptr;}
52 if (mPtEt2[0]) {
delete mPtEt2[0]; mPtEt2[0]=
nullptr;}
53 if (mPtEt2[1]) {
delete mPtEt2[1]; mPtEt2[1]=
nullptr;}
54 if (mCharge[0]) {
delete mCharge[0]; mCharge[0]=
nullptr;}
55 if (mCharge[1]) {
delete mCharge[1]; mCharge[1]=
nullptr;}
56 if (mCharge[2]) {
delete mCharge[2]; mCharge[2]=
nullptr;}
57 if (mXY[0]) {
delete mXY[0]; mXY[0]=
nullptr;}
58 if (mXY[1]) {
delete mXY[1]; mXY[1]=
nullptr;}
59 if (mXY[2]) {
delete mXY[2]; mXY[2]=
nullptr;}
74 int StFcsTrackMatchMaker::Init()
76 mFcsDb =
static_cast<StFcsDb *
>(GetDataSet(
"fcsDb"));
79 LOG_ERROR <<
"StFcsTrackMatchMaker::InitRun Failed to get StFcsDb" << endm;
85 LOG_INFO <<
"Opening " << mFilename << endm;
86 mFile =
new TFile(mFilename,
"RECREATE");
88 mHdx[0] =
new TH1F(
"dx_EcalTrk",
"dx Ecal-Track", 100, -50, 50);
89 mHdy[0] =
new TH1F(
"dy_EcalTrk",
"dy Ecal-Track", 100, -50, 50);
90 mHdr[0] =
new TH1F(
"dr_EcalTrk",
"dr Ecal-Track", 100, 0, 20);
91 mNtrk[0] =
new TH1F(
"NTrk_Ecal",
"NTrk_Ecal", 10, 0.0, 10.0);
92 mNclu[0] =
new TH1F(
"NEcalClu_Trk",
"NEcalClu_Trk", 10, 0.0, 10.0);
94 mHdx[1] =
new TH1F(
"dx_HcalTrk",
"dx Hcal-Track", 100, -50, 50);
95 mHdy[1] =
new TH1F(
"dy_HcalTrk",
"dy Hcal-Track", 100, -50, 50);
96 mHdr[1] =
new TH1F(
"dr_HcalTrk",
"dr Ecal-Track", 100, 0, 20);
97 mNtrk[1] =
new TH1F(
"NTrk_Hcal",
"NTrk_Hcal", 10, 0.0, 10.0);
98 mNclu[1] =
new TH1F(
"NHcalClu_Trk",
"NHcalClu_Trk", 10, 0.0, 10.0);
100 mNtrk[2] =
new TH1F(
"NTrk",
"NTrk/evt", 50, 0.0, 100.0);
101 mNtrk[3] =
new TH1F(
"NGoodTrk",
"NGoodTrk/evt", 20, 0.0, 20.0);
103 mNclu[2] =
new TH1F(
"NEcalClu",
"NEcalClu/evt", 30, 0.0, 30.0);
104 mNclu[3] =
new TH1F(
"NHcalClu",
"NHcalClu/evt", 30, 0.0, 30.0);
106 mPtEt[0] =
new TH1F(
"ETovPT_E",
"ETovPT_E", 50, 0.0, 2.0);
107 mPtEt[1] =
new TH1F(
"ETovPT_EH",
"ETovPT_E+H", 50, 0.0, 2.0);
108 mPtEt2[0] =
new TH2F(
"ETPT_E",
"ETvsPT_E; ET(Ecal); TrkPT", 50, 0.0, 8.0, 50, 0.0, 8.0);
109 mPtEt2[1] =
new TH2F(
"ETPT_EH",
"ETvsPT_E+H ET(E+H); TrkPT", 50, 0.0, 8.0, 50, 0.0, 8.0);
111 mCharge[0] =
new TH1F(
"Charge_E",
"Charge_E", 3, -1.5, 1.5);
112 mCharge[1] =
new TH1F(
"Charge_H",
"Charge_H", 3, -1.5, 1.5);
113 mCharge[2] =
new TH1F(
"Charge",
"Charge", 3, -1.5, 1.5);
115 mXY[0] =
new TH2F(
"XY_E",
"XY_E", 50, -130, 130, 50, -110, 110);
116 mXY[1] =
new TH2F(
"XY_H",
"XY_H", 50, -130, 130, 50, -110, 110);
117 mXY[2] =
new TH2F(
"XY",
"XY", 50, -130, 130, 50, -110, 110);
126 LOG_INFO <<
"Closing " << mFilename << endm;
138 LOG_ERROR <<
"StFcsTrackMatchMaker::Make did not find StEvent" << endm;
141 mFcsColl =
event->fcsCollection();
144 LOG_ERROR <<
"StFcsTrackMatchMaker::Make did not find StEvent->StFcsCollection" << endm;
147 mFwdTrkColl =
event->fwdTrackCollection();
150 LOG_ERROR <<
"StFcsTrackMatchMaker::Make did not find StEvent->fwdTrackCollection" << endm;
154 int ntrk = mFwdTrkColl->numberOfTracks();
156 int nMatch[2] = {0, 0};
157 for (
int itrk = 0; itrk < ntrk; itrk++)
159 StFwdTrack *trk = mFwdTrkColl->tracks()[itrk];
160 if (trk->didFitConvergeFully() ==
false)
166 LOG_INFO <<
"nProjections: "<< trk->mProjections.size() << endm;
167 projECAL = trk->getProjectionFor( kFcsWcalId );
168 projHCAL = trk->getProjectionFor( kFcsHcalId );
169 projEPD = trk->getProjectionFor( kFcsPresId );
174 LOG_INFO << Form(
"Proj0: %6.2f %6.2f %6.2f", projECAL.mXYZ.x(), projECAL.mXYZ.y(), projECAL.mXYZ.z()) << endm;
175 LOG_INFO << Form(
"Proj1: %6.2f %6.2f %6.2f", projHCAL.mXYZ.x(), projHCAL.mXYZ.y(), projHCAL.mXYZ.z()) << endm;
176 LOG_INFO << Form(
"Proj2: %6.2f %6.2f %6.2f", projEPD. mXYZ.x(), projEPD. mXYZ.y(), projEPD. mXYZ.z()) << endm;
181 if (projECAL.mXYZ.x() > 0.0)
184 for (
int ehp = 0; ehp < 2; ehp++)
188 proj = projHCAL.mXYZ;
190 int det = ehp * 2 + ns;
191 int nclu = mFcsColl->numberOfClusters(det);
192 for (
int iclu = 0; iclu < nclu; iclu++)
195 float energy = clu->energy();
196 if (energy > mMinEnergy[ehp])
199 double dx = xyz.x() - proj.x();
200 double dy = xyz.y() - proj.y();
201 double dr = sqrt(dx * dx + dy * dy);
203 LOG_INFO << Form(
"EHP=%1d dx = %6.2f - %6.2f = %6.2f dy = %6.2f - %6.2f = %6.2f dr=%6.2f",
204 ehp, xyz.x(), proj.x(), dx, xyz.y(), proj.y(), dy, dr)
208 if (fabs(dy) < mMaxDistance[ehp])
210 if (fabs(dx) < mMaxDistance[ehp])
214 if (dr < mMaxDistance[ehp])
218 trk->addEcalCluster(clu);
222 trk->addHcalCluster(clu);
233 for (
int itrk = 0; itrk < ntrk; itrk++)
235 StFwdTrack *trk = mFwdTrkColl->tracks()[itrk];
236 if (trk->didFitConvergeFully() ==
false)
238 trk->sortEcalClusterByET();
239 trk->sortHcalClusterByET();
242 LOG_INFO << Form(
"TRK pT=%6.2f Cg=%1d NEcal=%lu NHcal=%lu",
243 trk->momentum().perp(), trk->charge(),
244 trk->ecalClusters().size(),
245 trk->hcalClusters().size())
249 for (
int det = 0; det < 4; det++)
252 int nclu = mFcsColl->numberOfClusters(det);
253 for (
int iclu = 0; iclu < nclu; iclu++)
256 clu->sortTrackByPT();
259 if (clu->energy() > mMinEnergy[ehp])
261 LOG_INFO << Form(
"FCS DET=%d ET=%6.2f NTrk=%ld",
262 clu->detectorId(), clu->fourMomentum().perp(), clu->tracks().size())
272 mNtrk[2]->Fill(ntrk);
273 mNtrk[3]->Fill(ngoodtrk);
274 for (
int itrk = 0; itrk < ntrk; itrk++)
276 StFwdTrack *trk = mFwdTrkColl->tracks()[itrk];
277 if (trk->didFitConvergeFully() ==
false)
282 projECAL = trk->getProjectionFor( kFcsWcalId );
283 projHCAL = trk->getProjectionFor( kFcsHcalId );
284 projEPD = trk->getProjectionFor( kFcsPresId );
286 mCharge[2]->Fill(trk->charge());
287 mXY[2]->Fill(projECAL.mXYZ.x(), projECAL.mXYZ.y());
288 double pt = trk->momentum().perp();
289 int ne = trk->ecalClusters().size();
290 int nh = trk->hcalClusters().size();
291 mNclu[0]->Fill(
double(ne));
292 mNclu[1]->Fill(
double(nh));
297 ete = eclu->fourMomentum().perp();
298 mPtEt[0]->Fill(ete / pt);
299 mPtEt2[0]->Fill(ete, pt);
300 mCharge[0]->Fill(trk->charge());
301 mXY[0]->Fill(projECAL.mXYZ.x(), projECAL.mXYZ.y());
306 double eth = hclu->fourMomentum().perp() + ete;
307 mPtEt[1]->Fill(eth / pt);
308 mPtEt2[1]->Fill(eth, pt);
309 mCharge[1]->Fill(trk->charge());
310 mXY[1]->Fill(projHCAL.mXYZ.x(), projHCAL.mXYZ.y());
315 for (
int det = 0; det < 4; det++)
318 int nclu = mFcsColl->numberOfClusters(det);
320 for (
int iclu = 0; iclu < nclu; iclu++)
323 if (clu->energy() > mMinEnergy[ehp])
325 mNtrk[ehp]->Fill(clu->tracks().size());
329 mNclu[2]->Fill(nc[0]);
330 mNclu[3]->Fill(nc[1]);
332 LOG_INFO << Form(
"NTrack=%5d NGoodTrack=%3d NEcalMatch=%3d NHcalMatch=%3d", ntrk, ngoodtrk, nMatch[0], nMatch[1]) << endm;
StThreeVectorD getStarXYZfromColumnRow(int det, float col, float row, float FcsZ=-1.0) const
get the STAR frame cooridnates from other way