// ------------------------------------------------------------------------- // ----- AsyUnpack source file ----- // ----- Written for the CAMAC (Stelzer) by A.Le Fevre, 11/2012 ----- // ------------------------------------------------------------------------- #include "CAMACUnpack.h" #include "FairLogger.h" #include "TClonesArray.h" #include #include "TSystem.h" using std::cout; using std::endl; CAMACUnpack::CAMACUnpack() :FairTask() { //init calibration } // ------------------------------------------------------------------------- CAMACUnpack::CAMACUnpack(const char* name, Int_t iVerbose) : FairTask(name, iVerbose), fCAMAC_evt(0), fRootCAMACEvent(0), fRootCAMACEventCopy(0), ffEvtBufferClone(0) { } // ------------------------------------------------------------------------- CAMACUnpack::~CAMACUnpack() { } // ------------------------------------------------------------------------- InitStatus CAMACUnpack::Init() { fLogger->Info(MESSAGE_ORIGIN," CAMACUnpack::Init()------------------Start "); corr=false; fCAMAC_evt = new TCAMACEvent(); // start detector fRootCAMACEvent = new TRootCAMACEvent(); // CAMAC infos (Stelzer) FairRootManager* ioman = FairRootManager::Instance(); if ( ! ioman ) Fatal("Init", "No FairRootManager"); ioman->Register("CAMACEVENT", "CAMAC EVENT TREE", fRootCAMACEvent, kFALSE); fRootCAMACEventCopy = new TClonesArray("TRootCAMACEvent"); fRootCAMACEventCopy=(TClonesArray*)fRootCAMACEvent; ioman->Register("CAMACEVENTCLONE", "CAMAC EVENT TREE CLONE", fRootCAMACEventCopy, kFALSE); ffEvtBufferClone =(TClonesArray*) ioman->GetObject("EVTBUFFERCLONE"); ffEvtBuffer = (TEvtBuffer*)ffEvtBufferClone; if(!ffEvtBufferClone)cout << "CAMAC EVT BUFFER NOT FOUND"<Info(MESSAGE_ORIGIN," CAMACUnpack::Init()------------------End "); cout << " ...return to continue..."<< endl; getchar(); } // ------------------------------------------------------------------------- void CAMACUnpack::SetParTask() { } // ------------------------------------------------------------------------- void CAMACUnpack::Finish() { // if(fIsLastEvent) // fLogger->Info(MESSAGE_ORIGIN," Finish all events in file"); } // ------------------------------------------------------------------------- void CAMACUnpack::Reset() { } // ------------------------------------------------------------------------- void CAMACUnpack::Exec(Option_t* opt) { //_____________________________CAMAC subevent________________________________________________ //fCAMAC_evt->ProcessCurrentEventMBS(ffEvtBuffer->CAMACBuffer,ffEvtBuffer->CAMACnrlw); Int_t word[33]; int *SubEventDataPtr = ffEvtBuffer->CAMACBuffer; for (Int_t ii=5; ii<13; ii++){ // word = 0xFFFF0313; // word = (word<<21)>>21; word[ii] = (((*(SubEventDataPtr+ii))<<21)>>21); // cout<<(hex)<>21); // word = psubevt->Data(i); // word= (word<<21)>>21; // cout<<(hex)<>20); // cout<<(hex)<tdc1_sc = word[5]; fRootCAMACEvent->tdc2_sc = word[6]; fRootCAMACEvent->qdc1_sc = word[21]; fRootCAMACEvent->qdc2_sc = word[22]; fRootCAMACEvent->tstart_sc = (fRootCAMACEvent->tdc1_sc+fRootCAMACEvent->tdc2_sc)/2./20.; // (ns) - 50 ps/channel } // ------------------------------------------------------------------------- ClassImp(CAMACUnpack)