void runDigiFOPICosmics(TString filename, Int_t field, TString gas, Int_t gain, TString distfile="", Int_t nEvents=0, Int_t evStart=0, Int_t outnum=-1, Bool_t simpleResponse=kFALSE, TString outfolder="NULL") { // ======================================================================== // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug) Int_t iVerbose = 0; Int_t persistence=1; // Number of events to process //Int_t nEvents = 0; TString mcMode = "TGeant3"; // ---- Load libraries ------------------------------------------------- TString sysFile = gSystem->Getenv("VMCWORKDIR"); TString inFile = filename; TString outFile = filename; std::cout<<"OUTFOLDER:"<SetInputFile(inFile); fRun->SetOutputFile(outFile); // ------------------------------------------------------------------------ // ----- Parameter database -------------------------------------------- TString allDigiFile = sysFile; allDigiFile+= Form("/tpc/FOPI/par/tpc.%i%s%iMC.par",field,gas.Data(),gain); FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParRootFileIo* parInput1 = new FairParRootFileIo(); parInput1->open(parFile.Data()); FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo(); parIo1->open(allDigiFile.Data(),"in"); rtdb->setFirstInput(parInput1); //rtdb->setSecondInput(parIo1); // ------------------------------------------------------------------------ // ----- TPC digi producers --------------------------------- TpcEventCounter* evCount = new TpcEventCounter(); // evCount->SetnEvts(nEvents); //evCount->SetStep(1); fRun->AddTask(evCount); TpcClusterizerTask* tpcClusterizer = new TpcClusterizerTask(); if(mcMode=="TGeant3") tpcClusterizer->SetMereChargeConversion(); tpcClusterizer->SetPersistence(persistence); fRun->AddTask(tpcClusterizer); TpcDriftTask* tpcDrifter = new TpcDriftTask(); tpcDrifter->SetPersistence(persistence); if (distfile!="") { std::cout<<"using distortion file: "<SetDistort(true); tpcDrifter->SetDeviationFile(distfile.Data()); } else tpcDrifter->SetDistort(false); fRun->AddTask(tpcDrifter); TpcGemTask* tpcGem = new TpcGemTask(); tpcGem->SetPersistence(persistence); fRun->AddTask(tpcGem); TpcPadResponseTask* tpcPadResponse = new TpcPadResponseTask(); tpcPadResponse->SetPersistence(persistence); tpcPadResponse->SetSimpleResponse(simpleResponse); fRun->AddTask(tpcPadResponse); Double_t cal=0;//2.125+0.05+0.05+0.05+0.05; TpcElectronicsTask* tpcElec = new TpcElectronicsTask(); tpcElec->SetPersistence(); //tpcElec->SetPSATimeCalib(cal); //tpcElec->SetZDepTimeCalib(-2.23815,-0.000917388,1.70957e-6); //for fit with time axis tpcElec->SetZDepTimeCalib(2.19894e+00,2.46638e-03,-1.86485e-05,7.80484e-08,-1.63758e-10,1.29551e-13); tpcElec->SetSamplePersistence(); tpcElec->SetShaper("T2K"); fRun->AddTask(tpcElec); /* TpcMcToDigiTask* tpcMcToDigiTask = new TpcMcToDigiTask(); tpcMcToDigiTask->setUseDriftedElectrons(); tpcMcToDigiTask->SetInputBranchName("TpcDriftedElectron"); tpcMcToDigiTask->SetPersistence(); //tpcMcToDigiTask->SetSamplePersistence(); fRun->AddTask(tpcMcToDigiTask); */ // ----- Intialise and run -------------------------------------------- fRun->Init(); fRun->Run(evStart,nEvents); rtdb->saveOutput(); rtdb->print(); // tpcDrifter->WriteHistograms(); // ------------------------------------------------------------------------ // ----- 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; // ------------------------------------------------------------------------ }