Difference between revisions of "Analysis FAQ"

From GlueXWiki
Jump to: navigation, search
Line 18: Line 18:
 
if(locNeutralShower->dDetectorSystem == SYS_BCAL)
 
if(locNeutralShower->dDetectorSystem == SYS_BCAL)
 
   locNeutralShower->GetSingle(locBCALShower);
 
   locNeutralShower->GetSingle(locBCALShower);
 +
</syntaxhighlight>
 +
 +
== Histogramming ==
 +
 +
* How do I manually create and fill a histogram in processor in a way that is thread-safe?
 +
 +
<syntaxhighlight>
 +
//In your processor class definition (in your processor header file):
 +
TH1D* dMyHist;
 +
 +
//
 +
2) dMyHist = new TH1D(...); in init()
 +
3) dMyHist->Fill(); in evnt();
 +
</syntaxhighlight>
 +
 +
== Cuts ==
 +
 +
* How do I place a cut prior to kinematic fitting?
 +
** Answer: Add an analysis action to the DReaction that performs the cut. It should be added prior to any action that uses the kinematic fit results. If no action uses the fit results, then it can be added anywhere.
 +
 +
<syntaxhighlight>
 +
  //place cut on pi0 invariant mass (assuming a Pi0 decay step is defined in your DReaction):
 +
      //the false means "used measured data" as opposed to kinfit data
 +
      //0.04 and 0.24 specify the minimum and maximum invariant mass
 +
  locReaction->Add_AnalysisAction(new DCutAction_InvariantMass(locReaction, Pi0, false, 0.04, 0.24)); //does not require kinfit results
 +
  locReaction->Add_AnalysisAction(new DHistogramAction_KinFitResults(locReaction, 0.05)); //requires kinfit results
 +
  //Thus, the kinematic fit is performed between execution of these actions. If a combo fails a cut prior to the kinfit, then it is not performed for that combo.
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 13:25, 18 July 2014

Neutrals

  • Given a DNeutralParticleHypothesis or DNeutralShower object, how do I get the FCAL/BCAL shower objects?
    • Answer: By calling the inherited JObject::GetSingle() function:
//given a hypothesis, get the neutral shower:
const DNeutralShower* locNeutralShower = NULL;
locNeutralParticleHypothesis->GetSingle(locNeutralShower);
 
//given a neutral shower, get the BCAL shower:
const DFCALShower* locFCALShower = NULL;
if(locNeutralShower->dDetectorSystem == SYS_FCAL)
   locNeutralShower->GetSingle(locFCALShower);
 
//given a neutral shower, get the FCAL shower:
const DBCALShower* locBCALShower = NULL;
if(locNeutralShower->dDetectorSystem == SYS_BCAL)
   locNeutralShower->GetSingle(locBCALShower);

Histogramming

  • How do I manually create and fill a histogram in processor in a way that is thread-safe?
//In your processor class definition (in your processor header file):
TH1D* dMyHist;
 
//
2) dMyHist = new TH1D(...); in init()
3) dMyHist->Fill(); in evnt();

Cuts

  • How do I place a cut prior to kinematic fitting?
    • Answer: Add an analysis action to the DReaction that performs the cut. It should be added prior to any action that uses the kinematic fit results. If no action uses the fit results, then it can be added anywhere.
   //place cut on pi0 invariant mass (assuming a Pi0 decay step is defined in your DReaction): 
      //the false means "used measured data" as opposed to kinfit data
      //0.04 and 0.24 specify the minimum and maximum invariant mass
   locReaction->Add_AnalysisAction(new DCutAction_InvariantMass(locReaction, Pi0, false, 0.04, 0.24)); //does not require kinfit results
   locReaction->Add_AnalysisAction(new DHistogramAction_KinFitResults(locReaction, 0.05)); //requires kinfit results
   //Thus, the kinematic fit is performed between execution of these actions. If a combo fails a cut prior to the kinfit, then it is not performed for that combo.