StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFtpcSlowSimMaker.cxx
1 // $Id: StFtpcSlowSimMaker.cxx,v 1.39 2017/04/26 19:50:08 perev Exp $
2 // $Log: StFtpcSlowSimMaker.cxx,v $
3 // Revision 1.39 2017/04/26 19:50:08 perev
4 // Hide m_DataSet
5 //
6 // Revision 1.38 2013/03/26 15:56:00 genevb
7 // Replace agufld(x,b) with direct call to StarMagField::Instance()->BField(x,b)
8 //
9 // Revision 1.37 2013/02/18 16:30:42 fisyak
10 // gufld => agufld
11 //
12 // Revision 1.36 2012/11/07 23:30:18 fisyak
13 // Supress warnings
14 //
15 // Revision 1.35 2009/11/14 13:17:36 jcs
16 // add LOG_DEBUG message to print out microsecondsPerTimebi
17 //
18 // Revision 1.34 2007/05/15 14:35:18 jcs
19 // update to be compatible with changes made to StFtpcTrackParams.cc
20 // use default microsecondsPerTimebin value from database if no RHIC clock info available
21 //
22 // Revision 1.33 2007/01/15 15:02:20 jcs
23 // replace printf, cout and gMesMgr with Logger
24 //
25 // Revision 1.32 2006/03/01 17:25:40 jcs
26 // move all database initialization to InitRun
27 //
28 // Revision 1.31 2006/01/16 09:40:52 jcs
29 // Calculate mMicrosecondsPerTimebin from RHIC clock frequency for each event
30 //
31 // Revision 1.30 2005/12/12 14:39:54 jcs
32 // exit with kStWarn if StFtpcDbReader not constructed
33 //
34 // Revision 1.29 2005/10/26 14:07:32 jcs
35 // Calculate microsecondsPerTimebin from RHIC clock frequency if available,
36 // otherwise use default from database
37 //
38 // Revision 1.28 2005/03/23 14:33:18 jcs
39 // changes to use body + extra temperature readings starting with y2005
40 // (necessary for embedding)
41 //
42 // Revision 1.27 2004/07/19 22:00:44 jcs
43 // add run number to averageTemperatureWest/East calling sequence
44 //
45 // Revision 1.26 2004/06/04 11:01:51 jcs
46 // replaced StarDb/ftpc/fdepars/fdepar with StarDb/ftpc/ftpcdEdxPars
47 //
48 // Revision 1.25 2004/01/28 01:41:31 jeromel
49 // *** empty log message ***
50 //
51 // Revision 1.24 2003/11/13 14:41:48 jcs
52 // use StFtpcGasUtilities to obtain current pressure and FTPC gas temperature
53 //
54 // Revision 1.23 2003/10/07 14:04:07 jcs
55 // remove previous magnetic field fix
56 //
57 // Revision 1.22 2003/09/29 21:37:28 oldi
58 // Small change to make it compatible with the new StFtpcTrackingParams class.
59 //
60 // Revision 1.21 2003/09/02 17:58:16 perev
61 // gcc 3.2 updates + WarnOff
62 //
63 // Revision 1.20 2003/07/18 18:31:47 perev
64 // test for nonexistance of XXXReader added
65 //
66 // Revision 1.19 2003/07/04 14:04:51 fsimon
67 // Add rotation of hits from global GEANT coordinates into local FTPC coordinates.
68 // This needs an instance of StFtpcTrackingParams
69 //
70 // Revision 1.18 2003/07/03 13:25:47 fsimon
71 // Added database access for cathode offset information.
72 //
73 // Revision 1.17 2003/06/10 13:15:12 jcs
74 // get min,max gas temperature and pressure limits from database
75 //
76 // Revision 1.16 2003/02/28 13:00:27 jcs
77 // for embedding, calculate temperature,pressure corrections using values from offline database
78 //
79 // Revision 1.15 2003/02/14 16:55:50 fsimon
80 // Add functionality that allows for different temperature corrections
81 // in west and east, important for embedding. In the absence af a daq
82 // dataset, the standard temperature values will be used.
83 //
84 // In this version: Hardcoded values for temperatures with existing daq
85 // datasets, set for dAu running with SVT on, runs 4036xxxx and 4035xxxx
86 //
87 // Revision 1.14 2003/01/29 12:10:27 fsimon
88 // Change call of StFtpcRawWriter to allow for switch for inversion of ASIC 2
89 // in FTPC E (error in Y2001-2002 DAQ mapping)
90 //
91 // Revision 1.13 2003/01/14 12:58:25 jcs
92 // use Geometry_ftpc/ftpcAsicMap to control corrections for error in Y2001-2002
93 // FTPC asic mapping
94 //
95 // Revision 1.12 2002/10/23 09:13:58 fsimon
96 // Use calibration Db instead of local (local commented out, uncomment for use)
97 //
98 // Revision 1.11 2002/10/16 12:29:15 fsimon
99 // Include ftpcAmpSlope, ftpcAmpOffset and ftpcTimeOffset in Database access
100 // permits usage of gain factors and time offset in the simulator
101 //
102 // Revision 1.10 2002/06/04 13:54:21 jcs
103 // move GetDataBase from Make to InitRun
104 //
105 // Revision 1.9 2001/10/29 12:56:55 jcs
106 // select FTPC drift maps according to flavor of magnetic field
107 //
108 // Revision 1.8 2001/10/19 09:42:34 jcs
109 // tZero now in data base in ftpcElectronics
110 //
111 // Revision 1.7 2001/04/23 20:34:40 oldi
112 // Output sent to StMessMgr now.
113 //
114 // Revision 1.6 2001/04/04 17:08:57 jcs
115 // remove references to StFtpcParamReader from StFtpcDbReader
116 //
117 // Revision 1.5 2001/04/02 12:04:34 jcs
118 // get FTPC calibrations,geometry from MySQL database and code parameters from StarDb/ftpc
119 //
120 // Revision 1.4 2001/03/19 15:53:10 jcs
121 // use ftpcDimensions from database
122 //
123 // Revision 1.3 2001/03/06 23:36:09 jcs
124 // use database instead of params
125 //
126 // Revision 1.2 2001/01/11 18:28:47 jcs
127 // use PhysicalConstants.h instead of math.h, remove print statement
128 //
129 // Revision 1.1 2000/11/23 10:16:43 hummler
130 // New FTPC slow simulator in pure maker form
131 //
132 //
134 // //
135 // StFtpcSlowSimMaker class //
136 // //
138 
139 #include <Stiostream.h>
140 #include <stdlib.h>
141 #include "StFtpcSlowSimMaker.h"
142 #include "StFtpcSlowSimulator.hh"
143 #include "StFtpcRawWriter.hh"
144 
145 //VP#include "StDaqLib/GENERIC/EventReader.hh"
146 #include "StDAQMaker/StFTPCReader.h"
147 #include "PhysicalConstants.h"
148 
149 #include "StFtpcClusterMaker/StFtpcParamReader.hh"
150 #include "StFtpcClusterMaker/StFtpcDbReader.hh"
151 #include "StFtpcClusterMaker/StFtpcGeantReader.hh"
152 #include "StFtpcClusterMaker/StFtpcGasUtilities.hh"
153 
154 // include for Detector Rotations
155 #include "StFtpcTrackMaker/StFtpcTrackingParams.hh"
156 
157 #include "StDetectorDbMaker/StDetectorDbFTPCGas.h"
158 #include "St_db_Maker/St_db_Maker.h"
159 
160 #include "StMessMgr.h"
161 #include "St_DataSetIter.h"
162 #include "TH1.h"
163 #include "TH2.h"
164 
165 #include "tables/St_g2t_track_Table.h"
166 #include "tables/St_g2t_ftp_hit_Table.h"
167 #include "tables/St_fcl_ftpcndx_Table.h"
168 #include "tables/St_fcl_ftpcsqndx_Table.h"
169 #include "tables/St_fcl_ftpcadc_Table.h"
170 
171 #include "StDetectorDbMaker/StDetectorDbClock.h"
172 
173 ClassImp(StFtpcSlowSimMaker)
174 
175 //_____________________________________________________________________________
176 StFtpcSlowSimMaker::StFtpcSlowSimMaker(const char *name):
177 StMaker(name),
178  m_clusterpars(0),
179  m_slowsimgas(0),
180  m_slowsimpars(0),
181  m_dimensions(0),
182  m_asicmap(0),
183  m_efield(0),
184  m_vdrift(0),
185  m_deflection(0),
186  m_dvdriftdp(0),
187  m_ddeflectiondp(0),
188  m_ampslope(0),
189  m_ampoffset(0),
190  m_timeoffset(0),
191  m_driftfield(0),
192  m_gas(0),
193  m_electronics(0),
194  m_cathode(0),
195  m_temps(0)
196 {
197 }
198 //_____________________________________________________________________________
199 StFtpcSlowSimMaker::~StFtpcSlowSimMaker(){
200 }
201 //_____________________________________________________________________________
202 Int_t StFtpcSlowSimMaker::InitRun(int runnumber){
203  Float_t x[3] = {0,0,0};
204  Float_t b[3];
205  StarMagField::Instance()->BField(x,b);
206  Double_t gFactor = b[2]/4.980;
207 
208  mDbMaker = (St_db_Maker*)GetMaker("db");
209  Int_t dbDate = mDbMaker->GetDateTime().GetDate();
210  LOG_INFO<<"dbDate = "<<dbDate<<endm;
211 
212  LOG_INFO << "StFtpcSlowSimMaker::InitRun("<<runnumber<<") - 'flavor' FTPC drift maps for gFactor = "<<gFactor<<endm;
213 
214  // Load the correct FTPC drift maps depending on magnetic field
215 
216  // Full Field Positive ?
217  if ( gFactor > 0.8 ) {
218  SetFlavor("ffp10kv","ftpcVDrift");
219  SetFlavor("ffp10kv","ftpcdVDriftdP");
220  SetFlavor("ffp10kv","ftpcDeflection");
221  SetFlavor("ffp10kv","ftpcdDeflectiondP");
222  LOG_INFO << "StFtpcSlowSimMaker::InitRun: flavor set to ffp10kv"<<endm;
223  }
224  else if ( gFactor > 0.2 ) {
225  SetFlavor("hfp10kv","ftpcVDrift");
226  SetFlavor("hfp10kv","ftpcdVDriftdP");
227  SetFlavor("hfp10kv","ftpcDeflection");
228  SetFlavor("hfp10kv","ftpcdDeflectiondP");
229  LOG_INFO << "StFtpcSlowSimMaker::InitRun: flavor set to hfp10kv"<<endm;
230  }
231  else if ( gFactor > -0.2 ) {
232  SetFlavor("zf10kv","ftpcVDrift");
233  SetFlavor("zf10kv","ftpcdVDriftdP");
234  SetFlavor("zf10kv","ftpcDeflection");
235  SetFlavor("zf10kv","ftpcdDeflectiondP");
236  LOG_INFO << "StFtpcSlowSimMaker::InitRun: flavor set to zf10kv"<<endm;
237  }
238  else if ( gFactor > -0.8 ) {
239  SetFlavor("hfn10kv","ftpcVDrift");
240  SetFlavor("hfn10kv","ftpcdVDriftdP");
241  SetFlavor("hfn10kv","ftpcDeflection");
242  SetFlavor("hfn10kv","ftpcdDeflectiondP");
243  LOG_INFO << "StFtpcSlowSimMaker::InitRun: flavor set to hfn10kv"<<endm;
244  }
245  else {
246  SetFlavor("ffn10kv","ftpcVDrift");
247  SetFlavor("ffn10kv","ftpcdVDriftdP");
248  SetFlavor("ffn10kv","ftpcDeflection");
249  SetFlavor("ffn10kv","ftpcdDeflectiondP");
250  LOG_INFO << "StFtpcSlowSimMaker::InitRun: flavor set to ffn10kv"<<endm;
251  }
252 
253  // calculate microsecondsPerTimebin from RHIC clock frequency for current run
254  // if not available, use default values from offline database
255 
256  StDetectorDbClock* dbclock = StDetectorDbClock::instance();
257  double freq = dbclock->getCurrentFrequency()/1000000.0;
258  if ( freq != 0)
259  microsecondsPerTimebin = 1./(freq/2.);
260  else
262 
263  St_DataSet *ftpc_geometry_db = GetDataBase("Geometry/ftpc");
264  if ( !ftpc_geometry_db ){
265  LOG_WARN << "StFtpcSlowSimMaker::Error Getting FTPC database: Geometry"<<endm;
266  return kStWarn;
267  }
268  St_DataSetIter dblocal_geometry(ftpc_geometry_db);
269 
270  m_dimensions = (St_ftpcDimensions *)dblocal_geometry("ftpcDimensions");
271  m_asicmap = (St_ftpcAsicMap *)dblocal_geometry("ftpcAsicMap");
272 
273  m_cathode = (St_ftpcInnerCathode *)dblocal_geometry("ftpcInnerCathode");
274 
275  St_DataSet *ftpc_calibrations_db = GetDataBase("Calibrations/ftpc");
276  if ( !ftpc_calibrations_db ){
277  LOG_WARN << "StFtpcSlowSimMaker::Error Getting FTPC database: Calibrations"<<endm;
278  return kStWarn;
279  }
280  St_DataSetIter dblocal_calibrations(ftpc_calibrations_db);
281 
282 
283  m_efield = (St_ftpcEField *)dblocal_calibrations("ftpcEField" );
284  m_vdrift = (St_ftpcVDrift *)dblocal_calibrations("ftpcVDrift" );
285  m_deflection = (St_ftpcDeflection *)dblocal_calibrations("ftpcDeflection" );
286  m_dvdriftdp = (St_ftpcdVDriftdP *)dblocal_calibrations("ftpcdVDriftdP" );
287  m_ddeflectiondp = (St_ftpcdDeflectiondP *)dblocal_calibrations("ftpcdDeflectiondP" );
288  m_gas = (St_ftpcGas *)dblocal_calibrations("ftpcGas");
289  m_driftfield = (St_ftpcDriftField *)dblocal_calibrations("ftpcDriftField");
290  m_electronics = (St_ftpcElectronics *)dblocal_calibrations("ftpcElectronics");
291  m_temps = (St_ftpcTemps *)dblocal_calibrations("ftpcTemps");
292 
293  // Get Database for gain factors and time offset
294  m_ampslope = (St_ftpcAmpSlope *)dblocal_calibrations("ftpcAmpSlope" );
295  m_ampoffset = (St_ftpcAmpOffset *)dblocal_calibrations("ftpcAmpOffset");
296 
297  m_timeoffset = (St_ftpcTimeOffset *)dblocal_calibrations("ftpcTimeOffset");
298 
299 
300  // get ftpc parameters
301  TDataSet *ftpcParsDb = GetInputDB("ftpc");
302  assert(ftpcParsDb);
303  TDataSetIter ftpcPars(ftpcParsDb);
304 
305  // get tracking parameters from database
306  StFtpcTrackingParams::Instance(Debug(),
307  (St_ftpcTrackingPars *)ftpcPars("ftpcTrackingPars"),
308  (St_ftpcdEdxPars *)ftpcPars("ftpcdEdxPars"),
309  (St_ftpcDimensions *)dblocal_geometry("ftpcDimensions"),
310  (St_ftpcPadrowZ *)dblocal_geometry("ftpcPadrowZ"));
311  // instance tracking parameters for rotations
312  StFtpcTrackingParams::Instance(kTRUE,
313  (St_ftpcCoordTrans *)dblocal_calibrations("ftpcCoordTrans"));
314 
315  St_DataSet *ftpclocal = GetDataBase("ftpc"); // zum Verwenden der lokalen DB
316  if ( !ftpclocal ){
317  LOG_WARN << "StFtpcSlowSimMaker::Error Getting local FTPC database: Calibrations"<<endm;
318  return kStWarn;
319  } //assert(ftpc);
320 
321  St_DataSetIter local(ftpclocal);
322 
323  //m_timeoffset = (St_ftpcTimeOffset *)local("ftpcTimeOffset");
324 
325  m_clusterpars = (St_ftpcClusterPars *)local("ftpcClusterPars");
326  m_slowsimgas = (St_ftpcSlowSimGas *)local("ftpcSlowSimGas");
327  m_slowsimpars = (St_ftpcSlowSimPars *)local("ftpcSlowSimPars");
328 
329  return 0;
330 }
331 //_____________________________________________________________________________
332 Int_t StFtpcSlowSimMaker::Init(){
333 
334 
335  // Create Histograms
336  m_nadc = new TH1F("fss_total_adc","Total number of adcs in both FTPCs",1000,0.,2000000.);
337  m_nsqndx = new TH1F("fss_sqndx","FTPC raw data sequence index",100,0.,100000.);
338  m_nadc_index1 = new TH2F("fss_nadc_index1","Total number of adcs vs. number of adcs in FTPC East",100,0.,2000000.,100,0.,1000000.);
339 
340  return StMaker::Init();
341 }
342 //_____________________________________________________________________________
344 LOG_INFO << "Event number "<<(int) GetEventNumber()<<endm;
345 
346  St_DataSetIter geant(GetInputDS("geant"));
347  St_g2t_vertex *g2t_vertex = (St_g2t_vertex *) geant("g2t_vertex");
348  St_g2t_track *g2t_track = (St_g2t_track *) geant("g2t_track");
349  St_g2t_ftp_hit *g2t_ftp_hit = (St_g2t_ftp_hit *) geant("g2t_ftp_hit");
350  if (g2t_vertex && g2t_track && g2t_ftp_hit){
351 
352  St_DataSetIter local((GetData())); local.Cd("pixels");
353  St_fcl_ftpcndx *fcl_ftpcndx = new St_fcl_ftpcndx("fcl_ftpcndx",2);
354  local.Add(fcl_ftpcndx);
355  St_fcl_ftpcsqndx *fcl_ftpcsqndx = new St_fcl_ftpcsqndx("fcl_ftpcsqndx",500000);
356  local.Add(fcl_ftpcsqndx);
357  St_fcl_ftpcadc *fcl_ftpcadc = new St_fcl_ftpcadc("fcl_ftpcadc",2000000);
358  local.Add(fcl_ftpcadc);
359 
360  if (Debug()) {LOG_DEBUG <<"create data reader" << endm;}
361 
362  // create data reader
363  StFtpcGeantReader *geantReader = new StFtpcGeantReader(g2t_vertex,
364  g2t_track,
365  g2t_ftp_hit);
366  if (Debug()) {LOG_DEBUG <<"create FTPC database reader" << endm;}
367  //create FTPC database reader
368  StFtpcDbReader *dbReader = new StFtpcDbReader(m_dimensions,
369  m_asicmap,
370  m_efield,
371  m_vdrift,
372  m_deflection,
373  m_dvdriftdp,
374  m_ddeflectiondp,
375  m_gas,
376  m_driftfield,
377  m_electronics,
378  m_ampslope,
379  m_ampoffset,
380  m_timeoffset,
381  m_cathode);
382 
383  if ( dbReader->returnCode != 0 ) {
384  LOG_WARN << "StFtpcSlowSimMaker::Error Constructing StFtpcDbReader "<<endm;
385  return kStWarn;
386  }
387 
388  if (Debug()) { LOG_DEBUG << "create parameter reader" << endm;}
389  // create parameter reader
390  StFtpcParamReader *paramReader = new StFtpcParamReader(m_clusterpars,
391  m_slowsimgas,
392  m_slowsimpars);
393 
394 // LOG_INFO<<"paramReader->gasTemperatureWest() = "<<paramReader->gasTemperatureWest()<<endm;
395 // LOG_INFO<<"paramReader->gasTemperatureEast() = "<<paramReader->gasTemperatureEast()<<endm;
396 
397  if ( paramReader->gasTemperatureWest() == 0 && paramReader->gasTemperatureEast() == 0) {
398  LOG_INFO << "Using the following values from database:" << endm;
399  if (microsecondsPerTimebin > 0.0 ) {
400  dbReader->setMicrosecondsPerTimebin(microsecondsPerTimebin);
401  LOG_INFO<<" microsecondsPerTimebin = "<<dbReader->microsecondsPerTimebin()<<" (calculated from RHIC Clock Frequency)"<<endm;
402  } else {
403  LOG_INFO<<" microsecondsPerTimebin = "<<dbReader->microsecondsPerTimebin()<<" (default value from database)"<<endm;
404  }
405  LOG_INFO <<" EastIsInverted = "<<dbReader->EastIsInverted()<<endm;
406  LOG_INFO <<" Asic2EastNotInverted = "<<dbReader->Asic2EastNotInverted()<<endm;
407  LOG_INFO <<" tzero = "<<dbReader->tZero()<<endm;
408  LOG_INFO <<" temperatureDifference = "<<dbReader->temperatureDifference()<<endm;
409  LOG_INFO <<" defaultTemperatureWest = "<<dbReader->defaultTemperatureWest()<<endm;
410  LOG_INFO <<" defaultTemperatureEast = "<<dbReader->defaultTemperatureEast()<<endm;
411  LOG_INFO <<" magboltzVDrift(0,0) = "<<dbReader->magboltzVDrift(0,0)<<endm;
412  LOG_INFO <<" magboltzDeflection(0,0) = "<<dbReader->magboltzDeflection(0,0)<<endm;
413  // check db values for cathode offset and angle
414  LOG_INFO <<" offsetCathodeWest = " << dbReader->offsetCathodeWest() << endm;
415  LOG_INFO <<" angleOffsetWest = " << dbReader->angleOffsetWest() << endm;
416  LOG_INFO <<" offsetCathodeEast = " << dbReader->offsetCathodeEast() << endm;
417  LOG_INFO <<" angleOffsetEast = " << dbReader->angleOffsetEast() << endm;
418  }
419  LOG_DEBUG<<" Using microsecondsPerTimebin = "<<dbReader->microsecondsPerTimebin()<<" for this event"<<endm;
420 
421  // get temperatures from offline db, used for embedding!
422  // as long as there is no daq data, standard temperatures are used!
423 
424  St_DataSet *daqDataset;
426  StFTPCReader *ftpcReader=NULL;
427  daqDataset=GetDataSet("StDAQReader");
428  if(daqDataset)
429  {
430  LOG_INFO << "Using StDAQReader to get StFTPCReader in StFtpcSlowSimMaker for embedding" << endm;
431  assert(daqDataset);
432  daqReader=(StDAQReader *)(daqDataset->GetObject());
433  assert(daqReader);
434  ftpcReader=daqReader->getFTPCReader();
435 
436  if (!ftpcReader || !ftpcReader->checkForData()) {
437  LOG_WARN << "No FTPC data available!" << endm;
438  delete paramReader;
439  delete dbReader;
440  return kStWarn;
441  }
442 
443  // test if pressure and gas temperature available from offline DB
444 
445  StDetectorDbFTPCGas * gas = StDetectorDbFTPCGas::instance();
446  if ( !gas ){
447  LOG_WARN << "StFtpcSlowSimMaker::Error Getting FTPC Online database: Conditions"<<endm;
448  delete paramReader;
449  delete dbReader;
450  return kStWarn;
451  }
452 
453  Int_t returnCode;
454 
455  // use available pressure and gas temperature from offline DB to adjust
456  // the barometric pressure depending on the FTPC gas temperature
457 
458 
459  StFtpcGasUtilities *gasUtils = new StFtpcGasUtilities(paramReader,
460  dbReader,
461  gas,
462  m_temps);
463 
464  returnCode = gasUtils->barometricPressure();
465 
466  // Calculate FTPC gas temperature from body temperatures
467 
468  Int_t dbDate = mDbMaker->GetDateTime().GetDate();
469 
470  // For FTPC West
471 
472  returnCode = gasUtils->averageTemperatureWest(dbDate,GetRunNumber());
473 
474  // test if averageBodyTemperature for FTPC West found for first event
475  if (paramReader->gasTemperatureWest() == 0) {
476  // no value found in Calibrations_ftpc/ftpcGasOut for first event
477  // initialize FTPC gas temperatures to default values
478  // default values change depending on SVT high voltage on/off
479  // currently using daqReader->SVTPresent() to test but may need
480  // access to Conditions_svt/svtInterLocks
481  LOG_INFO << "daqReader->SVTPresent() = " << daqReader->SVTPresent()<<endm;
482  returnCode = gasUtils->defaultTemperatureWest(dbDate,daqReader->SVTPresent());
483  }
484 
485  // For FTPC East
486 
487  returnCode = gasUtils->averageTemperatureEast(dbDate,GetRunNumber());
488 
489  // test if averageBodyTemperature for FTPC East found for first event
490  if (paramReader->gasTemperatureEast() == 0 ) {
491  // no value found in Calibrations_ftpc/ftpcGasOut for first event
492  // initialize FTPC gas temperatures to default values
493  // default values change depending on SVT high voltage on/off
494  // currently using daqReader->SVTPresent() to test but may need
495  // access to Conditions_svt/svtInterLocks
496  LOG_INFO << "daqReader->SVTPresent() = " << daqReader->SVTPresent()<<endm;
497  returnCode = gasUtils->defaultTemperatureEast(dbDate,daqReader->SVTPresent());
498  }
499 
500  LOG_INFO << " Using normalizedNowPressure = "<<paramReader->normalizedNowPressure()<<" gasTemperatureWest = "<<paramReader->gasTemperatureWest()<<" gasTemperatureEast = "<<paramReader->gasTemperatureEast()<<endm;
501  paramReader->setAdjustedAirPressureWest(paramReader->normalizedNowPressure()*((dbReader->baseTemperature()+STP_Temperature)/(paramReader->gasTemperatureWest()+STP_Temperature)));
502  LOG_INFO <<" paramReader->setAdjustedAirPressureWest = "<<paramReader->adjustedAirPressureWest()<<endm;
503  paramReader->setAdjustedAirPressureEast(paramReader->normalizedNowPressure()*((dbReader->baseTemperature()+STP_Temperature)/(paramReader->gasTemperatureEast()+STP_Temperature)));
504  LOG_INFO <<" paramReader->setAdjustedAirPressureEast = "<<paramReader->adjustedAirPressureEast()<<endm;
505 
506  delete gasUtils;
507  }
508 
509 
510  if (Debug()) {LOG_DEBUG <<" create data writer"<<endm;}
511 
512  // create data writer
513  StFtpcRawWriter *dataWriter = new StFtpcRawWriter(fcl_ftpcndx,
514  fcl_ftpcsqndx,
515  fcl_ftpcadc,
516  dbReader->Asic2EastNotInverted());
517 
518 
519  if (Debug()) {LOG_DEBUG <<"Create SlowSimulator"<<endm;}
520 
521  StFtpcSlowSimulator *slowsim = new StFtpcSlowSimulator(geantReader,
522  paramReader,
523  dbReader,
524  dataWriter);
525 
526 
527  LOG_INFO << "FTPC SlowSimulator starting... " <<endm;
528  Int_t Res_fss = slowsim->simulate();
529 
530  delete slowsim;
531  delete paramReader;
532  delete dbReader;
533  delete dataWriter;
534  delete geantReader;
535 
536  if (Res_fss) {
537  if(Debug()) {LOG_INFO << "finished fss" << endm;}
538  }
539  }
540  MakeHistograms(); // FTPC slow simulator histograms
541 
542  LOG_INFO << "FTPC SlowSimulator done... " <<endm;
543  return kStOK;
544 }
545 //_____________________________________________________________________________
546 void StFtpcSlowSimMaker::MakeHistograms() {
547 
548  if(Debug()) {LOG_INFO << "*** NOW MAKING HISTOGRAMS FOR FtpcSlowSim ***" << endm;}
549 
550  // Create an iterator
551  St_DataSetIter ftpc_raw((GetData()));
552 
553  //Get the tables
554  St_fcl_ftpcadc *adc = 0;
555  St_fcl_ftpcndx *ndx = 0;
556  St_fcl_ftpcsqndx *sqndx = 0;
557  adc = (St_fcl_ftpcadc *) ftpc_raw.Find("fcl_ftpcadc");
558  ndx = (St_fcl_ftpcndx *) ftpc_raw.Find("fcl_ftpcndx");
559  sqndx = (St_fcl_ftpcsqndx *) ftpc_raw.Find("fcl_ftpcsqndx");
560  // Fill histograms for FTPC slow simulator
561  if (adc) {
562  Float_t nadc = adc->GetNRows();
563  LOG_INFO << "total # adcs = " << adc->GetNRows() << ", nadc = " << nadc << endm;
564  m_nadc->Fill(nadc);
565  }
566  if (ndx) {
567  fcl_ftpcndx_st *r = ndx->GetTable();
568  Float_t index1 = ++r->index;
569 
570  if (adc) {
571  m_nadc_index1->Fill((float)adc->GetNRows(),(float)index1);
572  }
573  }
574  if (sqndx) {
575  fcl_ftpcsqndx_st *r = sqndx->GetTable();
576  for (Int_t i=0; i<sqndx->GetNRows();i++,r++) {
577  m_nsqndx->Fill((float)r->index);
578  }
579  }
580 }
581 //_____________________________________________________________________________
582 
virtual TDataSet * Cd(const Char_t *dirname)
TH2F * m_nadc_index1
FTPC raw data sequence index.
TH1F * m_nsqndx
FTPC raw data adc output.
virtual TObject * GetObject() const
The depricated method (left here for the sake of the backward compatibility)
Definition: TDataSet.cxx:428
Definition: Stypes.h:42
Definition: Stypes.h:40
virtual Int_t GetRunNumber() const
Returns the current RunNumber.
Definition: StMaker.cxx:1054
Float_t microsecondsPerTimebin
FTPC # of total adcs vs. # in FTPC East.