@@ -67,31 +67,27 @@ struct EvSelParameters {
6767 float fT0CBBupper = 2.0 ; // ns
6868};
6969
70- struct EventSelectionTask {
71- Produces<aod::EvSels> evsel ;
70+ struct BcSelectionTask {
71+ Produces<aod::BcSels> bcsel ;
7272 Service<o2::ccdb::BasicCCDBManager> ccdb;
73- Configurable<bool > isMC{" isMC" , 0 , " 0 - data, 1 - MC" };
74-
7573 EvSelParameters par;
76-
7774 void init (InitContext&)
7875 {
7976 ccdb->setURL (" http://ccdb-test.cern.ch:8080" );
8077 ccdb->setCaching (true );
8178 ccdb->setLocalObjectValidityChecking ();
8279 }
8380
84- using BCsWithTimestampsAndRun2Infos = soa::Join<aod::BCsWithTimestamps, aod::Run2BCInfos>;
81+ using BCsWithRun2InfosTimestampsAndMatches = soa::Join<aod::BCs, aod::Run2BCInfos, aod::Timestamps, aod::Run2MatchedToBCSparse>;
82+
8583 void process (
86- aod::Run2MatchedSparse::iterator const & col,
87- BCsWithTimestampsAndRun2Infos const & bcs,
84+ BCsWithRun2InfosTimestampsAndMatches::iterator const & bc,
8885 aod::Zdcs const & zdcs,
8986 aod::FV0As const & fv0as,
9087 aod::FV0Cs const & fv0cs,
9188 aod::FT0s const & ft0s,
9289 aod::FDDs const & fdds)
9390 {
94- auto bc = col.bc_as <BCsWithTimestampsAndRun2Infos>();
9591 TriggerAliases* aliases = ccdb->getForTimeStamp <TriggerAliases>(" Trigger/TriggerAliases" , bc.timestamp ());
9692 if (!aliases) {
9793 LOGF (fatal, " Trigger aliases are not available in CCDB for run=%d at timestamp=%llu" , bc.runNumber (), bc.timestamp ());
@@ -108,14 +104,14 @@ struct EventSelectionTask {
108104 alias[al.first ] |= (triggerMaskNext50 & al.second ) > 0 ;
109105 }
110106
111- float timeZNA = col .has_zdc () ? col .zdc ().timeZNA () : -999 .f ;
112- float timeZNC = col .has_zdc () ? col .zdc ().timeZNC () : -999 .f ;
113- float timeV0A = col .has_fv0a () ? col .fv0a ().time () : -999 .f ;
114- float timeV0C = col .has_fv0c () ? col .fv0c ().time () : -999 .f ;
115- float timeT0A = col .has_ft0 () ? col .ft0 ().timeA () : -999 .f ;
116- float timeT0C = col .has_ft0 () ? col .ft0 ().timeC () : -999 .f ;
117- float timeFDA = col .has_fdd () ? col .fdd ().timeA () : -999 .f ;
118- float timeFDC = col .has_fdd () ? col .fdd ().timeC () : -999 .f ;
107+ float timeZNA = bc .has_zdc () ? bc .zdc ().timeZNA () : -999 .f ;
108+ float timeZNC = bc .has_zdc () ? bc .zdc ().timeZNC () : -999 .f ;
109+ float timeV0A = bc .has_fv0a () ? bc .fv0a ().time () : -999 .f ;
110+ float timeV0C = bc .has_fv0c () ? bc .fv0c ().time () : -999 .f ;
111+ float timeT0A = bc .has_ft0 () ? bc .ft0 ().timeA () : -999 .f ;
112+ float timeT0C = bc .has_ft0 () ? bc .ft0 ().timeC () : -999 .f ;
113+ float timeFDA = bc .has_fdd () ? bc .fdd ().timeA () : -999 .f ;
114+ float timeFDC = bc .has_fdd () ? bc .fdd ().timeC () : -999 .f ;
119115
120116 LOGF (debug, " timeZNA=%f timeZNC=%f" , timeZNA, timeZNC);
121117 LOGF (debug, " timeV0A=%f timeV0C=%f" , timeV0A, timeV0C);
@@ -135,11 +131,41 @@ struct EventSelectionTask {
135131 bool bbT0A = timeT0A > par.fT0ABBlower && timeT0A < par.fT0ABBupper ;
136132 bool bbT0C = timeT0C > par.fT0CBBlower && timeT0C < par.fT0CBBupper ;
137133
134+ // Fill bc selection columns
135+ bcsel (alias, bbT0A, bbT0C, bbV0A, bbV0C, bgV0A, bgV0C, bbZNA, bbZNC, bbFDA, bbFDC, bgFDA, bgFDC);
136+ }
137+ };
138+
139+ struct EventSelectionTask {
140+ Produces<aod::EvSels> evsel;
141+ Configurable<bool > isMC{" isMC" , 0 , " 0 - data, 1 - MC" };
142+
143+ using BCsWithBcSels = soa::Join<aod::BCs, aod::BcSels>;
144+
145+ void process (aod::Collision const & col, BCsWithBcSels const & bcs)
146+ {
147+ auto bc = col.bc_as <BCsWithBcSels>();
148+ int32_t alias[kNaliases ];
149+ for (int i = 0 ; i < kNaliases ; i++) {
150+ alias[i] = bc.alias ()[i];
151+ }
152+ bool bbZNA = bc.bbZNA ();
153+ bool bbZNC = bc.bbZNC ();
154+ bool bbV0A = bc.bbV0A ();
155+ bool bbV0C = bc.bbV0C ();
156+ bool bgV0A = bc.bgV0A ();
157+ bool bgV0C = bc.bgV0C ();
158+ bool bbFDA = bc.bbFDA ();
159+ bool bbFDC = bc.bbFDC ();
160+ bool bgFDA = bc.bgFDA ();
161+ bool bgFDC = bc.bgFDC ();
162+ bool bbT0A = bc.bbT0A ();
163+ bool bbT0C = bc.bbT0C ();
164+
138165 if (isMC) {
139166 bbZNA = 1 ;
140167 bbZNC = 1 ;
141168 }
142-
143169 // Fill event selection columns
144170 int64_t foundFT0 = -1 ; // this column is not used in run2 analysis
145171 evsel (alias, bbT0A, bbT0C, bbV0A, bbV0C, bgV0A, bgV0C, bbZNA, bbZNC, bbFDA, bbFDC, bgFDA, bgFDC, foundFT0);
@@ -220,7 +246,9 @@ struct EventSelectionTaskRun3 {
220246WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
221247{
222248 if (cfgc.options ().get <int >(" selection-run" ) == 2 ) {
223- return WorkflowSpec{adaptAnalysisTask<EventSelectionTask>(cfgc)};
249+ return WorkflowSpec{
250+ adaptAnalysisTask<BcSelectionTask>(cfgc),
251+ adaptAnalysisTask<EventSelectionTask>(cfgc)};
224252 } else {
225253 return WorkflowSpec{
226254 adaptAnalysisTask<EventSelectionTaskRun3>(cfgc)};
0 commit comments