ARA ROOT v3.6 Software

AraEvent/RawAtriStationEvent.cxx

00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 #include "RawAtriStationEvent.h"
00011 #include <iostream>
00012 #include <fstream>
00013 #include <cstring>
00014 ClassImp(RawAtriStationEvent);
00015 
00016 RawAtriStationEvent::RawAtriStationEvent()   
00017 {  
00018   //Default Constructor
00019 }
00020 
00021 RawAtriStationEvent::~RawAtriStationEvent() {
00022    //Default Destructor
00023 }
00024 
00025 
00026 RawAtriStationEvent::RawAtriStationEvent(AraStationEventHeader_t *hdPtr, char *dataBuffer) // Assignment constructor
00027   :RawAraStationEvent(&(hdPtr->gHdr))
00028 {
00029   
00030 
00031    unixTime=hdPtr->unixTime;
00032    unixTimeUs=hdPtr->unixTimeUs;
00033    eventNumber=hdPtr->eventNumber;
00034    ppsNumber=hdPtr->ppsNumber;
00035    numStationBytes=hdPtr->numBytes;
00036    versionId=hdPtr->versionNumber;
00037    timeStamp=hdPtr->timeStamp;
00038    timeStamp ^= (timeStamp >> 1);
00039    timeStamp ^= (timeStamp >> 2);
00040    timeStamp ^= (timeStamp >> 4);
00041    timeStamp ^= (timeStamp >> 8);
00042    timeStamp ^= (timeStamp >> 16);
00043 
00044 
00045    eventId=hdPtr->eventId;
00046    //   std::cerr << eventNumber << "\t" << versionId << "\t" << ppsNumber << "\t" << timeStamp << "\t" << eventId << std::endl;
00047    numReadoutBlocks=hdPtr->numReadoutBlocks; 
00048    
00049    for(int trig=0;trig<MAX_TRIG_BLOCKS;trig++) {
00050      triggerInfo[trig]=hdPtr->triggerInfo[trig];
00051      triggerBlock[trig]=hdPtr->triggerBlock[trig];
00052    }
00053 
00054    int uptoByte=0;
00055    //   std::cerr << "numReadoutBlocks " << numReadoutBlocks << "\n";
00056    for(int block=0;block<numReadoutBlocks;block++) {
00057      AraStationEventBlockHeader_t *blkPtr = (AraStationEventBlockHeader_t*)&dataBuffer[uptoByte];     
00058      uptoByte+=sizeof(AraStationEventBlockHeader_t);
00059      AraStationEventBlockChannel_t *chanPtr = (AraStationEventBlockChannel_t*)&dataBuffer[uptoByte];
00060      RawAtriStationBlock blocky(blkPtr,chanPtr);
00061      blockVec.push_back(blocky);
00062      int numChan=blocky.getNumChannels();
00063 
00064      // std::cout << "block " << block << " numChan " << numChan 
00065      //                <<  " irsBlockNumber " << (blkPtr->irsBlockNumber&0x1ff)
00066      //                << " channelMask " << blkPtr->channelMask << "\t"
00067      //                << " uptoByte " << uptoByte << "\n";
00068      // numChan=8; //HArd wire for testing
00069      uptoByte+=sizeof(AraStationEventBlockChannel_t)*numChan;
00070    }
00071    //   std::cerr << sizeof(AraStationEventHeader_t) << "\n";
00072    if(uptoByte!=int(numStationBytes))    
00073      std::cerr << "Error assigned " << uptoByte <<  " bytes out of " << numStationBytes << "\n";
00074 }
00075 
00076 RawAtriStationEvent::RawAtriStationEvent(AraStationEventHeader_t *hdPtr, char *dataBuffer, AraStationId_t forcedStationId) // Assignment constructor
00077   :RawAraStationEvent(&(hdPtr->gHdr))
00078 {
00079   //JPD The same as above but forcing the stationId value
00080   stationId = forcedStationId;
00081 
00082   
00083   unixTime=hdPtr->unixTime;
00084   unixTimeUs=hdPtr->unixTimeUs;
00085   eventNumber=hdPtr->eventNumber;
00086   versionId=hdPtr->versionNumber;
00087   ppsNumber=hdPtr->ppsNumber;
00088   numStationBytes=hdPtr->numBytes;
00089   //   std::cerr << eventNumber << "\t" << ppsNumber << "\t" << numStationBytes;
00090    timeStamp=hdPtr->timeStamp;
00091    timeStamp ^= (timeStamp >> 1);
00092    timeStamp ^= (timeStamp >> 2);
00093    timeStamp ^= (timeStamp >> 4);
00094    timeStamp ^= (timeStamp >> 8);
00095    timeStamp ^= (timeStamp >> 16);
00096 
00097 
00098 
00099    eventId=hdPtr->eventId;
00100    numReadoutBlocks=hdPtr->numReadoutBlocks; 
00101    
00102    for(int trig=0;trig<MAX_TRIG_BLOCKS;trig++) {
00103      triggerInfo[trig]=hdPtr->triggerInfo[trig];
00104      triggerBlock[trig]=hdPtr->triggerBlock[trig];
00105    }
00106 
00107    int uptoByte=0;
00108    //   std::cerr << "numReadoutBlocks " << numReadoutBlocks << "\n";
00109    for(int block=0;block<numReadoutBlocks;block++) {
00110      AraStationEventBlockHeader_t *blkPtr = (AraStationEventBlockHeader_t*)&dataBuffer[uptoByte];     
00111      uptoByte+=sizeof(AraStationEventBlockHeader_t);
00112      AraStationEventBlockChannel_t *chanPtr = (AraStationEventBlockChannel_t*)&dataBuffer[uptoByte];
00113      RawAtriStationBlock blocky(blkPtr,chanPtr);
00114      blockVec.push_back(blocky);
00115      int numChan=blocky.getNumChannels();
00116 
00117      // std::cout << "block " << block << " numChan " << numChan 
00118      //                <<  " irsBlockNumber " << (blkPtr->irsBlockNumber&0x1ff)
00119      //                << " channelMask " << blkPtr->channelMask << "\t"
00120      //                << " uptoByte " << uptoByte << "\n";
00121      // numChan=8; //HArd wire for testing
00122      uptoByte+=sizeof(AraStationEventBlockChannel_t)*numChan;
00123    }
00124    //   std::cerr << sizeof(AraStationEventHeader_t) << "\n";
00125    if(uptoByte!=int(numStationBytes))    
00126      std::cerr << "Error assigned " << uptoByte <<  " bytes out of " << numStationBytes << "\n";
00127 }
00128 
00129 Int_t RawAtriStationEvent::getFirstCapArray(Int_t dda)
00130 {
00131 
00132   for(int i=0;i<DDA_PER_ATRI;i++){
00133     int this_dda = this->blockVec.at(i).getDda();
00134     if(this_dda==dda) return this->blockVec.at(i).getCapArray();
00135   }  
00136   return -1;
00137   
00138 
00139 }

Generated on Mon Mar 18 16:04:45 2013 for ARA ROOT v3.6 Software by doxygen 1.4.7