// --------------------------------------------------------------------------
//
// Macro for testing the trd digitizer and hit producer
//
// F. Uhlig 02/06/2010
// Version 02/06/2010 (F. Uhlig)
//
// 20130605 - checked by DE
// --------------------------------------------------------------------------
TString caveGeom="";
TString pipeGeom="";
TString magnetGeom="";
TString mvdGeom="";
TString stsGeom="";
TString richGeom="";
TString muchGeom="";
TString shieldGeom="";
TString trdGeom="";
TString tofGeom="";
TString ecalGeom="";
TString platformGeom="";
TString psdGeom="";
Double_t psdZpos=0.;
Double_t psdXpos=0.;
TString mvdTag="";
TString stsTag="";
TString trdTag="";
TString tofTag="";
TString stsDigi="";
TString muchDigi="";
TString trdDigi="";
TString tofDigi="";
TString mvdMatBudget="";
TString stsMatBudget="";
TString fieldMap="";
Double_t fieldZ=0.;
Double_t fieldScale=0.;
Int_t fieldSymType=0;
TString defaultInputFile="";
void trd_digi1(Int_t nEvents = 1, const char* setup = "sis300_electron")
{
gStyle->SetPalette(1,0);
gROOT->SetStyle("Plain");
gStyle->SetPadTickX(1);
gStyle->SetPadTickY(1);
FairLogger *logger = FairLogger::GetLogger();
logger->SetLogFileName("MyLog.log");
logger->SetLogToScreen(kTRUE);
// logger->SetLogToFile(kFALSE);
// logger->SetLogVerbosityLevel("HIGH");
// logger->SetLogFileLevel("DEBUG4");
// logger->SetLogScreenLevel("DEBUG2");
logger->SetLogScreenLevel("INFO");
// ========================================================================
// 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 (MC events)
TString inFile = "data/test.mc.root";
// Parameter file
TString parFile = "data/params.root";
// Output directory
TString outDir = "data";
// Output file
TString outFile = "data/test.eds.root";
// Digitisation 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 which is then used during
// the reconstruction.
TList *parFileList = new TList();
TString inDir = gSystem->Getenv("VMCWORKDIR");
TString paramDir = inDir + "/parameters";
TString setupFile = inDir + "/geometry/setup/" + setup + "_setup.C";
TString setupFunct = setup;
setupFunct += "_setup()";
gROOT->LoadMacro(setupFile);
gInterpreter->ProcessLine(setupFunct);
TObjString stsDigiFile(paramDir + "/" + stsDigi);
parFileList->Add(&stsDigiFile);
TObjString trdDigiFile(paramDir + "/" + trdDigi);
parFileList->Add(&trdDigiFile);
TObjString tofDigiFile(paramDir + "/" + tofDigi);
parFileList->Add(&tofDigiFile);
cout << "finally using : >> " << trdDigi << " << " << endl;
// Function needed for CTest runtime dependency
TString depFile = Remove_CTest_Dependency_File(outDir, "trd_digi1");
// In general, the following parts need not be touched
// ========================================================================
// ---- Debug option -------------------------------------------------
gDebug = 0;
// ------------------------------------------------------------------------
// ----- Timer --------------------------------------------------------
TStopwatch timer;
timer.Start();
// ------------------------------------------------------------------------
// ----- Reconstruction run -------------------------------------------
FairRunAna *run = new FairRunAna();
run->SetInputFile(inFile);
run->SetOutputFile(outFile);
Bool_t hasFairMonitor = Has_Fair_Monitor();
if (hasFairMonitor) {
FairMonitor::GetMonitor()->EnableMonitor(kTRUE);
}
// ------------------------------------------------------------------------
// =========================================================================
// === TRD local reconstruction ===
// =========================================================================
// Update of the values for the radiator F.U. 17.08.07
Int_t trdNFoils = 130; // number of polyethylene foils
Float_t trdDFoils = 0.0013; // thickness of 1 foil [cm]
Float_t trdDGap = 0.02; // thickness of gap between foils [cm]
Bool_t simpleTR = kTRUE; // use fast and simple version for TR production
CbmTrdRadiator *radiator = new CbmTrdRadiator(simpleTR, trdNFoils, trdDFoils, trdDGap);
CbmTrdDigitizer* trdDigitizer = new CbmTrdDigitizer(radiator);
run->AddTask(trdDigitizer);
CbmTrdHitProducerDigi* trdHitProd = new CbmTrdHitProducerDigi();
run->AddTask(trdHitProd);
CbmTrdHitProducerQa* trdHitProdQa = new CbmTrdHitProducerQa();
run->AddTask(trdHitProdQa);
// -------------------------------------------------------------------------
// === End of TRD local reconstruction ===
// =========================================================================
// ----- Parameter database --------------------------------------------
FairRuntimeDb* rtdb = run->GetRuntimeDb();
FairParRootFileIo* parIo1 = new FairParRootFileIo();
FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo();
parIo1->open(parFile.Data());
parIo2->open(parFileList, "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 << "Parameter file is " << parFile << endl;
cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
cout << endl;
// ------------------------------------------------------------------------
if (hasFairMonitor) {
// Extract the maximal used memory an add is as Dart measurement
// This line is filtered by CTest and the value send to CDash
FairSystemInfo sysInfo;
Float_t maxMemory=sysInfo.GetMaxMemory();
cout << "";
cout << maxMemory;
cout << "" << endl;
Float_t cpuUsage=ctime/rtime;
cout << "";
cout << cpuUsage;
cout << "" << endl;
FairMonitor* tempMon = FairMonitor::GetMonitor();
tempMon->Print();
}
// delete run;
cout << " Test passed" << endl;
cout << " All ok " << endl;
// Function needed for CTest runtime dependency
Generate_CTest_Dependency_File(depFile);
}