@@ -48,7 +48,7 @@ void DefineHistograms(HistogramManager* histMan, TString histClasses);
4848struct DQFilterPbPbTask {
4949 Produces<aod::DQEventFilter> eventFilter;
5050 OutputObj<TH1I> fStats {" Statistics" };
51- OutputObj<TH1F> fIsEventDGOutcome {TH1F (" Filter outcome" , " Filter outcome" , 14 , -1 .5 , 6.5 )};
51+ OutputObj<TH1F> fIsEventDGOutcome {TH1F (" Filter outcome" , " Filter outcome" , 7 , -0 .5 , 6.5 )};
5252
5353 Configurable<std::string> fConfigBarrelSelections {" cfgBarrelSels" , " jpsiPID1:2:5" , " <track-cut>:<nmin>:<nmax>,[<track-cut>:<nmin>:<nmax>],..." };
5454 Configurable<int > fConfigNDtColl {" cfgNDtColl" , 4 , " Number of standard deviations to consider in BC range" };
@@ -64,7 +64,6 @@ struct DQFilterPbPbTask {
6464 Configurable<bool > fConfigUseFV0 {" cfgUseFV0" , true , " Whether to use FV0 for veto" };
6565 Configurable<bool > fConfigUseFT0 {" cfgUseFT0" , true , " Whether to use FT0 for veto" };
6666 Configurable<bool > fConfigUseFDD {" cfgUseFDD" , true , " Whether to use FDD for veto" };
67- Configurable<std::string> fConfigFITSides {" cfgFITSides" , " both" , " both, either, A, C, neither" };
6867 Configurable<bool > fConfigVetoForward {" cfgVetoForward" , true , " Whether to veto on forward tracks" };
6968 Configurable<bool > fConfigVetoBarrel {" cfgVetoBarrel" , false , " Whether to veto on barrel tracks" };
7069
@@ -74,15 +73,12 @@ struct DQFilterPbPbTask {
7473 std::vector<int > fBarrelNminTracks ; // minimal number of tracks in barrel
7574 std::vector<int > fBarrelNmaxTracks ; // maximal number of tracks in barrel
7675
77- int FITVetoSides = -1 ; // Integer to encode which side(s) of the FIT to use for veto
78- std::vector<std::string> FITVetoSidesOptions = {" both" , " either" , " A" , " C" , " neither" };
79-
8076 // Helper function for selecting DG events
8177 template <typename TEvent, typename TBCs, typename TTracks, typename TMuons>
82- int isEventDG (TEvent const & collision, TBCs const & bcs, TTracks const & tracks, TMuons const & muons,
83- aod::FT0s& ft0s, aod::FV0As& fv0as, aod::FDDs& fdds,
84- std::vector<float > FITAmpLimits, int nDtColl, int minNBCs, int minNPVCs, int maxNPVCs, float maxFITTime,
85- bool useFV0, bool useFT0, bool useFDD, int FITSide , bool doVetoFwd, bool doVetoBarrel)
78+ uint64_t isEventDG (TEvent const & collision, TBCs const & bcs, TTracks const & tracks, TMuons const & muons,
79+ aod::FT0s& ft0s, aod::FV0As& fv0as, aod::FDDs& fdds,
80+ std::vector<float > FITAmpLimits, int nDtColl, int minNBCs, int minNPVCs, int maxNPVCs, float maxFITTime,
81+ bool useFV0, bool useFT0, bool useFDD, bool doVetoFwd, bool doVetoBarrel)
8682 {
8783 fIsEventDGOutcome ->Fill (0 ., 1 .);
8884 // Find BC associated with collision
@@ -210,51 +206,54 @@ struct DQFilterPbPbTask {
210206 }
211207
212208 // Compute FIT decision
213- bool FITDecision = 0 ;
214- if (FITSide == 0 ) {
215- FITDecision = isSideAClean && isSideCClean;
216- } else if (FITSide == 1 ) {
217- FITDecision = isSideAClean ^ isSideCClean;
218- } else if (FITSide == 2 ) {
219- FITDecision = isSideAClean;
220- } else if (FITSide == 3 ) {
221- FITDecision = isSideCClean;
222- } else if (FITSide == 4 ) {
223- FITDecision = 1 ;
209+ uint64_t FITDecision = 0 ;
210+ if (isSideAClean && isSideCClean) {
211+ FITDecision |= (uint64_t (1 ) << VarManager::kDoubleGap );
212+ } else if (isSideAClean && !isSideCClean) {
213+ FITDecision |= (uint64_t (1 ) << VarManager::kSingleGapA );
214+ } else if (!isSideAClean && isSideCClean) {
215+ FITDecision |= (uint64_t (1 ) << VarManager::kSingleGapC );
224216 }
225217 if (!FITDecision) {
226- return 1 ;
218+ fIsEventDGOutcome ->Fill (2 , 1 );
219+ return 0 ;
227220 }
228221
229222 // Veto on activiy in either forward or barrel region
230223 if (doVetoFwd) {
231224 for (auto & muon : muons) {
232225 // Only care about muons with good timing (MID)
233226 if (muon.trackType () == 0 || muon.trackType () == 3 ) {
234- return 2 ;
227+ fIsEventDGOutcome ->Fill (3 , 1 );
228+ return 0 ;
235229 }
236230 }
237231 }
238232 if (doVetoBarrel) {
239233 if (tracks.size () > 0 ) {
240- return 3 ;
234+ fIsEventDGOutcome ->Fill (4 , 1 );
235+ return 0 ;
241236 }
242237 }
243238
244239 // No global tracks which are not vtx tracks
245240 for (auto & track : tracks) {
246241 if (track.isGlobalTrack () && !track.isPVContributor ()) {
247- return 4 ;
242+ fIsEventDGOutcome ->Fill (5 , 1 );
243+ return 0 ;
248244 }
249245 }
250246
251247 // Number of primary vertex contributors
252248 if (collision.numContrib () < minNPVCs || collision.numContrib () > maxNPVCs) {
253- return 5 ;
249+ fIsEventDGOutcome ->Fill (6 , 1 );
250+ return 0 ;
254251 }
255252
256253 // If we made it here, the event passed
257- return 0 ;
254+ fIsEventDGOutcome ->Fill (1 , 1 );
255+ // Return filter bitmap corresponding to FIT decision
256+ return FITDecision;
258257 }
259258
260259 void DefineCuts ()
@@ -290,15 +289,6 @@ struct DQFilterPbPbTask {
290289 void init (o2::framework::InitContext&)
291290 {
292291 DefineCuts ();
293-
294- for (int i = 0 ; i < 5 ; i++) {
295- if (fConfigFITSides .value == FITVetoSidesOptions[i]) {
296- FITVetoSides = i;
297- }
298- }
299- if (FITVetoSides == -1 ) {
300- LOGF (fatal, " Invalid choice of FIT side(s) for veto: %s" , fConfigFITSides .value );
301- }
302292 }
303293
304294 template <uint32_t TEventFillMap>
@@ -308,18 +298,13 @@ struct DQFilterPbPbTask {
308298 fStats ->Fill (-2.0 );
309299
310300 std::vector<float > FITAmpLimits = {fConfigFV0AmpLimit , fConfigFT0AAmpLimit , fConfigFT0CAmpLimit , fConfigFDDAAmpLimit , fConfigFDDCAmpLimit };
311- int filterOutcome = isEventDG (collision, bcs, tracks, muons, ft0s, fv0as, fdds,
312- FITAmpLimits, fConfigNDtColl , fConfigMinNBCs , fConfigMinNPVCs , fConfigMaxNPVCs , fConfigMaxFITTime ,
313- fConfigUseFV0 , fConfigUseFT0 , fConfigUseFDD , FITVetoSides, fConfigVetoForward , fConfigVetoBarrel );
314- fIsEventDGOutcome ->Fill (filterOutcome + 1 , 1 );
315-
316- // Don't need info on filter outcome anymore; reduce to a boolean
317- bool isDG = !filterOutcome;
318- fStats ->Fill (-1.0 , isDG);
319-
320- // Compute event filter
321- uint64_t filter = 0 ;
322- filter |= isDG;
301+ uint64_t filter = isEventDG (collision, bcs, tracks, muons, ft0s, fv0as, fdds,
302+ FITAmpLimits, fConfigNDtColl , fConfigMinNBCs , fConfigMinNPVCs , fConfigMaxNPVCs , fConfigMaxFITTime ,
303+ fConfigUseFV0 , fConfigUseFT0 , fConfigUseFDD , fConfigVetoForward , fConfigVetoBarrel );
304+
305+ bool isSelected = filter;
306+ fStats ->Fill (-1.0 , isSelected);
307+
323308 eventFilter (filter);
324309 }
325310
0 commit comments