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,
53  bool debug, bool famos)
54  : binOfMaximum_(binofmax), tcpFormat_(tcpFormat), barrelOnly_(barrelOnly),
55  debug_(debug), famos_(famos)
56 
57 {
58  if (famos_)
59  maxNrSamples_ = 1; // get from input??
60  else
61  maxNrSamples_ = 10;
62  this->init(setup);
63 }
64 
65 //----------------------------------------------------------------------
67  if (!barrelOnly_) {
68  edm::ESHandle<CaloGeometry> theGeometry;
69  edm::ESHandle<CaloSubdetectorGeometry> theEndcapGeometry_handle;
70  setup.get<CaloGeometryRecord>().get(theGeometry);
71  setup.get<EcalEndcapGeometryRecord>().get("EcalEndcap",
72  theEndcapGeometry_handle);
73  theEndcapGeometry = &(*theEndcapGeometry_handle);
74  setup.get<IdealGeometryRecord>().get(eTTmap_);
75  }
76  // endcap mapping
78  setup.get<EcalMappingRcd>().get(ecalmapping);
79  theMapping_ = ecalmapping.product();
80 
81  // create main sub algos
86 
87  // initialise data structures
90 
91  hitTowers_.resize(maxNrTowers_);
92  towtp_.resize(maxNrSamplesOut_);
93  towtp2_.resize(maxNrSamplesOut_);
94 }
95 //----------------------------------------------------------------------
96 
98  delete estrip_;
99  delete etcp_;
100 }
101 //----------------------------------------------------------------------
103  EBDigiCollection const *col,
105  EcalTrigPrimDigiCollection &resultTcp) {
106  run_part1_EB(col);
107  run_part2(setup, col, towerMapEB_, result, resultTcp);
108 }
109 
110 //----------------------------------------------------------------------
112  EEDigiCollection const *col,
114  EcalTrigPrimDigiCollection &resultTcp) {
115 
116  run_part1_EE(col);
117  run_part2(setup, col, towerMapEE_, result, resultTcp);
118 }
119 //----------------------------------------------------------------------
121  int stripnr;
122  int n = ((id.ic() - 1) % 100) /
123  20; // 20 corresponds to 4 * ecal_barrel_crystals_per_strip FIXME!!
124  if (id.ieta() < 0)
125  stripnr = n + 1;
126  else
127  stripnr = nbMaxStrips_ - n;
128  return stripnr;
129 }
130 //----------------------------------------------------------------------
132  int stripnr;
133  const EcalTriggerElectronicsId elId =
135  stripnr = elId.pseudoStripId();
136  return stripnr;
137 }
138 //----------------------------------------------------------------------
139 
142  // loop over dataframes and fill map
143  fillMap(col, towerMapEB_);
144 }
145 //----------------------------------------------------------------------
148  // loop over dataframes and fill map
149  fillMap(col, towerMapEE_);
150 }
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)
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
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:71
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...