CGEM BOSS 6.6.5.i
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[])
 
StatusCode setTrack (int layer, std::vector< int >particle, std::vector< int > charge, std::vector< double > p, std::vector< vector< double > > trkPosIn, std::vector< vector< 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 getXstripQ2 (int n) const
 
double getVstripQ2 (int n) const
 
double getXstripQ (int n) const
 
double getVstripQ (int n) const
 
double getXstripT (int n) const
 
double getVstripT (int n) const
 
double getXfirstT (int n) const
 
double getVfirstT (int n) const
 
double getQsaturation (int layer, int sheet, int view, int id)
 
- Public Member Functions inherited from ICgemDigitizerSvc

Additional Inherited Members

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

Detailed Description

Definition at line 44 of file CgemDigitizerSvc.h.

Constructor & Destructor Documentation

◆ CgemDigitizerSvc()

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

Definition at line 38 of file CgemDigitizerSvc.cxx.

38 :Service (name, svcloc){
39 // declare properties
40 declareProperty("IonizationModel", m_ionModel=1);
41 declareProperty("DriftAvalancheModel", m_driftAvaModel=1); // 3 mean SamplingGar2,
42 declareProperty("InductionModel", m_inductionModel=1); // 3 mean InductionGar2,
43 // this 2 doesnot extend from base normally and have to be used in conjunction.
44 declareProperty("GarfieldDebugging", m_garfDebugging=false);
45 declareProperty("SamplingDebugging", m_samplingDebugging=false);
46 declareProperty("InductionDebugging", m_debugInduction=false);
47 declareProperty("MagConfig", m_magConfig=1);
48 declareProperty("LUTFilePath",m_LUTFilePath = "/bes3fs/cgemCosmic/data/CGEM_cosmic_look_up_table_17.root");
49 declareProperty("QBranchVsampleDelay",sample_delay = 162.5);
50 declareProperty("StoreUnderThrethold",m_storeFlag = false);
51 declareProperty("Saturation",m_saturation = true);
52 declareProperty("SaveNt",m_saveNt= false);
53 declareProperty("SamplingGarGainMultiplier",m_GainMultiplier);
54 declareProperty("SamplingGarTransMultiplier",m_TransMultiplier= 1.0);
55 declareProperty("SamplingGarDiffuMultiplier",m_DiffuMultiplier= 1.0);
56 //cout << "CgemDigitizerSvc::m_ionModel = " << m_ionModel << endl;
57 declareProperty("Ngaps_microSector",m_Ngaps_microSector= 40);
58 declareProperty("gapShift_microSector",m_gapShift_microSector);
59 declareProperty("gap_microSector", m_gap_microSector= 1.1);// in mm
60 declareProperty("microSector_width", m_microSector_width);// in rad
61 declareProperty("QinGausSigma", m_QinGausSigma);
62 declareProperty("ScaleSignalX", m_ScaleSignalX=1.0);
63}

◆ ~CgemDigitizerSvc()

CgemDigitizerSvc::~CgemDigitizerSvc ( )

Definition at line 65 of file CgemDigitizerSvc.cxx.

65 {
66}

Member Function Documentation

◆ finalize()

StatusCode CgemDigitizerSvc::finalize ( )
virtual

Definition at line 272 of file CgemDigitizerSvc.cxx.

272 {
273 MsgStream log(messageService(), name());
274 log << MSG::INFO << "CgemDigitizerSvc::finalize()" << endreq;
275 delete m_pIon;
276 delete m_pDriftAndAva;
277 delete m_pInduction;
278
279 return StatusCode::SUCCESS;
280}

◆ getNVstrips()

int CgemDigitizerSvc::getNVstrips ( ) const
inlinevirtual

Implements ICgemDigitizerSvc.

Definition at line 61 of file CgemDigitizerSvc.h.

61{return m_nVstrips;}

Referenced by BesCgemDigitizer::Digitize_v3().

◆ getNXstrips()

int CgemDigitizerSvc::getNXstrips ( ) const
inlinevirtual

Implements ICgemDigitizerSvc.

Definition at line 60 of file CgemDigitizerSvc.h.

60{return m_nXstrips;}

Referenced by BesCgemDigitizer::Digitize_v3().

◆ getQsaturation()

double CgemDigitizerSvc::getQsaturation ( int layer,
int sheet,
int view,
int id )
inline

Definition at line 75 of file CgemDigitizerSvc.h.

75{ return Qsaturation[layer][sheet][view][id]; }

Referenced by BesCgemDigitizer::Digitize_v3().

◆ getVfirstT()

double CgemDigitizerSvc::getVfirstT ( int n) const
inline

Definition at line 74 of file CgemDigitizerSvc.h.

74{return m_vfirstT[n];}
const Int_t n

◆ getVstripID()

int CgemDigitizerSvc::getVstripID ( int n) const
inlinevirtual

Implements ICgemDigitizerSvc.

Definition at line 65 of file CgemDigitizerSvc.h.

65{return m_vstripID[n];}

Referenced by BesCgemDigitizer::Digitize_v3().

◆ getVstripQ()

double CgemDigitizerSvc::getVstripQ ( int n) const
inlinevirtual

Implements ICgemDigitizerSvc.

Definition at line 70 of file CgemDigitizerSvc.h.

70{return m_vstripQ2[n];}

Referenced by BesCgemDigitizer::Digitize_v3().

◆ getVstripQ2()

double CgemDigitizerSvc::getVstripQ2 ( int n) const
inline

Definition at line 68 of file CgemDigitizerSvc.h.

68{return m_vstripQ[n];}

◆ getVstripSheet()

int CgemDigitizerSvc::getVstripSheet ( int n) const
inline

Definition at line 64 of file CgemDigitizerSvc.h.

64{return m_vstripSheet[n];}

Referenced by BesCgemDigitizer::Digitize_v3().

◆ getVstripT()

double CgemDigitizerSvc::getVstripT ( int n) const
inlinevirtual

Implements ICgemDigitizerSvc.

Definition at line 72 of file CgemDigitizerSvc.h.

72{return m_vstripT[n];}

Referenced by BesCgemDigitizer::Digitize_v3().

◆ getXfirstT()

double CgemDigitizerSvc::getXfirstT ( int n) const
inline

Definition at line 73 of file CgemDigitizerSvc.h.

73{return m_xfirstT[n];}

◆ getXstripID()

int CgemDigitizerSvc::getXstripID ( int n) const
inlinevirtual

Implements ICgemDigitizerSvc.

Definition at line 63 of file CgemDigitizerSvc.h.

63{return m_xstripID[n];}

Referenced by BesCgemDigitizer::Digitize_v3().

◆ getXstripQ()

double CgemDigitizerSvc::getXstripQ ( int n) const
inlinevirtual

Implements ICgemDigitizerSvc.

Definition at line 69 of file CgemDigitizerSvc.h.

69{return m_xstripQ2[n];}//sum of induced charge simulated

Referenced by BesCgemDigitizer::Digitize_v3().

◆ getXstripQ2()

double CgemDigitizerSvc::getXstripQ2 ( int n) const
inline

Definition at line 67 of file CgemDigitizerSvc.h.

67{return m_xstripQ[n];}//measured Q

◆ getXstripSheet()

int CgemDigitizerSvc::getXstripSheet ( int n) const
inline

Definition at line 62 of file CgemDigitizerSvc.h.

62{return m_xstripSheet[n];}

Referenced by BesCgemDigitizer::Digitize_v3().

◆ getXstripT()

double CgemDigitizerSvc::getXstripT ( int n) const
inlinevirtual

Implements ICgemDigitizerSvc.

Definition at line 71 of file CgemDigitizerSvc.h.

71{return m_xstripT[n];}

Referenced by BesCgemDigitizer::Digitize_v3().

◆ initialize()

StatusCode CgemDigitizerSvc::initialize ( )
virtual

Definition at line 77 of file CgemDigitizerSvc.cxx.

77 {
78 MsgStream log(messageService(), name());
79 log << MSG::INFO << "CgemDigitizerSvc::initialize()" << endreq;
80
81 StatusCode sc = Service::initialize();
82 if( sc.isFailure() ) return sc;
83
84 static IJobOptionsSvc* jobSvc = 0;
85 if ( jobSvc == 0 ) {
86 sc = service("JobOptionsSvc", jobSvc);
87 if ( sc.isFailure() ) {
88 std::cout << "Can't get the JobOptionsSvc @ DistBoss::GetPropertyValue()" << std::endl;
89 return sc;
90 }
91 }
92
93 // const vector<const Property*>* properties = jobSvc->getProperties(client);
94 const vector<const Property*>* properties = jobSvc->getProperties("BesRndmGenSvc");
95 // cout << "client of jobSvc: " << jobSvc->getClients() << endl;
96 if ( properties == NULL ) {
97 std::cout << "In CgemDigitizerSvc::initialize(), can't get client: " << std::endl;
98 return StatusCode::FAILURE;
99 }
100
101 unsigned int randSeed;
102 for ( unsigned int i = 0; i < properties->size(); ++i ) {
103 if ( properties->at(i)->name() == "RndmSeed" ) {
104 cout << "name of property: " << properties->at(i)->name() << endl;
105 string strRnd = properties->at(i)->toString();
106 sscanf(strRnd.c_str(), "%u", &randSeed);
107 cout << "random seed from jobOption: " << randSeed << endl;
108 break;
109 }
110 }
111
112 sc = service("CgemGeomSvc", m_geomSvc); // initial pointer of CgemGeomSvc
113 if(sc != StatusCode::SUCCESS)
114 {
115 log << MSG::ERROR << "can not use CgemGeomSvc" << endreq;
116 return StatusCode::FAILURE;
117 }
118
119 gRandom->SetSeed(randSeed); // set random seed
120
121 cout << "ionModel = " << m_ionModel << endl;
122 if(1 == m_ionModel){
123 m_pIon = new IonizationGar();
124 } else if(2 == m_ionModel){
125 m_pIon = new IonizationGTS();
126 }
127 // m_pIon = new IonizationGar();
128 m_pIon->setDebugging(m_garfDebugging);
129 m_pIon->init(randSeed, m_geomSvc, m_magConfig);
130
131 if ((3==m_driftAvaModel && 3!=m_inductionModel )||(3!=m_driftAvaModel && 3==m_inductionModel )) {
132 cout<<"CgemDigitizerSvc::initialize() Error: DriftAvalancheModel type3 and InductionModel type3 must be used together!"<<endl;
133 return StatusCode::FAILURE;
134 }
135
136 if(1 == m_driftAvaModel){
137 m_pDriftAndAva = new SamplingGar();
138 SamplingGar *pDriftAndAvaGar=(SamplingGar *) m_pDriftAndAva;
139 pDriftAndAvaGar->setGainMultiplier(m_GainMultiplier);
140 pDriftAndAvaGar->setTransMultiplier(m_TransMultiplier);
141 pDriftAndAvaGar->setDiffuMultiplier(m_DiffuMultiplier);
142 } else if(2 == m_driftAvaModel){
143 m_pDriftAndAva = new SamplingGTS();
144 } else if(3 == m_driftAvaModel){
145 m_pDriftAndAva = new SamplingGar2();
146 SamplingGar2* pDriftAndAva=(SamplingGar2*)m_pDriftAndAva;
147 pDriftAndAva->setMultiElectronMapAddr(&m_hitmap);
148
149 // migrate of samGar1;
150 pDriftAndAva->setGainMultiplier(m_GainMultiplier);
151 pDriftAndAva->setTransMultiplier(m_TransMultiplier);
152 pDriftAndAva->setDiffuMultiplier(m_DiffuMultiplier);
153 // migrate of indGar1
154 pDriftAndAva->setNgapsSect(m_Ngaps_microSector);
155 pDriftAndAva->setGapSizeSect(m_gap_microSector);
156 pDriftAndAva->setGapShiftSect(m_gapShift_microSector);
157 pDriftAndAva->setMicroSectorWidthRad(m_microSector_width);
158
159 }
160 m_pDriftAndAva->init(m_geomSvc, m_magConfig);
161 m_pDriftAndAva->setDebugging(m_samplingDebugging);
162
163 if(1 == m_inductionModel){
164 InductionGar* indGar = new InductionGar();
165 indGar->setNgapsSect(m_Ngaps_microSector);
166 indGar->setGapSizeSect(m_gap_microSector);
167 indGar->setGapShiftSect(m_gapShift_microSector);
168 indGar->setMicroSectorWidthRad(m_microSector_width);
169 indGar->setQinGausSigma(m_QinGausSigma);
170 indGar->setScaleSignalX(m_ScaleSignalX);
171 m_pInduction = indGar;
172 //m_pInduction = new InductionGar();
173 m_pInduction->setVsampleDelay(sample_delay);
174 m_pInduction->setLUTFilePath(m_LUTFilePath);
175 m_pInduction->setStoreFlag(m_storeFlag);
176 m_pInduction->setSaturation(m_saturation);
177 } else if(2 == m_inductionModel){
178 m_pInduction = new InductionGTS();
179 //m_pInduction = new InductionGar();
180 }else if (3 == m_inductionModel){
181 m_pInduction = new InductionGar2();
182 InductionGar2* indGar=(InductionGar2*)m_pInduction;
183 indGar->setQinGausSigma(m_QinGausSigma);
184 indGar->setScaleSignalX(m_ScaleSignalX);
185
186 m_pInduction->setVsampleDelay(sample_delay);
187 m_pInduction->setLUTFilePath(m_LUTFilePath);
188 m_pInduction->setStoreFlag(m_storeFlag);
189 m_pInduction->setSaturation(m_saturation);
190 }
191 m_pInduction->init(m_geomSvc, m_magConfig);
192 m_pInduction->setDebugOutput(m_debugInduction);
193
194 // --- check gaps
195 cout<<"CgemDigitizerSvc:"<<endl;
196 cout<<"gapShift_microSector="<<m_gapShift_microSector[0]
197 <<", "<<m_gapShift_microSector[1]
198 <<", "<<m_gapShift_microSector[2]
199 <<", "<<m_gapShift_microSector[3]
200 <<", "<<m_gapShift_microSector[4]
201 <<", "<<m_gapShift_microSector[5]
202 <<endl;
203 cout<<"microSector_width="<<m_microSector_width[0]
204 <<", "<<m_microSector_width[1]
205 <<", "<<m_microSector_width[2]
206 <<", "<<m_microSector_width[3]
207 <<", "<<m_microSector_width[4]
208 <<", "<<m_microSector_width[5]
209 <<endl;
210 cout<<"QinGausSigma="<<m_QinGausSigma[0]
211 <<", "<<m_QinGausSigma[1]
212 <<endl;
213 cout<<"Ngaps_microSector="<<m_Ngaps_microSector<<endl;
214 cout<<"gap_microSector="<<m_gap_microSector<<endl;
215
216 // --- read saturations
217 TFile *LUTFile = TFile::Open(m_LUTFilePath.c_str(),"read");
218 TTree *tree = (TTree*)LUTFile->Get("tree");
219 Float_t QDC_saturation;
220 Int_t layer,sheet,strip_v,strip_x;
221 tree->SetBranchAddress("strip_x_boss", &strip_x);
222 tree->SetBranchAddress("strip_v_boss", &strip_v);
223 tree->SetBranchAddress("layer", &layer);
224 tree->SetBranchAddress("sheet", &sheet);
225 tree->SetBranchAddress("calib_QDC_saturation", &QDC_saturation);
226 for(int i=0;i<tree->GetEntries();i++) {
227 tree->GetEntry(i);
228 if(strip_x!=-1) {
229 Qsaturation[layer][sheet][0][strip_x] = QDC_saturation;
230 }
231 if(strip_v!=-1) {
232 Qsaturation[layer][sheet][1][strip_v] = QDC_saturation;
233 }
234 }
235 for(int i=0;i<832;i++) {
236 Qsaturation[2][0][0][i] = 45.;
237 Qsaturation[2][1][0][i] = 45.;
238 }
239 for(int i=0;i<1395;i++) {
240 Qsaturation[2][0][1][i] = 45.;
241 Qsaturation[2][1][1][i] = 45.;
242 }
243 LUTFile->Close();
244
245 // ntuple
246 if(m_saveNt) {
247 INTupleSvc* ntupleSvc;
248 Gaudi::svcLocator() -> service("NTupleSvc", ntupleSvc);
249 NTuplePtr nt(ntupleSvc, "CgemDigitizerSvcNT/digi");
250 // NTuplePtr nt(ntupleSvc(), "CgemDigitizerSvcNT/digi");
251 if(nt) m_tuple = nt;
252 else{
253 m_tuple = ntupleSvc->book("CgemDigitizerSvcNT/digi", CLID_ColumnWiseTuple, "noise");
254 if(m_tuple){
255 m_tuple->addItem("nIonE", m_ntNIonE);
256 m_tuple->addItem("nMultiE", m_ntNMultiE);
257 m_tuple->addItem("nXstrips", m_ntNxstrips,0,100);
258 m_tuple->addItem("nVstrips", m_ntNvstrips,0,100);
259 m_tuple->addIndexedItem("XstripQ", m_ntNxstrips,m_ntxstripQ);
260 m_tuple->addIndexedItem("XstripT", m_ntNxstrips,m_ntxstripT);
261 m_tuple->addIndexedItem("VstripQ", m_ntNvstrips,m_ntvstripQ);
262 m_tuple->addIndexedItem("VstripT", m_ntNvstrips,m_ntvstripT);
263 m_tuple->addIndexedItem("XstripID", m_ntNxstrips,m_XstripID);
264 m_tuple->addIndexedItem("VstripID", m_ntNvstrips,m_VstripID);
265 }
266 }
267 }
268
269 return StatusCode::SUCCESS;
270}
float Float_t
INTupleSvc * ntupleSvc()
virtual void init(ICgemGeomSvc *geomSvc, double magConfig)=0
virtual void setDebugging(bool debugging)=0
void setQinGausSigma(vector< double > sigma)
void setScaleSignalX(double ScaleSignalX)
void setGapSizeSect(double size)
void setMicroSectorWidthRad(vector< double > width)
void setNgapsSect(int n)
void setScaleSignalX(double ScaleSignalX)
void setQinGausSigma(vector< double > sigma)
void setGapShiftSect(vector< double > shift)
virtual void setStoreFlag(bool flag)=0
virtual void setSaturation(bool flag)=0
virtual void setVsampleDelay(double delay)=0
virtual void setDebugOutput(bool debugOutput)=0
virtual void setLUTFilePath(std::string path)=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
void setTransMultiplier(double TransMultiplier)
void setGapSizeSect(double size)
void setGapShiftSect(vector< double > shift)
void setNgapsSect(int n)
void setGainMultiplier(vector< double > GainMultiplier)
void setDiffuMultiplier(double DiffuMultiplier)
void setMultiElectronMapAddr(HitHistMap *address)
void setMicroSectorWidthRad(vector< double > width)
void setGainMultiplier(vector< double > GainMultiplier)
Definition SamplingGar.h:35
void setDiffuMultiplier(double DiffuMultiplier)
Definition SamplingGar.h:42
void setTransMultiplier(double TransMultiplier)
Definition SamplingGar.h:41

◆ queryInterface()

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

Definition at line 68 of file CgemDigitizerSvc.cxx.

68 {
69 if( IID_ICgemDigitizerSvc.versionMatch(riid) ){
70 *ppvInterface = static_cast<ICgemDigitizerSvc*> (this);
71 } else{
72 return Service::queryInterface(riid, ppvInterface);
73 }
74 return StatusCode::SUCCESS;
75}

◆ setTrack() [1/2]

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

Implements ICgemDigitizerSvc.

Definition at line 282 of file CgemDigitizerSvc.cxx.

282 {
283 vector<int> Vparticle (1,particle);
284 vector<int> Vcharge (1,charge);
285 vector<double> Vp (1,p);
286
287 // awkward way of saying
288 //vector<vector<double> >VtrkPosIn={{trkPosIn[0], trkPosIn[1], trkPosIn[2]}};
289 vector<double> posin;
290 posin.push_back(trkPosIn[0]);
291 posin.push_back(trkPosIn[1]);
292 posin.push_back(trkPosIn[2]);
293 vector<vector<double> > VtrkPosIn;
294 VtrkPosIn.push_back(posin);
295
296 vector<double> posout;
297 posout.push_back(trkPosOut[0]);
298 posout.push_back(trkPosOut[1]);
299 posout.push_back(trkPosOut[2]);
300 vector<vector<double> > VtrkPosOut;
301 VtrkPosOut.push_back(posout);//= {{trkPosOut[0], trkPosOut[1], trkPosOut[2]}};
302
303 StatusCode sc=setTrack(layer,Vparticle, Vcharge, Vp, VtrkPosIn, VtrkPosOut);
304
305 return sc;
306
307 //*******below are original contents of this function.**********
308
309 // //ProcInfo_t info;
310 // //gSystem->GetProcInfo(&info);
311 // //double currentMemory = info.fMemResident/1024;// MB
312 // //cout<<"CgemDigitizerSvc::setTrack() memory 1 "<<currentMemory<<" MB"<<endl;
313 //
314 // double time_spent = 0.;
315 // clock_t begin = clock();
316 // //cout<<"setTrack"<<endl;
317 // clear();
318 // m_layer = layer;
319 //
320 // //cout<<"before m_pIon->setTrack()"<<endl;
321 // //cout<<"set particle "<<particle<<", p="<<p<<endl;
322 // m_pIon->setTrack(particle, charge, p, trkPosIn, trkPosOut);
323 // //cout<<"after m_pIon->setTrack()"<<endl;
324 // //gSystem->GetProcInfo(&info); currentMemory = info.fMemResident/1024; cout<<"CgemDigitizerSvc::setTrack() memory 2 "<<currentMemory<<" MB"<<endl;
325 //
326 // vector<double> ionEx;
327 // vector<double> ionEy;
328 // vector<double> ionEz;
329 // vector<double> ionEt;
330 // int nIonE = m_pIon->getNumberIonE();
331 // for(int i=0; i<nIonE; i++){
332 // ionEx.push_back(m_pIon->getEx(i));
333 // ionEy.push_back(m_pIon->getEy(i));
334 // ionEz.push_back(m_pIon->getEz(i));
335 // ionEt.push_back(m_pIon->getEt(i));
336 // }
337 // //cout<<"after pushing back ionE "<<endl;
338 // if(m_saveNt) m_ntNIonE=nIonE;
339 // clock_t end = clock();
340 // //cout<<" CLOCKS_PER_SEC "<<endl;
341 // //cout<<CLOCKS_PER_SEC<<endl;
342 // //cout<<" calculate time_spent"<<endl;
343 // time_spent += (double)(end - begin) / CLOCKS_PER_SEC;
344 // //cout << "CgemDigitizerSvc::ionization " << time_spent << " seconds" << endl;
345 // // ---------------------------
346 // time_spent = 0.;
347 // begin = clock();
348 //
349 // //gSystem->GetProcInfo(&info); currentMemory = info.fMemResident/1024; cout<<"CgemDigitizerSvc::setTrack() memory 3 "<<currentMemory<<" MB"<<endl;
350 // m_pDriftAndAva->setIonElectrons(layer, nIonE, ionEx, ionEy, ionEz, ionEt);
351 //
352 // m_nMultiE = m_pDriftAndAva->getNelectrons();
353 // //for(int i=0; i<m_nMultiE; i++){
354 // // double x = m_pDriftAndAva->getX(i);
355 // // double y = m_pDriftAndAva->getY(i);
356 // // double z = m_pDriftAndAva->getZ(i);
357 // // double t = m_pDriftAndAva->getT(i);
358 // // (*m_pmultiEx).push_back(x);
359 // // (*m_pmultiEy).push_back(y);
360 // // (*m_pmultiEz).push_back(z);
361 // // (*m_pmultiEt).push_back(t);
362 // //}
363 // m_pmultiEx=& (m_pDriftAndAva->getXContainer());
364 // m_pmultiEy=& (m_pDriftAndAva->getYContainer());
365 // m_pmultiEz=& (m_pDriftAndAva->getZContainer());
366 // m_pmultiEt=& (m_pDriftAndAva->getTContainer());
367 // //std::cout<<m_nMultiE<<"\t";
368 // if(m_saveNt) m_ntNMultiE=m_nMultiE;
369 // end = clock();
370 // time_spent += (double)(end - begin) / CLOCKS_PER_SEC;
371 // //cout << "CgemDigitizerSvc::diffusion " << time_spent << " seconds" << endl;
372 // // --------------------
373 // time_spent = 0.;
374 // begin = clock();
375 //
376 // //gSystem->GetProcInfo(&info); currentMemory = info.fMemResident/1024; cout<<"CgemDigitizerSvc::setTrack() memory 4 "<<currentMemory<<" MB"<<endl;
377 // // Induction process
378 // // positionToStrips();
379 // //cout<<" before m_pInduction->setMultiElectrons "<<endl;
380 // m_pInduction->setMultiElectrons(layer, m_nMultiE, *m_pmultiEx, *m_pmultiEy, *m_pmultiEz, *m_pmultiEt);
381 // //cout<<" after m_pInduction->setMultiElectrons "<<endl;
382 // m_nXstrips = m_pInduction->getNXstrips();
383 // //gSystem->GetProcInfo(&info); currentMemory = info.fMemResident/1024; cout<<"CgemDigitizerSvc::setTrack() memory 5 "<<currentMemory<<" MB"<<endl;
384 // //m_ntNxstrips = m_nXstrips;
385 // //m_ntNvstrips = m_nVstrips;
386 // // cout<<"read data"<<endl;
387 // for(int i=0; i<m_nXstrips; i++){
388 // //m_ntNxstrips=i;
389 // if(m_saveNt && i<100) {
390 // m_ntxstripQ[i]=m_pInduction->getXstripQ(i);
391 // m_ntxstripT[i]=m_pInduction->getXstripT(i);
392 // m_XstripID[i]=m_pInduction->getXstripID(i);
393 // }
394 // m_xstripSheet.push_back(m_pInduction->getXstripSheet(i));
395 // m_xstripID.push_back(m_pInduction->getXstripID(i));
396 // m_xstripQ.push_back(m_pInduction->getXstripQ(i));
397 // m_xstripQ2.push_back(m_pInduction->getXstripQ_Branch(i));
398 // m_xstripT.push_back(m_pInduction->getXstripT(i));
399 // m_xfirstT.push_back(m_pInduction->getXfirstT(i));
400 //
401 // }
402 //
403 // m_nVstrips = m_pInduction->getNVstrips();
404 // for(int i=0; i<m_nVstrips; i++){
405 // //m_ntNvstrips=i;
406 // if(m_saveNt && i<100) {
407 // m_ntvstripQ[i]=m_pInduction->getVstripQ(i);
408 // m_ntvstripT[i]=m_pInduction->getVstripT(i);
409 // m_VstripID[i]=m_pInduction->getVstripID(i);
410 // }
411 // m_vstripSheet.push_back(m_pInduction->getVstripSheet(i));
412 // m_vstripID.push_back(m_pInduction->getVstripID(i));
413 // m_vstripQ.push_back(m_pInduction->getVstripQ(i));
414 // m_vstripQ2.push_back(m_pInduction->getVstripQ_Branch(i));
415 // m_vstripT.push_back(m_pInduction->getVstripT(i));
416 // m_vfirstT.push_back(m_pInduction->getVfirstT(i));
417 // }
418 // end = clock();
419 // time_spent += (double)(end - begin) / CLOCKS_PER_SEC;
420 // // cout << "CgemDigitizerSvc::induction " << time_spent << " seconds" << endl;
421 // // cout << "nXstrips = " << m_nXstrips << " , m_nVstrips = " << m_nVstrips << endl;
422 // // ---------------
423 // time_spent = 0.;
424 // begin = clock();
425 //
426 // if(m_saveNt) {
427 // //m_ntNIonE = nIonE;
428 // //m_ntNMultiE = m_nMultiE;
429 // m_ntNxstrips = m_nXstrips;
430 // m_ntNvstrips = m_nVstrips;
431 // m_tuple->write();
432 // }
433 //
434 // end = clock();
435 // time_spent += (double)(end - begin) / CLOCKS_PER_SEC;
436 // //cout << "CgemDigitizerSvc::write " << time_spent << " seconds" << endl;
437 //
438 // //std::cout<<"wow test2!\t";
439 // //checkMemorySize();
440 // //gSystem->GetProcInfo(&info);
441 // //double currentMemory2 = info.fMemResident/1024;// MB
442 // //cout<<"CgemDigitizerSvc::setTrack() memory from "<<currentMemory<<" to "<<currentMemory2<<" MB"<<endl;
443 //
444 // return StatusCode::SUCCESS;
445}
StatusCode setTrack(int layer, int particle, int charge, double p, double trkPosIn[], double trkPosOut[])

Referenced by BesCgemDigitizer::Digitize_v3(), and setTrack().

◆ setTrack() [2/2]

StatusCode CgemDigitizerSvc::setTrack ( int layer,
std::vector< int > particle,
std::vector< int > charge,
std::vector< double > p,
std::vector< vector< double > > trkPosIn,
std::vector< vector< double > > trkPosOut )
virtual

Implements ICgemDigitizerSvc.

Definition at line 447 of file CgemDigitizerSvc.cxx.

447 {
448
449 //ProcInfo_t info;
450 //gSystem->GetProcInfo(&info);
451 //double currentMemory = info.fMemResident/1024;// MB
452 //cout<<"CgemDigitizerSvc::setTrack() memory 1 "<<currentMemory<<" MB"<<endl;
453
454 double time_spent = 0.;
455 clock_t begin = clock();
456 int nTotIonE = 0;
457 //cout<<"setTrack"<<endl;
458 clear();
459 m_layer = layer;
460 vector<double> ionEx;
461 vector<double> ionEy;
462 vector<double> ionEz;
463 vector<double> ionEt;
464 for(unsigned TrackSeg=0;TrackSeg<particle.size();TrackSeg++){
465
466 double SegTrkPosIn[3];
467 double SegTrkPosOut[3];
468 for(int i=0;i<3;i++){
469 SegTrkPosIn[i]=trkPosIn[TrackSeg][i];
470 SegTrkPosOut[i]=trkPosOut[TrackSeg][i];
471 }
472 //cout<<"trrpos "<<SegTrkPosIn[0]<<" "<<SegTrkPosIn[1]<<" "<<SegTrkPosIn[2]<<" "<<SegTrkPosOut[0]<<" "<<SegTrkPosOut[1]<<" "<<SegTrkPosOut[2]<<endl;
473 m_pIon->setTrack(particle[TrackSeg], charge[TrackSeg], p[TrackSeg], SegTrkPosIn, SegTrkPosOut);
474
475 int nIonE = m_pIon->getNumberIonE();
476 nTotIonE=nIonE+nTotIonE;
477 for(int i=0; i<nIonE; i++){
478 ionEx.push_back(m_pIon->getEx(i));
479 ionEy.push_back(m_pIon->getEy(i));
480 ionEz.push_back(m_pIon->getEz(i));
481 ionEt.push_back(m_pIon->getEt(i));
482 }
483 }
484 //cout<<"after pushing back ionE "<<endl;
485 if(m_saveNt) m_ntNIonE=nTotIonE;
486 clock_t end = clock();
487 time_spent += (double)(end - begin) / CLOCKS_PER_SEC;
488 //cout << "CgemDigitizerSvc::ionization " << time_spent << " seconds" << endl;
489 // ---------------------------
490 time_spent = 0.;
491
492
493 if (m_driftAvaModel !=3){
494 begin = clock();
495 m_pDriftAndAva->setIonElectrons(layer, nTotIonE, ionEx, ionEy, ionEz, ionEt);
496
497 m_nMultiE = m_pDriftAndAva->getNelectrons();
498 //for(int i=0; i<m_nMultiE; i++){
499 // double x = m_pDriftAndAva->getX(i);
500 // double y = m_pDriftAndAva->getY(i);
501 // double z = m_pDriftAndAva->getZ(i);
502 // double t = m_pDriftAndAva->getT(i);
503 // (*m_pmultiEx).push_back(x);
504 // (*m_pmultiEy).push_back(y);
505 // (*m_pmultiEz).push_back(z);
506 // (*m_pmultiEt).push_back(t);
507 //}
508 m_pmultiEx=& (m_pDriftAndAva->getXContainer());
509 m_pmultiEy=& (m_pDriftAndAva->getYContainer());
510 m_pmultiEz=& (m_pDriftAndAva->getZContainer());
511 m_pmultiEt=& (m_pDriftAndAva->getTContainer());
512
513 if(m_saveNt) {
514 m_ntNMultiE=m_nMultiE;
515 }
516 end = clock();
517 time_spent += (double)(end - begin) / CLOCKS_PER_SEC;
518 //cout << "CgemDigitizerSvc::diffusion " << time_spent << " seconds" << endl;
519 // --------------------
520 time_spent = 0.;
521 begin = clock();
522
523 // Induction process
524 // positionToStrips();
525 // cout << "nXstrips = " << m_nXstrips << " , m_nVstrips = " << m_nVstrips << endl;
526 m_pInduction->setMultiElectrons(layer, m_nMultiE, *m_pmultiEx, *m_pmultiEy, *m_pmultiEz, *m_pmultiEt);
527
528 }
529 else{ //m_driftAvaModel ==3
530 SamplingGar2 *pSampling2=(SamplingGar2 *) m_pDriftAndAva;
531 InductionGar2 *pInduction2=(InductionGar2 *) m_pInduction;
532
533 pSampling2->setIonElectrons(layer, nTotIonE, ionEx, ionEy, ionEz, ionEt);
534 //yields m_hitmap
535 // as test;
536 end = clock();
537 time_spent += (double)(end - begin) / CLOCKS_PER_SEC;
538
539 // cout << "CgemDigitizerSvc::diffusion " << time_spent << " seconds" << endl;
540 // --------------------
541 m_nMultiE = m_pDriftAndAva->getNelectrons();
542
543 time_spent = 0.;
544 begin = clock();
545 if(m_saveNt) {
546 m_ntNMultiE=m_nMultiE;
547 }
548
549 InductionGar2::PVectorXYZT vMultiElectrons;
550 vMultiElectrons.x=& (m_pDriftAndAva->getXContainer());
551 vMultiElectrons.y=& (m_pDriftAndAva->getYContainer());
552 vMultiElectrons.z=& (m_pDriftAndAva->getZContainer());
553 vMultiElectrons.t=& (m_pDriftAndAva->getTContainer());
554 InductionGar2::PVectorXYZT *pMultiElectronsInfo=&vMultiElectrons;
555 if (!m_samplingDebugging){
556 pMultiElectronsInfo=0;
557 }
558 pInduction2->setMultiElectrons(layer, m_hitmap,pMultiElectronsInfo);
559
560 }
561 m_nXstrips = m_pInduction->getNXstrips();
562
563 for(int i=0; i<m_nXstrips; i++){
564 // m_ntNxstrips=i;
565 if(m_saveNt && i<100) {
566 m_ntxstripQ[i]=m_pInduction->getXstripQ(i);
567 m_ntxstripT[i]=m_pInduction->getXstripT(i);
568 m_XstripID[i]=m_pInduction->getXstripID(i);
569 }
570 m_xstripSheet.push_back(m_pInduction->getXstripSheet(i));
571 m_xstripID.push_back(m_pInduction->getXstripID(i));
572 m_xstripQ.push_back(m_pInduction->getXstripQ(i));
573 m_xstripQ2.push_back(m_pInduction->getXstripQ_Branch(i));
574 m_xstripT.push_back(m_pInduction->getXstripT(i));
575 m_xfirstT.push_back(m_pInduction->getXfirstT(i));
576
577
578 }
579
580 m_nVstrips = m_pInduction->getNVstrips();
581 for(int i=0; i<m_nVstrips; i++){
582 // m_ntNvstrips=i;
583 if(m_saveNt && i<100) {
584 m_ntvstripQ[i]=m_pInduction->getVstripQ(i);
585 m_ntvstripT[i]=m_pInduction->getVstripT(i);
586 m_VstripID[i]=m_pInduction->getVstripID(i);
587 }
588 m_vstripSheet.push_back(m_pInduction->getVstripSheet(i));
589 m_vstripID.push_back(m_pInduction->getVstripID(i));
590 m_vstripQ.push_back(m_pInduction->getVstripQ(i));
591 m_vstripQ2.push_back(m_pInduction->getVstripQ_Branch(i));
592 m_vstripT.push_back(m_pInduction->getVstripT(i));
593 m_vfirstT.push_back(m_pInduction->getVfirstT(i));
594 }
595 end = clock();
596
597
598 //cout<<"read finish"<<endl;
599
600 time_spent += (double)(end - begin) / CLOCKS_PER_SEC;
601 //cout << "CgemDigitizerSvc::induction " << time_spent << " seconds" << endl;
602 //cout<< "CgemDigitizerSvc multiplied electrons " << m_nMultiE << endl;
603 // ---------------
604 time_spent = 0.;
605 begin = clock();
606
607 if(m_saveNt) {
608 //m_ntNIonE = nIonE;
609 //m_ntNMultiE = m_nMultiE;
610 m_ntNxstrips = m_nXstrips;
611 m_ntNvstrips = m_nVstrips;
612 m_tuple->write();
613 }
614
615 end = clock();
616 time_spent += (double)(end - begin) / CLOCKS_PER_SEC;
617 // cout << "CgemDigitizerSvc::write " << time_spent << " seconds" << endl;
618 //checkMemorySize();
619
620 return StatusCode::SUCCESS;
621}
virtual const std::vector< Float_t > & getXContainer() const =0
virtual const std::vector< Float_t > & getYContainer() 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 const std::vector< Float_t > & getZContainer() const =0
virtual int getNelectrons() const =0
virtual const std::vector< Float_t > & getTContainer() const =0
void setMultiElectrons(int layer, int nElectrons, const std::vector< Float_t > &x, const std::vector< Float_t > &y, const std::vector< Float_t > &z, const std::vector< Float_t > &t)
virtual double getXstripT(int n) const =0
virtual double getXfirstT(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 getXstripQ_Branch(int n) const =0
virtual double getVstripQ(int n) const =0
virtual int getXstripSheet(int n) const =0
virtual double getVfirstT(int n) const =0
virtual void setMultiElectrons(int layer, int nElectrons, const std::vector< Float_t > &x, const std::vector< Float_t > &y, const std::vector< Float_t > &z, const std::vector< Float_t > &t)=0
virtual double getXstripQ(int n) const =0
virtual double getVstripQ_Branch(int n) const =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
void setIonElectrons(int layer, int nElectrons, std::vector< double > x, std::vector< double > y, std::vector< double > z, std::vector< double > t)
const std::vector< Float_t > * z
const std::vector< Float_t > * t
const std::vector< Float_t > * x
const std::vector< Float_t > * y

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