150 auto rechits = std::make_unique<std::vector<reco::PFRecHit>>();
151 auto rechitsCleaned = std::make_unique<std::vector<reco::PFRecHit>>();
152 auto HFHADRecHits = std::make_unique<std::vector<reco::PFRecHit>>();
153 auto HFEMRecHits = std::make_unique<std::vector<reco::PFRecHit>>();
165 for(
auto const & ct : *caloTowers) {
172 double energy = ct.hadEnergy();
174 double energyEM = ct.emEnergy();
176 if( (energy+energyEM) < 1
e-9 )
continue;
179 const std::vector<DetId>&
hits = ct.constituents();
182 bool foundHCALConstituent =
false;
186 for(
auto hit : hits) {
188 foundHCALConstituent =
true;
196 for(
auto allConstituent : allConstituents) {
225 if(foundHCALConstituent)
228 switch( detid.
subdet() ) {
232 if ( rescaleFactor > 1. ) {
238 pfrhCleaned->
setTime(rescaleFactor);
239 energy *= rescaleFactor;
254 if ( rescaleFactor > 1. ) {
260 pfrhCleaned->
setTime(rescaleFactor);
261 energy *= rescaleFactor;
283 if((energyemHF+energyhadHF) <
thresh_HF_ )
continue;
286 double longFibre = energyemHF + energyhadHF/2.;
287 double shortFibre = energyhadHF/2.;
288 int ieta = detid.
ieta();
289 int iphi = detid.
iphi();
293 auto theLongHit = hfHandle->
find(theLongDetId);
294 auto theShortHit = hfHandle->
find(theShortDetId);
296 double theLongHitEnergy = 0.;
297 double theShortHitEnergy = 0.;
298 bool flagShortDPG =
false;
299 bool flagLongDPG =
false;
300 bool flagShortTimeDPG =
false;
301 bool flagLongTimeDPG =
false;
302 bool flagShortPulseDPG =
false;
303 bool flagLongPulseDPG =
false;
305 if ( theLongHit != hfHandle->
end() ) {
306 int theLongFlag = theLongHit->flags();
307 theLongHitEnergy = theLongHit->energy();
317 if ( theShortHit != hfHandle->
end() ) {
318 int theShortFlag = theShortHit->flags();
319 theShortHitEnergy = theShortHit->energy();
332 flagShortTimeDPG || flagShortPulseDPG ) ) {
339 pfrhHFHADCleaned->
setTime(theShortHit->time());
352 shortFibre -= theShortHitEnergy;
353 theShortHitEnergy = 0.;
360 flagLongTimeDPG || flagLongPulseDPG ) ) {
367 pfrhHFEMCleaned->
setTime(theLongHit->time());
380 longFibre -= theLongHitEnergy;
381 theLongHitEnergy = 0.;
391 unsigned theStatusValue = theStatus->
getValue();
392 int theSeverityLevel = hcalSevLvlComputer->
getSeverityLevel(detid, 0, theStatusValue);
402 pfrhHFHADCleaned->
setTime(theShortHit->time());
416 shortFibre -= theShortHitEnergy;
417 theShortHitEnergy = 0.;
427 unsigned theStatusValue = theStatus->
getValue();
429 int theSeverityLevel = hcalSevLvlComputer->
getSeverityLevel(detid, 0, theStatusValue);
440 pfrhHFEMCleaned->
setTime(theLongHit->time());
454 longFibre -= theLongHitEnergy;
455 theLongHitEnergy = 0.;
461 if (
abs(ieta) == 29 ) {
470 pfrhHFEMCleaned29->
setTime(theLongHit->time());
478 longFibre -= theLongHitEnergy;
479 theLongHitEnergy = 0.;
488 pfrhHFHADCleaned29->
setTime(theShortHit->time());
496 shortFibre -= theShortHitEnergy;
497 theShortHitEnergy = 0.;
503 else if (
abs(ieta) == 30 ) {
504 int ieta29 = ieta > 0 ? 29 : -29;
507 auto theLongHit29 = hfHandle->
find(theLongDetId29);
508 auto theShortHit29 = hfHandle->
find(theShortDetId29);
510 double theLongHitEnergy29 = 0.;
511 double theShortHitEnergy29 = 0.;
512 bool flagShortDPG29 =
false;
513 bool flagLongDPG29 =
false;
514 bool flagShortTimeDPG29 =
false;
515 bool flagLongTimeDPG29 =
false;
516 bool flagShortPulseDPG29 =
false;
517 bool flagLongPulseDPG29 =
false;
519 if ( theLongHit29 != hfHandle->
end() ) {
520 int theLongFlag29 = theLongHit29->flags();
521 theLongHitEnergy29 = theLongHit29->energy() ;
531 if ( theShortHit29 != hfHandle->
end() ) {
532 int theShortFlag29 = theShortHit29->flags();
533 theShortHitEnergy29 = theShortHit29->energy();
546 flagLongTimeDPG29 || flagLongPulseDPG29 ) ) {
553 pfrhHFEMCleaned29->
setTime(theLongHit29->time());
566 longFibre -= theLongHitEnergy29;
567 theLongHitEnergy29 = 0;
573 flagShortTimeDPG29 || flagShortPulseDPG29 ) ) {
580 pfrhHFHADCleaned29->
setTime(theShortHit29->time());
593 shortFibre -= theShortHitEnergy29;
594 theShortHitEnergy29 = 0;
604 unsigned theStatusValue = theStatus->
getValue();
606 int theSeverityLevel = hcalSevLvlComputer->
getSeverityLevel(detid, 0, theStatusValue);
616 pfrhHFHADCleaned29->
setTime(theShortHit29->time());
630 shortFibre -= theShortHitEnergy29;
631 theShortHitEnergy29 = 0.;
642 unsigned theStatusValue = theStatus->
getValue();
643 int theSeverityLevel = hcalSevLvlComputer->
getSeverityLevel(detid, 0, theStatusValue);
654 pfrhHFEMCleaned29->
setTime(theLongHit29->time());
668 longFibre -= theLongHitEnergy29;
669 theLongHitEnergy29 = 0.;
682 pfrhHFEMCleaned29->
setTime(theLongHit29->time());
690 longFibre -= theLongHitEnergy29;
691 theLongHitEnergy29 = 0.;
700 pfrhHFHADCleaned29->
setTime(theShortHit29->time());
708 shortFibre -= theShortHitEnergy29;
709 theShortHitEnergy29 = 0.;
715 energyhadHF = 2.*shortFibre;
716 energyemHF = longFibre - shortFibre;
722 energyhadHF += energyemHF;
751 <<
"CaloTower constituent: unknown layer : " 761 rechitsCleaned->push_back( *pfrhCleaned );
765 HFEMRecHits->push_back( *pfrhHFEM );
769 HFHADRecHits->push_back( *pfrhHFHAD );
772 if(pfrhHFEMCleaned) {
773 rechitsCleaned->push_back( *pfrhHFEMCleaned );
774 delete pfrhHFEMCleaned;
776 if(pfrhHFHADCleaned) {
777 rechitsCleaned->push_back( *pfrhHFHADCleaned );
778 delete pfrhHFHADCleaned;
780 if(pfrhHFEMCleaned29) {
781 rechitsCleaned->push_back( *pfrhHFEMCleaned29 );
782 delete pfrhHFEMCleaned29;
784 if(pfrhHFHADCleaned29) {
785 rechitsCleaned->push_back( *pfrhHFHADCleaned29 );
786 delete pfrhHFHADCleaned29;
798 for(
unsigned int i=0;
i<
rechits->size();++
i) {
808 for(
unsigned int i=0;
i<HFEMRecHits->size();++
i) {
816 for(
unsigned int i=0;
i<HFHADRecHits->size();++
i) {
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
PFRecHitNavigatorBase * navigator_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
unsigned int ECAL_Dead_Code_
HcalSubdetector subdet() const
get the subdetector
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double thresh_HF_
threshold for HF
edm::EDGetTokenT< HBHERecHitCollection > hcalToken_
std::vector< CaloTower >::const_iterator const_iterator
edm::EDGetTokenT< CaloTowerCollection > towersToken_
int hcalHFLongShortFlagValue_
virtual void associateNeighbours(reco::PFRecHit &, std::unique_ptr< reco::PFRecHitCollection > &, edm::RefProd< reco::PFRecHitCollection > &)=0
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
const Item * getValues(DetId fId, bool throwOnFail=true) const
reco::PFRecHit * createHcalRecHit(const DetId &detid, double energy, PFLayer::Layer layer, const CaloSubdetectorGeometry *geom, const CaloTowerDetId &newDetId)
edm::EDGetTokenT< HFRecHitCollection > hfToken_
double longFibre_Fraction
double longShortFibre_Cut
std::vector< DetId > constituentsOf(const CaloTowerDetId &id) const
Get the constituent detids for this tower id ( not yet implemented )
double ECAL_Compensation_
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
double minShortTiming_Cut
int HcalMaxAllowedHFInTimeWindowSev_
const HcalChannelQuality * theHcalChStatus
int ieta() const
get the cell ieta
int hcalHFDigiTimeFlagValue_
Abs< T >::type abs(const T &t)
int HcalMaxAllowedHFLongShortSev_
int HcalMaxAllowedHFDigiTimeSev_
void setTime(double time)
RefProd< PROD > getRefBeforePut()
const CaloTowerConstituentsMap * theTowerConstituentsMap
const_iterator end() const
int iphi() const
get the cell iphi
const HcalTopology * theHcalTopology
double maxShortTiming_Cut
double shortFibre_Fraction
int getSeverityLevel(const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
iterator find(key_type k)
const EcalChannelStatus * theEcalChStatus
const_iterator find(uint32_t rawId) const
HcalDetId idFront(const HcalDetId &id) const
const_iterator end() const
uint32_t getValue() const
bool withSpecialRBXHBHE() const
int hcalHFInTimeWindowFlagValue_
T const * product() const
int HcalMaxAllowedChannelStatusSev_
virtual void beginEvent(const edm::EventSetup &)=0