Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:13:25

0001 // ----------------------------------------------------------------------------
0002 /*! \file    TriggerClusterTupleMaker.h'
0003  *  \authors Derek Anderson
0004  *  \date    06.06.2024
0005  *
0006  *  A Fun4All module to dump trigger clusters
0007  *  into an NTuple
0008  */
0009 // ----------------------------------------------------------------------------
0010 
0011 #ifndef TRIGGERCLUSTERTUPLEMAKER_H
0012 #define TRIGGERCLUSTERTUPLEMAKER_H
0013 
0014 // c++ utilities
0015 #include <string>
0016 #include <vector>
0017 #include <cassert>
0018 // root libraries
0019 #include <TFile.h>
0020 #include <TNtuple.h>
0021 // base calo libraries
0022 #include <calobase/RawCluster.h>
0023 #include <calobase/RawClusterv1.h>
0024 #include <calobase/RawClusterContainer.h>
0025 
0026 
0027 
0028 // ----------------------------------------------------------------------------
0029 //! Options for TriggerClusterTupleMaker module
0030 // ----------------------------------------------------------------------------
0031 struct TriggerClusterTupleMakerConfig {
0032 
0033   // general options 
0034   bool debug = true;
0035 
0036   // output options
0037   std::string outFile  = "test.tuple.root";
0038   std::string outTuple = "TrgClustTuple";
0039 
0040   // input options
0041   std::string inNode = "TriggerClusters";
0042 
0043 };
0044 
0045 
0046 
0047 // ----------------------------------------------------------------------------
0048 //! Creates an NTuple of Trigger Clusters
0049 // ----------------------------------------------------------------------------
0050 /*! This Fun4all modules ingests trigger clusters and
0051  *  dumps select information from them into ROOT
0052  *  NTuples.
0053  */
0054 class TriggerClusterTupleMaker : public SubsysReco {
0055 
0056   public:
0057 
0058     // ctor
0059     TriggerClusterTupleMaker(const std::string& name = "TriggerClusterTupleMaker");
0060     ~TriggerClusterMaker() override;
0061 
0062     // setters
0063     void SetConfig(const TriggerClusterTupleMakerConfig& config) {m_config = config;}
0064 
0065     // getters
0066     TriggerClusterTupleMakerConfig GetConfig() {return m_config;}
0067 
0068     // f4a methods
0069     int Init(PHCompositeNode* topNode)          override;
0070     int process_event(PHCompositeNode* topNode) override;
0071     int End(PHCompositeNode* topNode)           override;
0072 
0073   private:
0074 
0075     // private methods
0076     void InitOutput();
0077     void GrabInputNode(PHCompositeNode* topNode);
0078     void SetVariables(RawClusterv1* cluster);
0079     void SaveOutput();
0080     void ResetVariables();
0081 
0082     // output variables
0083     std::vector<float> m_vecOutVars;
0084 
0085     // output members
0086     TFile*   m_outFile  = NULL;
0087     TNtuple* m_outTuple = NULL; 
0088 
0089     // input node
0090     RawClusterContainer* m_inTrgClusts = NULL;
0091 
0092     // module configuration
0093     TriggerClusterMakerConfig m_config;
0094 
0095 };
0096 
0097 #endif
0098 
0099 // end ------------------------------------------------------------------------