13 #include <diginitialize.h>
25 #include <TClonesArray.h>
38 : TNamed("DIG Initialize","Initialize")
49 DIGInitialize::DIGInitialize(
const char *name,
const char *title, TString aCP, TString aCFN, TString action) : TNamed(name,title)
55 SetConfigPathAndFileName(aCP,aCFN);
56 printf(
" Reading Setup from %s\n", fConfigPathAndFileName.Data());
58 fConfigFileStream.open(fConfigPathAndFileName);
59 Bool_t answer=fConfigFileStream.fail();
61 cout <<
"enter correct file name \n";
62 cin >> fConfigFileName;
63 fConfigPathAndFileName = fConfigPath + fConfigFileName;
64 printf(
" Reading Setup from %s\n", fConfigPathAndFileName.Data());
65 fConfigFileStream.open(fConfigPathAndFileName);
66 answer=fConfigFileStream.fail();
89 ActionParameter.Doit[action.Sizeof()]=0;
92 memcpy(ActionParameter.Doit,temp.c_str() ,action.Sizeof());
97 fConfigFileStream >> c;
98 if ((c !=
'"') && (k < ActionParameter.actionnum)) {
99 ActionParameter.Model[k] = c;
111 read_item(BeamParameter.RunNumber);
112 read_item(BeamParameter.NumberOfEvents);
113 read_item(BeamParameter.BeamOption);
114 read_item(BeamParameter.ParticleDensity);
116 read_item(BeamParameter.NAngles);
118 for (Int_t j = 0; j < BeamParameter.NAngles; j++) {
119 fConfigFileStream >> BeamParameter.ThetaIncidentDeg[j];
122 for (Int_t j = 0; j < BeamParameter.NAngles; j++) {
123 fConfigFileStream >> BeamParameter.PhiIncidentDeg[j];
131 read_item(PlaneParameter.NGeom);
134 for (Int_t j = 0; j < PlaneParameter.NGeom; j++) {
135 fConfigFileStream >> PlaneParameter.PitchX[j];
139 for (Int_t j = 0; j < PlaneParameter.NGeom; j++) {
140 fConfigFileStream >> PlaneParameter.PitchY[j];
144 for (Int_t j = 0; j < PlaneParameter.NGeom; j++) {
145 fConfigFileStream >> PlaneParameter.NoiseElectrons[j];
149 for (Int_t j = 0; j < PlaneParameter.NGeom; j++) {
150 fConfigFileStream >> PlaneParameter.EpitaxialThickness[j];
154 read_item(PlaneParameter.NPixelsX);
155 read_item(PlaneParameter.NPixelsY);
157 read_item(PlaneParameter.NTemperature);
160 for (Int_t j = 0; j < PlaneParameter.NTemperature; j++) {
161 fConfigFileStream >> PlaneParameter.Temperature[j];
164 read_item(PlaneParameter.IonizationEnergy);
165 read_item(PlaneParameter.SegmentSize);
166 read_item(PlaneParameter.MaximumSegmentSize);
167 read_item(PlaneParameter.MaximumChargePerSegment);
168 read_item(PlaneParameter.DiffusionMaximumRangeInX);
169 read_item(PlaneParameter.DiffusionMaximumRangeInY);
170 read_item(PlaneParameter.ReflexionCoefficient);
171 read_item(PlaneParameter.BasicModel_SigmaTenMicrons);
177 read_item(PlaneParameter.NTransport);
178 pTransportParameter =
new TransportParameter_t[PlaneParameter.NTransport];
181 for (Int_t p = 0; p < PlaneParameter.NTransport; p++) {
182 read_item(pTransportParameter[p].ChargeModel);
183 read_item(pTransportParameter[p].RangeLimit_InPitchUnit);
184 if(pTransportParameter[p].ChargeModel==1){
185 read_item(pTransportParameter[p].Lorentz2DModel_Cp0);
186 read_item(pTransportParameter[p].Lorentz2DModel_Cp1);
188 if(pTransportParameter[p].ChargeModel==2){
189 read_item(pTransportParameter[p].Gauss2DModel_sigma1_Cp0);
190 read_item(pTransportParameter[p].Gauss2DModel_sigma1_Cp1);
191 read_item(pTransportParameter[p].Gauss2DModel_sigma2_Cp0);
192 read_item(pTransportParameter[p].Gauss2DModel_sigma2_Cp1);
193 read_item(pTransportParameter[p].Gauss2DModel_weight);
195 if(pTransportParameter[p].ChargeModel==3){
196 read_item(pTransportParameter[p].LorGaussModel_Norm1_Cp0);
197 read_item(pTransportParameter[p].LorGaussModel_Norm1_Cp1);
198 read_item(pTransportParameter[p].LorGaussModel_Norm1_Cp2);
199 read_item(pTransportParameter[p].LorGaussModel_sigma_Cp0);
200 read_item(pTransportParameter[p].LorGaussModel_sigma_Cp1);
201 read_item(pTransportParameter[p].LorGaussModel_C_Cp0);
202 read_item(pTransportParameter[p].LorGaussModel_C_Cp1);
203 read_item(pTransportParameter[p].LorGaussModel_Norm_Cp0);
204 read_item(pTransportParameter[p].LorGaussModel_Norm_Cp1);
206 if(pTransportParameter[p].ChargeModel==4){
207 read_item(pTransportParameter[p].lorlorgausModel_Norm1_Cp0) ;
208 read_item(pTransportParameter[p].lorlorgausModel_Norm1_Cp1) ;
209 read_item(pTransportParameter[p].lorlorgausModel_x01_Cp0) ;
210 read_item(pTransportParameter[p].lorlorgausModel_x01_Cp1) ;
211 read_item(pTransportParameter[p].lorlorgausModel_sigmax1_Cp0) ;
212 read_item(pTransportParameter[p].lorlorgausModel_sigmax1_Cp1) ;
213 read_item(pTransportParameter[p].lorlorgausModel_y01_Cp0) ;
214 read_item(pTransportParameter[p].lorlorgausModel_y01_Cp1) ;
215 read_item(pTransportParameter[p].lorlorgausModel_sigmay1_Cp0) ;
216 read_item(pTransportParameter[p].lorlorgausModel_sigmay1_Cp1) ;
217 read_item(pTransportParameter[p].lorlorgausModel_Gamma_Cp0) ;
218 read_item(pTransportParameter[p].lorlorgausModel_Gamma_Cp1) ;
219 read_item(pTransportParameter[p].lorlorgausModel_x0_Cp0) ;
220 read_item(pTransportParameter[p].lorlorgausModel_x0_Cp1) ;
221 read_item(pTransportParameter[p].lorlorgausModel_y0_Cp0) ;
222 read_item(pTransportParameter[p].lorlorgausModel_y0_Cp1) ;
223 read_item(pTransportParameter[p].lorlorgausModel_norm_Cp0) ;
224 read_item(pTransportParameter[p].lorlorgausModel_norm_Cp1) ;
225 read_item(pTransportParameter[p].lorlorgausModel_normgaus2_Cp0) ;
226 read_item(pTransportParameter[p].lorlorgausModel_normgaus2_Cp1) ;
227 read_item(pTransportParameter[p].lorlorgausModel_sigma2_Cp0) ;
228 read_item(pTransportParameter[p].lorlorgausModel_sigma2_Cp1) ;
230 if(pTransportParameter[p].ChargeModel==5){
231 read_item(pTransportParameter[p].l1dimgauslor_Norm_g_1st);
232 read_item(pTransportParameter[p].l1dimgauslor_x0_g_1st);
233 read_item(pTransportParameter[p].l1dimgauslor_sigma_g_1st);
234 read_item(pTransportParameter[p].l1dimgauslor_Gamma_lor_1st);
235 read_item(pTransportParameter[p].l1dimgauslor_x0_lor_1st);
236 read_item(pTransportParameter[p].l1dimgauslor_norm_lor_1st);
237 read_item(pTransportParameter[p].l1dimgauslor_Norm_g_2nd);
238 read_item(pTransportParameter[p].l1dimgauslor_x0_g_2nd);
239 read_item(pTransportParameter[p].l1dimgauslor_sigma_g_2nd);
240 read_item(pTransportParameter[p].l1dimgauslor_Gamma_lor_2nd);
241 read_item(pTransportParameter[p].l1dimgauslor_x0_lor_2nd);
242 read_item(pTransportParameter[p].l1dimgauslor_norm_lor_2nd);
249 read_item(PlaneParameter.NADC);
250 pADCParameter =
new ADCParameter_t[PlaneParameter.NADC];
253 for (Int_t p = 0; p < PlaneParameter.NADC; p++) {
255 read_item(pADCParameter[p].Nbits);
257 pADCParameter[p].NThresholds = int(TMath::Power(2.0,pADCParameter[p].Nbits) - 1);
258 read_item(pADCParameter[p].ADC_linear);
259 if(pADCParameter[p].ADC_linear){
260 read_item(pADCParameter[p].LSB);
261 read_item(pADCParameter[p].Electron_Conversion);
263 for (Int_t j = 0; j < pADCParameter[p].NThresholds; j++) {
264 pADCParameter[p].ADC_thresholds[j] = pADCParameter[p].LSB+float(j)* (pADCParameter[p].Electron_Conversion);
270 for (Int_t j = 0; j < pADCParameter[p].NThresholds; j++) {
271 fConfigFileStream >> pADCParameter[p].ADC_thresholds[j];
273 pADCParameter[p].LSB=pADCParameter[p].ADC_thresholds[0];
274 pADCParameter[p].Electron_Conversion = -999;
293 DIGInitialize::~DIGInitialize() {
303 void DIGInitialize::SetConfigPath(TString aCP)
311 void DIGInitialize::SetConfigFileName(TString aCFN)
313 fConfigFileName = aCFN;
318 void DIGInitialize::SetConfigPathAndFileName()
320 fConfigPathAndFileName = fConfigPath + fConfigFileName;
325 void DIGInitialize::SetConfigPathAndFileName(TString aCP,TString aCFN)
328 fConfigFileName = aCFN;
329 fConfigPathAndFileName = fConfigPath + fConfigFileName;
333 TString DIGInitialize::GetConfigPath()
339 TString DIGInitialize::GetConfigFileName()
341 return fConfigFileName;
345 TString DIGInitialize::GetConfigPathAndFileName()
347 return fConfigPathAndFileName;
352 void DIGInitialize::PrintInfo() {
354 std::cout<<
"------------------------------------------- "<<endl;
355 std::cout<<
"---------Action configuration------------- "<<endl;
356 std::cout<<
"------------------------------------------- "<<endl;
357 std::cout<<
" Action: "<<ActionParameter.Doit <<endl;
359 std::cout<<
" Model: "<<ActionParameter.Model << endl;
361 std::cout<<
"------------------------------------------- "<<endl;
362 std::cout<<
"---------General configuration------------- "<<endl;
363 std::cout<<
"------------------------------------------- "<<endl;
364 std::cout<<
"-- RunNumber: "<<BeamParameter.RunNumber<<endl;
365 std::cout<<
"-- NumberOfEvents: "<<BeamParameter.NumberOfEvents<<endl;
366 std::cout<<
"-- BeamOption: "<<BeamParameter.BeamOption<<endl;
367 std::cout<<
"-- ParticleDensity: "<<BeamParameter.ParticleDensity<<endl;
368 std::cout<<
"--Number of different Angles: "<<BeamParameter.NAngles<<endl;
369 for (Int_t j = 0; j < BeamParameter.NAngles; j++) {
370 std::cout<<
" Theta(deg): "<<BeamParameter.ThetaIncidentDeg[j]<<
" Phi(deg): "<<BeamParameter.PhiIncidentDeg[j]<<endl;
373 std::cout<<
"------------------------------------------- "<<endl;
374 std::cout<<
"----------Plane configuration-------------- "<<endl;
375 std::cout<<
"------------------------------------------- "<<endl;
376 std::cout<<
"--Number of different Geometries: "<<PlaneParameter.NGeom<<endl;
377 for (Int_t j = 0; j < PlaneParameter.NGeom ; j++) {
378 std::cout<<
" PitchX: "<<PlaneParameter.PitchX[j]<<
" PitchY: "<<PlaneParameter.PitchY[j]<<endl;
379 std::cout<<
" Epitaxial_thickness: "<<PlaneParameter.EpitaxialThickness[j]<<endl;
380 std::cout<<
" Noise: "<<PlaneParameter.NoiseElectrons[j]<<endl;
383 std::cout<<
"--Number pixels in X and Y: "<<PlaneParameter.NPixelsX<<
" x "<<PlaneParameter.NPixelsY<<endl;
385 std::cout<<
"--Number different temperatures "<<PlaneParameter.NTemperature<<endl;
386 for (Int_t j = 0; j < PlaneParameter.NTemperature; j++) {
387 std::cout<<
" Temperature: "<<PlaneParameter.Temperature[j]<<endl;
389 std::cout<<
"--IonizationEnergy "<< PlaneParameter.IonizationEnergy<<endl;
390 std::cout<<
"--SegmentSize "<<PlaneParameter.SegmentSize<<endl;
391 std::cout<<
"--MaximumSegmentSize "<<PlaneParameter.MaximumSegmentSize<<endl;
392 std::cout<<
"--MaximumChargePerSegment "<<PlaneParameter.MaximumChargePerSegment<<endl;
393 std::cout<<
"--DiffusionMaximumRangeInX "<<PlaneParameter.DiffusionMaximumRangeInX<<endl;
394 std::cout<<
"--DiffusionMaximumRangeInY "<<PlaneParameter.DiffusionMaximumRangeInY<<endl;
395 std::cout<<
"--ReflexionCoefficient "<<PlaneParameter.ReflexionCoefficient<<endl;
396 std::cout<<
"--BasicModel_SigmaTenMicrons "<<PlaneParameter.BasicModel_SigmaTenMicrons<<endl;
397 std::cout<<
"------------------------------------------- "<<endl;
398 std::cout<<
"----------Transport configuration-------------- "<<endl;
399 std::cout<<
"------------------------------------------- "<<endl;
400 std::cout<<
"-- Number of Transport models = "<<PlaneParameter.NTransport<<endl;
401 for (Int_t p = 0; p < PlaneParameter.NTransport; p++) {
402 std::cout<<
"-> Transport Model number "<<p<<endl;
403 std::cout<<
"--ChargeModel "<<pTransportParameter[p].ChargeModel<<endl;
404 std::cout<<
"--RangeLimit_InPitchUnit "<<pTransportParameter[p].RangeLimit_InPitchUnit<<endl;
405 if(pTransportParameter[p].ChargeModel==1){
406 std::cout<<
"--Lorentz2DModel_Cp0 "<<pTransportParameter[p].Lorentz2DModel_Cp0<<endl;
407 std::cout<<
"--Lorentz2DModel_Cp1 "<<pTransportParameter[p].Lorentz2DModel_Cp1<<endl;
409 if(pTransportParameter[p].ChargeModel==2){
410 std::cout<<
"--Gauss2DModel_sigma1_Cp0 "<<pTransportParameter[p].Gauss2DModel_sigma1_Cp0<<endl;
411 std::cout<<
"--Gauss2DModel_sigma1_Cp1 "<<pTransportParameter[p].Gauss2DModel_sigma1_Cp1<<endl;
412 std::cout<<
"--Gauss2DModel_sigma2_Cp0 "<<pTransportParameter[p].Gauss2DModel_sigma2_Cp0<<endl;
413 std::cout<<
"--Gauss2DModel_sigma2_Cp1 "<<pTransportParameter[p].Gauss2DModel_sigma2_Cp1<<endl;
414 std::cout<<
"--Gauss2DModel_weight "<<pTransportParameter[p].Gauss2DModel_weight<<endl;
416 if(pTransportParameter[p].ChargeModel==3){
417 std::cout<<
"--LorGaussModel_Norm1_Cp0 "<<pTransportParameter[p].LorGaussModel_Norm1_Cp0<<endl;
418 std::cout<<
"--LorGaussModel_Norm1_Cp1 "<<pTransportParameter[p].LorGaussModel_Norm1_Cp1<<endl;
419 std::cout<<
"--LorGaussModel_Norm1_Cp2 "<<pTransportParameter[p].LorGaussModel_Norm1_Cp2<<endl;
420 std::cout<<
"--LorGaussModel_sigma_Cp0 "<<pTransportParameter[p].LorGaussModel_sigma_Cp0<<endl;
421 std::cout<<
"--LorGaussModel_sigma_Cp1 "<<pTransportParameter[p].LorGaussModel_sigma_Cp1<<endl;
422 std::cout<<
"--LorGaussModel_C_Cp0 "<<pTransportParameter[p].LorGaussModel_C_Cp0<<endl;
423 std::cout<<
"--LorGaussModel_C_Cp1 "<<pTransportParameter[p].LorGaussModel_C_Cp1<<endl;
424 std::cout<<
"--LorGaussModel_Norm_Cp0 "<<pTransportParameter[p].LorGaussModel_Norm_Cp0<<endl;
425 std::cout<<
"--LorGaussModel_Norm_Cp1 "<<pTransportParameter[p].LorGaussModel_Norm_Cp1<<endl;
427 if(pTransportParameter[p].ChargeModel==4){
428 std::cout<<
"--lorlorgausModel_Norm1_Cp0 "<<pTransportParameter[p].lorlorgausModel_Norm1_Cp0<<endl;
429 std::cout<<
"--lorlorgausModel_Norm1_Cp1 "<<pTransportParameter[p].lorlorgausModel_Norm1_Cp1<<endl;
430 std::cout<<
"--lorlorgausModel_x01_Cp0 "<<pTransportParameter[p].lorlorgausModel_x01_Cp0<<endl;
431 std::cout<<
"--lorlorgausModel_x01_Cp1 "<<pTransportParameter[p].lorlorgausModel_x01_Cp1<<endl;
432 std::cout<<
"--lorlorgausModel_sigmax1_Cp0 "<<pTransportParameter[p].lorlorgausModel_sigmax1_Cp0<<endl;
433 std::cout<<
"--lorlorgausModel_sigmax1_Cp1 "<<pTransportParameter[p].lorlorgausModel_sigmax1_Cp1<<endl;
434 std::cout<<
"--lorlorgausModel_y01_Cp0 "<<pTransportParameter[p].lorlorgausModel_y01_Cp0<<endl;
435 std::cout<<
"--lorlorgausModel_y01_Cp1 "<<pTransportParameter[p].lorlorgausModel_y01_Cp1<<endl;
436 std::cout<<
"--lorlorgausModel_sigmay1_Cp0 "<<pTransportParameter[p].lorlorgausModel_sigmay1_Cp0<<endl;
437 std::cout<<
"--lorlorgausModel_sigmay1_Cp1 "<<pTransportParameter[p].lorlorgausModel_sigmay1_Cp1<<endl;
438 std::cout<<
"--lorlorgausModel_Gamma_Cp0 "<<pTransportParameter[p].lorlorgausModel_Gamma_Cp0<<endl;
439 std::cout<<
"--lorlorgausModel_Gamma_Cp1 "<<pTransportParameter[p].lorlorgausModel_Gamma_Cp1<<endl;
440 std::cout<<
"--lorlorgausModel_x0_Cp0 "<<pTransportParameter[p].lorlorgausModel_x0_Cp0<<endl;
441 std::cout<<
"--lorlorgausModel_x0_Cp1 "<<pTransportParameter[p].lorlorgausModel_x0_Cp1<<endl;
442 std::cout<<
"--lorlorgausModel_y0_Cp0 "<<pTransportParameter[p].lorlorgausModel_y0_Cp0<<endl;
443 std::cout<<
"--lorlorgausModel_y0_Cp1 "<<pTransportParameter[p].lorlorgausModel_y0_Cp1<<endl;
444 std::cout<<
"--lorlorgausModel_norm_Cp0 "<<pTransportParameter[p].lorlorgausModel_norm_Cp0<<endl;
445 std::cout<<
"--lorlorgausModel_norm_Cp1 "<<pTransportParameter[p].lorlorgausModel_norm_Cp1<<endl;
446 std::cout<<
"--lorlorgausModel_normgaus2_Cp0 "<<pTransportParameter[p].lorlorgausModel_normgaus2_Cp0<<endl;
447 std::cout<<
"--lorlorgausModel_normgaus2_Cp1 "<<pTransportParameter[p].lorlorgausModel_normgaus2_Cp1<<endl;
448 std::cout<<
"--lorlorgausModel_sigma2_Cp0 "<<pTransportParameter[p].lorlorgausModel_sigma2_Cp0<<endl;
449 std::cout<<
"--lorlorgausModel_sigma2_Cp1 "<<pTransportParameter[p].lorlorgausModel_sigma2_Cp1<<endl;
451 if(pTransportParameter[p].ChargeModel==5){
452 std::cout<<
"--l1dimgauslor_Norm_g_1st "<<pTransportParameter[p].l1dimgauslor_Norm_g_1st<<endl;
453 std::cout<<
"--l1dimgauslor_x0_g_1st "<<pTransportParameter[p].l1dimgauslor_x0_g_1st<<endl;
454 std::cout<<
"--l1dimgauslor_sigma_g_1st "<<pTransportParameter[p].l1dimgauslor_sigma_g_1st<<endl;
455 std::cout<<
"--l1dimgauslor_Gamma_lor_1st "<<pTransportParameter[p].l1dimgauslor_Gamma_lor_1st<<endl;
456 std::cout<<
"--l1dimgauslor_x0_lor_1st "<<pTransportParameter[p].l1dimgauslor_x0_lor_1st<<endl;
457 std::cout<<
"--l1dimgauslor_norm_lor_1st "<<pTransportParameter[p].l1dimgauslor_norm_lor_1st<<endl;
458 std::cout<<
"--l1dimgauslor_Norm_g_2nd "<<pTransportParameter[p].l1dimgauslor_Norm_g_2nd<<endl;
459 std::cout<<
"--l1dimgauslor_x0_g_2nd "<<pTransportParameter[p].l1dimgauslor_x0_g_2nd<<endl;
460 std::cout<<
"--l1dimgauslor_sigma_g_2nd "<<pTransportParameter[p].l1dimgauslor_sigma_g_2nd<<endl;
461 std::cout<<
"--l1dimgauslor_Gamma_lor_2nd "<<pTransportParameter[p].l1dimgauslor_Gamma_lor_2nd<<endl;
462 std::cout<<
"--l1dimgauslor_x0_lor_2nd "<<pTransportParameter[p].l1dimgauslor_x0_lor_2nd<<endl;
463 std::cout<<
"--l1dimgauslor_norm_lor_2nd "<<pTransportParameter[p].l1dimgauslor_norm_lor_2nd<<endl;
466 std::cout<<
"------------------------------------------- "<<endl;
467 std::cout<<
"-----------ADC configuration--------------- "<<endl;
468 std::cout<<
"------------------------------------------- "<<endl;
469 std::cout<<
"-- Number of ADCs = "<<PlaneParameter.NADC<<endl;
470 for (Int_t p = 0; p < PlaneParameter.NADC; p++) {
471 std::cout<<
"-> ADC "<<p<<endl;
472 std::cout<<
"Nbits= "<<pADCParameter[p].Nbits<<
"; ADC_linear="<<pADCParameter[p].ADC_linear<<endl;
473 std::cout<<
"NThresholds= "<<pADCParameter[p].NThresholds<<
"; LSB= "<<pADCParameter[p].LSB <<endl;
474 std::cout<<
"Electron_Conversion= "<<pADCParameter[p].Electron_Conversion<<endl;
475 Int_t Nthtoprint = pADCParameter[p].NThresholds;
477 for (Int_t j = 0; j < pADCParameter[p].NThresholds; j++) {
478 std::cout<<
"thresholds["<<j<<
"]="<<pADCParameter[p].ADC_thresholds[j]<<endl;
482 for (Int_t j = 0; j < Nthtoprint; j++) {
483 std::cout<<
"thresholds["<<j<<
"]="<<pADCParameter[p].ADC_thresholds[j]<<endl;
485 std::cout<<
" etc. "<<endl;
489 std::cout<<
"------------------------------------------- "<<endl;
490 std::cout<<
"------------------------------------------- "<<endl;
491 std::cout<<
"------------------------------------------- "<<endl;
493 std::cout<<
" "<<endl;
494 std::cout<<
"------------------------------------------- "<<endl;
495 std::cout<<
"----------END OF READ OUT FILE------------- "<<endl;
496 std::cout<<
"------------------------------------------- "<<endl;
501 void DIGInitialize::nextItem(Char_t delimiter)
505 fConfigFileStream >> c;
506 }
while (c != delimiter);
512 void DIGInitialize::read_item(Int_t &arg)
515 fConfigFileStream >> arg;
520 void DIGInitialize::read_item(Float_t &arg)
526 fConfigFileStream >> arg;
530 void DIGInitialize::read_item(Double_t &arg)
536 fConfigFileStream >> arg;
540 void DIGInitialize::read_item(Bool_t &arg)
546 fConfigFileStream >> arg;