Public Member Functions | Private Attributes | List of all members
protoana::ProtoDUNEDataUtils Class Reference

#include <ProtoDUNEDataUtils.h>

Public Member Functions

 ProtoDUNEDataUtils (fhicl::ParameterSet const &pset)
 
 ~ProtoDUNEDataUtils ()
 
void reconfigure (fhicl::ParameterSet const &pset)
 
bool IsBeamTrigger (art::Event const &evt) const
 
int GetNActiveFembsForAPA (art::Event const &evt, int apa) const
 Get number of active fembs in an APA. More...
 
bool CheckTimeStampConsistencyForAPAs (art::Event const &evt, std::set< int > apas, ULong64_t &timestamp, ULong64_t &timestamp2, int &apainconsist) const
 Check for consistency of timestamp values for a set of APAs. True if consistent, false if there are mismatches. More...
 

Private Attributes

art::InputTag fTimingTag
 
art::InputTag fRawDigitTag
 
art::InputTag fRawDigitTimeStampTag
 

Detailed Description

Definition at line 21 of file ProtoDUNEDataUtils.h.

Constructor & Destructor Documentation

protoana::ProtoDUNEDataUtils::ProtoDUNEDataUtils ( fhicl::ParameterSet const &  pset)

Definition at line 12 of file ProtoDUNEDataUtils.cxx.

12  {
13  this->reconfigure(p);
14 }
p
Definition: test.py:223
void reconfigure(fhicl::ParameterSet const &pset)
protoana::ProtoDUNEDataUtils::~ProtoDUNEDataUtils ( )

Definition at line 16 of file ProtoDUNEDataUtils.cxx.

16  {
17 
18 }

Member Function Documentation

bool protoana::ProtoDUNEDataUtils::CheckTimeStampConsistencyForAPAs ( art::Event const &  evt,
std::set< int >  apas,
ULong64_t &  timestamp,
ULong64_t &  timestamp2,
int &  apainconsist 
) const

Check for consistency of timestamp values for a set of APAs. True if consistent, false if there are mismatches.

Definition at line 120 of file ProtoDUNEDataUtils.cxx.

123 {
125  std::vector<art::Ptr<raw::RDTimeStamp> > TSlist;
126  auto RawTSListHandle = evt.getHandle< std::vector<raw::RDTimeStamp> >(fRawDigitTimeStampTag);
127  art::fill_ptr_vector(TSlist, RawTSListHandle);
128 
129  timestamp = 0;
130  timestamp2 = 0;
131  apainconsist = 0;
132  bool tsi = false;
133 
134  for(auto const & tsptr : TSlist)
135  {
136  const raw::RDTimeStamp & rdts = *tsptr;
137  uint16_t chan = rdts.GetFlags();
138  int iapa = channelMap->APAFromOfflineChannel(chan);
139  if (apas.find(iapa) != apas.end())
140  {
141  ULong64_t ts = rdts.GetTimeStamp();
142  if (tsi)
143  {
144  if (ts != timestamp)
145  {
146  apainconsist = iapa;
147  timestamp2 = ts;
148  return false;
149  }
150  }
151  else
152  {
153  tsi = true;
154  timestamp = ts;
155  timestamp2 = ts;
156  }
157  }
158  }
159  //std::cout << "All timestamps equal at: " << timestamp << " for APAs: ";
160  //for (auto const &iter : apas)
161  // {
162  // std::cout << iter << " ";
163  //}
164  //std::cout << std::endl;
165  return true;
166 }
uint16_t GetFlags() const
Definition: RDTimeStamp.h:46
unsigned int APAFromOfflineChannel(unsigned int offlineChannel) const
Returns APA/crate.
ULong64_t GetTimeStamp() const
Definition: RDTimeStamp.h:42
TCEvent evt
Definition: DataStructs.cxx:7
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
int protoana::ProtoDUNEDataUtils::GetNActiveFembsForAPA ( art::Event const &  evt,
int  apa 
) const

Get number of active fembs in an APA.

Definition at line 49 of file ProtoDUNEDataUtils.cxx.

49  {
50 
51 
52  // Get pd channel map
54 
55  // set only saves unique elements
56  std::set<int> apaset;
57 
58  // Get raw digits time stamps
59  std::vector<art::Ptr<raw::RDTimeStamp> > digitTSlist;
60 
61 
62  // Get raw digits
63  std::vector<art::Ptr<raw::RawDigit> > digitlist;
64 
65  auto RawdigitListHandle = evt.getHandle< std::vector<raw::RawDigit> >(fRawDigitTag);
66  if (RawdigitListHandle){
67 
68  art::fill_ptr_vector(digitlist, RawdigitListHandle);
69 
70  for(auto const & dptr : digitlist) {
71  const raw::RawDigit& digit = *dptr;
72  // Get the channel number for this digit
73  uint32_t chan = digit.Channel();
74 
75  int iapa = channelMap->APAFromOfflineChannel(chan);
76  if(iapa != apa) continue;
77  // Get the channel FEMB and WIB
78  int WIB = channelMap->WIBFromOfflineChannel(chan); // 0-4
79  int FEMB = channelMap->FEMBFromOfflineChannel(chan); // 1-4
80  //int FEMBchan = channelMap->FEMBChannelFromOfflineChannel(chan);
81  int iFEMB = ((WIB*4)+(FEMB-1)); //index of the FEMB 0-19
82 
83  apaset.insert(iFEMB);
84  }
85  }
86 
87  else{ // if raw digits have been dropped use RDTimeStamps instead
88 
89  auto RawdigitTSListHandle = evt.getHandle< std::vector<raw::RDTimeStamp> >(fRawDigitTimeStampTag);
90  art::fill_ptr_vector(digitTSlist, RawdigitTSListHandle);
91 
92  for(auto const & dptr : digitTSlist) {
93 
94  const raw::RDTimeStamp & digit = *dptr;
95 
96  // Get the channel number for this digit
97  uint16_t chan = digit.GetFlags();
98 
99  int iapa = channelMap->APAFromOfflineChannel(chan);
100  if(iapa != apa) continue;
101  // Get the channel FEMB and WIB
102  int WIB = channelMap->WIBFromOfflineChannel(chan); // 0-4
103  int FEMB = channelMap->FEMBFromOfflineChannel(chan); // 1-4
104  //int FEMBchan = channelMap->FEMBChannelFromOfflineChannel(chan);
105  int iFEMB = ((WIB*4)+(FEMB-1)); //index of the FEMB 0-19
106 
107  apaset.insert(iFEMB);
108  }
109  }
110  return (apaset.size());
111 }
uint16_t GetFlags() const
Definition: RDTimeStamp.h:46
Collection of charge vs time digitized from a single readout channel.
Definition: RawDigit.h:69
ChannelID_t Channel() const
DAQ channel this raw data was read from.
Definition: RawDigit.h:212
unsigned int APAFromOfflineChannel(unsigned int offlineChannel) const
Returns APA/crate.
unsigned int WIBFromOfflineChannel(unsigned int offlineChannel) const
Returns WIB/slot.
unsigned int FEMBFromOfflineChannel(unsigned int offlineChannel) const
Returns FEMB/fiber.
TCEvent evt
Definition: DataStructs.cxx:7
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
bool protoana::ProtoDUNEDataUtils::IsBeamTrigger ( art::Event const &  evt) const

Returns true if the ProtoDUNE trigger says this is a beam trigger

Definition at line 27 of file ProtoDUNEDataUtils.cxx.

27  {
28 
29  bool isBeam = false;
30 
31  // Accessing the trigger information as done in DataPrepModule
32  // The information is stored in the time stamps
33  auto timeStamps = evt.getHandle<std::vector<raw::RDTimeStamp>>(fTimingTag);
34 
35  // Return false if we have no time stamps
36  if (!timeStamps) return isBeam;
37  // We should only have one RDTimeStamp
38  if (timeStamps->size() > 1) return isBeam;
39 
40  // Access the trigger information. Beam trigger flag = 0xc
41  const raw::RDTimeStamp& timeStamp = timeStamps->at(0);
42  isBeam = (timeStamp.GetFlags() == 0xc);
43 
44  return isBeam;
45 }
uint16_t GetFlags() const
Definition: RDTimeStamp.h:46
TCEvent evt
Definition: DataStructs.cxx:7
void protoana::ProtoDUNEDataUtils::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 20 of file ProtoDUNEDataUtils.cxx.

20  {
21  fTimingTag = p.get<art::InputTag>("TimingTag");
22  fRawDigitTag = p.get<art::InputTag>("RawDigitTag");
23  fRawDigitTimeStampTag = p.get<art::InputTag>("RawDigitTimeStampTag");
24 }
p
Definition: test.py:223

Member Data Documentation

art::InputTag protoana::ProtoDUNEDataUtils::fRawDigitTag
private

Definition at line 46 of file ProtoDUNEDataUtils.h.

art::InputTag protoana::ProtoDUNEDataUtils::fRawDigitTimeStampTag
private

Definition at line 47 of file ProtoDUNEDataUtils.h.

art::InputTag protoana::ProtoDUNEDataUtils::fTimingTag
private

Definition at line 45 of file ProtoDUNEDataUtils.h.


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