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 theHEDthreshold(-1000.),
28 theHOthreshold0(-1000.),
29 theHOthresholdPlus1(-1000.),
30 theHOthresholdMinus1(-1000.),
31 theHOthresholdPlus2(-1000.),
32 theHOthresholdMinus2(-1000.),
33 theHF1threshold(-1000.),
34 theHF2threshold(-1000.),
35 theEBGrid(
std::vector<double>(5,10.)),
36 theEBWeights(
std::vector<double>(5,1.)),
37 theEEGrid(
std::vector<double>(5,10.)),
38 theEEWeights(
std::vector<double>(5,1.)),
39 theHBGrid(
std::vector<double>(5,10.)),
40 theHBWeights(
std::vector<double>(5,1.)),
41 theHESGrid(
std::vector<double>(5,10.)),
42 theHESWeights(
std::vector<double>(5,1.)),
43 theHEDGrid(
std::vector<double>(5,10.)),
44 theHEDWeights(
std::vector<double>(5,1.)),
45 theHOGrid(
std::vector<double>(5,10.)),
46 theHOWeights(
std::vector<double>(5,1.)),
47 theHF1Grid(
std::vector<double>(5,10.)),
48 theHF1Weights(
std::vector<double>(5,1.)),
49 theHF2Grid(
std::vector<double>(5,10.)),
50 theHF2Weights(
std::vector<double>(5,1.)),
60 theEBSumThreshold(-1000.),
61 theEESumThreshold(-1000.),
72 theTowerConstituentsMap(0),
73 theHcalAcceptSeverityLevel(0),
74 theRecoveredHcalHitsAreUsed(
false),
75 theRecoveredEcalHitsAreUsed(
false),
76 useRejectedHitsOnly(
false),
77 theHcalAcceptSeverityLevelForRejectedHit(0),
78 useRejectedRecoveredHcalHits(0),
79 useRejectedRecoveredEcalHits(0),
82 theMomConstrMethod(0),
96 bool useSymEBTreshold,
97 bool useSymEETreshold,
100 double HBthreshold,
double HESthreshold,
double HEDthreshold,
101 double HOthreshold0,
double HOthresholdPlus1,
double HOthresholdMinus1,
102 double HOthresholdPlus2,
double HOthresholdMinus2,
103 double HF1threshold,
double HF2threshold,
104 double EBweight,
double EEweight,
105 double HBweight,
double HESweight,
double HEDweight,
106 double HOweight,
double HF1weight,
double HF2weight,
194 bool useEtEBTreshold,
195 bool useEtEETreshold,
196 bool useSymEBTreshold,
197 bool useSymEETreshold,
200 double HBthreshold,
double HESthreshold,
double HEDthreshold,
201 double HOthreshold0,
double HOthresholdPlus1,
double HOthresholdMinus1,
202 double HOthresholdPlus2,
double HOthresholdMinus2,
203 double HF1threshold,
double HF2threshold,
204 const std::vector<double> &
EBGrid,
const std::vector<double> &
EBWeights,
205 const std::vector<double> &
EEGrid,
const std::vector<double> &
EEWeights,
206 const std::vector<double> &
HBGrid,
const std::vector<double> &
HBWeights,
209 const std::vector<double> &
HOGrid,
const std::vector<double> &
HOWeights,
212 double EBweight,
double EEweight,
213 double HBweight,
double HESweight,
double HEDweight,
214 double HOweight,
double HF1weight,
double HF2weight,
321 std::vector<int> tower28depths;
322 int ndepths, startdepth;
331 std::vector<bool> isMergedDepth(ndepths,
true);
332 for(
int i = 0;
i <
std::min(6,(
int)(tower28depths.size()));
i++){
333 isMergedDepth[tower28depths[
i]-startdepth] =
false;
337 for(
int i = 0;
i < ndepths;
i++){
344 std::vector<int> tower28depthsOne;
348 std::vector<bool> isMergedDepthOne(ndepths,
true);
349 for(
int i = 0;
i <
std::min(6,(
int)(tower28depthsOne.size()));
i++){
350 isMergedDepthOne[tower28depthsOne[
i]-startdepth] =
false;
353 for(
int i = 0;
i < ndepths;
i++){
363 <<
phizOne.size() <<
" phis" << std::endl;
382 hbheItr != hbhe.
end(); ++hbheItr)
388 hoItr != ho.
end(); ++hoItr)
394 hfItr != hf.
end(); ++hfItr)
400 ecItr != ec.
end(); ++ecItr)
410 ctcItr != ctc.
end(); ++ctcItr) {
441 ctcItr != ctc.
end(); ++ctcItr) {
444 double newE_em = ctcItr->emEnergy();
445 double newE_had = ctcItr->hadEnergy();
446 double newE_outer = ctcItr->outerEnergy();
453 double E_short = 0.5 * newE_had;
454 double E_long = newE_em + 0.5 * newE_had;
459 newE_em = E_long - E_short;
460 newE_had = 2.0 * E_short;
466 for (
unsigned int iConst = 0; iConst < ctcItr->constituentsSize(); ++iConst) {
467 DetId constId = ctcItr->constituent(iConst);
474 for (
unsigned int iConst = 0; iConst < ctcItr->constituentsSize(); ++iConst) {
475 DetId constId = ctcItr->constituent(iConst);
483 for (
unsigned int iConst = 0; iConst < ctcItr->constituentsSize(); ++iConst) {
484 DetId constId = ctcItr->constituent(iConst);
502 double f_em = 1.0/cosh(emPoint.
eta());
503 double f_had = 1.0/cosh(hadPoint.
eta());
512 double newE_tot = newE_em + newE_had;
519 CaloTower rescaledTower(twrId, newE_em, newE_had, newE_outer, -1, -1, towerP4, emPoint, hadPoint);
521 rescaledTower.setEcalTime(
int(ctcItr->ecalTime()*100.0 + 0.5) );
522 rescaledTower.setHcalTime(
int(ctcItr->hcalTime()*100.0 + 0.5) );
530 for (
unsigned int iConst = 0; iConst < ctcItr->constituentsSize(); ++iConst) {
531 contains.push_back(ctcItr->constituent(iConst));
533 rescaledTower.addConstituents(contains);
535 rescaledTower.setCaloTowerStatus(ctcItr->towerStatusWord());
565 double energy = recHit->
energy();
601 if (towerDetId.
null())
return;
607 tower29.numBadHcalCells += 1;
610 else if (0.5*energy >= threshold) {
613 if (towerDetId.
null())
return;
621 tower29.numRecHcalCells += 1;
625 tower29.numProbHcalCells += 1;
629 double e28 = 0.5 *
e;
630 double e29 = 0.5 *
e;
632 tower28.
E_had += e28;
634 std::pair<DetId,float>
mc(detId,e28);
637 tower29.E_had += e29;
639 tower29.metaConstituents.push_back(mc);
647 tower29.hadSumTimeTimesE += ( e29 * recHit->
time() );
648 tower29.hadSumEForTime += e29;
653 tower29.E_outer += e29;
665 if (towerDetId.
null())
return;
672 else if (energy >= threshold) {
688 std::pair<DetId,float>
mc(detId,e);
700 if (towerDetId.
null())
return;
705 else if (energy >= threshold) {
707 if (towerDetId.
null())
return;
710 if (hcalDetId.
depth() == 1) {
734 std::pair<DetId,float>
mc(detId,e);
745 if (towerDetId.
null())
return;
749 else if (energy >= threshold) {
751 if (towerDetId.
null())
return;
779 std::pair<DetId,float>
mc(detId,e);
793 unsigned int chStatusForCT;
794 bool ecalIsBad=
false;
804 double energy = recHit->
energy();
814 bool passEmThreshold =
false;
819 else passEmThreshold = (energy >=
threshold);
825 else passEmThreshold = (energy >=
threshold);
829 if (towerDetId.
null())
return;
871 std::pair<DetId,float>
mc(detId,e);
886 if (towerDetId.
null())
return;
916 std::pair<DetId, float>
mc(detId, 0);
948 assert(
id.rawId()!=0);
953 double E_had=mt.
E_had;
967 std::vector<std::pair<DetId,float> > metaContains_noecal;
969 for (std::vector<std::pair<DetId,float> >::iterator
i=metaContains.begin();
i!=metaContains.end(); ++
i)
970 if (
i->first.det()!=
DetId::Ecal) metaContains_noecal.push_back(*
i);
971 metaContains.swap(metaContains_noecal);
980 std::vector<std::pair<DetId,float> > metaContains_nohcal;
982 for (std::vector<std::pair<DetId,float> >::iterator
i=metaContains.begin();
i!=metaContains.end(); ++
i)
983 if (
i->first.det()!=
DetId::Hcal) metaContains_nohcal.push_back(*
i);
984 metaContains.swap(metaContains_nohcal);
987 if(metaContains.empty())
return;
1005 double momEmDepth = 0.;
1006 double momHadDepth = 0.;
1007 if (
id.ietaAbs()<=17) {
1041 emPoint =
emShwrPos(metaContains, momEmDepth, E_em);
1044 towerP4 = emP4*E_em;
1049 if ( (E_had + E_outer) >0) {
1050 massless = (E_em<=0);
1116 if unlikely ( (towerP4[3]==0) & (E_outer>0) ) {
1118 collection.emplace_back(
id, E_em, E_had, E_outer, -1, -1,
CaloTower::PolarLorentzVector(val,hadPoint.
eta(), hadPoint.
phi(),0), emPoint, hadPoint);
1120 collection.emplace_back(
id, E_em, E_had, E_outer, -1, -1,
GlobalVector(towerP4), towerP4[3], mass2, emPoint, hadPoint);
1122 auto & caloTower = collection.
back();
1148 unsigned int numBadEcalChan = 0;
1157 if (dropChItr !=
hcalDropChMap.end()) numBadHcalChan += dropChItr->second;
1214 caloTower.setCaloTowerStatus(numBadHcalChan, numBadEcalChan,
1215 numRecHcalChan, numRecEcalChan,
1216 numProbHcalChan, numProbEcalChan);
1218 double maxCellE = -999.0;
1221 contains.reserve(metaContains.size());
1222 for (std::vector<std::pair<DetId,float> >::iterator
i=metaContains.begin();
i!=metaContains.end(); ++
i) {
1224 contains.push_back(
i->first);
1226 if (maxCellE < i->
second) {
1234 maxCellE =
i->second;
1238 maxCellE =
i->second;
1246 caloTower.setConstituents(
std::move(contains));
1247 caloTower.setHottestCellE(maxCellE);
1317 else if(hcalDetId.
ieta() < 0) {
1332 if(hcalDetId.
depth() == 1) {
1350 edm::LogError(
"CaloTowersCreationAlgo") <<
"Bad cell: " << det << std::endl;
1399 if (fracDepth<=0)
return point;
1400 if (fracDepth>1) fracDepth=1;
1403 point += fracDepth * (backPoint-
point);
1415 float fracDepth,
double hadE) {
1420 std::cout <<
"hadShwrPos called with " << metaContains.size()
1421 <<
" elements and energy " << hadE <<
":" << fracDepth
1432 std::vector<std::pair<DetId,float> >::const_iterator mc_it = metaContains.begin();
1433 for (; mc_it!=metaContains.end(); ++mc_it) {
1448 return GlobalPoint(hadX/nConst, hadY/nConst, hadZ/nConst);
1459 std::cout <<
"hadShwrPos " << towerId <<
" frac " << fracDepth << std::endl;
1461 if (fracDepth < 0) fracDepth = 0;
1462 else if (fracDepth > 1) fracDepth = 1;
1466 int iEta = towerId.
ieta();
1467 int iPhi = towerId.
iphi();
1479 int frontDepth = 1000;
1480 int backDepth = -1000;
1481 for(
unsigned i = 0;
i < items.size();
i++){
1497 std::cout <<
"Front " << frontCellId <<
" Back " << backCellId
1498 <<
" Depths " << frontDepth <<
":" << backDepth << std::endl;
1505 std::cout << towerId28 <<
" with " << items28.size() <<
" constituents:";
1506 for (
unsigned k=0;
k<items28.size(); ++
k)
1510 for(
unsigned i = 0;
i < items28.size();
i++){
1521 std::cout <<
"Back " << backDepth <<
" ID " << backCellId << std::endl;
1534 HcalDetId hid1(frontCellId), hid2(backCellId);
1552 point += fracDepth * (backPoint -
point);
1559 float fracDepth,
double emE) {
1569 std::vector<std::pair<DetId,float> >::const_iterator mc_it = metaContains.begin();
1570 for (; mc_it!=metaContains.end(); ++mc_it) {
1573 double e = mc_it->second;
1589 float fracDepth,
double emE) {
1596 double sumWeights = 0;
1598 double crystalThresh = 0.015 * emE;
1600 std::vector<std::pair<DetId,float> >::const_iterator mc_it = metaContains.begin();
1601 for (; mc_it!=metaContains.end(); ++mc_it) {
1602 if (mc_it->second < 0)
continue;
1603 if (mc_it->first.det() ==
DetId::Ecal && mc_it->second > crystalThresh) sumEmE += mc_it->second;
1606 for (mc_it = metaContains.begin(); mc_it!=metaContains.end(); ++mc_it) {
1608 if (mc_it->first.det() !=
DetId::Ecal || mc_it->second < crystalThresh)
continue;
1612 weight = 4.2 +
log(mc_it->second/sumEmE);
1620 return GlobalPoint(emX/sumWeights, emY/sumWeights, emZ/sumWeights);
1629 const float timeUnit = 0.01;
1631 if (time> 300.0)
return 30000;
1632 if (time< -300.0)
return -30000;
1634 return int(time/timeUnit + 0.5);
1656 std::cout <<
"DropChMap with " << allChanInStatusCont.size() <<
" channels" 1659 for (std::vector<DetId>::iterator it = allChanInStatusCont.begin(); it!=allChanInStatusCont.end(); ++it) {
1709 for (std::vector<DetId>::iterator ac_it=allConstituents.begin();
1710 ac_it!=allConstituents.end(); ++ac_it) {
1749 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
void getDepthSegmentation(const unsigned ring, std::vector< int > &readoutDepths, const bool flag=false) const
const HcalChannelQuality * theHcalChStatus
std::vector< std::pair< int, int > > phizOne
size_t constituentsSize() const
const GlobalPoint & getBackPoint() 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 getPhiZOne(std::vector< std::pair< int, int > > &phiz) const
int ietaAbs() const
get the absolute value of the tower ieta
const DetId & detid() const
DetId constituent(size_t i) const
int zside() const
get the z-side of the cell (1/-1)
void setHF1EScale(double scale)
virtual const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
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)
void setHBEScale(double scale)
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
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)
void depthBinInformation(HcalSubdetector subdet, int etaRing, int iphi, int zside, int &nDepthBins, int &startingBin) const
finds the number of depth bins and which is the number to start with
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) ...
std::vector< int > mergedDepths
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)
int iphi() const
get the cell iphi
uint32_t denseIndex(const DetId &id) const
unsigned int theTowerMapSize
bool theUseSymEBTresholdFlag
void setEEEScale(double scale)
CaloTowerDetId id() const
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 > mergedDepthsOne
std::vector< int > theEcalSeveritiesToBeExcluded
std::vector< unsigned short > ecalBadChs
void setHOEScale(double scale)
double theHOthresholdMinus1
HcalDetId idBack(const HcalDetId &id) const
const EcalSeverityLevelAlgo * theEcalSevLvlAlgo
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
bool withSpecialRBXHBHE() const
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)