Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
p3pi_hists/DCustomAction_HistOmegaVsMissProton.cc
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DCustomAction_HistOmegaVsMissProton.cc
4 // Created: Sun Jun 28 22:48:32 EDT 2015
5 // Creator: pmatt (on Darwin Pauls-MacBook-Pro-2.local 13.4.0 i386)
6 //
7 
9 
11 {
12  //Optional: Create histograms and/or modify member variables.
13  //Create any histograms/trees/etc. within a ROOT lock.
14  //This is so that when running multithreaded, only one thread is writing to the ROOT file at a time.
15 
16  //CREATE THE HISTOGRAMS
17  //Since we are creating histograms, the contents of gDirectory will be modified: must use JANA-wide ROOT lock
18  japp->RootWriteLock(); //ACQUIRE ROOT LOCK!!
19  {
20  // Optional: Useful utility functions.
21  locEventLoop->GetSingle(dAnalysisUtilities);
22 
23  //Required: Create a folder in the ROOT output file that will contain all of the output ROOT objects (if any) for this action.
24  //If another thread has already created the folder, it just changes to it.
26 
27  // (Optional) Example: Create a histogram.
28  // This function will return the histogram if already created by another thread. If not pre-existing, it will create and return it.
29  // Function arguments are identical to those used for the histogram constructors
30  string locHistTitle = ";#it{#gamma}#it{p}#rightarrow#it{#pi}^{+}#it{#pi}^{-}#it{#gamma}#it{#gamma} Missing Mass (GeV/c^{2})";
31  locHistTitle += string(";#it{#pi}^{+}#it{#pi}^{-}#it{#gamma}#it{#gamma} Invariant Mass (GeV/c^{2})");
32  dHist_OmegaVsMissProton = GetOrCreate_Histogram<TH2I>("OmegaVsMissProton", locHistTitle, 325, 0.3, 1.6, 300, 0.5, 1.1);
33 
34  //Return to the base directory
36  }
37  japp->RootUnLock(); //RELEASE ROOT LOCK!!
38 }
39 
40 bool DCustomAction_HistOmegaVsMissProton::Perform_Action(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo)
41 {
42  //no duplicate entries: missing p4 is unique for each combo
43  DLorentzVector locMissingP4 = dAnalysisUtilities->Calc_MissingP4(Get_Reaction(), locParticleCombo, false);
44  DLorentzVector locOmegaP4 = dAnalysisUtilities->Calc_FinalStateP4(Get_Reaction(), locParticleCombo, 1, false);
45 
46  //FILL HISTOGRAMS
47  //Since we are filling histograms local to this action, it will not interfere with other ROOT operations: can use action-wide ROOT lock
48  //Note, the mutex is unique to this DReaction + action_string combo: actions of same class with different hists will have a different mutex
49  Lock_Action(); //ACQUIRE ROOT LOCK!!
50  {
51  dHist_OmegaVsMissProton->Fill(locMissingP4.M(), locOmegaP4.M());
52  }
53  Unlock_Action(); //RELEASE ROOT LOCK!!
54 
55  return true; //return false if you want to use this action to apply a cut (and it fails the cut!)
56 }
TDirectoryFile * ChangeTo_BaseDirectory(void)
const DReaction * Get_Reaction(void) const
char string[256]
TDirectoryFile * CreateAndChangeTo_ActionDirectory(void)
TLorentzVector DLorentzVector
JApplication * japp
DLorentzVector Calc_FinalStateP4(const DReaction *locReaction, const DParticleCombo *locParticleCombo, size_t locStepIndex, bool locUseKinFitDataFlag) const
DLorentzVector Calc_MissingP4(const DReaction *locReaction, const DParticleCombo *locParticleCombo, bool locUseKinFitDataFlag) const
bool Perform_Action(JEventLoop *locEventLoop, const DParticleCombo *locParticleCombo)