Public Member Functions | Private Member Functions | Private Attributes | List of all members
beamlineutil::BeamlineChannelMap Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-04-12/BeamlineUtils/BeamlineChannelMap.h"

Public Member Functions

 BeamlineChannelMap (fhicl::ParameterSet const &pset)
 
 BeamlineChannelMap (fhicl::ParameterSet const &pset, art::ActivityRegistry &)
 
bool ActiveDigitChannel (unsigned int channel) const
 Enquire whether this online digitizer channel is active. More...
 
SystemID DigitSystem (unsigned int channel) const
 Offline SystemID for this online digitizer channel. More...
 
DetectorID DigitDetector (unsigned int channel) const
 Offline DetectorID for this online digitizer channel. More...
 
ChannelID DigitChannel (unsigned int channel) const
 Offline ChannelID for this online digitizer channel. More...
 
unsigned int OnlineDigitChannel (ChannelID channel) const
 Online digiziter channel number for this offline ChannelID. More...
 
DetectorID TrigDetector () const
 Offline DetectorID for trigger. More...
 
DetectorID WCDetector (unsigned int detector) const
 Offline DetectorID for this online WC detector. More...
 
std::vector< SystemIDSystemIDs () const
 All the SystemIDs in this channel mapping. More...
 
std::vector< DetectorIDDetectorIDs () const
 All the DetectorIDs in this channel mapping. More...
 
std::vector< ChannelIDChannelIDs () const
 All the ChannelIDs in this channel mapping. More...
 

Private Member Functions

void FillBeamlineChannels (const fhicl::ParameterSet &map)
 

Private Attributes

std::map< unsigned int, ChannelIDfDigitOnlineToOffline
 
std::map< ChannelID, unsigned intfDigitOfflineToOnline
 

Detailed Description

Definition at line 41 of file BeamlineChannelMap.h.

Constructor & Destructor Documentation

beamlineutil::BeamlineChannelMap::BeamlineChannelMap ( fhicl::ParameterSet const &  pset)

Definition at line 23 of file BeamlineChannelMap_service.cc.

References FillBeamlineChannels(), and fhicl::ParameterSet::get().

23  {
24  fhicl::ParameterSet channel_map = pset.get<fhicl::ParameterSet>("ChannelMap");
25  this->FillBeamlineChannels(channel_map);
26 }
void FillBeamlineChannels(const fhicl::ParameterSet &map)
T get(std::string const &key) const
Definition: ParameterSet.h:231
beamlineutil::BeamlineChannelMap::BeamlineChannelMap ( fhicl::ParameterSet const &  pset,
art::ActivityRegistry  
)

Definition at line 29 of file BeamlineChannelMap_service.cc.

30  : BeamlineChannelMap(pset) {
31 }
BeamlineChannelMap(fhicl::ParameterSet const &pset)

Member Function Documentation

bool beamlineutil::BeamlineChannelMap::ActiveDigitChannel ( unsigned int  channel) const

Enquire whether this online digitizer channel is active.

Definition at line 103 of file BeamlineChannelMap_service.cc.

References fDigitOnlineToOffline.

Referenced by daq2raw::BeamlineUnpack::UnpackDigits().

103  {
104  return fDigitOnlineToOffline.count(channel);
105 }
std::map< unsigned int, ChannelID > fDigitOnlineToOffline
std::vector< ChannelID > beamlineutil::BeamlineChannelMap::ChannelIDs ( ) const

All the ChannelIDs in this channel mapping.

Definition at line 168 of file BeamlineChannelMap_service.cc.

References DEFINE_ART_SERVICE, and fDigitOnlineToOffline.

Referenced by beamlinereco::ToFSingleCounterAnalysis::beginJob(), and beamlinereco::ToFAnalysisMini::beginJob().

168  {
169  std::vector<ChannelID> channelIDs;
170  for (const auto& online : fDigitOnlineToOffline)
171  if (std::find(channelIDs.begin(), channelIDs.end(), online.second) == channelIDs.end())
172  channelIDs.push_back(online.second);
173  return channelIDs;
174 }
std::map< unsigned int, ChannelID > fDigitOnlineToOffline
std::vector< DetectorID > beamlineutil::BeamlineChannelMap::DetectorIDs ( ) const

All the DetectorIDs in this channel mapping.

Definition at line 159 of file BeamlineChannelMap_service.cc.

References fDigitOnlineToOffline.

159  {
160  std::vector<DetectorID> detectorIDs;
161  for (const auto& online : fDigitOnlineToOffline)
162  if (std::find(detectorIDs.begin(), detectorIDs.end(), online.second.GetDetectorID()) == detectorIDs.end())
163  detectorIDs.emplace_back(online.second.System, online.second.Detector);
164  return detectorIDs;
165 }
std::map< unsigned int, ChannelID > fDigitOnlineToOffline
ChannelID beamlineutil::BeamlineChannelMap::DigitChannel ( unsigned int  channel) const

Offline ChannelID for this online digitizer channel.

Definition at line 124 of file BeamlineChannelMap_service.cc.

References fDigitOnlineToOffline.

Referenced by daq2raw::BeamlineUnpack::UnpackDigits().

124  {
125  if (!fDigitOnlineToOffline.count(channel))
126  throw cet::exception("BeamlineChannelMap")
127  << "Requested online digitizer channel number " << channel << " unknown.";
128  return fDigitOnlineToOffline.at(channel);
129 }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
std::map< unsigned int, ChannelID > fDigitOnlineToOffline
DetectorID beamlineutil::BeamlineChannelMap::DigitDetector ( unsigned int  channel) const

Offline DetectorID for this online digitizer channel.

Definition at line 116 of file BeamlineChannelMap_service.cc.

References fDigitOnlineToOffline.

116  {
117  if (!fDigitOnlineToOffline.count(channel))
118  throw cet::exception("BeamlineChannelMap")
119  << "Requested online digitizer channel number " << channel << " unknown.";
120  return fDigitOnlineToOffline.at(channel).GetDetectorID();
121 }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
std::map< unsigned int, ChannelID > fDigitOnlineToOffline
SystemID beamlineutil::BeamlineChannelMap::DigitSystem ( unsigned int  channel) const

Offline SystemID for this online digitizer channel.

Definition at line 108 of file BeamlineChannelMap_service.cc.

References fDigitOnlineToOffline.

108  {
109  if (!fDigitOnlineToOffline.count(channel))
110  throw cet::exception("BeamlineChannelMap")
111  << "Requested online digitizer channel number " << channel << " unknown.";
112  return fDigitOnlineToOffline.at(channel).GetSystemID();
113 }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
std::map< unsigned int, ChannelID > fDigitOnlineToOffline
void beamlineutil::BeamlineChannelMap::FillBeamlineChannels ( const fhicl::ParameterSet map)
private

Definition at line 34 of file BeamlineChannelMap_service.cc.

References beamlinegeo::Cherenkov, fDigitOfflineToOnline, fDigitOnlineToOffline, fhicl::ParameterSet::get(), beamlinegeo::MuonStack, beamlinegeo::Other, beamlinegeo::Paddle, beamlinegeo::ToF, beamlinegeo::ToFChannelNames, beamlinegeo::ToFCounterNames, and beamlinegeo::WCDigit.

Referenced by BeamlineChannelMap().

34  {
35 
36  // cherenkov
37  unsigned int cherenkov_channel
38  = map.get<unsigned int>("CherenkovChannel");
39  ChannelID cherenkovchan(BeamlineSystem::Cherenkov, 0, 0);
40  fDigitOnlineToOffline[cherenkov_channel] = cherenkovchan;
41  fDigitOfflineToOnline[cherenkovchan] = cherenkov_channel;
42 
43  // tof
44  fhicl::ParameterSet tof_channels = map.get<fhicl::ParameterSet>("ToFChannels");
45  for (std::map<ToFCounter, std::string>::const_iterator tofCounterIt = beamlinegeo::ToFCounterNames.begin();
46  tofCounterIt != beamlinegeo::ToFCounterNames.end(); ++tofCounterIt) {
47  DetectorID tofdet(BeamlineSystem::ToF, tofCounterIt->first);
48  fhicl::ParameterSet tofdet_channels = tof_channels.get<fhicl::ParameterSet>(tofCounterIt->second);
49  for (std::map<ToFChannel, std::string>::const_iterator tofChannelIt = beamlinegeo::ToFChannelNames.begin();
50  tofChannelIt != beamlinegeo::ToFChannelNames.end(); ++tofChannelIt) {
51  ChannelID tofchan(tofdet, tofChannelIt->first);
52  unsigned int online_chan = tofdet_channels.get<unsigned int>(tofChannelIt->second);
53  fDigitOnlineToOffline[online_chan] = tofchan;
54  fDigitOfflineToOnline[tofchan] = online_chan;
55  }
56  }
57 
58  // muon stack
59  std::vector<unsigned int> muonstack_channels
60  = map.get<std::vector<unsigned int> >("MuonStackChannels");
61  for (unsigned int muonstack_chan = 0; muonstack_chan < muonstack_channels.size(); ++muonstack_chan) {
62  ChannelID muonstackchan(BeamlineSystem::MuonStack, 0, muonstack_chan);
63  unsigned int online_chan = muonstack_channels[muonstack_chan];
64  fDigitOnlineToOffline[online_chan] = muonstackchan;
65  fDigitOfflineToOnline[muonstackchan] = online_chan;
66  }
67 
68  // paddle
69  std::vector<unsigned int> paddle_channels
70  = map.get<std::vector<unsigned int> >("PaddlesChannels");
71  for (unsigned int paddle_chan = 0; paddle_chan < paddle_channels.size(); ++paddle_chan) {
72  ChannelID paddlechan(BeamlineSystem::Paddle, 0, paddle_chan);
73  unsigned int online_chan = paddle_channels[paddle_chan];
74  fDigitOnlineToOffline[online_chan] = paddlechan;
75  fDigitOfflineToOnline[paddlechan] = online_chan;
76  }
77 
78  // wc
79  std::vector<unsigned int> wc_channels
80  = map.get<std::vector<unsigned int> >("WCChannels");
81  for (unsigned int wc_chan = 0; wc_chan < wc_channels.size(); ++wc_chan) {
82  ChannelID wcdigitchan(BeamlineSystem::WCDigit, 0, wc_chan);
83  unsigned int online_chan = wc_channels[wc_chan];
84  fDigitOnlineToOffline[online_chan] = wcdigitchan;
85  fDigitOfflineToOnline[wcdigitchan] = online_chan;
86  }
87 
88  // other
89  std::vector<unsigned int> other_channels
90  = map.get<std::vector<unsigned int> >("OtherChannels");
91  for (unsigned int other_chan = 0; other_chan < other_channels.size(); ++other_chan) {
92  ChannelID otherchan(BeamlineSystem::Other, 0, other_chan);
93  unsigned int online_chan = other_channels[other_chan];
94  fDigitOnlineToOffline[online_chan] = otherchan;
95  fDigitOfflineToOnline[otherchan] = online_chan;
96  }
97 
98  return;
99 
100 }
std::map< ChannelID, unsigned int > fDigitOfflineToOnline
T get(std::string const &key) const
Definition: ParameterSet.h:231
std::map< unsigned int, ChannelID > fDigitOnlineToOffline
const std::map< ToFChannel, std::string > ToFChannelNames
const std::map< ToFCounter, std::string > ToFCounterNames
unsigned int beamlineutil::BeamlineChannelMap::OnlineDigitChannel ( ChannelID  channel) const

Online digiziter channel number for this offline ChannelID.

Definition at line 132 of file BeamlineChannelMap_service.cc.

References fDigitOfflineToOnline.

Referenced by novatb::TOFTimingResolution::analyze(), novatb::TriggerRateAna::analyze(), beamlinereco::ToFPositionRecoAnalysis::analyze(), novatb::BeamTuning::analyze(), beamlinereco::ToFAnalysisMini::beginJob(), beamlinereco::LEHitReco::produce(), and beamlinereco::CFDHitReco::produce().

132  {
133  if (!fDigitOfflineToOnline.count(channel))
134  throw cet::exception("BeamlineChannelMap")
135  << "Requested offline digitizer channel " << channel << " unknown.";
136  return fDigitOfflineToOnline.at(channel);
137 }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
std::map< ChannelID, unsigned int > fDigitOfflineToOnline
std::vector< SystemID > beamlineutil::BeamlineChannelMap::SystemIDs ( ) const

All the SystemIDs in this channel mapping.

Definition at line 150 of file BeamlineChannelMap_service.cc.

References fDigitOnlineToOffline.

150  {
151  std::vector<SystemID> systemIDs;
152  for (const auto& online : fDigitOnlineToOffline)
153  if (std::find(systemIDs.begin(), systemIDs.end(), online.second.GetSystemID()) == systemIDs.end())
154  systemIDs.emplace_back(online.second.System);
155  return systemIDs;
156 }
std::map< unsigned int, ChannelID > fDigitOnlineToOffline
DetectorID beamlineutil::BeamlineChannelMap::TrigDetector ( ) const

Offline DetectorID for trigger.

Definition at line 145 of file BeamlineChannelMap_service.cc.

References beamlinegeo::Trigger.

Referenced by daq2raw::BeamlineUnpack::UnpackTrigger().

DetectorID beamlineutil::BeamlineChannelMap::WCDetector ( unsigned int  detector) const

Offline DetectorID for this online WC detector.

Definition at line 140 of file BeamlineChannelMap_service.cc.

References beamlinegeo::WC.

Referenced by daq2raw::BeamlineUnpack::UnpackWC().

Member Data Documentation

std::map<ChannelID, unsigned int> beamlineutil::BeamlineChannelMap::fDigitOfflineToOnline
private

Definition at line 82 of file BeamlineChannelMap.h.

Referenced by FillBeamlineChannels(), and OnlineDigitChannel().

std::map<unsigned int, ChannelID> beamlineutil::BeamlineChannelMap::fDigitOnlineToOffline
private

The documentation for this class was generated from the following files: