diff --git a/src/libraries/ANALYSIS/DEventWriterROOT.cc b/src/libraries/ANALYSIS/DEventWriterROOT.cc index c1118a06a..542e0edef 100644 --- a/src/libraries/ANALYSIS/DEventWriterROOT.cc +++ b/src/libraries/ANALYSIS/DEventWriterROOT.cc @@ -5,6 +5,7 @@ static bool BCAL_VERBOSE_OUTPUT = false; static bool FCAL_VERBOSE_OUTPUT = false; static bool CCAL_VERBOSE_OUTPUT = false; static bool DIRC_OUTPUT = true; +static bool FDC_VERBOSE_OUTPUT = true; static bool STORE_PULL_INFO = false; static bool STORE_ERROR_MATRIX_INFO = false; @@ -55,6 +56,14 @@ void DEventWriterROOT::Initialize(JEventLoop* locEventLoop) dTargetCenterZ = 65.0; locGeometry->GetTargetZ(dTargetCenterZ); + // Get upstream positions of each FDC package + vectorfdc_z_wires; + locGeometry->GetFDCZ(fdc_z_wires); + dFdcPackages[0]=fdc_z_wires[0]-1.; // just upstream + dFdcPackages[1]=fdc_z_wires[6]-1.; + dFdcPackages[2]=fdc_z_wires[12]-1.; + dFdcPackages[3]=fdc_z_wires[18]-1.; + //CREATE TTREES for(auto& locVertexInfo : locVertexInfos) { @@ -271,6 +280,8 @@ TMap* DEventWriterROOT::Create_UserInfoMaps(DTreeBranchRegister& locBranchRegist locMiscInfoMap->Add(new TObjString("REST:JANACALIBCONTEXT"), new TObjString(REST_JANA_CALIB_CONTEXT.c_str())); // Note: adding these parameters (e.g. in hd_root) will create warnings with "<-- NO DEFAULT! (TYPO?)". Safe to ignore these. + if(gPARMS->Exists("ANALYSIS:FDC_VERBOSE_ROOT_OUTPUT")) + {gPARMS->GetParameter("ANALYSIS:FDC_VERBOSE_ROOT_OUTPUT", FDC_VERBOSE_OUTPUT); cout << "ANALYSIS:FDC_VERBOSE_ROOT_OUTPUT set to " << FDC_VERBOSE_OUTPUT << ", IGNORE the \"<-- NO DEFAULT! (TYPO?)\" message " << endl;} if(gPARMS->Exists("ANALYSIS:BCAL_VERBOSE_ROOT_OUTPUT")) {gPARMS->GetParameter("ANALYSIS:BCAL_VERBOSE_ROOT_OUTPUT", BCAL_VERBOSE_OUTPUT); cout << "ANALYSIS:BCAL_VERBOSE_ROOT_OUTPUT set to " << BCAL_VERBOSE_OUTPUT << ", IGNORE the \"<-- NO DEFAULT! (TYPO?)\" message " << endl;} if(gPARMS->Exists("ANALYSIS:FCAL_VERBOSE_ROOT_OUTPUT")) @@ -697,6 +708,12 @@ void DEventWriterROOT::Create_Branches_ChargedHypotheses(DTreeBranchRegister& lo locBranchRegister.Register_FundamentalArray(Build_BranchName(locParticleBranchName, "dEdx_CDC"), locArraySizeString, dInitNumTrackArraySize); locBranchRegister.Register_FundamentalArray(Build_BranchName(locParticleBranchName, "dEdx_CDC_integral"), locArraySizeString, dInitNumTrackArraySize); locBranchRegister.Register_FundamentalArray(Build_BranchName(locParticleBranchName, "dEdx_FDC"), locArraySizeString, dInitNumTrackArraySize); + if (FDC_VERBOSE_OUTPUT){ + for (unsigned int j=0;j<4;j++){ + locBranchRegister.Register_FundamentalArray(Build_BranchName(locParticleBranchName, dFDCxLeaves[j].c_str()), locArraySizeString, dInitNumTrackArraySize); + locBranchRegister.Register_FundamentalArray(Build_BranchName(locParticleBranchName, dFDCyLeaves[j].c_str()), locArraySizeString, dInitNumTrackArraySize); + } + } //TIMING INFO locBranchRegister.Register_FundamentalArray(Build_BranchName(locParticleBranchName, "HitTime"), locArraySizeString, dInitNumTrackArraySize); @@ -1822,7 +1839,31 @@ void DEventWriterROOT::Fill_ChargedHypo(DTreeFillData* locTreeFillData, unsigned locTreeFillData->Fill_Array(Build_BranchName(locParticleBranchName, "dEdx_CDC"), locChargedTrackHypothesis->Get_dEdx_CDC_amp(), locArrayIndex); locTreeFillData->Fill_Array(Build_BranchName(locParticleBranchName, "dEdx_CDC_integral"), locChargedTrackHypothesis->Get_dEdx_CDC_int(), locArrayIndex); locTreeFillData->Fill_Array(Build_BranchName(locParticleBranchName, "dEdx_FDC"), locTrackTimeBased->ddEdx_FDC, locArrayIndex); - + + if (FDC_VERBOSE_OUTPUT){ + if (locTrackTimeBased->extrapolations.find(SYS_FDC) != locTrackTimeBased->extrapolations.end()) { + vectorlocExtraps=locTrackTimeBased->extrapolations.at(SYS_FDC); + int locPackageIndex=-1,locOldIndex=-1; + for (unsigned int j=0;jdFdcPackages[3]) locPackageIndex=3; + else if (locZ>dFdcPackages[2]) locPackageIndex=2; + else if (locZ>dFdcPackages[1]) locPackageIndex=1; + else locPackageIndex=0; + + if (locPackageIndex!=locOldIndex){ + locTreeFillData->Fill_Array(Build_BranchName(locParticleBranchName, dFDCxLeaves[locPackageIndex].c_str()), locPos.x(), locArrayIndex); + locTreeFillData->Fill_Array(Build_BranchName(locParticleBranchName, dFDCyLeaves[locPackageIndex].c_str()), locPos.y(), locArrayIndex); + } + + if (locPackageIndex==3) break; + locOldIndex=locPackageIndex; + } + } + } + //HIT ENERGY double locTOFdEdx = (locChargedTrackHypothesis->Get_TOFHitMatchParams() != NULL) ? locChargedTrackHypothesis->Get_TOFHitMatchParams()->dEdx : 0.0; locTreeFillData->Fill_Array(Build_BranchName(locParticleBranchName, "dEdx_TOF"), locTOFdEdx, locArrayIndex); diff --git a/src/libraries/ANALYSIS/DEventWriterROOT.h b/src/libraries/ANALYSIS/DEventWriterROOT.h index 154a619df..832589e04 100644 --- a/src/libraries/ANALYSIS/DEventWriterROOT.h +++ b/src/libraries/ANALYSIS/DEventWriterROOT.h @@ -90,6 +90,9 @@ class DEventWriterROOT : public JObject unsigned int dInitNumComboArraySize; double dTargetCenterZ; + double dFdcPackages[4]; + vectordFDCxLeaves={"FDC1_X","FDC2_X","FDC3_X","FDC4_X"}; + vectordFDCyLeaves={"FDC1_Y","FDC2_Y","FDC3_Y","FDC4_Y"}; //DEFAULT ACTIONS LISTED SEPARATELY FROM CUSTOM (in case in derived class user does something bizarre) map dCutActionMap_ThrownTopology; diff --git a/src/libraries/HDDM/DEventSourceREST.cc b/src/libraries/HDDM/DEventSourceREST.cc index ba04fd2a0..4cadb1241 100644 --- a/src/libraries/HDDM/DEventSourceREST.cc +++ b/src/libraries/HDDM/DEventSourceREST.cc @@ -1408,6 +1408,22 @@ jerror_t DEventSourceREST::Extract_DTrackTimeBased(hddm_r::HDDM *record, tra->setErrorMatrix(loc7x7ErrorMatrix); (*loc7x7ErrorMatrix)(6, 6) = fit.getT0err()*fit.getT0err(); + // Positions at each FDC package + const hddm_r::FdcTrackPosList locFdcTrackPosList = iter->getFdcTrackPoses(); + hddm_r::FdcTrackPosList::iterator locFdcTrackPosIterator = locFdcTrackPosList.begin(); + if (locFdcTrackPosIterator!=locFdcTrackPosList.end()){ + // Create the extrapolation vector + vectormyvector; + tra->extrapolations.emplace(SYS_FDC,myvector); + for(; locFdcTrackPosIterator != locFdcTrackPosList.end(); ++locFdcTrackPosIterator){ + DVector3 pos(locFdcTrackPosIterator->getX(), + locFdcTrackPosIterator->getY(), + locFdcTrackPosIterator->getZ()); + DVector3 mom; + tra->extrapolations[SYS_FDC].push_back(DTrackFitter::Extrapolation_t(pos,mom,0.,0.)); + } + } + // Track parameters at exit of tracking volume const hddm_r::ExitParamsList& locExitParamsList = iter->getExitParamses(); hddm_r::ExitParamsList::iterator locExitParamsIterator = locExitParamsList.begin(); diff --git a/src/libraries/HDDM/DEventWriterREST.cc b/src/libraries/HDDM/DEventWriterREST.cc index a92e80c67..67cf4333c 100644 --- a/src/libraries/HDDM/DEventWriterREST.cc +++ b/src/libraries/HDDM/DEventWriterREST.cc @@ -28,6 +28,9 @@ DEventWriterREST::DEventWriterREST(JEventLoop* locEventLoop, string locOutputFil } japp->Unlock("RESTWriter"); + REST_WRITE_FDC_TRACK_POS=true; + gPARMS->SetDefaultParameter("REST:WRITE_FDC_TRACK_POS", REST_WRITE_FDC_TRACK_POS,"Add track positions at each FDC package"); + REST_WRITE_TRACK_EXIT_PARAMS=true; gPARMS->SetDefaultParameter("REST:WRITE_TRACK_EXIT_PARAMS", REST_WRITE_TRACK_EXIT_PARAMS,"Add track parameters at exit to tracking volume"); @@ -549,6 +552,24 @@ bool DEventWriterREST::Write_RESTEvent(JEventLoop* locEventLoop, string locOutpu elo3().setDEdxAmp(tracks[i]->ddEdx_FDC_amp_trunc[it]); } } + if (REST_WRITE_FDC_TRACK_POS){ + if (tracks[i]->extrapolations.find(SYS_FDC) != tracks[i]->extrapolations.end()) { + vectorextraps=tracks[i]->extrapolations.at(SYS_FDC); + double oldz=0.; + for (unsigned int k=0;koldz+20.){ + hddm_r::FdcTrackPosList locFdcTrackPoses = tra().addFdcTrackPoses(1); + locFdcTrackPoses().setX(pos.x()); + locFdcTrackPoses().setY(pos.y()); + locFdcTrackPoses().setZ(pos.z()); + oldz=pos.z(); + } + } + } + } + if (REST_WRITE_TRACK_EXIT_PARAMS){ if (tracks[i]->extrapolations.find(SYS_NULL) != tracks[i]->extrapolations.end()) { vectorextraps=tracks[i]->extrapolations.at(SYS_NULL); diff --git a/src/libraries/HDDM/DEventWriterREST.h b/src/libraries/HDDM/DEventWriterREST.h index fa7e1bff5..7dc057749 100644 --- a/src/libraries/HDDM/DEventWriterREST.h +++ b/src/libraries/HDDM/DEventWriterREST.h @@ -62,6 +62,7 @@ class DEventWriterREST : public JObject bool REST_WRITE_FMWPC_HITS; bool REST_WRITE_CCAL_SHOWERS; bool REST_WRITE_TRACK_EXIT_PARAMS; + bool REST_WRITE_FDC_TRACK_POS; bool ADD_FCAL_DATA_FOR_CPP; bool REST_WRITE_FCAL_HITS; diff --git a/src/libraries/HDDM/rest.xml b/src/libraries/HDDM/rest.xml index 3b5809397..6ea368c70 100644 --- a/src/libraries/HDDM/rest.xml +++ b/src/libraries/HDDM/rest.xml @@ -82,6 +82,7 @@ +