StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjFMSMuDst.cxx
1 // $Id: StjFMSMuDst.cxx,v 1.1 2017/05/22 19:35:00 zchang Exp $
2 #include "StjFMSMuDst.h"
3 
4 #include "StMaker.h"
5 #include "StMuDSTMaker/COMMON/StMuDst.h"
6 #include "StMuDSTMaker/COMMON/StMuEvent.h"
7 #include "StMuDSTMaker/COMMON/StMuEmcCollection.h"
8 
9 //#include <cassert>
10 #include "StMuDSTMaker/COMMON/StMuFmsCollection.h"
11 #include "StMuDSTMaker/COMMON/StMuFmsHit.h"
12 #include "StMuDSTMaker/COMMON/StMuDst.h"
13 
14 #include "StFmsDbMaker/StFmsDbMaker.h"
15 #include "StEventTypes.h"
16 #include "StEvent/StEvent.h"
17 #include "StEvent/StFmsCollection.h"
18 #include "StEvent/StFmsHit.h"
19 #include "StEvent/StFmsPoint.h"
20 #include "StEvent/StFmsPointPair.h"
21 #include "StMuDSTMaker/COMMON/StMuTypes.hh"
22 
23 //per Pibero
24 #include <iostream>
25 #include <fstream>
26 using namespace std;
27 
28 StjFMSMuDst::StjFMSMuDst() : mFmsDbMaker((StFmsDbMaker*)StMaker::GetChain()->GetDataSet("fmsDb"))
29 {
30  _setVertex = false;
31  // cout<<" HERE "<<endl;
32  //fmsdb = gStFmsDbMaker;
33 }
34 
35 
36 void StjFMSMuDst::Init()
37 {
38  /* mFmsDbMaker=static_cast<StFmsDbMaker*>(GetMaker("fmsDb"));
39  if(!mFmsDbMaker){
40  LOG_ERROR << "StFmsJetMaker::InitRun Failed to get StFmsDbMaker" << endm;
41  return kStFatal;
42  }
43  */
44  // return StMaker::Init();
45 }
46 
47 
48 StjTowerEnergyList StjFMSMuDst::getEnergyList()
49 {
50  StjTowerEnergyList fmsEnergyList;
51 
52  mFmsColl = findFmsCollection();
53  if(mFmsColl){
54  StjTowerEnergy energyDeposit;
55  int npoint=mFmsColl->numberOfPoints();
56  StSPtrVecFmsPoint& points = mFmsColl->points();
57  //loop over FMS points
58  for(int i=0; i<npoint; i++) {
59  float x=points[i]->XYZ().x();
60  float y=points[i]->XYZ().y();
61  //float z=points[i]->XYZ().z();
62  StLorentzVectorF v1=points[i]->fourMomentum();
63 
64  //loop over FPS layers to and project
65  energyDeposit.towerR = TMath::Sqrt(x*x + y*y);
66  energyDeposit.towerEta = v1.pseudoRapidity();
67  energyDeposit.towerPhi = v1.phi();
68  energyDeposit.vertexX = 0;
69  energyDeposit.vertexY = 0;
70  energyDeposit.vertexZ = 0;
71  energyDeposit.energy = points[i]->energy();
72  energyDeposit.adc = points[i]->energy();
73  energyDeposit.pedestal = 0;
74  energyDeposit.rms = 0;
75  energyDeposit.status = 1;
76  energyDeposit.towerId = points[i]->id();
77  energyDeposit.detectorId = 100 + points[i]->detectorId() ; //set FMS detector Id to 100 + detectorId(), i.e. 108, 109, 110, and 111, by zchang
78 
79  if(points[i]->energy()>1) fmsEnergyList.push_back(energyDeposit);
80  }
81  }
82  return fmsEnergyList;
83 
84 }
85 
86 
87 StFmsCollection* StjFMSMuDst::findFmsCollection()
88 {
89  StEvent* event = dynamic_cast<StEvent*>(StMaker::GetChain()->GetInputDS("StEvent"));
90  return (event) ? event->fmsCollection() : StMuDst::fmsCollection();
91 }
static StFmsCollection * fmsCollection()
returns pointer to current StFmsCollection
Definition: StMuDst.h:407