Reading minimc tree

Skeleton structure to read minimc tree:

 

void readMinimc()
{
    gROOT->Macro("${STAR}/StRoot/StMuDSTMaker/COMMON/macro/loadSharedLibraries.C");
    gSystem->Load("StMiniMcEvent");
    gSystem->Load("StEmbeddingUtilities");
   
    TFile f(pathFileName);
    TTree* mTree = (TTree*)f.Get("StMiniMcTree");
    if ((!mTree)) continue;
           
    StMiniMcEvent* mMiniMcEvent = new StMiniMcEvent();
    TBranch* b_MiniMcEvent = mTree->GetBranch("StMiniMcEvent");
    b_MiniMcEvent->SetAddress(&mMiniMcEvent);
   
    int nEntries = (int)mTree->GetEntries();

    StEmbeddingQAUtilities* utility = StEmbeddingQAUtilities::instance();
    const TString name(utility->getCategoryName(1));

    for (int iEvent=0;iEvent<nEntries;iEvent++)
    {
        mTree->GetEntry(iEvent);
       
        int nTrack=mMiniMcEvent->nMatchedPair();
       
        for(int itrk=0; itrk<nTrack; itrk++)
        {
            StMiniMcPair* miniPair=(StMiniMcPair*)mMiniMcEvent->tracks(1)->At(itrk);//1 is for MatchedPairs
           
            StEmbeddingQATrack* track=new StEmbeddingQATrack(name,miniPair);
           
            //miniPair->geantId()==geantId;
            //track->getNHit();
            //track->getNCommonHit();
            //track->getDcaGl();
            //track->getVectorGl().perp();
            //track->getPtMc();
        }
    }
}