Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:25:46

0001 #ifndef RecoLocalCalo_HcalRecAlgos_AbsPlan1RechitCombiner_h_
0002 #define RecoLocalCalo_HcalRecAlgos_AbsPlan1RechitCombiner_h_
0003 
0004 #include <utility>
0005 
0006 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
0007 
0008 class HcalTopology;
0009 
0010 class AbsPlan1RechitCombiner {
0011 public:
0012   inline virtual ~AbsPlan1RechitCombiner() {}
0013 
0014   // The topology should be set before the first call
0015   // to "add" and whenever it changes
0016   virtual void setTopo(const HcalTopology* topo) = 0;
0017 
0018   // The "clear" function is called once per event,
0019   // at the beginning of the rechit processing
0020   virtual void clear() = 0;
0021 
0022   // This method should be called to add a rechit to process.
0023   // It will be assumed that the rechit reference will remain
0024   // valid at the time "combine" method is called.
0025   virtual void add(const HBHERecHit& rh) = 0;
0026 
0027   // This method should be called once per event,
0028   // after all rechits have been added
0029   virtual void combine(HBHERecHitCollection* collectionToFill) = 0;
0030 
0031 protected:
0032   // The first element of the pair is the value to average
0033   // and the second is the weight (energy). Non-positive weights
0034   // will be ignored.
0035   typedef std::pair<float, float> FPair;
0036 
0037   static float energyWeightedAverage(const FPair* data, unsigned len, float valueToReturnOnFailure);
0038 };
0039 
0040 #endif  // RecoLocalCalo_HcalRecAlgos_AbsPlan1RechitCombiner_h_