StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
St_spa_Maker.cxx
1  /**************************************************************************
2  * Class : St_spa_maker.cxx
3  **************************************************************************
4  * $Id: St_spa_Maker.cxx,v 1.19 2017/04/26 20:16:30 perev Exp $
5  *
6  * $Log: St_spa_Maker.cxx,v $
7  * Revision 1.19 2017/04/26 20:16:30 perev
8  * Hide m_DataSet
9  *
10  * Revision 1.18 2009/01/26 15:00:34 fisyak
11  * Take care about sector number packed in volume Id
12  *
13  * Revision 1.17 2008/08/12 22:48:39 bouchet
14  * retrieve positions and dimensions tables using Get methods
15  *
16  * Revision 1.16 2008/05/29 03:07:28 bouchet
17  * remove inactive variables;fix a potential memory leak
18  *
19  * Revision 1.15 2008/05/07 22:59:11 bouchet
20  * EmbeddingMaker:initial version ; modified reading of GEANT hits
21  *
22  * Revision 1.14 2008/04/15 21:04:43 bouchet
23  * remove latest change
24  *
25  * Revision 1.13 2008/04/12 14:21:28 bouchet
26  * Add a switch to use constant noise and pedestal
27  *
28  * Revision 1.12 2007/04/28 17:57:00 perev
29  * Redundant StChain.h removed
30  *
31  * Revision 1.11 2007/03/21 17:19:56 fisyak
32  * use new StSsdBarrel
33  *
34  * Revision 1.10 2007/01/17 18:14:37 bouchet
35  * replace printf, cout statements with LOG statements
36  *
37  * Revision 1.9 2006/10/16 16:36:08 bouchet
38  * Unify classes : Remove StSlsStrip, StSlsPoint, StSpaStrip, StSpaNoise by the same classes used in StSsdPointMaker (StSsdStrip,StSsdPoint) ; The methods for these classes are in StSsdUtil
39  *
40  * Revision 1.8 2006/09/15 21:09:52 bouchet
41  * read the noise and pedestal from ssdStripCalib
42  *
43  * Revision 1.7 2005/11/22 03:56:46 bouchet
44  * id_mctrack is using for setIdTruth
45  *
46  * Revision 1.6 2005/05/13 08:39:33 lmartin
47  * CVS tags added
48  *
49  * Revision 1.5 2003/10/08 03:46:34 suire
50  * *** empty log message ***
51  *
52  * Revision 1.3 2002/03/25 20:06:44 suire
53  * Doxygen documentation, cleaning
54  *
55  *
56  **************************************************************************/
57 #include <assert.h>
58 #include <Stiostream.h>
59 #include <stdlib.h>
60 #include "St_spa_Maker.h"
61 #include "TDataSetIter.h"
62 //#include "svt/St_spa_am_Module.h"
63 #include "TFile.h"
64 #include "StMessMgr.h"
65 
66 #include "StSsdUtil/StSsdBarrel.hh"
67 #include "StSsdPointMaker/StSsdPointMaker.h"
68 #include "tables/St_spa_strip_Table.h"
69 #include "tables/St_sls_strip_Table.h"
70 #include "tables/St_ssdDimensions_Table.h"
71 #include "tables/St_sdm_calib_par_Table.h"
72 #include "tables/St_slsCtrl_Table.h"
73 #include "tables/St_sdm_calib_db_Table.h"
74 #include "tables/St_ssdStripCalib_Table.h"
75 #include "tables/St_ssdWafersPosition_Table.h"
76 #include "StSsdDbMaker/StSsdDbMaker.h"
77 
78 ClassImp(St_spa_Maker)
79 
80 //_____________________________________________________________________________
81  St_spa_Maker::St_spa_Maker(const char *name): StMaker(name),m_noise(0),m_condition(0),m_ctrl(0) {}
82 //_____________________________________________________________________________
83 St_spa_Maker::~St_spa_Maker(){}
84 //_____________________________________________________________________________
85 Int_t St_spa_Maker::Init(){
86 
87  // Create tables
88  TDataSet *ssdparams = GetInputDB("svt/ssd");
89  TDataSetIter local(ssdparams);
90 
91  m_condition = (St_sdm_condition_db *)local("sdm_condition_db");
92  return StMaker::Init();
93 }
94 //_____________________________________________________________________________
95 Int_t St_spa_Maker::InitRun(Int_t runnumber){
96  m_noise = (St_ssdStripCalib*) GetDataBase("Calibrations/ssd/ssdStripCalib");
97  if (! m_noise) return kStFATAL;
98  m_ctrl = gStSsdDbMaker->GetSlsCtrl();
99  if (!m_ctrl) {
100  LOG_ERROR << "No access to control parameters" << endm;
101  return kStFatal;
102  }
103  return kStOK;
104 }
105 //_____________________________________________________________________________
107 {
108  if (Debug()==true) {LOG_DEBUG << "Make() ..." << endm;}
109  // Create output tables
110  Int_t res = 0;
111 
112  St_sls_strip *sls_strip = (St_sls_strip *)GetDataSet("sls_strip/.data/sls_strip");
113 
114  St_spa_strip *spa_strip = new St_spa_strip("spa_strip",40000);
115  AddData(spa_strip);
116 
117  //slsCtrl_st *ctrl = m_ctrl->GetTable();
118 
119  LOG_INFO<<"#################################################"<<endm;
120  LOG_INFO<<"#### START OF SSD PEDESTAL ANNIHILATOR ####"<<endm;
121  LOG_INFO<<"#### SSD BARREL INITIALIZATION ####"<<endm;
122  StSsdBarrel *mySsd = StSsdBarrel::Instance();
123  assert(mySsd);
124  mySsd->readStripFromTable(sls_strip);
125  LOG_INFO<<"#### NUMBER OF SLS STRIPS "<<sls_strip->GetNRows()<<" ####"<<endm;
126  Int_t numberOfNoise = 0;
127  if (m_noise) {
128  numberOfNoise = mySsd->readNoiseFromTable(m_noise);
129  LOG_INFO<<"#### NUMBER OF DB ENTRIES "<<numberOfNoise<<" ####"<<endm;
130  } else {
131  LOG_ERROR<<"m_noise is missing" <<endm;
132  }
133  if (m_condition) {
134  mySsd->readConditionDbFromTable(m_condition);
135  LOG_INFO<<"#### ADD SPA NOISE ####"<<endm;
136  } else {
137  LOG_ERROR<<"m_condition is missing" <<endm;
138  }
139  if (m_ctrl) {
140  mySsd->addNoiseToStrip(m_ctrl);
141  LOG_INFO<<"#### DO DAQ SIMULATION ####"<<endm;
142  } else {
143  LOG_ERROR<<"m_ctrl is missing" <<endm;
144  }
145  mySsd->doDaqSimulation(m_ctrl);
146  Int_t nSsdStrips = mySsd->writeStripToTable(spa_strip,sls_strip);
147  //Int_t nSsdStrips = mySsd->writeStripToTable(spa_strip);
148  spa_strip->Purge();
149  LOG_INFO<<"#### NUMBER OF SPA STRIP "<<nSsdStrips<<" ####"<<endm;
150  mySsd->Reset();
151  LOG_INFO<<"#################################################"<<endm;
152  if (nSsdStrips) res = kStOK;
153 
154  if(res!=kStOK){
155  LOG_WARN <<"no output"<<endm;
156  return kStWarn;
157  }
158 
159  return kStOK;
160 }
161 //_____________________________________________________________________________
162 void St_spa_Maker::PrintInfo()
163 {
164  if (Debug()==true){ StMaker::PrintInfo();}
165 }
166 //_____________________________________________________________________________
168  if (Debug()==true) {LOG_DEBUG << "Finish() ... " << endm; }
169  return kStOK;
170 }
171 
virtual void AddData(TDataSet *data, const char *dir=".data")
User methods.
Definition: StMaker.cxx:332
virtual Int_t Finish()
virtual Int_t Make()
Int_t readNoiseFromTable(St_sdm_calib_db *spa_noise, StSsdDynamicControl *dynamicControl)
Definition: StSsdBarrel.cc:345
Definition: Stypes.h:42
Definition: Stypes.h:40