Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:12:21

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 // $Id: Prototype4DSTReader.h,v 1.7 2015/02/27 23:42:23 jinhuang Exp $
0004 
0005 /*!
0006  * \file Prototype4DSTReader.h
0007  * \brief
0008  * \author Jin Huang <jhuang@bnl.gov>
0009  * \version $Revision: 1.7 $
0010  * \date $Date: 2015/02/27 23:42:23 $
0011  */
0012 
0013 #ifndef PROTOTYPE4_PROTOTYPE4DSTREADER_H
0014 #define PROTOTYPE4_PROTOTYPE4DSTREADER_H
0015 
0016 #include "RawTower_Prototype4.h"
0017 #include "RawTower_Temperature.h"
0018 
0019 #include <fun4all/SubsysReco.h>
0020 
0021 #include <memory>
0022 #include <string>
0023 #include <vector>
0024 
0025 class PHCompositeNode;
0026 class TClonesArray;
0027 class TTree;
0028 
0029 /*!
0030  * \brief Prototype4DSTReader save information from DST to an evaluator, which
0031  * could include hit. particle, vertex, towers and jet (to be activated)
0032  */
0033 class Prototype4DSTReader : public SubsysReco
0034 {
0035  public:
0036   Prototype4DSTReader(const std::string &filename);
0037   virtual ~Prototype4DSTReader();
0038 
0039   //! full initialization
0040   int Init(PHCompositeNode *);
0041 
0042   //! event processing method
0043   int process_event(PHCompositeNode *);
0044 
0045   //! end of run method
0046   int End(PHCompositeNode *);
0047 
0048   void AddTower(const std::string &name) { _tower_postfix.push_back(name); }
0049 
0050   void AddTowerTemperature(const std::string &name)
0051   {
0052     _towertemp_postfix.push_back(name);
0053   }
0054 
0055   void AddRunInfo(const std::string &name) { _runinfo_list.push_back(name); }
0056   void AddEventInfo(const std::string &name)
0057   {
0058     _eventinfo_list.push_back(name);
0059   }
0060 
0061   //! zero suppression for all calorimeters
0062   double get_tower_zero_sup() { return _tower_zero_sup; }
0063 
0064   //! zero suppression for all calorimeters
0065   void set_tower_zero_sup(double b) { _tower_zero_sup = b; }
0066 
0067  protected:
0068   //  std::vector<std::string> _node_postfix;
0069   std::vector<std::string> _tower_postfix;
0070   //! tower temperature
0071   std::vector<std::string> _towertemp_postfix;
0072   //  std::vector<std::string> _jet_postfix;
0073   //  std::vector<std::string> _node_name;
0074   std::vector<std::string> _runinfo_list;
0075   std::vector<std::string> _eventinfo_list;
0076 
0077   int nblocks;
0078 
0079   typedef std::shared_ptr<TClonesArray> arr_ptr;
0080 
0081   struct record
0082   {
0083     unsigned int _cnt;
0084     std::string _name;
0085     arr_ptr _arr;
0086     TClonesArray *_arr_ptr;
0087     double _dvalue;
0088 
0089     enum enu_type
0090     {
0091       typ_hit,
0092       typ_part,
0093       typ_vertex,
0094       typ_tower,
0095       typ_jets,
0096       typ_runinfo,
0097       typ_eventinfo,
0098       typ_towertemp
0099     };
0100     enu_type _type;
0101   };
0102   typedef std::vector<record> records_t;
0103   records_t _records;
0104 
0105   typedef RawTower_Prototype4 RawTower_type;
0106 
0107   typedef RawTower_Temperature RawTowerT_type;
0108 
0109   int _event;
0110 
0111   std::string _out_file_name;
0112 
0113   //  TFile * _file;
0114   TTree *_T;
0115 
0116   //! zero suppression for all calorimeters
0117   double _tower_zero_sup;
0118 
0119   void build_tree();
0120 };
0121 
0122 #endif