void emc_mergepreclusters(const char* inFile, const char* digiFile, const char* simFile, const char* outFile, Int_t events=0, const char* parFile="simparams_hc7g5kG4_2.root", Bool_t useTimebasedSim = kTRUE) { // Loads files with hits and digitised hits and performs reconstruction for EMC // >>Set useTimebasedSim to kTRUE when using timebased sim, kFALSE for eventbased sim (DON'T FORGET TO SET THIS) // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug) Int_t iVerbose = 0; // Input file (MC events) // // Number of events to process Int_t nEvents=events; // if 0 all the events will be processed if (nEvents !=0) std::cout << "will process " << nEvents << " events" << std::endl; else std::cout << "all events will be processed" << std::endl; // Digitisation file (ascii) TString parFile_Ascii = "emc.par"; // Loading libraries // If the macro gives error messages in loading libraries, please check the path of the libs and put it by hands // gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C"); // gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C"); //rootlogon(); //basiclibs(); // ----- Reconstruction run ---------------------------- FairRunAna *fRun= new FairRunAna(); fRun->SetInputFile(inFile); fRun->AddFriend(digiFile); fRun->AddFriend(simFile); fRun->SetOutputFile(outFile); fRun->SetUseFairLinks(kTRUE); // ----- Parameter database ----------------------------- FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo(); parIo1->open(parFile_Ascii.Data(),"in"); rtdb->setFirstInput(parIo1); FairParRootFileIo* parInput1 = new FairParRootFileIo(); parInput1->open(parFile); rtdb->setSecondInput(parInput1); // --------------------------------------------------------- Bool_t storeclusters = kTRUE; if (useTimebasedSim) fRun->RunWithTimeStamps(); PndEmcMergePreclusters* clusterTask = new PndEmcMergePreclusters(iVerbose, storeclusters); clusterTask->SetPositionMethod(0); // Set cluster position method: // 0 = default method (logarithmic weighing), // 1 = simplified method (xpos=(xmax+xmin)/2, ypos=(ymax+ymin)/2) using the REAL x,y position, // 2 = simplified method (xpos=(xmax+xmin)/2, ypos=(ymax+ymin)/2) using the MAPPED XPad,YPad position, // 3 = simplified method using the REAL x,y position of the DIGI WITH HIGHEST ENERGY, // 4 = simplified method using the MAPPED XPad,YPad position of the DIGI WITH HIGHEST ENERGY. clusterTask->SetNeighbourMethod(0); // Set cluster neighbour method: // 0 = default method (for position, logarithmic weighing; for radius, distance of digi furthest from position) -> use this CIRCLE for neighbour relations), // 1 = simplified method (for position, xpos=(xmax-xmin)/2 ypos=(ymax-ymin)/2; for radius, r=max(ysize, xsize) -> use this CIRCLE for neighbour relations), // 2 = simplified method (for position, xpos=(xmax+xmin)/2 ypos=(ymax+ymin)/2; for radius, rx=(xmax-xmin)/2, ry=(ymax-ymin)/2 -> use this RECTANGULAR BOX for neighbour relations). // 3 = simplified method (for position, xpos=(xmax+xmin)/2 ypos=(ymax+ymin)/2; for radius, r=max(ysize, xsize) -> use this SQUARE BOX for neighbour relations). clusterTask->StoreClusterBaseDigis(kTRUE); // clusterTask->SetClusterActiveTime(20.); // manually change timebunch cutting time (minimal time between clusters). Default: read value used by emc_makepreclusters. //clusterTask->SetClusterMinimumEnergy(0.040); // change minimum cluster energy here (set to 0.03 GeV by default) //clusterTask->EnableRemovalOfLowEnergyClusters(kFALSE); // enable/disable removal of low energy (i.e. below the minimum energy) clusters (enabled by default). Slows down cluster finding task, but speeds up future processing, such as analysis. fRun->AddTask(clusterTask); //---- ----// if (useTimebasedSim) { // Sorting (only for timebased sim) PndEmcClusterSorterTask* sorterTask = new PndEmcClusterSorterTask(10000, 1, "EmcClusterTemp", "EmcClusterSorted", "Emc"); //sorterTask->SetVerbose(iVerbose); // ^ ^ sorterTask->SetClusterType(0); // set type 0: PndEmcCluster | | fRun->AddTask(sorterTask); // input branch output branch } // ----- Intialise and run ----------------------------- gRandom->SetSeed(); cout << "fRun->Init()" << endl; fRun->Init(); // ----- Timer ----------------------------------------- TStopwatch timer; timer.Start(); // --------------------------------------------------------- cout << "fRun->Run()" << endl; fRun->Run(0,nEvents); // --------------------------------------------------------- // ----- Finish ---------------------------------------- timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); cout << endl << endl; cout << "Macro finished successfully." << 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; // --------------------------------------------------------- exit(0); }