145 auto_ptr< vector<reco::PFRecHit> >
rechits(
new vector<reco::PFRecHit> );
146 auto_ptr< vector<reco::PFRecHit> > rechitsCleaned(
new vector<reco::PFRecHit> );
147 auto_ptr< vector<reco::PFRecHit> > HFHADRecHits(
new vector<reco::PFRecHit> );
148 auto_ptr< vector<reco::PFRecHit> > HFEMRecHits(
new vector<reco::PFRecHit> );
160 for(ICT ict=caloTowers->begin(); ict!=caloTowers->end();ict++) {
174 if( (energy+energyEM) < 1
e-9 )
continue;
180 bool foundHCALConstituent =
false;
184 for(
unsigned int i=0;
i< hits.size();++
i) {
186 foundHCALConstituent =
true;
190 for(
unsigned int j=0;
j<allConstituents.size();++
j) {
219 if(foundHCALConstituent)
222 switch( detid.
subdet() ) {
226 if ( rescaleFactor > 1. ) {
232 pfrhCleaned->
setTime(rescaleFactor);
233 energy *= rescaleFactor;
248 if ( rescaleFactor > 1. ) {
254 pfrhCleaned->
setTime(rescaleFactor);
255 energy *= rescaleFactor;
277 if((energyemHF+energyhadHF) <
thresh_HF_ )
continue;
280 double longFibre = energyemHF + energyhadHF/2.;
281 double shortFibre = energyhadHF/2.;
282 int ieta = detid.
ieta();
283 int iphi = detid.
iphi();
287 iHF theLongHit = hfHandle->find(theLongDetId);
288 iHF theShortHit = hfHandle->find(theShortDetId);
290 double theLongHitEnergy = 0.;
291 double theShortHitEnergy = 0.;
292 bool flagShortDPG =
false;
293 bool flagLongDPG =
false;
294 bool flagShortTimeDPG =
false;
295 bool flagLongTimeDPG =
false;
296 bool flagShortPulseDPG =
false;
297 bool flagLongPulseDPG =
false;
299 if ( theLongHit != hfHandle->end() ) {
300 int theLongFlag = theLongHit->flags();
301 theLongHitEnergy = theLongHit->energy();
311 if ( theShortHit != hfHandle->end() ) {
312 int theShortFlag = theShortHit->flags();
313 theShortHitEnergy = theShortHit->energy();
326 flagShortTimeDPG || flagShortPulseDPG ) ) {
333 pfrhHFHADCleaned->
setTime(theShortHit->time());
346 shortFibre -= theShortHitEnergy;
347 theShortHitEnergy = 0.;
354 flagLongTimeDPG || flagLongPulseDPG ) ) {
361 pfrhHFEMCleaned->
setTime(theLongHit->time());
374 longFibre -= theLongHitEnergy;
375 theLongHitEnergy = 0.;
385 unsigned theStatusValue = theStatus->
getValue();
386 int theSeverityLevel = hcalSevLvlComputer->
getSeverityLevel(detid, 0, theStatusValue);
396 pfrhHFHADCleaned->
setTime(theShortHit->time());
410 shortFibre -= theShortHitEnergy;
411 theShortHitEnergy = 0.;
421 unsigned theStatusValue = theStatus->
getValue();
423 int theSeverityLevel = hcalSevLvlComputer->
getSeverityLevel(detid, 0, theStatusValue);
434 pfrhHFEMCleaned->
setTime(theLongHit->time());
448 longFibre -= theLongHitEnergy;
449 theLongHitEnergy = 0.;
455 if (
abs(ieta) == 29 ) {
464 pfrhHFEMCleaned29->
setTime(theLongHit->time());
472 longFibre -= theLongHitEnergy;
473 theLongHitEnergy = 0.;
482 pfrhHFHADCleaned29->
setTime(theShortHit->time());
490 shortFibre -= theShortHitEnergy;
491 theShortHitEnergy = 0.;
497 else if (
abs(ieta) == 30 ) {
498 int ieta29 = ieta > 0 ? 29 : -29;
501 iHF theLongHit29 = hfHandle->find(theLongDetId29);
502 iHF theShortHit29 = hfHandle->find(theShortDetId29);
504 double theLongHitEnergy29 = 0.;
505 double theShortHitEnergy29 = 0.;
506 bool flagShortDPG29 =
false;
507 bool flagLongDPG29 =
false;
508 bool flagShortTimeDPG29 =
false;
509 bool flagLongTimeDPG29 =
false;
510 bool flagShortPulseDPG29 =
false;
511 bool flagLongPulseDPG29 =
false;
513 if ( theLongHit29 != hfHandle->end() ) {
514 int theLongFlag29 = theLongHit29->flags();
515 theLongHitEnergy29 = theLongHit29->energy() ;
525 if ( theShortHit29 != hfHandle->end() ) {
526 int theShortFlag29 = theShortHit29->flags();
527 theShortHitEnergy29 = theShortHit29->energy();
540 flagLongTimeDPG29 || flagLongPulseDPG29 ) ) {
547 pfrhHFEMCleaned29->
setTime(theLongHit29->time());
560 longFibre -= theLongHitEnergy29;
561 theLongHitEnergy29 = 0;
567 flagShortTimeDPG29 || flagShortPulseDPG29 ) ) {
574 pfrhHFHADCleaned29->
setTime(theShortHit29->time());
587 shortFibre -= theShortHitEnergy29;
588 theShortHitEnergy29 = 0.;
598 unsigned theStatusValue = theStatus->
getValue();
600 int theSeverityLevel = hcalSevLvlComputer->
getSeverityLevel(detid, 0, theStatusValue);
610 pfrhHFHADCleaned29->
setTime(theShortHit29->time());
624 shortFibre -= theShortHitEnergy29;
625 theShortHitEnergy29 = 0.;
636 unsigned theStatusValue = theStatus->
getValue();
637 int theSeverityLevel = hcalSevLvlComputer->
getSeverityLevel(detid, 0, theStatusValue);
648 pfrhHFEMCleaned29->
setTime(theLongHit29->time());
662 longFibre -= theLongHitEnergy29;
663 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
const T & max(const T &a, const T &b)
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