53 histfile_ =
new TFile(
"histos.root",
"RECREATE");
54 tree_ =
new TTree(
"TPGtree",
"TPGtree");
62 for (
unsigned int i = 0;
i < 2; ++
i) {
66 ecal_tt_[
i] =
new TH1I(title,
"TTF", 10, 0, 10);
74 hTPvsRechit_ =
new TH2F(
"TP_vs_RecHit",
"TP vs rechit", 256, -1, 255, 255, 0, 255);
75 hTPoverRechit_ =
new TH1F(
"TP_over_RecHit",
"TP over rechit", 500, 0, 4);
78 geomToken_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
81 eTTmapToken_ = esConsumes<EcalTrigTowerConstituentsMap, IdealGeometryRecord>();
105 for (
unsigned int i = 0;
i <
tp.product()->size();
i++) {
138 map<EcalTrigTowerDetId, float> mapTow_Et;
140 for (
unsigned int i = 0;
i < rechit_EB_col.product()->size();
i++) {
141 const EBDetId &myid1 = (*rechit_EB_col.product())[
i].
id();
143 float theta = theBarrelGeometry->getGeometry(myid1)->getPosition().theta();
144 float Etsum = ((*rechit_EB_col.product())[
i].
energy()) *
sin(theta);
145 bool test_alreadyin =
false;
146 map<EcalTrigTowerDetId, float>::iterator ittest = mapTow_Et.find(towid1);
147 if (ittest != mapTow_Et.end())
148 test_alreadyin =
true;
151 unsigned int j =
i + 1;
152 bool loopend =
false;
153 unsigned int count = 0;
154 while (j < rechit_EB_col.product()->size() && !loopend) {
156 const EBDetId &myid2 = (*rechit_EB_col.product())[j].
id();
158 if (towid1 == towid2) {
159 float theta = theBarrelGeometry->getGeometry(myid2)->getPosition().theta();
160 Etsum += (*rechit_EB_col.product())[j].
energy() *
sin(theta);
166 mapTow_Et.insert(pair<EcalTrigTowerDetId, float>(towid1, Etsum));
169 for (
unsigned int i = 0;
i < rechit_EE_col.product()->size();
i++) {
170 const EEDetId &myid1 = (*rechit_EE_col.product())[
i].
id();
172 float theta = theEndcapGeometry->getGeometry(myid1)->getPosition().theta();
173 float Etsum = (*rechit_EE_col.product())[
i].
energy() *
sin(theta);
174 bool test_alreadyin =
false;
175 map<EcalTrigTowerDetId, float>::iterator ittest = mapTow_Et.find(towid1);
176 if (ittest != mapTow_Et.end())
177 test_alreadyin =
true;
180 unsigned int j =
i + 1;
181 bool loopend =
false;
182 unsigned int count = 0;
183 while (j < rechit_EE_col.product()->size() && !loopend) {
184 const EEDetId &myid2 = (*rechit_EE_col.product())[j].
id();
186 if (towid1 == towid2) {
187 float theta = theEndcapGeometry->getGeometry(myid2)->getPosition().theta();
188 Etsum += (*rechit_EE_col.product())[j].
energy() *
sin(theta);
196 mapTow_Et.insert(pair<EcalTrigTowerDetId, float>(towid1, Etsum));
200 for (
unsigned int i = 0;
i <
tp.product()->size();
i++) {
203 map<EcalTrigTowerDetId, float>::iterator it = mapTow_Et.find(TPtowid);
213 if (it != mapTow_Et.end()) {
223 for (
unsigned int i = 0;
i < 2; ++
i) {
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
int ieta() const
get the tower ieta
void analyze(const edm::Event &, const edm::EventSetup &) override
int compressedEt() const
get the encoded/compressed Et of interesting sample
edm::ESGetToken< CaloSubdetectorGeometry, EcalBarrelGeometryRecord > barrelGeomToken_
~EcalTrigPrimAnalyzer() override
int ietaAbs() const
get the absolute value of the tower ieta
edm::ESGetToken< CaloSubdetectorGeometry, EcalEndcapGeometryRecord > endcapGeomToken_
std::vector< std::string > ecal_parts_
EcalTrigTowerDetId tower() const
get the HCAL/trigger iphi of this crystal
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
double getTPGInGeV(const EcalTriggerPrimitiveDigi &tpDigi) const
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecord > eTTmapToken_
std::vector< edm::EDGetTokenT< int > > tokens_
EcalTrigPrimAnalyzer(const edm::ParameterSet &)
int iphi() const
get the tower iphi
const EcalTrigTowerDetId & id() const
EcalTPGScale::Tokens tokens_
edm::InputTag rechits_labelEE_
edm::InputTag rechits_labelEB_
T getParameter(std::string const &) const
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
bool fineGrain() const
get the fine-grain bit of interesting sample
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
int ttFlag() const
get the Trigger tower Flag of interesting sample