CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
CgemDigitizerSvc Class Reference

#include <CgemDigitizerSvc.h>

+ Inheritance diagram for CgemDigitizerSvc:

Public Member Functions

 CgemDigitizerSvc (const std::string &name, ISvcLocator *svcloc)
 
 ~CgemDigitizerSvc ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
StatusCode setTrack (int layer, int particle, int charge, double p, double trkPosIn[], double trkPosOut[])
 
int getNXstrips () const
 
int getNVstrips () const
 
int getXstripSheet (int n) const
 
int getXstripID (int n) const
 
int getVstripSheet (int n) const
 
int getVstripID (int n) const
 
double getXstripQ (int n) const
 
double getVstripQ (int n) const
 
double getXstripT (int n) const
 
double getVstripT (int n) const
 
 CgemDigitizerSvc (const std::string &name, ISvcLocator *svcloc)
 
 ~CgemDigitizerSvc ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
StatusCode setTrack (int layer, int particle, int charge, double p, double trkPosIn[], double trkPosOut[])
 
int getNXstrips () const
 
int getNVstrips () const
 
int getXstripSheet (int n) const
 
int getXstripID (int n) const
 
int getVstripSheet (int n) const
 
int getVstripID (int n) const
 
double getXstripQ (int n) const
 
double getVstripQ (int n) const
 
double getXstripT (int n) const
 
double getVstripT (int n) const
 
virtual StatusCode setTrack (int layer, int particle, int charge, double p, double trkPosIn[], double trkPosOut[])=0
 
virtual int getNXstrips () const =0
 
virtual int getNVstrips () const =0
 
virtual int getXstripID (int n) const =0
 
virtual int getVstripID (int n) const =0
 
virtual double getXstripQ (int n) const =0
 
virtual double getVstripQ (int n) const =0
 
virtual double getXstripT (int n) const =0
 
virtual double getVstripT (int n) const =0
 
virtual StatusCode setTrack (int layer, int particle, int charge, double p, double trkPosIn[], double trkPosOut[])=0
 
virtual int getNXstrips () const =0
 
virtual int getNVstrips () const =0
 
virtual int getXstripID (int n) const =0
 
virtual int getVstripID (int n) const =0
 
virtual double getXstripQ (int n) const =0
 
virtual double getVstripQ (int n) const =0
 
virtual double getXstripT (int n) const =0
 
virtual double getVstripT (int n) const =0
 

Additional Inherited Members

- Static Public Member Functions inherited from ICgemDigitizerSvc
static const InterfaceID & interfaceID ()
 
static const InterfaceID & interfaceID ()
 

Detailed Description

Constructor & Destructor Documentation

◆ CgemDigitizerSvc() [1/2]

CgemDigitizerSvc::CgemDigitizerSvc ( const std::string &  name,
ISvcLocator *  svcloc 
)

◆ ~CgemDigitizerSvc() [1/2]

CgemDigitizerSvc::~CgemDigitizerSvc ( )

Definition at line 48 of file CgemDigitizerSvc.cxx.

48 {
49}

◆ CgemDigitizerSvc() [2/2]

CgemDigitizerSvc::CgemDigitizerSvc ( const std::string &  name,
ISvcLocator *  svcloc 
)

◆ ~CgemDigitizerSvc() [2/2]

CgemDigitizerSvc::~CgemDigitizerSvc ( )

Member Function Documentation

◆ finalize() [1/2]

StatusCode CgemDigitizerSvc::finalize ( )
virtual

Definition at line 154 of file CgemDigitizerSvc.cxx.

154 {
155 MsgStream log(messageService(), name());
156 log << MSG::INFO << "CgemDigitizerSvc::finalize()" << endreq;
157 delete m_pIon;
158 delete m_pDriftAndAva;
159 delete m_pInduction;
160
161 return StatusCode::SUCCESS;
162}

◆ finalize() [2/2]

virtual StatusCode CgemDigitizerSvc::finalize ( )
virtual

◆ getNVstrips() [1/2]

int CgemDigitizerSvc::getNVstrips ( ) const
inlinevirtual

◆ getNVstrips() [2/2]

int CgemDigitizerSvc::getNVstrips ( ) const
inlinevirtual

Implements ICgemDigitizerSvc.

Definition at line 56 of file InstallArea/include/CgemDigitizerSvc/CgemDigitizerSvc/CgemDigitizerSvc.h.

56{return m_nVstrips;}

◆ getNXstrips() [1/2]

int CgemDigitizerSvc::getNXstrips ( ) const
inlinevirtual

◆ getNXstrips() [2/2]

int CgemDigitizerSvc::getNXstrips ( ) const
inlinevirtual

Implements ICgemDigitizerSvc.

Definition at line 55 of file InstallArea/include/CgemDigitizerSvc/CgemDigitizerSvc/CgemDigitizerSvc.h.

55{return m_nXstrips;}

◆ getVstripID() [1/2]

int CgemDigitizerSvc::getVstripID ( int  n) const
inlinevirtual

Implements ICgemDigitizerSvc.

Definition at line 60 of file Cgem/CgemDigitizerSvc/CgemDigitizerSvc-00-00-24/CgemDigitizerSvc/CgemDigitizerSvc.h.

60{return m_vstripID[n];}
const Int_t n

Referenced by BesCgemDigitizer::Digitize_v3().

◆ getVstripID() [2/2]

int CgemDigitizerSvc::getVstripID ( int  n) const
inlinevirtual

Implements ICgemDigitizerSvc.

Definition at line 60 of file InstallArea/include/CgemDigitizerSvc/CgemDigitizerSvc/CgemDigitizerSvc.h.

60{return m_vstripID[n];}

◆ getVstripQ() [1/2]

double CgemDigitizerSvc::getVstripQ ( int  n) const
inlinevirtual

◆ getVstripQ() [2/2]

double CgemDigitizerSvc::getVstripQ ( int  n) const
inlinevirtual

Implements ICgemDigitizerSvc.

Definition at line 62 of file InstallArea/include/CgemDigitizerSvc/CgemDigitizerSvc/CgemDigitizerSvc.h.

62{return m_vstripQ[n];}

◆ getVstripSheet() [1/2]

int CgemDigitizerSvc::getVstripSheet ( int  n) const
inline

◆ getVstripSheet() [2/2]

int CgemDigitizerSvc::getVstripSheet ( int  n) const
inline

Definition at line 59 of file InstallArea/include/CgemDigitizerSvc/CgemDigitizerSvc/CgemDigitizerSvc.h.

59{return m_vstripSheet[n];}

◆ getVstripT() [1/2]

double CgemDigitizerSvc::getVstripT ( int  n) const
inlinevirtual

◆ getVstripT() [2/2]

double CgemDigitizerSvc::getVstripT ( int  n) const
inlinevirtual

Implements ICgemDigitizerSvc.

Definition at line 64 of file InstallArea/include/CgemDigitizerSvc/CgemDigitizerSvc/CgemDigitizerSvc.h.

64{return m_vstripT[n];}

◆ getXstripID() [1/2]

int CgemDigitizerSvc::getXstripID ( int  n) const
inlinevirtual

◆ getXstripID() [2/2]

int CgemDigitizerSvc::getXstripID ( int  n) const
inlinevirtual

Implements ICgemDigitizerSvc.

Definition at line 58 of file InstallArea/include/CgemDigitizerSvc/CgemDigitizerSvc/CgemDigitizerSvc.h.

58{return m_xstripID[n];}

◆ getXstripQ() [1/2]

double CgemDigitizerSvc::getXstripQ ( int  n) const
inlinevirtual

◆ getXstripQ() [2/2]

double CgemDigitizerSvc::getXstripQ ( int  n) const
inlinevirtual

Implements ICgemDigitizerSvc.

Definition at line 61 of file InstallArea/include/CgemDigitizerSvc/CgemDigitizerSvc/CgemDigitizerSvc.h.

61{return m_xstripQ[n];}

◆ getXstripSheet() [1/2]

int CgemDigitizerSvc::getXstripSheet ( int  n) const
inline

◆ getXstripSheet() [2/2]

int CgemDigitizerSvc::getXstripSheet ( int  n) const
inline

Definition at line 57 of file InstallArea/include/CgemDigitizerSvc/CgemDigitizerSvc/CgemDigitizerSvc.h.

57{return m_xstripSheet[n];}

◆ getXstripT() [1/2]

double CgemDigitizerSvc::getXstripT ( int  n) const
inlinevirtual

◆ getXstripT() [2/2]

double CgemDigitizerSvc::getXstripT ( int  n) const
inlinevirtual

Implements ICgemDigitizerSvc.

Definition at line 63 of file InstallArea/include/CgemDigitizerSvc/CgemDigitizerSvc/CgemDigitizerSvc.h.

63{return m_xstripT[n];}

◆ initialize() [1/2]

StatusCode CgemDigitizerSvc::initialize ( )
virtual

Definition at line 60 of file CgemDigitizerSvc.cxx.

60 {
61 MsgStream log(messageService(), name());
62 log << MSG::INFO << "CgemDigitizerSvc::initialize()" << endreq;
63
64 StatusCode sc = Service::initialize();
65 if( sc.isFailure() ) return sc;
66
67 static IJobOptionsSvc* jobSvc = 0;
68 if ( jobSvc == 0 ) {
69 sc = service("JobOptionsSvc", jobSvc);
70 if ( sc.isFailure() ) {
71 std::cout << "Can't get the JobOptionsSvc @ DistBoss::GetPropertyValue()" << std::endl;
72 return sc;
73 }
74 }
75
76 // const vector<const Property*>* properties = jobSvc->getProperties(client);
77 const vector<const Property*>* properties = jobSvc->getProperties("BesRndmGenSvc");
78 // cout << "client of jobSvc: " << jobSvc->getClients() << endl;
79 if ( properties == NULL ) {
80 std::cout << "In CgemDigitizerSvc::initialize(), can't get client: " << std::endl;
81 return StatusCode::FAILURE;
82 }
83
84 unsigned int randSeed;
85 for ( unsigned int i = 0; i < properties->size(); ++i ) {
86 if ( properties->at(i)->name() == "RndmSeed" ) {
87 cout << "name of property: " << properties->at(i)->name() << endl;
88 string strRnd = properties->at(i)->toString();
89 sscanf(strRnd.c_str(), "%u", &randSeed);
90 cout << "random seed from jobOption: " << randSeed << endl;
91 break;
92 }
93 }
94
95 sc = service("CgemGeomSvc", m_geomSvc); // initial pointer of CgemGeomSvc
96 if(sc != StatusCode::SUCCESS)
97 {
98 log << MSG::ERROR << "can not use CgemGeomSvc" << endreq;
99 return StatusCode::FAILURE;
100 }
101
102 gRandom->SetSeed(randSeed); // set random seed
103
104 cout << "ionModel = " << m_ionModel << endl;
105 if(1 == m_ionModel){
106 m_pIon = new IonizationGar();
107 } else if(2 == m_ionModel){
108 m_pIon = new IonizationGTS();
109 }
110 // m_pIon = new IonizationGar();
111 m_pIon->init(randSeed, m_geomSvc, m_magConfig);
112 m_pIon->setDebugging(m_garfDebugging);
113
114 if(1 == m_driftAvaModel){
115 m_pDriftAndAva = new SamplingGar();
116 } else if(2 == m_driftAvaModel){
117 m_pDriftAndAva = new SamplingGTS();
118 }
119 m_pDriftAndAva->init(m_geomSvc, m_magConfig);
120
121 if(1 == m_inductionModel){
122 m_pInduction = new InductionGar();
123 } else if(2 == m_inductionModel){
124 m_pInduction = new InductionGTS();
125 }
126 m_pInduction->init(m_geomSvc, m_magConfig);
127 m_pInduction->setDebugOutput(m_debugInduction);
128
129 // ntuple
130 INTupleSvc* ntupleSvc;
131 Gaudi::svcLocator() -> service("NTupleSvc", ntupleSvc);
132 NTuplePtr nt(ntupleSvc, "CgemDigitizerSvcNT/digi");
133 // NTuplePtr nt(ntupleSvc(), "CgemDigitizerSvcNT/digi");
134 if(nt) m_tuple = nt;
135 else{
136 m_tuple = ntupleSvc->book("CgemDigitizerSvcNT/digi", CLID_ColumnWiseTuple, "noise");
137 if(m_tuple){
138 m_tuple->addItem("nIonE", m_ntNIonE);
139 m_tuple->addItem("nMultiE", m_ntNMultiE);
140 m_tuple->addItem("nXstrips", m_ntNxstrips,0,100);
141 m_tuple->addItem("nVstrips", m_ntNvstrips,0,100);
142 m_tuple->addIndexedItem("XstripQ", m_ntNxstrips,m_ntxstripQ);
143 m_tuple->addIndexedItem("XstripT", m_ntNxstrips,m_ntxstripT);
144 m_tuple->addIndexedItem("VstripQ", m_ntNvstrips,m_ntvstripQ);
145 m_tuple->addIndexedItem("VstripT", m_ntNvstrips,m_ntvstripT);
146 m_tuple->addIndexedItem("XstripID", m_ntNxstrips,m_XstripID);
147 m_tuple->addIndexedItem("VstripID", m_ntNvstrips,m_VstripID);
148 }
149 }
150
151 return StatusCode::SUCCESS;
152}
virtual void init(ICgemGeomSvc *geomSvc, double magConfig)=0
virtual void setDebugOutput(bool debugOutput)=0
virtual void init(ICgemGeomSvc *geomSvc, double magConfig)=0
virtual void setDebugging(bool debugging)=0
virtual void init(unsigned int random, ICgemGeomSvc *geomSvc, double magConfig)=0

◆ initialize() [2/2]

virtual StatusCode CgemDigitizerSvc::initialize ( )
virtual

◆ queryInterface() [1/2]

StatusCode CgemDigitizerSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvUnknown 
)
virtual

Definition at line 51 of file CgemDigitizerSvc.cxx.

51 {
52 if( IID_ICgemDigitizerSvc.versionMatch(riid) ){
53 *ppvInterface = static_cast<ICgemDigitizerSvc*> (this);
54 } else{
55 return Service::queryInterface(riid, ppvInterface);
56 }
57 return StatusCode::SUCCESS;
58}

◆ queryInterface() [2/2]

virtual StatusCode CgemDigitizerSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvUnknown 
)
virtual

◆ setTrack() [1/2]

StatusCode CgemDigitizerSvc::setTrack ( int  layer,
int  particle,
int  charge,
double  p,
double  trkPosIn[],
double  trkPosOut[] 
)
virtual

Implements ICgemDigitizerSvc.

Definition at line 164 of file CgemDigitizerSvc.cxx.

164 {
165
166 double time_spent = 0.;
167 clock_t begin = clock();
168
169 clear();
170 m_layer = layer;
171
172 m_pIon->setTrack(particle, charge, p, trkPosIn, trkPosOut);
173
174 vector<double> ionEx;
175 vector<double> ionEy;
176 vector<double> ionEz;
177 vector<double> ionEt;
178 int nIonE = m_pIon->getNumberIonE();
179 for(int i=0; i<nIonE; i++){
180 ionEx.push_back(m_pIon->getEx(i));
181 ionEy.push_back(m_pIon->getEy(i));
182 ionEz.push_back(m_pIon->getEz(i));
183 ionEt.push_back(m_pIon->getEt(i));
184 }
185 clock_t end = clock();
186 time_spent += (double)(end - begin) / CLOCKS_PER_SEC;
187 // cout << "CgemDigitizerSvc::ionization " << time_spent << " seconds" << endl;
188 // ---------------------------
189 time_spent = 0.;
190 begin = clock();
191
192 m_pDriftAndAva->setIonElectrons(layer, nIonE, ionEx, ionEy, ionEz, ionEt);
193
194 m_nMultiE = m_pDriftAndAva->getNelectrons();
195 for(int i=0; i<m_nMultiE; i++){
196 double x = m_pDriftAndAva->getX(i);
197 double y = m_pDriftAndAva->getY(i);
198 double z = m_pDriftAndAva->getZ(i);
199 double t = m_pDriftAndAva->getT(i);
200 m_multiEx.push_back(x);
201 m_multiEy.push_back(y);
202 m_multiEz.push_back(z);
203 m_multiEt.push_back(t);
204 }
205 end = clock();
206 time_spent += (double)(end - begin) / CLOCKS_PER_SEC;
207 // cout << "CgemDigitizerSvc::diffusion " << time_spent << " seconds" << endl;
208 // --------------------
209 time_spent = 0.;
210 begin = clock();
211
212 // Induction process
213 // positionToStrips();
214 // cout << "nXstrips = " << m_nXstrips << " , m_nVstrips = " << m_nVstrips << endl;
215 m_pInduction->setMultiElectrons(layer, m_nMultiE, m_multiEx, m_multiEy, m_multiEz, m_multiEt);
216 m_nXstrips = m_pInduction->getNXstrips();
217 for(int i=0; i<m_nXstrips; i++){
218 m_xstripSheet.push_back(m_pInduction->getXstripSheet(i));
219 m_xstripID.push_back(m_pInduction->getXstripID(i));
220 m_xstripQ.push_back(m_pInduction->getXstripQ(i));
221 m_xstripT.push_back(m_pInduction->getXstripT(i));
222 }
223 m_nVstrips = m_pInduction->getNVstrips();
224 for(int i=0; i<m_nVstrips; i++){
225 m_vstripSheet.push_back(m_pInduction->getVstripSheet(i));
226 m_vstripID.push_back(m_pInduction->getVstripID(i));
227 m_vstripQ.push_back(m_pInduction->getVstripQ(i));
228 m_vstripT.push_back(m_pInduction->getVstripT(i));
229 }
230 end = clock();
231 time_spent += (double)(end - begin) / CLOCKS_PER_SEC;
232 // cout << "CgemDigitizerSvc::induction " << time_spent << " seconds" << endl;
233 // ---------------
234 time_spent = 0.;
235 begin = clock();
236
237 //m_ntNIonE = nIonE;
238 //m_ntNMultiE = m_nMultiE;
239 //m_ntNxstrips = m_nXstrips;
240 //m_ntNvstrips = m_nVstrips;
241 //m_tuple->write();
242
243 end = clock();
244 time_spent += (double)(end - begin) / CLOCKS_PER_SEC;
245 // cout << "CgemDigitizerSvc::write " << time_spent << " seconds" << endl;
246
247
248 return StatusCode::SUCCESS;
249}
Double_t x[10]
virtual double getX(int n) const =0
virtual double getY(int n) const =0
virtual void setIonElectrons(int layer, int nElectrons, std::vector< double > x, std::vector< double > y, std::vector< double > z, std::vector< double > t)=0
virtual double getZ(int n) const =0
virtual double getT(int n) const =0
virtual int getNelectrons() const =0
virtual double getXstripT(int n) const =0
virtual int getNVstrips() const =0
virtual int getVstripSheet(int n) const =0
virtual int getXstripID(int n) const =0
virtual int getVstripID(int n) const =0
virtual double getVstripQ(int n) const =0
virtual int getXstripSheet(int n) const =0
virtual double getXstripQ(int n) const =0
virtual void setMultiElectrons(int layer, int nElectrons, std::vector< double > x, std::vector< double > y, std::vector< double > z, std::vector< double > t)=0
virtual double getVstripT(int n) const =0
virtual int getNXstrips() const =0
virtual double getEx(int nElec)=0
virtual int getNumberIonE()=0
virtual double getEy(int nElec)=0
virtual double getEt(int nElec)=0
virtual double getEz(int nElec)=0
virtual void setTrack(int particle, int charge, double p, double trkPosIn[], double trkPosOut[])=0
int t()
Definition: t.c:1

Referenced by BesCgemDigitizer::Digitize_v3().

◆ setTrack() [2/2]

StatusCode CgemDigitizerSvc::setTrack ( int  layer,
int  particle,
int  charge,
double  p,
double  trkPosIn[],
double  trkPosOut[] 
)
virtual

Implements ICgemDigitizerSvc.


The documentation for this class was generated from the following files: