HGCal Test Beam  03a93d6239a951948e06fb3ef8dae4cbdebfad30
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
HGCSimDigiSource.h
Go to the documentation of this file.
1 #ifndef HGCSIMDIGISOURCE_H
2 #define HGCSIMDIGISOURCE_H
3 /** \class
4 
5  \author Harrison B. Prosper
6  */
7 #include <stdio.h>
8 #include <iostream>
9 #include <vector>
10 
11 #include "TChain.h"
12 #include "TTree.h"
13 #include "TRandom3.h"
14 
15 #include "FWCore/Framework/interface/Event.h"
16 #include "FWCore/ParameterSet/interface/ParameterSet.h"
17 #include "FWCore/Sources/interface/ProducerSourceFromFiles.h"
18 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
19 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
20 #include "FWCore/Utilities/interface/Exception.h"
21 
22 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
23 #include "HGCal/CondObjects/interface/HGCalElectronicsMap.h"
24 #include "HGCal/TBStandaloneSimulator/interface/HGCSSSimHit.hh"
25 #include "HGCal/TBStandaloneSimulator/interface/HGCCellMap.h"
26 #include "HGCal/DataFormats/interface/HGCalTBDataFrameContainers.h"
27 
28 class HGCSimDigiSource : public edm::ProducerSourceFromFiles
29 {
30 public:
31  explicit HGCSimDigiSource(const edm::ParameterSet& pset,
32  edm::InputSourceDescription
33  const& desc);
34 
35  virtual ~HGCSimDigiSource();
36 
37  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
38 
39  struct Cell {
40  int skiroc; // SKIROC number
41  int channel; // channel number
42  DetId detid; // detector id
43  uint16_t ADClow;
44  uint16_t ADChigh;
45  uint16_t TDC;
46  int layer;
47  int sensor_u;
48  int sensor_v;
49  int u;
50  int v;
51  int celltype;
52  double x;
53  double y;
54  double energy;
55 
57  {
58  // SKIROC 2 occurs before SKIROC 1
59  int ski = skiroc % 2;
60  int o_ski = o.skiroc % 2;
61  int lhs = 64 * ski + channel;
62  int rhs = 64 * o_ski + o.channel;
63  return lhs < rhs;
64  }
65  };
66 
67 private:
68  virtual bool setRunAndEventInfo(edm::EventID& id,
69  edm::TimeValue_t& time,
70  edm::EventAuxiliary::ExperimentType&);
71 
72  virtual void produce(edm::Event& e);
73 
74  virtual void digitize(std::vector<HGCSimDigiSource::Cell>& channels);
75 
76  int _run;
77  int _maxevents;
78  int _minadccount;
79  double _adcpermev;
80  std::vector<std::string> _filenames; ///<name of input sim files
81  std::vector<std::string> _noisefilenames; ///<name of input pedestal files
82 
83  /// Sim objects
84  TChain* _chain;
85  TTree* _tree;
86  size_t _entries;
87  size_t _entry;
88  HGCCellMap _cellmap;
89  HGCalElectronicsMap _emap;
90  HGCSSSimHitVec* _simhits;
91 
92  /// noise objects
93  TChain* _noisechain;
94  TTree* _noisetree;
95  size_t _noiseentries;
96  size_t _noiseentry;
97  TRandom3 _random;
98  std::vector<std::map<uint32_t, uint16_t> > _noise;
99 };
100 
101 
102 #endif
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
HGCSimDigiSource(const edm::ParameterSet &pset, edm::InputSourceDescription const &desc)
virtual ~HGCSimDigiSource()
provides the conversion between electronics Id to DetId
bool operator<(HGCSimDigiSource::Cell &o)