From 227abe168d713e3d442be2e56dccccbe06752de3 Mon Sep 17 00:00:00 2001 From: Daniel Brandenburg Date: Fri, 22 Dec 2023 12:57:07 -0500 Subject: [PATCH 01/12] nill --- StRoot/StFwdTrackMaker/StFwdTrackMaker.cxx | 36 +++-- StRoot/StFwdTrackMaker/StFwdTrackMaker.h | 178 +++++++++++++++++++++ StRoot/StFwdTrackMaker/macro/build_geom.C | 2 +- 3 files changed, 198 insertions(+), 18 deletions(-) diff --git a/StRoot/StFwdTrackMaker/StFwdTrackMaker.cxx b/StRoot/StFwdTrackMaker/StFwdTrackMaker.cxx index 46d9313eb16..4fc5c9bd5e0 100644 --- a/StRoot/StFwdTrackMaker/StFwdTrackMaker.cxx +++ b/StRoot/StFwdTrackMaker/StFwdTrackMaker.cxx @@ -229,7 +229,7 @@ class ForwardTracker : public ForwardTrackMaker { //________________________________________________________________________ -StFwdTrackMaker::StFwdTrackMaker() : StMaker("fwdTrack"), mGenHistograms(false), mGenTree(false), mForwardTracker(nullptr), mForwardData(nullptr){ +StFwdTrackMaker::StFwdTrackMaker() : StMaker("fwdTrack"), mGenHistograms(false), mGenTree(false), mForwardTracker(nullptr), mForwardData(nullptr), mGeoCache(""){ SetAttr("useFtt",1); // Default Ftt on SetAttr("useFst",1); // Default Fst on SetAttr("useFcs",1); // Default Fcs on @@ -419,23 +419,21 @@ int StFwdTrackMaker::Init() { mTree->SetAutoFlush(0); } // gen tree + if ( mGeoCache == "" ){ + /// Instantiate and cache the geometry + GetDataBase("VmcGeometry"); - /// Instantiate and cache the geometry - GetDataBase("VmcGeometry"); + mGeoCache = GetChainOpt()->GetFileOut(); + if ( mGeoCache=="" ) + mGeoCache = GetChainOpt()->GetFileIn(); - - - TString geoCache = GetChainOpt()->GetFileOut(); - if ( geoCache=="" ) - geoCache = GetChainOpt()->GetFileIn(); - - // Strip out @ symbol - geoCache = geoCache.ReplaceAll("@",""); - // Strip off the last extention in the geoCache - geoCache = geoCache( 0, geoCache.Last('.') ); - // Append geom.root to the extentionless geoCache - geoCache+=".geom.root"; - + // Strip out @ symbol + mGeoCache = mGeoCache.ReplaceAll("@",""); + // Strip off the last extention in the mGeoCache + mGeoCache = mGeoCache( 0, mGeoCache.Last('.') ); + // Append geom.root to the extentionless mGeoCache + mGeoCache+=".geom.root"; + } // create an SiRasterizer in case we need it mSiRasterizer = std::shared_ptr( new SiRasterizer(mFwdConfig)); mForwardTracker = std::shared_ptr(new ForwardTracker( )); @@ -446,7 +444,7 @@ int StFwdTrackMaker::Init() { mForwardData = std::shared_ptr(new FwdDataSource()); mForwardTracker->setData(mForwardData); - mForwardTracker->initialize( geoCache, mGenHistograms ); + mForwardTracker->initialize( mGeoCache, mGenHistograms ); if ( mGenHistograms ){ mHistograms["fwdVertexZ"] = new TH1D("fwdVertexZ", "FWD Vertex (RAVE);z", 1000, -50, 50); @@ -732,6 +730,10 @@ void StFwdTrackMaker::loadFttHitsFromGEANT( FwdDataSource::McTrackMap_t &mcTrack void StFwdTrackMaker::loadFstHits( FwdDataSource::McTrackMap_t &mcTrackMap, FwdDataSource::HitMap_t &hitMap, int count ){ StEvent *event = (StEvent *)GetDataSet("StEvent"); + if (!event) { + LOG_ERROR << "No StEvent, cannot load FST hits" << endm; + return; + } StFstHitCollection *fstHitCollection = event->fstHitCollection(); if ( fstHitCollection ){ diff --git a/StRoot/StFwdTrackMaker/StFwdTrackMaker.h b/StRoot/StFwdTrackMaker/StFwdTrackMaker.h index 5be3f4f0f11..99f23859065 100644 --- a/StRoot/StFwdTrackMaker/StFwdTrackMaker.h +++ b/StRoot/StFwdTrackMaker/StFwdTrackMaker.h @@ -182,6 +182,184 @@ class StFwdTrackMaker : public StMaker { void FillTTree(); // if debugging ttree is turned on (mGenTree) void FitVertex(); +<<<<<<< Updated upstream +======= + static std::string defaultConfigIdealSim; + static std::string defaultConfigData; + std::string defaultConfig; + bool configLoaded = false; + TString mGeoCache; + + // Helper functions for modifying configuration + // NOTE: to override configuration, call individual functions after setConfigForXXX + public: + /**@brief Setup the StFwdTrackMaker for running on Data + * Load the default configuration for Data. + * Note: Apply any overrides after calling this + */ + void setConfigForData() { defaultConfig = defaultConfigData; LoadConfiguration(); } + /**@brief Setup the StFwdTrackMaker for running on Data + * Load the default configuration for IDEAL simulation. + * This runs with MC track finding and MC-seeded track fitting. + * - MC track finding uses the MCTrackId to collect stgc/fst hits into track seeds + * - MC-seeded track fitting uses the MC particle momentum to seed the track fit + * - Also uses the simulated MC primary vertex with smearing according to the simgaXY,Z + * Note: Apply any overrides after calling this + */ + void setConfigForIdealSim() { defaultConfig = defaultConfigIdealSim; LoadConfiguration(); } + + /**@brief Setup the StFwdTrackMaker for running on Data + * Load the default configuration for Realistic simulation. + * This runs tracking on simulation using the same parameters / approach as on data. + * Note: Apply any overrides after calling this + */ + void setConfigForRealisticSim() { + defaultConfig = defaultConfigData; + LoadConfiguration(); + // Note: Once the slow sims work this override will not be needed + // because the slow sims will put hits into StEvent just like (data) reco chain + setFttHitSource( "GEANT" ); + } + + + /**@brief Set the filename for output ROOT file + * @param fn : filename of output ROOT file + */ + void setOutputFilename( std::string fn ) { mFwdConfig.set( "Output:url", fn ); } + /**@brief Set the data source for FTT hits + * + * @param source : {DATA, GEANT}, DATA means read from StEvent, GEANT means read directly from the GEANT hits + */ + void setFttHitSource( std::string source ) { mFwdConfig.set( "Source:ftt", source ); } + + /**@brief Enable or disable the Fst Rasterizer + * @param use : if true, load FST hits from GEANT and raster them according to r, phi resolutions. + */ + void setUseFstRasteredGeantHits( bool use = true ){ mFwdConfig.set( "SiRasterizer:active", use ); } + /**@brief Set the resolution in R for rasterizing FST hits (from fast sim) + * Only used when the Rasterizer is enabled, which results from reading FST hits from GEANT + * @param r : resolution in r (cm) + */ + void setFstRasterR( double r = 3.0 /*cm*/ ){ mFwdConfig.set( "SiRasterizer:r", r ); } + /**@brief Set the resolution in phi for rasterizing FST hits (from fast sim) + * Only used when the Rasterizer is enabled, which results from reading FST hits from GEANT + * @param phi : resolution in phi (rad) + */ + void setFstRasterPhi( double phi = 0.00409 /*2*pi/(12*128)*/ ){ mFwdConfig.set( "SiRasterizer:phi", phi ); } + + //Track Finding + /**@brief Use Ftt hits in the Seed Finding + * + */ + void setSeedFindingWithFtt() { mFwdConfig.set( "TrackFinder:source", "ftt" ); } + /**@brief Use Fst hits in the Seed Finding + * + */ + void setSeedFindingWithFst() { mFwdConfig.set( "TrackFinder:source", "fst" ); } + /**@brief Set the number of track finding iterations + * @param n : number of iterations to run + */ + void setSeedFindingNumInterations( int n = 1 ) { mFwdConfig.set("TrackFinder:nIterations", n); } + /**@brief Set the number of phi slices to split the track iterations into + * @param n : number of slices of equal size (2pi)/n + */ + void setSeedFindingNumPhiSlices( int n = 8 ) { mFwdConfig.set("TrackFinder.Iteration:nPhiSlices", n); } + /**@brief Set the connector distance for track finding + * @param d : distance between planes (1 = adjacent) + */ + void setSeedFindingConnectorDistance( int d = 1 ) { mFwdConfig.set( "TrackFinder.Connector:distance", d ); } + /**@brief Enable or disable the SubsetNN + * @param use : if true, enables the subsetNN which find the most compatible set of tracks without shared hits + * if false, all tracks are reported regardless of shared hits + */ + void setSeedFindingUseSubsetNN( bool use = true ) { mFwdConfig.set( "TrackFinder.SubsetNN:active", use ); } + /**@brief Enable or disable the SubsetNN + * @param n : minimum number of hits on a track seed. Seeds with fewer hits are discarded + */ + void setSeedFindingMinHitsOnTrack( int n = 3 ) { mFwdConfig.set( "TrackFinder.SubsetNN:min-hits-on-track", n ); } + /**@brief Enable or disable the HitRemover + * @param use : if true, enables the hit remover which removes any hits from the hitmap that were used in a track + * if false, hits are not removed after each iteration + */ + void setSeedFindingUseHitRemover( bool use = true ) { mFwdConfig.set( "TrackFinder.HitRemover:active", use ); } + /**@brief Enable or disable the Truth Seed finding + * @param use : if true, use Mc info to group hits into track seeds + * if false, seed finding uses options as in the case for data + */ + void setUseTruthSeedFinding( bool use = true ) { mFwdConfig.set( "TrackFinder:active", !use ); } + + // Track Fitting + /**@brief Turn off track fitting + * Useful if you want to speed up the run but dont need fitting (testing seed finding) + */ + void setTrackFittingOff() { mFwdConfig.set( "TrackFitter:active", "false" ); } + /**@brief Enable / disable material effects + * Material effects in kalman filter + */ + void setFittingMaterialEffects( bool mat = true) { mFwdConfig.set( "TrackFitter:materialEffects", mat ); } + /**@brief Set the resolution for the Primary Vertex in XY + * @params sXY : sigma in XY (cm) + */ + void setPrimaryVertexSigmaXY( double sXY ) { mFwdConfig.set( "TrackFitter.Vertex:sigmaXY", sXY ); } + /**@brief Set the resolution for the Primary Vertex in Z + * @params sZ : sigma in Z (cm) + */ + void setPrimaryVertexSigmaZ( double sZ ) { mFwdConfig.set( "TrackFitter.Vertex:sigmaZ", sZ ); } + // TODO: add options for beamline constraint + + /**@brief Include or exclude the Primary Vertex in fit + * @param pvf : if true, use PRimary Vertex in fit + */ + void setIncludePrimaryVertexInFit( bool pvf = true ) { mFwdConfig.set( "TrackFitter.Vertex:includeInFit", pvf ); } + /**@brief Set B-field to zero (for zero field running) + * @param zeroB : if true, use Zero B field + */ + void setZeroB( bool zeroB = true ) { mFwdConfig.set( "TrackFitter:zeroB", zeroB ); } + /**@brief Set B-field to constant (even outside of TPC) + * @param constB : if true, use const 0.5T B field + */ + void setConstB( bool constB = true ) { mFwdConfig.set( "TrackFitter:constB", constB ); } + /**@brief Force the use of McSeed for fit + * @param mcSeed : if true, use mc momentum as the seed for the track fitter + */ + void setUseMcSeedForFit( bool mcSeed = true ) { mFwdConfig.set( "TrackFitter:mcSeed", mcSeed ); } + + /**@brief Sets the tracking to refit + * This adds compatible hits from whichever detector was NOT used in seed finding + * if FTT seeding -> project to and add FST hits + * if FST seeding -> project to and add FTT hits + * @param refit : true, perform refit, false do not + */ + void setTrackRefit( bool refit = true) { mFwdConfig.set( "TrackFitter:refit", refit ); } + + /**@brief Sets the maximum number of hits that can be considered failed before the entire track fit fails + * @param n : number of failed hits allowed, -1 = no limit + */ + void setMaxFailedHitsInFit( int n = -1 /*no lim*/ ) {mFwdConfig.set("TrackFitter.KalmanFitterRefTrack:MaxFailedHits", n);} + /**@brief Sets Fitter debug level + * @param level : 0 = no output, higher numbers are more verbose + */ + void setFitDebugLvl( int level = 0 /*0=no output*/ ) {mFwdConfig.set("TrackFitter.KalmanFitterRefTrack:DebugLvl", level); } + /**@brief Sets Max fit iterations before failing + * @param n : num iterations + */ + void setFitMaxIterations( int n=4 ) {mFwdConfig.set("TrackFitter.KalmanFitterRefTrack:MaxIterations", n); } + /**@brief Sets Min fit iterations before converging + * @param n : num iterations + */ + void setFitMinIterations( int n = 1) {mFwdConfig.set("TrackFitter.KalmanFitterRefTrack:MinIterations", n); } + + /**@brief Enables smearing of the MC Primary Vertex according to sigmaXY,Z + * @param pvs : if true, smear vertex + */ + void setSmearMcPrimaryVertex( bool pvs = true ) { mFwdConfig.set( "TrackFitter.Vertex:smearMcVertex", pvs ); } + + /** + * @brief Sets geometry cache filename + * + */ + void setGeoCache( TString gc ) { mGeoCache = gc; } +>>>>>>> Stashed changes }; #endif diff --git a/StRoot/StFwdTrackMaker/macro/build_geom.C b/StRoot/StFwdTrackMaker/macro/build_geom.C index f0fd5663882..8d33c71fabf 100755 --- a/StRoot/StFwdTrackMaker/macro/build_geom.C +++ b/StRoot/StFwdTrackMaker/macro/build_geom.C @@ -2,7 +2,7 @@ // that is a valid shebang to run script as executable -void build_geom( TString geomtag = "dev2022", TString output="fGeom.root" ) { +void build_geom( TString geomtag = "y2023", TString output="fGeom.root" ) { gSystem->Load( "libStarRoot.so" ); From 3da2dba58ce752e091542838fca8decdf07d929a Mon Sep 17 00:00:00 2001 From: Daniel Brandenburg Date: Sat, 23 Dec 2023 12:29:04 -0500 Subject: [PATCH 02/12] Add StPicoFwdTrack --- StRoot/StPicoDstMaker/StPicoDstMaker.cxx | 31 ++++++++ StRoot/StPicoDstMaker/StPicoDstMaker.h | 2 + StRoot/StPicoEvent/StPicoArrays.cxx | 3 + StRoot/StPicoEvent/StPicoArrays.h | 5 +- StRoot/StPicoEvent/StPicoDst.cxx | 17 +++++ StRoot/StPicoEvent/StPicoDst.h | 7 ++ StRoot/StPicoEvent/StPicoDstLinkDef.h | 1 + StRoot/StPicoEvent/StPicoDstReader.cxx | 2 + StRoot/StPicoEvent/StPicoFwdTrack.cxx | 48 ++++++++++++ StRoot/StPicoEvent/StPicoFwdTrack.h | 94 ++++++++++++++++++++++++ 10 files changed, 208 insertions(+), 2 deletions(-) create mode 100644 StRoot/StPicoEvent/StPicoFwdTrack.cxx create mode 100644 StRoot/StPicoEvent/StPicoFwdTrack.h diff --git a/StRoot/StPicoDstMaker/StPicoDstMaker.cxx b/StRoot/StPicoDstMaker/StPicoDstMaker.cxx index 4e114feba2a..5d513d976ba 100644 --- a/StRoot/StPicoDstMaker/StPicoDstMaker.cxx +++ b/StRoot/StPicoDstMaker/StPicoDstMaker.cxx @@ -40,6 +40,8 @@ #include "StEvent/StTriggerData.h" #include "StEvent/StEnumerations.h" #include "StEvent/StL0Trigger.h" +#include "StEvent/StFwdTrackCollection.h" +#include "StEvent/StFwdTrack.h" #include "StMuDSTMaker/COMMON/StMuDst.h" #include "StMuDSTMaker/COMMON/StMuEvent.h" @@ -94,6 +96,7 @@ #include "StPicoEvent/StPicoBEmcSmdPHit.h" #include "StPicoEvent/StPicoETofHit.h" #include "StPicoEvent/StPicoETofPidTraits.h" +#include "StPicoEvent/StPicoFwdTrack.h" #include "StPicoEvent/StPicoMcVertex.h" #include "StPicoEvent/StPicoMcTrack.h" #include "StPicoEvent/StPicoArrays.h" @@ -245,6 +248,7 @@ void StPicoDstMaker::streamerOff() { StPicoTrackCovMatrix::Class()->IgnoreTObjectStreamer(); StPicoETofHit::Class()->IgnoreTObjectStreamer(); StPicoETofPidTraits::Class()->IgnoreTObjectStreamer(); + StPicoFwdTrack::Class()->IgnoreTObjectStreamer(); StPicoMcVertex::Class()->IgnoreTObjectStreamer(); StPicoMcTrack::Class()->IgnoreTObjectStreamer(); } @@ -893,6 +897,7 @@ Int_t StPicoDstMaker::MakeWrite() { fillEpdHits(); fillBbcHits(); fillETofHits(); + fillFwdTracks(); // Could be a good idea to move this call to Init() or InitRun() StFmsDbMaker* fmsDbMaker = static_cast(GetMaker("fmsDb")); @@ -2502,6 +2507,32 @@ void StPicoDstMaker::fillMtdHits() { } //while (triggerPos.size() > 0) } +//_________________ +void StPicoDstMaker::fillFwdTracks() { + + StEvent *evt = (StEvent *)GetDataSet("StEvent"); + if ( evt ){ + StFwdTrackCollection * evc = evt->fwdTrackCollection(); + if ( !evc ){ + LOG_ERROR << "null FwdTrackCollection" << endm; + return; + } + const StSPtrVecFwdTrack& evTracks = evc->tracks(); + LOG_INFO << "Adding " << evc->numberOfTracks() << " StMuFwdTracks to MuDSt" << endm; + for ( size_t i = 0; i < evc->numberOfTracks(); i++ ){ + StFwdTrack * evTrack = evTracks[i]; + StPicoFwdTrack picoFwdTrack; + picoFwdTrack.setMomentum( evTrack->momentum().x(), evTrack->momentum().y(), evTrack->momentum().z() ); + picoFwdTrack.setNumberOfFitPoints( evTrack->numberOfFitPoints() * evTrack->charge() ); + int counter = mPicoArrays[StPicoArrays::FwdTrack]->GetEntries(); + picoFwdTrack.setId( counter ); + new((*(mPicoArrays[StPicoArrays::FwdTrack]))[counter]) StPicoFwdTrack(picoFwdTrack); + } + } else { + LOG_WARN << "Cannot get Fwd Tracks from StEvent" << endm; + } +} + #if !defined (__TFG__VERSION__) /** diff --git a/StRoot/StPicoDstMaker/StPicoDstMaker.h b/StRoot/StPicoDstMaker/StPicoDstMaker.h index e5f91085fb2..64028677995 100644 --- a/StRoot/StPicoDstMaker/StPicoDstMaker.h +++ b/StRoot/StPicoDstMaker/StPicoDstMaker.h @@ -226,6 +226,8 @@ class StPicoDstMaker : public StMaker { /// Fill ETOF information void fillETofHits(); /// Fill MC vertex information + void fillFwdTracks(); + /// Fill MC vertex information void fillMcVertices(); /// Fill MC track information void fillMcTracks(); diff --git a/StRoot/StPicoEvent/StPicoArrays.cxx b/StRoot/StPicoEvent/StPicoArrays.cxx index 2038c048778..1ad46d9f57a 100644 --- a/StRoot/StPicoEvent/StPicoArrays.cxx +++ b/StRoot/StPicoEvent/StPicoArrays.cxx @@ -25,6 +25,7 @@ const char* StPicoArrays::picoArrayNames [NAllPicoArrays] = { "Event", "BEmcSmdPHit", "ETofHit", "ETofPidTraits", + "FwdTracks", "McVertex", "McTrack" }; @@ -49,6 +50,7 @@ const char* StPicoArrays::picoArrayTypes [NAllPicoArrays] = { "StPicoEvent", "StPicoBEmcSmdPHit", "StPicoETofHit", "StPicoETofPidTraits", + "StPicoFwdTrack", "StPicoMcVertex", "StPicoMcTrack" }; @@ -76,6 +78,7 @@ int StPicoArrays::picoArraySizes [NAllPicoArrays] = { 1, // StPicoEvent 100, // StPicoBEmcSmdPHit 100, // StPicoETofHit 100, // StPicoETofPidTraits + 10, // StPicoFwdTracks 10, // StPicoMcVertex 1000 // StPicoMcTrack }; diff --git a/StRoot/StPicoEvent/StPicoArrays.h b/StRoot/StPicoEvent/StPicoArrays.h index aad476f02d0..b3ebff3b2cb 100644 --- a/StRoot/StPicoEvent/StPicoArrays.h +++ b/StRoot/StPicoEvent/StPicoArrays.h @@ -17,7 +17,7 @@ class StPicoArrays { StPicoArrays(); /// Should be changed to constexpr once ROOT 6 is available at STAR - enum { NAllPicoArrays = 20}; + enum { NAllPicoArrays = 21}; /// Names of the TBranches in the TTree/File static const char* picoArrayNames[NAllPicoArrays]; @@ -32,7 +32,8 @@ class StPicoArrays { enum TypeIndex { Event=0, Track, EmcTrigger, MtdTrigger, BTowHit, BTofHit, MtdHit, BbcHit, EpdHit, FmsHit, BEmcPidTraits, BTofPidTraits, MtdPidTraits, TrackCovMatrix, - BEmcSmdEHit, BEmcSmdPHit, ETofHit, ETofPidTraits, + BEmcSmdEHit, BEmcSmdPHit, ETofHit, ETofPidTraits, + FwdTrack, McVertex, McTrack }; }; diff --git a/StRoot/StPicoEvent/StPicoDst.cxx b/StRoot/StPicoEvent/StPicoDst.cxx index 7c243deed22..920e1e781ca 100644 --- a/StRoot/StPicoEvent/StPicoDst.cxx +++ b/StRoot/StPicoEvent/StPicoDst.cxx @@ -19,6 +19,7 @@ #include "StPicoBEmcSmdPHit.h" #include "StPicoETofHit.h" #include "StPicoETofPidTraits.h" +#include "StPicoFwdTrack.h" #include "StPicoMcVertex.h" #include "StPicoMcTrack.h" #include "StPicoDst.h" //MUST be the last one @@ -328,3 +329,19 @@ void StPicoDst::printETofPidTraits() { LOG_INFO << endm; } +//_________________ +void StPicoDst::printFwdTracks() { + if(numberOfFwdTracks() == 0) { + LOG_INFO << "No Fwd tracks found!" << endm; + return; + } + + LOG_INFO << "\n+++++++++ fwd track list ( " << numberOfFwdTracks() << " entries )\n\n"; + for(UInt_t iTrk=0; iTrkPrint(); + LOG_INFO << "\n"; + } + + LOG_INFO << endm; +} diff --git a/StRoot/StPicoEvent/StPicoDst.h b/StRoot/StPicoEvent/StPicoDst.h index 7448d35b7ec..e8b3b862879 100644 --- a/StRoot/StPicoEvent/StPicoDst.h +++ b/StRoot/StPicoEvent/StPicoDst.h @@ -33,6 +33,7 @@ class StPicoBEmcSmdEHit; class StPicoBEmcSmdPHit; class StPicoETofHit; class StPicoETofPidTraits; +class StPicoFwdTrack; class StPicoMcVertex; class StPicoMcTrack; @@ -93,6 +94,8 @@ class StPicoDst { static StPicoBEmcSmdPHit* bemcSmdPHit(Int_t i) { return (StPicoBEmcSmdPHit*)picoArrays[StPicoArrays::BEmcSmdPHit]->UncheckedAt(i); } /// Return pointer to i-th etof hit static StPicoETofHit* etofHit(Int_t i) { return (StPicoETofHit*)picoArrays[StPicoArrays::ETofHit]->UncheckedAt(i); } + /// Return pointer to i-th etof hit + static StPicoFwdTrack* fwdTrack(Int_t i) { return (StPicoFwdTrack*)picoArrays[StPicoArrays::FwdTrack]->UncheckedAt(i); } /// Return pointer to i-th etof pidTraits static StPicoETofPidTraits* etofPidTraits(Int_t i) { return (StPicoETofPidTraits*)picoArrays[StPicoArrays::ETofPidTraits]->UncheckedAt(i); } /// Return pointer to i-th MC vertex @@ -134,6 +137,8 @@ class StPicoDst { static UInt_t numberOfETofHits() { return picoArrays[StPicoArrays::ETofHit]->GetEntriesFast(); } /// Return number of ETOF PID traits static UInt_t numberOfETofPidTraits() { return picoArrays[StPicoArrays::ETofPidTraits]->GetEntriesFast(); } + /// Return number of Fwd Tracks + static UInt_t numberOfFwdTracks() { return picoArrays[StPicoArrays::FwdTrack]->GetEntriesFast(); } /// Return number of MC vertices static UInt_t numberOfMcVertices() { return picoArrays[StPicoArrays::McVertex]->GetEntriesFast(); } /// Return number of MC tracks @@ -169,6 +174,8 @@ class StPicoDst { static void printETofHits(); /// Print ETOF PID trait info static void printETofPidTraits(); + /// Print Fwd track info + static void printFwdTracks(); /// Print MC vertex info static void printMcVertices(); /// Print MC track info diff --git a/StRoot/StPicoEvent/StPicoDstLinkDef.h b/StRoot/StPicoEvent/StPicoDstLinkDef.h index c81c8b95ef2..8641aef7a01 100644 --- a/StRoot/StPicoEvent/StPicoDstLinkDef.h +++ b/StRoot/StPicoEvent/StPicoDstLinkDef.h @@ -26,6 +26,7 @@ #pragma link C++ class StPicoDstReader+; #pragma link C++ class StPicoETofHit+; #pragma link C++ class StPicoETofPidTraits+; +#pragma link C++ class StPicoFwdTrack+; #pragma link C++ class StPicoDst+; // StarClassLibrary adopted classes diff --git a/StRoot/StPicoEvent/StPicoDstReader.cxx b/StRoot/StPicoEvent/StPicoDstReader.cxx index 8a388e9f5ee..aa3521b4fa0 100644 --- a/StRoot/StPicoEvent/StPicoDstReader.cxx +++ b/StRoot/StPicoEvent/StPicoDstReader.cxx @@ -30,6 +30,7 @@ #include "StPicoBEmcSmdPHit.h" #include "StPicoETofHit.h" #include "StPicoETofPidTraits.h" +#include "StPicoFwdTrack.h" #include "StPicoMcVertex.h" #include "StPicoMcTrack.h" #include "StPicoArrays.h" @@ -131,6 +132,7 @@ void StPicoDstReader::streamerOff() { StPicoBEmcSmdPHit::Class()->IgnoreTObjectStreamer(); StPicoETofHit::Class()->IgnoreTObjectStreamer(); StPicoETofPidTraits::Class()->IgnoreTObjectStreamer(); + StPicoFwdTrack::Class()->IgnoreTObjectStreamer(); StPicoMcVertex::Class()->IgnoreTObjectStreamer(); StPicoMcTrack::Class()->IgnoreTObjectStreamer(); } diff --git a/StRoot/StPicoEvent/StPicoFwdTrack.cxx b/StRoot/StPicoEvent/StPicoFwdTrack.cxx new file mode 100644 index 00000000000..371eda11f35 --- /dev/null +++ b/StRoot/StPicoEvent/StPicoFwdTrack.cxx @@ -0,0 +1,48 @@ +#include "StPicoFwdTrack.h" +#include +#include "StPicoMessMgr.h" + +// ROOT headers +#include "TMath.h" + +ClassImp(StPicoFwdTrack) + +StPicoFwdTrack::StPicoFwdTrack() : TObject() { + /* No Op*/ +} + +StPicoFwdTrack::StPicoFwdTrack(const StPicoFwdTrack &fwdTrack){ + mId = fwdTrack.mId; + mNumberOfSeedPoints = fwdTrack.mNumberOfSeedPoints; + mNumberOfFitPoints = fwdTrack.mNumberOfFitPoints; + mChi2 = fwdTrack.mChi2; + + mMomentumX = fwdTrack.mMomentumX; + mMomentumY = fwdTrack.mMomentumY; + mMomentumZ = fwdTrack.mMomentumZ; + mStatus = fwdTrack.mStatus; + + mIdTruth = fwdTrack.mIdTruth; + mQATruth = fwdTrack.mQATruth;mId; +} + +StPicoFwdTrack::~StPicoFwdTrack(){ + +} + +//_________________ +void StPicoFwdTrack::Print(const Char_t* option __attribute__((unused))) const { + LOG_INFO << " chi2: " << chi2() << "\n" + << "pMom: " << momentum().X() << " " << momentum().Y() << " " << momentum().Z() << "\n" + << "nHitsFit: " << numberOfFitPoints() + << " numberOfSeedPoints: " << numberOfSeedPoints() << "\n" + // << "idTruth: " << idTruth() << " qaTruth: " << qaTruth() << "\n" + << endm; +} + +//_________________ +void StPicoFwdTrack::setChi2(Float_t chi2) { + mChi2 = ( (chi2 * 1000.) > std::numeric_limits::max() ? + std::numeric_limits::max() : + (UShort_t)( TMath::Nint( chi2 * 1000. ) ) ); +} \ No newline at end of file diff --git a/StRoot/StPicoEvent/StPicoFwdTrack.h b/StRoot/StPicoEvent/StPicoFwdTrack.h new file mode 100644 index 00000000000..37b1d112eae --- /dev/null +++ b/StRoot/StPicoEvent/StPicoFwdTrack.h @@ -0,0 +1,94 @@ +/*************************************************************************** + * + * Author: jdb, Feb 2022 + *************************************************************************** + * + * Description: StPicoFwdTrack stores the Forward tracks built from Fst and Ftt + * + **************************************************************************/ +#ifndef StPicoFwdTrack_hh +#define StPicoFwdTrack_hh + +#include +#include +#include "TVector3.h" +#include "TRefArray.h" + + +class StPicoFwdTrack : public TObject { + +public: + /// Constructor + StPicoFwdTrack( ); + /// Copy constructor + StPicoFwdTrack(const StPicoFwdTrack &fwdTrack); + /// Destructor + virtual ~StPicoFwdTrack(); + + virtual void Print(const Char_t *option = "") const; + /// Return unique Id of the track + Int_t id() const { return mId; } + /// Return chi2 of the track + Float_t chi2() const { return mChi2 / 1000.f; } + /// Return momentum (GeV/c) + TVector3 momentum() const { return TVector3( mMomentumX, mMomentumY, mMomentumZ ); } + /// Return charge of the track (encoded in nHitsFit as: nHitsFit * charge) + Short_t charge() const { return (mNumberOfFitPoints > 0) ? 1 : -1; } + /// Quality of the fit (from status) + bool didFitConverge() const { return (mStatus >= 1); } + bool didFitConvergeFully() const { return (mStatus >= 2); } + /// Return if the track fit converged + Char_t status() const { return mStatus; } + /// Index of the corresponding MC track + Int_t idTruth() const { return mIdTruth; } + /// Qualtiy of the MC track + Int_t qaTruth() const { return mQATruth; } + + // Number of fit points used by GenFit + Int_t numberOfFitPoints() const { return mNumberOfFitPoints; } + // unsigned int numberOfPossibleFitPoints() const; + + // Number of points used in the track seed step + Int_t numberOfSeedPoints() const { return mNumberOfSeedPoints; } + + void setId( Int_t id) { mId = (UShort_t)id; } + void setMomentum( TVector3 mom ) { mMomentumX = mom.X(); mMomentumY = mom.Y(); mMomentumZ = mom.Z(); } + void setMomentum( double px, double py, double pz ) { mMomentumX = (Float_t)px; mMomentumY = (Float_t)py; mMomentumZ = (Float_t)pz; } + void setStatus( UChar_t status ) { mStatus = status;} + void setNumberOfSeedPoints( Int_t lNumberOfSeedPoints ) { mNumberOfSeedPoints = (UChar_t)lNumberOfSeedPoints;} + void setNumberOfFitPoints( Int_t lNumberOfFitPoints ) { mNumberOfFitPoints = (Char_t)lNumberOfFitPoints;} + void setChi2(Float_t chi2); + /// Set index of the corresonding MC track + void setMcTruth(Int_t index, Int_t qa) { mIdTruth = (UShort_t)index; mQATruth = (UShort_t)qa; } + +protected: + + // Track quality and convergence + /// Unique track ID + UShort_t mId; + UChar_t mNumberOfSeedPoints; + /// Charge * nHitsFit + Char_t mNumberOfFitPoints; + /// Chi2 of the track (encoding = chi2*1000) + UShort_t mChi2; + + /// Px momentum (GeV/c) + Float_t mMomentumX; + /// Py momentum (GeV/c) + Float_t mMomentumY; + /// Pz momentum (GeV/c) + Float_t mMomentumZ; + /// convergence (0=no, 1=converge, 2=converge fully) + UChar_t mStatus; + + /// MC track id + UShort_t mIdTruth; + /// MC track quality (percentage of hits coming from corresponding MC track) + UShort_t mQATruth; + + ClassDef(StPicoFwdTrack,2) + +}; + +#endif + From 3f1349079e52eb8fe485b0b4a5e0113801afdd12 Mon Sep 17 00:00:00 2001 From: Daniel Brandenburg Date: Sat, 23 Dec 2023 21:32:58 -0500 Subject: [PATCH 03/12] Add initial StPicoFcsCluster implementation --- StRoot/StPicoDstMaker/StPicoDstMaker.cxx | 88 ++++++++++++++++++++++++ StRoot/StPicoDstMaker/StPicoDstMaker.h | 7 ++ StRoot/StPicoEvent/StPicoArrays.cxx | 5 +- StRoot/StPicoEvent/StPicoArrays.h | 4 +- StRoot/StPicoEvent/StPicoDst.h | 7 +- StRoot/StPicoEvent/StPicoDstLinkDef.h | 1 + StRoot/StPicoEvent/StPicoDstReader.cxx | 2 + StRoot/StPicoEvent/StPicoFcsCluster.cxx | 40 +++++++++++ StRoot/StPicoEvent/StPicoFcsCluster.h | 84 ++++++++++++++++++++++ 9 files changed, 234 insertions(+), 4 deletions(-) create mode 100644 StRoot/StPicoEvent/StPicoFcsCluster.cxx create mode 100644 StRoot/StPicoEvent/StPicoFcsCluster.h diff --git a/StRoot/StPicoDstMaker/StPicoDstMaker.cxx b/StRoot/StPicoDstMaker/StPicoDstMaker.cxx index 5d513d976ba..bb021d50d53 100644 --- a/StRoot/StPicoDstMaker/StPicoDstMaker.cxx +++ b/StRoot/StPicoDstMaker/StPicoDstMaker.cxx @@ -61,6 +61,8 @@ #include "StMuDSTMaker/COMMON/StMuETofHeader.h" #include "StMuDSTMaker/COMMON/StMuMcTrack.h" #include "StMuDSTMaker/COMMON/StMuMcVertex.h" +#include "StMuDSTMaker/COMMON/StMuFcsCollection.h" +#include "StMuDSTMaker/COMMON/StMuFcsCluster.h" #include "StTriggerUtilities/StTriggerSimuMaker.h" #include "StTriggerUtilities/Bemc/StBemcTriggerSimu.h" @@ -97,6 +99,7 @@ #include "StPicoEvent/StPicoETofHit.h" #include "StPicoEvent/StPicoETofPidTraits.h" #include "StPicoEvent/StPicoFwdTrack.h" +#include "StPicoEvent/StPicoFcsCluster.h" #include "StPicoEvent/StPicoMcVertex.h" #include "StPicoEvent/StPicoMcTrack.h" #include "StPicoEvent/StPicoArrays.h" @@ -249,6 +252,7 @@ void StPicoDstMaker::streamerOff() { StPicoETofHit::Class()->IgnoreTObjectStreamer(); StPicoETofPidTraits::Class()->IgnoreTObjectStreamer(); StPicoFwdTrack::Class()->IgnoreTObjectStreamer(); + StPicoFcsCluster::Class()->IgnoreTObjectStreamer(); StPicoMcVertex::Class()->IgnoreTObjectStreamer(); StPicoMcTrack::Class()->IgnoreTObjectStreamer(); } @@ -898,6 +902,7 @@ Int_t StPicoDstMaker::MakeWrite() { fillBbcHits(); fillETofHits(); fillFwdTracks(); + fillFcsClusters(); // Could be a good idea to move this call to Init() or InitRun() StFmsDbMaker* fmsDbMaker = static_cast(GetMaker("fmsDb")); @@ -2533,6 +2538,89 @@ void StPicoDstMaker::fillFwdTracks() { } } +//_________________ +void StPicoDstMaker::fillFwdTracks() { + + StEvent *evt = (StEvent *)GetDataSet("StEvent"); + if ( evt ){ + StFwdTrackCollection * evc = evt->fwdTrackCollection(); + if ( !evc ){ + LOG_ERROR << "null FwdTrackCollection" << endm; + return; + } + const StSPtrVecFwdTrack& evTracks = evc->tracks(); + LOG_INFO << "Adding " << evc->numberOfTracks() << " StMuFwdTracks to MuDSt" << endm; + for ( size_t i = 0; i < evc->numberOfTracks(); i++ ){ + StFwdTrack * evTrack = evTracks[i]; + StPicoFwdTrack picoFwdTrack; + picoFwdTrack.setMomentum( evTrack->momentum().x(), evTrack->momentum().y(), evTrack->momentum().z() ); + picoFwdTrack.setNumberOfFitPoints( evTrack->numberOfFitPoints() * evTrack->charge() ); + int counter = mPicoArrays[StPicoArrays::FwdTrack]->GetEntries(); + picoFwdTrack.setId( counter ); + new((*(mPicoArrays[StPicoArrays::FwdTrack]))[counter]) StPicoFwdTrack(picoFwdTrack); + } + } else { + LOG_WARN << "Cannot get Fwd Tracks from StEvent" << endm; + } +} + +//_________________ +void StPicoDstMaker::fillFwdTracks() { + + StEvent *evt = (StEvent *)GetDataSet("StEvent"); + if ( evt ){ + StFwdTrackCollection * evc = evt->fwdTrackCollection(); + if ( !evc ){ + LOG_ERROR << "null FwdTrackCollection" << endm; + return; + } + const StSPtrVecFwdTrack& evTracks = evc->tracks(); + LOG_INFO << "Adding " << evc->numberOfTracks() << " StMuFwdTracks to MuDSt" << endm; + for ( size_t i = 0; i < evc->numberOfTracks(); i++ ){ + StFwdTrack * evTrack = evTracks[i]; + StPicoFwdTrack picoFwdTrack; + picoFwdTrack.setMomentum( evTrack->momentum().x(), evTrack->momentum().y(), evTrack->momentum().z() ); + picoFwdTrack.setNumberOfFitPoints( evTrack->numberOfFitPoints() * evTrack->charge() ); + picoFwdTrack.setNumberOfSeedPoints( evTrack->numberOfSeedPoints() ); + picoFwdTrack.setChi2( evTrack->chi2() ); + int counter = mPicoArrays[StPicoArrays::FwdTrack]->GetEntries(); + picoFwdTrack.setId( counter ); + new((*(mPicoArrays[StPicoArrays::FwdTrack]))[counter]) StPicoFwdTrack(picoFwdTrack); + } + } else { + LOG_WARN << "Cannot get Fwd Tracks from StEvent" << endm; + } +} //fillFwdTracks + +//_________________ +void StPicoDstMaker::fillFcsClusters() { + StMuFcsCollection * muFcs = mMuDst->muFcsCollection(); + if ( !muFcs ) { + LOG_ERROR << "Cannot get Fcs Collection from MuDst" << endm; + return; + } + TIter next(muFcs->getClusterArray()); + StMuFcsCluster* muCluster(NULL); + while ((muCluster = static_cast(next()))) { + int counter = mPicoArrays[StPicoArrays::FcsCluster]->GetEntries(); + StPicoFcsCluster picoFcsCluster; + picoFcsCluster.setId(counter); + picoFcsCluster.setDetectorId(muCluster->detectorId()); + picoFcsCluster.setCategory(muCluster->category()); + picoFcsCluster.setNTowers(muCluster->nTowers()); + picoFcsCluster.setEnergy(muCluster->energy()); + picoFcsCluster.setX(muCluster->x()); + picoFcsCluster.setY(muCluster->y()); + picoFcsCluster.setSigmaMin(muCluster->sigmaMin()); + picoFcsCluster.setSigmaMax(muCluster->sigmaMax()); + picoFcsCluster.setTheta(muCluster->theta()); + picoFcsCluster.setChi2Ndf1Photon(muCluster->chi2Ndf1Photon()); + picoFcsCluster.setChi2Ndf2Photon(muCluster->chi2Ndf2Photon()); + picoFcsCluster.setFourMomentum(muCluster->fourMomentum()); + new((*(mPicoArrays[StPicoArrays::FcsCluster]))[counter]) StPicoFcsCluster(picoFcsCluster); + } +}//fillFcsClusters + #if !defined (__TFG__VERSION__) /** diff --git a/StRoot/StPicoDstMaker/StPicoDstMaker.h b/StRoot/StPicoDstMaker/StPicoDstMaker.h index 64028677995..f400d591de7 100644 --- a/StRoot/StPicoDstMaker/StPicoDstMaker.h +++ b/StRoot/StPicoDstMaker/StPicoDstMaker.h @@ -225,6 +225,13 @@ class StPicoDstMaker : public StMaker { void fillBbcHits(); /// Fill ETOF information void fillETofHits(); +<<<<<<< Updated upstream +======= + /// Fill Fwd Track information + void fillFwdTracks(); + /// Fill FcsClusters information + void fillFcsClusters(); +>>>>>>> Stashed changes /// Fill MC vertex information void fillFwdTracks(); /// Fill MC vertex information diff --git a/StRoot/StPicoEvent/StPicoArrays.cxx b/StRoot/StPicoEvent/StPicoArrays.cxx index 1ad46d9f57a..bb5378a5b3d 100644 --- a/StRoot/StPicoEvent/StPicoArrays.cxx +++ b/StRoot/StPicoEvent/StPicoArrays.cxx @@ -26,6 +26,7 @@ const char* StPicoArrays::picoArrayNames [NAllPicoArrays] = { "Event", "ETofHit", "ETofPidTraits", "FwdTracks", + "FcsClusters", "McVertex", "McTrack" }; @@ -51,6 +52,7 @@ const char* StPicoArrays::picoArrayTypes [NAllPicoArrays] = { "StPicoEvent", "StPicoETofHit", "StPicoETofPidTraits", "StPicoFwdTrack", + "StPicoFcsCluster", "StPicoMcVertex", "StPicoMcTrack" }; @@ -78,7 +80,8 @@ int StPicoArrays::picoArraySizes [NAllPicoArrays] = { 1, // StPicoEvent 100, // StPicoBEmcSmdPHit 100, // StPicoETofHit 100, // StPicoETofPidTraits - 10, // StPicoFwdTracks + 10, // StPicoFwdTrack + 100, // StPicoFcsCluster 10, // StPicoMcVertex 1000 // StPicoMcTrack }; diff --git a/StRoot/StPicoEvent/StPicoArrays.h b/StRoot/StPicoEvent/StPicoArrays.h index b3ebff3b2cb..a2db45bce91 100644 --- a/StRoot/StPicoEvent/StPicoArrays.h +++ b/StRoot/StPicoEvent/StPicoArrays.h @@ -17,7 +17,7 @@ class StPicoArrays { StPicoArrays(); /// Should be changed to constexpr once ROOT 6 is available at STAR - enum { NAllPicoArrays = 21}; + enum { NAllPicoArrays = 22}; /// Names of the TBranches in the TTree/File static const char* picoArrayNames[NAllPicoArrays]; @@ -33,7 +33,7 @@ class StPicoArrays { BTowHit, BTofHit, MtdHit, BbcHit, EpdHit, FmsHit, BEmcPidTraits, BTofPidTraits, MtdPidTraits, TrackCovMatrix, BEmcSmdEHit, BEmcSmdPHit, ETofHit, ETofPidTraits, - FwdTrack, + FwdTrack, FcsCluster, McVertex, McTrack }; }; diff --git a/StRoot/StPicoEvent/StPicoDst.h b/StRoot/StPicoEvent/StPicoDst.h index e8b3b862879..8597f5fdee6 100644 --- a/StRoot/StPicoEvent/StPicoDst.h +++ b/StRoot/StPicoEvent/StPicoDst.h @@ -34,6 +34,7 @@ class StPicoBEmcSmdPHit; class StPicoETofHit; class StPicoETofPidTraits; class StPicoFwdTrack; +class StPicoFcsCluster; class StPicoMcVertex; class StPicoMcTrack; @@ -94,8 +95,10 @@ class StPicoDst { static StPicoBEmcSmdPHit* bemcSmdPHit(Int_t i) { return (StPicoBEmcSmdPHit*)picoArrays[StPicoArrays::BEmcSmdPHit]->UncheckedAt(i); } /// Return pointer to i-th etof hit static StPicoETofHit* etofHit(Int_t i) { return (StPicoETofHit*)picoArrays[StPicoArrays::ETofHit]->UncheckedAt(i); } - /// Return pointer to i-th etof hit + /// Return pointer to i-th fwd track static StPicoFwdTrack* fwdTrack(Int_t i) { return (StPicoFwdTrack*)picoArrays[StPicoArrays::FwdTrack]->UncheckedAt(i); } + /// Return pointer to i-th fcs Cluster + static StPicoFcsCluster* fcsCluster(Int_t i) { return (StPicoFcsCluster*)picoArrays[StPicoArrays::FwdTrack]->UncheckedAt(i); } /// Return pointer to i-th etof pidTraits static StPicoETofPidTraits* etofPidTraits(Int_t i) { return (StPicoETofPidTraits*)picoArrays[StPicoArrays::ETofPidTraits]->UncheckedAt(i); } /// Return pointer to i-th MC vertex @@ -139,6 +142,8 @@ class StPicoDst { static UInt_t numberOfETofPidTraits() { return picoArrays[StPicoArrays::ETofPidTraits]->GetEntriesFast(); } /// Return number of Fwd Tracks static UInt_t numberOfFwdTracks() { return picoArrays[StPicoArrays::FwdTrack]->GetEntriesFast(); } + /// Return number of FcsClusters + static UInt_t numberOfFcsClusters() { return picoArrays[StPicoArrays::FcsCluster]->GetEntriesFast(); } /// Return number of MC vertices static UInt_t numberOfMcVertices() { return picoArrays[StPicoArrays::McVertex]->GetEntriesFast(); } /// Return number of MC tracks diff --git a/StRoot/StPicoEvent/StPicoDstLinkDef.h b/StRoot/StPicoEvent/StPicoDstLinkDef.h index 8641aef7a01..12be79642fb 100644 --- a/StRoot/StPicoEvent/StPicoDstLinkDef.h +++ b/StRoot/StPicoEvent/StPicoDstLinkDef.h @@ -27,6 +27,7 @@ #pragma link C++ class StPicoETofHit+; #pragma link C++ class StPicoETofPidTraits+; #pragma link C++ class StPicoFwdTrack+; +#pragma link C++ class StPicoFcsCluster+; #pragma link C++ class StPicoDst+; // StarClassLibrary adopted classes diff --git a/StRoot/StPicoEvent/StPicoDstReader.cxx b/StRoot/StPicoEvent/StPicoDstReader.cxx index aa3521b4fa0..df21639dc04 100644 --- a/StRoot/StPicoEvent/StPicoDstReader.cxx +++ b/StRoot/StPicoEvent/StPicoDstReader.cxx @@ -31,6 +31,7 @@ #include "StPicoETofHit.h" #include "StPicoETofPidTraits.h" #include "StPicoFwdTrack.h" +#include "StPicoFcsCluster.h" #include "StPicoMcVertex.h" #include "StPicoMcTrack.h" #include "StPicoArrays.h" @@ -133,6 +134,7 @@ void StPicoDstReader::streamerOff() { StPicoETofHit::Class()->IgnoreTObjectStreamer(); StPicoETofPidTraits::Class()->IgnoreTObjectStreamer(); StPicoFwdTrack::Class()->IgnoreTObjectStreamer(); + StPicoFcsCluster::Class()->IgnoreTObjectStreamer(); StPicoMcVertex::Class()->IgnoreTObjectStreamer(); StPicoMcTrack::Class()->IgnoreTObjectStreamer(); } diff --git a/StRoot/StPicoEvent/StPicoFcsCluster.cxx b/StRoot/StPicoEvent/StPicoFcsCluster.cxx new file mode 100644 index 00000000000..ee19a6d72f8 --- /dev/null +++ b/StRoot/StPicoEvent/StPicoFcsCluster.cxx @@ -0,0 +1,40 @@ +#include "StPicoFcsCluster.h" +#include +#include "StPicoMessMgr.h" + +// ROOT headers +#include "TMath.h" + +ClassImp(StPicoFcsCluster) + +StPicoFcsCluster::StPicoFcsCluster() : TObject() { + /* No Op*/ +} + +StPicoFcsCluster::StPicoFcsCluster(const StPicoFcsCluster &clu){ + mId=clu.mId; + mDetectorId=clu.mDetectorId; + mCategory=clu.mCategory; + mNTowers=clu.mNTowers; + mEnergy=clu.mEnergy; + mX=clu.mX; + mY=clu.mY; + mSigmaMin=clu.mSigmaMin; + mSigmaMax=clu.mSigmaMax; + mTheta=clu.mTheta; + mChi2Ndf1Photon=clu.mChi2Ndf1Photon; + mChi2Ndf2Photon=clu.mChi2Ndf2Photon; + mFourMomentumX=clu.mFourMomentumX; + mFourMomentumY=clu.mFourMomentumY; + mFourMomentumZ=clu.mFourMomentumZ; + mFourMomentumT=clu.mFourMomentumT; +} + +StPicoFcsCluster::~StPicoFcsCluster(){ + +} + +//_________________ +void StPicoFcsCluster::Print(const Char_t* option __attribute__((unused))) const { + +} \ No newline at end of file diff --git a/StRoot/StPicoEvent/StPicoFcsCluster.h b/StRoot/StPicoEvent/StPicoFcsCluster.h new file mode 100644 index 00000000000..5c1486f8cb1 --- /dev/null +++ b/StRoot/StPicoEvent/StPicoFcsCluster.h @@ -0,0 +1,84 @@ +/*************************************************************************** + * + * Author: jdb, Feb 2022 + *************************************************************************** + * + * Description: StPicoFcsCluster stores the Fcs Clusters + * + **************************************************************************/ +#ifndef StPicoFcsCluster_hh +#define StPicoFcsCluster_hh + +#include +#include +#include "TVector3.h" +#include "TLorentzVector.h" + + +class StPicoFcsCluster : public TObject { + +public: + /// Constructor + StPicoFcsCluster( ); + /// Copy constructor + StPicoFcsCluster(const StPicoFcsCluster &fwdTrack); + /// Destructor + virtual ~StPicoFcsCluster(); + + virtual void Print(const Char_t *option = "") const; + /// Return unique Id of the track + Int_t id() const { return mId; } + unsigned short detectorId() const { return mDetectorId; } + int category() const { return mCategory; } + int nTowers() const { return mNTowers; } + // int nNeighbor() const { return } + // int nPoints() const; + float energy() const { return mEnergy; } + float x() const { return mX; } // Mean x ("center of gravity") in local grid coordinate (1st moment). + float y() const { return mY; } // Mean y ("center of gravity") in local grid coordinate (1st moment). + float sigmaMax() const { return mSigmaMax; } // Maximum 2nd moment (along major axis). + float sigmaMin() const { return mSigmaMin; } // Minimum 2nd moment. + float theta() const { return mTheta; } // Angle in x-y plane that defines the direction of least-2nd-sigma + float chi2Ndf1Photon() const { return mChi2Ndf1Photon; } // chi^2/ndf for 1-photon fit to the cluster. + float chi2Ndf2Photon() const { return mChi2Ndf2Photon; } // chi^2/ndf for 2-photon fit to the cluster. + const TLorentzVector& fourMomentum() const { return TLorentzVector( mFourMomentumX, mFourMomentumY, mFourMomentumZ, mFourMomentumT ); } // Cluster four-momentum (px, py, pz, E) + + void setId(int cluid) { mId = (UShort_t)cluid; } + void setDetectorId(unsigned short detector) { mDetectorId=(UShort_t)detector; } + void setCategory(int catag) { mCategory = catag; } + void setNTowers(int numbTower) { mNTowers = (UShort_t)numbTower; } + void setEnergy(float energy) { mEnergy = energy; } + void setX(float x0) { mX = x0; } + void setY(float y0) { mY = y0; } + void setSigmaMin(float sigmaMin) { mSigmaMin = sigmaMin; } + void setSigmaMax(float sigmaMax) { mSigmaMax = sigmaMax; } + void setTheta(float theta) { mTheta = theta; } + void setChi2Ndf1Photon(float chi2ndfph1) { mChi2Ndf1Photon = chi2ndfph1; } + void setChi2Ndf2Photon(float chi2ndfph2) { mChi2Ndf2Photon = chi2ndfph2;} + void setFourMomentum(TLorentzVector p4) { mFourMomentumX = p4.X(); mFourMomentumY = p4.Y(); mFourMomentumZ = p4.Z(); mFourMomentumT = p4.T(); } + + +protected: + UShort_t mId=0; // Eventwise cluster ID + UShort_t mDetectorId=0; // Detector starts from 1 + Int_t mCategory=0; // Category of cluster (see StMuFcsClusterCategory) + UShort_t mNTowers=0; // Number of non-zero-energy tower hits in the cluster + Float_t mEnergy=0.0; // Total energy contained in this cluster (0th moment) + Float_t mX=0.0; // Mean x ("center of gravity") in local grid coordinate (1st moment) + Float_t mY=0.0; // Mean y ("center of gravity") in local grid coordinate (1st moment) + Float_t mSigmaMin=0.0; // Minimum 2nd moment + Float_t mSigmaMax=0.0; // Maximum 2nd moment (along major axis) + Float_t mTheta=0.0; //Angle in x-y plane that defines the direction of least-2nd-sigma + Float_t mChi2Ndf1Photon=0.0; // χ2 / ndf for 1-photon fit + Float_t mChi2Ndf2Photon=0.0; // χ2 / ndf for 2-photon fit + // TLorentzVector mFourMomentum; // Cluster four momentum + Float_t mFourMomentumX=0.0; + Float_t mFourMomentumY=0.0; + Float_t mFourMomentumZ=0.0; + Float_t mFourMomentumT=0.0; + + ClassDef(StPicoFcsCluster, 1) +}; + +#endif + From e6daca50d9460d675623f2c825ee1338240b9696 Mon Sep 17 00:00:00 2001 From: Daniel Brandenburg Date: Tue, 16 Jan 2024 22:56:52 -0500 Subject: [PATCH 04/12] Add StPicoFcsHit, fix minor typos --- StRoot/StPicoDstMaker/StPicoDstMaker.cxx | 77 ++++++++---------------- StRoot/StPicoDstMaker/StPicoDstMaker.h | 7 +-- StRoot/StPicoEvent/StPicoArrays.cxx | 9 ++- StRoot/StPicoEvent/StPicoArrays.h | 6 +- StRoot/StPicoEvent/StPicoDst.h | 7 ++- StRoot/StPicoEvent/StPicoDstLinkDef.h | 1 + StRoot/StPicoEvent/StPicoDstReader.cxx | 2 + StRoot/StPicoEvent/StPicoFcsCluster.cxx | 3 +- StRoot/StPicoEvent/StPicoFcsCluster.h | 10 +-- StRoot/StPicoEvent/StPicoFcsHit.cxx | 27 +++++++++ StRoot/StPicoEvent/StPicoFcsHit.h | 52 ++++++++++++++++ StRoot/StPicoEvent/StPicoFwdTrack.h | 1 + 12 files changed, 129 insertions(+), 73 deletions(-) create mode 100644 StRoot/StPicoEvent/StPicoFcsHit.cxx create mode 100644 StRoot/StPicoEvent/StPicoFcsHit.h diff --git a/StRoot/StPicoDstMaker/StPicoDstMaker.cxx b/StRoot/StPicoDstMaker/StPicoDstMaker.cxx index bb021d50d53..0dcc3021919 100644 --- a/StRoot/StPicoDstMaker/StPicoDstMaker.cxx +++ b/StRoot/StPicoDstMaker/StPicoDstMaker.cxx @@ -62,6 +62,7 @@ #include "StMuDSTMaker/COMMON/StMuMcTrack.h" #include "StMuDSTMaker/COMMON/StMuMcVertex.h" #include "StMuDSTMaker/COMMON/StMuFcsCollection.h" +#include "StMuDSTMaker/COMMON/StMuFcsHit.h" #include "StMuDSTMaker/COMMON/StMuFcsCluster.h" #include "StTriggerUtilities/StTriggerSimuMaker.h" @@ -99,6 +100,7 @@ #include "StPicoEvent/StPicoETofHit.h" #include "StPicoEvent/StPicoETofPidTraits.h" #include "StPicoEvent/StPicoFwdTrack.h" +#include "StPicoEvent/StPicoFcsHit.h" #include "StPicoEvent/StPicoFcsCluster.h" #include "StPicoEvent/StPicoMcVertex.h" #include "StPicoEvent/StPicoMcTrack.h" @@ -252,6 +254,7 @@ void StPicoDstMaker::streamerOff() { StPicoETofHit::Class()->IgnoreTObjectStreamer(); StPicoETofPidTraits::Class()->IgnoreTObjectStreamer(); StPicoFwdTrack::Class()->IgnoreTObjectStreamer(); + StPicoFcsHit::Class()->IgnoreTObjectStreamer(); StPicoFcsCluster::Class()->IgnoreTObjectStreamer(); StPicoMcVertex::Class()->IgnoreTObjectStreamer(); StPicoMcTrack::Class()->IgnoreTObjectStreamer(); @@ -902,6 +905,7 @@ Int_t StPicoDstMaker::MakeWrite() { fillBbcHits(); fillETofHits(); fillFwdTracks(); + fillFcsHits(); fillFcsClusters(); // Could be a good idea to move this call to Init() or InitRun() @@ -2512,58 +2516,6 @@ void StPicoDstMaker::fillMtdHits() { } //while (triggerPos.size() > 0) } -//_________________ -void StPicoDstMaker::fillFwdTracks() { - - StEvent *evt = (StEvent *)GetDataSet("StEvent"); - if ( evt ){ - StFwdTrackCollection * evc = evt->fwdTrackCollection(); - if ( !evc ){ - LOG_ERROR << "null FwdTrackCollection" << endm; - return; - } - const StSPtrVecFwdTrack& evTracks = evc->tracks(); - LOG_INFO << "Adding " << evc->numberOfTracks() << " StMuFwdTracks to MuDSt" << endm; - for ( size_t i = 0; i < evc->numberOfTracks(); i++ ){ - StFwdTrack * evTrack = evTracks[i]; - StPicoFwdTrack picoFwdTrack; - picoFwdTrack.setMomentum( evTrack->momentum().x(), evTrack->momentum().y(), evTrack->momentum().z() ); - picoFwdTrack.setNumberOfFitPoints( evTrack->numberOfFitPoints() * evTrack->charge() ); - int counter = mPicoArrays[StPicoArrays::FwdTrack]->GetEntries(); - picoFwdTrack.setId( counter ); - new((*(mPicoArrays[StPicoArrays::FwdTrack]))[counter]) StPicoFwdTrack(picoFwdTrack); - } - } else { - LOG_WARN << "Cannot get Fwd Tracks from StEvent" << endm; - } -} - -//_________________ -void StPicoDstMaker::fillFwdTracks() { - - StEvent *evt = (StEvent *)GetDataSet("StEvent"); - if ( evt ){ - StFwdTrackCollection * evc = evt->fwdTrackCollection(); - if ( !evc ){ - LOG_ERROR << "null FwdTrackCollection" << endm; - return; - } - const StSPtrVecFwdTrack& evTracks = evc->tracks(); - LOG_INFO << "Adding " << evc->numberOfTracks() << " StMuFwdTracks to MuDSt" << endm; - for ( size_t i = 0; i < evc->numberOfTracks(); i++ ){ - StFwdTrack * evTrack = evTracks[i]; - StPicoFwdTrack picoFwdTrack; - picoFwdTrack.setMomentum( evTrack->momentum().x(), evTrack->momentum().y(), evTrack->momentum().z() ); - picoFwdTrack.setNumberOfFitPoints( evTrack->numberOfFitPoints() * evTrack->charge() ); - int counter = mPicoArrays[StPicoArrays::FwdTrack]->GetEntries(); - picoFwdTrack.setId( counter ); - new((*(mPicoArrays[StPicoArrays::FwdTrack]))[counter]) StPicoFwdTrack(picoFwdTrack); - } - } else { - LOG_WARN << "Cannot get Fwd Tracks from StEvent" << endm; - } -} - //_________________ void StPicoDstMaker::fillFwdTracks() { @@ -2621,6 +2573,27 @@ void StPicoDstMaker::fillFcsClusters() { } }//fillFcsClusters +//_________________ +void StPicoDstMaker::fillFcsHits() { + StMuFcsCollection * muFcs = mMuDst->muFcsCollection(); + if ( !muFcs ) { + LOG_ERROR << "Cannot get Fcs Collection from MuDst" << endm; + return; + } + TIter next(muFcs->getHitArray()); + StMuFcsHit* muHit(NULL); + while ((muHit = static_cast(next()))) { + int counter = mPicoArrays[StPicoArrays::FcsHit]->GetEntries(); + StPicoFcsHit picoFcsHit; + picoFcsHit.setIndex(counter); + picoFcsHit.setDetectorId(muHit->detectorId()); + picoFcsHit.setId(muHit->id()); + // picoFcsHit.setFourMomentum(muHit->fourMomentum()); + picoFcsHit.setFourMomentum( TLorentzVector(0, 0, 0, muHit->energy()) ); + new((*(mPicoArrays[StPicoArrays::FcsHit]))[counter]) StPicoFcsHit(picoFcsHit); + } +}//fillFcsHit + #if !defined (__TFG__VERSION__) /** diff --git a/StRoot/StPicoDstMaker/StPicoDstMaker.h b/StRoot/StPicoDstMaker/StPicoDstMaker.h index f400d591de7..0566fc85cd5 100644 --- a/StRoot/StPicoDstMaker/StPicoDstMaker.h +++ b/StRoot/StPicoDstMaker/StPicoDstMaker.h @@ -225,15 +225,12 @@ class StPicoDstMaker : public StMaker { void fillBbcHits(); /// Fill ETOF information void fillETofHits(); -<<<<<<< Updated upstream -======= /// Fill Fwd Track information void fillFwdTracks(); + /// Fill FcsHits information + void fillFcsHits(); /// Fill FcsClusters information void fillFcsClusters(); ->>>>>>> Stashed changes - /// Fill MC vertex information - void fillFwdTracks(); /// Fill MC vertex information void fillMcVertices(); /// Fill MC track information diff --git a/StRoot/StPicoEvent/StPicoArrays.cxx b/StRoot/StPicoEvent/StPicoArrays.cxx index bb5378a5b3d..5176b3edc67 100644 --- a/StRoot/StPicoEvent/StPicoArrays.cxx +++ b/StRoot/StPicoEvent/StPicoArrays.cxx @@ -26,8 +26,9 @@ const char* StPicoArrays::picoArrayNames [NAllPicoArrays] = { "Event", "ETofHit", "ETofPidTraits", "FwdTracks", + "FcsHits", "FcsClusters", - "McVertex", + "McVertex", "McTrack" }; @@ -52,8 +53,9 @@ const char* StPicoArrays::picoArrayTypes [NAllPicoArrays] = { "StPicoEvent", "StPicoETofHit", "StPicoETofPidTraits", "StPicoFwdTrack", + "StPicoFcsHit", "StPicoFcsCluster", - "StPicoMcVertex", + "StPicoMcVertex", "StPicoMcTrack" }; @@ -80,7 +82,8 @@ int StPicoArrays::picoArraySizes [NAllPicoArrays] = { 1, // StPicoEvent 100, // StPicoBEmcSmdPHit 100, // StPicoETofHit 100, // StPicoETofPidTraits - 10, // StPicoFwdTrack + 10, // StPicoFwdTrack + 200, // StPicoFcsHit 100, // StPicoFcsCluster 10, // StPicoMcVertex 1000 // StPicoMcTrack diff --git a/StRoot/StPicoEvent/StPicoArrays.h b/StRoot/StPicoEvent/StPicoArrays.h index a2db45bce91..253df2d0ad8 100644 --- a/StRoot/StPicoEvent/StPicoArrays.h +++ b/StRoot/StPicoEvent/StPicoArrays.h @@ -17,7 +17,7 @@ class StPicoArrays { StPicoArrays(); /// Should be changed to constexpr once ROOT 6 is available at STAR - enum { NAllPicoArrays = 22}; + enum { NAllPicoArrays = 23}; /// Names of the TBranches in the TTree/File static const char* picoArrayNames[NAllPicoArrays]; @@ -32,8 +32,8 @@ class StPicoArrays { enum TypeIndex { Event=0, Track, EmcTrigger, MtdTrigger, BTowHit, BTofHit, MtdHit, BbcHit, EpdHit, FmsHit, BEmcPidTraits, BTofPidTraits, MtdPidTraits, TrackCovMatrix, - BEmcSmdEHit, BEmcSmdPHit, ETofHit, ETofPidTraits, - FwdTrack, FcsCluster, + BEmcSmdEHit, BEmcSmdPHit, ETofHit, ETofPidTraits, + FwdTrack, FcsHit, FcsCluster, McVertex, McTrack }; }; diff --git a/StRoot/StPicoEvent/StPicoDst.h b/StRoot/StPicoEvent/StPicoDst.h index 8597f5fdee6..129df01e6e3 100644 --- a/StRoot/StPicoEvent/StPicoDst.h +++ b/StRoot/StPicoEvent/StPicoDst.h @@ -34,6 +34,7 @@ class StPicoBEmcSmdPHit; class StPicoETofHit; class StPicoETofPidTraits; class StPicoFwdTrack; +class StPicoFcsHit; class StPicoFcsCluster; class StPicoMcVertex; class StPicoMcTrack; @@ -97,8 +98,10 @@ class StPicoDst { static StPicoETofHit* etofHit(Int_t i) { return (StPicoETofHit*)picoArrays[StPicoArrays::ETofHit]->UncheckedAt(i); } /// Return pointer to i-th fwd track static StPicoFwdTrack* fwdTrack(Int_t i) { return (StPicoFwdTrack*)picoArrays[StPicoArrays::FwdTrack]->UncheckedAt(i); } + /// Return pointer to i-th fcs Hit + static StPicoFcsHit* fcsHit(Int_t i) { return (StPicoFcsHit*)picoArrays[StPicoArrays::FcsHit]->UncheckedAt(i); } /// Return pointer to i-th fcs Cluster - static StPicoFcsCluster* fcsCluster(Int_t i) { return (StPicoFcsCluster*)picoArrays[StPicoArrays::FwdTrack]->UncheckedAt(i); } + static StPicoFcsCluster* fcsCluster(Int_t i) { return (StPicoFcsCluster*)picoArrays[StPicoArrays::FcsCluster]->UncheckedAt(i); } /// Return pointer to i-th etof pidTraits static StPicoETofPidTraits* etofPidTraits(Int_t i) { return (StPicoETofPidTraits*)picoArrays[StPicoArrays::ETofPidTraits]->UncheckedAt(i); } /// Return pointer to i-th MC vertex @@ -142,6 +145,8 @@ class StPicoDst { static UInt_t numberOfETofPidTraits() { return picoArrays[StPicoArrays::ETofPidTraits]->GetEntriesFast(); } /// Return number of Fwd Tracks static UInt_t numberOfFwdTracks() { return picoArrays[StPicoArrays::FwdTrack]->GetEntriesFast(); } + /// Return number of FcsHits + static UInt_t numberOfFcsHits() { return picoArrays[StPicoArrays::FcsHit]->GetEntriesFast(); } /// Return number of FcsClusters static UInt_t numberOfFcsClusters() { return picoArrays[StPicoArrays::FcsCluster]->GetEntriesFast(); } /// Return number of MC vertices diff --git a/StRoot/StPicoEvent/StPicoDstLinkDef.h b/StRoot/StPicoEvent/StPicoDstLinkDef.h index 12be79642fb..9a69d010579 100644 --- a/StRoot/StPicoEvent/StPicoDstLinkDef.h +++ b/StRoot/StPicoEvent/StPicoDstLinkDef.h @@ -27,6 +27,7 @@ #pragma link C++ class StPicoETofHit+; #pragma link C++ class StPicoETofPidTraits+; #pragma link C++ class StPicoFwdTrack+; +#pragma link C++ class StPicoFcsHit+; #pragma link C++ class StPicoFcsCluster+; #pragma link C++ class StPicoDst+; diff --git a/StRoot/StPicoEvent/StPicoDstReader.cxx b/StRoot/StPicoEvent/StPicoDstReader.cxx index df21639dc04..2222fa89a28 100644 --- a/StRoot/StPicoEvent/StPicoDstReader.cxx +++ b/StRoot/StPicoEvent/StPicoDstReader.cxx @@ -31,6 +31,7 @@ #include "StPicoETofHit.h" #include "StPicoETofPidTraits.h" #include "StPicoFwdTrack.h" +#include "StPicoFcsHit.h" #include "StPicoFcsCluster.h" #include "StPicoMcVertex.h" #include "StPicoMcTrack.h" @@ -134,6 +135,7 @@ void StPicoDstReader::streamerOff() { StPicoETofHit::Class()->IgnoreTObjectStreamer(); StPicoETofPidTraits::Class()->IgnoreTObjectStreamer(); StPicoFwdTrack::Class()->IgnoreTObjectStreamer(); + StPicoFcsHit::Class()->IgnoreTObjectStreamer(); StPicoFcsCluster::Class()->IgnoreTObjectStreamer(); StPicoMcVertex::Class()->IgnoreTObjectStreamer(); StPicoMcTrack::Class()->IgnoreTObjectStreamer(); diff --git a/StRoot/StPicoEvent/StPicoFcsCluster.cxx b/StRoot/StPicoEvent/StPicoFcsCluster.cxx index ee19a6d72f8..62b3386c013 100644 --- a/StRoot/StPicoEvent/StPicoFcsCluster.cxx +++ b/StRoot/StPicoEvent/StPicoFcsCluster.cxx @@ -16,7 +16,6 @@ StPicoFcsCluster::StPicoFcsCluster(const StPicoFcsCluster &clu){ mDetectorId=clu.mDetectorId; mCategory=clu.mCategory; mNTowers=clu.mNTowers; - mEnergy=clu.mEnergy; mX=clu.mX; mY=clu.mY; mSigmaMin=clu.mSigmaMin; @@ -37,4 +36,4 @@ StPicoFcsCluster::~StPicoFcsCluster(){ //_________________ void StPicoFcsCluster::Print(const Char_t* option __attribute__((unused))) const { -} \ No newline at end of file +} diff --git a/StRoot/StPicoEvent/StPicoFcsCluster.h b/StRoot/StPicoEvent/StPicoFcsCluster.h index 5c1486f8cb1..0f174d82a8c 100644 --- a/StRoot/StPicoEvent/StPicoFcsCluster.h +++ b/StRoot/StPicoEvent/StPicoFcsCluster.h @@ -31,9 +31,7 @@ class StPicoFcsCluster : public TObject { unsigned short detectorId() const { return mDetectorId; } int category() const { return mCategory; } int nTowers() const { return mNTowers; } - // int nNeighbor() const { return } - // int nPoints() const; - float energy() const { return mEnergy; } + float energy() const { return mFourMomentumT; } float x() const { return mX; } // Mean x ("center of gravity") in local grid coordinate (1st moment). float y() const { return mY; } // Mean y ("center of gravity") in local grid coordinate (1st moment). float sigmaMax() const { return mSigmaMax; } // Maximum 2nd moment (along major axis). @@ -47,7 +45,7 @@ class StPicoFcsCluster : public TObject { void setDetectorId(unsigned short detector) { mDetectorId=(UShort_t)detector; } void setCategory(int catag) { mCategory = catag; } void setNTowers(int numbTower) { mNTowers = (UShort_t)numbTower; } - void setEnergy(float energy) { mEnergy = energy; } + void setEnergy(float energy) { mFourMomentumT = energy; } void setX(float x0) { mX = x0; } void setY(float y0) { mY = y0; } void setSigmaMin(float sigmaMin) { mSigmaMin = sigmaMin; } @@ -63,7 +61,6 @@ class StPicoFcsCluster : public TObject { UShort_t mDetectorId=0; // Detector starts from 1 Int_t mCategory=0; // Category of cluster (see StMuFcsClusterCategory) UShort_t mNTowers=0; // Number of non-zero-energy tower hits in the cluster - Float_t mEnergy=0.0; // Total energy contained in this cluster (0th moment) Float_t mX=0.0; // Mean x ("center of gravity") in local grid coordinate (1st moment) Float_t mY=0.0; // Mean y ("center of gravity") in local grid coordinate (1st moment) Float_t mSigmaMin=0.0; // Minimum 2nd moment @@ -71,13 +68,12 @@ class StPicoFcsCluster : public TObject { Float_t mTheta=0.0; //Angle in x-y plane that defines the direction of least-2nd-sigma Float_t mChi2Ndf1Photon=0.0; // χ2 / ndf for 1-photon fit Float_t mChi2Ndf2Photon=0.0; // χ2 / ndf for 2-photon fit - // TLorentzVector mFourMomentum; // Cluster four momentum Float_t mFourMomentumX=0.0; Float_t mFourMomentumY=0.0; Float_t mFourMomentumZ=0.0; Float_t mFourMomentumT=0.0; - ClassDef(StPicoFcsCluster, 1) + ClassDef(StPicoFcsCluster, 2) }; #endif diff --git a/StRoot/StPicoEvent/StPicoFcsHit.cxx b/StRoot/StPicoEvent/StPicoFcsHit.cxx new file mode 100644 index 00000000000..f372e59709d --- /dev/null +++ b/StRoot/StPicoEvent/StPicoFcsHit.cxx @@ -0,0 +1,27 @@ +#include "StPicoFcsHit.h" +#include +#include "StPicoMessMgr.h" + +// ROOT headers +#include "TMath.h" + +ClassImp(StPicoFcsHit) + +StPicoFcsHit::StPicoFcsHit() : TObject() { +} + +StPicoFcsHit::StPicoFcsHit(const StPicoFcsHit &hit){ + mIndex=hit.mIndex; + mDetectorId=hit.mDetectorId; + mId=hit.mId; + mFourMomentumX=hit.mFourMomentumX; + mFourMomentumY=hit.mFourMomentumY; + mFourMomentumZ=hit.mFourMomentumZ; + mFourMomentumT=hit.mFourMomentumT; +} + +StPicoFcsHit::~StPicoFcsHit(){ +} + +void StPicoFcsHit::Print(const Char_t* option __attribute__((unused))) const { +} diff --git a/StRoot/StPicoEvent/StPicoFcsHit.h b/StRoot/StPicoEvent/StPicoFcsHit.h new file mode 100644 index 00000000000..2b9283c8851 --- /dev/null +++ b/StRoot/StPicoEvent/StPicoFcsHit.h @@ -0,0 +1,52 @@ +/*************************************************************************** + * + * Author: jdb, Feb 2022 + *************************************************************************** + * + * Description: StPicoFcsHit stores the Fcs Hits + * + **************************************************************************/ +#ifndef StPicoFcsHit_hh +#define StPicoFcsHit_hh + +#include +#include +#include "TVector3.h" +#include "TLorentzVector.h" + +class StPicoFcsHit : public TObject { + +public: + /// Constructor + StPicoFcsHit(); + /// Copy constructor + StPicoFcsHit(const StPicoFcsHit &fwdTrack); + /// Destructor + virtual ~StPicoFcsHit(); + + virtual void Print(const Char_t *option = "") const; + Int_t index() const { return mId; } // Return unique Index of the hit + unsigned short detectorId() const { return mDetectorId; } + Int_t id() const { return mId; } // Id of the hit winthin detectorId + float energy() const { return mFourMomentumT; } + const TLorentzVector& fourMomentum() const { return TLorentzVector( mFourMomentumX, mFourMomentumY, mFourMomentumZ, mFourMomentumT ); } // Hit four-momentum (px, py, pz, E) + + void setIndex(int index) { mIndex = (UShort_t)index; } + void setDetectorId(unsigned short detector) { mDetectorId=(UShort_t)detector; } + void setId(int id) { mIndex = (UShort_t)id; } + void setFourMomentum(TLorentzVector p4) { mFourMomentumX = p4.X(); mFourMomentumY = p4.Y(); mFourMomentumZ = p4.Z(); mFourMomentumT = p4.T(); } + +protected: + UShort_t mIndex=0; // Eventwise Hit Index + UShort_t mDetectorId=0; // DetectorId + UShort_t mId=0; // Id of the hit winthin a detectorId + Float_t mFourMomentumX=0.0; // Four momentum component X + Float_t mFourMomentumY=0.0; // Four momentum component Y + Float_t mFourMomentumZ=0.0; // Four momentum component Z + Float_t mFourMomentumT=0.0; // Four momentum component T + + ClassDef(StPicoFcsHit, 1) +}; + +#endif + diff --git a/StRoot/StPicoEvent/StPicoFwdTrack.h b/StRoot/StPicoEvent/StPicoFwdTrack.h index 37b1d112eae..aa49d8cc204 100644 --- a/StRoot/StPicoEvent/StPicoFwdTrack.h +++ b/StRoot/StPicoEvent/StPicoFwdTrack.h @@ -66,6 +66,7 @@ class StPicoFwdTrack : public TObject { // Track quality and convergence /// Unique track ID UShort_t mId; + /// Number of points used in seed UChar_t mNumberOfSeedPoints; /// Charge * nHitsFit Char_t mNumberOfFitPoints; From 8f24db398331c48e7c158800966f8dfeed183f4c Mon Sep 17 00:00:00 2001 From: Daniel Brandenburg Date: Wed, 31 Jan 2024 20:51:12 -0500 Subject: [PATCH 05/12] Updates to StPicoFwdTrack --- StRoot/StPicoEvent/StPicoFwdTrack.cxx | 9 ++++++++- StRoot/StPicoEvent/StPicoFwdTrack.h | 11 +++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/StRoot/StPicoEvent/StPicoFwdTrack.cxx b/StRoot/StPicoEvent/StPicoFwdTrack.cxx index 371eda11f35..a381dc9fc64 100644 --- a/StRoot/StPicoEvent/StPicoFwdTrack.cxx +++ b/StRoot/StPicoEvent/StPicoFwdTrack.cxx @@ -23,7 +23,14 @@ StPicoFwdTrack::StPicoFwdTrack(const StPicoFwdTrack &fwdTrack){ mStatus = fwdTrack.mStatus; mIdTruth = fwdTrack.mIdTruth; - mQATruth = fwdTrack.mQATruth;mId; + mQATruth = fwdTrack.mQATruth; + + for ( size_t i = 0 ; i < fwdTrack.mEcalMatchIndex.size(); i++ ){ + addEcalCluster( fwdTrack.mEcalMatchIndex[i] ); + } + for ( size_t i = 0 ; i < fwdTrack.mHcalMatchIndex.size(); i++ ){ + addHcalCluster( fwdTrack.mHcalMatchIndex[i] ); + } } StPicoFwdTrack::~StPicoFwdTrack(){ diff --git a/StRoot/StPicoEvent/StPicoFwdTrack.h b/StRoot/StPicoEvent/StPicoFwdTrack.h index aa49d8cc204..dec71f9c497 100644 --- a/StRoot/StPicoEvent/StPicoFwdTrack.h +++ b/StRoot/StPicoEvent/StPicoFwdTrack.h @@ -58,8 +58,10 @@ class StPicoFwdTrack : public TObject { void setNumberOfSeedPoints( Int_t lNumberOfSeedPoints ) { mNumberOfSeedPoints = (UChar_t)lNumberOfSeedPoints;} void setNumberOfFitPoints( Int_t lNumberOfFitPoints ) { mNumberOfFitPoints = (Char_t)lNumberOfFitPoints;} void setChi2(Float_t chi2); + void addEcalCluster( UChar_t index ) { mEcalMatchIndex.push_back(index); } + void addHcalCluster( UChar_t index ) { mHcalMatchIndex.push_back(index); } /// Set index of the corresonding MC track - void setMcTruth(Int_t index, Int_t qa) { mIdTruth = (UShort_t)index; mQATruth = (UShort_t)qa; } + void setMcTruth(Int_t index, Int_t qa) { mIdTruth = (UShort_t)index; mQATruth = (UShort_t)qa; } protected: @@ -81,7 +83,12 @@ class StPicoFwdTrack : public TObject { Float_t mMomentumZ; /// convergence (0=no, 1=converge, 2=converge fully) UChar_t mStatus; - + + /// ecal match index + std::vector mEcalMatchIndex; + /// hcal match index + std::vector mHcalMatchIndex; + /// MC track id UShort_t mIdTruth; /// MC track quality (percentage of hits coming from corresponding MC track) From babd08f4440b2438e007ef90e3b1445a6563a49f Mon Sep 17 00:00:00 2001 From: "jdb12@rice.edu" Date: Thu, 8 Feb 2024 21:37:15 -0500 Subject: [PATCH 06/12] merge in Updated FcsHit codes --- StRoot/StPicoDstMaker/StPicoDstMaker.cxx | 41 +++++++++++++++++- StRoot/StPicoEvent/StPicoFcsCluster.h | 8 ++-- StRoot/StPicoEvent/StPicoFcsHit.h | 53 ++++++++++++++++++++++++ 3 files changed, 96 insertions(+), 6 deletions(-) create mode 100644 StRoot/StPicoEvent/StPicoFcsHit.h diff --git a/StRoot/StPicoDstMaker/StPicoDstMaker.cxx b/StRoot/StPicoDstMaker/StPicoDstMaker.cxx index bb021d50d53..1d2311ad4de 100644 --- a/StRoot/StPicoDstMaker/StPicoDstMaker.cxx +++ b/StRoot/StPicoDstMaker/StPicoDstMaker.cxx @@ -74,6 +74,7 @@ #include "StEmcRawMaker/StBemcTables.h" #include "StFmsDbMaker/StFmsDbMaker.h" +#include "StFcsDbMaker/StFcsDb.h" #include "tables/St_mtdModuleToQTmap_Table.h" #include "tables/St_mtdQTSlewingCorr_Table.h" @@ -2594,6 +2595,11 @@ void StPicoDstMaker::fillFwdTracks() { //_________________ void StPicoDstMaker::fillFcsClusters() { + StFcsDb* fcsDb = static_cast(GetDataSet("fcsDb")); + if( !fcsDb ) { + LOG_ERROR << "Cannot get StFcsDb object" << endm; + return; + } StMuFcsCollection * muFcs = mMuDst->muFcsCollection(); if ( !muFcs ) { LOG_ERROR << "Cannot get Fcs Collection from MuDst" << endm; @@ -2616,11 +2622,44 @@ void StPicoDstMaker::fillFcsClusters() { picoFcsCluster.setTheta(muCluster->theta()); picoFcsCluster.setChi2Ndf1Photon(muCluster->chi2Ndf1Photon()); picoFcsCluster.setChi2Ndf2Photon(muCluster->chi2Ndf2Photon()); - picoFcsCluster.setFourMomentum(muCluster->fourMomentum()); + double zVertex=picoDst()->event()->primaryVertex().z(); + StThreeVectorD xyz=fcsDb->getStarXYZ(muCluster->detectorId(), muCluster->x(), muCluster->y()); + StLorentzVectorD lv = fcsDb->getLorentzVector(xyz, muCluster->energy(), zVertex); + picoFcsCluster.setFourMomentum(lv.px(),lv.py(),lv.pz(),lv.e()); new((*(mPicoArrays[StPicoArrays::FcsCluster]))[counter]) StPicoFcsCluster(picoFcsCluster); } + LOG_INFO << "StPicoDstMaker::fillFcsClusters filled " << mPicoArrays[StPicoArrays::FcsCluster]->GetEntries() << endm; }//fillFcsClusters +//_________________ +void StPicoDstMaker::fillFcsHits() { + StFcsDb* fcsDb = static_cast(GetDataSet("fcsDb")); + if( !fcsDb ) { + LOG_ERROR << "Cannot get StFcsDb object" << endm; + return; + } + StMuFcsCollection * muFcs = mMuDst->muFcsCollection(); + if ( !muFcs ) { + LOG_ERROR << "Cannot get Fcs Collection from MuDst" << endm; + return; + } + TIter next(muFcs->getHitArray()); + StMuFcsHit* muHit(NULL); + while ((muHit = static_cast(next()))) { + int counter = mPicoArrays[StPicoArrays::FcsHit]->GetEntries(); + StPicoFcsHit picoFcsHit; + picoFcsHit.setIndex(counter); + picoFcsHit.setDetectorId(muHit->detectorId()); + picoFcsHit.setId(muHit->id()); + double zVertex=picoDst()->event()->primaryVertex().z(); + StThreeVectorD xyz = fcsDb->getStarXYZ(muHit->detectorId(), muHit->id()); + StLorentzVectorD lv = fcsDb->getLorentzVector(xyz, muHit->energy(), zVertex); + picoFcsHit.setFourMomentum(lv.px(),lv.py(),lv.pz(),lv.e()); + new((*(mPicoArrays[StPicoArrays::FcsHit]))[counter]) StPicoFcsHit(picoFcsHit); + } + LOG_INFO << "StPicoDstMaker::fillFcsHits filled " << mPicoArrays[StPicoArrays::FcsHit]->GetEntries() << endm; +}//fillFcsHit + #if !defined (__TFG__VERSION__) /** diff --git a/StRoot/StPicoEvent/StPicoFcsCluster.h b/StRoot/StPicoEvent/StPicoFcsCluster.h index 5c1486f8cb1..37d4b540356 100644 --- a/StRoot/StPicoEvent/StPicoFcsCluster.h +++ b/StRoot/StPicoEvent/StPicoFcsCluster.h @@ -31,9 +31,7 @@ class StPicoFcsCluster : public TObject { unsigned short detectorId() const { return mDetectorId; } int category() const { return mCategory; } int nTowers() const { return mNTowers; } - // int nNeighbor() const { return } - // int nPoints() const; - float energy() const { return mEnergy; } + float energy() const { return mFourMomentumT; } // Energy float x() const { return mX; } // Mean x ("center of gravity") in local grid coordinate (1st moment). float y() const { return mY; } // Mean y ("center of gravity") in local grid coordinate (1st moment). float sigmaMax() const { return mSigmaMax; } // Maximum 2nd moment (along major axis). @@ -41,7 +39,7 @@ class StPicoFcsCluster : public TObject { float theta() const { return mTheta; } // Angle in x-y plane that defines the direction of least-2nd-sigma float chi2Ndf1Photon() const { return mChi2Ndf1Photon; } // chi^2/ndf for 1-photon fit to the cluster. float chi2Ndf2Photon() const { return mChi2Ndf2Photon; } // chi^2/ndf for 2-photon fit to the cluster. - const TLorentzVector& fourMomentum() const { return TLorentzVector( mFourMomentumX, mFourMomentumY, mFourMomentumZ, mFourMomentumT ); } // Cluster four-momentum (px, py, pz, E) + const TLorentzVector fourMomentum() const { return TLorentzVector( mFourMomentumX, mFourMomentumY, mFourMomentumZ, mFourMomentumT ); } // Cluster four-momentum (px, py, pz, E) void setId(int cluid) { mId = (UShort_t)cluid; } void setDetectorId(unsigned short detector) { mDetectorId=(UShort_t)detector; } @@ -55,8 +53,8 @@ class StPicoFcsCluster : public TObject { void setTheta(float theta) { mTheta = theta; } void setChi2Ndf1Photon(float chi2ndfph1) { mChi2Ndf1Photon = chi2ndfph1; } void setChi2Ndf2Photon(float chi2ndfph2) { mChi2Ndf2Photon = chi2ndfph2;} + void setFourMomentum(float px, float py, float pz, float e) { mFourMomentumX = px; mFourMomentumY = py; mFourMomentumZ = pz; mFourMomentumT = e; } void setFourMomentum(TLorentzVector p4) { mFourMomentumX = p4.X(); mFourMomentumY = p4.Y(); mFourMomentumZ = p4.Z(); mFourMomentumT = p4.T(); } - protected: UShort_t mId=0; // Eventwise cluster ID diff --git a/StRoot/StPicoEvent/StPicoFcsHit.h b/StRoot/StPicoEvent/StPicoFcsHit.h new file mode 100644 index 00000000000..073eae34c07 --- /dev/null +++ b/StRoot/StPicoEvent/StPicoFcsHit.h @@ -0,0 +1,53 @@ +/*************************************************************************** + * + * Author: jdb, Feb 2022 + *************************************************************************** + * + * Description: StPicoFcsHit stores the Fcs Hits + * + **************************************************************************/ +#ifndef StPicoFcsHit_hh +#define StPicoFcsHit_hh + +#include +#include +#include "TVector3.h" +#include "TLorentzVector.h" + +class StPicoFcsHit : public TObject { + +public: + /// Constructor + StPicoFcsHit(); + /// Copy constructor + StPicoFcsHit(const StPicoFcsHit &fwdTrack); + /// Destructor + virtual ~StPicoFcsHit(); + + virtual void Print(const Char_t *option = "") const; + Int_t index() const { return mId; } // Return unique Index of the hit + unsigned short detectorId() const { return mDetectorId; } + Int_t id() const { return mId; } // Id of the hit winthin detectorId + float energy() const { return mFourMomentumT; } // Energy + const TLorentzVector fourMomentum() const { return TLorentzVector( mFourMomentumX, mFourMomentumY, mFourMomentumZ, mFourMomentumT ); } // Hit four-momentum (px, py, pz, E) + + void setIndex(int index) { mIndex = (UShort_t)index; } + void setDetectorId(unsigned short detector) { mDetectorId=(UShort_t)detector; } + void setId(int id) { mIndex = (UShort_t)id; } + void setFourMomentum(float px, float py, float pz, float e) { mFourMomentumX = px; mFourMomentumY = py; mFourMomentumZ = pz; mFourMomentumT = e; } + void setFourMomentum(TLorentzVector p4) { mFourMomentumX = p4.X(); mFourMomentumY = p4.Y(); mFourMomentumZ = p4.Z(); mFourMomentumT = p4.T(); } + +protected: + UShort_t mIndex=0; // Eventwise Hit Index + UShort_t mDetectorId=0; // DetectorId + UShort_t mId=0; // Id of the hit winthin a detectorId + Float_t mFourMomentumX=0.0; // Four momentum component X + Float_t mFourMomentumY=0.0; // Four momentum component Y + Float_t mFourMomentumZ=0.0; // Four momentum component Z + Float_t mFourMomentumT=0.0; // Four momentum component T + + ClassDef(StPicoFcsHit, 1) +}; + +#endif + From 61525da6d3206ad43d1a79b14d9a0813758cd469 Mon Sep 17 00:00:00 2001 From: Daniel Brandenburg Date: Thu, 8 Feb 2024 22:03:41 -0500 Subject: [PATCH 07/12] push FWD related branches to the end to maintain backward compat --- StRoot/StPicoEvent/StPicoArrays.cxx | 18 +++++++++--------- StRoot/StPicoEvent/StPicoArrays.h | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/StRoot/StPicoEvent/StPicoArrays.cxx b/StRoot/StPicoEvent/StPicoArrays.cxx index 5176b3edc67..3e493522ce0 100644 --- a/StRoot/StPicoEvent/StPicoArrays.cxx +++ b/StRoot/StPicoEvent/StPicoArrays.cxx @@ -25,11 +25,11 @@ const char* StPicoArrays::picoArrayNames [NAllPicoArrays] = { "Event", "BEmcSmdPHit", "ETofHit", "ETofPidTraits", + "McVertex", + "McTrack", "FwdTracks", "FcsHits", - "FcsClusters", - "McVertex", - "McTrack" + "FcsClusters" }; // ARRAY TYPES @@ -52,11 +52,11 @@ const char* StPicoArrays::picoArrayTypes [NAllPicoArrays] = { "StPicoEvent", "StPicoBEmcSmdPHit", "StPicoETofHit", "StPicoETofPidTraits", + "StPicoMcVertex", + "StPicoMcTrack", "StPicoFwdTrack", "StPicoFcsHit", - "StPicoFcsCluster", - "StPicoMcVertex", - "StPicoMcTrack" + "StPicoFcsCluster" }; // ARRAY SIZES @@ -82,11 +82,11 @@ int StPicoArrays::picoArraySizes [NAllPicoArrays] = { 1, // StPicoEvent 100, // StPicoBEmcSmdPHit 100, // StPicoETofHit 100, // StPicoETofPidTraits + 10, // StPicoMcVertex + 1000, // StPicoMcTrack 10, // StPicoFwdTrack 200, // StPicoFcsHit - 100, // StPicoFcsCluster - 10, // StPicoMcVertex - 1000 // StPicoMcTrack + 100 // StPicoFcsCluster }; //_________________ diff --git a/StRoot/StPicoEvent/StPicoArrays.h b/StRoot/StPicoEvent/StPicoArrays.h index 253df2d0ad8..a107091cdcd 100644 --- a/StRoot/StPicoEvent/StPicoArrays.h +++ b/StRoot/StPicoEvent/StPicoArrays.h @@ -33,8 +33,8 @@ class StPicoArrays { BTowHit, BTofHit, MtdHit, BbcHit, EpdHit, FmsHit, BEmcPidTraits, BTofPidTraits, MtdPidTraits, TrackCovMatrix, BEmcSmdEHit, BEmcSmdPHit, ETofHit, ETofPidTraits, - FwdTrack, FcsHit, FcsCluster, - McVertex, McTrack }; + McVertex, McTrack, + FwdTrack, FcsHit, FcsCluster }; }; #endif From 037647824381bc222f8cee852393da0db97a3092 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 13 Nov 2024 11:29:56 -0500 Subject: [PATCH 08/12] Apply suggestions from code review --- StRoot/StFwdTrackMaker/StFwdTrackMaker.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/StRoot/StFwdTrackMaker/StFwdTrackMaker.h b/StRoot/StFwdTrackMaker/StFwdTrackMaker.h index 99f23859065..dcacc13d1f5 100644 --- a/StRoot/StFwdTrackMaker/StFwdTrackMaker.h +++ b/StRoot/StFwdTrackMaker/StFwdTrackMaker.h @@ -182,8 +182,6 @@ class StFwdTrackMaker : public StMaker { void FillTTree(); // if debugging ttree is turned on (mGenTree) void FitVertex(); -<<<<<<< Updated upstream -======= static std::string defaultConfigIdealSim; static std::string defaultConfigData; std::string defaultConfig; @@ -359,7 +357,6 @@ class StFwdTrackMaker : public StMaker { * */ void setGeoCache( TString gc ) { mGeoCache = gc; } ->>>>>>> Stashed changes }; #endif From 9da379bb63156f309c7c53a291a825ec4b4f1004 Mon Sep 17 00:00:00 2001 From: Daniel Brandenburg Date: Fri, 31 Jan 2025 16:07:22 -0500 Subject: [PATCH 09/12] fix typo, assigning id sets index instead, add DCA / global / vtx index to FwdTrack --- StRoot/StPicoEvent/StPicoFcsHit.h | 4 ++-- StRoot/StPicoEvent/StPicoFwdTrack.h | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/StRoot/StPicoEvent/StPicoFcsHit.h b/StRoot/StPicoEvent/StPicoFcsHit.h index 073eae34c07..28e89575f12 100644 --- a/StRoot/StPicoEvent/StPicoFcsHit.h +++ b/StRoot/StPicoEvent/StPicoFcsHit.h @@ -25,7 +25,7 @@ class StPicoFcsHit : public TObject { virtual ~StPicoFcsHit(); virtual void Print(const Char_t *option = "") const; - Int_t index() const { return mId; } // Return unique Index of the hit + Int_t index() const { return mIndex; } // Return unique Index of the hit unsigned short detectorId() const { return mDetectorId; } Int_t id() const { return mId; } // Id of the hit winthin detectorId float energy() const { return mFourMomentumT; } // Energy @@ -33,7 +33,7 @@ class StPicoFcsHit : public TObject { void setIndex(int index) { mIndex = (UShort_t)index; } void setDetectorId(unsigned short detector) { mDetectorId=(UShort_t)detector; } - void setId(int id) { mIndex = (UShort_t)id; } + void setId(int id) { mId = (UShort_t)id; } void setFourMomentum(float px, float py, float pz, float e) { mFourMomentumX = px; mFourMomentumY = py; mFourMomentumZ = pz; mFourMomentumT = e; } void setFourMomentum(TLorentzVector p4) { mFourMomentumX = p4.X(); mFourMomentumY = p4.Y(); mFourMomentumZ = p4.Z(); mFourMomentumT = p4.T(); } diff --git a/StRoot/StPicoEvent/StPicoFwdTrack.h b/StRoot/StPicoEvent/StPicoFwdTrack.h index dec71f9c497..40fc99bdc0d 100644 --- a/StRoot/StPicoEvent/StPicoFwdTrack.h +++ b/StRoot/StPicoEvent/StPicoFwdTrack.h @@ -83,6 +83,14 @@ class StPicoFwdTrack : public TObject { Float_t mMomentumZ; /// convergence (0=no, 1=converge, 2=converge fully) UChar_t mStatus; + /// DCA to primary vertex (XY) + Float_t mDCAXY; + /// DCA to primary vertex (Z) + Float_t mDCAZ; + /// Index of primary vertex used in fit (primary tracks only) + UChar_t mVtxIndex; + /// Index of the corresponding Global Track if primary, else USHRT_MAX + UShort_t mGlobalTrackIndex; /// ecal match index std::vector mEcalMatchIndex; From 70080dc598e4577b89829bc760a9f57753baacda Mon Sep 17 00:00:00 2001 From: Daniel Brandenburg Date: Fri, 31 Jan 2025 19:13:20 -0500 Subject: [PATCH 10/12] assign missing data on FwdTracks, make cluster<->track association --- StRoot/StPicoDstMaker/StPicoDstMaker.h | 3 +++ StRoot/StPicoEvent/StPicoFcsCluster.h | 5 ++++- StRoot/StPicoEvent/StPicoFcsHit.cxx | 1 - StRoot/StPicoEvent/StPicoFwdTrack.h | 6 +++++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/StRoot/StPicoDstMaker/StPicoDstMaker.h b/StRoot/StPicoDstMaker/StPicoDstMaker.h index 0566fc85cd5..239d7452aa3 100644 --- a/StRoot/StPicoDstMaker/StPicoDstMaker.h +++ b/StRoot/StPicoDstMaker/StPicoDstMaker.h @@ -293,6 +293,9 @@ class StPicoDstMaker : public StMaker { /// Pointer to the array of BEMC tower hits StEmcRawHit* mEmcIndex[4800]; + /// Map of StPicoFcsCluster detId + Id to index in the array for track matching + std::map, int> mMapFcsIdPairIndex; + /// Magnetic field of the current event Float_t mBField; diff --git a/StRoot/StPicoEvent/StPicoFcsCluster.h b/StRoot/StPicoEvent/StPicoFcsCluster.h index 4160cef1040..529df8873a4 100644 --- a/StRoot/StPicoEvent/StPicoFcsCluster.h +++ b/StRoot/StPicoEvent/StPicoFcsCluster.h @@ -26,8 +26,9 @@ class StPicoFcsCluster : public TObject { virtual ~StPicoFcsCluster(); virtual void Print(const Char_t *option = "") const; + UShort_t index() const { return mIndex; } /// Return unique Id of the track - Int_t id() const { return mId; } + UShort_t id() const { return mId; } unsigned short detectorId() const { return mDetectorId; } int category() const { return mCategory; } int nTowers() const { return mNTowers; } @@ -41,6 +42,7 @@ class StPicoFcsCluster : public TObject { float chi2Ndf2Photon() const { return mChi2Ndf2Photon; } // chi^2/ndf for 2-photon fit to the cluster. const TLorentzVector fourMomentum() const { return TLorentzVector( mFourMomentumX, mFourMomentumY, mFourMomentumZ, mFourMomentumT ); } // Cluster four-momentum (px, py, pz, E) + void setIndex(int index) { mIndex = (UShort_t)index; } void setId(int cluid) { mId = (UShort_t)cluid; } void setDetectorId(unsigned short detector) { mDetectorId=(UShort_t)detector; } void setCategory(int catag) { mCategory = catag; } @@ -57,6 +59,7 @@ class StPicoFcsCluster : public TObject { void setFourMomentum(TLorentzVector p4) { mFourMomentumX = p4.X(); mFourMomentumY = p4.Y(); mFourMomentumZ = p4.Z(); mFourMomentumT = p4.T(); } protected: + UShort_t mIndex=0; // Eventwise cluster Index (unique across all detectors) UShort_t mId=0; // Eventwise cluster ID UShort_t mDetectorId=0; // Detector starts from 1 Int_t mCategory=0; // Category of cluster (see StMuFcsClusterCategory) diff --git a/StRoot/StPicoEvent/StPicoFcsHit.cxx b/StRoot/StPicoEvent/StPicoFcsHit.cxx index f372e59709d..699dfc19b3d 100644 --- a/StRoot/StPicoEvent/StPicoFcsHit.cxx +++ b/StRoot/StPicoEvent/StPicoFcsHit.cxx @@ -11,7 +11,6 @@ StPicoFcsHit::StPicoFcsHit() : TObject() { } StPicoFcsHit::StPicoFcsHit(const StPicoFcsHit &hit){ - mIndex=hit.mIndex; mDetectorId=hit.mDetectorId; mId=hit.mId; mFourMomentumX=hit.mFourMomentumX; diff --git a/StRoot/StPicoEvent/StPicoFwdTrack.h b/StRoot/StPicoEvent/StPicoFwdTrack.h index 40fc99bdc0d..a733ff06b2e 100644 --- a/StRoot/StPicoEvent/StPicoFwdTrack.h +++ b/StRoot/StPicoEvent/StPicoFwdTrack.h @@ -62,7 +62,11 @@ class StPicoFwdTrack : public TObject { void addHcalCluster( UChar_t index ) { mHcalMatchIndex.push_back(index); } /// Set index of the corresonding MC track void setMcTruth(Int_t index, Int_t qa) { mIdTruth = (UShort_t)index; mQATruth = (UShort_t)qa; } - + void setDca( Float_t dcaX, Float_t dcaY, Float_t dcaZ ) { mDCAXY =sqrt(dcaX*dcaX + dcaY*dcaY); mDCAZ = dcaZ; } + void setVtxIndex( UChar_t vtxIndex ) { mVtxIndex = vtxIndex; } + void setGlobalTrackIndex( UShort_t index ) { mGlobalTrackIndex = index; } + + protected: // Track quality and convergence From 4bb3b181d11c4f9cea7d8a7b95d18aab6ec2c178 Mon Sep 17 00:00:00 2001 From: Daniel Brandenburg Date: Fri, 31 Jan 2025 19:20:14 -0500 Subject: [PATCH 11/12] logic to fill matches between fcs clusters and fwd tracks --- StRoot/StPicoDstMaker/StPicoDstMaker.cxx | 45 +++++++++++++++++++++--- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/StRoot/StPicoDstMaker/StPicoDstMaker.cxx b/StRoot/StPicoDstMaker/StPicoDstMaker.cxx index ed454980217..bcffcda3963 100644 --- a/StRoot/StPicoDstMaker/StPicoDstMaker.cxx +++ b/StRoot/StPicoDstMaker/StPicoDstMaker.cxx @@ -42,6 +42,7 @@ #include "StEvent/StL0Trigger.h" #include "StEvent/StFwdTrackCollection.h" #include "StEvent/StFwdTrack.h" +#include "StEvent/StFcsCluster.h" #include "StMuDSTMaker/COMMON/StMuDst.h" #include "StMuDSTMaker/COMMON/StMuEvent.h" @@ -905,9 +906,9 @@ Int_t StPicoDstMaker::MakeWrite() { fillEpdHits(); fillBbcHits(); fillETofHits(); - fillFwdTracks(); fillFcsHits(); fillFcsClusters(); + fillFwdTracks(); // Could be a good idea to move this call to Init() or InitRun() StFmsDbMaker* fmsDbMaker = static_cast(GetMaker("fmsDb")); @@ -2527,8 +2528,19 @@ void StPicoDstMaker::fillFwdTracks() { LOG_ERROR << "null FwdTrackCollection" << endm; return; } + + // fill a map of picodst FCS clusters between index and the cluster pointer + map fcsClusterMap; + for ( size_t iClu = 0; iClu < mPicoArrays[StPicoArrays::FcsCluster]->GetEntries(); iClu++ ){ + StPicoFcsCluster * picoFcsCluster = (StPicoFcsCluster*)mPicoArrays[StPicoArrays::FcsCluster]->At(iClu); + fcsClusterMap[picoFcsCluster->index()] = picoFcsCluster; + } + + + + const StSPtrVecFwdTrack& evTracks = evc->tracks(); - LOG_INFO << "Adding " << evc->numberOfTracks() << " StMuFwdTracks to MuDSt" << endm; + LOG_INFO << "Adding " << evc->numberOfTracks() << " StFwdTracks from StEvent to PicoDst" << endm; for ( size_t i = 0; i < evc->numberOfTracks(); i++ ){ StFwdTrack * evTrack = evTracks[i]; StPicoFwdTrack picoFwdTrack; @@ -2536,6 +2548,30 @@ void StPicoDstMaker::fillFwdTracks() { picoFwdTrack.setNumberOfFitPoints( evTrack->numberOfFitPoints() * evTrack->charge() ); picoFwdTrack.setNumberOfSeedPoints( evTrack->numberOfSeedPoints() ); picoFwdTrack.setChi2( evTrack->chi2() ); + picoFwdTrack.setDca( evTrack->dca().x(), evTrack->dca().y(), evTrack->dca().z() ); + if ( evTrack->didFitConvergeFully()) + picoFwdTrack.setStatus( 2 ); + else if ( evTrack->didFitConverge()) + picoFwdTrack.setStatus( 1 ); + else + picoFwdTrack.setStatus( 0 ); + + picoFwdTrack.setMcTruth( evTrack->idTruth(), evTrack->qaTruth() ); + picoFwdTrack.setVtxIndex( evTrack->vertexIndex() ); + + // fill matched ecal and hcal clusters for the track + // ecal + for ( auto & cluster : evTrack->ecalClusters() ){ + int index = mMapFcsIdPairIndex[ make_pair( cluster->detectorId(), cluster->id() ) ]; + picoFwdTrack.addEcalCluster( index ); + } + // hcal + for ( auto & cluster : evTrack->hcalClusters() ){ + int index = mMapFcsIdPairIndex[ make_pair( cluster->detectorId(), cluster->id() ) ]; + picoFwdTrack.addHcalCluster( index ); + } + + int counter = mPicoArrays[StPicoArrays::FwdTrack]->GetEntries(); picoFwdTrack.setId( counter ); new((*(mPicoArrays[StPicoArrays::FwdTrack]))[counter]) StPicoFwdTrack(picoFwdTrack); @@ -2562,7 +2598,8 @@ void StPicoDstMaker::fillFcsClusters() { while ((muCluster = static_cast(next()))) { int counter = mPicoArrays[StPicoArrays::FcsCluster]->GetEntries(); StPicoFcsCluster picoFcsCluster; - picoFcsCluster.setId(counter); + picoFcsCluster.setId(muCluster->id()); + picoFcsCluster.setIndex(counter); picoFcsCluster.setDetectorId(muCluster->detectorId()); picoFcsCluster.setCategory(muCluster->category()); picoFcsCluster.setNTowers(muCluster->nTowers()); @@ -2579,6 +2616,7 @@ void StPicoDstMaker::fillFcsClusters() { StLorentzVectorD lv = fcsDb->getLorentzVector(xyz, muCluster->energy(), zVertex); picoFcsCluster.setFourMomentum(lv.px(),lv.py(),lv.pz(),lv.e()); new((*(mPicoArrays[StPicoArrays::FcsCluster]))[counter]) StPicoFcsCluster(picoFcsCluster); + mMapFcsIdPairIndex[ make_pair( muCluster->detectorId(), muCluster->id() ) ] = counter; } LOG_INFO << "StPicoDstMaker::fillFcsClusters filled " << mPicoArrays[StPicoArrays::FcsCluster]->GetEntries() << endm; }//fillFcsClusters @@ -2600,7 +2638,6 @@ void StPicoDstMaker::fillFcsHits() { while ((muHit = static_cast(next()))) { int counter = mPicoArrays[StPicoArrays::FcsHit]->GetEntries(); StPicoFcsHit picoFcsHit; - picoFcsHit.setIndex(counter); picoFcsHit.setDetectorId(muHit->detectorId()); picoFcsHit.setId(muHit->id()); double zVertex=picoDst()->event()->primaryVertex().z(); From 6437f2e1a3bfa2bd570d4465ed1d3c52612a2eee Mon Sep 17 00:00:00 2001 From: Daniel Brandenburg Date: Fri, 31 Jan 2025 19:21:17 -0500 Subject: [PATCH 12/12] add missing mGeoCache in StFwdTrackMaker, why is it missing? --- StRoot/StFwdTrackMaker/StFwdTrackMaker.h | 1 + 1 file changed, 1 insertion(+) diff --git a/StRoot/StFwdTrackMaker/StFwdTrackMaker.h b/StRoot/StFwdTrackMaker/StFwdTrackMaker.h index e04c158bb45..87c09de6e66 100644 --- a/StRoot/StFwdTrackMaker/StFwdTrackMaker.h +++ b/StRoot/StFwdTrackMaker/StFwdTrackMaker.h @@ -188,6 +188,7 @@ class StFwdTrackMaker : public StMaker { static std::string defaultConfigData; std::string defaultConfig; bool configLoaded = false; + TString mGeoCache; // Helper functions for modifying configuration // NOTE: to override configuration, call individual functions after setConfigForXXX