Repository navigation
Expand file tree
/
Copy pathspvector.cxx
More file actions
1541 lines (1324 loc) · 82.7 KB
/
Copy pathspvector.cxx
File metadata and controls
1541 lines (1324 loc) · 82.7 KB
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
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
//
// \author: prottay das 23/12/2024
// \email: prottay.das@cern.ch
#include "PWGLF/DataModel/SPCalibrationTables.h"
#include "Common/CCDB/EventSelectionParams.h"
#include "Common/CCDB/RCTSelectionFlags.h"
#include "Common/DataModel/Centrality.h"
#include "Common/DataModel/EventSelection.h"
#include "Common/DataModel/FT0Corrected.h"
#include "Common/DataModel/Multiplicity.h"
#include <CCDB/BasicCCDBManager.h>
#include <Framework/AnalysisDataModel.h>
#include <Framework/AnalysisHelpers.h>
#include <Framework/AnalysisTask.h>
#include <Framework/Configurable.h>
#include <Framework/HistogramRegistry.h>
#include <Framework/HistogramSpec.h>
#include <Framework/InitContext.h>
#include <Framework/OutputObjHeader.h>
#include <Framework/runDataProcessing.h>
#include <TF1.h>
#include <TH2.h>
#include <TH3.h>
#include <THn.h>
#include <TMath.h>
#include <TMathBase.h>
#include <TProfile.h>
#include <TProfile3D.h>
#include <TRandom3.h>
#include <RtypesCore.h>
#include <array>
#include <chrono>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
using namespace o2;
using namespace o2::framework;
using namespace o2::framework::expressions;
using namespace o2::constants::physics;
using namespace o2::aod::rctsel;
struct spvector {
Produces<aod::SPCalibrationTables> spcalibrationtable;
// Configurables.
struct : ConfigurableGroup {
Configurable<std::string> cfgURL{"cfgURL", "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"};
Configurable<int64_t> nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(), "Latest acceptable timestamp of creation for the object"};
} cfgCcdbParam;
// Enable access to the CCDB for the offset and correction constants and save them in dedicated variables.
Service<o2::ccdb::BasicCCDBManager> ccdb;
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
Configurable<float> cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"};
Configurable<float> cfgCutCentralityMax{"cfgCutCentralityMax", 80.0f, "Centrality cut Max"};
Configurable<float> cfgCutCentralityMin{"cfgCutCentralityMin", 0.0f, "Centrality cut Min"};
Configurable<bool> additionalEvSel{"additionalEvSel", false, "additionalEvSel"};
Configurable<bool> usemem{"usemem", true, "usemem"};
Configurable<bool> usecfactor{"usecfactor", false, "use c factor"};
struct : ConfigurableGroup {
Configurable<int> QxyNbins{"QxyNbins", 100, "Number of bins in QxQy histograms"};
Configurable<int> PhiNbins{"PhiNbins", 100, "Number of bins in phi histogram"};
Configurable<float> lbinQxy{"lbinQxy", -5.0, "lower bin value in QxQy histograms"};
Configurable<float> hbinQxy{"hbinQxy", 5.0, "higher bin value in QxQy histograms"};
Configurable<int> VxNbins{"VxNbins", 25, "Number of bins in Vx histograms"};
Configurable<float> lbinVx{"lbinVx", -0.05, "lower bin value in Vx histograms"};
Configurable<float> hbinVx{"hbinVx", 0.0, "higher bin value in Vx histograms"};
Configurable<int> VyNbins{"VyNbins", 25, "Number of bins in Vy histograms"};
Configurable<float> lbinVy{"lbinVy", -0.02, "lower bin value in Vy histograms"};
Configurable<float> hbinVy{"hbinVy", 0.02, "higher bin value in Vy histograms"};
Configurable<int> VzNbins{"VzNbins", 20, "Number of bins in Vz histograms"};
Configurable<float> lbinVz{"lbinVz", -10.0, "lower bin value in Vz histograms"};
Configurable<float> hbinVz{"hbinVz", 10.0, "higher bin value in Vz histograms"};
Configurable<int> CentNbins{"CentNbins", 16, "Number of bins in cent histograms"};
Configurable<float> lbinCent{"lbinCent", 0.0, "lower bin value in cent histograms"};
Configurable<float> hbinCent{"hbinCent", 80.0, "higher bin value in cent histograms"};
Configurable<int> VxfineNbins{"VxfineNbins", 25, "Number of bins in Vx fine histograms"};
Configurable<float> lfinebinVx{"lfinebinVx", -0.05, "lower bin value in Vx fine histograms"};
Configurable<float> hfinebinVx{"hfinebinVx", 0.0, "higher bin value in Vx fine histograms"};
Configurable<int> VyfineNbins{"VyfineNbins", 25, "Number of bins in Vy fine histograms"};
Configurable<float> lfinebinVy{"lfinebinVy", -0.02, "lower bin value in Vy fine histograms"};
Configurable<float> hfinebinVy{"hfinebinVy", 0.02, "higher bin value in Vy fine histograms"};
Configurable<int> VzfineNbins{"VzfineNbins", 20, "Number of bins in Vz fine histograms"};
Configurable<float> lfinebinVz{"lfinebinVz", -10.0, "lower bin value in Vz fine histograms"};
Configurable<float> hfinebinVz{"hfinebinVz", 10.0, "higher bin value in Vz fine histograms"};
Configurable<int> CentfineNbins{"CentfineNbins", 16, "Number of bins in cent fine histograms"};
Configurable<float> lfinebinCent{"lfinebinCent", 0.0, "lower bin value in cent fine histograms"};
Configurable<float> hfinebinCent{"hfinebinCent", 80.0, "higher bin value in cent fine histograms"};
Configurable<int> TimefineNbins{"TimefineNbins", 120, "Number of bins in Time fine histograms"};
Configurable<float> lfinebinTime{"lfinebinTime", 0, "lower bin value in Time fine histograms"};
Configurable<float> hfinebinTime{"hfinebinTime", 120, "higher bin value in Time fine histograms"};
} configbins;
Configurable<bool> useoldrecentering{"useoldrecentering", true, "flag to perform old vs new recentering"};
Configurable<bool> useShift{"useShift", false, "shift histograms"};
Configurable<bool> ispolarization{"ispolarization", false, "Flag to check polarization"};
Configurable<bool> followpub{"followpub", true, "flag to use alphaZDC"};
Configurable<bool> useGainCallib{"useGainCallib", false, "use gain calibration"};
Configurable<bool> useCallibvertex{"useCallibvertex", false, "use calibration for vxy"};
Configurable<bool> coarse1{"coarse1", false, "RE1"};
Configurable<bool> fine1{"fine1", false, "REfine1"};
Configurable<bool> finetime1{"finetime1", false, "REfinetime1"};
Configurable<bool> coarse2{"coarse2", false, "RE2"};
Configurable<bool> fine2{"fine2", false, "REfine2"};
Configurable<bool> finetime2{"finetime2", false, "REfinetime2"};
Configurable<bool> coarse3{"coarse3", false, "RE3"};
Configurable<bool> fine3{"fine3", false, "REfine3"};
Configurable<bool> finetime3{"finetime3", false, "REfinetime3"};
Configurable<bool> coarse4{"coarse4", false, "RE4"};
Configurable<bool> fine4{"fine4", false, "REfine4"};
Configurable<bool> coarse5{"coarse5", false, "RE5"};
Configurable<bool> fine5{"fine5", false, "REfine5"};
Configurable<bool> coarse6{"coarse6", false, "RE6"};
Configurable<bool> fine6{"fine6", false, "REfine6"};
Configurable<bool> useRecentereSp{"useRecentereSp", false, "use Recentering with Sparse or THn"};
Configurable<bool> useRecenterefineSp{"useRecenterefineSp", false, "use fine Recentering with THn"};
Configurable<bool> useTimeRecentering{"useTimeRecentering", false, "Use residual time recentering"};
Configurable<std::string> ConfGainPath{"ConfGainPath", "Users/p/prottay/My/Object/NewPbPbpass4_10092024/gaincallib", "Path to gain calibration"};
Configurable<std::string> ConfGainPathvxy{"ConfGainPathvxy", "Users/p/prottay/My/Object/swapcoords/PbPbpass4_20112024/recentervert", "Path to gain calibration for vxy"};
Configurable<std::string> ConfRecentereSp{"ConfRecentereSp", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for recentere"};
Configurable<std::string> ConfRecentereSp2{"ConfRecentereSp2", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for recentere2"};
Configurable<std::string> ConfRecentereSp3{"ConfRecentereSp3", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for recentere3"};
Configurable<std::string> ConfRecentereSp4{"ConfRecentereSp4", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for recentere4"};
Configurable<std::string> ConfRecentereSp5{"ConfRecentereSp5", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for recentere5"};
Configurable<std::string> ConfRecentereSp6{"ConfRecentereSp6", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for recentere6"};
Configurable<std::string> ConfRecenterecentSp{"ConfRecenterecentSp", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for cent recentere"};
Configurable<std::string> ConfRecenterevxSp{"ConfRecenterevxSp", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vx recentere"};
Configurable<std::string> ConfRecenterevySp{"ConfRecenterevySp", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vy recentere"};
Configurable<std::string> ConfRecenterevzSp{"ConfRecenterevzSp", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vz recentere"};
Configurable<std::string> ConfRecenterecentSp2{"ConfRecenterecentSp2", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for cent recentere2"};
Configurable<std::string> ConfRecenterevxSp2{"ConfRecenterevxSp2", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vx recentere2"};
Configurable<std::string> ConfRecenterevySp2{"ConfRecenterevySp2", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vy recentere2"};
Configurable<std::string> ConfRecenterevzSp2{"ConfRecenterevzSp2", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vz recentere2"};
Configurable<std::string> ConfRecenterecentSp3{"ConfRecenterecentSp3", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for cent recentere3"};
Configurable<std::string> ConfRecenterevxSp3{"ConfRecenterevxSp3", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vx recentere3"};
Configurable<std::string> ConfRecenterevySp3{"ConfRecenterevySp3", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vy recentere3"};
Configurable<std::string> ConfRecenterevzSp3{"ConfRecenterevzSp3", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vz recentere3"};
Configurable<std::string> ConfRecenterecentSp4{"ConfRecenterecentSp4", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for cent recentere4"};
Configurable<std::string> ConfRecenterevxSp4{"ConfRecenterevxSp4", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vx recentere4"};
Configurable<std::string> ConfRecenterevySp4{"ConfRecenterevySp4", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vy recentere4"};
Configurable<std::string> ConfRecenterevzSp4{"ConfRecenterevzSp4", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vz recentere4"};
Configurable<std::string> ConfRecenterecentSp5{"ConfRecenterecentSp5", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for cent recentere5"};
Configurable<std::string> ConfRecenterevxSp5{"ConfRecenterevxSp5", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vx recentere5"};
Configurable<std::string> ConfRecenterevySp5{"ConfRecenterevySp5", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vy recentere5"};
Configurable<std::string> ConfRecenterevzSp5{"ConfRecenterevzSp5", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vz recentere5"};
Configurable<std::string> ConfRecenterecentSp6{"ConfRecenterecentSp6", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for cent recentere6"};
Configurable<std::string> ConfRecenterevxSp6{"ConfRecenterevxSp6", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vx recentere6"};
Configurable<std::string> ConfRecenterevySp6{"ConfRecenterevySp6", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vy recentere6"};
Configurable<std::string> ConfRecenterevzSp6{"ConfRecenterevzSp6", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vz recentere6"};
Configurable<std::string> ConfShiftC{"ConfShiftC", "Users/p/prottay/My/Object/Testinglocaltree/shiftcallib2", "Path to shift C"};
Configurable<std::string> ConfShiftA{"ConfShiftA", "Users/p/prottay/My/Object/Testinglocaltree/shiftcallib2", "Path to shift A"};
Configurable<std::string> confRecentereTimeSp1{"confRecentereTimeSp1", "Users/p/prottay/My/Object/GCwithoutcfactorgoodVztimedep/From676541/TestDDlocal/2024PbPbpass3_23062026/recenterlast2", "Path to time recentering map 1"};
Configurable<std::string> confRecentereTimeSp2{"confRecentereTimeSp2", "Users/p/prottay/My/Object/GCwithoutcfactorgoodVztimedep/From676541/TestDDlocal/2024PbPbpass3_23062026/recenterlast2", "Path to time recentering map 2"};
Configurable<std::string> confRecentereTimeSp3{"confRecentereTimeSp3", "Users/p/prottay/My/Object/GCwithoutcfactorgoodVztimedep/From676541/TestDDlocal/2024PbPbpass3_23062026/recenterlast3", "Path to time recentering map 3"};
struct : ConfigurableGroup {
// Five recentering stages. Each stage is applied in the strict order:
// cent -> (cent,Vx) -> (cent,Vy) -> (cent,Vz).
Configurable<bool> finecent1{"finecent1", false, "Apply fine centrality recentering, stage 1"};
Configurable<bool> finecent2{"finecent2", false, "Apply fine centrality recentering, stage 2"};
Configurable<bool> finecent3{"finecent3", false, "Apply fine centrality recentering, stage 3"};
Configurable<bool> finecent4{"finecent4", false, "Apply fine centrality recentering, stage 4"};
Configurable<bool> finecent5{"finecent5", false, "Apply fine centrality recentering, stage 5"};
Configurable<bool> finecent6{"finecent6", false, "Apply fine centrality recentering, stage 6"};
Configurable<bool> finecentvx1{"finecentvx1", false, "Apply fine (cent,Vx) recentering, stage 1"};
Configurable<bool> finecentvx2{"finecentvx2", false, "Apply fine (cent,Vx) recentering, stage 2"};
Configurable<bool> finecentvx3{"finecentvx3", false, "Apply fine (cent,Vx) recentering, stage 3"};
Configurable<bool> finecentvx4{"finecentvx4", false, "Apply fine (cent,Vx) recentering, stage 4"};
Configurable<bool> finecentvx5{"finecentvx5", false, "Apply fine (cent,Vx) recentering, stage 5"};
Configurable<bool> finecentvx6{"finecentvx6", false, "Apply fine (cent,Vx) recentering, stage 6"};
Configurable<bool> finecentvy1{"finecentvy1", false, "Apply fine (cent,Vy) recentering, stage 1"};
Configurable<bool> finecentvy2{"finecentvy2", false, "Apply fine (cent,Vy) recentering, stage 2"};
Configurable<bool> finecentvy3{"finecentvy3", false, "Apply fine (cent,Vy) recentering, stage 3"};
Configurable<bool> finecentvy4{"finecentvy4", false, "Apply fine (cent,Vy) recentering, stage 4"};
Configurable<bool> finecentvy5{"finecentvy5", false, "Apply fine (cent,Vy) recentering, stage 5"};
Configurable<bool> finecentvy6{"finecentvy6", false, "Apply fine (cent,Vy) recentering, stage 6"};
Configurable<bool> finecentvz1{"finecentvz1", false, "Apply fine (cent,Vz) recentering, stage 1"};
Configurable<bool> finecentvz2{"finecentvz2", false, "Apply fine (cent,Vz) recentering, stage 2"};
Configurable<bool> finecentvz3{"finecentvz3", false, "Apply fine (cent,Vz) recentering, stage 3"};
Configurable<bool> finecentvz4{"finecentvz4", false, "Apply fine (cent,Vz) recentering, stage 4"};
Configurable<bool> finecentvz5{"finecentvz5", false, "Apply fine (cent,Vz) recentering, stage 5"};
Configurable<bool> finecentvz6{"finecentvz6", false, "Apply fine (cent,Vz) recentering, cycle 6"};
Configurable<bool> finevztime1{"finevztime1", false, "Apply fine (Vz,time) recentering, cycle 1"};
Configurable<bool> finevztime2{"finevztime2", false, "Apply fine (Vz,time) recentering, cycle 2"};
Configurable<bool> finevztime3{"finevztime3", false, "Apply fine (Vz,time) recentering, cycle 3"};
Configurable<bool> finevztime4{"finevztime4", false, "Apply fine (Vz,time) recentering, cycle 4"};
Configurable<bool> finevztime5{"finevztime5", false, "Apply fine (Vz,time) recentering, cycle 5"};
Configurable<bool> useRecenterefinecentSp{"useRecenterefinecentSp", false, "use finecent Recentering with THn"};
Configurable<bool> useRecenterefinecentvxvyvzSp{"useRecenterefinecentvxvyvzSp", false, "use finecentvxvyvz Recentering with THn"};
Configurable<bool> useRecenterefinevztimeSp{"useRecenterefinevztimeSp", false, "use fine (Vz,time) recentering with TH3F"};
Configurable<std::string> confRecentereCentSp{"confRecentereCentSp", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for cent recentering"};
Configurable<std::string> confRecentereCentSp2{"confRecentereCentSp2", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for cent recentering 2"};
Configurable<std::string> confRecentereCentSp3{"confRecentereCentSp3", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for cent recentering 3"};
Configurable<std::string> confRecentereCentSp4{"confRecentereCentSp4", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for cent recentering 4"};
Configurable<std::string> confRecentereCentSp5{"confRecentereCentSp5", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for cent recentering 5"};
Configurable<std::string> confRecentereCentSp6{"confRecentereCentSp6", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for cent recentering 6"};
Configurable<std::string> confRecentereCentVxSp{"confRecentereCentVxSp", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for centvx recentering"};
Configurable<std::string> confRecentereCentVySp{"confRecentereCentVySp", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for centvy recentering"};
Configurable<std::string> confRecentereCentVzSp{"confRecentereCentVzSp", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for centvz recentering"};
Configurable<std::string> confRecentereCentVxSp2{"confRecentereCentVxSp2", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for centvx2 recentering"};
Configurable<std::string> confRecentereCentVySp2{"confRecentereCentVySp2", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for centvy2 recentering"};
Configurable<std::string> confRecentereCentVzSp2{"confRecentereCentVzSp2", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for centvz2 recentering"};
Configurable<std::string> confRecentereCentVxSp3{"confRecentereCentVxSp3", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for centvx3 recentering"};
Configurable<std::string> confRecentereCentVySp3{"confRecentereCentVySp3", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for centvy3 recentering"};
Configurable<std::string> confRecentereCentVzSp3{"confRecentereCentVzSp3", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for centvz3 recentering"};
Configurable<std::string> confRecentereCentVxSp4{"confRecentereCentVxSp4", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for centvx4 recentering"};
Configurable<std::string> confRecentereCentVySp4{"confRecentereCentVySp4", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for centvy4 recentering"};
Configurable<std::string> confRecentereCentVzSp4{"confRecentereCentVzSp4", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for centvz4 recentering"};
Configurable<std::string> confRecentereCentVxSp5{"confRecentereCentVxSp5", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for centvx5 recentering"};
Configurable<std::string> confRecentereCentVySp5{"confRecentereCentVySp5", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for centvy5 recentering"};
Configurable<std::string> confRecentereCentVzSp5{"confRecentereCentVzSp5", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for centvz5 recentering"};
Configurable<std::string> confRecentereCentVxSp6{"confRecentereCentVxSp6", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for centvx6 recentering"};
Configurable<std::string> confRecentereCentVySp6{"confRecentereCentVySp6", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for centvy6 recentering"};
Configurable<std::string> confRecentereCentVzSp6{"confRecentereCentVzSp6", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn path for centvz6 recentering"};
Configurable<std::string> confRecentereVzTimeSp{"confRecentereVzTimeSp", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "TH3F path for (Vz,time) recentering, cycle 1"};
Configurable<std::string> confRecentereVzTimeSp2{"confRecentereVzTimeSp2", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "TH3F path for (Vz,time) recentering, cycle 2"};
Configurable<std::string> confRecentereVzTimeSp3{"confRecentereVzTimeSp3", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "TH3F path for (Vz,time) recentering, cycle 3"};
Configurable<std::string> confRecentereVzTimeSp4{"confRecentereVzTimeSp4", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "TH3F path for (Vz,time) recentering, cycle 4"};
Configurable<std::string> confRecentereVzTimeSp5{"confRecentereVzTimeSp5", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "TH3F path for (Vz,time) recentering, cycle 5"};
} confignewpro;
struct : ConfigurableGroup {
Configurable<bool> requireRCTFlagChecker{"requireRCTFlagChecker", true, "Check event quality in run condition table"};
Configurable<std::string> cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_hadronPID", "Evt sel: RCT flag checker label"};
Configurable<bool> cfgEvtRCTFlagCheckerZDCCheck{"cfgEvtRCTFlagCheckerZDCCheck", true, "Evt sel: RCT flag checker ZDC check"};
Configurable<bool> cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", false, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"};
} rctCut;
RCTFlagsChecker rctChecker;
void init(o2::framework::InitContext&)
{
rctChecker.init(rctCut.cfgEvtRCTFlagCheckerLabel, rctCut.cfgEvtRCTFlagCheckerZDCCheck, rctCut.cfgEvtRCTFlagCheckerLimitAcceptAsBad);
AxisSpec channelZDCAxis = {8, 0.0, 8.0, "ZDC tower"};
AxisSpec qxZDCAxis = {configbins.QxyNbins, configbins.lbinQxy, configbins.hbinQxy, "Qx"};
AxisSpec phiAxis = {configbins.PhiNbins, -6.28, 6.28, "phi"};
AxisSpec vzAxis = {configbins.VzNbins, configbins.lbinVz, configbins.hbinVz, "vz"};
AxisSpec vxAxis = {configbins.VxNbins, configbins.lbinVx, configbins.hbinVx, "vx"};
AxisSpec vyAxis = {configbins.VyNbins, configbins.lbinVy, configbins.hbinVy, "vy"};
AxisSpec centAxis = {configbins.CentNbins, configbins.lbinCent, configbins.hbinCent, "V0M (%)"};
AxisSpec vzfineAxis = {configbins.VzfineNbins, configbins.lfinebinVz, configbins.hfinebinVz, "vzfine"};
AxisSpec vxfineAxis = {configbins.VxfineNbins, configbins.lfinebinVx, configbins.hfinebinVx, "vxfine"};
AxisSpec vyfineAxis = {configbins.VyfineNbins, configbins.lfinebinVy, configbins.hfinebinVy, "vyfine"};
AxisSpec centfineAxis = {configbins.CentfineNbins, configbins.lfinebinCent, configbins.hfinebinCent, "V0M (%) fine"};
AxisSpec timefineAxis = {configbins.TimefineNbins, configbins.lfinebinTime, configbins.hfinebinTime, "timefine"};
AxisSpec shiftAxis = {10, 0, 10, "shift"};
AxisSpec basisAxis = {2, 0, 2, "basis"};
AxisSpec VxyAxis = {2, 0, 2, "Vxy"};
histos.add("htpcnsigmapi", "htpcnsigmapi", kTH1F, {{50, -10, 10.0}});
histos.add("hEvtSelInfo", "hEvtSelInfo", kTH1F, {{10, 0, 10.0}});
histos.add("hCentrality", "hCentrality", kTH1F, {{centfineAxis}});
histos.add("Vz", "Vz", kTH1F, {vzfineAxis});
histos.add("hpQxZDCAC", "hpQxZDCAC", kTProfile, {centfineAxis});
histos.add("hpQyZDCAC", "hpQyZDCAC", kTProfile, {centfineAxis});
histos.add("hpQxZDCAQyZDCC", "hpQxZDCAQyZDCC", kTProfile, {centfineAxis});
histos.add("hpQxZDCCQyZDCA", "hpQxZDCCQyZDCA", kTProfile, {centfineAxis});
if (!ispolarization) {
histos.add("hnQxZDCA", "hnQxZDCA", kTHnF, {{centAxis}, {vxAxis}, {vyAxis}, {vzAxis}, {qxZDCAxis}});
histos.add("hnQyZDCA", "hnQyZDCA", kTHnF, {{centAxis}, {vxAxis}, {vyAxis}, {vzAxis}, {qxZDCAxis}});
histos.add("hnQxZDCC", "hnQxZDCC", kTHnF, {{centAxis}, {vxAxis}, {vyAxis}, {vzAxis}, {qxZDCAxis}});
histos.add("hnQyZDCC", "hnQyZDCC", kTHnF, {{centAxis}, {vxAxis}, {vyAxis}, {vzAxis}, {qxZDCAxis}});
histos.add("hcentQxZDCA", "hcentQxZDCA", kTH2F, {{centfineAxis}, {qxZDCAxis}});
histos.add("hcentQyZDCA", "hcentQyZDCA", kTH2F, {{centfineAxis}, {qxZDCAxis}});
histos.add("hcentQxZDCC", "hcentQxZDCC", kTH2F, {{centfineAxis}, {qxZDCAxis}});
histos.add("hcentQyZDCC", "hcentQyZDCC", kTH2F, {{centfineAxis}, {qxZDCAxis}});
histos.add("hvxQxZDCA", "hvxQxZDCA", kTH2F, {{vxfineAxis}, {qxZDCAxis}});
histos.add("hvxQyZDCA", "hvxQyZDCA", kTH2F, {{vxfineAxis}, {qxZDCAxis}});
histos.add("hvxQxZDCC", "hvxQxZDCC", kTH2F, {{vxfineAxis}, {qxZDCAxis}});
histos.add("hvxQyZDCC", "hvxQyZDCC", kTH2F, {{vxfineAxis}, {qxZDCAxis}});
histos.add("hvyQxZDCA", "hvyQxZDCA", kTH2F, {{vyfineAxis}, {qxZDCAxis}});
histos.add("hvyQyZDCA", "hvyQyZDCA", kTH2F, {{vyfineAxis}, {qxZDCAxis}});
histos.add("hvyQxZDCC", "hvyQxZDCC", kTH2F, {{vyfineAxis}, {qxZDCAxis}});
histos.add("hvyQyZDCC", "hvyQyZDCC", kTH2F, {{vyfineAxis}, {qxZDCAxis}});
histos.add("hvzQxZDCA", "hvzQxZDCA", kTH2F, {{vzfineAxis}, {qxZDCAxis}});
histos.add("hvzQyZDCA", "hvzQyZDCA", kTH2F, {{vzfineAxis}, {qxZDCAxis}});
histos.add("hvzQxZDCC", "hvzQxZDCC", kTH2F, {{vzfineAxis}, {qxZDCAxis}});
histos.add("hvzQyZDCC", "hvzQyZDCC", kTH2F, {{vzfineAxis}, {qxZDCAxis}});
histos.add("htimeQxZDCA", "htimeQxZDCA", kTH2F, {{timefineAxis}, {qxZDCAxis}});
histos.add("htimeQyZDCA", "htimeQyZDCA", kTH2F, {{timefineAxis}, {qxZDCAxis}});
histos.add("htimeQxZDCC", "htimeQxZDCC", kTH2F, {{timefineAxis}, {qxZDCAxis}});
histos.add("htimeQyZDCC", "htimeQyZDCC", kTH2F, {{timefineAxis}, {qxZDCAxis}});
histos.add("pQxZDCAvsCentVzAfter",
"<Q_{x}^{ZNA}> after recentering;"
"centrality (%);V_{z} (cm);<Q_{x}^{ZNA}>",
kTProfile2D,
{centfineAxis, vzfineAxis});
histos.add("pQyZDCAvsCentVzAfter",
"<Q_{y}^{ZNA}> after recentering;"
"centrality (%);V_{z} (cm);<Q_{y}^{ZNA}>",
kTProfile2D,
{centfineAxis, vzfineAxis});
histos.add("pQxZDCCvsCentVzAfter",
"<Q_{x}^{ZNC}> after recentering;"
"centrality (%);V_{z} (cm);<Q_{x}^{ZNC}>",
kTProfile2D,
{centfineAxis, vzfineAxis});
histos.add("pQyZDCCvsCentVzAfter",
"<Q_{y}^{ZNC}> after recentering;"
"centrality (%);V_{z} (cm);<Q_{y}^{ZNC}>",
kTProfile2D,
{centfineAxis, vzfineAxis});
histos.add("pQxZDCAvsCentVyAfter",
"<Q_{x}^{ZNA}> after recentering;"
"centrality (%);V_{y} (cm);<Q_{x}^{ZNA}>",
kTProfile2D,
{centfineAxis, vyfineAxis});
histos.add("pQyZDCAvsCentVyAfter",
"<Q_{y}^{ZNA}> after recentering;"
"centrality (%);V_{y} (cm);<Q_{y}^{ZNA}>",
kTProfile2D,
{centfineAxis, vyfineAxis});
histos.add("pQxZDCCvsCentVyAfter",
"<Q_{x}^{ZNC}> after recentering;"
"centrality (%);V_{y} (cm);<Q_{x}^{ZNC}>",
kTProfile2D,
{centfineAxis, vyfineAxis});
histos.add("pQyZDCCvsCentVyAfter",
"<Q_{y}^{ZNC}> after recentering;"
"centrality (%);V_{y} (cm);<Q_{y}^{ZNC}>",
kTProfile2D,
{centfineAxis, vyfineAxis});
histos.add("pQxZDCAvsCentVxAfter",
"<Q_{x}^{ZNA}> after recentering;"
"centrality (%);V_{x} (cm);<Q_{x}^{ZNA}>",
kTProfile2D,
{centfineAxis, vxfineAxis});
histos.add("pQyZDCAvsCentVxAfter",
"<Q_{y}^{ZNA}> after recentering;"
"centrality (%);V_{x} (cm);<Q_{y}^{ZNA}>",
kTProfile2D,
{centfineAxis, vxfineAxis});
histos.add("pQxZDCCvsCentVxAfter",
"<Q_{x}^{ZNC}> after recentering;"
"centrality (%);V_{x} (cm);<Q_{x}^{ZNC}>",
kTProfile2D,
{centfineAxis, vxfineAxis});
histos.add("pQyZDCCvsCentVxAfter",
"<Q_{y}^{ZNC}> after recentering;"
"centrality (%);V_{x} (cm);<Q_{y}^{ZNC}>",
kTProfile2D,
{centfineAxis, vxfineAxis});
histos.add("pQxZDCAvsVyVxAfter",
"<Q_{x}^{ZNA}> after recentering;"
"V_{y};V_{x} (cm);<Q_{x}^{ZNA}>",
kTProfile2D,
{vyfineAxis, vxfineAxis});
histos.add("pQyZDCAvsVyVxAfter",
"<Q_{y}^{ZNA}> after recentering;"
"V_{y};V_{x} (cm);<Q_{y}^{ZNA}>",
kTProfile2D,
{vyfineAxis, vxfineAxis});
histos.add("pQxZDCCvsVyVxAfter",
"<Q_{x}^{ZNC}> after recentering;"
"V_{y};V_{x} (cm);<Q_{x}^{ZNC}>",
kTProfile2D,
{vyfineAxis, vxfineAxis});
histos.add("pQyZDCCvsVyVxAfter",
"<Q_{y}^{ZNC}> after recentering;"
"V_{y};V_{x} (cm);<Q_{y}^{ZNC}>",
kTProfile2D,
{vyfineAxis, vxfineAxis});
histos.add("pQxZDCAvsCentTimeAfter",
"<Q_{x}^{ZNA}> after recentering;"
"centrality (%);Time (min);<Q_{x}^{ZNA}>",
kTProfile2D,
{centfineAxis, timefineAxis});
histos.add("pQyZDCAvsCentTimeAfter",
"<Q_{y}^{ZNA}> after recentering;"
"centrality (%);Time (min);<Q_{y}^{ZNA}>",
kTProfile2D,
{centfineAxis, timefineAxis});
histos.add("pQxZDCCvsCentTimeAfter",
"<Q_{x}^{ZNC}> after recentering;"
"centrality (%);Time (min);<Q_{x}^{ZNC}>",
kTProfile2D,
{centfineAxis, timefineAxis});
histos.add("pQyZDCCvsCentTimeAfter",
"<Q_{y}^{ZNC}> after recentering;"
"centrality (%);Time (min);<Q_{y}^{ZNC}>",
kTProfile2D,
{centfineAxis, timefineAxis});
histos.add("pQxZDCAvsVzTimeAfter",
"<Q_{x}^{ZNA}> after recentering;"
"vz (cm);Time (min);<Q_{x}^{ZNA}>",
kTProfile2D,
{vzfineAxis, timefineAxis});
histos.add("pQyZDCAvsVzTimeAfter",
"<Q_{y}^{ZNA}> after recentering;"
"vz (cm);Time (min);<Q_{y}^{ZNA}>",
kTProfile2D,
{vzfineAxis, timefineAxis});
histos.add("pQxZDCCvsVzTimeAfter",
"<Q_{x}^{ZNC}> after recentering;"
"vz (cm);Time (min);<Q_{x}^{ZNC}>",
kTProfile2D,
{vzfineAxis, timefineAxis});
histos.add("pQyZDCCvsVzTimeAfter",
"<Q_{y}^{ZNC}> after recentering;"
"vz (cm);Time (min);<Q_{y}^{ZNC}>",
kTProfile2D,
{vzfineAxis, timefineAxis});
}
histos.add("PsiZDCC", "PsiZDCC", kTH2F, {centfineAxis, phiAxis});
histos.add("PsiZDCA", "PsiZDCA", kTH2F, {centfineAxis, phiAxis});
histos.add("ZDCAmp", "ZDCAmp", kTProfile2D, {channelZDCAxis, vzfineAxis});
histos.add("ZDCAmpCommon", "ZDCAmpCommon", kTProfile2D, {{2, 0.0, 2.0}, vzfineAxis});
histos.add("ShiftZDCC", "ShiftZDCC", kTProfile3D, {centfineAxis, basisAxis, shiftAxis});
histos.add("ShiftZDCA", "ShiftZDCA", kTProfile3D, {centfineAxis, basisAxis, shiftAxis});
histos.add("hpCosPsiAPsiC", "hpCosPsiAPsiC", kTProfile, {centfineAxis});
histos.add("hpSinPsiAPsiC", "hpSinPsiAPsiC", kTProfile, {centfineAxis});
histos.add("AvgVxy", "AvgVxy", kTProfile, {VxyAxis});
histos.add("hpQxZDCAvstime", "hpQxZDCAvstime", kTProfile, {{timefineAxis}});
histos.add("hpQxZDCCvstime", "hpQxZDCCvstime", kTProfile, {{timefineAxis}});
histos.add("hpQyZDCAvstime", "hpQyZDCAvstime", kTProfile, {{timefineAxis}});
histos.add("hpQyZDCCvstime", "hpQyZDCCvstime", kTProfile, {{timefineAxis}});
ccdb->setURL(cfgCcdbParam.cfgURL);
ccdb->setCaching(true);
ccdb->setLocalObjectValidityChecking();
ccdb->setCreatedNotAfter(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count());
}
int currentRunNumber = -999;
int lastRunNumber = -999;
TH2D* gainprofile = nullptr;
TProfile* gainprofilevxy = nullptr;
std::array<THnF*, 6> hrecentereSpA; // Array of 6 histograms
std::array<TH2F*, 6> hrecenterecentSpA; // Array of 5 histograms
std::array<TH2F*, 6> hrecenterevxSpA; // Array of 5 histograms
std::array<TH2F*, 6> hrecenterevySpA; // Array of 5 histograms
std::array<TH2F*, 6> hrecenterevzSpA; // Array of 5 histograms
TProfile3D* shiftprofileA = nullptr;
TProfile3D* shiftprofileC = nullptr;
TH2F* hrecentereTimeSp1 = nullptr;
TH2F* hrecentereTimeSp2 = nullptr;
TH2F* hrecentereTimeSp3 = nullptr;
// One payload for each of the five iterations.
std::array<TH3F*, 6> hrecenterecentvxSpA{};
std::array<TH3F*, 6> hrecenterecentvySpA{};
std::array<TH3F*, 6> hrecenterecentvzSpA{};
std::array<TH3F*, 5> hrecenterevztimeSpA{};
bool CorrectfineCent(TH2F* hrecenterecentSp,
auto centrality,
auto& qxZDCA,
auto& qyZDCA,
auto& qxZDCC,
auto& qyZDCC)
{
if (!hrecenterecentSp) {
return false;
}
const double meanxAcent = hrecenterecentSp->GetBinContent(
hrecenterecentSp->FindBin(centrality + 0.00001, 0.5));
const double meanyAcent = hrecenterecentSp->GetBinContent(
hrecenterecentSp->FindBin(centrality + 0.00001, 1.5));
const double meanxCcent = hrecenterecentSp->GetBinContent(
hrecenterecentSp->FindBin(centrality + 0.00001, 2.5));
const double meanyCcent = hrecenterecentSp->GetBinContent(
hrecenterecentSp->FindBin(centrality + 0.00001, 3.5));
qxZDCA -= meanxAcent;
qyZDCA -= meanyAcent;
qxZDCC -= meanxCcent;
qyZDCC -= meanyCcent;
return true;
}
bool CorrectfineCentVx(TH3F* hrecenterecentvxSp,
auto centrality,
auto vx,
auto& qxZDCA,
auto& qyZDCA,
auto& qxZDCC,
auto& qyZDCC)
{
if (!hrecenterecentvxSp) {
return false;
}
const double meanxAcentvx = hrecenterecentvxSp->GetBinContent(
hrecenterecentvxSp->FindBin(centrality + 0.00001, vx + 0.00001, 0.5));
const double meanyAcentvx = hrecenterecentvxSp->GetBinContent(
hrecenterecentvxSp->FindBin(centrality + 0.00001, vx + 0.00001, 1.5));
const double meanxCcentvx = hrecenterecentvxSp->GetBinContent(
hrecenterecentvxSp->FindBin(centrality + 0.00001, vx + 0.00001, 2.5));
const double meanyCcentvx = hrecenterecentvxSp->GetBinContent(
hrecenterecentvxSp->FindBin(centrality + 0.00001, vx + 0.00001, 3.5));
qxZDCA -= meanxAcentvx;
qyZDCA -= meanyAcentvx;
qxZDCC -= meanxCcentvx;
qyZDCC -= meanyCcentvx;
return true;
}
bool CorrectfineCentVy(TH3F* hrecenterecentvySp,
auto centrality,
auto vy,
auto& qxZDCA,
auto& qyZDCA,
auto& qxZDCC,
auto& qyZDCC)
{
if (!hrecenterecentvySp) {
return false;
}
const double meanxAcentvy = hrecenterecentvySp->GetBinContent(
hrecenterecentvySp->FindBin(centrality + 0.00001, vy + 0.00001, 0.5));
const double meanyAcentvy = hrecenterecentvySp->GetBinContent(
hrecenterecentvySp->FindBin(centrality + 0.00001, vy + 0.00001, 1.5));
const double meanxCcentvy = hrecenterecentvySp->GetBinContent(
hrecenterecentvySp->FindBin(centrality + 0.00001, vy + 0.00001, 2.5));
const double meanyCcentvy = hrecenterecentvySp->GetBinContent(
hrecenterecentvySp->FindBin(centrality + 0.00001, vy + 0.00001, 3.5));
qxZDCA -= meanxAcentvy;
qyZDCA -= meanyAcentvy;
qxZDCC -= meanxCcentvy;
qyZDCC -= meanyCcentvy;
return true;
}
bool CorrectfineCentVz(TH3F* hrecenterecentvzSp,
auto centrality,
auto vz,
auto& qxZDCA,
auto& qyZDCA,
auto& qxZDCC,
auto& qyZDCC)
{
if (!hrecenterecentvzSp) {
return false;
}
const double meanxAcentvz = hrecenterecentvzSp->GetBinContent(
hrecenterecentvzSp->FindBin(centrality + 0.00001, vz + 0.00001, 0.5));
const double meanyAcentvz = hrecenterecentvzSp->GetBinContent(
hrecenterecentvzSp->FindBin(centrality + 0.00001, vz + 0.00001, 1.5));
const double meanxCcentvz = hrecenterecentvzSp->GetBinContent(
hrecenterecentvzSp->FindBin(centrality + 0.00001, vz + 0.00001, 2.5));
const double meanyCcentvz = hrecenterecentvzSp->GetBinContent(
hrecenterecentvzSp->FindBin(centrality + 0.00001, vz + 0.00001, 3.5));
qxZDCA -= meanxAcentvz;
qyZDCA -= meanyAcentvz;
qxZDCC -= meanxCcentvz;
qyZDCC -= meanyCcentvz;
return true;
}
bool Correctcoarse(const THnF* hrecentereSp, auto centrality, auto vx, auto vy, auto vz, auto& qxZDCA, auto& qyZDCA, auto& qxZDCC, auto& qyZDCC)
{
int binCoords[5];
// Get axes of the THnSparse
TAxis* centralityAxis = hrecentereSp->GetAxis(0); // Axis 0: centrality
TAxis* vxAxis = hrecentereSp->GetAxis(1); // Axis 1: vx
TAxis* vyAxis = hrecentereSp->GetAxis(2); // Axis 2: vy
TAxis* vzAxis = hrecentereSp->GetAxis(3); // Axis 3: vz
TAxis* channelAxis = hrecentereSp->GetAxis(4); // Axis 4: channel
// Find bin indices for centrality, vx, vy, vz, and channel (for meanxA, 0.5)
binCoords[0] = centralityAxis->FindBin(centrality + 0.00001); // Centrality
binCoords[1] = vxAxis->FindBin(vx + 0.00001); // vx
binCoords[2] = vyAxis->FindBin(vy + 0.00001); // vy
binCoords[3] = vzAxis->FindBin(vz + 0.00001); // vz
binCoords[4] = channelAxis->FindBin(0.5); // Channel for meanxA
// Get the global bin for meanxA
int globalBinMeanxA = hrecentereSp->GetBin(binCoords);
float meanxA = hrecentereSp->GetBinContent(globalBinMeanxA);
// Repeat for other channels (meanyA, meanxC, meanyC)
binCoords[4] = channelAxis->FindBin(1.5); // Channel for meanyA
int globalBinMeanyA = hrecentereSp->GetBin(binCoords);
float meanyA = hrecentereSp->GetBinContent(globalBinMeanyA);
binCoords[4] = channelAxis->FindBin(2.5); // Channel for meanxC
int globalBinMeanxC = hrecentereSp->GetBin(binCoords);
float meanxC = hrecentereSp->GetBinContent(globalBinMeanxC);
binCoords[4] = channelAxis->FindBin(3.5); // Channel for meanyC
int globalBinMeanyC = hrecentereSp->GetBin(binCoords);
float meanyC = hrecentereSp->GetBinContent(globalBinMeanyC);
qxZDCA = qxZDCA - meanxA;
qyZDCA = qyZDCA - meanyA;
qxZDCC = qxZDCC - meanxC;
qyZDCC = qyZDCC - meanyC;
return kTRUE;
}
bool Correctfine(TH2F* hrecenterecentSp, TH2F* hrecenterevxSp, TH2F* hrecenterevySp, TH2F* hrecenterevzSp, auto centrality, auto vx, auto vy, auto vz, auto& qxZDCA, auto& qyZDCA, auto& qxZDCC, auto& qyZDCC)
{
if (!hrecenterecentSp || !hrecenterevxSp || !hrecenterevySp || !hrecenterevzSp) {
std::cerr << "Error: One or more histograms are null." << std::endl;
return false;
}
double meanxAcent = hrecenterecentSp->GetBinContent(hrecenterecentSp->FindBin(centrality + 0.00001, 0.5));
double meanyAcent = hrecenterecentSp->GetBinContent(hrecenterecentSp->FindBin(centrality + 0.00001, 1.5));
double meanxCcent = hrecenterecentSp->GetBinContent(hrecenterecentSp->FindBin(centrality + 0.00001, 2.5));
double meanyCcent = hrecenterecentSp->GetBinContent(hrecenterecentSp->FindBin(centrality + 0.00001, 3.5));
double meanxAvx = hrecenterevxSp->GetBinContent(hrecenterevxSp->FindBin(vx + 0.00001, 0.5));
double meanyAvx = hrecenterevxSp->GetBinContent(hrecenterevxSp->FindBin(vx + 0.00001, 1.5));
double meanxCvx = hrecenterevxSp->GetBinContent(hrecenterevxSp->FindBin(vx + 0.00001, 2.5));
double meanyCvx = hrecenterevxSp->GetBinContent(hrecenterevxSp->FindBin(vx + 0.00001, 3.5));
double meanxAvy = hrecenterevySp->GetBinContent(hrecenterevySp->FindBin(vy + 0.00001, 0.5));
double meanyAvy = hrecenterevySp->GetBinContent(hrecenterevySp->FindBin(vy + 0.00001, 1.5));
double meanxCvy = hrecenterevySp->GetBinContent(hrecenterevySp->FindBin(vy + 0.00001, 2.5));
double meanyCvy = hrecenterevySp->GetBinContent(hrecenterevySp->FindBin(vy + 0.00001, 3.5));
double meanxAvz = hrecenterevzSp->GetBinContent(hrecenterevzSp->FindBin(vz + 0.00001, 0.5));
double meanyAvz = hrecenterevzSp->GetBinContent(hrecenterevzSp->FindBin(vz + 0.00001, 1.5));
double meanxCvz = hrecenterevzSp->GetBinContent(hrecenterevzSp->FindBin(vz + 0.00001, 2.5));
double meanyCvz = hrecenterevzSp->GetBinContent(hrecenterevzSp->FindBin(vz + 0.00001, 3.5));
qxZDCA = qxZDCA - meanxAcent - meanxAvx - meanxAvy - meanxAvz;
qyZDCA = qyZDCA - meanyAcent - meanyAvx - meanyAvy - meanyAvz;
qxZDCC = qxZDCC - meanxCcent - meanxCvx - meanxCvy - meanxCvz;
qyZDCC = qyZDCC - meanyCcent - meanyCvx - meanyCvy - meanyCvz;
return kTRUE;
}
bool Correcttime(TH2F* hrecentereTimeSp,
auto timeMin,
auto& qxZDCA,
auto& qyZDCA,
auto& qxZDCC,
auto& qyZDCC)
{
if (!hrecentereTimeSp) {
return false;
}
double meanxA = hrecentereTimeSp->GetBinContent(hrecentereTimeSp->FindBin(timeMin + 1.e-7, 0.5));
double meanyA = hrecentereTimeSp->GetBinContent(hrecentereTimeSp->FindBin(timeMin + 1.e-7, 1.5));
double meanxC = hrecentereTimeSp->GetBinContent(hrecentereTimeSp->FindBin(timeMin + 1.e-7, 2.5));
double meanyC = hrecentereTimeSp->GetBinContent(hrecentereTimeSp->FindBin(timeMin + 1.e-7, 3.5));
qxZDCA -= meanxA;
qyZDCA -= meanyA;
qxZDCC -= meanxC;
qyZDCC -= meanyC;
return true;
}
bool CorrectfineVzTime(TH3F* hrecenterevstimeSp,
auto vz,
auto timeMin,
auto& qxZDCA,
auto& qyZDCA,
auto& qxZDCC,
auto& qyZDCC)
{
if (!hrecenterevstimeSp) {
return false;
}
// Payload axes:
// X = Vz
// Y = time from run start
// Z = component
// component channels:
// 0.5 = Qx ZNA
// 1.5 = Qy ZNA
// 2.5 = Qx ZNC
// 3.5 = Qy ZNC
const double meanxAvstime = hrecenterevstimeSp->GetBinContent(
hrecenterevstimeSp->FindBin(vz + 0.00001, timeMin + 0.00001, 0.5));
const double meanyAvstime = hrecenterevstimeSp->GetBinContent(
hrecenterevstimeSp->FindBin(vz + 0.00001, timeMin + 0.00001, 1.5));
const double meanxCvstime = hrecenterevstimeSp->GetBinContent(
hrecenterevstimeSp->FindBin(vz + 0.00001, timeMin + 0.00001, 2.5));
const double meanyCvstime = hrecenterevstimeSp->GetBinContent(
hrecenterevstimeSp->FindBin(vz + 0.00001, timeMin + 0.00001, 3.5));
qxZDCA -= meanxAvstime;
qyZDCA -= meanyAvstime;
qxZDCC -= meanxCvstime;
qyZDCC -= meanyCvstime;
return true;
}
using BCsRun3 = soa::Join<aod::BCsWithTimestamps, aod::Run3MatchedToBCSparse>;
using MyCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::FT0sCorrected, aod::CentFT0Cs>;
Preslice<aod::Zdcs> zdcPerCollision = aod::collision::bcId;
void process(MyCollisions::iterator const& collision, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0s*/, BCsRun3 const& bcs, aod::Zdcs const&)
{
histos.fill(HIST("hEvtSelInfo"), 0.5);
auto centrality = collision.centFT0C();
bool triggerevent = false;
if (bcs.size() != 0) {
gRandom->SetSeed(bcs.iteratorAt(0).globalBC());
}
currentRunNumber = collision.foundBC_as<BCsRun3>().runNumber();
auto vz = collision.posZ();
auto vx = collision.posX();
auto vy = collision.posY();
double psiZDCC = -99;
double psiZDCA = -99;
auto qxZDCA = 0.0;
auto qxZDCC = 0.0;
auto qyZDCA = 0.0;
auto qyZDCC = 0.0;
auto sumA = 0.0;
auto sumC = 0.0;
auto bc = collision.foundBC_as<BCsRun3>();
if (!bc.has_zdc()) {
triggerevent = false;
spcalibrationtable(triggerevent, currentRunNumber, centrality, vx, vy, vz, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, qxZDCA, qxZDCC, qyZDCA, qyZDCC, psiZDCC, psiZDCA);
return;
}
histos.fill(HIST("hEvtSelInfo"), 1.5);
const uint64_t timestampzdc = bc.timestamp(); // in milliseconds
// Convert timestamp to hours from run start (approximate)
// Store first timestamp of run to calculate relative time
static std::unordered_map<int, uint64_t> runStartTime;
if (runStartTime.find(currentRunNumber) == runStartTime.end()) {
// runStartTime[currentRunNumber] = timestampzdc;
runStartTime.try_emplace(currentRunNumber, timestampzdc);
}
double timeMin = (timestampzdc - runStartTime[currentRunNumber]) / 60000.0; // ms -> minutes
auto zdc = bc.zdc();
auto zncEnergy = zdc.energySectorZNC();
auto znaEnergy = zdc.energySectorZNA();
auto zncEnergycommon = zdc.energyCommonZNC();
auto znaEnergycommon = zdc.energyCommonZNA();
auto beamEne = 5.36 * 0.5;
if (znaEnergycommon <= 0.0 || zncEnergycommon <= 0.0) {
triggerevent = false;
spcalibrationtable(triggerevent, currentRunNumber, centrality, vx, vy, vz, znaEnergycommon, zncEnergycommon, znaEnergy[0], znaEnergy[1], znaEnergy[2], znaEnergy[3], zncEnergy[0], zncEnergy[1], zncEnergy[2], zncEnergy[3], qxZDCA, qxZDCC, qyZDCA, qyZDCC, psiZDCC, psiZDCA);
return;
}
histos.fill(HIST("hEvtSelInfo"), 2.5);
if (znaEnergy[0] <= 0.0 || znaEnergy[1] <= 0.0 || znaEnergy[2] <= 0.0 || znaEnergy[3] <= 0.0) {
triggerevent = false;
spcalibrationtable(triggerevent, currentRunNumber, centrality, vx, vy, vz, znaEnergycommon, zncEnergycommon, znaEnergy[0], znaEnergy[1], znaEnergy[2], znaEnergy[3], zncEnergy[0], zncEnergy[1], zncEnergy[2], zncEnergy[3], qxZDCA, qxZDCC, qyZDCA, qyZDCC, psiZDCC, psiZDCA);
return;
}
histos.fill(HIST("hEvtSelInfo"), 3.5);
if (zncEnergy[0] <= 0.0 || zncEnergy[1] <= 0.0 || zncEnergy[2] <= 0.0 || zncEnergy[3] <= 0.0) {
triggerevent = false;
spcalibrationtable(triggerevent, currentRunNumber, centrality, vx, vy, vz, znaEnergycommon, zncEnergycommon, znaEnergy[0], znaEnergy[1], znaEnergy[2], znaEnergy[3], zncEnergy[0], zncEnergy[1], zncEnergy[2], zncEnergy[3], qxZDCA, qxZDCC, qyZDCA, qyZDCC, psiZDCC, psiZDCA);
return;
}
histos.fill(HIST("hEvtSelInfo"), 4.5);
if (rctCut.requireRCTFlagChecker && !rctChecker(collision)) {
triggerevent = false;
spcalibrationtable(triggerevent, currentRunNumber, centrality, vx, vy, vz, znaEnergycommon, zncEnergycommon, znaEnergy[0], znaEnergy[1], znaEnergy[2], znaEnergy[3], zncEnergy[0], zncEnergy[1], zncEnergy[2], zncEnergy[3], qxZDCA, qxZDCC, qyZDCA, qyZDCC, psiZDCC, psiZDCA);
return;
}
histos.fill(HIST("hEvtSelInfo"), 5.5);
if (additionalEvSel && (!collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) {
triggerevent = false;
spcalibrationtable(triggerevent, currentRunNumber, centrality, vx, vy, vz, znaEnergycommon, zncEnergycommon, znaEnergy[0], znaEnergy[1], znaEnergy[2], znaEnergy[3], zncEnergy[0], zncEnergy[1], zncEnergy[2], zncEnergy[3], qxZDCA, qxZDCC, qyZDCA, qyZDCC, psiZDCC, psiZDCA);
return;
}
histos.fill(HIST("hEvtSelInfo"), 6.5);
if (collision.sel8() && centrality > cfgCutCentralityMin && centrality < cfgCutCentralityMax && TMath::Abs(vz) < cfgCutVertex && collision.has_foundFT0() && collision.selection_bit(aod::evsel::kNoTimeFrameBorder) && collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) {
triggerevent = true;
if (useGainCallib && (currentRunNumber != lastRunNumber)) {
gainprofile = ccdb->getForTimeStamp<TH2D>(ConfGainPath.value, bc.timestamp());
}
histos.fill(HIST("hEvtSelInfo"), 7.5);
auto gainequal = 1.0;
auto alphaZDC = 0.395;
constexpr double x[4] = {-1.75, 1.75, -1.75, 1.75};
constexpr double y[4] = {-1.75, -1.75, 1.75, 1.75};
double zncEnergycommonsum = 0.0;
double znaEnergycommonsum = 0.0;
histos.fill(HIST("ZDCAmpCommon"), 0.5, vz, znaEnergycommon);
histos.fill(HIST("ZDCAmpCommon"), 1.5, vz, zncEnergycommon);
for (std::size_t iChA = 0; iChA < 8; iChA++) {
auto chanelid = iChA;
if (useGainCallib && gainprofile) {
gainequal = gainprofile->GetBinContent(gainprofile->FindBin(vz + 0.00001, chanelid + 0.5));
}
if (iChA < 4) {
if (znaEnergy[iChA] <= 0.0) {
triggerevent = false;
spcalibrationtable(triggerevent, currentRunNumber, centrality, vx, vy, vz, znaEnergycommon, zncEnergycommon, znaEnergy[0], znaEnergy[1], znaEnergy[2], znaEnergy[3], zncEnergy[0], zncEnergy[1], zncEnergy[2], zncEnergy[3], qxZDCA, qxZDCC, qyZDCA, qyZDCC, psiZDCC, psiZDCA);
return;
} else {
double ampl = gainequal * znaEnergy[iChA];
znaEnergycommonsum += ampl;
if (followpub) {
ampl = TMath::Power(ampl, alphaZDC);
}
qxZDCA = qxZDCA - ampl * x[iChA];
qyZDCA = qyZDCA + ampl * y[iChA];
sumA = sumA + ampl;
histos.fill(HIST("ZDCAmp"), chanelid + 0.5, vz, ampl);
}
} else {
if (zncEnergy[iChA - 4] <= 0.0) {
triggerevent = false;
spcalibrationtable(triggerevent, currentRunNumber, centrality, vx, vy, vz, znaEnergycommon, zncEnergycommon, znaEnergy[0], znaEnergy[1], znaEnergy[2], znaEnergy[3], zncEnergy[0], zncEnergy[1], zncEnergy[2], zncEnergy[3], qxZDCA, qxZDCC, qyZDCA, qyZDCC, psiZDCC, psiZDCA);
return;
} else {
double ampl = gainequal * zncEnergy[iChA - 4];
zncEnergycommonsum += ampl;
if (followpub) {
ampl = TMath::Power(ampl, alphaZDC);
}
qxZDCC = qxZDCC + ampl * x[iChA - 4];
qyZDCC = qyZDCC + ampl * y[iChA - 4];
sumC = sumC + ampl;
histos.fill(HIST("ZDCAmp"), chanelid + 0.5, vz, ampl);
}
}
}
auto cZNC = 1.0;
auto cZNA = 1.0;
if (sumA > 0) {
float nSpecnA = znaEnergycommonsum / beamEne;
if (usecfactor)
cZNA = 1.89358 - 0.71262 / (nSpecnA + 0.71789);
else
cZNA = 1.0;
qxZDCA = cZNA * (qxZDCA / sumA);
qyZDCA = cZNA * (qyZDCA / sumA);
}
if (sumC > 0) {
float nSpecnC = zncEnergycommonsum / beamEne;
if (usecfactor)
cZNC = 1.89358 - 0.71262 / (nSpecnC + 0.71789);
else
cZNC = 1.0;
qxZDCC = cZNC * (qxZDCC / sumC);
qyZDCC = cZNC * (qyZDCC / sumC);
}
if (sumA <= 1e-4 || sumC <= 1e-4) {
qxZDCA = 0.0;
qxZDCC = 0.0;
qyZDCA = 0.0;
qyZDCC = 0.0;
triggerevent = false;
spcalibrationtable(triggerevent, currentRunNumber, centrality, vx, vy, vz, znaEnergycommon, zncEnergycommon, znaEnergy[0], znaEnergy[1], znaEnergy[2], znaEnergy[3], zncEnergy[0], zncEnergy[1], zncEnergy[2], zncEnergy[3], qxZDCA, qxZDCC, qyZDCA, qyZDCC, psiZDCC, psiZDCA);
return;
}
histos.fill(HIST("hEvtSelInfo"), 8.5);
histos.fill(HIST("hCentrality"), centrality);
histos.fill(HIST("Vz"), vz);
histos.fill(HIST("AvgVxy"), 0.5, vx);
histos.fill(HIST("AvgVxy"), 1.5, vy);
if (useCallibvertex && (currentRunNumber != lastRunNumber)) {
gainprofilevxy = ccdb->getForTimeStamp<TProfile>(ConfGainPathvxy.value, bc.timestamp());
}
if (useCallibvertex) {
vx = vx - gainprofilevxy->GetBinContent(1);
vy = vy - gainprofilevxy->GetBinContent(2);
}
bool res = false;
bool resfine = false;
int check = 1;
if (useoldrecentering) {
if (coarse1) {
if (useRecentereSp && (currentRunNumber != lastRunNumber)) {
hrecentereSpA[0] = ccdb->getForTimeStamp<THnF>(ConfRecentereSp.value, bc.timestamp());
}
res = Correctcoarse(hrecentereSpA[0], centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC);
}
if (fine1) {
if (useRecenterefineSp && (currentRunNumber != lastRunNumber)) {
hrecenterecentSpA[0] = ccdb->getForTimeStamp<TH2F>(ConfRecenterecentSp.value, bc.timestamp());
hrecenterevxSpA[0] = ccdb->getForTimeStamp<TH2F>(ConfRecenterevxSp.value, bc.timestamp());
hrecenterevySpA[0] = ccdb->getForTimeStamp<TH2F>(ConfRecenterevySp.value, bc.timestamp());
hrecenterevzSpA[0] = ccdb->getForTimeStamp<TH2F>(ConfRecenterevzSp.value, bc.timestamp());
}
resfine = Correctfine(hrecenterecentSpA[0], hrecenterevxSpA[0], hrecenterevySpA[0], hrecenterevzSpA[0], centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC);
}
if (finetime1 && (currentRunNumber != lastRunNumber)) {
hrecentereTimeSp1 = ccdb->getForTimeStamp<TH2F>(confRecentereTimeSp1.value, bc.timestamp());
}
bool restime = false;
if (useTimeRecentering) {
restime = Correcttime(hrecentereTimeSp1, timeMin, qxZDCA, qyZDCA, qxZDCC, qyZDCC);
}
if (coarse2) {
if (useRecentereSp && (currentRunNumber != lastRunNumber)) {