Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:40

0001 // Author: Aurora Perego, Fabio Cossutti - aurora.perego@cern.ch, fabio.cossutti@ts.infn.it
0002 // Date: 05/2023
0003 
0004 #ifndef SimDataFormats_CaloAnalysis_MtdSimLayerCluster_h
0005 #define SimDataFormats_CaloAnalysis_MtdSimLayerCluster_h
0006 
0007 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0008 #include "SimDataFormats/CaloAnalysis/interface/MtdSimCluster.h"
0009 #include <vector>
0010 
0011 class MtdSimLayerCluster : public MtdSimCluster {
0012   friend std::ostream &operator<<(std::ostream &s, MtdSimLayerCluster const &tp);
0013 
0014 public:
0015   MtdSimLayerCluster();
0016   MtdSimLayerCluster(const SimTrack &simtrk);
0017   MtdSimLayerCluster(EncodedEventId eventID, uint32_t particleID);  // for PU
0018 
0019   // destructor
0020   ~MtdSimLayerCluster();
0021 
0022   /** @brief computes the time of the cluster */
0023   float computeClusterTime() {
0024     simLC_time_ = 0.;
0025     float tot_en = 0.;
0026     for (uint32_t i = 0; i < times_.size(); i++) {
0027       simLC_time_ += times_[i] * energies_[i];
0028       tot_en += energies_[i];
0029     }
0030     if (tot_en != 0.)
0031       simLC_time_ = simLC_time_ / tot_en;
0032     return simLC_time_;
0033   }
0034 
0035   /** @brief computes the energy of the cluster */
0036   void addCluEnergy(float energy) { simLC_energy_ = energy; }
0037 
0038   /** @brief computes the position of the cluster */
0039   void addCluLocalPos(LocalPoint pos) { simLC_pos_ = pos; }
0040 
0041   /** @brief add the index of the simcluster */
0042   void addCluIndex(const uint32_t index) { seedId_ = index; }
0043 
0044   /** @brief returns the time of the cluster */
0045   float simLCTime() const { return simLC_time_; }
0046 
0047   /** @brief returns the local position of the cluster */
0048   LocalPoint simLCPos() const { return simLC_pos_; }
0049 
0050   /** @brief returns the accumulated sim energy in the cluster */
0051   float simLCEnergy() const { return simLC_energy_; }
0052 
0053   uint32_t seedId() const { return seedId_; }
0054 
0055 private:
0056   // id of the simCluster it comes from
0057   uint32_t seedId_;
0058 
0059   float simLC_time_{0.f};
0060   float simLC_energy_{0.f};
0061   LocalPoint simLC_pos_;
0062 };
0063 
0064 #endif