Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-05-11 02:21:54

0001 /****************************************************************************
0002 *
0003 * This is a part of TOTEM offline software.
0004 * Authors: 
0005 *   Maciej Wróbel (wroblisko@gmail.com)
0006 *
0007 ****************************************************************************/
0008 
0009 #include "FWCore/Utilities/interface/typelookup.h"
0010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0011 
0012 #include "CondFormats/PPSObjects/interface/TotemDAQMapping.h"
0013 
0014 using namespace std;
0015 
0016 //----------------------------------------------------------------------------------------------------
0017 
0018 std::ostream &operator<<(std::ostream &s, const TotemVFATInfo &vi) {
0019   s << vi.symbolicID << ", hw id=0x" << hex << vi.hwID << dec;
0020 
0021   return s;
0022 }
0023 
0024 //----------------------------------------------------------------------------------------------------
0025 
0026 void TotemDAQMapping::insert(const TotemFramePosition &fp, const TotemVFATInfo &vi) {
0027   auto it = VFATMapping.find(fp);
0028   if (it != VFATMapping.end()) {
0029     edm::LogWarning("Totem") << "WARNING in DAQMapping::insert > Overwriting entry at " << fp << ". Previous: "
0030                              << "    " << VFATMapping[fp] << ","
0031                              << "  new: "
0032                              << "    " << vi << ". " << endl;
0033   }
0034 
0035   VFATMapping[fp] = vi;
0036 }
0037 
0038 //----------------------------------------------------------------------------------------------------
0039 void TotemDAQMapping::insert(const TotemT2FramePosition &fp2, const TotemVFATInfo &vi) {
0040   const TotemFramePosition fp1(fp2.getRawPosition());
0041   auto it = VFATMapping.find(fp1);
0042   if (it != VFATMapping.end()) {
0043     edm::LogWarning("Totem") << "WARNING in DAQMapping::insert > Overwriting T2 entry at " << fp2 << ". Previous: "
0044                              << "    " << VFATMapping[fp1] << ","
0045                              << "  new: "
0046                              << "    " << vi << ". " << endl;
0047   }
0048 
0049   VFATMapping[fp1] = vi;
0050 }
0051 
0052 //----------------------------------------------------------------------------------------------------
0053 
0054 const TotemDAQMapping::TotemTimingPlaneChannelPair TotemDAQMapping::getTimingChannel(const uint8_t hwId) const {
0055   TotemTimingPlaneChannelPair pair;
0056   auto iterator = totemTimingChannelMap.find(hwId);
0057   if (iterator != totemTimingChannelMap.end())
0058     pair = iterator->second;
0059   return pair;
0060 }
0061 
0062 //----------------------------------------------------------------------------------------------------
0063 
0064 TYPELOOKUP_DATA_REG(TotemDAQMapping);