@@ -59,20 +59,33 @@ enum RunType {
5959 kRun2
6060};
6161
62+ // Structure to handle net charge fluctuation analysis
6263struct NetchargeFluctuations {
64+
65+ // Macro to define configurable parameters with default values and help text
66+
6367#define O2_DEFINE_CONFIGURABLE (NAME, TYPE, DEFAULT, HELP ) Configurable<TYPE> NAME{#NAME, DEFAULT, HELP};
6468
65- Service<o2::framework::O2DatabasePDG> pdgService;
66- Service<o2::ccdb::BasicCCDBManager> ccdb;
69+ // Services for PDG and CCDB (Calibration and Condition Database)
70+ Service<o2::framework::O2DatabasePDG> pdgService; // Particle data group service
71+ Service<o2::ccdb::BasicCCDBManager> ccdb; // CCDB manager service
72+
73+ // Random number generator for statistical fluctuations, initialized with seed 0
6774 TRandom3* fRndm = new TRandom3(0 );
75+
76+ // Registry for histograms used in analysis
6877 HistogramRegistry histogramRegistry{" Histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
6978
70- // Configurables
79+ // -------------------
80+ // Configurable parameters
81+ // -------------------
82+ // CCDB related configurations
7183 Configurable<int64_t > ccdbNoLaterThan{" ccdbNoLaterThan" , std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now ().time_since_epoch ()).count (), " latest acceptable timestamp of creation for the object" };
7284 Configurable<std::string> cfgUrlCCDB{" cfgUrlCCDB" , " http://alice-ccdb.cern.ch" , " url of ccdb" };
7385 Configurable<std::string> cfgPathCCDB{" cfgPathCCDB" , " Users/n/nimalik/netcharge/p/Run3/LHC24f3d" , " Path for ccdb-object" };
7486 Configurable<bool > cfgLoadEff{" cfgLoadEff" , true , " Load efficiency" };
7587
88+ // Track and event selection cuts
7689 Configurable<float > vertexZcut{" vertexZcut" , 10 .f , " Vertex Z" };
7790 Configurable<float > etaCut{" etaCut" , 0 .8f , " Eta cut" };
7891 Configurable<float > ptMinCut{" ptMinCut" , 0.2 , " Pt min cut" };
@@ -99,38 +112,49 @@ struct NetchargeFluctuations {
99112 Configurable<bool > cTpcChi{" cTpcChi" , true , " TPC chi" };
100113 Configurable<bool > cFT0C{" cFT0C" , true , " cent FT0C" };
101114 Configurable<bool > cFT0M{" cFT0M" , false , " cent FT0M" };
102- ConfigurableAxis centBining{" centBining" , {0 , 5 , 10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 , 90 , 100 }, " Centrality/Multiplicity percentile bining" };
103- Configurable<bool > cPileupReject{" cPileupReject" , true , " Pileup rejection" }; // pileup
104- Configurable<bool > cfgUseGoodItsLayerAllCut{" cfgUseGoodItsLayerAllCut" , true , " Good ITS Layers All" }; // pileup
105- Configurable<bool > cTFBorder{" cTFBorder" , false , " Timeframe Border Selection" }; // pileup
106- Configurable<bool > cNoItsROBorder{" cNoItsROBorder" , false , " No ITSRO Border Cut" }; // pileup
107- Configurable<bool > cItsTpcVtx{" cItsTpcVtx" , true , " ITS+TPC Vertex Selection" }; // pileup
108- Configurable<bool > cZVtxTimeDiff{" cZVtxTimeDiff" , false , " z-vtx time diff selection" }; // pileup
109- Configurable<bool > cPVcont{" cPVcont" , true , " primary vertex contributor" };
110115
116+ // Centrality binning configuration
117+ ConfigurableAxis centBining{" centBining" , {0 , 5 , 10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 , 90 , 100 }, " Centrality/Multiplicity percentile bining" };
118+ Configurable<bool > cPileupReject{" cPileupReject" , false , " Pileup rejection" }; // pileup
119+ Configurable<bool > cfgUseGoodItsLayerAllCut{" cfgUseGoodItsLayerAllCut" , false , " Good ITS Layers All" }; // pileup
120+ Configurable<bool > cTFBorder{" cTFBorder" , false , " Timeframe Border Selection" }; // pileup
121+ Configurable<bool > cNoItsROBorder{" cNoItsROBorder" , false , " No ITSRO Border Cut" }; // pileup
122+ Configurable<bool > cItsTpcVtx{" cItsTpcVtx" , false , " ITS+TPC Vertex Selection" }; // pileup
123+ Configurable<bool > cZVtxTimeDiff{" cZVtxTimeDiff" , false , " z-vtx time diff selection" }; // pileup
124+ Configurable<bool > cPVcont{" cPVcont" , false , " primary vertex contributor" };
125+
126+ // Configurable to enable multiplicity correlation cuts
111127 O2_DEFINE_CONFIGURABLE (cfgEvSelMultCorrelation, bool , true , " Multiplicity correlation cut" )
128+
129+ // Struct grouping multiplicity vs centrality/vertex cuts and related parameters
112130 struct : ConfigurableGroup {
113131
132+ // Flags to enable specific multiplicity correlation cuts
114133 O2_DEFINE_CONFIGURABLE (cfgMultPVT0CCutEnabled, bool , true , " Enable PV multiplicity vs T0C centrality cut" )
115134 O2_DEFINE_CONFIGURABLE (cfgMultGlobalFT0CCutEnabled, bool , true , " Enable globalTracks vs FT0C multiplicity cut" )
116135 O2_DEFINE_CONFIGURABLE (cfgMultGlobalPVCutEnabled, bool , true , " Enable globalTracks vs PV multiplicity cut" )
117136
137+ // Parameter values for PV multiplicity vs FT0C centrality cut (polynomial coefficients, etc.)
118138 Configurable<std::vector<double >> cfgMultPVT0CCutPars{" cfgMultPVT0CCutPars" ,
119139 std::vector<double >{30.434 , -0.917137 , 0.0185032 , -0.000198425 , 7.94381e-07 , 13.7406 , -0.282656 , 0.00556147 , -6.32766e-05 , 2.51648e-07 },
120140 " PV multiplicity vs T0C centrality cut parameter values" };
121141
142+ // Parameter values for globalTracks vs FT0C multiplicity cut
122143 Configurable<std::vector<double >> cfgMultGlobalFT0CCutPars{" cfgMultGlobalFT0CCutPars" ,
123144 std::vector<double >{18.9628 , -0.576466 , 0.0117324 , -0.000126086 , 5.05365e-07 , 8.99921 , -0.188022 , 0.0037089 , -4.20275e-05 , 1.68234e-07 },
124145 " globalTracks vs FT0C cut parameter values" };
125146
147+ // Parameter values for globalTracks vs PV multiplicity cut
126148 Configurable<std::vector<double >> cfgMultGlobalPVCutPars{" cfgMultGlobalPVCutPars" ,
127149 std::vector<double >{0.148031 , 0.616699 , 0.603083 , 0.112751 , -0.0013846 , 8.38211e-06 },
128150 " globalTracks vs PV cut parameter values" };
129151
152+ // Local vectors to store the above parameters
130153 std::vector<double > multPVT0CCutPars;
131154 std::vector<double > multGlobalFT0CPars;
132155 std::vector<double > multGlobalPVCutPars;
133156
157+ // TF1 objects to represent low/high cut functions for the above correlations
134158 TF1* fMultPVT0CCutLow = nullptr ;
135159 TF1* fMultPVT0CCutHigh = nullptr ;
136160 TF1* fMultGlobalFT0CCutLow = nullptr ;
@@ -140,9 +164,10 @@ struct NetchargeFluctuations {
140164
141165 } cfgFunCoeff;
142166
143- // CCDB efficiency histograms
167+ // Histogram pointer for CCDB efficiency
144168 TH1D* efficiency = nullptr ;
145169
170+ // Filters for selecting collisions and tracks
146171 Filter collisionFilter = nabs(aod::collision::posZ) <= vertexZcut;
147172 Filter trackFilter = (nabs(aod::track::eta) < etaCut) && (aod::track::pt > ptMinCut) && (aod::track::pt < ptMaxCut) && (requireGlobalTrackInFilter());
148173
@@ -166,6 +191,9 @@ struct NetchargeFluctuations {
166191
167192 void init (o2::framework::InitContext&)
168193 {
194+ // -------------------------------
195+ // Define histogram axes specifications
196+ // -------------------------------
169197 const AxisSpec vtxzAxis = {800 , -20 , 20 , " V_{Z} (cm)" };
170198 const AxisSpec dcaAxis = {1000 , -0.5 , 0.5 , " DCA_{xy} (cm)" };
171199 const AxisSpec dcazAxis = {600 , -3 , 3 , " DCA_{z} (cm)" };
@@ -185,10 +213,12 @@ struct NetchargeFluctuations {
185213 const AxisSpec nchpAxis = {50000 , 0 , 50000 , " Nch" };
186214 const AxisSpec cent1Axis{centBining, " Multiplicity percentile from FT0M (%)" };
187215
216+ // Subsample axis (used for error estimation from subsamples)
188217 auto noSubsample = static_cast <int >(cfgNSubsample);
189218 float maxSubsample = 1.0 * noSubsample;
190219 AxisSpec subsampleAxis = {noSubsample, 0.0 , maxSubsample, " subsample no." };
191220
221+ // Add QA histograms
192222 histogramRegistry.add (" QA/hVtxZ_before" , " " , kTH1F , {vtxzAxis});
193223 histogramRegistry.add (" QA/hDcaXY_before" , " " , kTH1F , {dcaAxis});
194224 histogramRegistry.add (" QA/hphi" , " " , kTH1F , {phiAxis});
@@ -316,6 +346,7 @@ struct NetchargeFluctuations {
316346 histogramRegistry.add (" QA/hNchGlobal" , " " , kTH1F , {nchAxis});
317347 histogramRegistry.add (" QA/hNchPV" , " " , kTH1F , {nchAxis});
318348
349+ // QA histograms for multiplicity correlations
319350 histogramRegistry.add (" MultCorrelationPlots/globalTracks_PV_bef" , " " , {HistType::kTH2D , {nchAxis, nchAxis}});
320351 histogramRegistry.add (" MultCorrelationPlots/globalTracks_FT0C_bef" , " " , {HistType::kTH2D , {centAxis, nchAxis}});
321352 histogramRegistry.add (" MultCorrelationPlots/PV_FT0C_bef" , " " , {HistType::kTH2D , {centAxis, nchAxis}});
@@ -328,49 +359,62 @@ struct NetchargeFluctuations {
328359 cfgFunCoeff.multGlobalFT0CPars = cfgFunCoeff.cfgMultGlobalFT0CCutPars ;
329360 cfgFunCoeff.multGlobalPVCutPars = cfgFunCoeff.cfgMultGlobalPVCutPars ;
330361
362+ // --- Initialize PV vs FT0C multiplicity cut functions ---
363+ // Lower cut function: 4th-order polynomial minus 3.5 sigma deviation
364+
331365 cfgFunCoeff.fMultPVT0CCutLow =
332366 new TF1 (" fMultPVT0CCutLow" ,
333- " [0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 2.0 *([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)" ,
367+ " [0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5 *([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)" ,
334368 0 , 100 );
335369 cfgFunCoeff.fMultPVT0CCutLow ->SetParameters (&(cfgFunCoeff.multPVT0CCutPars [0 ]));
336370
371+ // Upper cut function: 4th-order polynomial plus 3.5 sigma deviation
337372 cfgFunCoeff.fMultPVT0CCutHigh =
338373 new TF1 (" fMultPVT0CCutHigh" ,
339- " [0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 2. *([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)" ,
374+ " [0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 3.5 *([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)" ,
340375 0 , 100 );
341376 cfgFunCoeff.fMultPVT0CCutHigh ->SetParameters (&(cfgFunCoeff.multPVT0CCutPars [0 ]));
342377
378+ // --- Initialize globalTracks vs FT0C multiplicity cut functions ---
379+ // Lower cut function
343380 cfgFunCoeff.fMultGlobalFT0CCutLow =
344381 new TF1 (" fMultGlobalFT0CCutLow" ,
345- " [0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 2. *([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)" ,
382+ " [0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5 *([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)" ,
346383 0 , 100 );
347384 cfgFunCoeff.fMultGlobalFT0CCutLow ->SetParameters (&(cfgFunCoeff.multGlobalFT0CPars [0 ]));
348385
386+ // Upper cut function
349387 cfgFunCoeff.fMultGlobalFT0CCutHigh =
350388 new TF1 (" fMultGlobalFT0CCutHigh" ,
351- " [0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 2. *([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)" ,
389+ " [0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 3.5 *([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)" ,
352390 0 , 100 );
353391 cfgFunCoeff.fMultGlobalFT0CCutHigh ->SetParameters (&(cfgFunCoeff.multGlobalFT0CPars [0 ]));
354392
393+ // --- Initialize globalTracks vs PV multiplicity cut functions ---
394+ // Lower cut: linear + cubic term minus 3.5 sigma
395+
355396 cfgFunCoeff.fMultGlobalPVCutLow =
356397 new TF1 (" fMultGlobalPVCutLow" ,
357398 " [0]+[1]*x - 3.5*([2]+[3]*x+[4]*x*x+[5]*x*x*x)" ,
358399 0 , 100 );
359400 cfgFunCoeff.fMultGlobalPVCutLow ->SetParameters (&(cfgFunCoeff.multGlobalPVCutPars [0 ]));
360401
402+ // Upper cut: linear + cubic term plus 3.5 sigma
361403 cfgFunCoeff.fMultGlobalPVCutHigh =
362404 new TF1 (" fMultGlobalPVCutHigh" ,
363405 " [0]+[1]*x + 3.5*([2]+[3]*x+[4]*x*x+[5]*x*x*x)" ,
364406 0 , 100 );
365407 cfgFunCoeff.fMultGlobalPVCutHigh ->SetParameters (&(cfgFunCoeff.multGlobalPVCutPars [0 ]));
366408
409+ // --- Load efficiency histogram from CCDB
367410 if (cfgLoadEff) {
368411 ccdb->setURL (cfgUrlCCDB.value );
369412 ccdb->setCaching (true );
370413 ccdb->setLocalObjectValidityChecking ();
371414
372415 TList* list = ccdb->getForTimeStamp <TList>(cfgPathCCDB.value , -1 );
373416 efficiency = reinterpret_cast <TH1D*>(list->FindObject (" efficiency_Run3" ));
417+ // Log fatal error if efficiency histogram is not found
374418 if (!efficiency) {
375419 LOGF (info, " FATAL!! Could not find required histograms in CCDB" );
376420 }
@@ -1001,7 +1045,7 @@ struct NetchargeFluctuations {
10011045 }
10021046 }
10031047
1004- PROCESS_SWITCH (NetchargeFluctuations, processDataRun3, " Process for Run3 DATA" , true );
1048+ PROCESS_SWITCH (NetchargeFluctuations, processDataRun3, " Process for Run3 DATA" , false );
10051049
10061050 // process function for Data Run2
10071051 void processDataRun2 (MyCollisionRun2 const & coll, MyTracks const & tracks)
@@ -1015,7 +1059,7 @@ struct NetchargeFluctuations {
10151059 }
10161060 }
10171061
1018- PROCESS_SWITCH (NetchargeFluctuations, processDataRun2, " Process for Run2 DATA" , false );
1062+ PROCESS_SWITCH (NetchargeFluctuations, processDataRun2, " Process for Run2 DATA" , true );
10191063
10201064 // process function for MC Run3
10211065
0 commit comments