52 histfile_ =
new TFile(
"histos.root",
"RECREATE");
53 tree_ =
new TTree(
"TPGtree",
"TPGtree");
61 for (
unsigned int i = 0;
i < 2; ++
i) {
65 ecal_tt_[
i] =
new TH1I(title,
"TTF", 10, 0, 10);
73 hTPvsRechit_ =
new TH2F(
"TP_vs_RecHit",
"TP vs rechit", 256, -1, 255, 255, 0, 255);
74 hTPoverRechit_ =
new TH1F(
"TP_over_RecHit",
"TP over rechit", 500, 0, 4);
77 geomToken_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
80 eTTmapToken_ = esConsumes<EcalTrigTowerConstituentsMap, IdealGeometryRecord>();
104 for (
unsigned int i = 0;
i <
tp.product()->size();
i++) {
137 map<EcalTrigTowerDetId, float> mapTow_Et;
139 for (
unsigned int i = 0;
i < rechit_EB_col.product()->size();
i++) {
140 const EBDetId &myid1 = (*rechit_EB_col.product())[
i].
id();
142 float theta = theBarrelGeometry->getGeometry(myid1)->getPosition().theta();
143 float Etsum = ((*rechit_EB_col.product())[
i].
energy()) *
sin(theta);
144 bool test_alreadyin =
false;
145 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_EB_col.product()->size() && !loopend) {
155 const EBDetId &myid2 = (*rechit_EB_col.product())[j].
id();
157 if (towid1 == towid2) {
158 float theta = theBarrelGeometry->getGeometry(myid2)->getPosition().theta();
159 Etsum += (*rechit_EB_col.product())[j].
energy() *
sin(theta);
165 mapTow_Et.insert(pair<EcalTrigTowerDetId, float>(towid1, Etsum));
168 for (
unsigned int i = 0;
i < rechit_EE_col.product()->size();
i++) {
169 const EEDetId &myid1 = (*rechit_EE_col.product())[
i].
id();
171 float theta = theEndcapGeometry->getGeometry(myid1)->getPosition().theta();
172 float Etsum = (*rechit_EE_col.product())[
i].
energy() *
sin(theta);
173 bool test_alreadyin =
false;
174 map<EcalTrigTowerDetId, float>::iterator ittest = mapTow_Et.find(towid1);
175 if (ittest != mapTow_Et.end())
176 test_alreadyin =
true;
179 unsigned int j =
i + 1;
180 bool loopend =
false;
181 unsigned int count = 0;
182 while (j < rechit_EE_col.product()->size() && !loopend) {
183 const EEDetId &myid2 = (*rechit_EE_col.product())[j].
id();
185 if (towid1 == towid2) {
186 float theta = theEndcapGeometry->getGeometry(myid2)->getPosition().theta();
187 Etsum += (*rechit_EE_col.product())[j].
energy() *
sin(theta);
195 mapTow_Et.insert(pair<EcalTrigTowerDetId, float>(towid1, Etsum));
199 for (
unsigned int i = 0;
i <
tp.product()->size();
i++) {
202 map<EcalTrigTowerDetId, float>::iterator it = mapTow_Et.find(TPtowid);
212 if (it != mapTow_Et.end()) {
222 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