CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/SimCalorimetry/HcalTrigPrimAlgos/interface/HcalTriggerPrimitiveAlgo.h

Go to the documentation of this file.
00001 #ifndef HcalSimAlgos_HcalTriggerPrimitiveAlgo_h
00002 #define HcalSimAlgos_HcalTriggerPrimitiveAlgo_h
00003 
00004 #include "DataFormats/HcalDetId/interface/HcalTrigTowerDetId.h"
00005 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
00006 #include "Geometry/HcalTowerAlgo/interface/HcalTrigTowerGeometry.h"
00007 #include "CalibFormats/CaloObjects/interface/CaloSamples.h"
00008 #include "CalibFormats/CaloObjects/interface/IntegerCaloSamples.h"
00009 //#include "CalibFormats/HcalObjects/interface/HcalTPGCoder.h"
00010 #include "CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h"
00011 #include "CalibFormats/CaloTPG/interface/HcalTPGCompressor.h"
00012 #include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h"
00013 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
00014 
00015 #include <map>
00016 #include <vector>
00017 class CaloGeometry;
00018 class IntegerCaloSamples;
00019 
00020 class HcalTriggerPrimitiveAlgo {
00021 public:
00022   HcalTriggerPrimitiveAlgo(bool pf, const std::vector<double>& w, 
00023                            int latency,
00024                            uint32_t FG_threshold, uint32_t ZS_threshold,
00025                            int numberOfSamples, int numberOfPresamples,
00026                            uint32_t minSignalThreshold=0, uint32_t PMT_NoiseThreshold=0);
00027   ~HcalTriggerPrimitiveAlgo();
00028 
00029   void run(const HcalTPGCoder* incoder,
00030            const HcalTPGCompressor* outcoder,
00031            const HBHEDigiCollection& hbheDigis,
00032            const HFDigiCollection& hfDigis,
00033            HcalTrigPrimDigiCollection& result,
00034            float rctlsb);
00035 
00036   void runZS(HcalTrigPrimDigiCollection& tp);
00037   void runFEFormatError(const FEDRawDataCollection* rawraw,
00038                         const HcalElectronicsMap* emap,
00039                         HcalTrigPrimDigiCollection & result);
00040   void setPeakFinderAlgorithm(int algo);
00041  private:
00042 
00044   void addSignal(const HBHEDataFrame & frame);
00045   void addSignal(const HFDataFrame & frame);
00046   void addSignal(const IntegerCaloSamples & samples);
00047   void addFG(const HcalTrigTowerDetId& id, std::vector<bool>& msb);
00048 
00050   void analyze(IntegerCaloSamples & samples, HcalTriggerPrimitiveDigi & result);
00051   void analyzeHF(IntegerCaloSamples & samples, HcalTriggerPrimitiveDigi & result, float rctlsb);
00052 
00053    // Member initialized by constructor
00054   const HcaluLUTTPGCoder* incoder_;
00055   const HcalTPGCompressor* outcoder_;
00056   double theThreshold;
00057   bool peakfind_;
00058   std::vector<double> weights_;
00059   int latency_;
00060   uint32_t FG_threshold_;
00061   uint32_t ZS_threshold_;
00062   int ZS_threshold_I_;
00063   int numberOfSamples_;
00064   int numberOfPresamples_;
00065   uint32_t minSignalThreshold_;
00066   uint32_t PMT_NoiseThreshold_; 
00067 
00068   // Algo1: isPeak = TS[i-1] < TS[i] && TS[i] >= TS[i+1]
00069   // Algo2: isPeak = TSS[i-1] < TSS[i] && TSS[i] >= TSS[i+1],
00070   // TSS[i] = TS[i] + TS[i+1]
00071   // Default: Algo2
00072   int peak_finder_algorithm_;
00073 
00074   // Member not initialzed
00075   //std::vector<HcalTrigTowerDetId> towerIds(const HcalDetId & id) const;
00076 
00077   HcalTrigTowerGeometry theTrigTowerGeometry; // from event setup eventually?
00078 
00079   typedef std::map<HcalTrigTowerDetId, IntegerCaloSamples> SumMap;
00080   SumMap theSumMap;  
00081   
00082   typedef std::vector<IntegerCaloSamples> SumFGContainer;
00083   typedef std::map< HcalTrigTowerDetId, SumFGContainer > TowerMapFGSum;
00084   TowerMapFGSum theTowerMapFGSum;
00085 
00086   // ==============================
00087   // =  HF Veto
00088   // ==============================
00089   // Sum = Long + Short;" // intermediate calculation. 
00090   //  if ((Short < MinSignalThresholdET OR Long  < MinSignalThresholdET)
00091   //     AND Sum > PMTNoiseThresholdET) VetoedSum = 0; 
00092   //  else VetoedSum = Sum; 
00093   // ==============================
00094   // Map from FG id to veto booleans
00095   typedef std::map<uint32_t, std::vector<bool> > TowerMapVeto;
00096   TowerMapVeto HF_Veto;
00097 
00098   typedef std::map<HcalTrigTowerDetId, std::vector<bool> > FGbitMap;
00099   FGbitMap fgMap_;
00100 };
00101 #endif