Public Member Functions | Private Attributes | List of all members
beam::ProtoDUNEBeamSpill Class Reference

#include <ProtoDUNEBeamSpill.h>

Public Member Functions

 ProtoDUNEBeamSpill ()
 
 ~ProtoDUNEBeamSpill ()
 
void InitFBMs (std::vector< std::string >)
 
std::pair< double, double > GetT0 (size_t)
 
double GetT0Sec (size_t)
 
double GetT0Nano (size_t)
 
size_t GetNT0 ()
 
void AddT0 (std::pair< double, double >)
 
FBM GetFBM (std::string name, size_t theTrigger)
 
void AddFBMTrigger (std::string, FBM)
 
void ReplaceFBMTrigger (std::string, FBM, size_t)
 
void DecodeFibers (std::string, size_t)
 
double DecodeFiberTime (std::string, size_t, double)
 
void FixFiberGlitch (std::string)
 
std::array< double, 4 > ReturnTriggerAndTime (std::string, size_t)
 
short GetFiberStatus (std::string, size_t, size_t)
 
std::vector< short > GetActiveFibers (std::string, size_t)
 
std::vector< short > GetMaskedFibers (std::string, size_t)
 
double GetFiberTime (std::string, size_t)
 
size_t GetNFBMTriggers (std::string)
 
std::bitset< 32 > toBinary (double)
 
void AddCKov0 (CKov theCKov)
 
void AddCKov1 (CKov theCKov)
 
CKov GetCKov0 (size_t i)
 
CKov GetCKov1 (size_t i)
 
size_t GetNCKov0 ()
 
size_t GetNCKov1 ()
 
short GetCKov0Status (size_t i)
 
short GetCKov1Status (size_t i)
 
double GetCKov0Pressure (size_t i)
 
double GetCKov1Pressure (size_t i)
 
double GetCKov0Time (size_t i)
 
double GetCKov1Time (size_t i)
 
void AddTOF0Trigger (std::pair< double, double > theT)
 
void AddTOF1Trigger (std::pair< double, double > theT)
 
void AddTOFChan (int theChan)
 
std::pair< double, double > GetTOF0 (size_t)
 
double GetTOF0Sec (size_t)
 
double GetTOF0Nano (size_t)
 
std::pair< double, double > GetTOF1 (size_t)
 
double GetTOF1Sec (size_t)
 
double GetTOF1Nano (size_t)
 
double GetTOF (size_t)
 
int GetTOFChan (size_t)
 
int GetNTOF0Triggers ()
 
int GetNTOF1Triggers ()
 
std::vector< double > GetMultipleTOFs (size_t i)
 
std::vector< int > GetMultipleTOFChans (size_t i)
 
std::vector< size_t > GetUpstreamTriggers (size_t i)
 
std::vector< size_t > GetDownstreamTriggers (size_t i)
 
void AddMultipleTOFs (std::vector< double > theTOFs)
 
void AddMultipleTOFChans (std::vector< int > theChans)
 
void AddUpstreamTriggers (std::vector< size_t > theTriggers)
 
void AddDownstreamTriggers (std::vector< size_t > theTriggers)
 
void AddBeamTrack (recob::Track theTrack)
 
recob::Track GetBeamTrack (size_t i)
 
size_t GetNBeamTracks ()
 
const std::vector< recob::Track > & GetBeamTracks () const
 
void ClearBeamTracks ()
 
void SetActiveTrigger (size_t theTrigger)
 
bool CheckIsMatched ()
 
void SetUnmatched ()
 
size_t GetActiveTrigger ()
 
void AddRecoBeamMomentum (double theMomentum)
 
size_t GetNRecoBeamMomenta ()
 
double GetRecoBeamMomentum (size_t i)
 
void ClearRecoBeamMomenta ()
 
void SetBITrigger (int theTrigger)
 
int GetBITrigger ()
 
void SetSpillStart (double theSpillStart)
 
double GetSpillStart ()
 
void SetSpillOffset (double theSpillOffset)
 
double GetSpillOffset ()
 
void SetCTBTimestamp (double theCTBTimestamp)
 
double GetCTBTimestamp ()
 
void SetMagnetCurrent (double theMagnetCurrent)
 
double GetMagnetCurrent ()
 

Private Attributes

std::vector< std::pair< double, double > > t0
 
double CTBTimestamp
 
std::map< std::string, std::vector< FBM > > fiberMonitors
 
size_t nFBMs
 
std::vector< std::pair< double, double > > TOF0
 
std::vector< std::pair< double, double > > TOF1
 
std::vector< int > TOFChan
 
std::vector< std::vector< double > > TOFs
 
std::vector< std::vector< int > > TOFChans
 
std::vector< std::vector< size_t > > UpstreamTriggers
 
std::vector< std::vector< size_t > > DownstreamTriggers
 
std::vector< CKovCKov0
 
std::vector< CKovCKov1
 
std::vector< recob::TrackTracks
 
size_t activeTrigger
 
bool isMatched = false
 
std::vector< double > RecoBeamMomenta
 
int BITrigger
 
double SpillStart
 
double SpillOffset
 
double MagnetCurrent
 

Detailed Description

Definition at line 75 of file ProtoDUNEBeamSpill.h.

Constructor & Destructor Documentation

beam::ProtoDUNEBeamSpill::ProtoDUNEBeamSpill ( )

Definition at line 17 of file ProtoDUNEBeamSpill.cxx.

17 {}
beam::ProtoDUNEBeamSpill::~ProtoDUNEBeamSpill ( )

Definition at line 41 of file ProtoDUNEBeamSpill.cxx.

41 {}

Member Function Documentation

void beam::ProtoDUNEBeamSpill::AddBeamTrack ( recob::Track  theTrack)
inline

Definition at line 144 of file ProtoDUNEBeamSpill.h.

144 { Tracks.push_back(theTrack);};
std::vector< recob::Track > Tracks
void beam::ProtoDUNEBeamSpill::AddCKov0 ( CKov  theCKov)
inline

Definition at line 104 of file ProtoDUNEBeamSpill.h.

104 { CKov0.push_back(theCKov); };
std::vector< CKov > CKov0
void beam::ProtoDUNEBeamSpill::AddCKov1 ( CKov  theCKov)
inline

Definition at line 105 of file ProtoDUNEBeamSpill.h.

105 { CKov1.push_back(theCKov); };
std::vector< CKov > CKov1
void beam::ProtoDUNEBeamSpill::AddDownstreamTriggers ( std::vector< size_t >  theTriggers)
inline

Definition at line 142 of file ProtoDUNEBeamSpill.h.

142 { DownstreamTriggers.push_back( theTriggers ); };
std::vector< std::vector< size_t > > DownstreamTriggers
void beam::ProtoDUNEBeamSpill::AddFBMTrigger ( std::string  FBMName,
FBM  theFBM 
)
inline

Definition at line 280 of file ProtoDUNEBeamSpill.h.

280  {
281 // if( (FBMName > (nFBMs - 1) ) ){
282  if( fiberMonitors.find(FBMName) == fiberMonitors.end() ){
283  std::cout << "Error FBM not found" << std::endl;
284 // for(size_t i = 0; i < fiberMonitors.find(FBMName); ++i){
285 
286  for(auto itF = fiberMonitors.begin(); itF != fiberMonitors.end(); ++itF){
287  std::cout << "\t" << itF->first << std::endl;
288  }
289  return;
290  }
291 
292  //Check if it's the first time in the monitor. Replace dummy
293  if(fiberMonitors[FBMName][0].ID == -1){
294  std::cout << "Replacing dummy FBM" << std::endl;
295  std::vector<FBM>::iterator theIt = fiberMonitors[FBMName].begin();
296  fiberMonitors[FBMName].insert(theIt,theFBM);
297  fiberMonitors[FBMName].pop_back();
298  }
299  else{
300  fiberMonitors[FBMName].push_back(theFBM);
301  }
302  }
intermediate_table::iterator iterator
unsigned int ID
std::map< std::string, std::vector< FBM > > fiberMonitors
QTextStream & endl(QTextStream &s)
void beam::ProtoDUNEBeamSpill::AddMultipleTOFChans ( std::vector< int >  theChans)
inline

Definition at line 140 of file ProtoDUNEBeamSpill.h.

140 { TOFChans.push_back( theChans ); };
std::vector< std::vector< int > > TOFChans
void beam::ProtoDUNEBeamSpill::AddMultipleTOFs ( std::vector< double >  theTOFs)
inline

Definition at line 139 of file ProtoDUNEBeamSpill.h.

139 { TOFs.push_back( theTOFs ); };
std::vector< std::vector< double > > TOFs
void beam::ProtoDUNEBeamSpill::AddRecoBeamMomentum ( double  theMomentum)
inline

Definition at line 155 of file ProtoDUNEBeamSpill.h.

155 { RecoBeamMomenta.push_back( theMomentum ); };
std::vector< double > RecoBeamMomenta
void beam::ProtoDUNEBeamSpill::AddT0 ( std::pair< double, double >  theT0)
inline

Definition at line 254 of file ProtoDUNEBeamSpill.h.

254  {
255  t0.push_back(theT0);
256  }
code to link reconstructed objects back to the MC truth information
void beam::ProtoDUNEBeamSpill::AddTOF0Trigger ( std::pair< double, double >  theT)
inline

Definition at line 120 of file ProtoDUNEBeamSpill.h.

120 { TOF0.push_back(theT); };
std::vector< std::pair< double, double > > TOF0
void beam::ProtoDUNEBeamSpill::AddTOF1Trigger ( std::pair< double, double >  theT)
inline

Definition at line 121 of file ProtoDUNEBeamSpill.h.

121 { TOF1.push_back(theT); };
std::vector< std::pair< double, double > > TOF1
void beam::ProtoDUNEBeamSpill::AddTOFChan ( int  theChan)
inline

Definition at line 122 of file ProtoDUNEBeamSpill.h.

122 { TOFChan.push_back(theChan); };
std::vector< int > TOFChan
void beam::ProtoDUNEBeamSpill::AddUpstreamTriggers ( std::vector< size_t >  theTriggers)
inline

Definition at line 141 of file ProtoDUNEBeamSpill.h.

141 { UpstreamTriggers.push_back( theTriggers ); };
std::vector< std::vector< size_t > > UpstreamTriggers
bool beam::ProtoDUNEBeamSpill::CheckIsMatched ( )
inline

Definition at line 151 of file ProtoDUNEBeamSpill.h.

151 { return isMatched; };
void beam::ProtoDUNEBeamSpill::ClearBeamTracks ( )
inline

Definition at line 148 of file ProtoDUNEBeamSpill.h.

148 { Tracks.clear(); };
std::vector< recob::Track > Tracks
void beam::ProtoDUNEBeamSpill::ClearRecoBeamMomenta ( )
inline

Definition at line 158 of file ProtoDUNEBeamSpill.h.

158 { RecoBeamMomenta.clear(); };
std::vector< double > RecoBeamMomenta
void beam::ProtoDUNEBeamSpill::DecodeFibers ( std::string  FBMName,
size_t  nTrigger 
)
inline

Definition at line 325 of file ProtoDUNEBeamSpill.h.

325  {
326  if( fiberMonitors.find(FBMName) == fiberMonitors.end() ){
327  std::cout << "Please input monitor in range [0," << fiberMonitors.size() - 1 << "]" << std::endl;
328  return;
329  }
330  if( (nTrigger > fiberMonitors[FBMName].size()) ){
331  std::cout << "Please input trigger in range [0," << fiberMonitors[FBMName].size() - 1 << "]" << std::endl;
332  return;
333  }
334 
335  //This always clears the currently active fibers in the FBM.
336  fiberMonitors[FBMName][nTrigger].active.clear();
337 
338  for(int iSet = 0; iSet < 6; ++iSet){
339 
340  std::bitset<32> theseFibers = toBinary( fiberMonitors[FBMName][nTrigger].fiberData[iSet] );
341 
342  for(int iFiber = 0; iFiber < 32; ++iFiber){
343  fiberMonitors[FBMName][nTrigger].fibers[iSet*32 + iFiber] = theseFibers[iFiber];
344  if(theseFibers[iFiber]) fiberMonitors[FBMName][nTrigger].active.push_back(iSet*32 + iFiber);
345  }
346  }
347 
348  fiberMonitors[FBMName][nTrigger].decoded = true;
349  }
std::map< std::string, std::vector< FBM > > fiberMonitors
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
std::bitset< 32 > toBinary(double)
QTextStream & endl(QTextStream &s)
double beam::ProtoDUNEBeamSpill::DecodeFiberTime ( std::string  FBMName,
size_t  nTrigger,
double  OffsetTAI 
)
inline

Definition at line 351 of file ProtoDUNEBeamSpill.h.

351  {
352  if( fiberMonitors.find(FBMName) == fiberMonitors.end() ){
353  std::cout << "FBM not found in list" << std::endl;
354  return -1.;
355  }
356  if( (nTrigger > fiberMonitors[FBMName].size()) ){
357  std::cout << "Please input trigger in range [0," << fiberMonitors[FBMName].size() - 1 << "]" << std::endl;
358  return -1.;
359  }
360 
361 
362  //timeData[3] -> Event Time in Seconds
363  //timeData[2] -> Number of 8ns ticks after that time
364 // return fiberMonitors[FBMName][nTrigger].timeData[0];
365  return fiberMonitors[FBMName][nTrigger].timeData[3] - OffsetTAI + fiberMonitors[FBMName][nTrigger].timeData[2]*8.e-9;
366  }
std::map< std::string, std::vector< FBM > > fiberMonitors
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
QTextStream & endl(QTextStream &s)
void beam::ProtoDUNEBeamSpill::FixFiberGlitch ( std::string  FBMName)
inline

Definition at line 529 of file ProtoDUNEBeamSpill.h.

529  {
530 
531  if( fiberMonitors.find(FBMName) == fiberMonitors.end() ){
532  std::cout << "Please input monitor with correct name" << std::endl;
533  return;
534  }
535 
536 
537  //We won't be able to tell if any are bad
538  if( fiberMonitors[FBMName].size() < 2 ){ return; }
539 
540  for( size_t i = 1; i < fiberMonitors[FBMName].size(); ++i ){
541  std::vector<short> previous_active = fiberMonitors[FBMName][i-1].active;
542  std::vector<short> current_active = fiberMonitors[FBMName][i].active;
543 
544  for( size_t j = 0; j < current_active.size(); ++j ){
545 
546  //The issue only occurs in the last 2 32-bit words
547  if( current_active[j] < 128 ){ continue; }
548 
549  //This means this active fiber in the last 2 words is also in the previous event
550  if( std::find( previous_active.begin(), previous_active.end(), current_active[j] ) != previous_active.end() ){
551  //Set the glitch mask to true
552  fiberMonitors[FBMName][i].glitch_mask[ current_active[j] ] = 1;
553  }
554  }
555  }
556 
557  }
std::map< std::string, std::vector< FBM > > fiberMonitors
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
QTextStream & endl(QTextStream &s)
std::vector< short > beam::ProtoDUNEBeamSpill::GetActiveFibers ( std::string  FBMName,
size_t  nTrigger 
)
inline

Definition at line 415 of file ProtoDUNEBeamSpill.h.

415  {
416  std::vector<short> active;
417 
418  if( fiberMonitors.find(FBMName) == fiberMonitors.end() ){
419  std::cout << "Please input monitor in range [0," << fiberMonitors.size() - 1 << "]" << std::endl;
420  return active;
421  }
422  if( (nTrigger > fiberMonitors[FBMName].size()) ){
423  std::cout << "Please input trigger in range [0," << fiberMonitors[FBMName].size() - 1 << "]" << std::endl;
424  return active;
425  }
426 
427  for(size_t iF = 0; iF < 192; ++iF){
428  if(fiberMonitors[FBMName][nTrigger].fibers[iF]) active.push_back(iF);
429  }
430 
431  return active;
432  }
std::map< std::string, std::vector< FBM > > fiberMonitors
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
QTextStream & endl(QTextStream &s)
size_t beam::ProtoDUNEBeamSpill::GetActiveTrigger ( )
inline

Definition at line 153 of file ProtoDUNEBeamSpill.h.

153 { return activeTrigger; };
recob::Track beam::ProtoDUNEBeamSpill::GetBeamTrack ( size_t  i)
inline

Definition at line 145 of file ProtoDUNEBeamSpill.h.

145 { return Tracks[i];};
std::vector< recob::Track > Tracks
const std::vector< recob::Track > & beam::ProtoDUNEBeamSpill::GetBeamTracks ( ) const
inline

Definition at line 225 of file ProtoDUNEBeamSpill.h.

225 { return Tracks; }
std::vector< recob::Track > Tracks
int beam::ProtoDUNEBeamSpill::GetBITrigger ( )
inline

Definition at line 161 of file ProtoDUNEBeamSpill.h.

CKov beam::ProtoDUNEBeamSpill::GetCKov0 ( size_t  i)
inline

Definition at line 106 of file ProtoDUNEBeamSpill.h.

106 { return CKov0[i]; };
std::vector< CKov > CKov0
double beam::ProtoDUNEBeamSpill::GetCKov0Pressure ( size_t  i)
inline

Definition at line 114 of file ProtoDUNEBeamSpill.h.

114 { return CKov0[i].pressure; };
std::vector< CKov > CKov0
short beam::ProtoDUNEBeamSpill::GetCKov0Status ( size_t  i)
inline

Definition at line 112 of file ProtoDUNEBeamSpill.h.

112 { return CKov0[i].trigger; };
std::vector< CKov > CKov0
double beam::ProtoDUNEBeamSpill::GetCKov0Time ( size_t  i)
inline

Definition at line 116 of file ProtoDUNEBeamSpill.h.

116 { return CKov0[i].timeStamp; };
std::vector< CKov > CKov0
CKov beam::ProtoDUNEBeamSpill::GetCKov1 ( size_t  i)
inline

Definition at line 107 of file ProtoDUNEBeamSpill.h.

107 { return CKov1[i]; };
std::vector< CKov > CKov1
double beam::ProtoDUNEBeamSpill::GetCKov1Pressure ( size_t  i)
inline

Definition at line 115 of file ProtoDUNEBeamSpill.h.

115 { return CKov1[i].pressure; };
std::vector< CKov > CKov1
short beam::ProtoDUNEBeamSpill::GetCKov1Status ( size_t  i)
inline

Definition at line 113 of file ProtoDUNEBeamSpill.h.

113 { return CKov1[i].trigger; };
std::vector< CKov > CKov1
double beam::ProtoDUNEBeamSpill::GetCKov1Time ( size_t  i)
inline

Definition at line 117 of file ProtoDUNEBeamSpill.h.

117 { return CKov1[i].timeStamp; };
std::vector< CKov > CKov1
double beam::ProtoDUNEBeamSpill::GetCTBTimestamp ( )
inline

Definition at line 170 of file ProtoDUNEBeamSpill.h.

170 { return CTBTimestamp; };
std::vector< size_t > beam::ProtoDUNEBeamSpill::GetDownstreamTriggers ( size_t  i)
inline

Definition at line 137 of file ProtoDUNEBeamSpill.h.

137 { return DownstreamTriggers[i]; };
std::vector< std::vector< size_t > > DownstreamTriggers
FBM beam::ProtoDUNEBeamSpill::GetFBM ( std::string  name,
size_t  theTrigger 
)
inline

Definition at line 259 of file ProtoDUNEBeamSpill.h.

259  {
260  //FBM dummy={{{0}}};
261  FBM dummy(-1);
262  //dummy.ID = -1;
263  if( fiberMonitors.find(FBMName) == fiberMonitors.end() ){
264  std::cout << "Error FBM not found" << std::endl;
265 // for(size_t i = 0; i < fiberMonitors.find(FBMName); ++i){
266 
267  for(auto itF = fiberMonitors.begin(); itF != fiberMonitors.end(); ++itF){
268  std::cout << "\t" << itF->first << std::endl;
269  }
270  return dummy;
271  }
272 
273  if(theTrigger > t0.size()){
274  std::cout << "Error, trigger out of range" << std::endl;
275  return dummy;
276  }
277  return fiberMonitors[FBMName].at(theTrigger);
278  }
code to link reconstructed objects back to the MC truth information
std::map< std::string, std::vector< FBM > > fiberMonitors
cet::LibraryManager dummy("noplugin")
QTextStream & endl(QTextStream &s)
short beam::ProtoDUNEBeamSpill::GetFiberStatus ( std::string  FBMName,
size_t  nTrigger,
size_t  iFiber 
)
inline

Definition at line 399 of file ProtoDUNEBeamSpill.h.

399  {
400  if( fiberMonitors.find(FBMName) == fiberMonitors.end() ){
401  std::cout << "Please input monitor in range [0," << fiberMonitors.size() - 1 << "]" << std::endl;
402  return -1;
403  }
404  if( (iFiber > 191)){
405  std::cout << "Please input fiber in range [0,191]" << std::endl;
406  return -1;
407  }
408  if( (nTrigger > fiberMonitors[FBMName].size()) ){
409  std::cout << "Please input trigger in range [0," << fiberMonitors[FBMName].size() - 1 << "]" << std::endl;
410  return -1;
411  }
412  return fiberMonitors[FBMName][nTrigger].fibers[iFiber];
413  }
std::map< std::string, std::vector< FBM > > fiberMonitors
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
QTextStream & endl(QTextStream &s)
double beam::ProtoDUNEBeamSpill::GetFiberTime ( std::string  FBMName,
size_t  nTrigger 
)
inline

Definition at line 434 of file ProtoDUNEBeamSpill.h.

434  {
435  if( fiberMonitors.find(FBMName) == fiberMonitors.end() ){
436  std::cout << "Please input monitor in range [0," << fiberMonitors.size() - 1 << "]" << std::endl;
437  return -1;
438  }
439  if( (nTrigger > fiberMonitors[FBMName].size()) ){
440  std::cout << "Please input trigger in range [0," << fiberMonitors[FBMName].size() - 1 << "]" << std::endl;
441  return -1;
442  }
443  return fiberMonitors[FBMName][nTrigger].timeStamp;
444  }
std::map< std::string, std::vector< FBM > > fiberMonitors
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
QTextStream & endl(QTextStream &s)
double beam::ProtoDUNEBeamSpill::GetMagnetCurrent ( )
inline

Definition at line 173 of file ProtoDUNEBeamSpill.h.

173 { return MagnetCurrent; };
std::vector<short> beam::ProtoDUNEBeamSpill::GetMaskedFibers ( std::string  ,
size_t   
)
std::vector< int > beam::ProtoDUNEBeamSpill::GetMultipleTOFChans ( size_t  i)
inline

Definition at line 135 of file ProtoDUNEBeamSpill.h.

135 { return TOFChans[i]; };
std::vector< std::vector< int > > TOFChans
std::vector< double > beam::ProtoDUNEBeamSpill::GetMultipleTOFs ( size_t  i)
inline

Definition at line 134 of file ProtoDUNEBeamSpill.h.

134 { return TOFs[i]; };
std::vector< std::vector< double > > TOFs
size_t beam::ProtoDUNEBeamSpill::GetNBeamTracks ( )
inline

Definition at line 146 of file ProtoDUNEBeamSpill.h.

146 {return Tracks.size();}
std::vector< recob::Track > Tracks
size_t beam::ProtoDUNEBeamSpill::GetNCKov0 ( )
inline

Definition at line 108 of file ProtoDUNEBeamSpill.h.

108 { return CKov0.size(); };
std::vector< CKov > CKov0
size_t beam::ProtoDUNEBeamSpill::GetNCKov1 ( )
inline

Definition at line 109 of file ProtoDUNEBeamSpill.h.

109 { return CKov1.size(); };
std::vector< CKov > CKov1
size_t beam::ProtoDUNEBeamSpill::GetNFBMTriggers ( std::string  FBMName)
inline

Definition at line 446 of file ProtoDUNEBeamSpill.h.

446  {
447  if( fiberMonitors.find(FBMName) == fiberMonitors.end() ){
448  std::cout << "Please input monitor in range [0," << fiberMonitors.size() - 1 << "]" << std::endl;
449  return -1;
450  }
451  return fiberMonitors[FBMName].size();
452  }
std::map< std::string, std::vector< FBM > > fiberMonitors
QTextStream & endl(QTextStream &s)
size_t beam::ProtoDUNEBeamSpill::GetNRecoBeamMomenta ( )
inline

Definition at line 156 of file ProtoDUNEBeamSpill.h.

156 { return RecoBeamMomenta.size(); };
std::vector< double > RecoBeamMomenta
size_t beam::ProtoDUNEBeamSpill::GetNT0 ( )
inline

Definition at line 84 of file ProtoDUNEBeamSpill.h.

84 {return t0.size();};
code to link reconstructed objects back to the MC truth information
int beam::ProtoDUNEBeamSpill::GetNTOF0Triggers ( )
inline

Definition at line 131 of file ProtoDUNEBeamSpill.h.

131 { return TOF0.size(); };
std::vector< std::pair< double, double > > TOF0
int beam::ProtoDUNEBeamSpill::GetNTOF1Triggers ( )
inline

Definition at line 132 of file ProtoDUNEBeamSpill.h.

132 { return TOF1.size(); };
std::vector< std::pair< double, double > > TOF1
double beam::ProtoDUNEBeamSpill::GetRecoBeamMomentum ( size_t  i)
inline

Definition at line 157 of file ProtoDUNEBeamSpill.h.

157 { return RecoBeamMomenta[i]; };
std::vector< double > RecoBeamMomenta
double beam::ProtoDUNEBeamSpill::GetSpillOffset ( )
inline

Definition at line 167 of file ProtoDUNEBeamSpill.h.

167 { return SpillOffset; };
double beam::ProtoDUNEBeamSpill::GetSpillStart ( )
inline

Definition at line 164 of file ProtoDUNEBeamSpill.h.

164 { return SpillStart; };
std::pair< double, double > beam::ProtoDUNEBeamSpill::GetT0 ( size_t  trigger)
inline

Definition at line 227 of file ProtoDUNEBeamSpill.h.

227  {
228  if( trigger > t0.size() - 1 ){
229  std::cout << "Error. Trigger out of bunds" << std::endl;
230  return std::make_pair(-1.,-1.);
231  }
232 
233  return t0[trigger];
234  }
code to link reconstructed objects back to the MC truth information
QTextStream & endl(QTextStream &s)
double beam::ProtoDUNEBeamSpill::GetT0Nano ( size_t  trigger)
inline

Definition at line 245 of file ProtoDUNEBeamSpill.h.

245  {
246  if( trigger > t0.size() - 1 ){
247  std::cout << "Error. Trigger out of bunds" << std::endl;
248  return -1.;
249  }
250 
251  return t0[trigger].second;
252  }
code to link reconstructed objects back to the MC truth information
QTextStream & endl(QTextStream &s)
double beam::ProtoDUNEBeamSpill::GetT0Sec ( size_t  trigger)
inline

Definition at line 236 of file ProtoDUNEBeamSpill.h.

236  {
237  if( trigger > t0.size() - 1 ){
238  std::cout << "Error. Trigger out of bunds" << std::endl;
239  return -1.;
240  }
241 
242  return t0[trigger].first;
243  }
code to link reconstructed objects back to the MC truth information
QTextStream & endl(QTextStream &s)
double beam::ProtoDUNEBeamSpill::GetTOF ( size_t  nTrigger)
inline

Definition at line 519 of file ProtoDUNEBeamSpill.h.

519  {
520  if( (nTrigger >= TOF1.size()) ){
521  std::cout << "Please input index in range [0," << TOF1.size() - 1 << "]" << std::endl;
522  return -1;
523  }
524 
525  return (TOF1[nTrigger].first - TOF0[nTrigger].first + 1.e-9*(TOF1[nTrigger].second - TOF0[nTrigger].second));
526  }
const double e
std::vector< std::pair< double, double > > TOF0
std::vector< std::pair< double, double > > TOF1
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:85
QTextStream & endl(QTextStream &s)
std::pair< double, double > beam::ProtoDUNEBeamSpill::GetTOF0 ( size_t  nTrigger)
inline

Definition at line 456 of file ProtoDUNEBeamSpill.h.

456  {
457  if( (nTrigger >= TOF0.size()) ){
458  std::cout << "Please input index in range [0," << TOF0.size() - 1 << "]" << std::endl;
459  return std::make_pair(-1.,-1.);
460  }
461 
462  return TOF0[nTrigger];
463  }
std::vector< std::pair< double, double > > TOF0
QTextStream & endl(QTextStream &s)
double beam::ProtoDUNEBeamSpill::GetTOF0Nano ( size_t  nTrigger)
inline

Definition at line 474 of file ProtoDUNEBeamSpill.h.

474  {
475  if( (nTrigger >= TOF0.size()) ){
476  std::cout << "Please input index in range [0," << TOF0.size() - 1 << "]" << std::endl;
477  return -1.;
478  }
479 
480  return TOF0[nTrigger].second;
481  }
std::vector< std::pair< double, double > > TOF0
QTextStream & endl(QTextStream &s)
double beam::ProtoDUNEBeamSpill::GetTOF0Sec ( size_t  nTrigger)
inline

Definition at line 465 of file ProtoDUNEBeamSpill.h.

465  {
466  if( (nTrigger >= TOF0.size()) ){
467  std::cout << "Please input index in range [0," << TOF0.size() - 1 << "]" << std::endl;
468  return -1.;
469  }
470 
471  return TOF0[nTrigger].first;
472  }
std::vector< std::pair< double, double > > TOF0
QTextStream & endl(QTextStream &s)
std::pair< double, double > beam::ProtoDUNEBeamSpill::GetTOF1 ( size_t  nTrigger)
inline

Definition at line 483 of file ProtoDUNEBeamSpill.h.

483  {
484  if( (nTrigger >= TOF1.size()) ){
485  std::cout << "Please input index in range [0," << TOF1.size() - 1 << "]" << std::endl;
486  return std::make_pair(-1.,-1.);
487  }
488 
489  return TOF1[nTrigger];
490  }
std::vector< std::pair< double, double > > TOF1
QTextStream & endl(QTextStream &s)
double beam::ProtoDUNEBeamSpill::GetTOF1Nano ( size_t  nTrigger)
inline

Definition at line 501 of file ProtoDUNEBeamSpill.h.

501  {
502  if( (nTrigger >= TOF1.size()) ){
503  std::cout << "Please input index in range [0," << TOF1.size() - 1 << "]" << std::endl;
504  return -1.;
505  }
506 
507  return TOF1[nTrigger].second;
508  }
std::vector< std::pair< double, double > > TOF1
QTextStream & endl(QTextStream &s)
double beam::ProtoDUNEBeamSpill::GetTOF1Sec ( size_t  nTrigger)
inline

Definition at line 492 of file ProtoDUNEBeamSpill.h.

492  {
493  if( (nTrigger >= TOF1.size()) ){
494  std::cout << "Please input index in range [0," << TOF1.size() - 1 << "]" << std::endl;
495  return -1.;
496  }
497 
498  return TOF1[nTrigger].first;
499  }
std::vector< std::pair< double, double > > TOF1
QTextStream & endl(QTextStream &s)
int beam::ProtoDUNEBeamSpill::GetTOFChan ( size_t  nTrigger)
inline

Definition at line 510 of file ProtoDUNEBeamSpill.h.

510  {
511  if( (nTrigger >= TOF1.size()) ){
512  std::cout << "Please input index in range [0," << TOF1.size() - 1 << "]" << std::endl;
513  return -1;
514  }
515 
516  return TOFChan[nTrigger];
517  }
std::vector< int > TOFChan
std::vector< std::pair< double, double > > TOF1
QTextStream & endl(QTextStream &s)
std::vector< size_t > beam::ProtoDUNEBeamSpill::GetUpstreamTriggers ( size_t  i)
inline

Definition at line 136 of file ProtoDUNEBeamSpill.h.

136 { return UpstreamTriggers[i]; };
std::vector< std::vector< size_t > > UpstreamTriggers
void beam::ProtoDUNEBeamSpill::InitFBMs ( std::vector< std::string monitors)

Definition at line 18 of file ProtoDUNEBeamSpill.cxx.

18  {
19  nFBMs = monitors.size();
20  //std::cout << "Got " << nFBMs << " monitors and " << t0.size() << " good particles" << std::endl;
21  FBM dummyFBM;
22  /*
23  dummyFBM.ID = -1;
24  dummyFBM.fibers = {};
25  std::uninitialized_fill( std::begin(dummyFBM.fiberData), std::end(dummyFBM.fiberData), 0. );
26  std::uninitialized_fill( std::begin(dummyFBM.timeData), std::end(dummyFBM.timeData), 0. );
27  dummyFBM.timeStamp = 0.;
28  dummyFBM.decoded = false;
29  dummyFBM.active = std::vector<short>();
30  */
31 
32  std::vector<FBM> dummyVec;
33  for(size_t i = 0; i < t0.size(); ++i){
34  dummyVec.push_back(dummyFBM);
35  }
36  for(size_t i = 0; i < nFBMs; ++i){
37 // std::cout << "Initing " << monitors[i] << std::endl;
38  fiberMonitors[monitors[i]] = dummyVec;
39  }
40  }
code to link reconstructed objects back to the MC truth information
std::map< std::string, std::vector< FBM > > fiberMonitors
void beam::ProtoDUNEBeamSpill::ReplaceFBMTrigger ( std::string  FBMName,
FBM  theFBM,
size_t  theTrigger 
)
inline

Definition at line 304 of file ProtoDUNEBeamSpill.h.

304  {
305  if( fiberMonitors.find(FBMName) == fiberMonitors.end() ){
306  std::cout << "Error FBM not found" << std::endl;
307 
308  for(auto itF = fiberMonitors.begin(); itF != fiberMonitors.end(); ++itF){
309  std::cout << "\t" << itF->first << std::endl;
310  }
311 
312  return;
313  }
314 
315  if( theTrigger > t0.size() - 1 ){
316  std::cout << "Trigger out of range of good particles." << std::endl;
317  return;
318  }
319 
320 // std::cout << "Replacing FBM Trigger" << std::endl;
321  fiberMonitors[FBMName].at(theTrigger) = theFBM;
322 
323  }
code to link reconstructed objects back to the MC truth information
std::map< std::string, std::vector< FBM > > fiberMonitors
QTextStream & endl(QTextStream &s)
std::array< double, 4 > beam::ProtoDUNEBeamSpill::ReturnTriggerAndTime ( std::string  FBMName,
size_t  nTrigger 
)
inline

Definition at line 368 of file ProtoDUNEBeamSpill.h.

368  {
369  if( fiberMonitors.find(FBMName) == fiberMonitors.end() ){
370  std::cout << "FBM not found in list" << std::endl;
371  return {{-1.,-1.,-1.,-1.}};
372  }
373  if( (nTrigger > fiberMonitors[FBMName].size()) ){
374  std::cout << "Please input trigger in range [0," << fiberMonitors[FBMName].size() - 1 << "]" << std::endl;
375  return {{-1.,-1.,-1.,-1.}};
376  }
377 
378  return {{fiberMonitors[FBMName][nTrigger].timeData[0], fiberMonitors[FBMName][nTrigger].timeData[1], fiberMonitors[FBMName][nTrigger].timeData[2], fiberMonitors[FBMName][nTrigger].timeData[3]}};
379  }
std::map< std::string, std::vector< FBM > > fiberMonitors
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
QTextStream & endl(QTextStream &s)
void beam::ProtoDUNEBeamSpill::SetActiveTrigger ( size_t  theTrigger)
inline

Definition at line 150 of file ProtoDUNEBeamSpill.h.

void beam::ProtoDUNEBeamSpill::SetBITrigger ( int  theTrigger)
inline

Definition at line 160 of file ProtoDUNEBeamSpill.h.

160 { BITrigger = theTrigger; };
void beam::ProtoDUNEBeamSpill::SetCTBTimestamp ( double  theCTBTimestamp)
inline

Definition at line 169 of file ProtoDUNEBeamSpill.h.

169 { CTBTimestamp = theCTBTimestamp; };
void beam::ProtoDUNEBeamSpill::SetMagnetCurrent ( double  theMagnetCurrent)
inline

Definition at line 172 of file ProtoDUNEBeamSpill.h.

172 { MagnetCurrent = theMagnetCurrent; };
void beam::ProtoDUNEBeamSpill::SetSpillOffset ( double  theSpillOffset)
inline

Definition at line 166 of file ProtoDUNEBeamSpill.h.

166 { SpillOffset = theSpillOffset; };
void beam::ProtoDUNEBeamSpill::SetSpillStart ( double  theSpillStart)
inline

Definition at line 163 of file ProtoDUNEBeamSpill.h.

163 { SpillStart = theSpillStart; };
void beam::ProtoDUNEBeamSpill::SetUnmatched ( )
inline

Definition at line 152 of file ProtoDUNEBeamSpill.h.

152 { isMatched = false; };
std::bitset< 32 > beam::ProtoDUNEBeamSpill::toBinary ( double  num)
inline

Definition at line 381 of file ProtoDUNEBeamSpill.h.

381  {
382  std::bitset<64> mybits( (long(num)) );
383  std::bitset<32> upper, lower;
384  for(int i = 0; i < 32; ++i){
385  lower[i] = mybits[i];
386  upper[i] = mybits[i + 32];
387  }
388  if(upper.any()) std::cout << "WARNING: NONZERO HALF" << std::endl;
389 
390  return lower;
391  }
QTextStream & endl(QTextStream &s)

Member Data Documentation

size_t beam::ProtoDUNEBeamSpill::activeTrigger
private

Definition at line 213 of file ProtoDUNEBeamSpill.h.

int beam::ProtoDUNEBeamSpill::BITrigger
private

Definition at line 218 of file ProtoDUNEBeamSpill.h.

std::vector< CKov > beam::ProtoDUNEBeamSpill::CKov0
private

Definition at line 208 of file ProtoDUNEBeamSpill.h.

std::vector< CKov > beam::ProtoDUNEBeamSpill::CKov1
private

Definition at line 209 of file ProtoDUNEBeamSpill.h.

double beam::ProtoDUNEBeamSpill::CTBTimestamp
private

Definition at line 186 of file ProtoDUNEBeamSpill.h.

std::vector< std::vector< size_t > > beam::ProtoDUNEBeamSpill::DownstreamTriggers
private

Definition at line 204 of file ProtoDUNEBeamSpill.h.

std::map<std::string, std::vector< FBM > > beam::ProtoDUNEBeamSpill::fiberMonitors
private

Definition at line 191 of file ProtoDUNEBeamSpill.h.

bool beam::ProtoDUNEBeamSpill::isMatched = false
private

Definition at line 214 of file ProtoDUNEBeamSpill.h.

double beam::ProtoDUNEBeamSpill::MagnetCurrent
private

Definition at line 222 of file ProtoDUNEBeamSpill.h.

size_t beam::ProtoDUNEBeamSpill::nFBMs
private

Definition at line 192 of file ProtoDUNEBeamSpill.h.

std::vector< double > beam::ProtoDUNEBeamSpill::RecoBeamMomenta
private

Definition at line 216 of file ProtoDUNEBeamSpill.h.

double beam::ProtoDUNEBeamSpill::SpillOffset
private

Definition at line 220 of file ProtoDUNEBeamSpill.h.

double beam::ProtoDUNEBeamSpill::SpillStart
private

Definition at line 219 of file ProtoDUNEBeamSpill.h.

std::vector<std::pair<double,double> > beam::ProtoDUNEBeamSpill::t0
private

Definition at line 173 of file ProtoDUNEBeamSpill.h.

std::vector< std::pair< double, double > > beam::ProtoDUNEBeamSpill::TOF0
private

Definition at line 196 of file ProtoDUNEBeamSpill.h.

std::vector< std::pair< double, double > > beam::ProtoDUNEBeamSpill::TOF1
private

Definition at line 197 of file ProtoDUNEBeamSpill.h.

std::vector< int > beam::ProtoDUNEBeamSpill::TOFChan
private

Definition at line 198 of file ProtoDUNEBeamSpill.h.

std::vector< std::vector< int > > beam::ProtoDUNEBeamSpill::TOFChans
private

Definition at line 202 of file ProtoDUNEBeamSpill.h.

std::vector< std::vector< double > > beam::ProtoDUNEBeamSpill::TOFs
private

Definition at line 201 of file ProtoDUNEBeamSpill.h.

std::vector<recob::Track> beam::ProtoDUNEBeamSpill::Tracks
private

Definition at line 211 of file ProtoDUNEBeamSpill.h.

std::vector< std::vector< size_t > > beam::ProtoDUNEBeamSpill::UpstreamTriggers
private

Definition at line 203 of file ProtoDUNEBeamSpill.h.


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