• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

beamtime/cern-gem12/go4/Gem2/TGem2Proc.cxx (r4864/r3571)

Go to the documentation of this file.
00001 /* Generated by Together */
00002 
00003 #include "TGem2Proc.h"
00004 
00005 
00006 TGem2Proc::TGem2Proc(const char* name) : TCBMBeamtimeProc(name),
00007                                                                          fOutputEvent(0)
00008 {
00009   cout << "**** TGem2ProcTTRDSpadicProc: Create instance " << name << endl;
00010    
00011 
00012   fPar = (TGem2Param*) MakeParameter("Gem2Par", "TGem2Param", "set_Gem2Par.C");
00013 
00014   fRocInputEvent = 0;
00015   fOutputEvent = 0;
00016 
00017 }
00018 
00019 TGem2Proc::~TGem2Proc()
00020 {
00021 }
00022 
00023 void TGem2Proc::InitEvent(TGo4EventElement* outevnt)
00024 {
00025    // first assign input event:
00026    // since input event object is never discarded within processor lifetime,
00027    // we just search for subevent by name once to speed up processing
00028    if(fRocInputEvent==0)
00029    {
00030       TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent());
00031       if(btevent)
00032       {
00033          fRocInputEvent = dynamic_cast<TRocEvent*>(btevent->GetSubEvent("ROC"));
00034       }
00035       else
00036       {
00037          fRocInputEvent = dynamic_cast<TRocEvent*>(GetInputEvent());
00038       }
00039 
00040       if (fRocInputEvent==0) {
00041          GO4_STOP_ANALYSIS_MESSAGE("**** TRICHProc: Fatal error: input event is not a TRocEvent!!! STOP GO4");
00042       }
00043 
00044    }
00045 
00046    // then assign output event
00047    // since output event object is never discarded within processor lifetime,
00048    // we just search for subevent by name once to speed up processing
00049    if(fOutputEvent==0)
00050    {
00051       TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(outevnt);
00052       if(btevent)
00053       {
00054          fOutputEvent=dynamic_cast<TGem2Event*>(btevent->GetSubEvent("Gem2"));
00055       }
00056       else
00057       {
00058          fOutputEvent= dynamic_cast<TGem2Event*>(outevnt);
00059       }
00060       if(fOutputEvent==0) {
00061          GO4_STOP_ANALYSIS_MESSAGE("**** TGem2Proc: Fatal error: output event is not a TGem2Event!!! STOP GO4");
00062       }
00063    }
00064 }
00065 
00066 void TGem2Proc::FinalizeEvent()
00067 {
00068    for (int nn=0; nn<2; nn++) {
00069      // cout << "  Processing ROC "<< RICHROC << endl;
00070       // Loop over all ROCs which deliver RICH data
00071 
00072       int rocid(0);
00073       if (nn == 0) rocid = fPar->fRoc1; else
00074       if (nn == 1) rocid = fPar->fRoc2;
00075 
00076       TRocData* RocData=dynamic_cast<TRocData*>(fRocInputEvent->getEventElement(rocid));
00077       if (RocData==0) continue;  //no data from this ROC available;
00078 
00079       for (unsigned MessageNr=0; MessageNr<RocData->fExtMessages.size(); MessageNr++) {
00080          //cout << "  Processing message " << MessageNr << "from ROC " << RICHROC << endl;
00081          //cout << "Msg.size() = " << RocData->fExtMessages.size() << endl;
00082          // Loop over all messages from particular RICH-ROC
00083 
00084          TRocMessageExtended msg = RocData->fExtMessages.at(MessageNr);
00085          if (msg.GetMessageType() != roc::MSG_HIT) continue;  // only interrested in HIT messages
00086          //cout << "roc::MSG_HIT" << endl;
00087 
00088          // extraxt message information
00089          UInt_t dataROC=msg.GetRocNumber();
00090          UInt_t nxid = msg.GetNxNumber();  // 0 or 2
00091          UInt_t nxch=msg.GetNxChNum();   // 0..127
00092          Double_t dataHitTime=msg.GetTriggerDeltaT();
00093          Int_t dataHitADCraw=msg.GetNxADC();
00094          Int_t dataHitADCcor=msg.GetCorrectedNxADC();
00095       }
00096    }
00097 
00098 }

Generated on Tue Dec 10 2013 04:52:16 for ROCsoft by  doxygen 1.7.1