// $Id: TPexorMonProc.cxx 614 2010-04-13 15:39:33Z linev $ //----------------------------------------------------------------------- // The GSI Online Offline Object Oriented (Go4) Project // Experiment Data Processing at EE department, GSI //----------------------------------------------------------------------- // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH // Planckstr. 1, 64291 Darmstadt, Germany // Contact: http://go4.gsi.de //----------------------------------------------------------------------- // This software can be used under the license agreements as stated // in Go4License.txt file which is part of the distribution. //----------------------------------------------------------------------- #include "TPexorMonProc.h" #include #include "Riostream.h" #include "TH1.h" #include "TH2.h" #include "TCutG.h" #include "TCanvas.h" #include "TLine.h" //#include "TGo4WinCond.h" //#include "TGo4PolyCond.h" //#include "TGo4CondArray.h" #include "TGo4Picture.h" #include "TGo4StepFactory.h" #include "TGo4Analysis.h" #include "TGo4Version.h" unsigned int TPexorMonProc::fNumSlavesSFP[]={1,0,0,0}; //*********************************************************** TPexorMonProc::TPexorMonProc() : TGo4EventProcessor() { } //*********************************************************** TPexorMonProc::~TPexorMonProc() { cout << "**** TPexorMonProc: Delete instance " << endl; } //*********************************************************** // this one is used in standard factory TPexorMonProc::TPexorMonProc(const char* name) : TGo4EventProcessor(name) { cout << "**** TPexorMonProc: Create instance " << name << endl; for(int sfp=0;sfp PEXOR_SLAVE_NUM) TPexorMonProc::fNumSlavesSFP[sfp] = PEXOR_SLAVE_NUM; for(unsigned int slave=0;slaveIsA() != TGo4MbsEvent::Class())) { cout << "TPexorMonProc: no input MBS event found!" << endl; return kFALSE; } TGo4MbsEvent* evnt = (TGo4MbsEvent*) GetInputEvent(); TPexorMonEvent* outevent=dynamic_cast(target); if(outevent==0) { cout << "TPexorMonProc: wrong output event type!" << endl; return kFALSE; } // if(evnt->GetTrigger() > 11) { // cout << "**** TPexorMonProc: Skip trigger event" << endl; // return kFALSE; // } evnt->ResetIterator(); TGo4MbsSubEvent *psubevt(0); while((psubevt = evnt->NextSubEvent()) != 0) { // loop over subevents Int_t * pdata = psubevt->GetDataField(); Int_t lwords = psubevt->GetIntLen(); Int_t sfp=psubevt->GetSubcrate(); if(sfp<0 || sfp>=PEXOR_SFP_NUM) { GO4_SKIP_EVENT_MESSAGE("############ TPexorMonProc: Found invalid sfp number %d , skip event\n",sfp); // cout << "**** TPexorMonProc: Found invalid sfp number, skip event" << endl; // return kFALSE; } if(TPexorMonProc::fNumSlavesSFP[sfp]==0) { cout << "**** TPexorMonProc: Skipping not configured sfp number"<> 4; // just for check should be 3(byte) dlength=((currentdata ) & 0x0f); // should be 4 (byte) trigid = ((currentdata >> 8 ) & 0xff); modid = ((currentdata >> 16 ) & 0xff); memid = ((currentdata >> 24 ) & 0xff); //printf("Token header: hlen:0x%x dlen:0x%x trigid:0x%x modid:0x%x memid:0x%x \n",hlength,dlength,trigid,modid,memid); if(hlength!=3 || dlength!=4) { printf("Invalid token header data, assume we reached end of token, stop it!\n"); evnt->Print(); printf("hlen:%d dlen:%d trigid:%d modid:%d memid:%d \n",hlength,dlength,trigid,modid,memid); GO4_STOP_ANALYSIS; return kTRUE; //break; } submem=memid; if(submem>=PEXOR_SUBMEM_NUM) { printf("Token header: Error found submem 0x%x out of range:0x%x \n",submem,PEXOR_SUBMEM_NUM); submem=0; } slave=modid; if(slave>=TPexorMonProc::fNumSlavesSFP[sfp]) { printf("Token header: Error found slave 0x%x out of range:0x%x \n",slave,TPexorMonProc::fNumSlavesSFP[sfp]); slave=0; } isheaderread=true; } else if(!isdsizeread) { // read data size of next submem chunk datasize=currentdata; //printf("Reading datasize:0x%x bytes... \n",datasize); if(datasize==0) { printf("Zero datasize, assume we reached end of token.\n"); break; } datawordsize=datasize/sizeof(int); isdsizeread=true; } else { if(datacount < datawordsize) { datacount++; // fill data into corresponding histogram: if(fHisSubmem[sfp][slave][submem]!=0) fHisSubmem[sfp][slave][submem]->Fill(currentdata); outevent->fSubmem[sfp][slave][submem].push_back(currentdata); // copy values to output event } else { //printf("Reached end of block at datacount 0x%x words... \n",datacount); --i; // repeat this word index for header scan --pdata; isheaderread=false; // get next header isdsizeread=false; // get next datasize datacount=0; } } } // for }// while subevents return kTRUE; }