@@ -345,88 +345,88 @@ struct tpcPid {
345345 network_prediction = createNetworkPrediction (collisions, tracks, tracksForNet_size);
346346 }
347347
348- uint64_t count_tracks = 0 ;
349-
350- for (auto const & trk : tracks) {
351- // Loop on Tracks
352- if (trk.has_collision ()) {
353- const auto & bc = collisions.iteratorAt (trk.collisionId ()).bc_as <aod::BCsWithTimestamps>();
354- if (useCCDBParam && ccdbTimestamp.value == 0 && !ccdb->isCachedObjectValid (ccdbPath.value , bc.timestamp ())) { // Updating parametrisation only if the initial timestamp is 0
355- if (recoPass.value == " " ) {
356- LOGP (info, " Retrieving latest TPC response object for timestamp {}:" , bc.timestamp ());
357- } else {
358- LOGP (info, " Retrieving TPC Response for timestamp {} and recoPass {}:" , bc.timestamp (), recoPass.value );
359- }
360- response = ccdb->getSpecific <o2::pid::tpc::Response>(ccdbPath.value , bc.timestamp (), metadata);
348+ uint64_t count_tracks = 0 ;
349+
350+ for (auto const & trk : tracks) {
351+ // Loop on Tracks
352+ if (trk.has_collision ()) {
353+ const auto & bc = collisions.iteratorAt (trk.collisionId ()).bc_as <aod::BCsWithTimestamps>();
354+ if (useCCDBParam && ccdbTimestamp.value == 0 && !ccdb->isCachedObjectValid (ccdbPath.value , bc.timestamp ())) { // Updating parametrisation only if the initial timestamp is 0
355+ if (recoPass.value == " " ) {
356+ LOGP (info, " Retrieving latest TPC response object for timestamp {}:" , bc.timestamp ());
357+ } else {
358+ LOGP (info, " Retrieving TPC Response for timestamp {} and recoPass {}:" , bc.timestamp (), recoPass.value );
359+ }
360+ response = ccdb->getSpecific <o2::pid::tpc::Response>(ccdbPath.value , bc.timestamp (), metadata);
361+ if (!response) {
362+ LOGP (warning, " !! Could not find a valid TPC response object for specific pass name {}! Falling back to latest uploaded object." , recoPass.value );
363+ response = ccdb->getForTimeStamp <o2::pid::tpc::Response>(ccdbPath.value , bc.timestamp ());
361364 if (!response) {
362- LOGP (warning, " !! Could not find a valid TPC response object for specific pass name {}! Falling back to latest uploaded object." , recoPass.value );
363- response = ccdb->getForTimeStamp <o2::pid::tpc::Response>(ccdbPath.value , bc.timestamp ());
364- if (!response) {
365- LOGP (fatal, " Could not find ANY TPC response object for the timestamp {}!" , bc.timestamp ());
366- }
365+ LOGP (fatal, " Could not find ANY TPC response object for the timestamp {}!" , bc.timestamp ());
367366 }
368- response->PrintAll ();
369367 }
368+ response->PrintAll ();
370369 }
371- // Check and fill enabled tables
372- auto makeTablePid = [&trk, &collisions, &network_prediction, &count_tracks, &tracksForNet_size, this ](const int flag, auto & table, const o2::track::PID::ID pid) {
373- if (flag != 1 ) {
374- return ;
375- }
376- if (!trk.hasTPC ()) {
377- table (aod::pidtpc_tiny::binning::underflowBin);
378- return ;
379- }
380- if (skipTPCOnly) {
381- if (!trk.hasITS () && !trk.hasTRD () && !trk.hasTOF ()) {
382- table (aod::pidtpc_tiny::binning::underflowBin);
383- return ;
384- }
385- }
386- auto expSignal = response->GetExpectedSignal (trk, pid);
387- auto expSigma = response->GetExpectedSigma (collisions.iteratorAt (trk.collisionId ()), trk, pid);
388- if (expSignal < 0 . || expSigma < 0 .) { // skip if expected signal invalid
370+ }
371+ // Check and fill enabled tables
372+ auto makeTablePid = [&trk, &collisions, &network_prediction, &count_tracks, &tracksForNet_size, this ](const int flag, auto & table, const o2::track::PID::ID pid) {
373+ if (flag != 1 ) {
374+ return ;
375+ }
376+ if (!trk.hasTPC ()) {
377+ table (aod::pidtpc_tiny::binning::underflowBin);
378+ return ;
379+ }
380+ if (skipTPCOnly) {
381+ if (!trk.hasITS () && !trk.hasTRD () && !trk.hasTOF ()) {
389382 table (aod::pidtpc_tiny::binning::underflowBin);
390383 return ;
391384 }
385+ }
386+ auto expSignal = response->GetExpectedSignal (trk, pid);
387+ auto expSigma = response->GetExpectedSigma (collisions.iteratorAt (trk.collisionId ()), trk, pid);
388+ if (expSignal < 0 . || expSigma < 0 .) { // skip if expected signal invalid
389+ table (aod::pidtpc_tiny::binning::underflowBin);
390+ return ;
391+ }
392392
393- if (useNetworkCorrection) {
394-
395- // Here comes the application of the network. The output--dimensions of the network dtermine the application: 1: mean, 2: sigma, 3: sigma asymmetric
396- // For now only the option 2: sigma will be used. The other options are kept if there would be demand later on
397- if (network.getNumOutputNodes () == 1 ) {
398- aod::pidutils::packInTable<aod::pidtpc_tiny::binning>((trk.tpcSignal () - network_prediction[count_tracks + tracksForNet_size * pid] * expSignal) / expSigma, table);
399- } else if (network.getNumOutputNodes () == 2 ) {
400- aod::pidutils::packInTable<aod::pidtpc_tiny::binning>((trk.tpcSignal () / expSignal - network_prediction[2 * (count_tracks + tracksForNet_size * pid)]) / (network_prediction[2 * (count_tracks + tracksForNet_size * pid) + 1 ] - network_prediction[2 * (count_tracks + tracksForNet_size * pid)]), table);
401- } else if (network.getNumOutputNodes () == 3 ) {
402- if (trk.tpcSignal () / expSignal >= network_prediction[3 * (count_tracks + tracksForNet_size * pid)]) {
403- aod::pidutils::packInTable<aod::pidtpc_tiny::binning>((trk.tpcSignal () / expSignal - network_prediction[3 * (count_tracks + tracksForNet_size * pid)]) / (network_prediction[3 * (count_tracks + tracksForNet_size * pid) + 1 ] - network_prediction[3 * (count_tracks + tracksForNet_size * pid)]), table);
404- } else {
405- aod::pidutils::packInTable<aod::pidtpc_tiny::binning>((trk.tpcSignal () / expSignal - network_prediction[3 * (count_tracks + tracksForNet_size * pid)]) / (network_prediction[3 * (count_tracks + tracksForNet_size * pid)] - network_prediction[3 * (count_tracks + tracksForNet_size * pid) + 2 ]), table);
406- }
393+ if (useNetworkCorrection) {
394+
395+ // Here comes the application of the network. The output--dimensions of the network dtermine the application: 1: mean, 2: sigma, 3: sigma asymmetric
396+ // For now only the option 2: sigma will be used. The other options are kept if there would be demand later on
397+ if (network.getNumOutputNodes () == 1 ) {
398+ aod::pidutils::packInTable<aod::pidtpc_tiny::binning>((trk.tpcSignal () - network_prediction[count_tracks + tracksForNet_size * pid] * expSignal) / expSigma, table);
399+ } else if (network.getNumOutputNodes () == 2 ) {
400+ aod::pidutils::packInTable<aod::pidtpc_tiny::binning>((trk.tpcSignal () / expSignal - network_prediction[2 * (count_tracks + tracksForNet_size * pid)]) / (network_prediction[2 * (count_tracks + tracksForNet_size * pid) + 1 ] - network_prediction[2 * (count_tracks + tracksForNet_size * pid)]), table);
401+ } else if (network.getNumOutputNodes () == 3 ) {
402+ if (trk.tpcSignal () / expSignal >= network_prediction[3 * (count_tracks + tracksForNet_size * pid)]) {
403+ aod::pidutils::packInTable<aod::pidtpc_tiny::binning>((trk.tpcSignal () / expSignal - network_prediction[3 * (count_tracks + tracksForNet_size * pid)]) / (network_prediction[3 * (count_tracks + tracksForNet_size * pid) + 1 ] - network_prediction[3 * (count_tracks + tracksForNet_size * pid)]), table);
407404 } else {
408- LOGF (fatal, " Network output-dimensions incompatible! " );
405+ aod::pidutils::packInTable<aod::pidtpc_tiny::binning>((trk. tpcSignal () / expSignal - network_prediction[ 3 * (count_tracks + tracksForNet_size * pid)]) / (network_prediction[ 3 * (count_tracks + tracksForNet_size * pid)] - network_prediction[ 3 * (count_tracks + tracksForNet_size * pid) + 2 ]), table );
409406 }
410407 } else {
411- aod::pidutils::packInTable<aod::pidtpc_tiny::binning>(response-> GetNumberOfSigma (collisions. iteratorAt (trk. collisionId ()), trk, pid), table );
408+ LOGF (fatal, " Network output-dimensions incompatible! " );
412409 }
413- };
414-
415- makeTablePid (pidEl.value , tablePIDEl, o2::track::PID::Electron);
416- makeTablePid (pidMu.value , tablePIDMu, o2::track::PID::Muon);
417- makeTablePid (pidPi.value , tablePIDPi, o2::track::PID::Pion);
418- makeTablePid (pidKa.value , tablePIDKa, o2::track::PID::Kaon);
419- makeTablePid (pidPr.value , tablePIDPr, o2::track::PID::Proton);
420- makeTablePid (pidDe.value , tablePIDDe, o2::track::PID::Deuteron);
421- makeTablePid (pidTr.value , tablePIDTr, o2::track::PID::Triton);
422- makeTablePid (pidHe.value , tablePIDHe, o2::track::PID::Helium3);
423- makeTablePid (pidAl.value , tablePIDAl, o2::track::PID::Alpha);
424-
425- if (trk.hasTPC () && (!skipTPCOnly || trk.hasITS () || trk.hasTRD () || trk.hasTOF ())) {
426- count_tracks++; // Increment network track counter only if track has TPC, and (not skipping TPConly) or (is not TPConly)
410+ } else {
411+ aod::pidutils::packInTable<aod::pidtpc_tiny::binning>(response->GetNumberOfSigma (collisions.iteratorAt (trk.collisionId ()), trk, pid), table);
427412 }
413+ };
414+
415+ makeTablePid (pidEl.value , tablePIDEl, o2::track::PID::Electron);
416+ makeTablePid (pidMu.value , tablePIDMu, o2::track::PID::Muon);
417+ makeTablePid (pidPi.value , tablePIDPi, o2::track::PID::Pion);
418+ makeTablePid (pidKa.value , tablePIDKa, o2::track::PID::Kaon);
419+ makeTablePid (pidPr.value , tablePIDPr, o2::track::PID::Proton);
420+ makeTablePid (pidDe.value , tablePIDDe, o2::track::PID::Deuteron);
421+ makeTablePid (pidTr.value , tablePIDTr, o2::track::PID::Triton);
422+ makeTablePid (pidHe.value , tablePIDHe, o2::track::PID::Helium3);
423+ makeTablePid (pidAl.value , tablePIDAl, o2::track::PID::Alpha);
424+
425+ if (trk.hasTPC () && (!skipTPCOnly || trk.hasITS () || trk.hasTRD () || trk.hasTOF ())) {
426+ count_tracks++; // Increment network track counter only if track has TPC, and (not skipping TPConly) or (is not TPConly)
428427 }
429428 }
429+ }
430430
431431 PROCESS_SWITCH (tpcPid, processStandard, " Creating PID tables for real data" , !(bool )mcTuneDeDxOnData.value);
432432
@@ -584,6 +584,6 @@ struct tpcPid {
584584 }
585585
586586 PROCESS_SWITCH (tpcPid, processMc, " Creating PID tables for MC identity" , (bool )mcTuneDeDxOnData.value);
587- };
587+ };
588588
589- WorkflowSpec defineDataProcessing (ConfigContext const & cfgc) { return WorkflowSpec{adaptAnalysisTask<tpcPid>(cfgc)}; }
589+ WorkflowSpec defineDataProcessing (ConfigContext const & cfgc) { return WorkflowSpec{adaptAnalysisTask<tpcPid>(cfgc)}; }
0 commit comments