Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:20:38

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