// -------------------------------------------------------------------------- // // Macro for analyzing test setup data // nh 14/02/2014 // -------------------------------------------------------------------------- // Max nEvents: 198999999999 void ana_lmd(Int_t nEvents = 10) { // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug, 4=raw debug) Int_t iVerbose = 3; // Specify log level (INFO, DEBUG, DEBUG1, ...) // TString logLevel = "DEBUG2"; // TString logLevel = "DEBUG1"; // TString logLevel = "DEBUG"; TString logLevel = "INFO"; // TString logLevel = "FATAL"; FairLogger* log; // Parameter files. // Add TObjectString containing the different file names to // a TList which is passed as input to the FairParAsciiFileIo. // The FairParAsciiFileIo will take care to create on the fly // a concatenated input parameter file. TList *parFileList = new TList(); TString workDir = gSystem->Getenv("VMCWORKDIR"); TString paramDir = workDir + "/macro/tof/beamtime"; TObjString unpParFile = paramDir + "/parUnpackLmdLab2014.txt"; parFileList->Add(&unpParFile); TObjString calParFile = paramDir + "/parCalLab2014.txt"; parFileList->Add(&calParFile); TObjString mapParFile = paramDir + "/parMapLab2014.txt"; parFileList->Add(&mapParFile); TObjString convParFile = paramDir + "/parConvLab2014.txt"; parFileList->Add(&convParFile); TString TofGeo="v14a"; TObjString tofDigiFile = workDir + "/parameters/tof/tof_" + TofGeo + ".digi.par"; // TOF digi file parFileList->Add(&tofDigiFile); TObjString tofDigiBdfFile = paramDir + "/tof.digibdf.par"; parFileList->Add(&tofDigiBdfFile); TString geoDir = gSystem->Getenv("VMCWORKDIR"); TString geoFile = geoDir + "/geometry/tof/geofile_tof_" + TofGeo + ".root"; TFile* fgeo = new TFile(geoFile); TGeoManager *geoMan = (TGeoManager*) fgeo->Get("FAIRGeom"); if (NULL == geoMan){ cout << " FAIRGeom not found in geoFile"<GetTopVolume(); master->SetVisContainers(1); master->Draw("ogl"); // Parameter file output TString parFile = paramDir + "/unpack.params.root"; // Output file TString outFile = paramDir+"/unpack.out.root"; // ---- Debug option ------------------------------------------------- gDebug = 0; // ------------------------------------------------------------------------ // ----- Timer -------------------------------------------------------- TStopwatch timer; timer.Start(); // ------------------------------------------------------------------------ // ========================================================================= // === Unpacker === // ========================================================================= FairLmdSource* source = new FairLmdSource(); // source->AddFile("/buffalo/gsi2012/nov12/run36_20121105_0102.lmd"); // source->AddFile("/home/nh/CBM/cbmroot/Devel/PAL/main/macro/tof/beamtime/LMD/run36_20121105_0102.lmd"); source->AddFile("/home/nh/CBM/cbmroot/Devel/PAL/main/macro/tof/beamtime/LMD/cosmic_131220_Big11kV_Buc5600V_0001.lmd"); // ----- Online/Offline MBS run ----------------------------------- TTriglogUnpackTof* tofTriglogUnpacker = new TTriglogUnpackTof( iVerbose ); source->AddUnpacker( tofTriglogUnpacker ); TMbsUnpackTof* tofMbsDataUnpacker = new TMbsUnpackTof( iVerbose ); source->AddUnpacker( tofMbsDataUnpacker ); FairRunOnline *run = new FairRunOnline(source); // run->SetGeomFile(geoFile); run->SetOutputFile(outFile); // === End of Unpacker === // ========================================================================= // ========================================================================= // === Unpacker monitoring === // ========================================================================= TMbsUnpTofMonitor* tofUnpMonitor = new TMbsUnpTofMonitor("Tof Unp Moni", iVerbose); run->AddTask(tofUnpMonitor); // do not remove!! // === End of Unpacker monitoring === // ========================================================================= // ---- Set the log level gLogger->SetLogScreenLevel(logLevel.Data()); // ========================================================================= // === Calibration === // ========================================================================= TMbsCalibTof* tofCalibration = new TMbsCalibTof("Tof Calibration", iVerbose); run->AddTask(tofCalibration); // === End of Calibration === // ========================================================================= // ========================================================================= // === Mapping === // ========================================================================= TMbsMappingTof* tofMapping = new TMbsMappingTof("Tof Mapping", iVerbose); run->AddTask(tofMapping); // === End of Mapping === // ========================================================================= // Cluster/Hit builder //CbmTofSimpClusterizer* tofSimpClust = new CbmTofSimpClusterizer("TOF Simple Clusterizer",iVerbose, kTRUE); //run->AddTask(tofSimpClust); CbmTofTestBeamClusterizer* tofTestBeamClust = new CbmTofTestBeamClusterizer("TOF TestBeam Clusterizer",iVerbose, kTRUE); run->AddTask(tofTestBeamClust); // ========================================================================= // === GO4 like output formatting === // ========================================================================= /* TMbsConvTof* tofConversion = new TMbsConvTof("Tof Conversion", iVerbose); run->AddTask(tofConversion); */ // === End of output conversion === // ========================================================================= // ----- Parameter database -------------------------------------------- FairRuntimeDb* rtdb = run->GetRuntimeDb(); Bool_t kParameterMerged = kTRUE; FairParRootFileIo* parIo1 = new FairParRootFileIo(kParameterMerged); parIo1->open(parFile.Data()); // "UPDATE"); parIo1->print(); rtdb->setFirstInput(parIo1); FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); parIo2->open(parFileList, "in"); parIo2->print(); // rtdb->setFirstInput(parIo1); rtdb->setSecondInput(parIo2); rtdb->print(); rtdb->printParamContexts(); rtdb->setOutput(parIo1); rtdb->saveOutput(); // ------------------------------------------------------------------------ // ----- Intialise and run -------------------------------------------- run->Init(); cout << "Starting run" << endl; // run->Run(0, nEvents); run->Run(nEvents, 0); // <= FAIRROOT guy style, crash for me on event finish // run->RunOnLmdFiles(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 << "Parameter file is " << parFile << endl; cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl; cout << endl; // ------------------------------------------------------------------------ // delete run; cout << " Test passed" << endl; cout << " All ok " << endl; }