// -------------------------------------------------------------------------- // // Macro for reconstruction of raw data from LMD files (test beam AUG 09) // // Uses the task CbmTbReceiver // // V. Friese 30.06.2009 // Version 30.06.2009 (V. Friese) // // -------------------------------------------------------------------------- #include "source/cbmbase/CbmDetectorList.h" void reco_lmd(Int_t nEvents = 1000) { // ======================================================================== // Adjust this part according to your requirements // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug) Int_t iVerbose = 0; // Input file (LMD) // Specify file name separately from path such that the run number can be // deduced automatically TString inFile = "sep04_run021c_0000.lmd"; TString inPath = "/d/cbm06/cbmdata/AUG09/lmd_cal"; // Output file TString outFile = "data/sep20_run020_0000.raw.root"; // Parameter file TString work = getenv("VMCWORKDIR"); TString parFile = work + "/macro/sts/params.root"; // STS digitisation file for stereo angle 0 & 15 deg TString digiFile = "sts_test_beam_09_4st.digi.par"; // In general, the following parts need not be touched // ======================================================================== // ----- Check input file and get run number -------------------------- if ( inFile[12] != 'c' ) { cout << endl; cout << "=== Please use calibrated lmd file for analysis!" << endl; cout << endl; exit(9); } Int_t iRun = atoi(inFile(9,3).Data()); cout << endl << "=== Run number is " << iRun << endl << endl; // ------------------------------------------------------------------------ // ---- Debug option ------------------------------------------------- gDebug = 0; // ------------------------------------------------------------------------ // ----- Timer -------------------------------------------------------- TStopwatch timer; timer.Start(); // ------------------------------------------------------------------------ // ---- Load libraries ------------------------------------------------- gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C"); basiclibs(); gSystem->Load("/misc/cbmsoft/cbmdaq/JUN09/sarge32/fileapi/libLmdFile.so"); gSystem->Load("/misc/cbmsoft/cbmdaq/JUN09/sarge32/sw-local/libKnut.so"); gSystem->Load("libGeoBase"); gSystem->Load("libParBase"); gSystem->Load("libBase"); gSystem->Load("libCbmBase"); gSystem->Load("libCbmData"); gSystem->Load("libSts"); // ------------------------------------------------------------------------ // ----- Reconstruction run ------------------------------------------- FairRunAna *run= new FairRunAna(); run->SetOutputFile(outFile); // ------------------------------------------------------------------------ // ----- Data receiver ------------------------------------------------ TString input = inPath + "/" + inFile; CbmTbReceiver* receiver = new CbmTbReceiver(input, 2000., iVerbose); receiver->SetRun(iRun); receiver->AddRoc(0, kSTS); receiver->AddRoc(1, kSTS); receiver->AddRoc(3, kSTS); receiver->AddRoc(4, kMUCH); receiver->AddRoc(5, kMUCH); receiver->AddRoc(6, kRICH); receiver->SetBeam(6, 2); receiver->SetPersistence(kTRUE); run->AddTask(receiver); // ------------------------------------------------------------------------ // ----- STS cluster finder ------------------------------------------- FairTask* clusterFinder = new CbmStsRealClusterFinder("STS Cluster Finder", iVerbose); run->AddTask(clusterFinder); // ------------------------------------------------------------------------ // ----- STS Hit Finder ----------------------------------------------- FairTask* hitFinder = new CbmStsRealFindHits("STS Hit Finder", iVerbose); run->AddTask(hitFinder); // ------------------------------------------------------------------------ // ----- Parameter database -------------------------------------------- TString stsDigiFile = gSystem->Getenv("VMCWORKDIR"); stsDigiFile += "/parameters/sts/"; stsDigiFile += digiFile; cout << "digi file = " << stsDigiFile << endl; FairRuntimeDb* rtdb = run->GetRuntimeDb(); FairParRootFileIo* parIo1 = new FairParRootFileIo(); FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); parIo1->open(parFile.Data()); parIo2->open(stsDigiFile.Data(),"in"); rtdb->setFirstInput(parIo1); rtdb->setSecondInput(parIo2); rtdb->setOutput(parIo1); rtdb->saveOutput(); // ------------------------------------------------------------------------ // ----- Intialise and run -------------------------------------------- run->Init(); cout << "Starting run" << endl; run->Run(0,nEvents); // ------------------------------------------------------------------------ // ----- Finish ------------------------------------------------------- timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); cout << endl << endl; cout << "Macro finished succesfully." << endl; cout << "Output file is " << outFile << endl; cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl; cout << endl; // ------------------------------------------------------------------------ cout << " Test passed" << endl; cout << " All ok " << endl; exit(0); }