Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:22:01

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 // $Id: Prototype3DSTReader.h,v 1.7 2015/02/27 23:42:23 jinhuang Exp $
0004 
0005 /*!
0006  * \file Prototype3DSTReader.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 PROTOTYPE3_PROTOTYPE3DSTREADER_H
0014 #define PROTOTYPE3_PROTOTYPE3DSTREADER_H
0015 
0016 #include "RawTower_Prototype3.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 Prototype3DSTReader save information from DST to an evaluator, which
0031  * could include hit. particle, vertex, towers and jet (to be activated)
0032  */
0033 class Prototype3DSTReader : public SubsysReco
0034 {
0035  public:
0036   Prototype3DSTReader(const std::string &filename);
0037   virtual ~Prototype3DSTReader();
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 
0080   typedef std::shared_ptr<TClonesArray> arr_ptr;
0081 
0082   struct record
0083   {
0084     unsigned int _cnt;
0085     std::string _name;
0086     arr_ptr _arr;
0087     TClonesArray *_arr_ptr;
0088     double _dvalue;
0089 
0090     enum enu_type
0091     {
0092       typ_hit,
0093       typ_part,
0094       typ_vertex,
0095       typ_tower,
0096       typ_jets,
0097       typ_runinfo,
0098       typ_eventinfo,
0099       typ_towertemp
0100     };
0101     enu_type _type;
0102   };
0103   typedef std::vector<record> records_t;
0104   records_t _records;
0105 
0106   typedef RawTower_Prototype3 RawTower_type;
0107 
0108   typedef RawTower_Temperature RawTowerT_type;
0109 
0110   int _event;
0111 
0112   std::string _out_file_name;
0113 
0114   //  TFile * _file;
0115   TTree *_T;
0116 
0117   //! zero suppression for all calorimeters
0118   double _tower_zero_sup;
0119 
0120   void build_tree();
0121 };
0122 
0123 #endif