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 myebrechits = * ebrechits;
112 float ebrechitenergy = -1.0;
116 for (ebrechititer
i=myebrechits.
begin();
i!=myebrechits.
end();
i++) {
117 ebrechitenergy =
i->energy();
125 myeerechits = * eerechits;
127 float eerechitenergy = -1.0;
131 for (eerechititer
i=myeerechits.
begin();
i!=myeerechits.
end();
i++) {
132 eerechitenergy =
i->energy();
140 myhbherechits = * hbherechits;
142 float hbherechitenergy = -1.0;
146 for (hbherechititer
i=myhbherechits.
begin();
i!=myhbherechits.
end();
i++) {
147 hbherechitenergy =
i->energy();
155 myhorechits = * horechits;
157 float horechitenergy = -1.0;
161 for (horechititer
i=myhorechits.
begin();
i!=myhorechits.
end();
i++) {
162 horechitenergy =
i->energy();
170 myhfrechits = * hfrechits;
172 float hfrechitenergy = -1.0;
176 for (hfrechititer
i=myhfrechits.
begin();
i!=myhfrechits.
end();
i++) {
177 hfrechitenergy =
i->energy();
205 std::vector<int>::iterator it;
208 for( l1extra::L1EmParticleCollection::const_iterator emItr = l1EGIso->begin();
209 emItr != l1EGIso->end() ;++emItr ){
211 float pt = emItr ->
pt();
215 int etaIndex = emItr->gctEmCand()->etaIndex() ;
216 int phiIndex = emItr->gctEmCand()->phiIndex() ;
217 double etaLow = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
218 double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
219 double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
220 double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
223 for (
int n=0;
n < (int)feds.size();
n++) {
232 for( l1extra::L1EmParticleCollection::const_iterator emItr = l1EGNonIso->begin();
233 emItr != l1EGNonIso->end() ;++emItr ){
235 float pt = emItr ->
pt();
239 int etaIndex = emItr->gctEmCand()->etaIndex() ;
240 int phiIndex = emItr->gctEmCand()->phiIndex() ;
241 double etaLow = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
242 double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
243 double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
244 double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
247 for (
int n=0;
n < (int)feds.size();
n++) {
262 for (l1extra::L1JetParticleCollection::const_iterator jetItr=l1extjetc->begin(); jetItr != l1extjetc->end(); jetItr++) {
264 double pt = jetItr->
pt();
265 double eta = jetItr->
eta();
266 double phi = jetItr->
phi();
271 for (
int n=0;
n < (int)feds.size();
n++) {
284 for (l1extra::L1JetParticleCollection::const_iterator jetItr=l1extjetf->begin(); jetItr != l1extjetf->end(); jetItr++) {
286 double pt = jetItr ->
pt();
287 double eta = jetItr ->
eta();
288 double phi = jetItr ->
phi();
294 for (
int n=0;
n < (int)feds.size();
n++) {
307 for (l1extra::L1JetParticleCollection::const_iterator jetItr=l1exttaujet->begin(); jetItr != l1exttaujet->end(); jetItr++) {
309 double pt = jetItr ->
pt();
310 double eta = jetItr ->
eta();
311 double phi = jetItr ->
phi();
316 for (
int n=0;
n < (int)feds.size();
n++) {
336 if( fed >= 10 && fed <= 45){
347 std::vector<EcalRecHit> seeds;
350 std::vector<EBDetId> usedXtals;
362 for (itb=pi0ebrechits->begin(); itb!=pi0ebrechits->end(); itb++) {
363 double energy = itb->energy();
381 std::vector<float> eClus;
382 std::vector<float> etClus;
383 std::vector<float> etaClus;
384 std::vector<float> phiClus;
385 std::vector<EBDetId> max_hit;
386 std::vector< std::vector<EcalRecHit> > RecHitsCluster;
387 std::vector<float> s4s9Clus;
397 for (std::vector<EcalRecHit>::iterator itseed=seeds.begin(); itseed!=seeds.end(); itseed++) {
398 EBDetId seed_id = itseed->id();
399 std::vector<EBDetId>::const_iterator usedIds;
401 bool seedAlreadyUsed=
false;
402 for(usedIds=usedXtals.begin(); usedIds!=usedXtals.end(); usedIds++){
403 if(*usedIds==seed_id){
404 seedAlreadyUsed=
true;
409 if(seedAlreadyUsed)
continue;
412 std::vector< std::pair<DetId, float> > clus_used;
414 std::vector<EcalRecHit> RecHitsInWindow;
416 double simple_energy = 0;
418 for (std::vector<DetId>::iterator det=clus_v.begin(); det!=clus_v.end(); det++) {
421 bool HitAlreadyUsed=
false;
422 for(usedIds=usedXtals.begin(); usedIds!=usedXtals.end(); usedIds++){
429 if(HitAlreadyUsed)
continue;
443 usedXtals.push_back(*det);
444 RecHitsInWindow.push_back(
EBRecHits[nn]);
445 clus_used.push_back( std::pair<DetId, float>(*det, 1) );
446 simple_energy = simple_energy +
EBRecHits[nn].energy();
451 float theta_s = 2. * atan(
exp(-clus_pos.eta()));
452 float p0x_s = simple_energy *
sin(theta_s) *
cos(clus_pos.phi());
453 float p0y_s = simple_energy *
sin(theta_s) *
sin(clus_pos.phi());
454 float et_s =
sqrt( p0x_s*p0x_s + p0y_s*p0y_s);
456 eClus.push_back(simple_energy);
457 etClus.push_back(et_s);
458 etaClus.push_back(clus_pos.eta());
459 phiClus.push_back(clus_pos.phi());
460 max_hit.push_back(seed_id);
461 RecHitsCluster.push_back(RecHitsInWindow);
468 for(
int i=0;
i<4;
i++)s4s9_tmp[
i]= 0;
470 int seed_ieta = seed_id.
ieta();
471 int seed_iphi = seed_id.
iphi();
475 for(
unsigned int j=0;
j<RecHitsInWindow.size();
j++){
478 int ieta = det.
ieta();
479 int iphi = det.
iphi();
483 float en = RecHitsInWindow[
j].energy();
488 if(dx <= 0 && dy <=0) s4s9_tmp[0] += en;
489 if(dx >= 0 && dy <=0) s4s9_tmp[1] += en;
490 if(dx <= 0 && dy >=0) s4s9_tmp[2] += en;
491 if(dx >= 0 && dy >=0) s4s9_tmp[3] += en;
494 float s4s9_max = *std::max_element( s4s9_tmp,s4s9_tmp+4)/simple_energy;
495 s4s9Clus.push_back(s4s9_max);
519 std::vector<EcalRecHit> seedsEndCap;
522 std::vector<EEDetId> usedXtalsEndCap;
523 usedXtalsEndCap.clear();
527 for (ite=pi0eerechits->begin(); ite!=pi0eerechits->end(); ite++) {
528 double energy = ite->energy();
534 int fed = elid.
dccId();
551 std::vector<float> eClusEndCap;
552 std::vector<float> etClusEndCap;
553 std::vector<float> etaClusEndCap;
554 std::vector<float> phiClusEndCap;
555 std::vector< std::vector<EcalRecHit> > RecHitsClusterEndCap;
556 std::vector<float> s4s9ClusEndCap;
562 for (std::vector<EcalRecHit>::iterator itseed=seedsEndCap.begin(); itseed!=seedsEndCap.end(); itseed++) {
563 EEDetId seed_id = itseed->id();
564 std::vector<EEDetId>::const_iterator usedIds;
566 bool seedAlreadyUsed=
false;
567 for(usedIds=usedXtalsEndCap.begin(); usedIds!=usedXtalsEndCap.end(); usedIds++){
568 if(*usedIds==seed_id){
569 seedAlreadyUsed=
true;
574 if(seedAlreadyUsed)
continue;
577 std::vector< std::pair<DetId, float> > clus_used;
579 std::vector<EcalRecHit> RecHitsInWindow;
581 double simple_energy = 0;
583 for (std::vector<DetId>::iterator det=clus_v.begin(); det!=clus_v.end(); det++) {
586 bool HitAlreadyUsed=
false;
587 for(usedIds=usedXtalsEndCap.begin(); usedIds!=usedXtalsEndCap.end(); usedIds++){
594 if(HitAlreadyUsed)
continue;
599 int fed = elid.
dccId();
608 usedXtalsEndCap.push_back(*det);
609 RecHitsInWindow.push_back(
EERecHits[nn]);
610 clus_used.push_back( std::pair<DetId, float>(*det, 1) );
611 simple_energy = simple_energy +
EERecHits[nn].energy();
616 float theta_s = 2. * atan(
exp(-clus_pos.eta()));
617 float p0x_s = simple_energy *
sin(theta_s) *
cos(clus_pos.phi());
618 float p0y_s = simple_energy *
sin(theta_s) *
sin(clus_pos.phi());
619 float et_s =
sqrt( p0x_s*p0x_s + p0y_s*p0y_s);
621 eClusEndCap.push_back(simple_energy);
622 etClusEndCap.push_back(et_s);
623 etaClusEndCap.push_back(clus_pos.eta());
624 phiClusEndCap.push_back(clus_pos.phi());
625 RecHitsClusterEndCap.push_back(RecHitsInWindow);
630 for(
int i=0;
i<4;
i++) s4s9_tmp[
i]= 0;
632 int ixSeed = seed_id.
ix();
633 int iySeed = seed_id.
iy();
634 for(
unsigned int j=0;
j<RecHitsInWindow.size();
j++){
636 int dx = ixSeed - det_this.
ix();
637 int dy = iySeed - det_this.
iy();
639 float en = RecHitsInWindow[
j].energy();
641 if(dx <= 0 && dy <=0) s4s9_tmp[0] += en;
642 if(dx >= 0 && dy <=0) s4s9_tmp[1] += en;
643 if(dx <= 0 && dy >=0) s4s9_tmp[2] += en;
644 if(dx >= 0 && dy >=0) s4s9_tmp[3] += en;
647 float s4s9_max = *std::max_element( s4s9_tmp,s4s9_tmp+4)/simple_energy;
648 s4s9ClusEndCap.push_back(s4s9_max);
676 double phiHigh,
double etamargin,
double phimargin)
679 std::vector<int>
FEDs;
684 etaHigh += etamargin;
685 double phiMinus = phiLow - phimargin;
686 double phiPlus = phiHigh + phimargin;
689 double dd = fabs(phiPlus-phiMinus);
691 if (dd > 2.*
Geom::pi() ) all =
true;
694 while (phiMinus < 0) { phiMinus += 2.*
Geom::pi() ; }
697 double dphi = phiPlus - phiMinus;
698 if (dphi < 0) dphi += 2.*
Geom::pi() ;
704 if (fed_low1 == fed_low2) all =
true;
708 if (fed_hi1 == fed_hi2) all =
true;
729 if( ieta<=-1)
return smId - 9;
730 else return smId + 27;
742 if(neta > 0) neta -= 1;
743 if(nphi > 359) nphi=nphi-360;
746 if(nphi >359 || nphi <0 || neta< -85 || neta > 84)
748 std::cout <<
" unexpected fatal error in HLTPi0::convxtalid "<< nphi <<
" " << neta <<
" " <<std::endl;
771 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< EcalRecHit >::const_iterator const_iterator
double JETSregionEtaMargin_
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_
float ohHighestEnergyHORecHit
Cos< T >::type cos(const T &t)
const CaloSubdetectorTopology * topology_ee
const CaloSubdetectorGeometry * geometry_ee
Abs< T >::type abs(const T &t)
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_
T const * product() const
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_
const CaloSubdetectorTopology * topology_eb
math::XYZPoint Calculate_Location(const HitsAndFractions &iDetIds, const edm::SortedCollection< HitType > *iRecHits, const CaloSubdetectorGeometry *iSubGeom, const CaloSubdetectorGeometry *iESGeom=0)
std::vector< int > GetListofFEDs(const EcalEtaPhiRegion ®ion) const
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