3535#include < TH2.h>
3636#include < TList.h>
3737#include < TObject.h>
38+ #include < TParticlePDG.h>
3839#include < TString.h>
3940#include < TSystem.h>
40- #include < TParticlePDG.h>
4141
4242#include < RtypesCore.h>
4343
@@ -94,8 +94,7 @@ const char* eventHistNames[eEventHistograms_N] = {
9494 " VertexX" ,
9595 " VertexY" ,
9696 " VertexZ" ,
97- " NumContrib"
98- };
97+ " NumContrib" };
9998
10099enum EnParticleHistograms {
101100 ePt,
@@ -162,7 +161,7 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
162161 Configurable<std::vector<float >> cfDCAXYCut{" cfDCAXYCut" , {-3.2 , 3.2 }, " range of distance-of-closest-approach (DCA) of the extrapolated track to the primary position in XY-direction: {min, max}[cm]" };
163162 Configurable<std::vector<float >> cfDCAZCut{" cfDCAZCut" , {-2.4 , 2.4 }, " range of distance-of-closest-approach (DCA) of the extrapolated track to the primary position in Z-direction: {min, max}[cm]" };
164163
165- // *)
164+ // *)
166165 Configurable<std::string> cfFileWithWeights{" cfFileWithWeights" , " /scratch3/go52dab/O2tutorial/tutorial3-6/weights.root" , " path to external ROOT file which holds all particle weights in O2 format" };
167166 Configurable<std::string> cfRunNumber{" cfRunNumber" , " 000123456" , " run number" };
168167
@@ -185,7 +184,7 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
185184 std::string fMultEstm = " FT0A" ;
186185
187186 bool fPrintSwitch = true ;
188-
187+
189188 bool fVertexZCutSwitch = true ;
190189 bool fSel8CutSwitch = true ;
191190 bool fCentCutSwitch = true ;
@@ -208,7 +207,7 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
208207 std::vector<float > fTpcNClsFoundCut = {70 ., 160 .};
209208 std::vector<float > fDCAXYCut = {-3.2 , 3.2 };
210209 std::vector<float > fDCAZCut = {-2.4 , 2.4 };
211-
210+
212211 std::string fFileWithWeights = " /scratch3/go52dab/O2tutorial/tutorial3-6/weights.root" ;
213212 std::string fRunNumber = " 000123456" ;
214213 } tc; // you have to prepend "tc." for all objects name in this group later in the code
@@ -245,64 +244,69 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
245244 int fNumContrib = 0 .;
246245 } ebye;
247246
248-
249-
250-
251247 template <EnRlMc rm, typename T1>
252- bool EventCuts (T1 const & collision)
248+ bool ctEventCuts (T1 const & collision)
253249 {
254250 bool pass = true ;
255251
256- bool VertexZCut = true ;
257- bool Sel8Cut = true ;
258- bool CentCut = true ;
259- bool NumContribCut = true ;
252+ bool bVertexZCut = true ;
253+ bool bSel8Cut = true ;
254+ bool bCentCut = true ;
255+ bool bNumContribCut = true ;
260256
261257 // *) For real event and MC event
262- VertexZCut = collision.posZ () < tc.fVertexZCut [1 ] && collision.posZ () > tc.fVertexZCut [0 ];
258+ bVertexZCut = collision.posZ () < tc.fVertexZCut [1 ] && collision.posZ () > tc.fVertexZCut [0 ];
263259
264260 // *) For real event only
265261 if constexpr (rm == eRl) {
266- Sel8Cut = collision.sel8 ();
267- CentCut = ebye.fCentrality < tc.fCentCut [1 ] && ebye.fCentrality > tc.fCentCut [0 ];
268- NumContribCut = ebye.fNumContrib < tc.fNumContribCut [1 ] && ebye.fNumContrib > tc.fNumContribCut [0 ];
262+ bSel8Cut = collision.sel8 ();
263+ bCentCut = ebye.fCentrality < tc.fCentCut [1 ] && ebye.fCentrality > tc.fCentCut [0 ];
264+ bNumContribCut = ebye.fNumContrib < tc.fNumContribCut [1 ] && ebye.fNumContrib > tc.fNumContribCut [0 ];
269265 }
270266
271267 // *) For MC event only
272268 if constexpr (rm == eMc) {
273- CentCut = ebye.fCentralitySim < tc.fCentCut [1 ] && ebye.fCentralitySim > tc.fCentCut [0 ];
269+ bCentCut = ebye.fCentralitySim < tc.fCentCut [1 ] && ebye.fCentralitySim > tc.fCentCut [0 ];
274270 }
275271
276- if (tc.fVertexZCutSwitch ) {pass = pass && VertexZCut;}
277- if (tc.fSel8CutSwitch ) {pass = pass && Sel8Cut;}
278- if (tc.fCentCutSwitch ) {pass = pass && CentCut;}
279- if (tc.fNumContribCutSwitch ) {pass = pass && NumContribCut;}
272+ if (tc.fVertexZCutSwitch ) {
273+ pass = pass && bVertexZCut;
274+ }
275+ if (tc.fSel8CutSwitch ) {
276+ pass = pass && bSel8Cut;
277+ }
278+ if (tc.fCentCutSwitch ) {
279+ pass = pass && bCentCut;
280+ }
281+ if (tc.fNumContribCutSwitch ) {
282+ pass = pass && bNumContribCut;
283+ }
280284
281285 return pass;
282286 }
283287
284288 template <EnRlMc rm, typename T1>
285- bool ParticleCuts (T1 const & track)
289+ bool ctParticleCuts (T1 const & track)
286290 {
287291 bool pass = true ;
288292
289- bool PtCut = true ;
290- bool EtaCut = true ;
291- bool SignCut = true ;
292- bool TpcNClsFoundCut = true ;
293- bool DCAXYCut = true ;
294- bool DCAZCut = true ;
293+ bool bPtCut = true ;
294+ bool bEtaCut = true ;
295+ bool bSignCut = true ;
296+ bool bTpcNClsFoundCut = true ;
297+ bool bDCAXYCut = true ;
298+ bool bDCAZCut = true ;
295299
296300 // *) For real event and MC event
297- PtCut = track.pt () < tc.fPtCut [1 ] && track.pt () > tc.fPtCut [0 ];
298- EtaCut = track.eta () < tc.fEtaCut [1 ] && track.eta () > tc.fEtaCut [0 ];
299-
301+ bPtCut = track.pt () < tc.fPtCut [1 ] && track.pt () > tc.fPtCut [0 ];
302+ bEtaCut = track.eta () < tc.fEtaCut [1 ] && track.eta () > tc.fEtaCut [0 ];
303+
300304 // *) For real event only
301305 if constexpr (rm == eRl) {
302- SignCut = (track.sign () == -1 && tc.fSignCut [0 ]) || (track.sign () == 0 && tc.fSignCut [1 ]) || (track.sign () == 1 && tc.fSignCut [2 ]);
303- TpcNClsFoundCut = track.tpcNClsFound () < tc.fTpcNClsFoundCut [1 ] && track.tpcNClsFound () > tc.fTpcNClsFoundCut [0 ];
304- DCAXYCut = track.dcaXY () < tc.fDCAXYCut [1 ] && track.dcaXY () > tc.fDCAXYCut [0 ];
305- DCAZCut = track.dcaZ () < tc.fDCAZCut [1 ] && track.dcaZ () > tc.fDCAZCut [0 ];
306+ bSignCut = (track.sign () == -1 && tc.fSignCut [0 ]) || (track.sign () == 0 && tc.fSignCut [1 ]) || (track.sign () == 1 && tc.fSignCut [2 ]);
307+ bTpcNClsFoundCut = track.tpcNClsFound () < tc.fTpcNClsFoundCut [1 ] && track.tpcNClsFound () > tc.fTpcNClsFoundCut [0 ];
308+ bDCAXYCut = track.dcaXY () < tc.fDCAXYCut [1 ] && track.dcaXY () > tc.fDCAXYCut [0 ];
309+ bDCAZCut = track.dcaZ () < tc.fDCAZCut [1 ] && track.dcaZ () > tc.fDCAZCut [0 ];
306310 }
307311
308312 // *) For mc event only
@@ -312,21 +316,32 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
312316
313317 if (!particle) {
314318 // LOGF(warning, "PDG code %d not found", track.pdgCode());
315- SignCut = false ;
316- }
317- else {
319+ bSignCut = false ;
320+ } else {
318321 // LOGF(info, "PDG code %d found", track.pdgCode());
319322 float charge = particle->Charge ();
320- SignCut = (charge < 0 && tc.fSignCut [0 ]) || (charge == 0 && tc.fSignCut [1 ]) || (charge > 0 && tc.fSignCut [2 ]);
323+ bSignCut = (charge < 0 && tc.fSignCut [0 ]) || (charge == 0 && tc.fSignCut [1 ]) || (charge > 0 && tc.fSignCut [2 ]);
321324 }
322325 }
323326
324- if (tc.fPtCutSwitch ) {pass = pass && PtCut;}
325- if (tc.fEtaCutSwitch ) {pass = pass && EtaCut;}
326- if (tc.fSignCutSwitch ) {pass = pass && SignCut;}
327- if (tc.fTpcNClsFoundCutSwitch ) {pass = pass && TpcNClsFoundCut;}
328- if (tc.fDCAXYCutSwitch ) {pass = pass && DCAXYCut;}
329- if (tc.fDCAZCutSwitch ) {pass = pass && DCAZCut;}
327+ if (tc.fPtCutSwitch ) {
328+ pass = pass && bPtCut;
329+ }
330+ if (tc.fEtaCutSwitch ) {
331+ pass = pass && bEtaCut;
332+ }
333+ if (tc.fSignCutSwitch ) {
334+ pass = pass && bSignCut;
335+ }
336+ if (tc.fTpcNClsFoundCutSwitch ) {
337+ pass = pass && bTpcNClsFoundCut;
338+ }
339+ if (tc.fDCAXYCutSwitch ) {
340+ pass = pass && bDCAXYCut;
341+ }
342+ if (tc.fDCAZCutSwitch ) {
343+ pass = pass && bDCAZCut;
344+ }
330345
331346 return pass;
332347 }
@@ -559,13 +574,13 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
559574 LOGF (info, " Vertex Y position: %f" , collision.posY ());
560575 LOGF (info, " Vertex Z position: %f" , collision.posZ ());
561576
562- // Print NContributors
577+ // Print NContributors
563578 LOGF (info, " NContributors: %f" , static_cast <int >(rlCollisionNumContrib));
564579 }
565580 ebye.fCentrality = rlCollisionCent;
566581 ebye.fReferenceMultiplicity = rlCollisionMult;
567582 ebye.fNumContrib = rlCollisionNumContrib;
568-
583+
569584 if constexpr (rs == eRec || rs == eRecAndSim) {
570585 ev.fEventHistograms [eCent][eRec][0 ]->Fill (rlCollisionCent);
571586 ev.fEventHistograms [eMult][eRec][0 ]->Fill (rlCollisionMult);
@@ -574,7 +589,7 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
574589 ev.fEventHistograms [eVertexZ][eRec][0 ]->Fill (collision.posZ ());
575590 ev.fEventHistograms [eNumContrib][eRec][0 ]->Fill (rlCollisionNumContrib);
576591
577- if (EventCuts <eRl>(collision)) {
592+ if (ctEventCuts <eRl>(collision)) {
578593 ev.fEventHistograms [eCent][eRec][1 ]->Fill (rlCollisionCent);
579594 ev.fEventHistograms [eMult][eRec][1 ]->Fill (rlCollisionMult);
580595 ev.fEventHistograms [eVertexX][eRec][1 ]->Fill (collision.posX ());
@@ -613,7 +628,7 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
613628 ev.fEventHistograms [eVertexY][eSim][0 ]->Fill (mccollision.posY ());
614629 ev.fEventHistograms [eVertexZ][eSim][0 ]->Fill (mccollision.posZ ());
615630
616- if (EventCuts <eMc>(mccollision)) {
631+ if (ctEventCuts <eMc>(mccollision)) {
617632 ev.fEventHistograms [eCent][eSim][1 ]->Fill (mcCollisionCent);
618633 ev.fEventHistograms [eVertexX][eSim][1 ]->Fill (mccollision.posX ());
619634 ev.fEventHistograms [eVertexY][eSim][1 ]->Fill (mccollision.posY ());
@@ -623,7 +638,7 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
623638 if (qa.fQASwitch ) {
624639 qa.fQAHistograms [eQACent][0 ]->Fill (rlCollisionCent, mcCollisionCent);
625640 qa.fQAHistograms [eQAMultNumContrib][0 ]->Fill (rlCollisionMult, rlCollisionNumContrib);
626- if (EventCuts <eRl>(collision) && EventCuts <eMc>(mccollision)) {
641+ if (ctEventCuts <eRl>(collision) && ctEventCuts <eMc>(mccollision)) {
627642 qa.fQAHistograms [eQACent][1 ]->Fill (rlCollisionCent, mcCollisionCent);
628643 qa.fQAHistograms [eQAMultNumContrib][1 ]->Fill (rlCollisionMult, rlCollisionNumContrib);
629644 }
@@ -643,7 +658,7 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
643658 pc.fParticleHistograms [ePt][eRec][0 ]->Fill (track.pt ());
644659 pc.fParticleHistograms [ePhi][eRec][0 ]->Fill (track.phi ());
645660
646- if (ParticleCuts <eRl>(track)) {
661+ if (ctParticleCuts <eRl>(track)) {
647662 pc.fParticleHistograms [ePt][eRec][1 ]->Fill (track.pt ());
648663 pc.fParticleHistograms [ePhi][eRec][1 ]->Fill (track.phi ());
649664 }
@@ -662,7 +677,7 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
662677 auto mcparticle = track.mcParticle (); // corresponding MC truth simulated particle
663678 pc.fParticleHistograms [ePt][eSim][0 ]->Fill (mcparticle.pt ());
664679 pc.fParticleHistograms [ePhi][eSim][0 ]->Fill (mcparticle.phi ());
665- if (ParticleCuts <eMc>(mcparticle)) {
680+ if (ctParticleCuts <eMc>(mcparticle)) {
666681 pc.fParticleHistograms [ePt][eSim][1 ]->Fill (mcparticle.pt ());
667682 pc.fParticleHistograms [ePhi][eSim][1 ]->Fill (mcparticle.phi ());
668683 }
@@ -763,12 +778,10 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
763778 if constexpr (histType == eCent) {
764779 std::string nameRecNocutfull = tc.fCentEstm + eventHistNames[histType] + std::string (" distribution for reconstructed events" );
765780 std::string nameSimNocutfull = tc.fCentEstm + eventHistNames[histType] + std::string (" distribution for simulated events" );
766- }
767- else if constexpr (histType == eMult) {
781+ } else if constexpr (histType == eMult) {
768782 std::string nameRecNocutfull = tc.fMultEstm + eventHistNames[histType] + std::string (" distribution for reconstructed events" );
769783 std::string nameSimNocutfull = tc.fMultEstm + eventHistNames[histType] + std::string (" distribution for simulated events" );
770- }
771- else {
784+ } else {
772785 std::string nameRecNocutfull = eventHistNames[histType] + std::string (" distribution for reconstructed events" );
773786 std::string nameSimNocutfull = eventHistNames[histType] + std::string (" distribution for simulated events" );
774787 }
@@ -785,10 +798,8 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
785798 ev.fEventHistograms [histType][eSim][0 ]->GetXaxis ()->SetTitle (eventHistNames[histType]);
786799 ev.fEventHistogramsList ->Add (ev.fEventHistograms [histType][eSim][0 ]);
787800 } // No nContrib and multiplicity for processSim
788-
789801 }
790802
791-
792803 std::string nameRecCut = std::string (" fHist" ) + eventHistNames[histType] + std::string (" [eRec][after cut]" );
793804 std::string nameSimCut = std::string (" fHist" ) + eventHistNames[histType] + std::string (" [eSim][after cut]" );
794805 std::string nameRecCutfull;
@@ -797,12 +808,10 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
797808 if constexpr (histType == eCent) {
798809 std::string nameRecCutfull = tc.fCentEstm + eventHistNames[histType] + std::string (" distribution for reconstructed events" );
799810 std::string nameSimCutfull = tc.fCentEstm + eventHistNames[histType] + std::string (" distribution for simulated events" );
800- }
801- else if constexpr (histType == eMult) {
811+ } else if constexpr (histType == eMult) {
802812 std::string nameRecCutfull = tc.fMultEstm + eventHistNames[histType] + std::string (" distribution for reconstructed events" );
803813 std::string nameSimCutfull = tc.fMultEstm + eventHistNames[histType] + std::string (" distribution for simulated events" );
804- }
805- else {
814+ } else {
806815 std::string nameRecCutfull = eventHistNames[histType] + std::string (" distribution for reconstructed events" );
807816 std::string nameSimCutfull = eventHistNames[histType] + std::string (" distribution for simulated events" );
808817 }
@@ -844,48 +853,41 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
844853 std::string nameNocutfull;
845854 if constexpr (histType == eCent) {
846855 std::string nameNocutfull = std::string (" Quality assurance of " ) + tc.fCentEstm + eventHistNames[histType];
847- }
848- else if constexpr (histType == eNumContrib) {
856+ } else if constexpr (histType == eNumContrib) {
849857 std::string nameNocutfull = std::string (" Quality assurance of " ) + tc.fMultEstm + eventHistNames[histType] + std::string (" vs. NContributors" );
850- }
851- else {
858+ } else {
852859 std::string nameNocutfull = std::string (" Quality assurance of " ) + eventHistNames[histType];
853860 }
854-
861+
855862 qa.fQAHistograms [histType][0 ] = new TH2F (nameNocut.c_str (), nameNocutfull.c_str (), nBinsCent, minCent, maxCent, nBinsCent, minCent, maxCent);
856863 if constexpr (histType == eNumContrib) {
857864 qa.fQAHistograms [histType][0 ]->GetYaxis ()->SetTitle (" NContributors" );
858- qa.fQAHistograms [histType][0 ]->GetXaxis ()->SetTitle (" Reference multiplicity" );
859- }
860- else {
865+ qa.fQAHistograms [histType][0 ]->GetXaxis ()->SetTitle (" Reference multiplicity" );
866+ } else {
861867 qa.fQAHistograms [histType][0 ]->GetYaxis ()->SetTitle (Form (" Simulated %s" , eventHistNames[histType]));
862- qa.fQAHistograms [histType][0 ]->GetXaxis ()->SetTitle (Form (" Reconstructed %s" , eventHistNames[histType]));
868+ qa.fQAHistograms [histType][0 ]->GetXaxis ()->SetTitle (Form (" Reconstructed %s" , eventHistNames[histType]));
863869 }
864870 qa.fQAHistogramsList ->Add (qa.fQAHistograms [histType][0 ]);
865871
866872 std::string nameCut = std::string (" fHist" ) + eventHistNames[histType] + std::string (" [after cut]" );
867873 std::string nameCutfull;
868874 if constexpr (histType == eCent) {
869875 std::string nameCutfull = std::string (" Quality assurance of " ) + tc.fCentEstm + eventHistNames[histType];
870- }
871- else if constexpr (histType == eNumContrib) {
876+ } else if constexpr (histType == eNumContrib) {
872877 std::string nameCutfull = std::string (" Quality assurance of " ) + tc.fMultEstm + eventHistNames[histType];
873- }
874- else {
878+ } else {
875879 std::string nameCutfull = std::string (" Quality assurance of " ) + eventHistNames[histType];
876880 }
877-
881+
878882 qa.fQAHistograms [histType][1 ] = new TH2F (nameCut.c_str (), nameCutfull.c_str (), nBinsCent, minCent, maxCent, nBinsCent, minCent, maxCent);
879883 if constexpr (histType == eNumContrib) {
880884 qa.fQAHistograms [histType][1 ]->GetYaxis ()->SetTitle (" NContributors" );
881- qa.fQAHistograms [histType][1 ]->GetXaxis ()->SetTitle (" Reference multiplicity" );
882- }
883- else {
885+ qa.fQAHistograms [histType][1 ]->GetXaxis ()->SetTitle (" Reference multiplicity" );
886+ } else {
884887 qa.fQAHistograms [histType][1 ]->GetYaxis ()->SetTitle (Form (" Simulated %s" , eventHistNames[histType]));
885- qa.fQAHistograms [histType][1 ]->GetXaxis ()->SetTitle (Form (" Reconstructed %s" , eventHistNames[histType]));
888+ qa.fQAHistograms [histType][1 ]->GetXaxis ()->SetTitle (Form (" Reconstructed %s" , eventHistNames[histType]));
886889 }
887890 qa.fQAHistogramsList ->Add (qa.fQAHistograms [histType][1 ]);
888-
889891 }
890892
891893 // *) Initialize and book all objects:
@@ -982,7 +984,6 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
982984 }
983985 }
984986
985-
986987 } // end of void init(InitContext&) {
987988
988989 // A) Process only reconstructed data:
@@ -1021,4 +1022,4 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
10211022 return WorkflowSpec{
10221023 adaptAnalysisTask<MultiparticleCumulants>(cfgc),
10231024 };
1024- } // WorkflowSpec...
1025+ } // WorkflowSpec...
0 commit comments