@@ -72,7 +72,7 @@ using namespace o2::aod::pwgem::dilepton::utils::pairutil;
7272using MyCollisions = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMEventsQvec>;
7373using MyCollision = MyCollisions::iterator;
7474
75- using MyCollisionsWithSWT = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMEventsQvec, aod::EMSWTriggerInfos >;
75+ using MyCollisionsWithSWT = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMEventsQvec, aod::EMSWTriggerBits >;
7676using MyCollisionWithSWT = MyCollisionsWithSWT::iterator;
7777
7878using MyElectrons = soa::Join<aod::EMPrimaryElectrons, aod::EMPrimaryElectronEMEventIds, aod::EMAmbiguousElectronSelfIds, aod::EMPrimaryElectronsPrefilterBit, aod::EMPrimaryElectronsPrefilterBitDerived>;
@@ -427,7 +427,13 @@ struct Dilepton {
427427 fRegistry .addClone (" Event/before/hCollisionCounter" , " Event/norm/hCollisionCounter" );
428428 }
429429 if (doprocessTriggerAnalysis) {
430- fRegistry .add (" Event/hNInspectedTVX" , " N inspected TVX;run number;N_{TVX}" , kTProfile , {{80000 , 520000.5 , 600000.5 }}, true );
430+ LOGF (info, " Trigger analysis is enabled. Desired trigger name = %s" , cfg_swt_name.value );
431+ fRegistry .add (" NormTrigger/hInspectedTVX" , " inspected TVX;run number;N_{TVX}" , kTProfile , {{80000 , 520000.5 , 600000.5 }}, true );
432+ fRegistry .add (" NormTrigger/hScalers" , " trigger counter before DS;run number;counter" , kTProfile , {{80000 , 520000.5 , 600000.5 }}, true );
433+ fRegistry .add (" NormTrigger/hSelections" , " trigger counter after DS;run number;counter" , kTProfile , {{80000 , 520000.5 , 600000.5 }}, true );
434+ auto hTriggerCounter = fRegistry .add <TH2>(" NormTrigger/hTriggerCounter" , Form (" trigger counter of %s;run number;" , cfg_swt_name.value .data ()), kTH2D , {{80000 , 520000.5 , 600000.5 }, {2 , -0.5 , 1.5 }}, false );
435+ hTriggerCounter->GetYaxis ()->SetBinLabel (1 , " Analyzed Trigger" );
436+ hTriggerCounter->GetYaxis ()->SetBinLabel (2 , " Analyzed TOI" );
431437 }
432438 if (doprocessBC) {
433439 auto hTVXCounter = fRegistry .add <TH1>(" BC/hTVXCounter" , " TVX counter" , kTH1D , {{6 , -0 .5f , 5 .5f }});
@@ -440,7 +446,7 @@ struct Dilepton {
440446 }
441447 }
442448
443- template <bool isTriggerAnalysis, typename TCollision>
449+ template <typename TCollision>
444450 void initCCDB (TCollision const & collision)
445451 {
446452 if (mRunNumber == collision.runNumber ()) {
@@ -494,12 +500,6 @@ struct Dilepton {
494500 beamP2 = std::sqrt (std::pow (beamE2, 2 ) - std::pow (beamM2, 2 ));
495501 LOGF (info, " beamZ1 = %d, beamZ2 = %d, beamA1 = %d, beamA2 = %d, beamE1 = %f (GeV), beamE2 = %f (GeV), beamM1 = %f (GeV), beamM2 = %f (GeV), beamP1 = %f (GeV), beamP2 = %f (GeV)" , beamZ1, beamZ2, beamA1, beamA2, beamE1, beamE2, beamM1, beamM2, beamP1, beamP2);
496502
497- if constexpr (isTriggerAnalysis) {
498- LOGF (info, " Trigger analysis is enabled. Desired trigger name = %s" , cfg_swt_name.value );
499- LOGF (info, " total inspected TVX events = %d in run number %d" , collision.nInspectedTVX (), collision.runNumber ());
500- fRegistry .fill (HIST (" Event/hNInspectedTVX" ), collision.runNumber (), collision.nInspectedTVX ());
501- }
502-
503503 if (cfgApplySPresolution) {
504504 auto list = ccdb->getForTimeStamp <TList>(spresoPath, collision.timestamp ());
505505 h2sp_resolution = reinterpret_cast <TH2D*>(list->FindObject (spresoHistName.value .data ()));
@@ -1164,7 +1164,7 @@ struct Dilepton {
11641164 void runPairing (TCollisions const & collisions, TLeptons const & posTracks, TLeptons const & negTracks, TPresilce const & perCollision, TCut const & cut, TAllTracks const & tracks)
11651165 {
11661166 for (const auto & collision : collisions) {
1167- initCCDB<isTriggerAnalysis> (collision);
1167+ initCCDB (collision);
11681168 const float centralities[3 ] = {collision.centFT0M (), collision.centFT0A (), collision.centFT0C ()};
11691169 float centrality = centralities[cfgCentEstimator];
11701170 if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) {
@@ -1412,7 +1412,7 @@ struct Dilepton {
14121412 passed_pairIds.reserve (posTracks.size () * negTracks.size ());
14131413
14141414 for (const auto & collision : collisions) {
1415- initCCDB<isTriggerAnalysis> (collision);
1415+ initCCDB (collision);
14161416 const float centralities[3 ] = {collision.centFT0M (), collision.centFT0A (), collision.centFT0C ()};
14171417 if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) {
14181418 continue ;
@@ -1531,8 +1531,8 @@ struct Dilepton {
15311531 }
15321532 PROCESS_SWITCH (Dilepton, processAnalysis, " run dilepton analysis" , true );
15331533
1534- // using FilteredMyCollisionsWithSWT = soa::Filtered<MyCollisionsWithSWT>;
1535- void processTriggerAnalysis (MyCollisionsWithSWT const & collisions, Types const &... args)
1534+ using FilteredMyCollisionsWithSWT = soa::Filtered<MyCollisionsWithSWT>;
1535+ void processTriggerAnalysis (FilteredMyCollisionsWithSWT const & collisions, aod::EMSWTriggerInfos const & cefpinfos, aod::EMSWTriggerCounters const & counters , Types const &... args)
15361536 {
15371537 if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron ) {
15381538 auto electrons = std::get<0 >(std::tie (args...));
@@ -1549,6 +1549,23 @@ struct Dilepton {
15491549 }
15501550 map_weight.clear ();
15511551 ndf++;
1552+
1553+ // for nomalization
1554+ int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at (cfg_swt_name.value );
1555+ for (const auto & counter : counters) {
1556+ if (counter.isAnalyzed_bit (emswtId)) {
1557+ fRegistry .fill (HIST (" NormTrigger/hTriggerCounter" ), mRunNumber , 0 );
1558+ }
1559+ if (counter.isAnalyzedToI_bit (emswtId)) {
1560+ fRegistry .fill (HIST (" NormTrigger/hTriggerCounter" ), mRunNumber , 1 );
1561+ }
1562+ }
1563+
1564+ for (const auto & info : cefpinfos) {
1565+ fRegistry .fill (HIST (" NormTrigger/hInspectedTVX" ), info.runNumber (), info.nInspectedTVX ());
1566+ fRegistry .fill (HIST (" NormTrigger/hScalers" ), info.runNumber (), info.nScalers ()[emswtId]);
1567+ fRegistry .fill (HIST (" NormTrigger/hSelections" ), info.runNumber (), info.nSelections ()[emswtId]);
1568+ }
15521569 }
15531570 PROCESS_SWITCH (Dilepton, processTriggerAnalysis, " run dilepton analysis on triggered data" , false );
15541571
0 commit comments