// $Id$ // // File: DCustomAction_HistOmegaMVsOmegaP.cc // Created: Sun Jun 28 22:48:32 EDT 2015 // Creator: pmatt (on Darwin Pauls-MacBook-Pro-2.local 13.4.0 i386) // #include "DCustomAction_HistOmegaMVsOmegaP.h" void DCustomAction_HistOmegaMVsOmegaP::Initialize(JEventLoop* locEventLoop) { //Optional: Create histograms and/or modify member variables. //Create any histograms/trees/etc. within a ROOT lock. //This is so that when running multithreaded, only one thread is writing to the ROOT file at a time. japp->RootWriteLock(); //ACQUIRE ROOT LOCK!! { // Optional: Useful utility functions. locEventLoop->GetSingle(dAnalysisUtilities); //Required: Create a folder in the ROOT output file that will contain all of the output ROOT objects (if any) for this action. //If another thread has already created the folder, it just changes to it. CreateAndChangeTo_ActionDirectory(); // (Optional) Example: Create a histogram. // This function will return the histogram if already created by another thread. If not pre-existing, it will create and return it. // Function arguments are identical to those used for the histogram constructors string locHistTitle = ";#it{B}#rightarrow#it{#pi}^{0}#it{#gamma}#it{#gamma} P (GeV/c)"; locHistTitle += string(";#it{B}#rightarrow#it{#pi}^{0}#it{#gamma}#it{#gamma} Inv. Mass (GeV/c^{2})"); dHist_OmegaMVsOmegaP = GetOrCreate_Histogram("OmegaMVsOmegaP", locHistTitle, 1200, 0., 12., 1500, 0., 1.5); } japp->RootUnLock(); //RELEASE ROOT LOCK!! } bool DCustomAction_HistOmegaMVsOmegaP::Perform_Action(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo) { //no duplicate entries: missing p4 is unique for each combo //DLorentzVector locMissingP4 = dAnalysisUtilities->Calc_MissingP4(locParticleCombo, false); DLorentzVector locOmegaP4 = dAnalysisUtilities->Calc_FinalStateP4(locParticleCombo, 1, false); //Optional: Fill histograms japp->RootWriteLock(); //ACQUIRE ROOT LOCK!! { dHist_OmegaMVsOmegaP->Fill(locOmegaP4.P(), locOmegaP4.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!) }