Preliminary Bemc Energy reconstruction (Simulated events)

Preliminary Bemc Energy reconstruction (Simulated events)

I am studying the production of neutral and charged pions in Au + Au collision at 11.5 GeV at simulated events. At present, my intention is to reconstruction the pi0 energy in BEMC.
I'm simulating events by HIJING / STARSIM and reconstructing by BFC using the following chain:

chain=3Dfzin,tpcRS,y2014a,AgML,usexgeom,FieldOn,MakeEvent,Sti,NoSsdIt,NoSvtIt,StiHftC,TpcHitMover,TpxClu,Idst,BAna,l0,Tree,logger,genvtx,tpcDB,bbcSim,btofsim,mtdSim,tags,emcY2,EEfs,evout,geantout,-dstout,IdTruth,big,clearmem,tables.

Then, I have .geant., .event. and .MuDst.  root files and I use the following file.C to active the branches and analyse my events.

Finally, I have my .root with BEMC energy histogram. But this histogram, in my view, should be "centralized" at zero.

---------------------------------------------------------------------------------------------------------------------------------------------

root4star << EOF
.x run_StMcAnalysisMaker.C("$inFileGEANT","$inFileMuDST","$outFile1");
.q
EOF

----------------------------------------------------  run_StMcAnalysisMaker.C  ---------------------------------------------------------------------------------

class StMyMcMaker;
void run_StMcAnalysisMaker(const char* geantfile, const char* file, const char* outfile) 
{
    Load();
 
    // Create chain
    StChain* chain = new StChain;
 
  // I/O maker
  StIOMaker* ioMaker = new StIOMaker;
  ioMaker->SetFile(geantfile);
  ioMaker->SetIOMode("r");
  ioMaker->SetBranch("*",0,"0");             // Deactivate all branches
  ioMaker->SetBranch("geantBranch",0,"r");   // Activate geant branch
  ioMaker->SetBranch("eventBranch",0,"r");   // Activate event branch
      
  // Instantiate the MuDstReader
  TString mudstfile = file;
  mudstfile.ReplaceAll(".event.root",".MuDst.root");
  mudstfile.ReplaceAll(".geant.root",".MuDst.root");
  StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,"",mudstfile.Data()," ",1000000,"MuDst");
 
  // STAR database
   
  St_db_Maker *dbMk = new St_db_Maker("db","MySQL:StarDb","$STAR/StarDb","StarDb");
 
  // MC event maker
  StMcEventMaker* mcEvent = new StMcEventMaker;
  mcEvent->doPrintEventInfo = false;
  mcEvent->doPrintMemoryInfo = false;
  mcEventReader->doUseTpc = true;
  mcEventReader->doUseBemc = true;
 
 
  // EMC simulator
   StEmcSimulatorMaker* emcSim = new StEmcSimulatorMaker;
 
  // TPC assocation maker
  StAssociationMaker* assoc = new StAssociationMaker;
  assoc->useInTracker();
 
  // EMC association maker
  // StEmcAssociationMaker* emcAssociation = new StEmcAssociationMaker;
 
    // My analysis maker
    cout << "INIT MY MAKER" << endl;
     gSystem->Load("StMyMcMaker"); 
     StMyMcMaker *my = new StMyMcMaker(outfile);
     my->mFile=outfile;
    cout << "FINISH MY MAKER" << endl;
    // Initialize chain
   cout << "Starting up the chain..." << endl;
   chain->Init();
    cout << "Looping over events..." << endl;
    int ntotal = 100;
    Int_t stat  = 0;
    Int_t total = 0;
    for(int iev = 0; iev < ntotal; ++iev)
    {
 
        cout << "******************************************" << endl;
        cout << "Processing Event: " << iev << endl;
        cout << "******************************************" << endl;
 
        chain->Clear();
        stat = chain->Make();
        
        if(stat) 
        {
            cout << "Bad return code!" << endl;
            break;
        }
        
        ++total;
 
    }
    chain->Finish(); 
    
    cout << "****************************************** " << endl;
    cout << total << " Total Events" << endl;
    cout << "****************************************** " << endl;
 
    return;
}
 
void Load() {
    gROOT->Macro("loadMuDst.C");
    gROOT->Macro("LoadLogger.C");
    gSystem->Load("StMcEvent");
    gSystem->Load("StMcEventMaker");
    gSystem->Load("StAssociationMaker");
    gSystem->Load("StDbLib.so");
    gSystem->Load("StDbBroker.so");
    gSystem->Load("libglobal_Tables.so");
    gSystem->Load("St_db_Maker.so");
    gSystem->Load("StDetectorDbMaker");
    gSystem->Load("StTpcDb");
    gSystem->Load("StDbUtilities");
    gSystem->Load("StMcAnalysisMaker");
    gSystem->Load("StEmcRawMaker");
    gSystem->Load("StEmcADCtoEMaker");
    gSystem->Load("StPreEclMaker");
    gSystem->Load("StEpcMaker");
    gSystem->Load("StEmcSimulatorMaker");
    gSystem->Load("StEmcUtil");
    gSystem->Load("StEEmcUtil");
    gSystem->Load("StEEmcDbMaker");
    gSystem->Load("StEmcTriggerMaker");
    gSystem->Load("StTriggerUtilities");
    gSystem->Load("StEEmcUtil");
    gSystem->Load("StMyMcMaker");
}

---------------------------------------------------------------------------------------------------------------------