1717
1818#include " Common/DataModel/EventSelection.h"
1919
20+ #include " PWGUD/DataModel/UDTables.h"
21+ #include " PWGUD/Core/SGSelector.h"
22+
2023#include < TH1D.h>
2124
2225using namespace o2 ;
@@ -25,14 +28,23 @@ using namespace o2::framework::expressions;
2528
2629using BCsWithRun3Matchings = soa::Join<aod::BCs, aod::Timestamps, aod::Run3MatchedToBCSparse>;
2730using CCs = soa::Join<aod::Collisions, aod::EvSels>;
31+ using FullSGUDCollision = soa::Join<aod::UDCollisions, aod::UDCollisionsSels, aod::SGCollisions, aod::UDZdcsReduced>::iterator;
2832
2933struct UpcEventITSROFcounter {
3034 Service<o2::ccdb::BasicCCDBManager> ccdb;
35+ SGSelector sgSelector;
3136
3237 HistogramRegistry histos{" histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
3338
3439 Configurable<int > nTracksForUPCevent{" nTracksForUPCevent" , 16 , {" Maximum of tracks defining a UPC collision" }};
3540
41+ Configurable<bool > useTrueGap{" useTrueGap" , true , {" Calculate gapSide for a given FV0/FT0/ZDC thresholds" }};
42+ Configurable<float > cutMyGapSideFV0{" FV0" , -1 , " FV0A threshold for SG selector" };
43+ Configurable<float > cutMyGapSideFT0A{" FT0A" , 150 ., " FT0A threshold for SG selector" };
44+ Configurable<float > cutMyGapSideFT0C{" FT0C" , 50 ., " FT0C threshold for SG selector" };
45+ Configurable<float > cutMyGapSideZDC{" ZDC" , 10 ., " ZDC threshold for SG selector" };
46+ ConfigurableAxis axisRunNumbers{" axisRunNumbers" , {1400 , 544000.5 , 545400.5 }, " Range of run numbers" };
47+
3648 void init (InitContext&)
3749 {
3850
@@ -41,9 +53,18 @@ struct UpcEventITSROFcounter {
4153 histos.add (" Events/hCountCollisionsInROFborderMatching" , " ;;Number of collision (-)" , HistType::kTH1D , {{11 , -0.5 , 10.5 }});
4254 histos.add (" Events/hCountUPCcollisionsInROFborderMatching" , " ;;Number of UPC (mult < 17) collision (-)" , HistType::kTH1D , {{11 , -0.5 , 10.5 }});
4355
56+ histos.add (" Runs/hStdModeCollDG" , " ;Run number;Number of events (-)" , HistType::kTH1D , {axisRunNumbers});
57+ histos.add (" Runs/hUpcModeCollDG" , " ;Run number;Number of events (-)" , HistType::kTH1D , {axisRunNumbers});
58+ histos.add (" Runs/hStdModeCollSG1" , " ;Run number;Number of events (-)" , HistType::kTH1D , {axisRunNumbers});
59+ histos.add (" Runs/hUpcModeCollSG1" , " ;Run number;Number of events (-)" , HistType::kTH1D , {axisRunNumbers});
60+ histos.add (" Runs/hStdModeCollSG0" , " ;Run number;Number of events (-)" , HistType::kTH1D , {axisRunNumbers});
61+ histos.add (" Runs/hUpcModeCollSG0" , " ;Run number;Number of events (-)" , HistType::kTH1D , {axisRunNumbers});
62+ histos.add (" Runs/hStdModeCollNG" , " ;Run number;Number of events (-)" , HistType::kTH1D , {axisRunNumbers});
63+ histos.add (" Runs/hUpcModeCollNG" , " ;Run number;Number of events (-)" , HistType::kTH1D , {axisRunNumbers});
64+
4465 } // end init
4566
46- void process (BCsWithRun3Matchings const & bcs, CCs const & collisions)
67+ void processCounterPerITSROF (BCsWithRun3Matchings const & bcs, CCs const & collisions)
4768 {
4869 int nAllColls = 0 ;
4970 int nUPCcolls = 0 ;
@@ -119,7 +140,40 @@ struct UpcEventITSROFcounter {
119140 }
120141 }
121142
122- PROCESS_SWITCH (UpcEventITSROFcounter, process, " Counts number of collisions within ITSROF" , true );
143+ void processCounterPerRun (FullSGUDCollision const & coll)
144+ {
145+
146+ int gapSide = coll.gapSide ();
147+ int trueGapSide = sgSelector.trueGap (coll, cutMyGapSideFV0, cutMyGapSideFT0A, cutMyGapSideFT0C, cutMyGapSideZDC);
148+ if (useTrueGap) {
149+ gapSide = trueGapSide;
150+ }
151+
152+ if (coll.flags () == 0 ) {
153+ if (gapSide == 2 ) {
154+ histos.get <TH1 >(HIST (" Runs/hStdModeCollDG" ))->Fill (coll.runNumber ());
155+ } else if (gapSide == 1 ) {
156+ histos.get <TH1 >(HIST (" Runs/hStdModeCollSG1" ))->Fill (coll.runNumber ());
157+ } else if (gapSide == 0 ) {
158+ histos.get <TH1 >(HIST (" Runs/hStdModeCollSG0" ))->Fill (coll.runNumber ());
159+ } else {
160+ histos.get <TH1 >(HIST (" Runs/hStdModeCollNG" ))->Fill (coll.runNumber ());
161+ }
162+ } else {
163+ if (gapSide == 2 ) {
164+ histos.get <TH1 >(HIST (" Runs/hUpcModeCollDG" ))->Fill (coll.runNumber ());
165+ } else if (gapSide == 1 ) {
166+ histos.get <TH1 >(HIST (" Runs/hUpcModeCollSG1" ))->Fill (coll.runNumber ());
167+ } else if (gapSide == 0 ) {
168+ histos.get <TH1 >(HIST (" Runs/hUpcModeCollSG0" ))->Fill (coll.runNumber ());
169+ } else {
170+ histos.get <TH1 >(HIST (" Runs/hUpcModeCollNG" ))->Fill (coll.runNumber ());
171+ }
172+ }
173+ }
174+
175+ PROCESS_SWITCH (UpcEventITSROFcounter, processCounterPerITSROF, " Counts number of collisions per ITSROF" , false );
176+ PROCESS_SWITCH (UpcEventITSROFcounter, processCounterPerRun, " Counts number of whatever per RUN" , true );
123177};
124178
125179WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
0 commit comments