2121#include < cmath>
2222#include < cstdlib>
2323// #include <iostream>
24+ #include < iostream>
2425#include < memory>
2526#include < string>
2627#include < vector>
@@ -132,31 +133,33 @@ struct F0980pbpbanalysis {
132133 Configurable<std::string> cfgQvecRefBName{" cfgQvecRefBName" , " TPCneg" , " The name of detector for reference B" };
133134
134135 // Rotational Background Configurables
135- Configurable<bool > cfgBkgRotSel{" cfgBkgRotSel" , true , " flag to construct rotational backgrounds" };
136- Configurable<int > cfgBkgRotNum{" cfgBkgRotNum" , 10 , " the number of rotational backgrounds" };
136+ Configurable<bool > cfgBkgRotSel{" cfgBkgRotSel" , false , " flag to construct rotational backgrounds" };
137+ Configurable<int > cfgBkgRotNum{" cfgBkgRotNum" , 5 , " the number of rotational backgrounds" };
137138
138139 // Mixed Event Background Configurables
139140 SliceCache cache;
140- Configurable<int > cfgBkgMixedNum{" cfgBkgMixedNum" , 10 , " Number of mixed events per event" };
141+ Configurable<int > cfgBkgMixedNum{" cfgBkgMixedNum" , 5 , " Number of mixed events per event" };
141142 ConfigurableAxis mixAxisVertex{" mixAxisVertex" , {10 , -10 , 10 }, " Vertex axis for mixing bin" };
142143 ConfigurableAxis mixAxisCent{" mixAxisCent" , {VARIABLE_WIDTH, 0 , 10 , 20 , 50 , 100 }, " multiplicity percentile for mixing bin" };
143144 // ConfigurableAxis mixingAxisMultiplicity{"mixingAxisMultiplicity", {2000, 0, 10000}, "TPC multiplicity for bin"};
144145
145146 // List Configurables
146147 Configurable<int > cfgListPID{" cfgListPID" , 0 , " PID selection type" };
147148 Configurable<int > cfgListPtl{" cfgListPtl" , 0 , " Particle selection type" };
148- Configurable<int > cfgListPair{" cfgListPair" , 2 , " Pair selection type" };
149149
150150 // Histogram QA Configurables
151151 Configurable<bool > cfgQAEventCut{" cfgQAEventCut" , true , " Enable Event QA Hists" };
152152 Configurable<bool > cfgQATrackCut{" cfgQATrackCut" , true , " Enable Track QA Hists" };
153153 Configurable<bool > cfgQAPIDCut{" cfgQAPIDCut" , true , " Enable PID QA Hists" };
154154 Configurable<bool > cfgQAEPCut{" cfgQAEPCut" , true , " Enable Event Plane QA Hists" };
155+ Configurable<bool > cfgQAEventFlowCut{" cfgQAEventFlowCut" , true , " Enable Event Flow QA Hists" };
155156
156157 ConfigurableAxis histAxisDCAz{" histAxisDCAz" , {40 , -0.2 , 0.2 }, " DCAz axis" };
157158 ConfigurableAxis histAxisDCAr{" histAxisDCAr" , {40 , -0.2 , 0.2 }, " DCAxy axis" };
158159 ConfigurableAxis histAxisOccupancy{" histAxisOccupancy" , {100 , 0.0 , 20000 }, " Occupancy axis" };
159160
161+ Configurable<bool > cfgAnalysisMethod{" cfgAnalysisMethod" , true , " true: Two for-loop, false: Combination" };
162+
160163 // Configurable for axis
161164 ConfigurableAxis axisMass{" axisMass" , {400 , 0.2 , 2.2 }, " Invariant mass axis" };
162165 ConfigurableAxis axisPT{" axisPT" , {VARIABLE_WIDTH, 0.0 , 0.1 , 0.2 , 0.3 , 0.4 , 0.5 , 0.6 , 0.8 , 1.0 , 1.5 , 2.0 , 2.5 , 3.0 , 3.5 , 4.0 , 4.5 , 5.0 , 6.0 , 7.0 , 8.0 , 10.0 , 13.0 , 20.0 }, " Transverse momentum Binning" };
@@ -217,18 +220,11 @@ struct F0980pbpbanalysis {
217220 PtlKaon = 1 ,
218221 };
219222
220- enum IndexSelList {
221- None = 0 ,
222- woSame = 1 ,
223- leq = 2
224- };
225-
226223 enum QAList {
227224 QAEvent = 1 ,
228225 QAEP = 2 ,
229226 QATrack = 3 ,
230227 QAPID = 4 ,
231- QAPIDS = 5
232228 };
233229
234230 TRandom* rn = new TRandom();
@@ -329,13 +325,6 @@ struct F0980pbpbanalysis {
329325 histos.fill (HIST (" PIDQA/TPC_TOF_AC" ), getTpcNSigma (obj), getTofNSigma (obj));
330326 }
331327 }
332- if (objecttype == QAPIDS) {
333- if (pass) {
334- histos.fill (HIST (" PIDQA/Nsigma_TPC_selected" ), obj.pt (), getTpcNSigma (obj));
335- histos.fill (HIST (" PIDQA/Nsigma_TOF_selected" ), obj.pt (), getTofNSigma (obj));
336- histos.fill (HIST (" PIDQA/TPC_TOF_selected" ), getTpcNSigma (obj), getTofNSigma (obj));
337- }
338- }
339328 }
340329 }
341330
@@ -346,36 +335,50 @@ struct F0980pbpbanalysis {
346335 fillQA (false , collision, 1 );
347336 if (cfgQAEPCut && QA)
348337 fillQA (false , collision, 2 );
338+ // if (cfgQAEventFlowCut) histos.fill(HIST("EventQA/hnEvents"), 0);
349339 //
350- // histos.fill(HIST("EventQA/hnEvents"), 0);
351340 if (std::abs (collision.posZ ()) > cfgEventCutVertex) {
352341 return 0 ;
353342 }
354- histos.fill (HIST (" EventQA/hnEvents" ), 1 );
343+ if (cfgQAEventFlowCut && QA)
344+ histos.fill (HIST (" EventQA/hnEvents" ), 1 );
345+
355346 if (!collision.sel8 ()) {
356347 return 0 ;
357348 }
358- histos.fill (HIST (" EventQA/hnEvents" ), 2 );
349+ if (cfgQAEventFlowCut && QA)
350+ histos.fill (HIST (" EventQA/hnEvents" ), 2 );
351+
359352 if (cfgEventGoodZvtxSel && !collision.selection_bit (aod::evsel::kIsGoodZvtxFT0vsPV )) {
360353 return 0 ;
361354 }
362- histos.fill (HIST (" EventQA/hnEvents" ), 3 );
355+ if (cfgQAEventFlowCut && QA)
356+ histos.fill (HIST (" EventQA/hnEvents" ), 3 );
357+
363358 if (cfgEventNSamePileupSel && !collision.selection_bit (aod::evsel::kNoSameBunchPileup )) {
364359 return 0 ;
365360 }
366- histos.fill (HIST (" EventQA/hnEvents" ), 4 );
361+ if (cfgQAEventFlowCut && QA)
362+ histos.fill (HIST (" EventQA/hnEvents" ), 4 );
363+
367364 if (cfgEventNCollinTRSel && !collision.selection_bit (o2::aod::evsel::kNoCollInTimeRangeStandard )) {
368365 return 0 ;
369366 }
370- histos.fill (HIST (" EventQA/hnEvents" ), 5 );
367+ if (cfgQAEventFlowCut && QA)
368+ histos.fill (HIST (" EventQA/hnEvents" ), 5 );
369+
371370 if (cfgEventQvecSel && (collision.qvecAmp ()[detId] < QvecAmpMin || collision.qvecAmp ()[refAId] < QvecAmpMin || collision.qvecAmp ()[refBId] < QvecAmpMin)) {
372371 return 0 ;
373372 }
374- histos.fill (HIST (" EventQA/hnEvents" ), 6 );
373+ if (cfgQAEventFlowCut && QA)
374+ histos.fill (HIST (" EventQA/hnEvents" ), 6 );
375+
375376 if (cfgEventOccupancySel && (collision.trackOccupancyInTimeRange () > cfgEventOccupancyMax || collision.trackOccupancyInTimeRange () < cfgEventOccupancyMin)) {
376377 return 0 ;
377378 }
378- histos.fill (HIST (" EventQA/hnEvents" ), 7 );
379+ if (cfgQAEventFlowCut && QA)
380+ histos.fill (HIST (" EventQA/hnEvents" ), 7 );
381+
379382 if (cfgEventCentMax < centrality) {
380383 return 0 ;
381384 }
@@ -388,12 +391,18 @@ struct F0980pbpbanalysis {
388391 return 0;
389392 }
390393 */
391- histos.fill (HIST (" EventQA/hnEvents" ), 8 );
394+ if (cfgQAEventFlowCut && QA)
395+ histos.fill (HIST (" EventQA/hnEvents" ), 8 );
396+
392397 if (cfgEventPVSel && std::abs (collision.posZ ()) > cfgEventPV) {
393398 return 0 ;
394399 }
395- histos.fill (HIST (" EventQA/hnEvents" ), 9 );
396- histos.fill (HIST (" EventQA/hnEvents" ), 10 );
400+ if (cfgQAEventFlowCut && QA)
401+ histos.fill (HIST (" EventQA/hnEvents" ), 9 );
402+
403+ // All passed
404+ if (cfgQAEventFlowCut && QA)
405+ histos.fill (HIST (" EventQA/hnEvents" ), 10 );
397406 return 1 ;
398407 } // event selection
399408
@@ -445,7 +454,7 @@ struct F0980pbpbanalysis {
445454 template <typename TrackType>
446455 bool selectionPID (const TrackType track, const bool QA)
447456 {
448- if (cfgQAPIDCut && QA)
457+ if (QA)
449458 fillQA (false , track, 4 );
450459 //
451460 if (cfgListPID == PIDList::PIDRun3) {
@@ -499,21 +508,6 @@ struct F0980pbpbanalysis {
499508 return 1 ;
500509 }
501510
502- template <typename TrackType1, typename TrackType2>
503- bool pairIndexSelection (const TrackType1 track1, const TrackType2 track2)
504- {
505- if (cfgListPair == IndexSelList::woSame) {
506- if (track2.globalIndex () == track1.globalIndex ()) {
507- return 0 ;
508- }
509- } else if (cfgListPair == IndexSelList::leq) {
510- if (track2.globalIndex () <= track1.globalIndex ()) {
511- return 0 ;
512- }
513- }
514- return 1 ;
515- }
516-
517511 template <typename TrackType1, typename TrackType2>
518512 bool pairAngleSelection (const TrackType1 track1, const TrackType2 track2)
519513 {
@@ -569,28 +563,25 @@ struct F0980pbpbanalysis {
569563 if (!trackSelected (trk1, true )) {
570564 continue ;
571565 }
572- fillQA (true , trk1, 3 );
566+ if (cfgQATrackCut)
567+ fillQA (true , trk1, 3 );
573568
574569 if (!selectionPID (trk1, true )) {
575570 continue ;
576571 }
577572 fillQA (true , trk1, 4 );
578573
579574 for (const auto & trk2 : dTracks) {
580- if (! trackSelected (trk2, false )) {
575+ if (trk1. globalIndex () >= trk2. globalIndex ( )) {
581576 continue ;
582577 }
583578
584- // PID
585- if (!selectionPID (trk2, false )) {
579+ if (!trackSelected (trk2, false )) {
586580 continue ;
587581 }
588582
589- if (trk1.index () == trk2.index ()) {
590- fillQA (true , trk1, 5 );
591- }
592-
593- if (!pairIndexSelection (trk1, trk2)) {
583+ // PID
584+ if (!selectionPID (trk2, false )) {
594585 continue ;
595586 }
596587
@@ -690,19 +681,19 @@ struct F0980pbpbanalysis {
690681 }
691682 }
692683 }
693- PROCESS_SWITCH (F0980pbpbanalysis, processEventMixing, " Process Event mixing" , true );
684+ PROCESS_SWITCH (F0980pbpbanalysis, processEventMixing, " Process Event mixing" , false );
694685
695- void processOnce (EventCandidatesOrigin const & events)
686+ void processTotalEvent (EventCandidatesOrigin const & events)
696687 {
697- if (cfgQAEventCut ) {
688+ if (cfgQAEventFlowCut ) {
698689 nTotalEvents += events.size ();
699690 auto hTotalEvents = histos.get <TH1>(HIST (" EventQA/hnEvents" ));
700- if (hTotalEvents)
691+ if (hTotalEvents) {
701692 hTotalEvents->SetBinContent (1 , static_cast <double >(nTotalEvents));
702- // std::cout << "Total number of events processed: " << nTotalEvents << std::endl;
693+ }
703694 }
704695 }
705- PROCESS_SWITCH (F0980pbpbanalysis, processOnce , " fill Total nEvents once" , true );
696+ PROCESS_SWITCH (F0980pbpbanalysis, processTotalEvent , " fill Total nEvents once" , false );
706697
707698 void init (o2::framework::InitContext&)
708699 {
@@ -749,18 +740,17 @@ struct F0980pbpbanalysis {
749740 }
750741
751742 // PID QA
752- if (cfgQAPIDCut) {
753- histos.add (" PIDQA/Nsigma_TPC_BC" , " " , {HistType::kTH2F , {qaPtAxis, qaPIDAxis}});
754- histos.add (" PIDQA/Nsigma_TOF_BC" , " " , {HistType::kTH2F , {qaPtAxis, qaPIDAxis}});
755- histos.add (" PIDQA/TPC_TOF_BC" , " " , {HistType::kTH2F , {qaPIDAxis, qaPIDAxis}});
756- }
743+ histos.add (" PIDQA/Nsigma_TPC_BC" , " " , {HistType::kTH2F , {qaPtAxis, qaPIDAxis}});
744+ histos.add (" PIDQA/Nsigma_TOF_BC" , " " , {HistType::kTH2F , {qaPtAxis, qaPIDAxis}});
745+ histos.add (" PIDQA/TPC_TOF_BC" , " " , {HistType::kTH2F , {qaPIDAxis, qaPIDAxis}});
746+ //
757747 histos.add (" PIDQA/Nsigma_TPC_AC" , " " , {HistType::kTH2F , {qaPtAxis, qaPIDAxis}});
758748 histos.add (" PIDQA/Nsigma_TOF_AC" , " " , {HistType::kTH2F , {qaPtAxis, qaPIDAxis}});
759749 histos.add (" PIDQA/TPC_TOF_AC" , " " , {HistType::kTH2F , {qaPIDAxis, qaPIDAxis}});
760750 //
761- histos.add (" PIDQA/Nsigma_TPC_selected" , " " , {HistType::kTH2F , {qaPtAxis, qaPIDAxis}});
762- histos.add (" PIDQA/Nsigma_TOF_selected" , " " , {HistType::kTH2F , {qaPtAxis, qaPIDAxis}});
763- histos.add (" PIDQA/TPC_TOF_selected" , " " , {HistType::kTH2F , {qaPIDAxis, qaPIDAxis}});
751+ // histos.add("PIDQA/Nsigma_TPC_selected", "", {HistType::kTH2F, {qaPtAxis, qaPIDAxis}});
752+ // histos.add("PIDQA/Nsigma_TOF_selected", "", {HistType::kTH2F, {qaPtAxis, qaPIDAxis}});
753+ // histos.add("PIDQA/TPC_TOF_selected", "", {HistType::kTH2F, {qaPIDAxis, qaPIDAxis}});
764754
765755 // Event Plane QA
766756 if (cfgQAEPCut) {
@@ -775,6 +765,7 @@ struct F0980pbpbanalysis {
775765 histos.add (" EventQA/EPhistAC_AC" , " " , {HistType::kTH2F , {qaCentAxis, epresAxis}});
776766 histos.add (" EventQA/EPhistBC_AC" , " " , {HistType::kTH2F , {qaCentAxis, epresAxis}});
777767
768+ // Invariant Mass Histograms
778769 histos.add (" hInvMass_f0980_US_EPA" , " unlike invariant mass" ,
779770 {HistType::kTHnSparseF , {axisMass, axisPT, axisCent, axisEp}});
780771 histos.add (" hInvMass_f0980_LSpp_EPA" , " ++ invariant mass" ,
@@ -791,22 +782,24 @@ struct F0980pbpbanalysis {
791782 // }
792783
793784 // Event Histograms
794- histos.add (" EventQA/hnEvents" , " Event selection steps" , {HistType::kTH1F , {{11 , -0.5 , 10.5 }}});
795- std::shared_ptr<TH1> hEventsCutFlow = histos.get <TH1>(HIST (" EventQA/hnEvents" ));
796- std::vector<std::string> eventCutLabels = {
797- " All Events" ,
798- " Zvtx" ,
799- " sel8" ,
800- " GoodZvtxFT0vsPV" ,
801- " NoSameBunchPileup" ,
802- " NoCollInTimeRangeStandard" ,
803- " Qvec Amplitude" ,
804- " Occupancy" ,
805- " Centrality" ,
806- " Additional PV cut" ,
807- " Passed Events" };
808- for (size_t i = 0 ; i < eventCutLabels.size (); ++i) {
809- hEventsCutFlow->GetXaxis ()->SetBinLabel (i + 1 , eventCutLabels[i].c_str ());
785+ if (cfgQAEventFlowCut) {
786+ histos.add (" EventQA/hnEvents" , " Event selection steps" , {HistType::kTH1F , {{11 , -0.5 , 10.5 }}});
787+ std::shared_ptr<TH1> hEventsCutFlow = histos.get <TH1>(HIST (" EventQA/hnEvents" ));
788+ std::vector<std::string> eventCutLabels = {
789+ " All Events" ,
790+ " Zvtx" ,
791+ " sel8" ,
792+ " GoodZvtxFT0vsPV" ,
793+ " NoSameBunchPileup" ,
794+ " NoCollInTimeRangeStandard" ,
795+ " Qvec Amplitude" ,
796+ " Occupancy" ,
797+ " Centrality" ,
798+ " Additional PV cut" ,
799+ " Passed Events" };
800+ for (size_t i = 0 ; i < eventCutLabels.size (); ++i) {
801+ hEventsCutFlow->GetXaxis ()->SetBinLabel (i + 1 , eventCutLabels[i].c_str ());
802+ }
810803 }
811804
812805 detId = getDetId (cfgQvecDetName);
@@ -853,7 +846,7 @@ struct F0980pbpbanalysis {
853846
854847 fillHistograms<false >(collision, tracks);
855848 };
856- PROCESS_SWITCH (F0980pbpbanalysis, processData, " Process Event for data" , true );
849+ PROCESS_SWITCH (F0980pbpbanalysis, processData, " Process Event for data" , false );
857850};
858851
859852WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
0 commit comments