#include "DCustomAction_BVsEta_hists.h" void DCustomAction_BVsEta_hists::Initialize(JEventLoop* locEventLoop) { //CREATE THE HISTOGRAMS //Since we are creating histograms, the contents of gDirectory will be modified: must use JANA-wide ROOT lock japp->RootWriteLock(); //ACQUIRE ROOT LOCK!! { CreateAndChangeTo_ActionDirectory(); dM_BVsEta = GetOrCreate_Histogram("dM_BVsEta", "M(B) vs M(#eta); M_{#eta} [GeV/c^{2}]; M(B) [GeV/c^{2}]", 1000, 0.0 , 1.0, 1000, 0., 1.); } japp->RootUnLock(); //RELEASE ROOT LOCK!! } bool DCustomAction_BVsEta_hists::Perform_Action(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo) { //const DParticleComboStep* locParticleComboStep = locParticleCombo->Get_ParticleComboStep(1); // calculate masses DLorentzVector locBboson = locParticleCombo->Get_ParticleComboStep(1)->Get_FinalParticle_Measured(0)->lorentzMomentum(); DLorentzVector locEta = locParticleCombo->Get_ParticleComboStep(1)->Get_FinalParticle_Measured(1)->lorentzMomentum(); japp->RootWriteLock(); //ACQUIRE ROOT LOCK!! { // Fill histograms here dM_BVsEta->Fill(locEta.M(),locBboson.M()); } japp->RootUnLock(); //RELEASE ROOT LOCK!! return true; //return false if you want to use this action to apply a cut (and it fails the cut!) }