34 : recHits_(iConfig.getParameter<
bool>(
"AnalyzeRecHits")),
35 label_(iConfig.getParameter<
edm::
InputTag>(
"inputTP")),
36 rechits_labelEB_(iConfig.getParameter<
edm::
InputTag>(
"inputRecHitsEB")),
37 rechits_labelEE_(iConfig.getParameter<
edm::
InputTag>(
"inputRecHitsEE")),
48 tree_ =
fs->make<TTree>(
"TPGtree",
"TPGtree");
56 for (
unsigned int i = 0;
i < 2; ++
i) {
66 hTPvsRechit_ =
fs->make<TH2F>(
"TP_vs_RecHit",
"TP vs rechit", 256, -1, 255, 255, 0, 255);
67 hTPoverRechit_ =
fs->make<TH1F>(
"TP_over_RecHit",
"TP over rechit", 500, 0, 4);
70 eTTmapToken_ = esConsumes<EcalTrigTowerConstituentsMap, IdealGeometryRecord>();
82 for (
unsigned int i = 0;
i <
tp.size();
i++) {
84 int subdet =
d.id().subDet() - 1;
88 if (
d.id().ietaAbs() == 27 ||
d.id().ietaAbs() == 28) {
90 ecal_et_[subdet]->Fill(
d.compressedEt() * 2.);
108 std::map<EcalTrigTowerDetId, float> mapTow_Et;
110 for (
unsigned int i = 0;
i < rechit_EB_col.
size();
i++) {
111 const EBDetId &myid1 = rechit_EB_col[
i].id();
113 float theta = theBarrelGeometry.getGeometry(myid1)->getPosition().theta();
114 float Etsum = rechit_EB_col[
i].energy() *
sin(
theta);
115 bool test_alreadyin =
false;
116 std::map<EcalTrigTowerDetId, float>::iterator ittest = mapTow_Et.find(towid1);
117 if (ittest != mapTow_Et.end())
118 test_alreadyin =
true;
121 unsigned int j =
i + 1;
122 bool loopend =
false;
123 unsigned int count = 0;
124 while (
j < rechit_EB_col.
size() && !loopend) {
126 const EBDetId &myid2 = rechit_EB_col[
j].id();
128 if (towid1 == towid2) {
129 float theta = theBarrelGeometry.getGeometry(myid2)->getPosition().theta();
130 Etsum += rechit_EB_col[
j].energy() *
sin(
theta);
136 mapTow_Et.insert(std::pair<EcalTrigTowerDetId, float>(towid1, Etsum));
139 for (
unsigned int i = 0;
i < rechit_EE_col.
size();
i++) {
140 const EEDetId &myid1 = rechit_EE_col[
i].id();
142 float theta = theEndcapGeometry.getGeometry(myid1)->getPosition().theta();
143 float Etsum = rechit_EE_col[
i].energy() *
sin(
theta);
144 bool test_alreadyin =
false;
145 std::map<EcalTrigTowerDetId, float>::iterator ittest = mapTow_Et.find(towid1);
146 if (ittest != mapTow_Et.end())
147 test_alreadyin =
true;
150 unsigned int j =
i + 1;
151 bool loopend =
false;
152 unsigned int count = 0;
153 while (
j < rechit_EE_col.
size() && !loopend) {
154 const EEDetId &myid2 = rechit_EE_col[
j].id();
156 if (towid1 == towid2) {
157 float theta = theEndcapGeometry.getGeometry(myid2)->getPosition().theta();
158 Etsum += rechit_EE_col[
j].energy() *
sin(
theta);
166 mapTow_Et.insert(std::pair<EcalTrigTowerDetId, float>(towid1, Etsum));
170 for (
unsigned int i = 0;
i <
tp.size();
i++) {
173 std::map<EcalTrigTowerDetId, float>::iterator it = mapTow_Et.find(TPtowid);
174 float Et = ecalScale.
getTPGInGeV(
d.compressedEt(), TPtowid);
175 if (
d.id().ietaAbs() == 27 ||
d.id().ietaAbs() == 28)
183 if (it != mapTow_Et.end()) {
static const std::string kSharedResource
const edm::EDGetTokenT< EcalTrigPrimDigiCollection > tpToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
int ieta() const
get the tower ieta
Sin< T >::type sin(const T &t)
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::ESGetToken< CaloSubdetectorGeometry, EcalBarrelGeometryRecord > barrelGeomToken_
edm::ESGetToken< CaloSubdetectorGeometry, EcalEndcapGeometryRecord > endcapGeomToken_
std::vector< std::string > ecal_parts_
const edm::EDGetTokenT< EcalRecHitCollection > eeToken_
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecord > eTTmapToken_
std::vector< edm::EDGetTokenT< int > > tokens_
EcalTrigPrimAnalyzer(const edm::ParameterSet &)
EcalTPGScale::Tokens tokens_
double getTPGInGeV(const EcalTriggerPrimitiveDigi &tpDigi) const
const edm::EDGetTokenT< EcalRecHitCollection > ebToken_
EcalTrigTowerDetId tower() const
get the HCAL/trigger iphi of this crystal
int iphi() const
get the tower iphi
Geom::Theta< T > theta() const