/** @file readTsa.C ** @author Florian Uhlig ** @since August 2014 ** @date 23.01.2015 ** ** Adapted to GET4 v1.23 unpacker in 32b mode by P.-A. Loizeau ** ROOT macro to read tsa files which have been generated by a flib board and convert the data ** into cbmroot format. ** Uses CbmFlibFileSource as source task. */ void readTsa_file_get4( Int_t nEvents = -1, TString inFile = "data/get4Test.tsa" ) { // --- Specify input file name (this is just an example) //TString inFile = "spadic_dlm_trigger_2014-11-15_noepoch.tsa"; // TString inFile = "nxdata.tsa"; // --- Specify number of events to be produced. // --- -1 means run until the end of the input file. // Int_t nEvents = -1; // --- Specify output file name (this is just an example) TString outFile = "data/get4_test.root"; // --- Set log output levels // FairLogger::GetLogger()->SetLogScreenLevel("WARNING"); FairLogger::GetLogger()->SetLogScreenLevel("INFO"); // FairLogger::GetLogger()->SetLogScreenLevel("DEBUG"); FairLogger::GetLogger()->SetLogVerbosityLevel("LOW"); // --- Set debug level gDebug = 0; std::cout << std::endl; //std::cout << ">>> readTsa: input file is " << inFile << std::endl; std::cout << ">>> readTsa: output file is " << outFile << std::endl; // ======================================================================== // ======================================================================== std::cout << std::endl; std::cout << ">>> readTsa: Initialising..." << std::endl; // NXyter Unpacker // CbmTSUnpackNxyter* nxyter_unpacker = new CbmTSUnpackNxyter(); // Spadic Unpacker // CbmTSUnpackSpadic* spadic_unpacker = new CbmTSUnpackSpadic(); // GET4 Unpacker CbmTSUnpackGet4v1x* get4_unpacker = new CbmTSUnpackGet4v1x(); get4_unpacker->SetRocNb( 2); // Min 1 get4_unpacker->SetGet4Nb( 88); // Min 1 get4_unpacker->SetMsOverlapTs(0); // Min 1 get4_unpacker->SetMode( 1); // 0 = debug, 1 = moni, 2 = unpack // Disable unconnected chips for( UInt_t uChipIndex = 24; uChipIndex < 64; uChipIndex++) get4_unpacker->SetActiveGet4( uChipIndex, kFALSE ); // Disable unread USTC RPC chips for( UInt_t uChipIndex = 80; uChipIndex < 88; uChipIndex++) get4_unpacker->SetActiveGet4( uChipIndex, kFALSE ); get4_unpacker->SetPulserMode( kFALSE ); // kTRUE = ON, kFALSE = OFF (default is ON) get4_unpacker->SetPulserFee( ); // 1 value (default is 0) get4_unpacker->SetPulserChans( 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60); // 1-16 values (default is 0-15) get4_unpacker->SetOldReadoutSupp(); get4_unpacker->SetMaxCoincDist(500.0); // --- Source task CbmFlibFileSourceNew* source = new CbmFlibFileSourceNew(); source->SetFileName(inFile); // source->AddUnpacker(nxyter_unpacker, 0x10); // source->AddUnpacker(spadic_unpacker, 0x40); source->AddUnpacker(get4_unpacker, 0x60); // --- Event header // FairEventHeader* event = new CbmTbEvent(); // event->SetRunId(260); // --- Run FairRunOnline *run = FairRunOnline::Instance(); run->SetSource(source); run->SetOutputFile(outFile); run->SetAutoFinish(kFALSE); // FairRunOnline *run = new FairRunOnline(source); // run->SetOutputFile(outFile); // run->SetEventHeader(event); /* FairTask* spadicRawBeam = new CbmTrdRawBeamProfile(); run->AddTask(spadicRawBeam); CbmTrdOnlineDisplay* onlineDisplay = new CbmTrdOnlineDisplay(); onlineDisplay->SetUpdateInterval(96); run->AddTask(onlineDisplay); */ run->Init(); // --- Start run TStopwatch timer; timer.Start(); // std::cout << ">>> Start run from the command line by calling Run()" << std::endl; run->Run(nEvents, 0); // run until end of input file run->Finish(); get4_unpacker->Finish(); timer.Stop(); // --- End-of-run info Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); std::cout << std::endl << std::endl; std::cout << ">>> readTsa: Macro finished successfully." << std::endl; std::cout << ">>> readTsa: Output file is " << outFile << std::endl; std::cout << ">>> readTsa: Real time " << rtime << " s, CPU time " << ctime << " s" << std::endl; std::cout << std::endl; /// --- Screen output for automatic tests std::cout << " Test passed" << std::endl; std::cout << " All ok " << std::endl; }