10#include "BmnDetectorList.h"
11#include "BmnFHCalGeo.h"
12#include "BmnFHCalPoint.h"
44 LOG(error) <<
"BmnFHCalReconstructor::Init(): branch with Digits not found! Task will be deactivated";
51 LOG(error) <<
"BmnFHCalReconstructor::Init(): branch with Digits not found! Task will be deactivated";
58 LOG(error) <<
"BmnFHCalReconstructor::Init(): branch with FHCalPoints not found! No MC match will be done";
69 LOG(debug) <<
"FHCal Reconstructor ready";
75 namespace po = boost::program_options;
77 TString dir = getenv(
"VMCWORKDIR");
78 TString path = dir +
"/parameters/fhcal/";
86 po::options_description desc(
"Options");
87 desc.add_options()(
"VERSION.id", po::value<float>(&version),
88 "version identificator")(
"COMMENT.str", po::value<std::string>(&comment),
"comment")(
89 "EXPERIMENT.cut", po::value<std::string>(&cutExp),
90 "cut for Experimental data")(
"SIMULATION.cut", po::value<std::string>(&cutSim),
"cut for Simulated data");
94 std::ifstream config_file((path +
fRecoCutsFile).Data(), std::ifstream::in);
95 if (!config_file.is_open()) {
96 LOG(error) <<
Form(
"BmnFHCalReconstructor: Loading Cuts from file: %s - file open error!",
100 LOG(debug) <<
Form(
"BmnFHCalReconstructor: Loading Cuts from file: %s",
fRecoCutsFile.Data());
101 po::store(po::parse_config_file(config_file, desc), vm);
116 LOG(error) <<
Form(
"BmnFHCalReconstructor::Check geometry file. Trying to set number of FHCal modules %d",
120 for (
auto it = positionMap.begin(); it != positionMap.end(); ++it) {
121 auto unique_address = it->first;
122 auto position = it->second.first;
127 this_mod->SetModuleId(mod_id);
128 this_mod->SetPosition(position);
130 this_mod->SetNsections(7);
132 this_mod->SetNsections(10);
134 auto err = it->second.second;
135 this_mod->SetDxyz(err.X(), err.Y(), err.Z() * this_mod->GetNsections());
150 for (
auto it : digiVector) {
154 if (mod_id <= 0 || (
int)mod_id >
fBmnFHCalEvent->GetTotalModules() || sec_id <= 0
155 || (
int)sec_id >
fBmnFHCalEvent->GetModule(mod_id)->GetNsections())
158 LOG(warning) <<
Form(
"FHCal digi ignored. Mod %d Sec %d", mod_id, sec_id);
174 TTree* temp_tree =
new TTree(
"temp_tree",
"temp_tree");
175 TString temp_br_name = (
fIsExp) ?
"FHCalDigi" :
"FHCalDigit";
195 if (!formula || formula->
GetNdim() == 0)
196 LOG(error) <<
Form(
"BmnFHCalReconstructor::GetSelectedDigiVector. Bad cuts. Check formula %s from file %s",
218 for (uint imod = 1; imod < (uint)
fBmnFHCalEvent->GetTotalModules(); ++imod) {
223 for (
int iPt = 0; iPt <
fArrayOfPoints->GetEntriesFast(); ++iPt) {
226 if (point->GetModuleId() != imod)
229 if (!point->GetPointerToLinks()) {
230 LOG(debug4) <<
"BmnFHCalReconstructor::MatchMCTracks. Link nullptr";
234 mod->AddLinks(*point->GetPointerToLinks());
235 LOG(debug4) <<
Form(
"BmnFHCalReconstructor::MatchMCTracks. Updated module with id "
236 "%d. Now it has %d links",
237 mod->GetModuleId(), mod->GetNLinks());
256 printf(
"Work time of BmnFHCalReconstructor: %4.2f sec.\n",
fworkTime);
char * Form(const char *fmt,...)
static uint32_t GetModuleId(uint32_t address)
Return Module id from address.
static uint32_t GetModuleType(uint32_t address)
Return Module id from address.
static uint32_t GetSectionId(uint32_t address)
Return Section id from address.
Data class for Bmn FHCal digital signal processing.
uint32_t GetSectionId() const
uint32_t GetModuleId() const
Class for Bmn FHCal data container in event.
int GetMaxModuleId() const
std::vector< TObject * > fSelectedDigiVector
TClonesArray * fArrayOfDigits
BmnFHCalEvent * fBmnFHCalEvent
FairRootManager * fpFairRootMgr
TClonesArray * fArrayOfPoints
virtual InitStatus Init()
virtual void Exec(Option_t *opt)
BmnFHCalReconstructor(bool isExp, bool isGlobalCoordinates)
std::vector< TObject * > GetSelectedDigiVector(TString formulaString)
void SetRecoCutsFile(TString reco_cuts_file)
virtual void OnlineWrite(const std::unique_ptr< TTree > &resultTree)
Write task resul to tree.
const auto & GetPositionMap() const
BmnStatus ReadGeometryFromGeoManager(bool getGlobalPosition=true)
virtual void Delete(Option_t *option="")
void Start(Bool_t reset=kTRUE)
const char * Data() const
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
void Delete(Option_t *option="") override
virtual Long64_t GetEntries() const
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)
virtual Int_t Branch(const char *folder, Int_t bufsize=32000, Int_t splitlevel=99)