TV1190Data Class Reference

#include <TV1190Data.hxx>

Inheritance diagram for TV1190Data:
Inheritance graph
[legend]
Collaboration diagram for TV1190Data:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TV1190Data (int bklen, int bktype, const char *name, void *pdata)
 Constructor.
uint32_t GetEventCounter (int index=0) const
 Get Event Counter.
uint32_t GetGeoAddress (int index=0) const
 Get Geographical Address.
int GetExtendedTriggerTimeTag (int index=0) const
 Get the extended trigger time tag.
int GetWordCount () const
 Get the word count.
bool IsTriggerLost (int index=0) const
bool HasBufferOverflow (int index=0) const
bool HasTDCError (int index=0) const
int GetEventsInBank ()
 Get the number of events in this bank.
void Print ()
 Print the bank contents in a structured way.
std::vector< TDCMeasurement > & GetMeasurements ()
 Get the Vector of TDC Measurements.
const uint16_t * GetData16 () const
const uint32_t * GetData32 () const
const uint64_t * GetData64 () const
int GetSize () const
int GetType () const
std::string GetName () const
void Dump ()
 Dump the bank contents in an unstructured way.

Private Attributes

std::vector< uint32_t > fGlobalHeader
 The overall global header.
std::vector< int > fExtendedTriggerTimeTag
int fWordCountTotal
std::vector< uint32_t > fStatus
std::vector< TDCMeasurementfMeasurements
 Vector of TDC Measurements.

Detailed Description

Class to store data from CAEN V1190. We store the information as a vector of TDCMeasurement's Question: do we need a way of retrieving information about TDCs that have no measurements? Currently this information is not exposed. For the definition of obscure variables see the CAEN V1190 manual.

Definition at line 78 of file TV1190Data.hxx.


Constructor & Destructor Documentation

TV1190Data::TV1190Data ( int  bklen,
int  bktype,
const char *  name,
void *  pdata 
)

Constructor.

Definition at line 46 of file TV1190Data.cxx.

References fExtendedTriggerTimeTag, fGlobalHeader, fMeasurements, fStatus, fWordCountTotal, TGenericData::GetData32(), and TGenericData::GetSize().

00046                                                                           :
00047     TGenericData(bklen, bktype, name, pdata)
00048 {
00049   
00050   // Do decoding.  Decoding is complicated by the fact that there can be 
00051   // multiple events in the same bank.  So need to find and save multiple
00052   // event headers, trailers.
00053 
00054   
00055   // Do some sanity checking.  
00056   // Make sure first word has right identifier
00057   if( (GetData32()[0] & 0xf8000000) != 0x40000000) 
00058     std::cerr << "First word has wrong identifier; first word = 0x" 
00059               << std::hex << GetData32()[0] << std::dec << std::endl;
00060 
00061   // Scan through the data, saving information as we go.
00062   int found_trailer_word = -1;
00063   //  fExtendedTriggerTimeTag = -1;
00064 
00065   uint32_t current_tdc_header =0;
00066   int index_for_trailer = 0;
00067   int index_for_error = 0;
00068   int numberEventsInBank = 0;
00069   fWordCountTotal =0;
00070   for(int i = 0; i < GetSize(); i++){
00071     uint32_t word = GetData32()[i];
00072     //std::cout << "0x"<<std::hex << word << std::dec << std::endl;
00073 
00074     // Header
00075     if( (word & 0xf8000000) == 0x40000000){
00076       fGlobalHeader.push_back(word);
00077       numberEventsInBank++;
00078     }
00079 
00080     // TDC header
00081     if( (word & 0xf8000000) == 0x08000000){
00082       current_tdc_header = word;
00083     }
00084     // TDC measurement
00085     if( (word & 0xf8000000) == 0x00000000){
00086       fMeasurements.push_back(TDCMeasurement(current_tdc_header,word,numberEventsInBank-1));
00087     }
00088     
00089     // TDC trailer
00090     if( (word & 0xf8000000) == 0x18000000){
00091       // Set the TDC trailer word for all the measurements since the last
00092       // TDC trailer.
00093       for(unsigned int i = index_for_trailer; i < fMeasurements.size(); i++){
00094         fMeasurements[i].SetTrailer(word);
00095       }
00096       index_for_trailer = fMeasurements.size();      
00097     }
00098 
00099     // TDC error
00100     if( (word & 0xf8000000) == 0x20000000){
00101       // Set the TDC error word for all the measurements since the last
00102       // TDC error.
00103       std::cout << "Error word: " << std::hex << "0x"<<word<< std::dec << std::endl;
00104       for(unsigned int i = index_for_trailer; i < fMeasurements.size(); i++){
00105         fMeasurements[i].SetErrors(word);
00106       }
00107       index_for_error = fMeasurements.size();    
00108     }
00109 
00110 
00111     // Extended Trigger Time Tag
00112     if( (word & 0xf8000000) == 0x88000000) fExtendedTriggerTimeTag.push_back((int)(word & 0x07ffffff));
00113 
00114     // Found global trailer
00115     if( (word & 0xf8000000) == 0x80000000){ // Found trailer
00116       found_trailer_word = i;
00117       fWordCountTotal += (word & 0x0001fffe0) >> 5;      
00118       fStatus.push_back( (word & 0x07000000) >> 24);
00119     }
00120  
00121   }
00122 
00123   if(found_trailer_word == -1){
00124     std::cerr << "Error in decoding V1190 data; didn't find trailer." << std::endl;
00125     std::cerr << "Bank dump: " << std::endl;
00126     for(int i = 0; i < GetSize(); i++){
00127       uint32_t word = GetData32()[i];
00128       std::cout << "0x"<<std::hex << word << std::dec << std::endl;
00129     }
00130   }
00131   if(found_trailer_word != GetSize()-1)
00132     std::cerr << "Error; did not find trailer on last word of bank. trailer word = " << found_trailer_word
00133               << " last word = " << GetSize()-1 << std::endl;
00134 
00135   if(fWordCountTotal != GetSize()){
00136     std::cerr << "Error in decoding V1190 data; word count in all trailers ("<<fWordCountTotal 
00137               << ") doesn't match bank size ("<< GetSize() << ")." << std::endl;
00138   }
00139 
00140 
00141 }

Here is the call graph for this function:


Member Function Documentation

void TGenericData::Dump (  )  [inline, inherited]

Dump the bank contents in an unstructured way.

Definition at line 39 of file TGenericData.hxx.

References TGenericData::GetData32(), TGenericData::GetName(), and TGenericData::GetSize().

Referenced by TGenericData::Print().

00039              {
00040 
00041     std::cout << "Generic decoder for bank named " <<  GetName().c_str() << std::endl;
00042     for(int i = 0; i < GetSize(); i++){
00043       std::cout << std::hex << "0x" << GetData32()[i] << std::dec << std::endl;
00044     }
00045 
00046   }

Here is the call graph for this function:

Here is the caller graph for this function:

const uint16_t* TGenericData::GetData16 (  )  const [inline, inherited]

Definition at line 24 of file TGenericData.hxx.

References TGenericData::fData.

Referenced by TL2249Data::TL2249Data().

00024 { return reinterpret_cast<const uint16_t*>(fData); }

Here is the caller graph for this function:

const uint32_t* TGenericData::GetData32 (  )  const [inline, inherited]
const uint64_t* TGenericData::GetData64 (  )  const [inline, inherited]

Definition at line 30 of file TGenericData.hxx.

References TGenericData::fData.

Referenced by TAgilentHistograms::UpdateHistograms().

00030 { return reinterpret_cast<const uint64_t*>(fData); }

Here is the caller graph for this function:

uint32_t TV1190Data::GetEventCounter ( int  index = 0  )  const [inline]

Get Event Counter.

Definition at line 87 of file TV1190Data.hxx.

References fGlobalHeader.

Referenced by Print().

00087 {return (fGlobalHeader[index] & 0x07ffffe0) >> 5;};

Here is the caller graph for this function:

int TV1190Data::GetEventsInBank (  )  [inline]

Get the number of events in this bank.

Definition at line 119 of file TV1190Data.hxx.

References fGlobalHeader.

Referenced by Print().

00119 {return fGlobalHeader.size();};

Here is the caller graph for this function:

int TV1190Data::GetExtendedTriggerTimeTag ( int  index = 0  )  const [inline]

Get the extended trigger time tag.

Definition at line 93 of file TV1190Data.hxx.

References fExtendedTriggerTimeTag.

00093 {return fExtendedTriggerTimeTag[index];};

uint32_t TV1190Data::GetGeoAddress ( int  index = 0  )  const [inline]

Get Geographical Address.

Definition at line 90 of file TV1190Data.hxx.

References fGlobalHeader.

Referenced by Print().

00090 {return (fGlobalHeader[index] & 0x1f) ;};

Here is the caller graph for this function:

std::vector<TDCMeasurement>& TV1190Data::GetMeasurements (  )  [inline]

Get the Vector of TDC Measurements.

Definition at line 124 of file TV1190Data.hxx.

References fMeasurements.

Referenced by MyTestLoop::ProcessMidasEvent(), TSimpleExampleCanvas::UpdateCanvasHistograms(), and TV1190Histograms::UpdateHistograms().

00124 {return fMeasurements;}

Here is the caller graph for this function:

std::string TGenericData::GetName (  )  const [inline, inherited]
int TGenericData::GetSize (  )  const [inline, inherited]

Definition at line 32 of file TGenericData.hxx.

References TGenericData::fSize.

Referenced by TGenericData::Dump(), TL2249Data::TL2249Data(), TMesytecData::TMesytecData(), TV1190Data(), and TV792Data::TV792Data().

00032 {return fSize;}

Here is the caller graph for this function:

int TGenericData::GetType (  )  const [inline, inherited]

Definition at line 34 of file TGenericData.hxx.

References TGenericData::fBankType.

00034 {return fBankType;}

int TV1190Data::GetWordCount (  )  const [inline]

Get the word count.

Definition at line 96 of file TV1190Data.hxx.

References fWordCountTotal.

00096 {return fWordCountTotal;};

bool TV1190Data::HasBufferOverflow ( int  index = 0  )  const [inline]

Definition at line 105 of file TV1190Data.hxx.

References fStatus.

00105                                               {
00106     if(fStatus[index] & 0x2)
00107       return true;
00108     else
00109       return false;
00110   }

bool TV1190Data::HasTDCError ( int  index = 0  )  const [inline]

Definition at line 111 of file TV1190Data.hxx.

References fStatus.

00111                                         {
00112     if(fStatus[index] & 0x1)
00113       return true;
00114     else
00115       return false;
00116   }

bool TV1190Data::IsTriggerLost ( int  index = 0  )  const [inline]

Definition at line 99 of file TV1190Data.hxx.

References fStatus.

00099                                           {
00100     if(fStatus[index] & 0x4)
00101       return true;
00102     else
00103       return false;
00104   }  

void TV1190Data::Print (  )  [virtual]

Print the bank contents in a structured way.

Reimplemented from TGenericData.

Definition at line 143 of file TV1190Data.cxx.

References fMeasurements, GetEventCounter(), GetEventsInBank(), GetGeoAddress(), and TGenericData::GetName().

00143                       {
00144 
00145   std::cout << "V1190 decoder for bank " << GetName().c_str() << std::endl;
00146   std::cout << "event counter = " << GetEventCounter() << ", geographic address: " <<  GetGeoAddress() << std::endl;
00147   std::cout << "Number of events in this bank: " << GetEventsInBank() << std::endl;
00148   for(unsigned int i = 0; i < fMeasurements.size(); i++){
00149     std::cout << "Measurement: " <<    fMeasurements[i].GetMeasurement() << " for tdc/chan "  <<
00150       fMeasurements[i].GetTDCNumber() << "/"<< fMeasurements[i].GetChannel();
00151     if(fMeasurements[i].IsLeading())
00152       std::cout << " (leading edge meas)";
00153     if(fMeasurements[i].IsTrailing())
00154       std::cout << " (trailing edge meas)";
00155 
00156     std::cout << "[event_id = " << fMeasurements[i].GetEventID() << ",bunch_id=" 
00157               << fMeasurements[i].GetBunchID()<< "]" << "Event index=" << fMeasurements[i].GetEventIndex();
00158     if(fMeasurements[i].HasTDCErrorWord())
00159       std::cout << "[errors=0x"<< std::hex << fMeasurements[i].GetErrors() << std::dec << "]";
00160     std::cout << std::endl;
00161   }
00162 
00163 
00164 }

Here is the call graph for this function:


Member Data Documentation

std::vector<int> TV1190Data::fExtendedTriggerTimeTag [private]

Definition at line 136 of file TV1190Data.hxx.

Referenced by GetExtendedTriggerTimeTag(), and TV1190Data().

std::vector<uint32_t> TV1190Data::fGlobalHeader [private]

The overall global header.

Definition at line 133 of file TV1190Data.hxx.

Referenced by GetEventCounter(), GetEventsInBank(), GetGeoAddress(), and TV1190Data().

std::vector<TDCMeasurement> TV1190Data::fMeasurements [private]

Vector of TDC Measurements.

Definition at line 143 of file TV1190Data.hxx.

Referenced by GetMeasurements(), Print(), and TV1190Data().

std::vector<uint32_t> TV1190Data::fStatus [private]

Definition at line 139 of file TV1190Data.hxx.

Referenced by HasBufferOverflow(), HasTDCError(), IsTriggerLost(), and TV1190Data().

Definition at line 137 of file TV1190Data.hxx.

Referenced by GetWordCount(), and TV1190Data().


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

Generated on 12 Feb 2016 for ROOT Analyzer by  doxygen 1.6.1