31 for ( std::vector<std::string>::iterator iParam = parameterNames.begin();
32 iParam != parameterNames.end(); iParam++ ){
62 const int kMaxClus = 2000;
75 HltTree->Branch(
"ohAlcapi0ptClusAll",
ptClusAll,
"ohAlcapi0ptClusAll[Nalcapi0clusters]/F");
76 HltTree->Branch(
"ohAlcapi0etaClusAll",
etaClusAll,
"ohAlcapi0etaClusAll[Nalcapi0clusters]/F");
77 HltTree->Branch(
"ohAlcapi0phiClusAll",
phiClusAll,
"ohAlcapi0phiClusAll[Nalcapi0clusters]/F");
78 HltTree->Branch(
"ohAlcapi0s4s9ClusAll",
s4s9ClusAll,
"ohAlcapi0s4s9ClusAll[Nalcapi0clusters]/F");
110 int nhbherechits = 0;
116 myebrechits = * ebrechits;
118 nebrechits = myebrechits.
size();
119 float ebrechitenergy = -1.0;
123 for (ebrechititer
i=myebrechits.
begin();
i!=myebrechits.
end();
i++) {
124 ebrechitenergy =
i->energy();
129 else {nebrechits = 0;}
133 myeerechits = * eerechits;
135 neerechits = myeerechits.
size();
136 float eerechitenergy = -1.0;
140 for (eerechititer
i=myeerechits.
begin();
i!=myeerechits.
end();
i++) {
141 eerechitenergy =
i->energy();
146 else {neerechits = 0;}
150 myhbherechits = * hbherechits;
152 nhbherechits = myhbherechits.
size();
153 float hbherechitenergy = -1.0;
157 for (hbherechititer
i=myhbherechits.
begin();
i!=myhbherechits.
end();
i++) {
158 hbherechitenergy =
i->energy();
163 else {nhbherechits = 0;}
167 myhorechits = * horechits;
169 nhorechits = myhorechits.
size();
170 float horechitenergy = -1.0;
174 for (horechititer
i=myhorechits.
begin();
i!=myhorechits.
end();
i++) {
175 horechitenergy =
i->energy();
180 else {nhorechits = 0;}
184 myhfrechits = * hfrechits;
186 nhfrechits = myhfrechits.
size();
187 float hfrechitenergy = -1.0;
191 for (hfrechititer
i=myhfrechits.
begin();
i!=myhfrechits.
end();
i++) {
192 hfrechitenergy =
i->energy();
197 else {nhfrechits = 0;}
221 std::vector<int>::iterator it;
224 for( l1extra::L1EmParticleCollection::const_iterator emItr = l1EGIso->begin();
225 emItr != l1EGIso->end() ;++emItr ){
227 float pt = emItr ->
pt();
231 int etaIndex = emItr->gctEmCand()->etaIndex() ;
232 int phiIndex = emItr->gctEmCand()->phiIndex() ;
233 double etaLow = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
234 double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
235 double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
236 double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
239 for (
int n=0;
n < (int)feds.size();
n++) {
248 for( l1extra::L1EmParticleCollection::const_iterator emItr = l1EGNonIso->begin();
249 emItr != l1EGNonIso->end() ;++emItr ){
251 float pt = emItr ->
pt();
255 int etaIndex = emItr->gctEmCand()->etaIndex() ;
256 int phiIndex = emItr->gctEmCand()->phiIndex() ;
257 double etaLow = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
258 double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
259 double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
260 double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
263 for (
int n=0;
n < (int)feds.size();
n++) {
278 for (l1extra::L1JetParticleCollection::const_iterator jetItr=l1extjetc->begin(); jetItr != l1extjetc->end(); jetItr++) {
280 double pt = jetItr->
pt();
281 double eta = jetItr->
eta();
282 double phi = jetItr->
phi();
287 for (
int n=0;
n < (int)feds.size();
n++) {
300 for (l1extra::L1JetParticleCollection::const_iterator jetItr=l1extjetf->begin(); jetItr != l1extjetf->end(); jetItr++) {
302 double pt = jetItr ->
pt();
303 double eta = jetItr ->
eta();
304 double phi = jetItr ->
phi();
310 for (
int n=0;
n < (int)feds.size();
n++) {
323 for (l1extra::L1JetParticleCollection::const_iterator jetItr=l1exttaujet->begin(); jetItr != l1exttaujet->end(); jetItr++) {
325 double pt = jetItr ->
pt();
326 double eta = jetItr ->
eta();
327 double phi = jetItr ->
phi();
332 for (
int n=0;
n < (int)feds.size();
n++) {
352 if( fed >= 10 && fed <= 45){
363 std::vector<EcalRecHit> seeds;
366 std::vector<EBDetId> usedXtals;
378 for (itb=pi0ebrechits->begin(); itb!=pi0ebrechits->end(); itb++) {
379 double energy = itb->energy();
397 std::vector<float> eClus;
398 std::vector<float> etClus;
399 std::vector<float> etaClus;
400 std::vector<float> phiClus;
401 std::vector<EBDetId> max_hit;
402 std::vector< std::vector<EcalRecHit> > RecHitsCluster;
403 std::vector<float> s4s9Clus;
413 for (std::vector<EcalRecHit>::iterator itseed=seeds.begin(); itseed!=seeds.end(); itseed++) {
414 EBDetId seed_id = itseed->id();
415 std::vector<EBDetId>::const_iterator usedIds;
417 bool seedAlreadyUsed=
false;
418 for(usedIds=usedXtals.begin(); usedIds!=usedXtals.end(); usedIds++){
419 if(*usedIds==seed_id){
420 seedAlreadyUsed=
true;
425 if(seedAlreadyUsed)
continue;
428 std::vector< std::pair<DetId, float> > clus_used;
430 std::vector<EcalRecHit> RecHitsInWindow;
432 double simple_energy = 0;
434 for (std::vector<DetId>::iterator det=clus_v.begin(); det!=clus_v.end(); det++) {
437 bool HitAlreadyUsed=
false;
438 for(usedIds=usedXtals.begin(); usedIds!=usedXtals.end(); usedIds++){
445 if(HitAlreadyUsed)
continue;
459 usedXtals.push_back(*det);
460 RecHitsInWindow.push_back(
EBRecHits[nn]);
461 clus_used.push_back( std::pair<DetId, float>(*det, 1) );
462 simple_energy = simple_energy +
EBRecHits[nn].energy();
467 float theta_s = 2. * atan(
exp(-clus_pos.eta()));
468 float p0x_s = simple_energy *
sin(theta_s) *
cos(clus_pos.phi());
469 float p0y_s = simple_energy *
sin(theta_s) *
sin(clus_pos.phi());
470 float et_s =
sqrt( p0x_s*p0x_s + p0y_s*p0y_s);
472 eClus.push_back(simple_energy);
473 etClus.push_back(et_s);
474 etaClus.push_back(clus_pos.eta());
475 phiClus.push_back(clus_pos.phi());
476 max_hit.push_back(seed_id);
477 RecHitsCluster.push_back(RecHitsInWindow);
484 for(
int i=0;
i<4;
i++)s4s9_tmp[
i]= 0;
486 int seed_ieta = seed_id.
ieta();
487 int seed_iphi = seed_id.
iphi();
491 for(
unsigned int j=0;
j<RecHitsInWindow.size();
j++){
494 int ieta = det.
ieta();
495 int iphi = det.
iphi();
499 float en = RecHitsInWindow[
j].energy();
504 if(dx <= 0 && dy <=0) s4s9_tmp[0] += en;
505 if(dx >= 0 && dy <=0) s4s9_tmp[1] += en;
506 if(dx <= 0 && dy >=0) s4s9_tmp[2] += en;
507 if(dx >= 0 && dy >=0) s4s9_tmp[3] += en;
510 float s4s9_max = *std::max_element( s4s9_tmp,s4s9_tmp+4)/simple_energy;
511 s4s9Clus.push_back(s4s9_max);
535 std::vector<EcalRecHit> seedsEndCap;
538 std::vector<EEDetId> usedXtalsEndCap;
539 usedXtalsEndCap.clear();
543 for (ite=pi0eerechits->begin(); ite!=pi0eerechits->end(); ite++) {
544 double energy = ite->energy();
550 int fed = elid.
dccId();
567 std::vector<float> eClusEndCap;
568 std::vector<float> etClusEndCap;
569 std::vector<float> etaClusEndCap;
570 std::vector<float> phiClusEndCap;
571 std::vector< std::vector<EcalRecHit> > RecHitsClusterEndCap;
572 std::vector<float> s4s9ClusEndCap;
578 for (std::vector<EcalRecHit>::iterator itseed=seedsEndCap.begin(); itseed!=seedsEndCap.end(); itseed++) {
579 EEDetId seed_id = itseed->id();
580 std::vector<EEDetId>::const_iterator usedIds;
582 bool seedAlreadyUsed=
false;
583 for(usedIds=usedXtalsEndCap.begin(); usedIds!=usedXtalsEndCap.end(); usedIds++){
584 if(*usedIds==seed_id){
585 seedAlreadyUsed=
true;
590 if(seedAlreadyUsed)
continue;
593 std::vector< std::pair<DetId, float> > clus_used;
595 std::vector<EcalRecHit> RecHitsInWindow;
597 double simple_energy = 0;
599 for (std::vector<DetId>::iterator det=clus_v.begin(); det!=clus_v.end(); det++) {
602 bool HitAlreadyUsed=
false;
603 for(usedIds=usedXtalsEndCap.begin(); usedIds!=usedXtalsEndCap.end(); usedIds++){
610 if(HitAlreadyUsed)
continue;
615 int fed = elid.
dccId();
624 usedXtalsEndCap.push_back(*det);
625 RecHitsInWindow.push_back(
EERecHits[nn]);
626 clus_used.push_back( std::pair<DetId, float>(*det, 1) );
627 simple_energy = simple_energy +
EERecHits[nn].energy();
632 float theta_s = 2. * atan(
exp(-clus_pos.eta()));
633 float p0x_s = simple_energy *
sin(theta_s) *
cos(clus_pos.phi());
634 float p0y_s = simple_energy *
sin(theta_s) *
sin(clus_pos.phi());
635 float et_s =
sqrt( p0x_s*p0x_s + p0y_s*p0y_s);
637 eClusEndCap.push_back(simple_energy);
638 etClusEndCap.push_back(et_s);
639 etaClusEndCap.push_back(clus_pos.eta());
640 phiClusEndCap.push_back(clus_pos.phi());
641 RecHitsClusterEndCap.push_back(RecHitsInWindow);
646 for(
int i=0;
i<4;
i++) s4s9_tmp[
i]= 0;
648 int ixSeed = seed_id.
ix();
649 int iySeed = seed_id.
iy();
650 for(
unsigned int j=0;
j<RecHitsInWindow.size();
j++){
652 int dx = ixSeed - det_this.
ix();
653 int dy = iySeed - det_this.
iy();
655 float en = RecHitsInWindow[
j].energy();
657 if(dx <= 0 && dy <=0) s4s9_tmp[0] += en;
658 if(dx >= 0 && dy <=0) s4s9_tmp[1] += en;
659 if(dx <= 0 && dy >=0) s4s9_tmp[2] += en;
660 if(dx >= 0 && dy >=0) s4s9_tmp[3] += en;
663 float s4s9_max = *std::max_element( s4s9_tmp,s4s9_tmp+4)/simple_energy;
664 s4s9ClusEndCap.push_back(s4s9_max);
692 double phiHigh,
double etamargin,
double phimargin)
695 std::vector<int>
FEDs;
700 etaHigh += etamargin;
701 double phiMinus = phiLow - phimargin;
702 double phiPlus = phiHigh + phimargin;
705 double dd = fabs(phiPlus-phiMinus);
707 if (dd > 2.*
Geom::pi() ) all =
true;
710 while (phiMinus < 0) { phiMinus += 2.*
Geom::pi() ; }
713 double dphi = phiPlus - phiMinus;
714 if (dphi < 0) dphi += 2.*
Geom::pi() ;
720 if (fed_low1 == fed_low2) all =
true;
724 if (fed_hi1 == fed_hi2) all =
true;
745 if( ieta<=-1)
return smId - 9;
746 else return smId + 27;
758 if(neta > 0) neta -= 1;
759 if(nphi > 359) nphi=nphi-360;
762 if(nphi >359 || nphi <0 || neta< -85 || neta > 84)
764 std::cout <<
" unexpected fatal error in HLTPi0::convxtalid "<< nphi <<
" " << neta <<
" " <<std::endl;
787 if(nphi1>nphi2) mdiff=-mdiff;
T getParameter(std::string const &) const
EcalElectronicsMapping * TheMapping
T getUntrackedParameter(std::string const &, T const &) const
int GetFED(double eta, double phi) const
void setup(const edm::ParameterSet &pSet, TTree *tree)
double JETSregionPhiMargin_
const CaloSubdetectorGeometry * geometry_es
std::vector< EEDetId > detIdEERecHits
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
float ohHighestEnergyHFRecHit
Sin< T >::type sin(const T &t)
std::vector< T >::const_iterator const_iterator
double JETSregionEtaMargin_
Exp< T >::type exp(const T &t)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
int convertSmToFedNumbBarrel(int ieta, int smId)
std::vector< EBDetId > detIdEBRecHits
std::vector< EcalRecHit > EBRecHits
int diff_nphi_s(Int_t nphi1, Int_t nphi2)
int iphi() const
get the crystal iphi
int diff_neta_s(Int_t neta1, Int_t neta2)
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
double EMregionPhiMargin_
double seleXtalMinEnergy_
std::vector< int > GetListofFEDs(const EcalEtaPhiRegion region) const
float ohHighestEnergyHORecHit
Cos< T >::type cos(const T &t)
const CaloSubdetectorTopology * topology_ee
const CaloSubdetectorGeometry * geometry_ee
std::vector< int > FEDListUsed
int ieta() const
get the crystal ieta
std::vector< std::string > getParameterNames() const
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
void convxtalid(Int_t &nphi, Int_t &neta)
const_iterator end() const
float ohHighestEnergyEERecHit
std::vector< EcalRecHit > EERecHits
float ohHighestEnergyEBRecHit
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
double EMregionEtaMargin_
PositionCalc posCalculator_
XYZPointD XYZPoint
point in space with cartesian internal representation
T const * product() const
int DCCid(const EBDetId &id) const
returns the DCC of an EBDetId
std::vector< int > ListOfFEDS(double etaLow, double etaHigh, double phiLow, double phiHigh, double etamargin, double phimargin)
double clusSeedThrEndCap_
T const * product() const
const CaloSubdetectorTopology * topology_eb
math::XYZPoint Calculate_Location(const std::vector< std::pair< DetId, float > > &iDetIds, const EcalRecHitCollection *iRecHits, const CaloSubdetectorGeometry *iSubGeom, const CaloSubdetectorGeometry *iESGeom=0)
float ohHighestEnergyHBHERecHit
void analyze(const edm::Handle< EBRecHitCollection > &ebrechits, const edm::Handle< EERecHitCollection > &eerechits, const edm::Handle< HBHERecHitCollection > &hbherechits, const edm::Handle< HORecHitCollection > &horechits, const edm::Handle< HFRecHitCollection > &hfrechits, const edm::Handle< EBRecHitCollection > &pi0ebrechits, const edm::Handle< EERecHitCollection > &pi0eerechits, const edm::Handle< l1extra::L1EmParticleCollection > &l1extemi, const edm::Handle< l1extra::L1EmParticleCollection > &l1extemn, const edm::Handle< l1extra::L1JetParticleCollection > &l1extjetc, const edm::Handle< l1extra::L1JetParticleCollection > &l1extjetf, const edm::Handle< l1extra::L1JetParticleCollection > &l1exttaujet, const edm::ESHandle< EcalElectronicsMapping > &ecalmapping, const edm::ESHandle< CaloGeometry > &geoHandle, const edm::ESHandle< CaloTopology > &pTopology, const edm::ESHandle< L1CaloGeometry > &l1CaloGeom, TTree *tree)
std::vector< int > FEDListUsedBarrel
const_iterator begin() const
std::vector< int > FEDListUsedEndcap
const CaloSubdetectorGeometry * geometry_eb