/** @file readTsa.C ** @author Florian Uhlig ** @since August 2014 ** @date 08.08.2014 ** ** 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 readTsaQA(TString inFile = //"data/98_ba2015.tsa" //"data/129_ba2015.tsa" //"/data/cern2015/flesnet/159_cern-fex.tsa" //"/opt/CBM/Daten/16_sps2016.tsa" "/opt/CBM/Daten/121_cern-fex.tsa" //"data/1076_cern2014.tsa" //"data/test.tsa" ) { // --- Specify input file name (this is just an example) //TString inFile = "spadic_dlm_trigger_2014-11-15_noepoch.tsa"; //TString inFile1 = "spadic_noise_trigger_2014-11-15_withepoch.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 = inFile;//"data/test_online.root"; outFile.ReplaceAll(".tsa",".root"); // --- Set log output levels FairLogger::GetLogger()->SetLogScreenLevel("INFO"); 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; // Spadic Unpacker CbmTSUnpackSpadic20* spadic_unpacker20 = new CbmTSUnpackSpadic20(); // --- Source task CbmFlibFileSourceNew* source = new CbmFlibFileSourceNew(); //source->SetHostName("cbmflib01"); source->SetFileName(inFile); source->AddUnpacker(spadic_unpacker20, 0x40); // 0x40 is foreseen default for TRD -- take care, often used in TRD readout prototypes so far is 0x10, try in case of doubt // --- Event header // FairEventHeader* event = new CbmTbEvent(); // event->SetRunId(260); CbmTrdTestBeamTools::Instance(new CbmTrdTestBeamTools); // change for your setup //CbmTrdTestBeamTools::Instance(new CbmTrdLabTools); // --- Run FairRunOnline *run = new FairRunOnline(source); run->SetOutputFile(outFile); // run->SetEventHeader(event); // gDebug=2; FairTask* spadicRawBeam = new CbmTrdQABase(); run->AddTask(spadicRawBeam); FairTask* HitAnalysis = new CbmTrdQAHit(); run->AddTask(HitAnalysis); /* FairTask* Baseline=new CbmTrdQABaseline(); run->AddTask(Baseline); */ FairTask* digitize=new CbmTrdAdvDigitizer(); run->AddTask(digitize); FairTask* DigiAnalysis = new CbmTrdDigiAnalysis(); run->AddTask(DigiAnalysis); FairTask* Clusterrize=new CbmTrdSimpleClusterizer(); run->AddTask(Clusterrize); // FairTask* ClusterAnalysis=new CbmTrdClusterAnalysis(); // run->AddTask(ClusterAnalysis); run->Init(); // --- Start run TStopwatch timer; timer.Start(); std::cout << ">>> readTsa: Starting run..." << std::endl; run->Run(nEvents, 0); // run until end of input file 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; }