StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
St_ctf_Maker.cxx
1 // $Id: St_ctf_Maker.cxx,v 1.18 2017/04/26 20:19:18 perev Exp $
2 // $Log: St_ctf_Maker.cxx,v $
3 // Revision 1.18 2017/04/26 20:19:18 perev
4 // Hide m_DataSet
5 //
6 // Revision 1.17 2009/11/10 21:09:59 fisyak
7 // pams clean up
8 //
9 // Revision 1.16 2007/04/28 17:55:47 perev
10 // Redundant StChain.h removed
11 //
12 // Revision 1.15 2003/04/30 20:39:14 perev
13 // Warnings cleanup. Modified lines marked VP
14 //
15 // Revision 1.14 2000/06/26 22:13:06 fisyak
16 // remove params
17 //
18 // Revision 1.13 1999/07/15 13:57:48 perev
19 // cleanup
20 //
21 // Revision 1.12 1999/03/11 03:55:06 perev
22 // new schema
23 //
24 // Revision 1.11 1999/03/02 00:11:49 llope
25 // reduced table maxlen's for mdc2
26 //
27 // Revision 1.10 1999/02/26 14:49:54 kathy
28 // fixed histogram limits as per Bill's request
29 //
30 // Revision 1.9 1999/02/25 21:11:46 kathy
31 // fix histograms
32 //
33 // Revision 1.8 1999/02/25 19:38:50 kathy
34 // fix up histograms
35 //
36 // Revision 1.7 1999/02/23 21:25:42 llope
37 // fixed histograms, added 1/beta vs p
38 //
39 // Revision 1.6 1999/02/23 01:09:47 fisyak
40 // Add Bill Llope dst tables
41 //
42 // Revision 1.5 1999/02/06 00:15:46 fisyak
43 // Add adc/tdc histograms
44 //
45 // Revision 1.4 1999/01/25 23:39:12 fisyak
46 // Add tof
47 //
48 // Revision 1.3 1999/01/21 00:52:31 fisyak
49 // Cleanup
50 //
51 // Revision 1.2 1999/01/02 19:08:14 fisyak
52 // Add ctf
53 //
54 // Revision 1.1 1999/01/01 02:39:38 fisyak
55 // Add ctf Maker
56 //
57 // Revision 1.7 1998/10/31 00:25:45 fisyak
58 // Makers take care about branches
59 //
60 // Revision 1.6 1998/10/06 18:00:29 perev
61 // cleanup
62 //
63 // Revision 1.5 1998/10/02 13:46:08 fine
64 // DataSet->DataSetIter
65 //
66 // Revision 1.4 1998/08/14 15:25:58 fisyak
67 // add options
68 //
69 // Revision 1.3 1998/08/10 02:32:07 fisyak
70 // Clean up
71 //
72 // Revision 1.2 1998/07/20 15:08:15 fisyak
73 // Add tcl and tpt
74 //
76 // //
77 // St_ctf_Maker class for Makers //
78 // //
80 
81 #include "St_ctf_Maker.h"
82 #include "St_DataSetIter.h"
83 #include "ctf/St_ctg_Module.h"
84 #include "ctf/St_ctg_Module.h"
85 #include "ctf/St_cts_Module.h"
86 #include "ctf/St_ctu_Module.h"
87 #ifdef __TPT__
88 #include "ctf/St_fill_dst_tof_Module.h"
89 #endif
90 #include "TH1.h"
91 #include "TH2.h"
92 
93 ClassImp(St_ctf_Maker)
94 
95 //_____________________________________________________________________________
96 St_ctf_Maker::St_ctf_Maker(const char *name):StMaker(name),
97 m_ctb(0),
98 m_ctb_slat_phi(0),
99 m_ctb_slat_eta(0),
100 m_ctb_slat(0),
101 m_cts_ctb(0),
102 m_tof(0),
103 m_tof_slat_phi(0),
104 m_tof_slat_eta(0),
105 m_tof_slat(0),
106 m_cts_tof(0)
107 {
108  drawinit=kFALSE;
109 }
110 //_____________________________________________________________________________
111 St_ctf_Maker::~St_ctf_Maker(){
112 }
113 //_____________________________________________________________________________
114 Int_t St_ctf_Maker::Init(){
115  int iInit=0;
116 
117 // Create tables
118  St_DataSet *ctfg = GetInputDB("ctf/ctg");
119  assert (ctfg);
120  St_DataSetIter gime(ctfg);
121  m_ctb = (St_ctg_geo *) gime("ctb");
122  m_ctb_slat_phi = (St_ctg_slat_phi *) gime("ctb_slat_phi");
123  m_ctb_slat_eta = (St_ctg_slat_eta *) gime("ctb_slat_eta");
124  m_ctb_slat = (St_ctg_slat *) gime("ctb_slat");
125 
126  Int_t Res_ctg_ctb = ctg (m_ctb,m_ctb_slat_phi,m_ctb_slat_eta,m_ctb_slat);
127  if (Res_ctg_ctb!=kSTAFCV_OK) iInit = kStWarn;
128  m_tof = (St_ctg_geo *) gime("tof");
129  m_tof_slat_phi = (St_ctg_slat_phi *) gime("tof_slat_phi");
130  m_tof_slat_eta = (St_ctg_slat_eta *) gime("tof_slat_eta");
131  m_tof_slat = (St_ctg_slat *) gime("tof_slat");
132 
133  Int_t Res_ctg_tof = ctg (m_tof,m_tof_slat_phi,m_tof_slat_eta,m_tof_slat); if(Res_ctg_tof){};
134  // Special treatment for double names
135  // m_cts = (St_cts_mpara *) params("ctf/cts")->GetList()->FindObject("cts");
136  St_DataSet *ctfs = GetInputDB("ctf/cts");
137  assert (ctfs);
138  gime.Reset(ctfs);
139  m_cts_ctb = (St_cts_mpara *) gime("cts_ctb");
140  m_cts_tof = (St_cts_mpara *) gime("cts_tof");
141  // Create Histograms
142  m_adcc = new TH1F("CtfCtbrawAdc","CTB ADCs",128,0.,1024.);
143  m_adct = new TH1F("CtfTofrawAdc","TOF ADCs",128,0.,2048.);
144  m_tsvsp = new TH2F("CtfDsttoftrkTsvsp","TOF 1/beta vs. Ptrk",80,0.1,4.1,100,0.,10.);
145  m_tsvsp->SetXTitle("TPC track momentum (GeV/c)");
146  m_tsvsp->SetYTitle("1/beta from TOFp");
147  m_tsvsp1= new TH2F("CtfDsttoftrkTsvsp1","TOF 1/beta vs. Ptrk",80,0.1,4.1,100,0.,10.);
148  m_tsvsp1->SetXTitle("TPC track momentum (GeV/c)");
149  m_tsvsp1->SetYTitle("1/beta from TOFp, slat Nhits=1");
150  return StMaker::Init();
151 }
152 //_____________________________________________________________________________
154 // PrintInfo();
155 
156  int iMake=kStOK;
157 
158  St_DataSet *gea = GetInputDS("geant");
159  if (gea) {// Geant input exists
160  St_DataSetIter geant(gea);
161  St_g2t_track *g2t_track = (St_g2t_track *) geant("g2t_track");
162  St_g2t_ctf_hit *g2t_ctb_hit = (St_g2t_ctf_hit *) geant("g2t_ctb_hit");
163  if (g2t_ctb_hit) {
164  St_cts_mslat *ctb_mslat = new St_cts_mslat("ctb_mslat", 240); AddData(ctb_mslat);
165  St_cts_event *ctb_event = new St_cts_event("ctb_event", 1); AddData(ctb_event);
166  St_ctu_raw *ctb_raw = new St_ctu_raw("ctb_raw", 240); AddData(ctb_raw);
167  St_ctu_cor *ctb_cor = new St_ctu_cor("ctb_cor", 240); AddData(ctb_cor);
168  Int_t Res_cts_ctb = cts(g2t_ctb_hit, g2t_track,
169  m_ctb, m_ctb_slat, m_ctb_slat_phi, m_ctb_slat_eta, m_cts_ctb,
170  ctb_event, ctb_mslat, ctb_raw); if(Res_cts_ctb){};
171  Int_t Res_ctu_ctb = ctu(m_ctb, m_ctb_slat, ctb_raw, ctb_cor);if(Res_ctu_ctb){};
172  ctu_raw_st *raw = ctb_raw->GetTable();
173  for (Int_t i=0; i<ctb_raw->GetNRows();i++,raw++){
174  m_adcc->Fill((Float_t) raw->adc);
175  }
176  }
177 
178  St_g2t_ctf_hit *g2t_tof_hit = (St_g2t_ctf_hit *) geant("g2t_tof_hit");
179  if (g2t_tof_hit) {
180  St_cts_mslat *tof_mslat = new St_cts_mslat("tof_mslat",500); AddData(tof_mslat); //safe factor of 5 for mdc2
181  St_cts_event *tof_event = new St_cts_event("tof_event", 1); AddData(tof_event);
182  St_ctu_raw *tof_raw = new St_ctu_raw("tof_raw", 50); AddData(tof_raw);
183  St_ctu_cor *tof_cor = new St_ctu_cor("tof_cor", 50); AddData(tof_cor);
184  Int_t Res_cts_tof = cts(g2t_tof_hit, g2t_track,
185  m_tof, m_tof_slat, m_tof_slat_phi, m_tof_slat_eta, m_cts_tof,
186  tof_event, tof_mslat, tof_raw);if(Res_cts_tof){}
187 #ifdef __TPT__
188  St_DataSet *tpc_tracks = GetDataSet("tpc_tracks");
189  St_tpt_track *tptrack = 0;
190  St_tte_mctrk *mctrk = 0;
191  if (tpc_tracks) {
192  St_DataSetIter tpcI(tpc_tracks);
193  tptrack = (St_tpt_track *) tpcI["tptrack"];
194  mctrk = (St_tte_mctrk *) tpcI["mctrk"];
195  }
196  St_DataSet *global = GetDataSet("global");
197  St_dst_vertex *vertex = 0;
198  if (global) {
199  St_DataSetIter globalI(global);
200  vertex = (St_dst_vertex *) globalI["dst/vertex"];
201  }
202  if (g2t_track && tptrack && mctrk && vertex ) {
203  St_dst_tof_trk *dst_tof_trk = new St_dst_tof_trk("dst_tof_trk",250); //safe factor of 5 for mdc2
204  AddData(dst_tof_trk);
205  St_dst_tof_evt *dst_tof_evt = new St_dst_tof_evt("dst_tof_evt",1);
206  AddData(dst_tof_evt);
207  Int_t Res_fill_dst_tof = fill_dst_tof(g2t_tof_hit,g2t_track,
208  tptrack,mctrk,vertex,
209  m_tof,m_tof_slat,
210  m_tof_slat_phi,m_tof_slat_eta,
211  m_cts_tof,tof_mslat,
212  dst_tof_trk,dst_tof_evt); if(Res_fill_dst_tof){};
213  dst_tof_trk_st *dst = dst_tof_trk->GetTable();
214  for (Int_t i=0; i<dst_tof_trk->GetNRows();i++,dst++){
215  m_tsvsp->Fill(dst->ptot,dst->ts_mtime);
216  if (dst->n_hits == 1) {
217  m_tsvsp1->Fill(dst->ptot,dst->ts_mtime);
218  }
219  }
220  }
221  Int_t Res_ctu_tof = ctu(m_tof, m_tof_slat, tof_raw, tof_cor);if(Res_ctu_tof){}
222  ctu_raw_st *raw = tof_raw->GetTable();
223  for (Int_t i=0; i<tof_raw->GetNRows();i++,raw++){
224  m_adct->Fill((Float_t) raw->adc);
225  }
226 #endif
227  }
228  }
229  return iMake;
230 
231 }
232 //_____________________________________________________________________________
233 
virtual void AddData(TDataSet *data, const char *dir=".data")
User methods.
Definition: StMaker.cxx:332
virtual Int_t Make()
Definition: Stypes.h:42
Definition: Stypes.h:40