9 #include "Math/Interpolator.h" 15 : theEBthreshold(-1000.),
16 theEEthreshold(-1000.),
18 theUseEtEBTresholdFlag(
false),
19 theUseEtEETresholdFlag(
false),
20 theUseSymEBTresholdFlag(
false),
21 theUseSymEETresholdFlag(
false),
24 theHcalThreshold(-1000.),
25 theHBthreshold(-1000.),
26 theHESthreshold(-1000.),
27 theHESthreshold1(-1000.),
28 theHEDthreshold(-1000.),
29 theHEDthreshold1(-1000.),
30 theHOthreshold0(-1000.),
31 theHOthresholdPlus1(-1000.),
32 theHOthresholdMinus1(-1000.),
33 theHOthresholdPlus2(-1000.),
34 theHOthresholdMinus2(-1000.),
35 theHF1threshold(-1000.),
36 theHF2threshold(-1000.),
37 theEBGrid(
std::vector<double>(5,10.)),
38 theEBWeights(
std::vector<double>(5,1.)),
39 theEEGrid(
std::vector<double>(5,10.)),
40 theEEWeights(
std::vector<double>(5,1.)),
41 theHBGrid(
std::vector<double>(5,10.)),
42 theHBWeights(
std::vector<double>(5,1.)),
43 theHESGrid(
std::vector<double>(5,10.)),
44 theHESWeights(
std::vector<double>(5,1.)),
45 theHEDGrid(
std::vector<double>(5,10.)),
46 theHEDWeights(
std::vector<double>(5,1.)),
47 theHOGrid(
std::vector<double>(5,10.)),
48 theHOWeights(
std::vector<double>(5,1.)),
49 theHF1Grid(
std::vector<double>(5,10.)),
50 theHF1Weights(
std::vector<double>(5,1.)),
51 theHF2Grid(
std::vector<double>(5,10.)),
52 theHF2Weights(
std::vector<double>(5,1.)),
62 theEBSumThreshold(-1000.),
63 theEESumThreshold(-1000.),
74 theTowerConstituentsMap(
nullptr),
75 theHcalAcceptSeverityLevel(0),
76 theRecoveredHcalHitsAreUsed(
false),
77 theRecoveredEcalHitsAreUsed(
false),
78 useRejectedHitsOnly(
false),
79 theHcalAcceptSeverityLevelForRejectedHit(0),
80 useRejectedRecoveredHcalHits(0),
81 useRejectedRecoveredEcalHits(0),
84 theMomConstrMethod(0),
97 bool useSymEBTreshold,
98 bool useSymEETreshold,
102 double HESthreshold,
double HESthreshold1,
103 double HEDthreshold,
double HEDthreshold1,
104 double HOthreshold0,
double HOthresholdPlus1,
double HOthresholdMinus1,
105 double HOthresholdPlus2,
double HOthresholdMinus2,
106 double HF1threshold,
double HF2threshold,
107 double EBweight,
double EEweight,
108 double HBweight,
double HESweight,
double HEDweight,
109 double HOweight,
double HF1weight,
double HF2weight,
198 bool useEtEBTreshold,
199 bool useEtEETreshold,
200 bool useSymEBTreshold,
201 bool useSymEETreshold,
205 double HESthreshold,
double HESthreshold1,
206 double HEDthreshold,
double HEDthreshold1,
207 double HOthreshold0,
double HOthresholdPlus1,
double HOthresholdMinus1,
208 double HOthresholdPlus2,
double HOthresholdMinus2,
209 double HF1threshold,
double HF2threshold,
210 const std::vector<double> &
EBGrid,
const std::vector<double> &
EBWeights,
211 const std::vector<double> &
EEGrid,
const std::vector<double> &
EEWeights,
212 const std::vector<double> &
HBGrid,
const std::vector<double> &
HBWeights,
215 const std::vector<double> &
HOGrid,
const std::vector<double> &
HOWeights,
218 double EBweight,
double EEweight,
219 double HBweight,
double HESweight,
double HEDweight,
220 double HOweight,
double HF1weight,
double HF2weight,
331 hbheItr != hbhe.
end(); ++hbheItr)
337 hoItr != ho.
end(); ++hoItr)
343 hfItr != hf.
end(); ++hfItr)
349 ecItr != ec.
end(); ++ecItr)
359 ctcItr != ctc.
end(); ++ctcItr) {
390 ctcItr != ctc.
end(); ++ctcItr) {
393 double newE_em = ctcItr->emEnergy();
394 double newE_had = ctcItr->hadEnergy();
395 double newE_outer = ctcItr->outerEnergy();
402 double E_short = 0.5 * newE_had;
403 double E_long = newE_em + 0.5 * newE_had;
408 newE_em = E_long - E_short;
409 newE_had = 2.0 * E_short;
415 for (
unsigned int iConst = 0; iConst < ctcItr->constituentsSize(); ++iConst) {
416 DetId constId = ctcItr->constituent(iConst);
423 for (
unsigned int iConst = 0; iConst < ctcItr->constituentsSize(); ++iConst) {
424 DetId constId = ctcItr->constituent(iConst);
432 for (
unsigned int iConst = 0; iConst < ctcItr->constituentsSize(); ++iConst) {
433 DetId constId = ctcItr->constituent(iConst);
451 double f_em = 1.0/cosh(emPoint.
eta());
452 double f_had = 1.0/cosh(hadPoint.
eta());
461 double newE_tot = newE_em + newE_had;
468 CaloTower rescaledTower(twrId, newE_em, newE_had, newE_outer, -1, -1, towerP4, emPoint, hadPoint);
470 rescaledTower.setEcalTime(
int(ctcItr->ecalTime()*100.0 + 0.5) );
471 rescaledTower.setHcalTime(
int(ctcItr->hcalTime()*100.0 + 0.5) );
479 for (
unsigned int iConst = 0; iConst < ctcItr->constituentsSize(); ++iConst) {
480 contains.push_back(ctcItr->constituent(iConst));
482 rescaledTower.addConstituents(contains);
484 rescaledTower.setCaloTowerStatus(ctcItr->towerStatusWord());
514 double energy = recHit->
energy();
537 if (towerDetId.
null())
return;
543 tower29.numBadHcalCells += 1;
546 else if (0.5*energy >= threshold) {
549 if (towerDetId.
null())
return;
557 tower29.numRecHcalCells += 1;
561 tower29.numProbHcalCells += 1;
565 double e28 = 0.5 *
e;
566 double e29 = 0.5 *
e;
568 tower28.
E_had += e28;
570 std::pair<DetId,float>
mc(detId,e28);
573 tower29.E_had += e29;
575 tower29.metaConstituents.push_back(mc);
583 tower29.hadSumTimeTimesE += ( e29 * recHit->
time() );
584 tower29.hadSumEForTime += e29;
589 tower29.E_outer += e29;
601 if (towerDetId.
null())
return;
608 else if (energy >= threshold) {
624 std::pair<DetId,float>
mc(detId,e);
636 if (towerDetId.
null())
return;
641 else if (energy >= threshold) {
643 if (towerDetId.
null())
return;
646 if (hcalDetId.
depth() == 1) {
670 std::pair<DetId,float>
mc(detId,e);
681 if (towerDetId.
null())
return;
685 else if (energy >= threshold) {
687 if (towerDetId.
null())
return;
708 if(theHcalPhase==0) {
716 else if(theHcalPhase==1) {
726 std::pair<DetId,float>
mc(detId,e);
740 unsigned int chStatusForCT;
741 bool ecalIsBad=
false;
751 double energy = recHit->
energy();
761 bool passEmThreshold =
false;
766 else passEmThreshold = (energy >=
threshold);
772 else passEmThreshold = (energy >=
threshold);
776 if (towerDetId.
null())
return;
818 std::pair<DetId,float>
mc(detId,e);
833 if (towerDetId.
null())
return;
863 std::pair<DetId, float>
mc(detId, 0);
895 assert(
id.rawId()!=0);
900 double E_had=mt.
E_had;
914 std::vector<std::pair<DetId,float> > metaContains_noecal;
916 for (std::vector<std::pair<DetId,float> >::iterator
i=metaContains.begin();
i!=metaContains.end(); ++
i)
917 if (
i->first.det()!=
DetId::Ecal) metaContains_noecal.push_back(*
i);
918 metaContains.swap(metaContains_noecal);
927 std::vector<std::pair<DetId,float> > metaContains_nohcal;
929 for (std::vector<std::pair<DetId,float> >::iterator
i=metaContains.begin();
i!=metaContains.end(); ++
i)
930 if (
i->first.det()!=
DetId::Hcal) metaContains_nohcal.push_back(*
i);
931 metaContains.swap(metaContains_nohcal);
934 if(metaContains.empty())
return;
952 double momEmDepth = 0.;
953 double momHadDepth = 0.;
954 if (
id.ietaAbs()<=17) {
988 emPoint =
emShwrPos(metaContains, momEmDepth, E_em);
996 if ( (E_had + E_outer) >0) {
997 massless = (E_em<=0);
1063 if unlikely ( (towerP4[3]==0) & (E_outer>0) ) {
1065 collection.emplace_back(
id, E_em, E_had, E_outer, -1, -1,
CaloTower::PolarLorentzVector(val,hadPoint.
eta(), hadPoint.
phi(),0), emPoint, hadPoint);
1067 collection.emplace_back(
id, E_em, E_had, E_outer, -1, -1,
GlobalVector(towerP4), towerP4[3], mass2, emPoint, hadPoint);
1069 auto & caloTower = collection.
back();
1095 unsigned int numBadEcalChan = 0;
1104 if (dropChItr !=
hcalDropChMap.end()) numBadHcalChan += dropChItr->second;
1161 caloTower.setCaloTowerStatus(numBadHcalChan, numBadEcalChan,
1162 numRecHcalChan, numRecEcalChan,
1163 numProbHcalChan, numProbEcalChan);
1165 double maxCellE = -999.0;
1168 contains.reserve(metaContains.size());
1169 for (std::vector<std::pair<DetId,float> >::iterator
i=metaContains.begin();
i!=metaContains.end(); ++
i) {
1171 contains.push_back(
i->first);
1173 if (maxCellE < i->
second) {
1181 maxCellE =
i->second;
1185 maxCellE =
i->second;
1193 caloTower.setConstituents(
std::move(contains));
1194 caloTower.setHottestCellE(maxCellE);
1265 else if(hcalDetId.
ieta() < 0) {
1280 if(hcalDetId.
depth() == 1) {
1298 edm::LogError(
"CaloTowersCreationAlgo") <<
"Bad cell: " << det << std::endl;
1347 if (fracDepth<=0)
return point;
1348 if (fracDepth>1) fracDepth=1;
1350 const GlobalPoint& backPoint = cellGeometry->getBackPoint();
1351 point += fracDepth * (backPoint-
point);
1363 float fracDepth,
double hadE) {
1368 std::cout <<
"hadShwrPos called with " << metaContains.size()
1369 <<
" elements and energy " << hadE <<
":" << fracDepth
1380 std::vector<std::pair<DetId,float> >::const_iterator mc_it = metaContains.begin();
1381 for (; mc_it!=metaContains.end(); ++mc_it) {
1396 return GlobalPoint(hadX/nConst, hadY/nConst, hadZ/nConst);
1407 std::cout <<
"hadShwrPos " << towerId <<
" frac " << fracDepth << std::endl;
1409 if (fracDepth < 0) fracDepth = 0;
1410 else if (fracDepth > 1) fracDepth = 1;
1414 int iEta = towerId.
ieta();
1415 int iPhi = towerId.
iphi();
1427 int frontDepth = 1000;
1428 int backDepth = -1000;
1429 for(
unsigned i = 0;
i < items.size();
i++){
1445 std::cout <<
"Front " << frontCellId <<
" Back " << backCellId
1446 <<
" Depths " << frontDepth <<
":" << backDepth << std::endl;
1453 std::cout << towerId28 <<
" with " << items28.size() <<
" constituents:";
1454 for (
unsigned k=0;
k<items28.size(); ++
k)
1458 for(
unsigned i = 0;
i < items28.size();
i++){
1469 std::cout <<
"Back " << backDepth <<
" ID " << backCellId << std::endl;
1482 HcalDetId hid1(frontCellId), hid2(backCellId);
1498 const GlobalPoint& backPoint = backCellGeometry->getBackPoint();
1500 point += fracDepth * (backPoint -
point);
1507 float fracDepth,
double emE) {
1517 std::vector<std::pair<DetId,float> >::const_iterator mc_it = metaContains.begin();
1518 for (; mc_it!=metaContains.end(); ++mc_it) {
1521 double e = mc_it->second;
1537 float fracDepth,
double emE) {
1544 double sumWeights = 0;
1546 double crystalThresh = 0.015 * emE;
1548 std::vector<std::pair<DetId,float> >::const_iterator mc_it = metaContains.begin();
1549 for (; mc_it!=metaContains.end(); ++mc_it) {
1550 if (mc_it->second < 0)
continue;
1551 if (mc_it->first.det() ==
DetId::Ecal && mc_it->second > crystalThresh) sumEmE += mc_it->second;
1554 for (mc_it = metaContains.begin(); mc_it!=metaContains.end(); ++mc_it) {
1556 if (mc_it->first.det() !=
DetId::Ecal || mc_it->second < crystalThresh)
continue;
1560 weight = 4.2 +
log(mc_it->second/sumEmE);
1568 return GlobalPoint(emX/sumWeights, emY/sumWeights, emZ/sumWeights);
1577 const float timeUnit = 0.01;
1579 if (time> 300.0)
return 30000;
1580 if (time< -300.0)
return -30000;
1582 return int(time/timeUnit + 0.5);
1604 std::cout <<
"DropChMap with " << allChanInStatusCont.size() <<
" channels" 1607 for (std::vector<DetId>::iterator it = allChanInStatusCont.begin(); it!=allChanInStatusCont.end(); ++it) {
1652 for (std::vector<DetId>::iterator ac_it=allConstituents.begin();
1653 ac_it!=allConstituents.end(); ++ac_it) {
1692 const uint32_t recHitFlag = hit->
flags();
std::vector< double > theHBGrid
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
bool theUseEtEETresholdFlag
const HcalChannelQuality * theHcalChStatus
bool mergedDepth29(HcalDetId id) const
size_t constituentsSize() const
bool contains(EventRange const &lh, EventID const &rh)
HcalSubdetector subdet() const
get the subdetector
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
int ietaAbs() const
get the absolute value of the tower ieta
const DetId & detid() const
DetId constituent(size_t i) const
void setHF1EScale(double scale)
std::vector< double > theHESGrid
std::vector< double > theHEDGrid
GlobalPoint emCrystalShwrPos(DetId detId, float fracDepth)
void assignHitHcal(const CaloRecHit *recHit)
std::vector< int > theEcalSeveritiesToBeUsedInBadTowers
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Geom::Phi< T > phi() const
Basic3DVector unit() const
Global3DPoint GlobalPoint
const DetId & detid() const
std::vector< HBHERecHit >::const_iterator const_iterator
GlobalPoint emShwrPos(const std::vector< std::pair< DetId, float > > &metaContains, float fracDepth, double totEmE)
void push_back(T const &t)
void setHF2EScale(double scale)
void finish(CaloTowerCollection &destCollection)
const Item * getValues(DetId fId, bool throwOnFail=true) const
std::vector< double > theHOWeights
bool validHcal(const HcalDetId &id) const
MetaTower & find(const CaloTowerDetId &id)
looks for a given tower in the internal cache. If it can't find it, it makes it.
std::vector< double > theEEGrid
void rescale(const CaloTower *ct)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
bool getMergePositionFlag() const
void setHBEScale(double scale)
std::vector< DetId > constituentsOf(const CaloTowerDetId &id) const
Get the constituent detids for this tower id ( not yet implemented )
HcalDetId mergedDepthDetId(const HcalDetId &id) const
std::vector< double > theEEWeights
std::vector< double > theHESWeights
U second(std::pair< T, U > const &p)
void setGeometry(const CaloTowerTopology *cttopo, const CaloTowerConstituentsMap *ctmap, const HcalTopology *htopo, const CaloGeometry *geo)
GlobalPoint hadShwrPos(const std::vector< std::pair< DetId, float > > &metaContains, float fracDepth, double hadE)
const CaloSubdetectorGeometry * theTowerGeometry
CaloTowerDetId detIdFromDenseIndex(uint32_t din) const
int depth() const
get the tower depth
unsigned int hcalChanStatusForCaloTower(const CaloRecHit *hit)
CaloTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
std::vector< double > theHF2Grid
std::vector< double > theHEDWeights
unsigned int useRejectedRecoveredEcalHits
void rescaleTowers(const CaloTowerCollection &ctInput, CaloTowerCollection &ctResult)
static const int SubdetId
std::vector< DetId > getAllChannels() const
bool recoveredRecHit(const DetId &myid, const uint32_t &myflag) const
const CaloGeometry * theGeometry
int ieta() const
get the cell ieta
GlobalPoint emShwrLogWeightPos(const std::vector< std::pair< DetId, float > > &metaContains, float fracDepth, double totEmE)
int iphi() const
get the tower iphi
Abs< T >::type abs(const T &t)
std::vector< double > theHOGrid
void assignHitEcal(const EcalRecHit *recHit)
adds a single hit to the tower
bool dropChannel(const uint32_t &mystatus) const
const CaloTowerConstituentsMap * theTowerConstituentsMap
double theHOthresholdPlus1
void convert(const CaloTowerDetId &id, const MetaTower &mt, CaloTowerCollection &collection)
const CaloTowerTopology * theTowerTopology
std::vector< double > theHF1Weights
int firstHEDoublePhiRing() const
GlobalPoint hadSegmentShwrPos(DetId detId, float fracDepth)
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool theRecoveredHcalHitsAreUsed
unsigned towerId(DetId const &)
bool theHOIsUsed
only affects energy and ET calculation. HO is still recorded in the tower
void process(const HBHERecHitCollection &hbhe)
int ietaAbs() const
get the absolute value of the cell ieta
unsigned int useRejectedRecoveredHcalHits
const_iterator end() const
double theHOthresholdMinus2
std::vector< double > theHBWeights
const HcalSeverityLevelComputer * theHcalSevLvlComputer
void setHESEScale(double scale)
void setHEDEScale(double scale)
uint32_t denseIndex(const DetId &id) const
unsigned int theTowerMapSize
bool theUseSymEBTresholdFlag
void setEEEScale(double scale)
CaloTowerDetId id() const
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
int compactTime(float time)
GlobalPoint hadShwPosFromCells(DetId frontCell, DetId backCell, float fracDepth)
bool null() const
is this a null id ?
int zside() const
get the z-side of the tower (1/-1)
void getThresholdAndWeight(const DetId &detId, double &threshold, double &weight) const
helper method to look up the appropriate threshold & weight
int getSeverityLevel(const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
const HcalTopology * theHcalTopology
std::vector< int > theEcalSeveritiesToBeExcluded
std::vector< unsigned short > ecalBadChs
void setHOEScale(double scale)
double theHOthresholdMinus1
HcalDetId idBack(const HcalDetId &id) const
const EcalSeverityLevelAlgo * theEcalSevLvlAlgo
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
std::vector< double > theHF1Grid
void reserve(size_type n)
int convertCTtoHcal(int ct_ieta) const
std::vector< double > theEBGrid
HcalDetId idFront(const HcalDetId &id) const
std::vector< double > theHF2Weights
int ieta() const
get the tower ieta
bool theUseEtEBTresholdFlag
uint32_t getValue() const
unsigned int theHcalAcceptSeverityLevelForRejectedHit
std::tuple< unsigned int, bool > ecalChanStatusForCaloTower(const EcalRecHit *hit)
Detector det() const
get the detector field from this detid
HcalThreshold
GeV, ORCA value w/o selective readout.
const BasicVectorType & basicVector() const
HcalDropChMap hcalDropChMap
void setEBEScale(double scale)
std::vector< double > theEBWeights
double theHOthresholdPlus2
bool theRecoveredEcalHitsAreUsed
unsigned int theHcalAcceptSeverityLevel
bool theUseSymEETresholdFlag
uint32_t sizeForDenseIndexing() const
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
double outerEnergy() const
const_iterator begin() const
const_reference back() const
Global3DVector GlobalVector
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
def merge(dictlist, TELL=False)