diff --git a/Plume/PlumeReco/options/examples/plume.py b/Plume/PlumeReco/options/examples/plume.py index cedb1b8c84da15c79b1206e4287b8aee388ca864..0adcdcb1c6ee3f934623476f60e8661c3e06109a 100755 --- a/Plume/PlumeReco/options/examples/plume.py +++ b/Plume/PlumeReco/options/examples/plume.py @@ -30,10 +30,10 @@ options = Options( simulation=False, data_type="2023", input_files= - '/eos/lhcb/wg/rta/samples/data/2024-PLUME-RAW/plume_v4.mdf', #v4, little endian + 'mdf:root://eoslhcb.cern.ch//eos/lhcb/cern-swtest/lhcb/swtest/2024_raw_hlt1_290683/Run_0000290683_20240417-065023-114_UCEB02_0001.mdf', dddb_tag='dddb-20210617', conddb_tag='sim-20210617-vc-md100', - evt_max=500, + evt_max=200, histo_file=f'./plume_histos.root', ntuple_file=f'./plume_ntuple.root', monitoring_file=f"plume_output.json", diff --git a/Plume/PlumeReco/src/PlumeDigitMonitor.cpp b/Plume/PlumeReco/src/PlumeDigitMonitor.cpp index f965abfc4ff54cbab011932c09bae7134a88f8ab..ac02355054d4cbc317a36e9cfb7bb5ca0c345223 100644 --- a/Plume/PlumeReco/src/PlumeDigitMonitor.cpp +++ b/Plume/PlumeReco/src/PlumeDigitMonitor.cpp @@ -68,13 +68,12 @@ namespace { return oss.str(); } - const auto AxisBCID = axis1D( 3565, -0.5, 3564.5 ); - const auto AxisADC = axis1D( 4096 + 256, -256, 4096 ); - const auto AxisTIME = axis1D( 100, 0, 8 ); - const auto AxisTIMEERR = axis1D( 100, 0, 0.4 ); - const auto AxisSAMP = axis1D( 1000, 0, 1000 ); - const auto AxisSAMPERR = axis1D( 100, 0, 10 ); - const auto AxisINDEXTAE = axis1D( 9, 0.5, 9.5 ); + const auto AxisBCID = axis1D( 3565, -0.5, 3564.5 ); + const auto AxisADC = axis1D( 4096 + 256, -256, 4096 ); + const auto AxisTIME = axis1D( 100, 0, 8 ); + const auto AxisTIMEERR = axis1D( 100, 0, 0.4 ); + const auto AxisSAMP = axis1D( 1000, 0, 1000 ); + const auto AxisSAMPERR = axis1D( 100, 0, 10 ); } // namespace class PlumeDigitMonitor final @@ -209,11 +208,6 @@ private: // ADC vs BCID (TProfile1) for every channel mutable std::map> m_channel_bcid_adc; - // Pedestals - mutable std::map> m_channel_pedestals; - - mutable Gaudi::Accumulators::Histogram<2> m_bcid_lumi_tae{this, "bcid_lumi_tae", "ADC counts in lumi channels in TAE", - AxisINDEXTAE, AxisADC}; // Timing data mutable Gaudi::Accumulators::Histogram<1> m_time_adc{this, "adc_TIME", "ADC for all timing channels", AxisADC}; mutable std::map> m_channel_time; @@ -248,21 +242,18 @@ StatusCode PlumeDigitMonitor::initialize() { } // loops over Monitoring PMT numbers, that are defined between 1 and 4 for ( int i : {5, 29, 11, 35} ) { for ( int j = 0; j <= 15; ++j ) channels.emplace_back( ChannelID::ChannelType::TIME, i, j ); - channels.emplace_back( ChannelID::ChannelType::TIME_T, i ); } for ( const auto& ch : channels ) { if ( ch.channelType() != ChannelID::ChannelType::TIME_T ) { map_emplace( m_channel_bcid_adc, ch, this, "bcid_adc_" + ch.toString(), "ADC vs BCID for " + ch.toString(), AxisBCID ); - map_emplace( m_channel_pedestals, ch, this, "pedestal_" + ch.toString(), "Pedestal for " + ch.toString(), - AxisADC ); } for ( auto bx : {BXTypes::NoBeam, BXTypes::Beam1, BXTypes::Beam2, BXTypes::BeamCrossing} ) { map_emplace( m_channel_bx_adc, std::make_pair( ch, bx ), this, "adc_" + ch.toString() + "_" + to_string( bx ), "ADC for " + ch.toString() + "/" + to_string( bx ), AxisADC ); - if ( ch.channelType() == ChannelID::ChannelType::LUMI ) { + if ( ch.channelType() == ChannelID::ChannelType::LUMI && bx == BXTypes::NoBeam ) { map_emplace( m_channel_bx_adc_calib, std::make_pair( ch, bx ), this, "adc_" + ch.toString() + "_" + to_string( bx ) + "_calib_signals", "ADC for " + ch.toString() + "/" + to_string( bx ) + "/calib signals", AxisADC ); @@ -329,7 +320,6 @@ void PlumeDigitMonitor::monitor( const Input& adcs, const LHCb::ODIN& odin ) con auto calibType = odin.calibrationType(); auto bx = odin.bunchCrossingType(); const auto bcid = odin.bunchId(); - auto indexTAE = odin.timeAlignmentEventIndex(); using ChannelType = ChannelID::ChannelType; @@ -343,31 +333,18 @@ void PlumeDigitMonitor::monitor( const Input& adcs, const LHCb::ODIN& odin ) con const auto channel_id = digit->channelID().channelID(); const auto channel_sub_id = digit->channelID().channelSubID(); const auto over_thld = overThreshold( *digit ); - const auto pedestal = digit->pedestal(); + const auto key = std::make_pair( digit->channelID(), odin.bunchCrossingType() ); - ++m_channel_pedestals.at( digit->channelID() )[pedestal]; m_channel_bcid_adc.at( digit->channelID() )[bcid] += adc; // Profile ADC vs BXID for each channel - bool complementOT = false; - if ( type == ChannelType::LUMI || type == ChannelType::TIME ) { - const auto* complement = adcs.object( ChannelID( - type, channel_id < 24 ? ( channel_id + 24 ) : ( channel_id - 24 ), digit->channelID().channelSubID() ) ); - complementOT = ( complement != nullptr ) && overThreshold( *complement ); - } - if ( calibType == 0 && type == ChannelType::LUMI ) { // lumi PMT, without requiring coincidence - auto key = std::make_pair( digit->channelID(), odin.bunchCrossingType() ); ++m_channel_bx_adc.at( key )[adc]; - } else if ( calibType != 0 && type == ChannelType::LUMI ) { // lumi PMT, without requiring coincidence, but with - // the LED signals - auto key = std::make_pair( digit->channelID(), odin.bunchCrossingType() ); + } else if ( calibType != 0 && type == ChannelType::LUMI && + bx == BXTypes::NoBeam ) { // lumi PMT, without requiring coincidence, but with the LED signals ++m_channel_bx_adc_calib.at( key )[adc]; - } else if ( calibType == 0 && complementOT && type == ChannelType::TIME ) { // timing PMT requires coincidence - auto key = std::make_pair( digit->channelID(), odin.bunchCrossingType() ); + } else if ( calibType == 0 && type == ChannelType::TIME ) { // timing PMT requires coincidence ++m_channel_bx_adc.at( key )[adc]; - } - - else if ( type == ChannelType::TIME && channel_sub_id == 0 ) { + } else if ( type == ChannelType::TIME && channel_sub_id == 0 ) { if ( sshape_status.at( channel_id ) == true ) { ++m_time_channel.at( channel_id )[{bcid, sshape_result.at( channel_id )[3].first}]; ++m_time_err_channel.at( channel_id )[{bcid, sshape_result.at( channel_id )[3].second}]; @@ -379,20 +356,22 @@ void PlumeDigitMonitor::monitor( const Input& adcs, const LHCb::ODIN& odin ) con ++m_sshape_amp_tot.at( channel_id )[sshape_result.at( channel_id )[1].first]; ++m_sshape_amp_err_tot.at( channel_id )[sshape_result.at( channel_id )[1].second]; } + } else if ( type == ChannelType::PIN || type == ChannelType::MON ) { + ++m_channel_bx_adc.at( key )[adc]; } switch ( type ) { case ChannelType::LUMI: - if ( calibType == 0 ) ++m_lumi_bx_adc.at( bx )[adc]; // do not require coincidence + if ( calibType == 0 ) ++m_lumi_bx_adc.at( bx )[adc]; break; case ChannelType::TIME: - if ( calibType == 0 && complementOT ) ++m_time_bx_adc.at( bx )[adc]; + if ( calibType == 0 ) ++m_time_bx_adc.at( bx )[adc]; break; case ChannelType::PIN: - if ( calibType != 0 ) ++m_pin_bx_adc.at( bx )[adc]; + ++m_pin_bx_adc.at( bx )[adc]; break; case ChannelType::MON: - if ( calibType != 0 ) ++m_mon_bx_adc.at( bx )[adc]; + ++m_mon_bx_adc.at( bx )[adc]; break; default: break; @@ -403,65 +382,67 @@ void PlumeDigitMonitor::monitor( const Input& adcs, const LHCb::ODIN& odin ) con ++m_bcid_adc_lumi[{bcid, adc}]; ++m_bcid_adc_lumi_coarse[{bcid, adc}]; - if ( indexTAE > 0 ) { ++m_bcid_lumi_tae[{10 - indexTAE, adc}]; } - // fill histograms for front layer - int x = channel_id % 6 + 1; - int y = channel_id % 6 + 1; - ++nOTLumi; + // avoid calib signals, that are in empty-empty, and fill only if over threshold + if ( bx != BXTypes::NoBeam && over_thld ) { + // fill histograms for front layer + int x = channel_id % 6 + 1; + int y = channel_id % 6 + 1; + ++nOTLumi; - if ( channel_id > 11 && channel_id < 24 ) { - x *= -1; - y *= -1; - } - if ( channel_id > 35 && channel_id < 48 ) { - x *= -1; - y *= -1; - } - ( channel_id % 12 ) < 5 ? y = 0 : x = 0; - - // fill outliers first - if ( channel_id == 17 ) { ++m_xy_hits_front[{-2, -2}]; } - if ( channel_id == 23 ) { ++m_xy_hits_front[{2, -2}]; } - if ( channel_id == 41 ) { ++m_xy_hits_back[{-2, -2}]; } - if ( channel_id == 47 ) { ++m_xy_hits_back[{2, -2}]; } - - if ( channel_id < 24 ) { - ++m_xy_hits_front[{x, y}]; - if ( x > 0 && y == 0 ) { - ++m_occup_front_right[channel_id % 6]; - ++m_assym_front_horiz[x - 0.5]; - } - if ( x == 0 && y > 0 ) { - ++m_occup_front_up[channel_id % 6]; - ++m_assym_front_vert[y - 0.5]; + if ( channel_id > 11 && channel_id < 24 ) { + x *= -1; + y *= -1; } - if ( x < 0 && y == 0 ) { - ++m_occup_front_left[channel_id % 6]; - ++m_assym_front_horiz[x + 0.5]; + if ( channel_id > 35 && channel_id < 48 ) { + x *= -1; + y *= -1; } - if ( x == 0 && y < 0 ) { - ++m_occup_front_down[channel_id % 6]; - ++m_assym_front_vert[y + 0.5]; + ( channel_id % 12 ) < 5 ? y = 0 : x = 0; + + // fill outliers first + if ( channel_id == 17 ) { ++m_xy_hits_front[{-2, -2}]; } + if ( channel_id == 23 ) { ++m_xy_hits_front[{2, -2}]; } + if ( channel_id == 41 ) { ++m_xy_hits_back[{-2, -2}]; } + if ( channel_id == 47 ) { ++m_xy_hits_back[{2, -2}]; } + + if ( channel_id < 24 ) { + ++m_xy_hits_front[{x, y}]; + if ( x > 0 && y == 0 ) { + ++m_occup_front_right[channel_id % 6]; + ++m_assym_front_horiz[x - 0.5]; + } + if ( x == 0 && y > 0 ) { + ++m_occup_front_up[channel_id % 6]; + ++m_assym_front_vert[y - 0.5]; + } + if ( x < 0 && y == 0 ) { + ++m_occup_front_left[channel_id % 6]; + ++m_assym_front_horiz[x + 0.5]; + } + if ( x == 0 && y < 0 ) { + ++m_occup_front_down[channel_id % 6]; + ++m_assym_front_vert[y + 0.5]; + } } - } - if ( channel_id >= 24 ) { - ++m_xy_hits_back[{x, y}]; - if ( x > 0 && y == 0 ) { - ++m_occup_back_right[channel_id % 6]; - ++m_assym_back_horiz[x - 0.5]; - } - if ( x == 0 && y > 0 ) { - ++m_occup_back_up[channel_id % 6]; - ++m_assym_back_vert[y - 0.5]; - } - if ( x < 0 && y == 0 ) { - ++m_occup_back_left[channel_id % 6]; - ++m_assym_back_horiz[x + 0.5]; - } - if ( x == 0 && y < 0 ) { - ++m_occup_back_down[channel_id % 6]; - ++m_assym_back_vert[y + 0.5]; + if ( channel_id >= 24 ) { + ++m_xy_hits_back[{x, y}]; + if ( x > 0 && y == 0 ) { + ++m_occup_back_right[channel_id % 6]; + ++m_assym_back_horiz[x - 0.5]; + } + if ( x == 0 && y > 0 ) { + ++m_occup_back_up[channel_id % 6]; + ++m_assym_back_vert[y - 0.5]; + } + if ( x < 0 && y == 0 ) { + ++m_occup_back_left[channel_id % 6]; + ++m_assym_back_horiz[x + 0.5]; + } + if ( x == 0 && y < 0 ) { + ++m_occup_back_down[channel_id % 6]; + ++m_assym_back_vert[y + 0.5]; + } } } break; diff --git a/Plume/PlumeReco/tests/options/plume_decoding.py b/Plume/PlumeReco/tests/options/plume_decoding.py index 0336fb8ae8a7c20f443410c16bfd2f27e6bf8495..2f9b1cff4093bbc8e0ecd1165697a6b096507fea 100644 --- a/Plume/PlumeReco/tests/options/plume_decoding.py +++ b/Plume/PlumeReco/tests/options/plume_decoding.py @@ -26,7 +26,7 @@ from PyConf.Algorithms import ( PrintHeader, ) -options = test_file_db["plume-raw-data-v4"].make_lbexec_options( +options = test_file_db["2024_raw_hlt1_290683"].make_lbexec_options( simulation=True, dddb_tag="dddb-20210617", conddb_tag="sim-20210617-vc-md100",