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(ICT ict=caloTowers->begin(); ict!=caloTowers->end();ict++) {
179 if( (energy+energyEM) < 1
e-9 )
continue;
185 bool foundHCALConstituent =
false;
189 for(
unsigned int i=0;
i< hits.size();++
i) {
191 foundHCALConstituent =
true;
199 for(
unsigned int j=0;j<allConstituents.size();++j) {
228 if(foundHCALConstituent)
231 switch( detid.
subdet() ) {
235 if ( rescaleFactor > 1. ) {
241 pfrhCleaned->
setTime(rescaleFactor);
242 energy *= rescaleFactor;
257 if ( rescaleFactor > 1. ) {
263 pfrhCleaned->
setTime(rescaleFactor);
264 energy *= rescaleFactor;
286 if((energyemHF+energyhadHF) <
thresh_HF_ )
continue;
289 double longFibre = energyemHF + energyhadHF/2.;
290 double shortFibre = energyhadHF/2.;
291 int ieta = detid.
ieta();
292 int iphi = detid.
iphi();
296 iHF theLongHit = hfHandle->
find(theLongDetId);
297 iHF theShortHit = hfHandle->
find(theShortDetId);
299 double theLongHitEnergy = 0.;
300 double theShortHitEnergy = 0.;
301 bool flagShortDPG =
false;
302 bool flagLongDPG =
false;
303 bool flagShortTimeDPG =
false;
304 bool flagLongTimeDPG =
false;
305 bool flagShortPulseDPG =
false;
306 bool flagLongPulseDPG =
false;
308 if ( theLongHit != hfHandle->
end() ) {
309 int theLongFlag = theLongHit->flags();
310 theLongHitEnergy = theLongHit->energy();
320 if ( theShortHit != hfHandle->
end() ) {
321 int theShortFlag = theShortHit->flags();
322 theShortHitEnergy = theShortHit->energy();
335 flagShortTimeDPG || flagShortPulseDPG ) ) {
342 pfrhHFHADCleaned->
setTime(theShortHit->time());
355 shortFibre -= theShortHitEnergy;
356 theShortHitEnergy = 0.;
363 flagLongTimeDPG || flagLongPulseDPG ) ) {
370 pfrhHFEMCleaned->
setTime(theLongHit->time());
383 longFibre -= theLongHitEnergy;
384 theLongHitEnergy = 0.;
394 unsigned theStatusValue = theStatus->
getValue();
395 int theSeverityLevel = hcalSevLvlComputer->
getSeverityLevel(detid, 0, theStatusValue);
405 pfrhHFHADCleaned->
setTime(theShortHit->time());
419 shortFibre -= theShortHitEnergy;
420 theShortHitEnergy = 0.;
430 unsigned theStatusValue = theStatus->
getValue();
432 int theSeverityLevel = hcalSevLvlComputer->
getSeverityLevel(detid, 0, theStatusValue);
443 pfrhHFEMCleaned->
setTime(theLongHit->time());
457 longFibre -= theLongHitEnergy;
458 theLongHitEnergy = 0.;
464 if (
abs(ieta) == 29 ) {
473 pfrhHFEMCleaned29->
setTime(theLongHit->time());
481 longFibre -= theLongHitEnergy;
482 theLongHitEnergy = 0.;
491 pfrhHFHADCleaned29->
setTime(theShortHit->time());
499 shortFibre -= theShortHitEnergy;
500 theShortHitEnergy = 0.;
506 else if (
abs(ieta) == 30 ) {
507 int ieta29 = ieta > 0 ? 29 : -29;
510 iHF theLongHit29 = hfHandle->
find(theLongDetId29);
511 iHF theShortHit29 = hfHandle->
find(theShortDetId29);
513 double theLongHitEnergy29 = 0.;
514 double theShortHitEnergy29 = 0.;
515 bool flagShortDPG29 =
false;
516 bool flagLongDPG29 =
false;
517 bool flagShortTimeDPG29 =
false;
518 bool flagLongTimeDPG29 =
false;
519 bool flagShortPulseDPG29 =
false;
520 bool flagLongPulseDPG29 =
false;
522 if ( theLongHit29 != hfHandle->
end() ) {
523 int theLongFlag29 = theLongHit29->flags();
524 theLongHitEnergy29 = theLongHit29->energy() ;
534 if ( theShortHit29 != hfHandle->
end() ) {
535 int theShortFlag29 = theShortHit29->flags();
536 theShortHitEnergy29 = theShortHit29->energy();
549 flagLongTimeDPG29 || flagLongPulseDPG29 ) ) {
556 pfrhHFEMCleaned29->
setTime(theLongHit29->time());
569 longFibre -= theLongHitEnergy29;
570 theLongHitEnergy29 = 0;
576 flagShortTimeDPG29 || flagShortPulseDPG29 ) ) {
583 pfrhHFHADCleaned29->
setTime(theShortHit29->time());
596 shortFibre -= theShortHitEnergy29;
597 theShortHitEnergy29 = 0;
607 unsigned theStatusValue = theStatus->
getValue();
609 int theSeverityLevel = hcalSevLvlComputer->
getSeverityLevel(detid, 0, theStatusValue);
619 pfrhHFHADCleaned29->
setTime(theShortHit29->time());
633 shortFibre -= theShortHitEnergy29;
634 theShortHitEnergy29 = 0.;
645 unsigned theStatusValue = theStatus->
getValue();
646 int theSeverityLevel = hcalSevLvlComputer->
getSeverityLevel(detid, 0, theStatusValue);
657 pfrhHFEMCleaned29->
setTime(theLongHit29->time());
671 longFibre -= theLongHitEnergy29;
672 theLongHitEnergy29 = 0.;
685 pfrhHFEMCleaned29->
setTime(theLongHit29->time());
693 longFibre -= theLongHitEnergy29;
694 theLongHitEnergy29 = 0.;
703 pfrhHFHADCleaned29->
setTime(theShortHit29->time());
711 shortFibre -= theShortHitEnergy29;
712 theShortHitEnergy29 = 0.;
718 energyhadHF = 2.*shortFibre;
719 energyemHF = longFibre - shortFibre;
725 energyhadHF += energyemHF;
754 <<
"CaloTower constituent: unknown layer : " 764 rechitsCleaned->push_back( *pfrhCleaned );
768 HFEMRecHits->push_back( *pfrhHFEM );
772 HFHADRecHits->push_back( *pfrhHFHAD );
775 if(pfrhHFEMCleaned) {
776 rechitsCleaned->push_back( *pfrhHFEMCleaned );
777 delete pfrhHFEMCleaned;
779 if(pfrhHFHADCleaned) {
780 rechitsCleaned->push_back( *pfrhHFHADCleaned );
781 delete pfrhHFHADCleaned;
783 if(pfrhHFEMCleaned29) {
784 rechitsCleaned->push_back( *pfrhHFEMCleaned29 );
785 delete pfrhHFEMCleaned29;
787 if(pfrhHFHADCleaned29) {
788 rechitsCleaned->push_back( *pfrhHFHADCleaned29 );
789 delete pfrhHFHADCleaned29;
801 for(
unsigned int i=0;
i<
rechits->size();++
i) {
811 for(
unsigned int i=0;
i<HFEMRecHits->size();++
i) {
819 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)
const std::vector< DetId > & constituents() const
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
CaloTowerDetId id() const
const HcalTopology * theHcalTopology
double maxShortTiming_Cut
std::vector< Item >::const_iterator const_iterator
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