-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathsbsdig.cxx
3443 lines (3077 loc) · 109 KB
/
sbsdig.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//includes: standard
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <map>
//includes: root
#include <TROOT.h>
#include "TString.h"
#include "TObjString.h"
#include "TChain.h"
#include "TChainElement.h"
#include "TCut.h"
#include "TEventList.h"
#include "TMath.h"
#include "TRandom3.h"
//includes: specific
#include "G4SBSRunData.hh"
#include "g4sbs_types.h"
#include "g4sbs_tree.h"
#include "SBSDigAuxi.h"
#include "SBSDigPMTDet.h"
#include "SBSDigGEMDet.h"
#include "SBSDigGEMSimDig.h"
#include "SBSDigBkgdGen.h"
#ifdef __APPLE__
#include "unistd.h"
#endif
#include <chrono>
/*
//Defining here the parameters for the new detectors.
//TODO: write a list of parameters that are not "frozen" (e.g. gain, pedestal parameters, etc...) and switch them into databases...
#define NPlanes_bbgem 32 // modules...
#define NChan_bbps 52
#define NChan_bbsh 189
#define NChan_bbhodo 180
#define NChan_grinch 510
#define NChan_hcal 288
#define TriggerJitter 3.0 //ns
#define ADCbits 12
#define gatewidth_PMT 100 //ns
#define gatewidth_GEM 400 //ns
#define FADC_sampsize 4.0 //ns
//DB???
#define sigmapulse_bbpsSH 3.0 //ns / 1.2 of
#define sigmapulse_bbhodo 1.6 //ns
#define sigmapulse_grinch 3.75 //ns
#define gain_bbps 2.e6
#define ped_bbps 600.0 // ADC channel
#define pedsigma_bbps 3.0 // ADC channel
#define trigoffset_bbps 18.2 //ns
#define ADCconv_bbps 50 //fC/ch
#define gain_bbsh 7.5e5
#define ped_bbsh 500.0 // ADC channel
#define pedsigma_bbsh 4.5 // ADC channel
#define trigoffset_bbsh 18.5 //ns
#define ADCconv_bbsh 50 //fC/ch
#define gain_grinch 7.0e6
#define ped_grinch 0.0
#define pedsigma_grinch 0.0
#define trigoffset_grinch 15.3 //ns
#define threshold_grinch 3.e-3 //V
#define ADCconv_grinch 100 //fC/ch
#define TDCconv_grinch 1.0 //ns/channel
#define TDCbits_grinch 16 //ns/channel
#define gain_bbhodo 1.0e5
#define ped_bbhodo 0.0
#define pedsigma_bbhodo 0.0
#define trigoffset_bbhodo 18.6 //ns
#define threshold_bbhodo 3.e-3 //V
#define ADCconv_bbhodo 100 //fC/ch
#define TDCconv_bbhodo 0.1 //ns/channel
#define TDCbits_bbhodo 19 //ns/channel
#define gain_hcal 1.0e6
#define ped_hcal 0.0
#define pedsigma_hcal 0.0
#define trigoffset_hcal 81.0 //ns
#define threshold_hcal 3.e-3 //V
#define ADCconv_hcal 1.0 //fC/ch //??
#define TDCconv_hcal 0.12 //ns/channel
#define TDCbits_hcal 16 //ns/channel
*/
using namespace std;
//____________________________________________________
int main(int argc, char** argv){
// Step 0: read out arguments
string db_file, inputsigfile, inputbkgdfile = "";//sources of files
ULong64_t Nentries = -1;//number of events to process
//UShort_t Nbkgd = 0;//number of background files to add to each event
double BkgdTimeWindow = 0, LumiFrac = 0;
bool pmtbkgddig = false;
if(argc<3 || argc>4){
cout << "*** Inadequate number of arguments! ***" << endl
<< " Arguments: database (mandatory); " << endl
<< " list_of_sig_input_files (str, mandatory); " << endl
<< " nb_of_sig_evts_to_process (int, def=-1); " << endl;
//<< " bkgd_histo_input_file (str, def=''); " << endl
// << " bkgd_lumi_frac (double, def=0); " << endl;
return(-1);
}
db_file = argv[1];
cout << " database file " << db_file << endl;
inputsigfile = argv[2];
cout << " Signal input files from: " << inputsigfile << endl;
if(argc>3)Nentries = atoi(argv[3]);
cout << " Number of (signal) events to process = " << Nentries << endl;
/*
if(argc>5){
inputbkgdfile = argv[4];
cout << " Background histgrams from: " << inputbkgdfile << endl;
LumiFrac = max(0., atof(argv[5]));
cout << " Fraction of background to superimpose to signal = " << LumiFrac << endl;
}
*/
// ------------------- // dev notes // ------------------- //
// First, we want to extend the input tree (for signal only!!!)
// I guess in order to avoid adding extra layers of code,
// the tree extension might have to be coded in the custom tree class
std::vector<SBSDigPMTDet*> PMTdetectors;
std::vector<int> detmap;
std::vector<SBSDigGEMDet*> GEMdetectors;
std::vector<SBSDigGEMSimDig*> GEMsimDig;
std::vector<int> gemdetmap;
// Variable parameters.
// Can be configured with the database, but are provided with defaults.
Int_t Rseed = 0;
Double_t TriggerJitter = 3.0;
std::vector<TString> detectors_list;
const int nparam_pmtdet_adc = 12;
const int nparam_pmtdet_fadc = 11;
const int nparam_pmtdet_fadc_leadglass = 12;
const int nparam_gemdet = 12;
int nparam_bbps_read = 0;
Double_t refindex_bbps = 1.68;
Int_t NChan_bbps = 52;
Double_t gatewidth_bbps = 100.;
std::vector<Double_t> gain_bbps;
Double_t ped_bbps = 600.;//
Double_t pedsigma_bbps = 3.;//
Double_t trigoffset_bbps = 18.2;//
Double_t threshold_bbps = 3.e-3;
Double_t ADCconv_bbps = 50.;
Int_t ADCbits_bbps = 12;
Double_t TDCconv_bbps = 0.0625;
Int_t TDCbits_bbps = 15;
Double_t sigmapulse_bbps = 3.0;
int nparam_bbsh_read = 0;
Double_t refindex_bbsh = 1.68;
Int_t NChan_bbsh = 189;
Double_t gatewidth_bbsh = 100.;
std::vector<Double_t> gain_bbsh;
Double_t ped_bbsh = 500.;
Double_t pedsigma_bbsh = 4.5;
Double_t trigoffset_bbsh = 18.5;
Double_t threshold_bbsh = 3.e-3;
Double_t ADCconv_bbsh = 50.;
Int_t ADCbits_bbsh = 12;
Double_t TDCconv_bbsh = 0.0625;
Int_t TDCbits_bbsh = 15;
Double_t sigmapulse_bbsh = 3.0;
int nparam_grinch_read = 0;
Int_t NChan_grinch = 510;
Double_t gatewidth_grinch = 100.;
std::vector<Double_t> gain_grinch;
Double_t ped_grinch = 0.;
Double_t pedsigma_grinch = 0.;
Double_t trigoffset_grinch = 15.3;
Double_t threshold_grinch = 3.e-3;
Double_t ADCconv_grinch = 100;
Int_t ADCbits_grinch = 12;
Double_t TDCconv_grinch = 1.;
Int_t TDCbits_grinch = 16;
Double_t sigmapulse_grinch = 3.75;
int nparam_bbhodo_read = 0;
Int_t NChan_bbhodo = 180;
Double_t gatewidth_bbhodo = 100.;
std::vector<Double_t> gain_bbhodo;
Double_t ped_bbhodo = 0.;
Double_t pedsigma_bbhodo = 0.;
Double_t trigoffset_bbhodo = 18.6;
Double_t threshold_bbhodo = 3.e3;
Double_t ADCconv_bbhodo = 100.;
Int_t ADCbits_bbhodo = 12;
Double_t TDCconv_bbhodo = 0.1;
Int_t TDCbits_bbhodo = 19;
Double_t sigmapulse_bbhodo = 1.6;
int nparam_hcal_read = 0;
Int_t NChan_hcal = 288;
Double_t gatewidth_hcal = 80;
std::vector<Double_t> gain_hcal;
Double_t ped_hcal = 0.;
Double_t pedsigma_hcal = 0.;
Double_t trigoffset_hcal = 81.;
Double_t threshold_hcal = 3.e-3;
Double_t ADCconv_hcal = 1.;
Double_t TDCconv_hcal = 0.12;
Int_t TDCbits_hcal = 16;
Int_t FADC_ADCbits = 12;
Double_t FADC_sampsize = 4.0;
Double_t sigmapulse_hcal = 20.0;
int nparam_bbgem_read = 0;
Int_t NPlanes_bbgem = 32;// number of planes/modules/readout
Double_t gatewidth_bbgem = 400.;
Double_t ZsupThr_bbgem = 240.;
Int_t Nlayers_bbgem = 5;
std::vector<Double_t> bbgem_layer_z;
Int_t* layer_bbgem;
Int_t* nstrips_bbgem;
Double_t* offset_bbgem;
Double_t* RO_angle_bbgem;
Double_t* triggeroffset_bbgem;
Double_t* gain_bbgem;//one gain per module
Double_t* commonmode_array_bbgem;
UShort_t nAPV_bbgem = 0;
int nparam_sbsgem_read = 0;
Int_t NPlanes_sbsgem = 32;// number of planes/modules/readout
Double_t gatewidth_sbsgem = 400.;
Double_t ZsupThr_sbsgem = 240.;
Int_t Nlayers_sbsgem = 5;
std::vector<Double_t> sbsgem_layer_z;
Int_t* layer_sbsgem;
Int_t* nstrips_sbsgem;
Double_t* offset_sbsgem;
Double_t* RO_angle_sbsgem;
Double_t* triggeroffset_sbsgem;
Double_t* gain_sbsgem;//one gain per module
Double_t* commonmode_array_sbsgem;
UShort_t nAPV_sbsgem = 0;
//GEP detectors: parameters with dummy values...
int nparam_ecal_read = 0;
Double_t refindex_ecal = 1.68;
Int_t NChan_ecal = 189;
Double_t gatewidth_ecal = 100.;
std::vector<Double_t> gain_ecal;
Double_t ped_ecal = 500.;
Double_t pedsigma_ecal = 4.5;
Double_t trigoffset_ecal = 18.5;
Double_t threshold_ecal = 3.e-3;
Double_t ADCconv_ecal = 50.;
Int_t ADCbits_ecal = 12;
Double_t TDCconv_ecal = 0.0625;
Int_t TDCbits_ecal = 15;
Double_t sigmapulse_ecal = 3.0;
int nparam_cdet_read = 0;
Int_t NChan_cdet = 189;
Double_t gatewidth_cdet = 100.;
std::vector<Double_t> gain_cdet;
Double_t ped_cdet = 500.;
Double_t pedsigma_cdet = 4.5;
Double_t trigoffset_cdet = 18.5;
Double_t threshold_cdet = 3.e-3;
Double_t ADCconv_cdet = 50.;
Int_t ADCbits_cdet = 12;
Double_t TDCconv_cdet = 0.0625;
Int_t TDCbits_cdet = 15;
Double_t sigmapulse_cdet = 3.0;
int nparam_ft_read = 0;
Int_t NPlanes_ft = 36;// number of planes/modules/readout
Double_t gatewidth_ft = 400.;
Double_t ZsupThr_ft = 240.;
Int_t Nlayers_ft = 6;
std::vector<Double_t> ft_layer_z;
Int_t* layer_ft;
Int_t* nstrips_ft;
Double_t* offset_ft;
Double_t* RO_angle_ft;
Double_t* triggeroffset_ft;
Double_t* gain_ft;//one gain per module
Double_t* commonmode_array_ft;
UShort_t nAPV_ft = 0;
int nparam_fpp1_read = 0;
Int_t NPlanes_fpp1 = 40;// number of planes/modules/readout
Double_t gatewidth_fpp1 = 400.;
Double_t ZsupThr_fpp1 = 240.;
Int_t Nlayers_fpp1 = 5;
std::vector<Double_t> fpp1_layer_z;
Int_t* layer_fpp1;
Int_t* nstrips_fpp1;
Double_t* offset_fpp1;
Double_t* RO_angle_fpp1;
Double_t* triggeroffset_fpp1;
Double_t* gain_fpp1;//one gain per module
Double_t* commonmode_array_fpp1;
UShort_t nAPV_fpp1 = 0;
int nparam_fpp2_read = 0;
Int_t NPlanes_fpp2 = 40;// number of planes/modules/readout
Double_t gatewidth_fpp2 = 400.;
Double_t ZsupThr_fpp2 = 240.;
Int_t Nlayers_fpp2 = 5;
std::vector<Double_t> fpp2_layer_z;
Int_t* layer_fpp2;
Int_t* nstrips_fpp2;
Double_t* offset_fpp2;
Double_t* RO_angle_fpp2;
Double_t* triggeroffset_fpp2;
Double_t* gain_fpp2;//one gain per module
Double_t* commonmode_array_fpp2;
UShort_t nAPV_fpp2 = 0;
int nparam_cepol_front_read = 0;
Int_t NPlanes_cepol_front = 28;// number of planes/modules/readout
Double_t gatewidth_cepol_front = 400.;
Double_t ZsupThr_cepol_front = 240.;
Int_t Nlayers_cepol_front = 4;
std::vector<Double_t> cepol_front_layer_z;
Int_t* layer_cepol_front;
Int_t* nstrips_cepol_front;
Double_t* offset_cepol_front;
Double_t* RO_angle_cepol_front;
Double_t* triggeroffset_cepol_front;
Double_t* gain_cepol_front;//one gain per module
Double_t* commonmode_array_cepol_front;
UShort_t nAPV_cepol_front = 0;
int nparam_cepol_rear_read = 0;
Int_t NPlanes_cepol_rear = 32;// number of planes/modules/readout
Double_t gatewidth_cepol_rear = 400.;
Double_t ZsupThr_cepol_rear = 240.;
Int_t Nlayers_cepol_rear = 4;
std::vector<Double_t> cepol_rear_layer_z;
Int_t* layer_cepol_rear;
Int_t* nstrips_cepol_rear;
Double_t* offset_cepol_rear;
Double_t* RO_angle_cepol_rear;
Double_t* triggeroffset_cepol_rear;
Double_t* gain_cepol_rear;//one gain per module
Double_t* commonmode_array_cepol_rear;
UShort_t nAPV_cepol_rear = 0;
int nparam_prpolbs_gem_read = 0;
Int_t NPlanes_prpolbs_gem = 16;// number of planes/modules/readout
Double_t gatewidth_prpolbs_gem = 400.;
Double_t ZsupThr_prpolbs_gem = 240.;
Int_t Nlayers_prpolbs_gem = 2;
std::vector<Double_t> prpolbs_gem_layer_z;
Int_t* layer_prpolbs_gem;
Int_t* nstrips_prpolbs_gem;
Double_t* offset_prpolbs_gem;
Double_t* RO_angle_prpolbs_gem;
Double_t* triggeroffset_prpolbs_gem;
Double_t* gain_prpolbs_gem;//one gain per module
Double_t* commonmode_array_prpolbs_gem;
UShort_t nAPV_prpolbs_gem = 0;
int nparam_prpolfs_gem_read = 0;
Int_t NPlanes_prpolfs_gem = 16;// number of planes/modules/readout
Double_t gatewidth_prpolfs_gem = 400.;
Double_t ZsupThr_prpolfs_gem = 240.;
Int_t Nlayers_prpolfs_gem = 2;
std::vector<Double_t> prpolfs_gem_layer_z;
Int_t* layer_prpolfs_gem;
Int_t* nstrips_prpolfs_gem;
Double_t* offset_prpolfs_gem;
Double_t* RO_angle_prpolfs_gem;
Double_t* triggeroffset_prpolfs_gem;
Double_t* gain_prpolfs_gem;//one gain per module
Double_t* commonmode_array_prpolfs_gem;
UShort_t nAPV_prpolfs_gem = 0;
// ** How to add a new subsystem **
// Add param for new detectors there...
//polscint_bs
int nparam_prpolscint_bs_read = 0;
Int_t NChan_polscint_bs = 48;
Double_t gatewidth_polscint_bs = 30.;
std::vector<Double_t> gain_polscint_bs;
Double_t ped_polscint_bs = 300.;
Double_t pedsigma_polscint_bs = 10.;
Double_t trigoffset_polscint_bs = 37.6;
Double_t threshold_polscint_bs = 3.e3;
Double_t ADCconv_polscint_bs = 100.;
Int_t ADCbits_polscint_bs = 12;
Double_t TDCconv_polscint_bs = 0.1;
Int_t TDCbits_polscint_bs = 19;
Double_t sigmapulse_polscint_bs = 1.6;
//polscint_fs
int nparam_prpolscint_fs_read = 0;
Int_t NChan_polscint_fs = 48;
Double_t gatewidth_polscint_fs = 30.;
std::vector<Double_t> gain_polscint_fs;
Double_t ped_polscint_fs = 300.;
Double_t pedsigma_polscint_fs = 3.;
Double_t trigoffset_polscint_fs = 37.6;
Double_t threshold_polscint_fs = 3.e3;
Double_t ADCconv_polscint_fs = 100.;
Int_t ADCbits_polscint_fs = 12;
Double_t TDCconv_polscint_fs = 0.1;
Int_t TDCbits_polscint_fs = 19;
Double_t sigmapulse_polscint_fs = 1.6;
//activeana
int nparam_activeana_read = 0;
Int_t NChan_activeana = 32;
Double_t gatewidth_activeana = 30.;
std::vector<Double_t> gain_activeana;
Double_t ped_activeana = 300.;
Double_t pedsigma_activeana = 10.0;
Double_t trigoffset_activeana = 37.6;
Double_t threshold_activeana = 3.e3;
Double_t ADCconv_activeana = 100.;
Int_t ADCbits_activeana = 19;
Double_t TDCconv_activeana = 0.1;
Int_t TDCbits_activeana = 19;
Double_t sigmapulse_activeana = 1.6;
//-----------------------------
// Read database
//-----------------------------
cout << "read database: " << db_file.c_str() << endl;
ifstream in_db(db_file.c_str());
if(!in_db.is_open()){
cout << "database " << db_file.c_str() << " does not exist!!!" << endl;
exit(-1);
}
TString currentline;
while( currentline.ReadLine(in_db) && !currentline.BeginsWith("endconfig")){
if( !currentline.BeginsWith("#") ){
Int_t ntokens = 0;
std::unique_ptr<TObjArray> tokens( currentline.Tokenize(", \t") );
if( !tokens->IsEmpty() ) {
ntokens = tokens->GetLast()+1;
}
//TObjArray *tokens = currentline.Tokenize(" ");//vg: def lost => versions prior to 6.06; should be fixed! ???
//int ntokens = tokens->GetEntries();
if( ntokens >= 2 ){
TString skey = ( (TObjString*) (*tokens)[0] )->GetString();
if(skey=="Rseed"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
Rseed = stemp.Atoi();
}
if(skey=="TriggerJitter"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
TriggerJitter = stemp.Atof();
}
if(skey=="detectors_list"){
for(int k = 1; k<ntokens; k++){
TString sdet = ( (TObjString*) (*tokens)[k] )->GetString();
detectors_list.push_back(sdet);
}
}
//BBPS
if(skey=="refindex_bbps"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
refindex_bbps = stemp.Atof();
nparam_bbps_read++;
}
if(skey=="NChan_bbps"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
NChan_bbps = stemp.Atoi();
nparam_bbps_read++;
}
if(skey=="gatewidth_bbps"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
gatewidth_bbps = stemp.Atof();
nparam_bbps_read++;
}
if(skey=="gain_bbps"){
gain_bbps.resize(NChan_bbps);
if(ntokens==NChan_bbps+1){
for(int k = 0; k<NChan_bbps; k++){
TString stemp = ( (TObjString*) (*tokens)[k+1] )->GetString();
gain_bbps[k] = stemp.Atof()*qe;
}
}else{
cout << ntokens-1 << " entries for " << skey << " dont match number of channels = "
<< NChan_bbps << endl << " applying first value on all planes " << endl;
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
for(int k = 0; k<NChan_bbps; k++){
gain_bbps[k] = stemp.Atof()*qe;
}
}
nparam_bbps_read++;
}
if(skey=="ped_bbps"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
ped_bbps = stemp.Atof();
nparam_bbps_read++;
}
if(skey=="pedsigma_bbps"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
pedsigma_bbps = stemp.Atof();
nparam_bbps_read++;
}
if(skey=="threshold_bbps"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
threshold_bbps = stemp.Atof();
nparam_bbps_read++;
}
if(skey=="trigoffset_bbps"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
trigoffset_bbps = stemp.Atof();
nparam_bbps_read++;
}
if(skey=="ADCconv_bbps"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
ADCconv_bbps = stemp.Atof();
nparam_bbps_read++;
}
if(skey=="ADCbits_bbps"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
ADCbits_bbps = stemp.Atoi();
nparam_bbps_read++;
}
if(skey=="TDCconv_bbps"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
TDCconv_bbps = stemp.Atof();
nparam_bbps_read++;
}
if(skey=="TDCbits_bbps"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
TDCbits_bbps = stemp.Atoi();
nparam_bbps_read++;
}
if(skey=="sigmapulse_bbps"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
sigmapulse_bbps = stemp.Atof();
nparam_bbps_read++;
}
//BBSH
if(skey=="refindex_bbsh"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
refindex_bbsh = stemp.Atof();
nparam_bbsh_read++;
}
if(skey=="NChan_bbsh"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
NChan_bbsh = stemp.Atoi();
nparam_bbsh_read++;
}
if(skey=="gatewidth_bbsh"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
gatewidth_bbsh = stemp.Atof();
nparam_bbsh_read++;
}
if(skey=="gain_bbsh"){
gain_bbsh.resize(NChan_bbsh);
if(ntokens==NChan_bbsh+1){
for(int k = 0; k<NChan_bbsh; k++){
TString stemp = ( (TObjString*) (*tokens)[k+1] )->GetString();
gain_bbsh[k] = stemp.Atof()*qe;
}
}else{
cout << ntokens-1 << " entries for " << skey << " dont match number of channels = "
<< NChan_bbsh << endl << " applying first value on all planes " << endl;
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
for(int k = 0; k<NChan_bbsh; k++){
gain_bbsh[k] = stemp.Atof()*qe;
}
}
nparam_bbsh_read++;
}
if(skey=="ped_bbsh"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
ped_bbsh = stemp.Atof();
nparam_bbsh_read++;
}
if(skey=="pedsigma_bbsh"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
pedsigma_bbsh = stemp.Atof();
nparam_bbsh_read++;
}
if(skey=="trigoffset_bbsh"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
trigoffset_bbsh = stemp.Atof();
nparam_bbsh_read++;
}
if(skey=="threshold_bbsh"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
threshold_bbsh = stemp.Atof();
nparam_bbsh_read++;
}
if(skey=="ADCconv_bbsh"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
ADCconv_bbsh = stemp.Atof();
nparam_bbsh_read++;
}
if(skey=="ADCbits_bbsh"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
ADCbits_bbsh = stemp.Atoi();
nparam_bbsh_read++;
}
if(skey=="TDCconv_bbsh"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
TDCconv_bbsh = stemp.Atof();
nparam_bbsh_read++;
}
if(skey=="TDCbits_bbsh"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
TDCbits_bbsh = stemp.Atoi();
nparam_bbsh_read++;
}
if(skey=="sigmapulse_bbsh"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
sigmapulse_bbsh = stemp.Atof();
nparam_bbsh_read++;
}
//GRINCH
if(skey=="NChan_grinch"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
NChan_grinch = stemp.Atoi();
nparam_grinch_read++;
}
if(skey=="gatewidth_grinch"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
gatewidth_grinch = stemp.Atof();
nparam_grinch_read++;
}
if(skey=="gain_grinch"){
gain_grinch.resize(NChan_grinch);
if(ntokens==NChan_grinch+1){
for(int k = 0; k<NChan_grinch; k++){
TString stemp = ( (TObjString*) (*tokens)[k+1] )->GetString();
gain_grinch[k] = stemp.Atof()*qe;
}
}else{
cout << ntokens-1 << " entries for " << skey << " dont match number of channels = "
<< NChan_grinch << endl << " applying first value on all planes " << endl;
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
for(int k = 0; k<NChan_grinch; k++){
gain_grinch[k] = stemp.Atof()*qe;
}
}
nparam_grinch_read++;
}
if(skey=="ped_grinch"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
ped_grinch = stemp.Atof();
nparam_grinch_read++;
}
if(skey=="pedsigma_grinch"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
pedsigma_grinch = stemp.Atof();
nparam_grinch_read++;
}
if(skey=="trigoffset_grinch"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
trigoffset_grinch = stemp.Atof();
nparam_grinch_read++;
}
if(skey=="threshold_grinch"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
threshold_grinch = stemp.Atof();
nparam_grinch_read++;
}
if(skey=="ADCconv_grinch"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
ADCconv_grinch = stemp.Atof();
nparam_grinch_read++;
}
if(skey=="ADCbits_grinch"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
ADCbits_grinch = stemp.Atoi();
nparam_grinch_read++;
}
if(skey=="TDCconv_grinch"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
TDCconv_grinch = stemp.Atof();
nparam_grinch_read++;
}
if(skey=="TDCbits_grinch"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
TDCbits_grinch = stemp.Atoi();
nparam_grinch_read++;
}
if(skey=="sigmapulse_grinch"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
sigmapulse_grinch = stemp.Atof();
nparam_grinch_read++;
}
//BBHODO
if(skey=="NChan_bbhodo"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
NChan_bbhodo = stemp.Atoi();
nparam_bbhodo_read++;
}
if(skey=="gatewidth_bbhodo"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
gatewidth_bbhodo = stemp.Atof();
nparam_bbhodo_read++;
}
if(skey=="gain_bbhodo"){
gain_bbhodo.resize(NChan_bbhodo);
if(ntokens==NChan_bbhodo+1){
for(int k = 0; k<NChan_bbhodo; k++){
TString stemp = ( (TObjString*) (*tokens)[k+1] )->GetString();
gain_bbhodo[k] = stemp.Atof()*qe;
}
}else{
cout << ntokens-1 << " entries for " << skey << " dont match number of channels = "
<< NChan_bbhodo << endl << " applying first value on all planes " << endl;
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
for(int k = 0; k<NChan_bbhodo; k++){
gain_bbhodo[k] = stemp.Atof()*qe;
}
}
nparam_bbhodo_read++;
}
if(skey=="ped_bbhodo"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
ped_bbhodo = stemp.Atof();
nparam_bbhodo_read++;
}
if(skey=="pedsigma_bbhodo"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
pedsigma_bbhodo = stemp.Atof();
nparam_bbhodo_read++;
}
if(skey=="trigoffset_bbhodo"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
trigoffset_bbhodo = stemp.Atof();
nparam_bbhodo_read++;
}
if(skey=="threshold_bbhodo"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
threshold_bbhodo = stemp.Atof();
nparam_bbhodo_read++;
}
if(skey=="ADCconv_bbhodo"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
ADCconv_bbhodo = stemp.Atof();
nparam_bbhodo_read++;
}
if(skey=="ADCbits_bbhodo"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
ADCbits_bbhodo = stemp.Atoi();
nparam_bbhodo_read++;
}
if(skey=="TDCconv_bbhodo"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
TDCconv_bbhodo = stemp.Atof();
nparam_bbhodo_read++;
}
if(skey=="TDCbits_bbhodo"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
TDCbits_bbhodo = stemp.Atoi();
nparam_bbhodo_read++;
}
if(skey=="sigmapulse_bbhodo"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
sigmapulse_bbhodo = stemp.Atof();
nparam_bbhodo_read++;
}
//HCal
if(skey=="NChan_hcal"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
NChan_hcal = stemp.Atoi();
nparam_hcal_read++;
}
if(skey=="gatewidth_hcal"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
gatewidth_hcal = stemp.Atof();
nparam_hcal_read++;
}
if(skey=="gain_hcal"){
gain_hcal.resize(NChan_hcal);
if(ntokens==NChan_hcal+1){
for(int k = 0; k<NChan_hcal; k++){
TString stemp = ( (TObjString*) (*tokens)[k+1] )->GetString();
gain_hcal[k] = stemp.Atof()*qe;
}
}else{
cout << ntokens-1 << " entries for " << skey << " dont match number of channels = "
<< NChan_hcal << endl << " applying first value on all planes " << endl;
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
for(int k = 0; k<NChan_hcal; k++){
gain_hcal[k] = stemp.Atof()*qe;
}
}
nparam_hcal_read++;
}
if(skey=="ped_hcal"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
ped_hcal = stemp.Atof();
nparam_hcal_read++;
}
if(skey=="pedsigma_hcal"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
pedsigma_hcal = stemp.Atof();
nparam_hcal_read++;
}
if(skey=="trigoffset_hcal"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
trigoffset_hcal = stemp.Atof();
nparam_hcal_read++;
}
if(skey=="threshold_hcal"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
threshold_hcal = stemp.Atof();
nparam_hcal_read++;
}
if(skey=="ADCconv_hcal"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
ADCconv_hcal = stemp.Atof();
nparam_hcal_read++;
}
if(skey=="TDCconv_hcal"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
TDCconv_hcal = stemp.Atof();
nparam_hcal_read++;
}
if(skey=="TDCbits_hcal"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
TDCbits_hcal = stemp.Atoi();
nparam_hcal_read++;
}
if(skey=="sigmapulse_hcal"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
sigmapulse_hcal = stemp.Atof();
nparam_hcal_read++;
}
if(skey=="FADC_ADCbits"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
FADC_ADCbits = stemp.Atoi();
}
if(skey=="FADC_sampsize"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
FADC_sampsize = stemp.Atof();
}
//Ecal
if(skey=="refindex_ecal"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
refindex_ecal = stemp.Atof();
nparam_ecal_read++;
}
if(skey=="NChan_ecal"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
NChan_ecal = stemp.Atoi();
nparam_ecal_read++;
}
if(skey=="gatewidth_ecal"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
gatewidth_ecal = stemp.Atof();
nparam_ecal_read++;
}
if(skey=="gain_ecal"){
gain_ecal.resize(NChan_ecal);
if(ntokens==NChan_ecal+1){
for(int k = 0; k<NChan_ecal; k++){
TString stemp = ( (TObjString*) (*tokens)[k+1] )->GetString();
gain_ecal[k] = stemp.Atof()*qe;
}
}else{
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
for(int k = 0; k<NChan_ecal; k++){
gain_ecal[k] = stemp.Atof()*qe;
}
}
nparam_ecal_read++;
}
if(skey=="ped_ecal"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
ped_ecal = stemp.Atof();
nparam_ecal_read++;
}
if(skey=="pedsigma_ecal"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
pedsigma_ecal = stemp.Atof();
nparam_ecal_read++;
}
if(skey=="trigoffset_ecal"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
trigoffset_ecal = stemp.Atof();
nparam_ecal_read++;
}
if(skey=="threshold_ecal"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
threshold_ecal = stemp.Atof();
nparam_ecal_read++;
}
if(skey=="ADCconv_ecal"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
ADCconv_ecal = stemp.Atof();
nparam_ecal_read++;
}
if(skey=="TDCconv_ecal"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
TDCconv_ecal = stemp.Atof();
nparam_ecal_read++;
}
if(skey=="TDCbits_ecal"){
TString stemp = ( (TObjString*) (*tokens)[1] )->GetString();
TDCbits_ecal = stemp.Atoi();
nparam_ecal_read++;
}
if(skey=="sigmapulse_ecal"){