Skip to content

Commit

Permalink
logic to fill matches between fcs clusters and fwd tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
jdbrice committed Feb 1, 2025
1 parent 70080dc commit 4bb3b18
Showing 1 changed file with 41 additions and 4 deletions.
45 changes: 41 additions & 4 deletions StRoot/StPicoDstMaker/StPicoDstMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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<StFmsDbMaker*>(GetMaker("fmsDb"));
Expand Down Expand Up @@ -2527,15 +2528,50 @@ void StPicoDstMaker::fillFwdTracks() {
LOG_ERROR << "null FwdTrackCollection" << endm;
return;
}

// fill a map of picodst FCS clusters between index and the cluster pointer
map<UShort_t, StPicoFcsCluster*> 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;
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() );
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);
Expand All @@ -2562,7 +2598,8 @@ void StPicoDstMaker::fillFcsClusters() {
while ((muCluster = static_cast<StMuFcsCluster*>(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());
Expand All @@ -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
Expand All @@ -2600,7 +2638,6 @@ void StPicoDstMaker::fillFcsHits() {
while ((muHit = static_cast<StMuFcsHit*>(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();
Expand Down

0 comments on commit 4bb3b18

Please sign in to comment.