Difference between revisions of "Mattione GlueX Analysis Factories"
From GlueXWiki
Line 20: | Line 20: | ||
int <span style="color:#0000FF">dMissingParticleIndex</span>; //-1 for no missing particles, else final state particle at this index is missing (0 -> x) | int <span style="color:#0000FF">dMissingParticleIndex</span>; //-1 for no missing particles, else final state particle at this index is missing (0 -> x) | ||
deque<Particle_t> <span style="color:#0000FF">dFinalParticleIDs</span>; | deque<Particle_t> <span style="color:#0000FF">dFinalParticleIDs</span>; | ||
+ | }; | ||
+ | |||
+ | |||
+ | == DTrackCombo == | ||
+ | * Will be located in src/libraries/ANALYSIS | ||
+ | * <span style="color:#0000FF">DTrackCombo_factory</span>: Generates a DTrackCombo object for each possible combination of detected tracks and DBeamPhotons (configurable time cut used to eliminate way-out-of-time photons). | ||
+ | ** PID is NOT assumed, all possibilities are tested: For each q = +/-/0 particle in a given DReaction, all detected q = +/-/0 tracks are tested as to whether or not they are that particle. | ||
+ | * <span style="color:#0000FF">DKinFitResults_factory</span>: Performs a single, full kinematic fit testing whether each DTrackCombo matches the DReaction: includes all mass, vertex, timing constraints. | ||
+ | * <span style="color:#0000FF">DTrackCombo_factory_KinFit</span>: Create new DTrackCombo objects, using the kinematic fit track information and results. | ||
+ | |||
+ | class <span style="color:#0000FF">DTrackCombo</span> : public <span style="color:#0000FF">JObject</span> | ||
+ | { | ||
+ | private: | ||
+ | const DReaction* <span style="color:#0000FF">dReaction</span>; | ||
+ | deque<const DTrackComboStep*> <span style="color:#0000FF">dTrackComboSteps</span>; | ||
+ | deque<const DChargedTrack*> <span style="color:#0000FF">dUnusedPositiveTracks</span>; | ||
+ | deque<const DChargedTrack*> <span style="color:#0000FF">dUnusedNegativeTracks</span>; | ||
+ | deque<const DNeutralShower*> <span style="color:#0000FF">dUnusedNeutralShowers</span>; | ||
+ | }; | ||
+ | |||
+ | class <span style="color:#0000FF">DTrackComboStep</span> | ||
+ | { | ||
+ | private: | ||
+ | <span style="color:#0000FF">//PIDS:</span> | ||
+ | Particle_t <span style="color:#0000FF">dInitialParticleID</span>; //e.g. lambda, phi, gamma | ||
+ | Particle_t <span style="color:#0000FF">dTargetParticleID</span>; //Unknown for no target | ||
+ | deque<Particle_t> <span style="color:#0000FF">dFinalParticleIDs</span>; | ||
+ | |||
+ | <span style="color:#0000FF">//INITIAL PARTICLES:</span> | ||
+ | DKinematicData* <span style="color:#0000FF">dInitialParticle</span>; //kinfit result, else measured | ||
+ | DKinematicData* <span style="color:#0000FF">dInitialParticle_Measured</span>; //e.g. DBeamPhoton | ||
+ | DKinematicData* <span style="color:#0000FF">dTargetParticle</span>; //NULL for no target | ||
+ | |||
+ | <span style="color:#0000FF">//FINAL PARTICLES:</span> | ||
+ | deque<const DKinematicData*> <span style="color:#0000FF">dFinalParticles</span>; //kinfit result, else measured //e.g. DChargedTrackHypothesis, DNeutralParticleHypothesis | ||
+ | deque<const DKinematicData*> <span style="color:#0000FF">dFinalParticles_Measured</span>; //e.g. DChargedTrackHypothesis, DNeutralParticleHypothesis | ||
+ | deque<const JObject*> <span style="color:#0000FF">dFinalParticleSourceObjects</span>; //original DChargedTrack or DNeutralShower objects | ||
+ | |||
+ | <span style="color:#0000FF">//CONTROL VARIABLES:</span> | ||
+ | int <span style="color:#0000FF">dInitialParticleDecayFromStepIndex</span>; //points to which DTrackComboStep represents the production of the initial particle (e.g. Lambda) | ||
+ | deque<int> <span style="color:#0000FF">dDecayStepIndices</span>; //let's you know whether a final state particle is decaying, missing, or detected. if decaying, points to which DTrackComboStep represents its decay | ||
+ | }; | ||
+ | |||
+ | == User Plugin DAnalysis Factory == | ||
+ | |||
+ | == User Plugin DEventProcessor == | ||
+ | |||
+ | extern "C" | ||
+ | { | ||
+ | void InitPlugin(JApplication *app) | ||
+ | { | ||
+ | InitJANAPlugin(app); | ||
+ | app->AddProcessor(new DEventProcessor_Y2175()); | ||
+ | <span style="color:#0000FF">app->AddFactoryGenerator(new DFactoryGenerator_DReaction());</span> | ||
+ | } | ||
+ | } // "C" | ||
+ | |||
+ | jerror_t DEventProcessor_Y2175::evnt(JEventLoop *locEventLoop, int eventnumber) | ||
+ | { | ||
+ | vector<const DAnalysisResults*> locAnalysisResultsVector; | ||
+ | locEventLoop->Get(locAnalysisResultsVector); | ||
+ | |||
+ | //SAVE OUTPUT HERE | ||
+ | |||
+ | return NOERROR; | ||
+ | } | ||
+ | |||
+ | == Cutting/Histogramming == | ||
+ | * Coming Soon... | ||
+ | |||
+ | //execute the contained action for each DTrackCombo of the given DReaction that has passed all previous cuts. | ||
+ | class <span style="color:#0000FF">DAnalysisAction</span> | ||
+ | { | ||
+ | public: | ||
+ | //returns true/false if passes/fails cut/eval/etc, respectively | ||
+ | virtual bool <span style="color:#0000FF">operator()</span>(JEventLoop* locEventLoop, map<const DTrackCombo*, bool>& locTrackComboCutStatus, deque<const JObject*>& locNewObjects) = 0; | ||
+ | protected: | ||
+ | DReaction* <span style="color:#0000FF">dReaction</span>; //tells it to ignore DTrackCombo objects from other reactions | ||
}; | }; | ||
Line 113: | Line 191: | ||
return NOERROR; | return NOERROR; | ||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Tupling == | == Tupling == | ||
* Haven't really gotten this far yet... | * Haven't really gotten this far yet... |
Revision as of 15:07, 12 August 2012
Contents
Summary
- In his/her plugin, a user specifies the reactions he/she wants to study (DReaction objects), then just asks JANA for the results (DTrackCombo objects).
- Creates all possible track combinations for the desired reaction; user then cuts on the likelihood that those combinations represent the hypothesized reaction.
DReaction
class DReaction : public JObject { private: string dReactionName; //must be unique: e.g. "Y2175" deque<DReactionStep*> dReactionSteps; unsigned short int dFitTypeFlag; //0 is none, 1 is p4 only, 2 is p4 & v, 3 is p4, v, & t deque<size_t> dDecayingParticlesExcludedFromKinfit; //to exclude decaying particles from the kinematic fit (resonances are automatically excluded) };
class DReactionStep { private: Particle_t dInitialParticleID; //e.g. lambda, phi, gamma Particle_t dTargetParticleID; //Unknown for no target int dMissingParticleIndex; //-1 for no missing particles, else final state particle at this index is missing (0 -> x) deque<Particle_t> dFinalParticleIDs; };
DTrackCombo
- Will be located in src/libraries/ANALYSIS
- DTrackCombo_factory: Generates a DTrackCombo object for each possible combination of detected tracks and DBeamPhotons (configurable time cut used to eliminate way-out-of-time photons).
- PID is NOT assumed, all possibilities are tested: For each q = +/-/0 particle in a given DReaction, all detected q = +/-/0 tracks are tested as to whether or not they are that particle.
- DKinFitResults_factory: Performs a single, full kinematic fit testing whether each DTrackCombo matches the DReaction: includes all mass, vertex, timing constraints.
- DTrackCombo_factory_KinFit: Create new DTrackCombo objects, using the kinematic fit track information and results.
class DTrackCombo : public JObject { private: const DReaction* dReaction; deque<const DTrackComboStep*> dTrackComboSteps; deque<const DChargedTrack*> dUnusedPositiveTracks; deque<const DChargedTrack*> dUnusedNegativeTracks; deque<const DNeutralShower*> dUnusedNeutralShowers; };
class DTrackComboStep { private: //PIDS: Particle_t dInitialParticleID; //e.g. lambda, phi, gamma Particle_t dTargetParticleID; //Unknown for no target deque<Particle_t> dFinalParticleIDs; //INITIAL PARTICLES: DKinematicData* dInitialParticle; //kinfit result, else measured DKinematicData* dInitialParticle_Measured; //e.g. DBeamPhoton DKinematicData* dTargetParticle; //NULL for no target //FINAL PARTICLES: deque<const DKinematicData*> dFinalParticles; //kinfit result, else measured //e.g. DChargedTrackHypothesis, DNeutralParticleHypothesis deque<const DKinematicData*> dFinalParticles_Measured; //e.g. DChargedTrackHypothesis, DNeutralParticleHypothesis deque<const JObject*> dFinalParticleSourceObjects; //original DChargedTrack or DNeutralShower objects //CONTROL VARIABLES: int dInitialParticleDecayFromStepIndex; //points to which DTrackComboStep represents the production of the initial particle (e.g. Lambda) deque<int> dDecayStepIndices; //let's you know whether a final state particle is decaying, missing, or detected. if decaying, points to which DTrackComboStep represents its decay };
User Plugin DAnalysis Factory
User Plugin DEventProcessor
extern "C"
{
void InitPlugin(JApplication *app)
{
InitJANAPlugin(app);
app->AddProcessor(new DEventProcessor_Y2175());
app->AddFactoryGenerator(new DFactoryGenerator_DReaction());
}
} // "C"
jerror_t DEventProcessor_Y2175::evnt(JEventLoop *locEventLoop, int eventnumber)
{
vector<const DAnalysisResults*> locAnalysisResultsVector;
locEventLoop->Get(locAnalysisResultsVector);
//SAVE OUTPUT HERE
return NOERROR;
}
Cutting/Histogramming
- Coming Soon...
//execute the contained action for each DTrackCombo of the given DReaction that has passed all previous cuts. class DAnalysisAction { public: //returns true/false if passes/fails cut/eval/etc, respectively virtual bool operator()(JEventLoop* locEventLoop, map<const DTrackCombo*, bool>& locTrackComboCutStatus, deque<const JObject*>& locNewObjects) = 0; protected: DReaction* dReaction; //tells it to ignore DTrackCombo objects from other reactions };
User Plugin DReaction Factory
- DReaction.h located in DANA libraries, DReaction_factory.h located in user plugin (along with a factory generator for it).
- Below shows how to set up DReaction for a Y(2175) analysis.
//------------------ // init //------------------ jerror_t DReaction_factory::init(void) { // Setting the PERSISTANT prevents JANA from deleting // the objects every event so we only create them once. SetFactoryFlag(PERSISTANT); DReaction* locReaction; DReactionStep* locReactionStep; // Make as many DReaction objects as desired locReaction = new DReaction(); locReaction->Set_ReactionName("Y2175"); locReaction->Set_FitTypeFlag(3); //kinfit p4, v, & t simultaneously (0 is no kinfit) //g, p -> phi(2175), (p) locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(Gamma); locReactionStep->Set_TargetParticleID(Proton); locReactionStep->Add_FinalParticleID(Unknown); //phi(2175) locReactionStep->Add_FinalParticleID(Proton); locReactionStep->Set_MissingParticleIndex(1); //proton missing locReaction->Add_ReactionStep(locReactionStep); dReactionStepPool.push_back(locReactionStep); //prevent memory leak //phi(2175) -> pi+, pi-, phi locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(Unknown); //phi(2175) locReactionStep->Set_TargetParticleID(Unknown); //no target for this step locReactionStep->Add_FinalParticleID(PiPlus); locReactionStep->Add_FinalParticleID(PiMinus); locReactionStep->Add_FinalParticleID(phiMeson); locReactionStep->Set_MissingParticleIndex(-1); //none missing locReaction->Add_ReactionStep(locReactionStep); dReactionStepPool.push_back(locReactionStep); //prevent memory leak //phi -> K+, K- locReactionStep = new DReactionStep(); locReactionStep->Set_InitialParticleID(Unknown); //phi(2175) locReactionStep->Set_TargetParticleID(Unknown); //no target for this step locReactionStep->Add_FinalParticleID(KPlus); locReactionStep->Add_FinalParticleID(KMinus); locReactionStep->Set_MissingParticleIndex(-1); //none missing locReaction->Add_ReactionStep(locReactionStep); dReactionStepPool.push_back(locReactionStep); //prevent memory leak //Track reconstruction quality/multiplicity dReaction->Add_AnalysisAction(new DHistogramFunctor_TrackMultiplicity()); dReaction->Add_AnalysisAction(new DHistogramFunctor_GenReconTrackComparison()); //Vertex reconstruction and cuts of tracks with bogus vertex-z dReaction->Add_AnalysisAction(new DHistogramFunctor_TrackComboKinematics(1)); //1: initial data dReaction->Add_AnalysisAction(new DCutFunctor_AllVertexZ(45.0, 85.0)); dReaction->Add_AnalysisAction(new DHistogramFunctor_TrackVertexComparison()); //PID dReaction->Add_AnalysisAction(new DHistogramFunctor_PID()); dReaction->Add_AnalysisAction(new DCutFunctor_AllPID(0.01, 1)); //1%, all charged tracks dReaction->Add_AnalysisAction(new DHistogramFunctor_TruePID()); //Phi Invariant Mass Cut & PID Check dReaction->Add_AnalysisAction(new DHistogramFunctor_PhiMass(1)); //1: initial data dReaction->Add_AnalysisAction(new DCutFunctor_InvariantMass(phiMeson, 1, 1.004, 1.04)); //~3sigma dReaction->Add_AnalysisAction(new DHistogramFunctor_TruePID()); //Initial Proton and Y2175 Mass Distributions dReaction->Add_AnalysisAction(new DHistogramFunctor_ProtonMass(1)); //1: initial data dReaction->Add_AnalysisAction(new DHistogramFunctor_Phi2175Mass(1)); //1: initial data //Missing Proton Kinematic Fit dReaction->Add_AnalysisAction(new DHistogramFunctor_KinFitResults(0.1)); dReaction->Add_AnalysisAction(new DCutFunctor_KinFitFOM(0.01); //1% //Final Proton and Y2175 Mass Distributions dReaction->Add_AnalysisAction(new DHistogramFunctor_ProtonMass(1)); //1: initial data dReaction->Add_AnalysisAction(new DHistogramFunctor_Phi2175Mass(1)); //1: initial data dReaction->Add_AnalysisAction(new DHistogramFunctor_Phi2175Mass(2)); //2: final data //Final track kinematics & PID Check dReaction->Add_AnalysisAction(new DHistogramFunctor_TrackComboKinematics(2)); //2: final data dReaction->Add_AnalysisAction(new DHistogramFunctor_TruePID()); _data.push_back(locReaction); return NOERROR; }
Tupling
- Haven't really gotten this far yet...