144 auto_ptr< vector<reco::PFRecHit> >
rechits(
new vector<reco::PFRecHit> );
145 auto_ptr< vector<reco::PFRecHit> > rechitsCleaned(
new vector<reco::PFRecHit> );
146 auto_ptr< vector<reco::PFRecHit> > HFHADRecHits(
new vector<reco::PFRecHit> );
147 auto_ptr< vector<reco::PFRecHit> > HFEMRecHits(
new vector<reco::PFRecHit> );
159 for(ICT ict=caloTowers->begin(); ict!=caloTowers->end();ict++) {
173 if( (energy+energyEM) < 1
e-9 )
continue;
179 bool foundHCALConstituent =
false;
183 for(
unsigned int i=0;
i< hits.size();++
i) {
185 foundHCALConstituent =
true;
189 for(
unsigned int j=0;
j<allConstituents.size();++
j) {
218 if(foundHCALConstituent)
221 switch( detid.
subdet() ) {
225 if ( rescaleFactor > 1. ) {
231 pfrhCleaned->
setTime(rescaleFactor);
232 energy *= rescaleFactor;
247 if ( rescaleFactor > 1. ) {
253 pfrhCleaned->
setTime(rescaleFactor);
254 energy *= rescaleFactor;
276 if((energyemHF+energyhadHF) <
thresh_HF_ )
continue;
279 double longFibre = energyemHF + energyhadHF/2.;
280 double shortFibre = energyhadHF/2.;
281 int ieta = detid.
ieta();
282 int iphi = detid.
iphi();
286 iHF theLongHit = hfHandle->find(theLongDetId);
287 iHF theShortHit = hfHandle->find(theShortDetId);
289 double theLongHitEnergy = 0.;
290 double theShortHitEnergy = 0.;
291 bool flagShortDPG =
false;
292 bool flagLongDPG =
false;
293 bool flagShortTimeDPG =
false;
294 bool flagLongTimeDPG =
false;
295 bool flagShortPulseDPG =
false;
296 bool flagLongPulseDPG =
false;
298 if ( theLongHit != hfHandle->end() ) {
299 int theLongFlag = theLongHit->flags();
300 theLongHitEnergy = theLongHit->energy();
310 if ( theShortHit != hfHandle->end() ) {
311 int theShortFlag = theShortHit->flags();
312 theShortHitEnergy = theShortHit->energy();
325 flagShortTimeDPG || flagShortPulseDPG ) ) {
332 pfrhHFHADCleaned->
setTime(theShortHit->time());
345 shortFibre -= theShortHitEnergy;
346 theShortHitEnergy = 0.;
353 flagLongTimeDPG || flagLongPulseDPG ) ) {
360 pfrhHFEMCleaned->
setTime(theLongHit->time());
373 longFibre -= theLongHitEnergy;
374 theLongHitEnergy = 0.;
384 unsigned theStatusValue = theStatus->
getValue();
385 int theSeverityLevel = hcalSevLvlComputer->
getSeverityLevel(detid, 0, theStatusValue);
395 pfrhHFHADCleaned->
setTime(theShortHit->time());
409 shortFibre -= theShortHitEnergy;
410 theShortHitEnergy = 0.;
420 unsigned theStatusValue = theStatus->
getValue();
422 int theSeverityLevel = hcalSevLvlComputer->
getSeverityLevel(detid, 0, theStatusValue);
433 pfrhHFEMCleaned->
setTime(theLongHit->time());
447 longFibre -= theLongHitEnergy;
448 theLongHitEnergy = 0.;
454 if (
abs(ieta) == 29 ) {
463 pfrhHFEMCleaned29->
setTime(theLongHit->time());
471 longFibre -= theLongHitEnergy;
472 theLongHitEnergy = 0.;
481 pfrhHFHADCleaned29->
setTime(theShortHit->time());
489 shortFibre -= theShortHitEnergy;
490 theShortHitEnergy = 0.;
496 else if (
abs(ieta) == 30 ) {
497 int ieta29 = ieta > 0 ? 29 : -29;
500 iHF theLongHit29 = hfHandle->find(theLongDetId29);
501 iHF theShortHit29 = hfHandle->find(theShortDetId29);
503 double theLongHitEnergy29 = 0.;
504 double theShortHitEnergy29 = 0.;
505 bool flagShortDPG29 =
false;
506 bool flagLongDPG29 =
false;
507 bool flagShortTimeDPG29 =
false;
508 bool flagLongTimeDPG29 =
false;
509 bool flagShortPulseDPG29 =
false;
510 bool flagLongPulseDPG29 =
false;
512 if ( theLongHit29 != hfHandle->end() ) {
513 int theLongFlag29 = theLongHit29->flags();
514 theLongHitEnergy29 = theLongHit29->energy() ;
524 if ( theShortHit29 != hfHandle->end() ) {
525 int theShortFlag29 = theShortHit29->flags();
526 theShortHitEnergy29 = theShortHit29->energy();
539 flagLongTimeDPG29 || flagLongPulseDPG29 ) ) {
546 pfrhHFEMCleaned29->
setTime(theLongHit29->time());
559 longFibre -= theLongHitEnergy29;
560 theLongHitEnergy29 = 0;
566 flagShortTimeDPG29 || flagShortPulseDPG29 ) ) {
573 pfrhHFHADCleaned29->
setTime(theShortHit29->time());
586 shortFibre -= theShortHitEnergy29;
587 theShortHitEnergy29 = 0.;
597 unsigned theStatusValue = theStatus->
getValue();
599 int theSeverityLevel = hcalSevLvlComputer->
getSeverityLevel(detid, 0, theStatusValue);
609 pfrhHFHADCleaned29->
setTime(theShortHit29->time());
623 shortFibre -= theShortHitEnergy29;
624 theShortHitEnergy29 = 0.;
635 unsigned theStatusValue = theStatus->
getValue();
636 int theSeverityLevel = hcalSevLvlComputer->
getSeverityLevel(detid, 0, theStatusValue);
647 pfrhHFEMCleaned29->
setTime(theLongHit29->time());
661 longFibre -= theLongHitEnergy29;
662 theLongHitEnergy29 = 0.;
675 pfrhHFEMCleaned29->
setTime(theLongHit29->time());
683 longFibre -= theLongHitEnergy29;
684 theLongHitEnergy29 = 0.;
693 pfrhHFHADCleaned29->
setTime(theShortHit29->time());
701 shortFibre -= theShortHitEnergy29;
702 theShortHitEnergy29 = 0.;
708 energyhadHF = 2.*shortFibre;
709 energyemHF = longFibre - shortFibre;
715 energyhadHF += energyemHF;
744 <<
"CaloTower constituent: unknown layer : "
754 rechitsCleaned->push_back( *pfrhCleaned );
758 HFEMRecHits->push_back( *pfrhHFEM );
762 HFHADRecHits->push_back( *pfrhHFHAD );
765 if(pfrhHFEMCleaned) {
766 rechitsCleaned->push_back( *pfrhHFEMCleaned );
767 delete pfrhHFEMCleaned;
769 if(pfrhHFHADCleaned) {
770 rechitsCleaned->push_back( *pfrhHFHADCleaned );
771 delete pfrhHFHADCleaned;
773 if(pfrhHFEMCleaned29) {
774 rechitsCleaned->push_back( *pfrhHFEMCleaned29 );
775 delete pfrhHFEMCleaned29;
777 if(pfrhHFHADCleaned29) {
778 rechitsCleaned->push_back( *pfrhHFHADCleaned29 );
779 delete pfrhHFHADCleaned29;
791 for(
unsigned int i=0;
i<
rechits->size();++
i) {
801 for(
unsigned int i=0;
i<HFEMRecHits->size();++
i) {
809 for(
unsigned int i=0;
i<HFHADRecHits->size();++
i) {
815 iEvent.
put( rechitsCleaned,
"Cleaned" );
816 iEvent.
put( HFEMRecHits,
"HFEM" );
817 iEvent.
put( HFHADRecHits,
"HFHAD" );
PFRecHitNavigatorBase * navigator_
unsigned int ECAL_Dead_Code_
HcalSubdetector subdet() const
get the subdetector
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual void associateNeighbours(reco::PFRecHit &, std::auto_ptr< reco::PFRecHitCollection > &, edm::RefProd< reco::PFRecHitCollection > &)=0
double thresh_HF_
threshold for HF
edm::EDGetTokenT< HBHERecHitCollection > hcalToken_
std::vector< CaloTower >::const_iterator const_iterator
edm::EDGetTokenT< CaloTowerCollection > towersToken_
int hcalHFLongShortFlagValue_
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_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
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
int iphi() const
get the cell iphi
CaloTowerDetId id() const
double maxShortTiming_Cut
std::vector< Item >::const_iterator const_iterator
T const * product() const
double shortFibre_Fraction
int getSeverityLevel(const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
const EcalChannelStatus * theEcalChStatus
const_iterator find(uint32_t rawId) const
const_iterator end() const
uint32_t getValue() const
int hcalHFInTimeWindowFlagValue_
int HcalMaxAllowedChannelStatusSev_
virtual void beginEvent(const edm::EventSetup &)=0