88// In applying this license CERN does not waive the privileges and immunities
99// granted to it by virtue of its status as an Intergovernmental Organization
1010// or submit itself to any jurisdiction.
11-
12- // jet finder QA task
1311//
1412// / \author Aimeric Landou <aimeric.landou@cern.ch>
1513// / \author Nima Zardoshti <nima.zardoshti@cern.ch>
14+ // / \author Yubiao Wang <yubiao.wang@cern.ch>
15+ // / \file jetBackgroundAnalysis.cxx
16+ // / \brief This file contains the implementation for the Charged Jet v2 analysis in the ALICE experiment
1617
1718#include " RecoDecay.h"
1819
3536#include < cmath>
3637#include < string>
3738#include < vector>
38-
3939#include < math.h>
4040
4141using namespace o2 ;
4242using namespace o2 ::framework;
4343using namespace o2 ::framework::expressions;
4444
45- struct JetBackgroundAnalysisTask {
45+ struct JetBackgroundAnalysis {
4646 HistogramRegistry registry;
4747
4848 Configurable<std::string> eventSelections{" eventSelections" , " sel8" , " choose event selection" };
4949 Configurable<float > vertexZCut{" vertexZCut" , 10 .0f , " Accepted z-vertex range for collisions" };
5050 Configurable<float > centralityMin{" centralityMin" , -999.0 , " minimum centrality for collisions" };
5151 Configurable<float > centralityMax{" centralityMax" , 999.0 , " maximum centrality for collisions" };
52+ Configurable<bool > checkCentFT0M{" checkCentFT0M" , false , " 0: centFT0C as default, 1: use centFT0M estimator" };
5253 Configurable<int > trackOccupancyInTimeRangeMax{" trackOccupancyInTimeRangeMax" , 999999 , " maximum track occupancy of collisions in neighbouring collisions in a given time range; only applied to reconstructed collisions (data and mcd jets), not mc collisions (mcp jets)" };
5354 Configurable<int > trackOccupancyInTimeRangeMin{" trackOccupancyInTimeRangeMin" , -999999 , " minimum track occupancy of collisions in neighbouring collisions in a given time range; only applied to reconstructed collisions (data and mcd jets), not mc collisions (mcp jets)" };
5455 Configurable<bool > skipMBGapEvents{" skipMBGapEvents" , false , " flag to choose to reject min. bias gap events" };
@@ -99,7 +100,7 @@ struct JetBackgroundAnalysisTask {
99100 }
100101
101102 Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax);
102- Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax );
103+ Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut);
103104
104105 template <typename TTracks, typename TJets>
105106 bool trackIsInJet (TTracks const & track, TJets const & jet)
@@ -113,73 +114,73 @@ struct JetBackgroundAnalysisTask {
113114 }
114115
115116 template <typename TCollisions, typename TJets, typename TTracks>
116- void bkgFluctuationsRandomCone (TCollisions const & collision, TJets const & jets, TTracks const & tracks)
117+ void bkgFluctuationsRandomCone (TCollisions const & collision, TJets const & jets, TTracks const & tracks, float centrality )
117118 {
118119 TRandom3 randomNumber (0 );
119120 float randomConeEta = randomNumber.Uniform (trackEtaMin + randomConeR, trackEtaMax - randomConeR);
120- float randomConePhi = randomNumber.Uniform (0.0 , 2 * M_PI );
121+ float randomConePhi = randomNumber.Uniform (0.0 , o2::constants::math::TwoPI );
121122 float randomConePt = 0 ;
122123 for (auto const & track : tracks) {
123124 if (jetderiveddatautilities::selectTrack (track, trackSelection)) {
124- float dPhi = RecoDecay::constrainAngle (track.phi () - randomConePhi, static_cast <float >(-M_PI ));
125+ float dPhi = RecoDecay::constrainAngle (track.phi () - randomConePhi, static_cast <float >(-o2::constants::math::PI ));
125126 float dEta = track.eta () - randomConeEta;
126- if (TMath::Sqrt (dEta * dEta + dPhi * dPhi) < randomConeR) {
127+ if (std::sqrt (dEta * dEta + dPhi * dPhi) < randomConeR) {
127128 randomConePt += track.pt ();
128129 }
129130 }
130131 }
131- registry.fill (HIST (" h2_centrality_rhorandomcone" ), collision. centFT0M () , randomConePt - M_PI * randomConeR * randomConeR * collision.rho ());
132+ registry.fill (HIST (" h2_centrality_rhorandomcone" ), centrality , randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho ());
132133
133134 // randomised eta,phi for tracks, to assess part of fluctuations coming from statistically independently emitted particles
134135 randomConePt = 0 ;
135136 for (auto const & track : tracks) {
136137 if (jetderiveddatautilities::selectTrack (track, trackSelection)) {
137- float dPhi = RecoDecay::constrainAngle (randomNumber.Uniform (0.0 , 2 * M_PI ) - randomConePhi, static_cast <float >(-M_PI )); // ignores actual phi of track
138+ float dPhi = RecoDecay::constrainAngle (randomNumber.Uniform (0.0 , o2::constants::math::TwoPI ) - randomConePhi, static_cast <float >(-o2::constants::math::PI )); // ignores actual phi of track
138139 float dEta = randomNumber.Uniform (trackEtaMin, trackEtaMax) - randomConeEta; // ignores actual eta of track
139- if (TMath::Sqrt (dEta * dEta + dPhi * dPhi) < randomConeR) {
140+ if (std::sqrt (dEta * dEta + dPhi * dPhi) < randomConeR) {
140141 randomConePt += track.pt ();
141142 }
142143 }
143144 }
144- registry.fill (HIST (" h2_centrality_rhorandomconerandomtrackdirection" ), collision. centFT0M () , randomConePt - M_PI * randomConeR * randomConeR * collision.rho ());
145+ registry.fill (HIST (" h2_centrality_rhorandomconerandomtrackdirection" ),centrality , randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho ());
145146
146147 // removing the leading jet from the random cone
147148 if (jets.size () > 0 ) { // if there are no jets in the acceptance (from the jetfinder cuts) then there can be no leading jet
148- float dPhiLeadingJet = RecoDecay::constrainAngle (jets.iteratorAt (0 ).phi () - randomConePhi, static_cast <float >(-M_PI ));
149+ float dPhiLeadingJet = RecoDecay::constrainAngle (jets.iteratorAt (0 ).phi () - randomConePhi, static_cast <float >(-o2::constants::math::PI ));
149150 float dEtaLeadingJet = jets.iteratorAt (0 ).eta () - randomConeEta;
150151
151152 bool jetWasInCone = false ;
152- while ((randomConeLeadJetDeltaR <= 0 && (TMath::Sqrt (dEtaLeadingJet * dEtaLeadingJet + dPhiLeadingJet * dPhiLeadingJet) < jets.iteratorAt (0 ).r () / 100.0 + randomConeR)) || (randomConeLeadJetDeltaR > 0 && (TMath::Sqrt (dEtaLeadingJet * dEtaLeadingJet + dPhiLeadingJet * dPhiLeadingJet) < randomConeLeadJetDeltaR))) {
153+ while ((randomConeLeadJetDeltaR <= 0 && (std::sqrt (dEtaLeadingJet * dEtaLeadingJet + dPhiLeadingJet * dPhiLeadingJet) < jets.iteratorAt (0 ).r () / 100.0 + randomConeR)) || (randomConeLeadJetDeltaR > 0 && (std::sqrt (dEtaLeadingJet * dEtaLeadingJet + dPhiLeadingJet * dPhiLeadingJet) < randomConeLeadJetDeltaR))) {
153154 jetWasInCone = true ;
154155 randomConeEta = randomNumber.Uniform (trackEtaMin + randomConeR, trackEtaMax - randomConeR);
155- randomConePhi = randomNumber.Uniform (0.0 , 2 * M_PI );
156- dPhiLeadingJet = RecoDecay::constrainAngle (jets.iteratorAt (0 ).phi () - randomConePhi, static_cast <float >(-M_PI ));
156+ randomConePhi = randomNumber.Uniform (0.0 , o2::constants::math::TwoPI );
157+ dPhiLeadingJet = RecoDecay::constrainAngle (jets.iteratorAt (0 ).phi () - randomConePhi, static_cast <float >(-o2::constants::math::PI ));
157158 dEtaLeadingJet = jets.iteratorAt (0 ).eta () - randomConeEta;
158159 }
159160 if (jetWasInCone) {
160161 randomConePt = 0.0 ;
161162 for (auto const & track : tracks) {
162163 if (jetderiveddatautilities::selectTrack (track, trackSelection)) { // if track selection is uniformTrack, dcaXY and dcaZ cuts need to be added as they aren't in the selection so that they can be studied here
163- float dPhi = RecoDecay::constrainAngle (track.phi () - randomConePhi, static_cast <float >(-M_PI ));
164+ float dPhi = RecoDecay::constrainAngle (track.phi () - randomConePhi, static_cast <float >(-o2::constants::math::PI ));
164165 float dEta = track.eta () - randomConeEta;
165- if (TMath::Sqrt (dEta * dEta + dPhi * dPhi) < randomConeR) {
166+ if (std::sqrt (dEta * dEta + dPhi * dPhi) < randomConeR) {
166167 randomConePt += track.pt ();
167168 }
168169 }
169170 }
170171 }
171172 }
172- registry.fill (HIST (" h2_centrality_rhorandomconewithoutleadingjet" ), collision. centFT0M () , randomConePt - M_PI * randomConeR * randomConeR * collision.rho ());
173+ registry.fill (HIST (" h2_centrality_rhorandomconewithoutleadingjet" ), centrality , randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho ());
173174
174175 // randomised eta,phi for tracks, to assess part of fluctuations coming from statistically independently emitted particles, removing tracks from 2 leading jets
175176 double randomConePtWithoutOneLeadJet = 0 ;
176177 double randomConePtWithoutTwoLeadJet = 0 ;
177178 if (jets.size () > 1 ) { // if there are no jets, or just one, in the acceptance (from the jetfinder cuts) then one cannot find 2 leading jets
178179 for (auto const & track : tracks) {
179180 if (jetderiveddatautilities::selectTrack (track, trackSelection)) {
180- float dPhi = RecoDecay::constrainAngle (randomNumber.Uniform (0.0 , 2 * M_PI ) - randomConePhi, static_cast <float >(-M_PI )); // ignores actual phi of track
181+ float dPhi = RecoDecay::constrainAngle (randomNumber.Uniform (0.0 , o2::constants::math::TwoPI ) - randomConePhi, static_cast <float >(-o2::constants::math::PI )); // ignores actual phi of track
181182 float dEta = randomNumber.Uniform (trackEtaMin, trackEtaMax) - randomConeEta; // ignores actual eta of track
182- if (TMath::Sqrt (dEta * dEta + dPhi * dPhi) < randomConeR) {
183+ if (std::sqrt (dEta * dEta + dPhi * dPhi) < randomConeR) {
183184 if (!trackIsInJet (track, jets.iteratorAt (0 ))) {
184185 randomConePtWithoutOneLeadJet += track.pt ();
185186 if (!trackIsInJet (track, jets.iteratorAt (1 ))) {
@@ -190,8 +191,8 @@ struct JetBackgroundAnalysisTask {
190191 }
191192 }
192193 }
193- registry.fill (HIST (" h2_centrality_rhorandomconerandomtrackdirectionwithoutoneleadingjets" ), collision. centFT0M () , randomConePtWithoutOneLeadJet - M_PI * randomConeR * randomConeR * collision.rho ());
194- registry.fill (HIST (" h2_centrality_rhorandomconerandomtrackdirectionwithouttwoleadingjets" ), collision. centFT0M () , randomConePtWithoutTwoLeadJet - M_PI * randomConeR * randomConeR * collision.rho ());
194+ registry.fill (HIST (" h2_centrality_rhorandomconerandomtrackdirectionwithoutoneleadingjets" ), centrality , randomConePtWithoutOneLeadJet - o2::constants::math::PI * randomConeR * randomConeR * collision.rho ());
195+ registry.fill (HIST (" h2_centrality_rhorandomconerandomtrackdirectionwithouttwoleadingjets" ), centrality , randomConePtWithoutTwoLeadJet - o2::constants::math::PI * randomConeR * randomConeR * collision.rho ());
195196 }
196197
197198 void processRho (soa::Filtered<soa::Join<aod::JetCollisions, aod::BkgChargedRhos>>::iterator const & collision, soa::Filtered<aod::JetTracks> const & tracks)
@@ -202,19 +203,24 @@ struct JetBackgroundAnalysisTask {
202203 if (collision.trackOccupancyInTimeRange () < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange ()) {
203204 return ;
204205 }
206+ float centrality = checkCentFT0M ? collision.centFT0M () : collision.centFT0C ();
207+ if (centrality < centralityMin || centralityMax < centrality) {
208+ return ;
209+ }
210+
205211 int nTracks = 0 ;
206212 for (auto const & track : tracks) {
207213 if (jetderiveddatautilities::selectTrack (track, trackSelection)) {
208214 nTracks++;
209215 }
210216 }
211- registry.fill (HIST (" h2_centrality_ntracks" ), collision. centFT0M () , nTracks);
217+ registry.fill (HIST (" h2_centrality_ntracks" ), centrality , nTracks);
212218 registry.fill (HIST (" h2_ntracks_rho" ), nTracks, collision.rho ());
213219 registry.fill (HIST (" h2_ntracks_rhom" ), nTracks, collision.rhoM ());
214- registry.fill (HIST (" h2_centrality_rho" ), collision. centFT0M () , collision.rho ());
215- registry.fill (HIST (" h2_centrality_rhom" ), collision. centFT0M () , collision.rhoM ());
220+ registry.fill (HIST (" h2_centrality_rho" ), centrality , collision.rho ());
221+ registry.fill (HIST (" h2_centrality_rhom" ), centrality , collision.rhoM ());
216222 }
217- PROCESS_SWITCH (JetBackgroundAnalysisTask , processRho, " QA for rho-area subtracted jets" , false );
223+ PROCESS_SWITCH (JetBackgroundAnalysis , processRho, " QA for rho-area subtracted jets" , false );
218224
219225 void processBkgFluctuationsData (soa::Filtered<soa::Join<aod::JetCollisions, aod::BkgChargedRhos>>::iterator const & collision, soa::Join<aod::ChargedJets, aod::ChargedJetConstituents> const & jets, soa::Filtered<aod::JetTracks> const & tracks)
220226 {
@@ -224,9 +230,14 @@ struct JetBackgroundAnalysisTask {
224230 if (collision.trackOccupancyInTimeRange () < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange ()) {
225231 return ;
226232 }
227- bkgFluctuationsRandomCone (collision, jets, tracks);
233+ float centrality = checkCentFT0M ? collision.centFT0M () : collision.centFT0C ();
234+ if (centrality < centralityMin || centralityMax < centrality) {
235+ return ;
236+ }
237+
238+ bkgFluctuationsRandomCone (collision, jets, tracks, centrality);
228239 }
229- PROCESS_SWITCH (JetBackgroundAnalysisTask , processBkgFluctuationsData, " QA for random cone estimation of background fluctuations in data" , false );
240+ PROCESS_SWITCH (JetBackgroundAnalysis , processBkgFluctuationsData, " QA for random cone estimation of background fluctuations in data" , false );
230241
231242 void processBkgFluctuationsMCD (soa::Filtered<soa::Join<aod::JetCollisions, aod::BkgChargedRhos>>::iterator const & collision, soa::Join<aod::ChargedMCDetectorLevelJets, aod::ChargedMCDetectorLevelJetConstituents> const & jets, soa::Filtered<aod::JetTracks> const & tracks)
232243 {
@@ -236,9 +247,17 @@ struct JetBackgroundAnalysisTask {
236247 if (collision.trackOccupancyInTimeRange () < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange ()) {
237248 return ;
238249 }
239- bkgFluctuationsRandomCone (collision, jets, tracks);
250+ float centrality = checkCentFT0M ? collision.centFT0M () : collision.centFT0C ();
251+ if (centrality < centralityMin || centralityMax < centrality) {
252+ return ;
253+ }
254+
255+ bkgFluctuationsRandomCone (collision, jets, tracks, centrality);
240256 }
241- PROCESS_SWITCH (JetBackgroundAnalysisTask , processBkgFluctuationsMCD, " QA for random cone estimation of background fluctuations in mcd" , false );
257+ PROCESS_SWITCH (JetBackgroundAnalysis , processBkgFluctuationsMCD, " QA for random cone estimation of background fluctuations in mcd" , false );
242258};
243259
244- WorkflowSpec defineDataProcessing (ConfigContext const & cfgc) { return WorkflowSpec{adaptAnalysisTask<JetBackgroundAnalysisTask>(cfgc, TaskName{" jet-background-analysis" })}; }
260+ WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
261+ {
262+ return WorkflowSpec{adaptAnalysisTask<JetBackgroundAnalysis>(cfgc)};
263+ }
0 commit comments