@@ -71,12 +71,14 @@ struct JetBackgroundAnalysisTask {
7171
7272 std::vector<int > eventSelectionBits;
7373 int trackSelection = -1 ;
74+ TRandom3 randomNumber{};
7475
7576 void init (o2::framework::InitContext&)
7677 {
7778 // selection settings initialisation
7879 eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits (static_cast <std::string>(eventSelections));
7980 trackSelection = jetderiveddatautilities::initialiseTrackSelection (static_cast <std::string>(trackSelections));
81+ randomNumber.SetSeed (0 );
8082
8183 // Axes definitions
8284 AxisSpec bkgFluctuationsAxis = {nBinsFluct, -100.0 , 100.0 , " #delta #it{p}_{T} (GeV/#it{c})" };
@@ -117,36 +119,37 @@ struct JetBackgroundAnalysisTask {
117119 template <typename TCollisions, typename TJets, typename TTracks>
118120 void bkgFluctuationsRandomCone (TCollisions const & collision, TJets const & jets, TTracks const & tracks, float centrality)
119121 {
120- TRandom3 randomNumber (0 );
121- float randomConeEta = randomNumber.Uniform (trackEtaMin + randomConeR, trackEtaMax - randomConeR);
122- float randomConePhi = randomNumber.Uniform (0.0 , o2::constants::math::TwoPI);
123- float randomConePt = 0 ;
124- for (auto const & track : tracks) {
125- if (jetderiveddatautilities::selectTrack (track, trackSelection)) {
126- float dPhi = RecoDecay::constrainAngle (track.phi () - randomConePhi, static_cast <float >(-o2::constants::math::PI));
127- float dEta = track.eta () - randomConeEta;
128- if (std::sqrt (dEta * dEta + dPhi * dPhi) < randomConeR) {
129- randomConePt += track.pt ();
122+ if (jets.size () > 0 ) { // Since the purpose of the fluctuation measurement is jet correction, events with zero accepted jets (from the jetfinder cuts) are excluded
123+ float randomConeEta = randomNumber.Uniform (trackEtaMin + randomConeR, trackEtaMax - randomConeR);
124+ float randomConePhi = randomNumber.Uniform (0.0 , o2::constants::math::TwoPI);
125+ float randomConePt = 0 ;
126+ for (auto const & track : tracks) {
127+ if (jetderiveddatautilities::selectTrack (track, trackSelection)) {
128+ float dPhi = RecoDecay::constrainAngle (track.phi () - randomConePhi, static_cast <float >(-o2::constants::math::PI));
129+ float dEta = track.eta () - randomConeEta;
130+ if (std::sqrt (dEta * dEta + dPhi * dPhi) < randomConeR) {
131+ randomConePt += track.pt ();
132+ }
130133 }
131134 }
132- }
133- registry.fill (HIST (" h2_centrality_rhorandomcone" ), centrality, randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho ());
135+ registry.fill (HIST (" h2_centrality_rhorandomcone" ), centrality, randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho ());
134136
135- // randomised eta,phi for tracks, to assess part of fluctuations coming from statistically independently emitted particles
136- randomConePt = 0 ;
137- for (auto const & track : tracks) {
138- if (jetderiveddatautilities::selectTrack (track, trackSelection)) {
139- 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
140- float dEta = randomNumber.Uniform (trackEtaMin, trackEtaMax) - randomConeEta; // ignores actual eta of track
141- if (std::sqrt (dEta * dEta + dPhi * dPhi) < randomConeR) {
142- randomConePt += track.pt ();
137+ // randomised eta,phi for tracks, to assess part of fluctuations coming from statistically independently emitted particles
138+ {
139+ float randomConePt = 0 ;
140+ for (auto const & track : tracks) {
141+ if (jetderiveddatautilities::selectTrack (track, trackSelection)) {
142+ 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
143+ float dEta = randomNumber.Uniform (trackEtaMin, trackEtaMax) - randomConeEta; // ignores actual eta of track
144+ if (std::sqrt (dEta * dEta + dPhi * dPhi) < randomConeR) {
145+ randomConePt += track.pt ();
146+ }
147+ }
143148 }
149+ registry.fill (HIST (" h2_centrality_rhorandomconerandomtrackdirection" ), centrality, randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho ());
144150 }
145- }
146- registry.fill (HIST (" h2_centrality_rhorandomconerandomtrackdirection" ), centrality, randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho ());
147151
148- // removing the leading jet from the random cone
149- if (jets.size () > 0 ) { // if there are no jets in the acceptance (from the jetfinder cuts) then there can be no leading jet
152+ // removing the leading jet from the random cone
150153 float dPhiLeadingJet = RecoDecay::constrainAngle (jets.iteratorAt (0 ).phi () - randomConePhi, static_cast <float >(-o2::constants::math::PI));
151154 float dEtaLeadingJet = jets.iteratorAt (0 ).eta () - randomConeEta;
152155
@@ -170,30 +173,30 @@ struct JetBackgroundAnalysisTask {
170173 }
171174 }
172175 }
173- }
174- registry.fill (HIST (" h2_centrality_rhorandomconewithoutleadingjet" ), centrality, randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho ());
176+ registry.fill (HIST (" h2_centrality_rhorandomconewithoutleadingjet" ), centrality, randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho ());
175177
176- // randomised eta,phi for tracks, to assess part of fluctuations coming from statistically independently emitted particles, removing tracks from 2 leading jets
177- double randomConePtWithoutOneLeadJet = 0 ;
178- double randomConePtWithoutTwoLeadJet = 0 ;
179- 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
178+ // randomised eta,phi for tracks, to assess part of fluctuations coming from statistically independently emitted particles, removing tracks from 2 leading jets
179+ double randomConePtWithoutOneLeadJet = 0 ;
180+ double randomConePtWithoutTwoLeadJet = 0 ;
180181 for (auto const & track : tracks) {
181182 if (jetderiveddatautilities::selectTrack (track, trackSelection)) {
182183 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
183184 float dEta = randomNumber.Uniform (trackEtaMin, trackEtaMax) - randomConeEta; // ignores actual eta of track
184185 if (std::sqrt (dEta * dEta + dPhi * dPhi) < randomConeR) {
185186 if (!trackIsInJet (track, jets.iteratorAt (0 ))) {
186187 randomConePtWithoutOneLeadJet += track.pt ();
187- if (!trackIsInJet (track, jets.iteratorAt (1 ))) {
188+ if (jets. size () > 1 && !trackIsInJet (track, jets.iteratorAt (1 ))) { // if there are jets in the acceptance (from the jetfinder cuts) less than two then one cannot find 2 leading jets
188189 randomConePtWithoutTwoLeadJet += track.pt ();
189190 }
190191 }
191192 }
192193 }
193194 }
195+ registry.fill (HIST (" h2_centrality_rhorandomconerandomtrackdirectionwithoutoneleadingjets" ), centrality, randomConePtWithoutOneLeadJet - o2::constants::math::PI * randomConeR * randomConeR * collision.rho ());
196+ if (jets.size () > 1 ) {
197+ registry.fill (HIST (" h2_centrality_rhorandomconerandomtrackdirectionwithouttwoleadingjets" ), centrality, randomConePtWithoutTwoLeadJet - o2::constants::math::PI * randomConeR * randomConeR * collision.rho ());
198+ }
194199 }
195- registry.fill (HIST (" h2_centrality_rhorandomconerandomtrackdirectionwithoutoneleadingjets" ), centrality, randomConePtWithoutOneLeadJet - o2::constants::math::PI * randomConeR * randomConeR * collision.rho ());
196- registry.fill (HIST (" h2_centrality_rhorandomconerandomtrackdirectionwithouttwoleadingjets" ), centrality, randomConePtWithoutTwoLeadJet - o2::constants::math::PI * randomConeR * randomConeR * collision.rho ());
197200 }
198201
199202 void processRho (soa::Filtered<soa::Join<aod::JetCollisions, aod::BkgChargedRhos>>::iterator const & collision, soa::Filtered<aod::JetTracks> const & tracks)
0 commit comments