CMS 3D CMS Logo

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