CMS 3D CMS Logo

EcalTrigPrimFunctionalAlgo.cc
Go to the documentation of this file.
1 
15 #include <algorithm>
16 #include <functional>
17 #include <numeric>
18 #include <string>
19 
21 
26 
31 
37 
40 
41 #include <TMath.h>
42 #include <TTree.h>
43 
44 const unsigned int EcalTrigPrimFunctionalAlgo::nrSamples_ = 5; // to be written
45 const unsigned int EcalTrigPrimFunctionalAlgo::maxNrSamplesOut_ = 10;
46 const unsigned int EcalTrigPrimFunctionalAlgo::maxNrTowers_ = 2448;
47 const unsigned int EcalTrigPrimFunctionalAlgo::maxNrTPs_ = 2448; // FIXME??
48 
49 //----------------------------------------------------------------------
50 
52  const edm::EventSetup &setup, int binofmax, bool tcpFormat, bool barrelOnly, bool debug, bool famos)
53  : binOfMaximum_(binofmax),
54  tcpFormat_(tcpFormat),
55  barrelOnly_(barrelOnly),
56  debug_(debug),
57  famos_(famos)
58 
59 {
60  if (famos_)
61  maxNrSamples_ = 1; // get from input??
62  else
63  maxNrSamples_ = 10;
64  this->init(setup);
65 }
66 
67 //----------------------------------------------------------------------
69  if (!barrelOnly_) {
70  edm::ESHandle<CaloGeometry> theGeometry;
71  edm::ESHandle<CaloSubdetectorGeometry> theEndcapGeometry_handle;
72  setup.get<CaloGeometryRecord>().get(theGeometry);
73  setup.get<EcalEndcapGeometryRecord>().get("EcalEndcap", theEndcapGeometry_handle);
74  theEndcapGeometry = &(*theEndcapGeometry_handle);
75  setup.get<IdealGeometryRecord>().get(eTTmap_);
76  }
77  // endcap mapping
79  setup.get<EcalMappingRcd>().get(ecalmapping);
80  theMapping_ = ecalmapping.product();
81 
82  // create main sub algos
85 
86  // initialise data structures
89 
90  hitTowers_.resize(maxNrTowers_);
91  towtp_.resize(maxNrSamplesOut_);
92  towtp2_.resize(maxNrSamplesOut_);
93 }
94 //----------------------------------------------------------------------
95 
97  delete estrip_;
98  delete etcp_;
99 }
100 //----------------------------------------------------------------------
102  EBDigiCollection const *col,
104  EcalTrigPrimDigiCollection &resultTcp) {
105  run_part1_EB(col);
106  run_part2(setup, col, towerMapEB_, result, resultTcp);
107 }
108 
109 //----------------------------------------------------------------------
111  EEDigiCollection const *col,
113  EcalTrigPrimDigiCollection &resultTcp) {
114  run_part1_EE(col);
115  run_part2(setup, col, towerMapEE_, result, resultTcp);
116 }
117 //----------------------------------------------------------------------
119  int stripnr;
120  int n = ((id.ic() - 1) % 100) / 20; // 20 corresponds to 4 * ecal_barrel_crystals_per_strip FIXME!!
121  if (id.ieta() < 0)
122  stripnr = n + 1;
123  else
124  stripnr = nbMaxStrips_ - n;
125  return stripnr;
126 }
127 //----------------------------------------------------------------------
129  int stripnr;
131  stripnr = elId.pseudoStripId();
132  return stripnr;
133 }
134 //----------------------------------------------------------------------
135 
138  // loop over dataframes and fill map
139  fillMap(col, towerMapEB_);
140 }
141 //----------------------------------------------------------------------
144  // loop over dataframes and fill map
145  fillMap(col, towerMapEE_);
146 }
const EcalElectronicsMapping * theMapping_
const CaloSubdetectorGeometry * theEndcapGeometry
class representing the Fenix chip, format strip
void fillMap(Coll const *col, std::vector< std::vector< std::pair< int, std::vector< typename Coll::Digi >>>> &towerMap)
std::vector< std::pair< int, EcalTrigTowerDetId > > hitTowers_
static const unsigned int maxNrSamplesOut_
edm::ESHandle< EcalTrigTowerConstituentsMap > eTTmap_
std::vector< EcalTriggerPrimitiveSample > towtp_
static const unsigned int maxNrTowers_
EcalTrigPrimFunctionalAlgo(const edm::EventSetup &setup, int binofmax, bool tcpFormat, bool barrelOnly, bool debug, bool famos)
void initStructures(std::vector< std::vector< std::pair< int, std::vector< T >>>> &towMap)
void run(const edm::EventSetup &, const EBDigiCollection *col, EcalTrigPrimDigiCollection &result, EcalTrigPrimDigiCollection &resultTcp)
std::vector< std::vector< std::pair< int, std::vector< EBDataFrame > > > > towerMapEB_
EcalTriggerElectronicsId getTriggerElectronicsId(const DetId &id) const
Get the trigger electronics id for this det id.
int pseudoStripId() const
get the tower id
void clean(std::vector< std::vector< std::pair< int, std::vector< T >>>> &towerMap)
void run_part2(const edm::EventSetup &, Coll const *col, std::vector< std::vector< std::pair< int, std::vector< typename Coll::Digi >>>> &towerMap, EcalTrigPrimDigiCollection &result, EcalTrigPrimDigiCollection &resultTcp)
#define debug
Definition: HDRShower.cc:19
void init(const edm::EventSetup &)
static const unsigned int maxNrTPs_
std::vector< std::vector< std::pair< int, std::vector< EEDataFrame > > > > towerMapEE_
std::vector< EcalTriggerPrimitiveSample > towtp2_
void run_part1_EB(EBDigiCollection const *col)
T get() const
Definition: EventSetup.h:73
col
Definition: cuy.py:1010
class representing the Fenix chip, format strip
Definition: EcalFenixTcp.h:33
static const unsigned int nrSamples_
void run_part1_EE(EEDigiCollection const *col)
T const * product() const
Definition: ESHandle.h:86
Ecal trigger electronics identification [32:20] Unused (so far) [19:13] TCC id [12:6] TT id [5:3] pse...