CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes
CaloTowersCreationAlgo Class Reference

#include <CaloTowersCreationAlgo.h>

Classes

struct  MetaTower
 

Public Member Functions

void begin ()
 
 CaloTowersCreationAlgo ()
 
 CaloTowersCreationAlgo (double EBthreshold, double EEthreshold, bool useEtEBTreshold, bool useEtEETreshold, bool useSymEBTreshold, bool useSymEETreshold, double HcalThreshold, double HBthreshold, double HESthreshold, double HEDthreshold, double HOthreshold0, double HOthresholdPlus1, double HOthresholdMinus1, double HOthresholdPlus2, double HOthresholdMinus2, double HF1threshold, double HF2threshold, double EBweight, double EEweight, double HBweight, double HESweight, double HEDweight, double HOweight, double HF1weight, double HF2weight, double EcutTower, double EBSumThreshold, double EESumThreshold, bool useHO, int momConstrMethod, double momHBDepth, double momHEDepth, double momEBDepth, double momEEDepth, int hcalPhase=0)
 
 CaloTowersCreationAlgo (double EBthreshold, double EEthreshold, bool useEtEBTreshold, bool useEtEETreshold, bool useSymEBTreshold, bool useSymEETreshold, double HcalThreshold, double HBthreshold, double HESthreshold, double HEDthreshold, double HOthreshold0, double HOthresholdPlus1, double HOthresholdMinus1, double HOthresholdPlus2, double HOthresholdMinus2, double HF1threshold, double HF2threshold, const std::vector< double > &EBGrid, const std::vector< double > &EBWeights, const std::vector< double > &EEGrid, const std::vector< double > &EEWeights, const std::vector< double > &HBGrid, const std::vector< double > &HBWeights, const std::vector< double > &HESGrid, const std::vector< double > &HESWeights, const std::vector< double > &HEDGrid, const std::vector< double > &HEDWeights, const std::vector< double > &HOGrid, const std::vector< double > &HOWeights, const std::vector< double > &HF1Grid, const std::vector< double > &HF1Weights, const std::vector< double > &HF2Grid, const std::vector< double > &HF2Weights, double EBweight, double EEweight, double HBweight, double HESweight, double HEDweight, double HOweight, double HF1weight, double HF2weight, double EcutTower, double EBSumThreshold, double EESumThreshold, bool useHO, int momConstrMethod, double momHBDepth, double momHEDepth, double momEBDepth, double momEEDepth, int hcalPhase=0)
 
std::tuple< unsigned int, bool > ecalChanStatusForCaloTower (const EcalRecHit *hit)
 
GlobalPoint emCrystalShwrPos (DetId detId, float fracDepth)
 
GlobalPoint emShwrLogWeightPos (const std::vector< std::pair< DetId, float > > &metaContains, float fracDepth, double totEmE)
 
GlobalPoint emShwrPos (const std::vector< std::pair< DetId, float > > &metaContains, float fracDepth, double totEmE)
 
void finish (CaloTowerCollection &destCollection)
 
GlobalPoint hadSegmentShwrPos (DetId detId, float fracDepth)
 
GlobalPoint hadShwPosFromCells (DetId frontCell, DetId backCell, float fracDepth)
 
GlobalPoint hadShwrPos (const std::vector< std::pair< DetId, float > > &metaContains, float fracDepth, double hadE)
 
GlobalPoint hadShwrPos (CaloTowerDetId id, float fracDepth)
 
unsigned int hcalChanStatusForCaloTower (const CaloRecHit *hit)
 
void makeEcalBadChs ()
 
void makeHcalDropChMap ()
 
void process (const HBHERecHitCollection &hbhe)
 
void process (const HORecHitCollection &ho)
 
void process (const HFRecHitCollection &hf)
 
void process (const EcalRecHitCollection &ecal)
 
void process (const CaloTowerCollection &ctc)
 
void rescaleTowers (const CaloTowerCollection &ctInput, CaloTowerCollection &ctResult)
 
void setEBEScale (double scale)
 
void setEbHandle (const edm::Handle< EcalRecHitCollection > eb)
 
void setEcalChStatusFromDB (const EcalChannelStatus *s)
 
void setEcalSeveritiesToBeExcluded (const std::vector< int > &ecalSev)
 
void SetEcalSeveritiesToBeUsedInBadTowers (const std::vector< int > &ecalSev)
 
void setEcalSevLvlAlgo (const EcalSeverityLevelAlgo *a)
 
void setEEEScale (double scale)
 
void setEeHandle (const edm::Handle< EcalRecHitCollection > ee)
 
void setGeometry (const CaloTowerTopology *cttopo, const CaloTowerConstituentsMap *ctmap, const HcalTopology *htopo, const CaloGeometry *geo)
 
void setHBEScale (double scale)
 
void setHcalAcceptSeverityLevel (unsigned int level)
 
void setHcalAcceptSeverityLevelForRejectedHit (unsigned int level)
 
void setHcalChStatusFromDB (const HcalChannelQuality *s)
 
void setHcalSevLvlComputer (const HcalSeverityLevelComputer *c)
 
void setHEDEScale (double scale)
 
void setHESEScale (double scale)
 
void setHF1EScale (double scale)
 
void setHF2EScale (double scale)
 
void setHOEScale (double scale)
 
void setRecoveredEcalHitsAreUsed (bool flag)
 
void setRecoveredHcalHitsAreUsed (bool flag)
 
void setUseRejectedHitsOnly (bool flag)
 
void setUseRejectedRecoveredEcalHits (bool flag)
 
void setUseRejectedRecoveredHcalHits (bool flag)
 

Public Attributes

int nalgo =-1
 

Private Types

enum  ctHitCategory {
  GoodChan = 0, BadChan = 1, RecoveredChan = 2, ProblematicChan = 3,
  IgnoredChan = 99
}
 
typedef std::map< CaloTowerDetId, int > HcalDropChMap
 
typedef std::vector< MetaTowerMetaTowerMap
 

Private Member Functions

void assignHitEcal (const EcalRecHit *recHit)
 adds a single hit to the tower More...
 
void assignHitHcal (const CaloRecHit *recHit)
 
int compactTime (float time)
 
void convert (const CaloTowerDetId &id, const MetaTower &mt, CaloTowerCollection &collection)
 
MetaTowerfind (const CaloTowerDetId &id)
 looks for a given tower in the internal cache. If it can't find it, it makes it. More...
 
void getThresholdAndWeight (const DetId &detId, double &threshold, double &weight) const
 helper method to look up the appropriate threshold & weight More...
 
void rescale (const CaloTower *ct)
 

Private Attributes

std::vector< unsigned short > ecalBadChs
 
HcalDropChMap hcalDropChMap
 
std::vector< HcalDetIdids_
 
std::vector< int > mergedDepths
 
std::vector< int > mergedDepthsOne
 
std::vector< std::pair< int, int > > phizOne
 
int subdetOne
 
double theEBEScale
 
std::vector< double > theEBGrid
 
edm::Handle< EcalRecHitCollectiontheEbHandle
 
double theEBSumThreshold
 
double theEBthreshold
 
double theEBweight
 
std::vector< double > theEBWeights
 
const EcalChannelStatustheEcalChStatus
 
std::vector< int > theEcalSeveritiesToBeExcluded
 
std::vector< int > theEcalSeveritiesToBeUsedInBadTowers
 
const EcalSeverityLevelAlgotheEcalSevLvlAlgo
 
double theEcutTower
 
double theEEEScale
 
std::vector< double > theEEGrid
 
edm::Handle< EcalRecHitCollectiontheEeHandle
 
double theEESumThreshold
 
double theEEthreshold
 
double theEEweight
 
std::vector< double > theEEWeights
 
const CaloGeometrytheGeometry
 
double theHBEScale
 
std::vector< double > theHBGrid
 
double theHBthreshold
 
double theHBweight
 
std::vector< double > theHBWeights
 
unsigned int theHcalAcceptSeverityLevel
 
unsigned int theHcalAcceptSeverityLevelForRejectedHit
 
const HcalChannelQualitytheHcalChStatus
 
int theHcalPhase
 
const HcalSeverityLevelComputertheHcalSevLvlComputer
 
double theHcalThreshold
 
const HcalTopologytheHcalTopology
 
double theHEDEScale
 
std::vector< double > theHEDGrid
 
double theHEDthreshold
 
double theHEDweight
 
std::vector< double > theHEDWeights
 
double theHESEScale
 
std::vector< double > theHESGrid
 
double theHESthreshold
 
double theHESweight
 
std::vector< double > theHESWeights
 
double theHF1EScale
 
std::vector< double > theHF1Grid
 
double theHF1threshold
 
double theHF1weight
 
std::vector< double > theHF1Weights
 
double theHF2EScale
 
std::vector< double > theHF2Grid
 
double theHF2threshold
 
double theHF2weight
 
std::vector< double > theHF2Weights
 
double theHOEScale
 
std::vector< double > theHOGrid
 
bool theHOIsUsed
 only affects energy and ET calculation. HO is still recorded in the tower More...
 
double theHOthreshold0
 
double theHOthresholdMinus1
 
double theHOthresholdMinus2
 
double theHOthresholdPlus1
 
double theHOthresholdPlus2
 
double theHOweight
 
std::vector< double > theHOWeights
 
int theMomConstrMethod
 
double theMomEBDepth
 
double theMomEEDepth
 
double theMomHBDepth
 
double theMomHEDepth
 
bool theRecoveredEcalHitsAreUsed
 
bool theRecoveredHcalHitsAreUsed
 
const CaloTowerConstituentsMaptheTowerConstituentsMap
 
const CaloSubdetectorGeometrytheTowerGeometry
 
MetaTowerMap theTowerMap
 
unsigned int theTowerMapSize =0
 
const CaloTowerTopologytheTowerTopology
 
bool theUseEtEBTresholdFlag
 
bool theUseEtEETresholdFlag
 
bool theUseSymEBTresholdFlag
 
bool theUseSymEETresholdFlag
 
bool useRejectedHitsOnly
 
unsigned int useRejectedRecoveredEcalHits
 
unsigned int useRejectedRecoveredHcalHits
 

Detailed Description

Author
R. Wilkinson - Caltech

Definition at line 49 of file CaloTowersCreationAlgo.h.

Member Typedef Documentation

typedef std::map<CaloTowerDetId, int> CaloTowersCreationAlgo::HcalDropChMap
private

Definition at line 337 of file CaloTowersCreationAlgo.h.

typedef std::vector<MetaTower> CaloTowersCreationAlgo::MetaTowerMap
private

Definition at line 331 of file CaloTowersCreationAlgo.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

CaloTowersCreationAlgo::CaloTowersCreationAlgo ( )

Definition at line 14 of file CaloTowersCreationAlgo.cc.

15  : theEBthreshold(-1000.),
16  theEEthreshold(-1000.),
17 
22 
23 
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.)),
51  theEBweight(1.),
52  theEEweight(1.),
53  theHBweight(1.),
54  theHESweight(1.),
55  theHEDweight(1.),
56  theHOweight(1.),
57  theHF1weight(1.),
58  theHF2weight(1.),
59  theEcutTower(-1000.),
60  theEBSumThreshold(-1000.),
61  theEESumThreshold(-1000.),
62  theEBEScale(50.),
63  theEEEScale(50.),
64  theHBEScale(50.),
65  theHESEScale(50.),
66  theHEDEScale(50.),
67  theHOEScale(50.),
68  theHF1EScale(50.),
69  theHF2EScale(50.),
70  theHcalTopology(0),
71  theGeometry(0),
76  useRejectedHitsOnly(false),
80  theHOIsUsed(true),
81  // (for momentum reconstruction algorithm)
83  theMomHBDepth(0.),
84  theMomHEDepth(0.),
85  theMomEBDepth(0.),
86  theMomEEDepth(0.),
87  theHcalPhase(0),
88  subdetOne(-1)
89 {
90 }
std::vector< double > theHBGrid
std::vector< double > theHESGrid
std::vector< double > theHEDGrid
std::vector< double > theHOWeights
std::vector< double > theEEGrid
std::vector< double > theEEWeights
std::vector< double > theHESWeights
std::vector< double > theHF2Grid
std::vector< double > theHEDWeights
const CaloGeometry * theGeometry
std::vector< double > theHOGrid
const CaloTowerConstituentsMap * theTowerConstituentsMap
std::vector< double > theHF1Weights
bool theHOIsUsed
only affects energy and ET calculation. HO is still recorded in the tower
std::vector< double > theHBWeights
const HcalTopology * theHcalTopology
std::vector< double > theHF1Grid
std::vector< double > theEBGrid
std::vector< double > theHF2Weights
unsigned int theHcalAcceptSeverityLevelForRejectedHit
std::vector< double > theEBWeights
CaloTowersCreationAlgo::CaloTowersCreationAlgo ( double  EBthreshold,
double  EEthreshold,
bool  useEtEBTreshold,
bool  useEtEETreshold,
bool  useSymEBTreshold,
bool  useSymEETreshold,
double  HcalThreshold,
double  HBthreshold,
double  HESthreshold,
double  HEDthreshold,
double  HOthreshold0,
double  HOthresholdPlus1,
double  HOthresholdMinus1,
double  HOthresholdPlus2,
double  HOthresholdMinus2,
double  HF1threshold,
double  HF2threshold,
double  EBweight,
double  EEweight,
double  HBweight,
double  HESweight,
double  HEDweight,
double  HOweight,
double  HF1weight,
double  HF2weight,
double  EcutTower,
double  EBSumThreshold,
double  EESumThreshold,
bool  useHO,
int  momConstrMethod,
double  momHBDepth,
double  momHEDepth,
double  momEBDepth,
double  momEEDepth,
int  hcalPhase = 0 
)

Definition at line 92 of file CaloTowersCreationAlgo.cc.

117  : theEBthreshold(EBthreshold),
118  theEEthreshold(EEthreshold),
119 
120  theUseEtEBTresholdFlag(useEtEBTreshold),
121  theUseEtEETresholdFlag(useEtEETreshold),
122  theUseSymEBTresholdFlag(useSymEBTreshold),
123  theUseSymEETresholdFlag(useSymEETreshold),
124 
126  theHBthreshold(HBthreshold),
127  theHESthreshold(HESthreshold),
128  theHEDthreshold(HEDthreshold),
129  theHOthreshold0(HOthreshold0),
130  theHOthresholdPlus1(HOthresholdPlus1),
131  theHOthresholdMinus1(HOthresholdMinus1),
132  theHOthresholdPlus2(HOthresholdPlus2),
133  theHOthresholdMinus2(HOthresholdMinus2),
134  theHF1threshold(HF1threshold),
135  theHF2threshold(HF2threshold),
136  theEBGrid(std::vector<double>(5,10.)),
137  theEBWeights(std::vector<double>(5,1.)),
138  theEEGrid(std::vector<double>(5,10.)),
139  theEEWeights(std::vector<double>(5,1.)),
140  theHBGrid(std::vector<double>(5,10.)),
141  theHBWeights(std::vector<double>(5,1.)),
142  theHESGrid(std::vector<double>(5,10.)),
143  theHESWeights(std::vector<double>(5,1.)),
144  theHEDGrid(std::vector<double>(5,10.)),
145  theHEDWeights(std::vector<double>(5,1.)),
146  theHOGrid(std::vector<double>(5,10.)),
147  theHOWeights(std::vector<double>(5,1.)),
148  theHF1Grid(std::vector<double>(5,10.)),
149  theHF1Weights(std::vector<double>(5,1.)),
150  theHF2Grid(std::vector<double>(5,10.)),
151  theHF2Weights(std::vector<double>(5,1.)),
152  theEBweight(EBweight),
153  theEEweight(EEweight),
154  theHBweight(HBweight),
155  theHESweight(HESweight),
156  theHEDweight(HEDweight),
157  theHOweight(HOweight),
158  theHF1weight(HF1weight),
159  theHF2weight(HF2weight),
163  theEBEScale(50.),
164  theEEEScale(50.),
165  theHBEScale(50.),
166  theHESEScale(50.),
167  theHEDEScale(50.),
168  theHOEScale(50.),
169  theHF1EScale(50.),
170  theHF2EScale(50.),
171  theHcalTopology(0),
172  theGeometry(0),
177  useRejectedHitsOnly(false),
182  // (momentum reconstruction algorithm)
183  theMomConstrMethod(momConstrMethod),
184  theMomHBDepth(momHBDepth),
185  theMomHEDepth(momHEDepth),
186  theMomEBDepth(momEBDepth),
187  theMomEEDepth(momEEDepth),
188  theHcalPhase(hcalPhase),
189  subdetOne(-1)
190 {
191 }
std::vector< double > theHBGrid
std::vector< double > theHESGrid
std::vector< double > theHEDGrid
std::vector< double > theHOWeights
std::vector< double > theEEGrid
std::vector< double > theEEWeights
std::vector< double > theHESWeights
std::vector< double > theHF2Grid
std::vector< double > theHEDWeights
const CaloGeometry * theGeometry
std::vector< double > theHOGrid
const CaloTowerConstituentsMap * theTowerConstituentsMap
std::vector< double > theHF1Weights
bool theHOIsUsed
only affects energy and ET calculation. HO is still recorded in the tower
std::vector< double > theHBWeights
const HcalTopology * theHcalTopology
std::vector< double > theHF1Grid
std::vector< double > theEBGrid
std::vector< double > theHF2Weights
unsigned int theHcalAcceptSeverityLevelForRejectedHit
HcalThreshold
GeV, ORCA value w/o selective readout.
std::vector< double > theEBWeights
CaloTowersCreationAlgo::CaloTowersCreationAlgo ( double  EBthreshold,
double  EEthreshold,
bool  useEtEBTreshold,
bool  useEtEETreshold,
bool  useSymEBTreshold,
bool  useSymEETreshold,
double  HcalThreshold,
double  HBthreshold,
double  HESthreshold,
double  HEDthreshold,
double  HOthreshold0,
double  HOthresholdPlus1,
double  HOthresholdMinus1,
double  HOthresholdPlus2,
double  HOthresholdMinus2,
double  HF1threshold,
double  HF2threshold,
const std::vector< double > &  EBGrid,
const std::vector< double > &  EBWeights,
const std::vector< double > &  EEGrid,
const std::vector< double > &  EEWeights,
const std::vector< double > &  HBGrid,
const std::vector< double > &  HBWeights,
const std::vector< double > &  HESGrid,
const std::vector< double > &  HESWeights,
const std::vector< double > &  HEDGrid,
const std::vector< double > &  HEDWeights,
const std::vector< double > &  HOGrid,
const std::vector< double > &  HOWeights,
const std::vector< double > &  HF1Grid,
const std::vector< double > &  HF1Weights,
const std::vector< double > &  HF2Grid,
const std::vector< double > &  HF2Weights,
double  EBweight,
double  EEweight,
double  HBweight,
double  HESweight,
double  HEDweight,
double  HOweight,
double  HF1weight,
double  HF2weight,
double  EcutTower,
double  EBSumThreshold,
double  EESumThreshold,
bool  useHO,
int  momConstrMethod,
double  momHBDepth,
double  momHEDepth,
double  momEBDepth,
double  momEEDepth,
int  hcalPhase = 0 
)

Definition at line 193 of file CaloTowersCreationAlgo.cc.

225  : theEBthreshold(EBthreshold),
226  theEEthreshold(EEthreshold),
227 
228  theUseEtEBTresholdFlag(useEtEBTreshold),
229  theUseEtEETresholdFlag(useEtEETreshold),
230  theUseSymEBTresholdFlag(useSymEBTreshold),
231  theUseSymEETresholdFlag(useSymEETreshold),
232 
234  theHBthreshold(HBthreshold),
235  theHESthreshold(HESthreshold),
236  theHEDthreshold(HEDthreshold),
237  theHOthreshold0(HOthreshold0),
238  theHOthresholdPlus1(HOthresholdPlus1),
239  theHOthresholdMinus1(HOthresholdMinus1),
240  theHOthresholdPlus2(HOthresholdPlus2),
241  theHOthresholdMinus2(HOthresholdMinus2),
242  theHF1threshold(HF1threshold),
243  theHF2threshold(HF2threshold),
244  theEBGrid(EBGrid),
246  theEEGrid(EEGrid),
248  theHBGrid(HBGrid),
254  theHOGrid(HOGrid),
260  theEBweight(EBweight),
261  theEEweight(EEweight),
262  theHBweight(HBweight),
263  theHESweight(HESweight),
264  theHEDweight(HEDweight),
265  theHOweight(HOweight),
266  theHF1weight(HF1weight),
267  theHF2weight(HF2weight),
271  theEBEScale(50.),
272  theEEEScale(50.),
273  theHBEScale(50.),
274  theHESEScale(50.),
275  theHEDEScale(50.),
276  theHOEScale(50.),
277  theHF1EScale(50.),
278  theHF2EScale(50.),
279  theHcalTopology(0),
280  theGeometry(0),
285  useRejectedHitsOnly(false),
290  // (momentum reconstruction algorithm)
291  theMomConstrMethod(momConstrMethod),
292  theMomHBDepth(momHBDepth),
293  theMomHEDepth(momHEDepth),
294  theMomEBDepth(momEBDepth),
295  theMomEEDepth(momEEDepth),
296  theHcalPhase(hcalPhase),
297  subdetOne(-1)
298 {
299  // static int N = 0;
300  // std::cout << "VI Algo " << ++N << std::endl;
301  // nalgo=N;
302 }
std::vector< double > theHBGrid
std::vector< double > theHESGrid
std::vector< double > theHEDGrid
std::vector< double > theHOWeights
std::vector< double > theEEGrid
std::vector< double > theEEWeights
std::vector< double > theHESWeights
std::vector< double > theHF2Grid
std::vector< double > theHEDWeights
const CaloGeometry * theGeometry
std::vector< double > theHOGrid
const CaloTowerConstituentsMap * theTowerConstituentsMap
std::vector< double > theHF1Weights
bool theHOIsUsed
only affects energy and ET calculation. HO is still recorded in the tower
std::vector< double > theHBWeights
const HcalTopology * theHcalTopology
std::vector< double > theHF1Grid
std::vector< double > theEBGrid
std::vector< double > theHF2Weights
unsigned int theHcalAcceptSeverityLevelForRejectedHit
HcalThreshold
GeV, ORCA value w/o selective readout.
std::vector< double > theEBWeights

Member Function Documentation

void CaloTowersCreationAlgo::assignHitEcal ( const EcalRecHit recHit)
private

adds a single hit to the tower

Definition at line 790 of file CaloTowersCreationAlgo.cc.

References BadChan, EcalRecHit::detid(), MillePedeFileConverter_cfg::e, CaloTowersCreationAlgo::MetaTower::E, CaloTowersCreationAlgo::MetaTower::E_em, EcalBarrel, ecalChanStatusForCaloTower(), EcalEndcap, CaloTowersCreationAlgo::MetaTower::emSumEForTime, CaloTowersCreationAlgo::MetaTower::emSumTimeTimesE, EcalRecHit::energy(), stringResolutionProvider_cfi::eta, spr::find(), find(), CaloGeometry::getGeometry(), CaloCellGeometry::getPosition(), getThresholdAndWeight(), GoodChan, IgnoredChan, CaloTowersParam_cfi::mc, CaloTowersCreationAlgo::MetaTower::metaConstituents, DetId::null(), CaloTowersCreationAlgo::MetaTower::numBadEcalCells, CaloTowersCreationAlgo::MetaTower::numProbEcalCells, CaloTowersCreationAlgo::MetaTower::numRecEcalCells, ProblematicChan, RecoveredChan, EcalSeverityLevelAlgo::severityLevel(), DetId::subdetId(), theEcalSeveritiesToBeExcluded, theEcalSevLvlAlgo, theGeometry, theTowerConstituentsMap, theUseEtEBTresholdFlag, theUseEtEETresholdFlag, theUseSymEBTresholdFlag, theUseSymEETresholdFlag, ctppsDiamondLocalTracks_cfi::threshold, EcalRecHit::time(), CaloTowerConstituentsMap::towerOf(), and mps_merge::weight.

Referenced by process().

790  {
791  DetId detId = recHit->detid();
792 
793  unsigned int chStatusForCT;
794  bool ecalIsBad=false;
795  std::tie(chStatusForCT,ecalIsBad) = ecalChanStatusForCaloTower(recHit);
796 
797  // this is for skipping channls: mostly needed for the creation of
798  // bad towers from hits i the bad channel collections.
799  if (chStatusForCT==CaloTowersCreationAlgo::IgnoredChan) return;
800 
801  double threshold, weight;
802  getThresholdAndWeight(detId, threshold, weight);
803 
804  double energy = recHit->energy(); // original RecHit energy is used to apply thresholds
805  double e = energy * weight; // energies scaled by user weight: used in energy assignments
806 
808 
809  // For ECAL we count all bad channels after the metatower is complete
810 
811  // Include options for symmetric thresholds and cut on Et
812  // for ECAL RecHits
813 
814  bool passEmThreshold = false;
815 
816  if (detId.subdetId() == EcalBarrel) {
817  if (theUseEtEBTresholdFlag) energy /= cosh( (theGeometry->getGeometry(detId)->getPosition()).eta() ) ;
818  if (theUseSymEBTresholdFlag) passEmThreshold = (fabs(energy) >= threshold);
819  else passEmThreshold = (energy >= threshold);
820 
821  }
822  else if (detId.subdetId() == EcalEndcap) {
823  if (theUseEtEETresholdFlag) energy /= cosh( (theGeometry->getGeometry(detId)->getPosition()).eta() ) ;
824  if (theUseSymEETresholdFlag) passEmThreshold = (fabs(energy) >= threshold);
825  else passEmThreshold = (energy >= threshold);
826  }
827 
828  CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(detId);
829  if (towerDetId.null()) return;
830  MetaTower & tower = find(towerDetId);
831 
832 
833  // count bad cells and avoid double counting with those from DB (Recovered are counted bad)
834 
835  // somehow misses some
836  // if ( (chStatusForCT == CaloTowersCreationAlgo::BadChan) & (!ecalIsBad) ) ++tower.numBadEcalCells;
837 
838  // a bit slower...
839  if ( chStatusForCT == CaloTowersCreationAlgo::BadChan ) {
840  auto thisEcalSevLvl = theEcalSevLvlAlgo->severityLevel(detId);
841  // check if the Ecal severity is ok to keep
842  auto sevit = std::find(theEcalSeveritiesToBeExcluded.begin(),
844  thisEcalSevLvl);
845  if (sevit==theEcalSeveritiesToBeExcluded.end()) ++tower.numBadEcalCells; // notinDB
846  }
847 
848 
849  // if (chStatusForCT != CaloTowersCreationAlgo::BadChan && energy >= threshold) {
850  if (chStatusForCT != CaloTowersCreationAlgo::BadChan && passEmThreshold) {
851 
852  tower.E_em += e;
853  tower.E += e;
854 
855  if (chStatusForCT == CaloTowersCreationAlgo::RecoveredChan) {
856  tower.numRecEcalCells += 1;
857  }
858  else if (chStatusForCT == CaloTowersCreationAlgo::ProblematicChan) {
859  tower.numProbEcalCells += 1;
860  }
861 
862  // change when full status info is available
863  // for now use only good channels
864 
865  // add e>0 check (new options allow e<0)
866  if (chStatusForCT == CaloTowersCreationAlgo::GoodChan && e>0 ) {
867  tower.emSumTimeTimesE += ( e * recHit->time() );
868  tower.emSumEForTime += e; // see above
869  }
870 
871  std::pair<DetId,float> mc(detId,e);
872  tower.metaConstituents.push_back(mc);
873  }
874 } // end of assignHitEcal method
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
const DetId & detid() const
Definition: EcalRecHit.h:72
float time() const
Definition: EcalRecHit.h:70
MetaTower & find(const CaloTowerDetId &id)
looks for a given tower in the internal cache. If it can&#39;t find it, it makes it.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
CaloTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
const CaloGeometry * theGeometry
float energy() const
Definition: EcalRecHit.h:68
const CaloTowerConstituentsMap * theTowerConstituentsMap
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
bool null() const
is this a null id ?
Definition: DetId.h:45
void getThresholdAndWeight(const DetId &detId, double &threshold, double &weight) const
helper method to look up the appropriate threshold & weight
std::vector< int > theEcalSeveritiesToBeExcluded
const EcalSeverityLevelAlgo * theEcalSevLvlAlgo
const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:78
std::tuple< unsigned int, bool > ecalChanStatusForCaloTower(const EcalRecHit *hit)
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
void CaloTowersCreationAlgo::assignHitHcal ( const CaloRecHit recHit)
private

Definition at line 545 of file CaloTowersCreationAlgo.cc.

References BadChan, gather_cfg::cout, HcalDetId::depth(), DetId::det(), CaloRecHit::detid(), MillePedeFileConverter_cfg::e, CaloTowersCreationAlgo::MetaTower::E, CaloTowersCreationAlgo::MetaTower::E_em, CaloTowersCreationAlgo::MetaTower::E_had, CaloTowersCreationAlgo::MetaTower::E_outer, CaloRecHit::energy(), spr::find(), find(), getThresholdAndWeight(), GoodChan, CaloTowersCreationAlgo::MetaTower::hadSumEForTime, CaloTowersCreationAlgo::MetaTower::hadSumTimeTimesE, DetId::Hcal, hcalChanStatusForCaloTower(), HcalEndcap, HcalForward, HcalOuter, HcalTopology::idFront(), CaloTowerDetId::ieta(), HcalDetId::ieta(), HcalDetId::ietaAbs(), IgnoredChan, CaloTowerDetId::iphi(), HcalDetId::iphi(), HcalTopology::lastHERing(), CaloTowersParam_cfi::mc, MatrixUtil::merge(), mergedDepths, mergedDepthsOne, CaloTowersCreationAlgo::MetaTower::metaConstituents, DetId::null(), CaloTowersCreationAlgo::MetaTower::numBadHcalCells, CaloTowersCreationAlgo::MetaTower::numProbHcalCells, CaloTowersCreationAlgo::MetaTower::numRecHcalCells, phizOne, ProblematicChan, RecoveredChan, HcalDetId::subdet(), subdetOne, theHcalPhase, theHcalTopology, theHOIsUsed, theTowerConstituentsMap, ctppsDiamondLocalTracks_cfi::threshold, CaloRecHit::time(), CaloTowerConstituentsMap::towerOf(), mps_merge::weight, HcalTopology::withSpecialRBXHBHE(), CaloTowerDetId::zside(), and HcalDetId::zside().

Referenced by process().

545  {
546  DetId detId = recHit->detid();
547  DetId detIdF(detId);
548  if (detId.det() == DetId::Hcal && theHcalTopology->withSpecialRBXHBHE()) {
549  detIdF = theHcalTopology->idFront(HcalDetId(detId));
550 #ifdef EDM_ML_DEBUG
551  std::cout << "AssignHitHcal DetId " << HcalDetId(detId) << " Front "
552  << HcalDetId(detIdF) << std::endl;
553 #endif
554  }
555 
556  unsigned int chStatusForCT = hcalChanStatusForCaloTower(recHit);
557 
558  // this is for skipping channls: mostly needed for the creation of
559  // bad towers from hits i the bad channel collections.
560  if (chStatusForCT==CaloTowersCreationAlgo::IgnoredChan) return;
561 
562  double threshold, weight;
563  getThresholdAndWeight(detId, threshold, weight);
564 
565  double energy = recHit->energy(); // original RecHit energy is used to apply thresholds
566  double e = energy * weight; // energies scaled by user weight: used in energy assignments
567 
568  // SPECIAL handling of tower 28 merged depths --> half into tower 28 and half into tower 29
569  bool merge(false);
570  if (detIdF.det()==DetId::Hcal &&
571  HcalDetId(detIdF).subdet()==HcalEndcap &&
572  (theHcalPhase==0 || theHcalPhase==1) &&
573  //HcalDetId(detId).depth()==3 &&
574  HcalDetId(detIdF).ietaAbs()==theHcalTopology->lastHERing()-1) {
575  if (subdetOne == HcalEndcap && (std::find(phizOne.begin(),phizOne.end(),std::pair<int,int>(HcalDetId(detIdF).iphi(),HcalDetId(detIdF).zside())) != phizOne.end())) {
576  merge = (std::find(mergedDepthsOne.begin(), mergedDepthsOne.end(), HcalDetId(detIdF).depth())!=mergedDepthsOne.end());
577 #ifdef EDM_ML_DEBUG
578  std::cout << "Special cell ";
579 #endif
580  } else {
581  merge = (std::find(mergedDepths.begin(), mergedDepths.end(), HcalDetId(detIdF).depth())!=mergedDepths.end());
582 #ifdef EDM_ML_DEBUG
583  std::cout << "Normal cell ";
584 #endif
585  }
586 #ifdef EDM_ML_DEBUG
587  std::cout << "Merge " << HcalDetId(detIdF).subdet() << ":"
588  << HcalDetId(detIdF).ieta() << ":" << HcalDetId(detIdF).iphi()
589  << ":" << HcalDetId(detIdF).depth() << ":" << merge
590  << std::endl;
591 #endif
592  }
593  if (merge) {
594 
596 
597  // bad channels are counted regardless of energy threshold
598 
599  if (chStatusForCT == CaloTowersCreationAlgo::BadChan) {
600  CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(detId);
601  if (towerDetId.null()) return;
602  MetaTower & tower28 = find(towerDetId);
603  CaloTowerDetId towerDetId29(towerDetId.ieta()+towerDetId.zside(),
604  towerDetId.iphi());
605  MetaTower & tower29 = find(towerDetId29);
606  tower28.numBadHcalCells += 1;
607  tower29.numBadHcalCells += 1;
608  }
609 
610  else if (0.5*energy >= threshold) { // not bad channel: use energy if above threshold
611 
612  CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(detId);
613  if (towerDetId.null()) return;
614  MetaTower & tower28 = find(towerDetId);
615  CaloTowerDetId towerDetId29(towerDetId.ieta()+towerDetId.zside(),
616  towerDetId.iphi());
617  MetaTower & tower29 = find(towerDetId29);
618 
619  if (chStatusForCT == CaloTowersCreationAlgo::RecoveredChan) {
620  tower28.numRecHcalCells += 1;
621  tower29.numRecHcalCells += 1;
622  }
623  else if (chStatusForCT == CaloTowersCreationAlgo::ProblematicChan) {
624  tower28.numProbHcalCells += 1;
625  tower29.numProbHcalCells += 1;
626  }
627 
628  // NOTE DIVIDE BY 2!!!
629  double e28 = 0.5 * e;
630  double e29 = 0.5 * e;
631 
632  tower28.E_had += e28;
633  tower28.E += e28;
634  std::pair<DetId,float> mc(detId,e28);
635  tower28.metaConstituents.push_back(mc);
636 
637  tower29.E_had += e29;
638  tower29.E += e29;
639  tower29.metaConstituents.push_back(mc);
640 
641  // time info: do not use in averaging if timing error is found: need
642  // full set of status info to implement: use only "good" channels for now
643 
644  if (chStatusForCT == CaloTowersCreationAlgo::GoodChan) {
645  tower28.hadSumTimeTimesE += ( e28 * recHit->time() );
646  tower28.hadSumEForTime += e28;
647  tower29.hadSumTimeTimesE += ( e29 * recHit->time() );
648  tower29.hadSumEForTime += e29;
649  }
650 
651  // store the energy in layer 3 also in E_outer
652  tower28.E_outer += e28;
653  tower29.E_outer += e29;
654  } // not a "bad" hit
655  } // end of special case
656 
657  else {
658  HcalDetId hcalDetId(detId);
659 
661 
662  if(hcalDetId.subdet() == HcalOuter) {
663 
664  CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(detId);
665  if (towerDetId.null()) return;
666  MetaTower & tower = find(towerDetId);
667 
668  if (chStatusForCT == CaloTowersCreationAlgo::BadChan) {
669  if (theHOIsUsed) tower.numBadHcalCells += 1;
670  }
671 
672  else if (energy >= threshold) {
673  tower.E_outer += e; // store HO energy even if HO is not used
674  // add energy of the tower and/or flag if theHOIsUsed
675  if(theHOIsUsed) {
676  tower.E += e;
677 
678  if (chStatusForCT == CaloTowersCreationAlgo::RecoveredChan) {
679  tower.numRecHcalCells += 1;
680  }
681  else if (chStatusForCT == CaloTowersCreationAlgo::ProblematicChan) {
682  tower.numProbHcalCells += 1;
683  }
684  } // HO is used
685 
686 
687  // add HO to constituents even if it is not used: JetMET wants to keep these towers
688  std::pair<DetId,float> mc(detId,e);
689  tower.metaConstituents.push_back(mc);
690 
691  } // not a bad channel, energy above threshold
692 
693  } // HO hit
694 
695  // HF calculates EM fraction differently
696  else if(hcalDetId.subdet() == HcalForward) {
697 
698  if (chStatusForCT == CaloTowersCreationAlgo::BadChan) {
699  CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(detId);
700  if (towerDetId.null()) return;
701  MetaTower & tower = find(towerDetId);
702  tower.numBadHcalCells += 1;
703  }
704 
705  else if (energy >= threshold) {
706  CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(detId);
707  if (towerDetId.null()) return;
708  MetaTower & tower = find(towerDetId);
709 
710  if (hcalDetId.depth() == 1) {
711  // long fiber, so E_EM = E(Long) - E(Short)
712  tower.E_em += e;
713  }
714  else {
715  // short fiber, EHAD = 2 * E(Short)
716  tower.E_em -= e;
717  tower.E_had += 2. * e;
718  }
719  tower.E += e;
720  if (chStatusForCT == CaloTowersCreationAlgo::RecoveredChan) {
721  tower.numRecHcalCells += 1;
722  }
723  else if (chStatusForCT == CaloTowersCreationAlgo::ProblematicChan) {
724  tower.numProbHcalCells += 1;
725  }
726 
727  // put the timing in HCAL -> have to check timing errors when available
728  // for now use only good channels
729  if (chStatusForCT == CaloTowersCreationAlgo::GoodChan) {
730  tower.hadSumTimeTimesE += ( e * recHit->time() );
731  tower.hadSumEForTime += e;
732  }
733 
734  std::pair<DetId,float> mc(detId,e);
735  tower.metaConstituents.push_back(mc);
736 
737  } // not a bad HF channel, energy above threshold
738 
739  } // HF hit
740 
741  else {
742  // HCAL situation normal in HB/HE
743  if (chStatusForCT == CaloTowersCreationAlgo::BadChan) {
744  CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(detId);
745  if (towerDetId.null()) return;
746  MetaTower & tower = find(towerDetId);
747  tower.numBadHcalCells += 1;
748  }
749  else if (energy >= threshold) {
750  CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(detId);
751  if (towerDetId.null()) return;
752  MetaTower & tower = find(towerDetId);
753  tower.E_had += e;
754  tower.E += e;
755  if (chStatusForCT == CaloTowersCreationAlgo::RecoveredChan) {
756  tower.numRecHcalCells += 1;
757  }
758  else if (chStatusForCT == CaloTowersCreationAlgo::ProblematicChan) {
759  tower.numProbHcalCells += 1;
760  }
761 
762  // Timing information: need specific accessors
763  // for now use only good channels
764  if (chStatusForCT == CaloTowersCreationAlgo::GoodChan) {
765  tower.hadSumTimeTimesE += ( e * recHit->time() );
766  tower.hadSumEForTime += e;
767  }
768  // store energy in highest depth for towers 18-27 (for electron,photon ID in endcap)
769  // also, store energy in HE part of tower 16 (for JetMET cleanup)
770  HcalDetId hcalDetId(detId);
771  if (hcalDetId.subdet()==HcalEndcap && theHcalPhase==0) {
772  if ( (hcalDetId.depth()==2 && hcalDetId.ietaAbs()>=18 && hcalDetId.ietaAbs()<27) ||
773  (hcalDetId.depth()==3 && hcalDetId.ietaAbs()==27) ||
774  (hcalDetId.depth()==3 && hcalDetId.ietaAbs()==16) ) {
775  tower.E_outer += e;
776  }
777  }
778 
779  std::pair<DetId,float> mc(detId,e);
780  tower.metaConstituents.push_back(mc);
781 
782  } // not a "bad" channel, energy above threshold
783 
784  } // channel in HBHE (excluding twrs 28,29)
785 
786  } // recHit normal case (not in HE towers 28,29)
787 
788 } // end of assignHitHcal method
Definition: merge.py:1
std::vector< std::pair< int, int > > phizOne
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
const DetId & detid() const
Definition: CaloRecHit.h:21
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.cc:93
MetaTower & find(const CaloTowerDetId &id)
looks for a given tower in the internal cache. If it can&#39;t find it, it makes it.
float time() const
Definition: CaloRecHit.h:19
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
int depth() const
get the tower depth
Definition: HcalDetId.cc:108
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)
float energy() const
Definition: CaloRecHit.h:17
int ieta() const
get the cell ieta
Definition: HcalDetId.h:56
int iphi() const
get the tower iphi
const CaloTowerConstituentsMap * theTowerConstituentsMap
std::vector< int > mergedDepths
bool theHOIsUsed
only affects energy and ET calculation. HO is still recorded in the tower
int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.cc:98
int iphi() const
get the cell iphi
Definition: HcalDetId.cc:103
Definition: DetId.h:18
bool null() const
is this a null id ?
Definition: DetId.h:45
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
const HcalTopology * theHcalTopology
std::vector< int > mergedDepthsOne
HcalDetId idFront(const HcalDetId &id) const
Definition: HcalTopology.h:170
int ieta() const
get the tower ieta
bool withSpecialRBXHBHE() const
Definition: HcalTopology.h:162
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
int lastHERing() const
Definition: HcalTopology.h:90
def merge(dictlist, TELL=False)
Definition: MatrixUtil.py:191
void CaloTowersCreationAlgo::begin ( void  )

Definition at line 374 of file CaloTowersCreationAlgo.cc.

References theTowerMap, and theTowerMapSize.

Referenced by CaloTowersReCreator::produce(), CaloTowersCreator::produce(), and setEcalChStatusFromDB().

374  {
375  theTowerMap.clear();
376  theTowerMapSize=0;
377  //hcalDropChMap.clear();
378 }
int CaloTowersCreationAlgo::compactTime ( float  time)
private

Definition at line 1627 of file CaloTowersCreationAlgo.cc.

References createfilelist::int.

Referenced by convert().

1627  {
1628 
1629  const float timeUnit = 0.01; // discretization (ns)
1630 
1631  if (time> 300.0) return 30000;
1632  if (time< -300.0) return -30000;
1633 
1634  return int(time/timeUnit + 0.5);
1635 
1636 }
void CaloTowersCreationAlgo::convert ( const CaloTowerDetId id,
const MetaTower mt,
CaloTowerCollection collection 
)
private

if (E>0) towerP4 = CaloTower::PolarLorentzVector(E*sumPf, emPoint.eta(), emPoint.phi(), 0);

Definition at line 945 of file CaloTowersCreationAlgo.cc.

References edm::SortedCollection< T, SORT >::back(), PV3DBase< T, PVType, FrameType >::basicVector(), compactTime(), edm::contains(), CaloTowerTopology::denseIndex(), mps_update::diff, CaloTowersCreationAlgo::MetaTower::E, CaloTowersCreationAlgo::MetaTower::E_em, CaloTowersCreationAlgo::MetaTower::E_had, CaloTowersCreationAlgo::MetaTower::E_outer, DetId::Ecal, ecalBadChs, digitizers_cfi::ecalTime, emShwrLogWeightPos(), emShwrPos(), CaloTowersCreationAlgo::MetaTower::emSumEForTime, CaloTowersCreationAlgo::MetaTower::emSumTimeTimesE, PV3DBase< T, PVType, FrameType >::eta(), CaloTowerTopology::firstHFRing(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), hadShwrPos(), CaloTowersCreationAlgo::MetaTower::hadSumEForTime, CaloTowersCreationAlgo::MetaTower::hadSumTimeTimesE, DetId::Hcal, hcalDropChMap, HcalOuter, mps_fire::i, reco::if(), CaloTowerTopology::lastHBRing(), CaloTowerTopology::lastHERing(), CaloTowerTopology::lastHFRing(), CaloTowerTopology::lastHORing(), CaloTowersCreationAlgo::MetaTower::metaConstituents, eostools::move(), CaloTowersCreationAlgo::MetaTower::numBadEcalCells, CaloTowersCreationAlgo::MetaTower::numBadHcalCells, CaloTowersCreationAlgo::MetaTower::numProbEcalCells, CaloTowersCreationAlgo::MetaTower::numProbHcalCells, CaloTowersCreationAlgo::MetaTower::numRecEcalCells, CaloTowersCreationAlgo::MetaTower::numRecHcalCells, AlCaHLTBitMon_ParallelJobs::p, PV3DBase< T, PVType, FrameType >::phi(), edm::SortedCollection< T, SORT >::pop_back(), edm::second(), mathSSE::sqrt(), HcalDetId::subdet(), theEBSumThreshold, theEcutTower, theEESumThreshold, theHcalThreshold, theHOIsUsed, theMomConstrMethod, theMomEBDepth, theMomEEDepth, theMomHBDepth, theMomHEDepth, theTowerGeometry, theTowerTopology, Basic3DVector< T >::unit(), unlikely, and heppy_batch::val.

Referenced by finish().

947 {
948  assert(id.rawId()!=0);
949 
950  double ecalThres=(id.ietaAbs()<=17)?(theEBSumThreshold):(theEESumThreshold);
951  double E=mt.E;
952  double E_em=mt.E_em;
953  double E_had=mt.E_had;
954  double E_outer=mt.E_outer;
955 
956  // Note: E_outer is used to save HO energy OR energy in the outermost depths in endcap region
957  // In the methods with separate treatment of EM and HAD components:
958  // - HO is not used to determine direction, however HO energy is added to get "total had energy"
959  // => Check if the tower is within HO coverage before adding E_outer to the "total had" energy
960  // else the energy will be double counted
961  // When summing up the energy of the tower these checks are performed in the loops over RecHits
962 
963  std::vector<std::pair<DetId,float> > metaContains=mt.metaConstituents;
964  if (id.ietaAbs()<theTowerTopology->firstHFRing() && E_em<ecalThres) { // ignore EM threshold in HF
965  E-=E_em;
966  E_em=0;
967  std::vector<std::pair<DetId,float> > metaContains_noecal;
968 
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);
972  }
973  if (id.ietaAbs()<theTowerTopology->firstHFRing() && E_had<theHcalThreshold) {
974  E-=E_had;
975 
976  if (theHOIsUsed && id.ietaAbs()<=theTowerTopology->lastHORing()) E-=E_outer; // not subtracted before, think it should be done
977 
978  E_had=0;
979  E_outer=0;
980  std::vector<std::pair<DetId,float> > metaContains_nohcal;
981 
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);
985  }
986 
987  if(metaContains.empty()) return;
988 
989  double E_had_tot = (theHOIsUsed && id.ietaAbs()<=theTowerTopology->lastHORing())? E_had+E_outer : E_had;
990 
991 
992  // create CaloTower using the selected algorithm
993 
994  GlobalPoint emPoint, hadPoint;
995 
996  // this is actually a 4D vector
997  Basic3DVectorF towerP4;
998  bool massless=true;
999  // float mass1=0;
1000  float mass2=0;
1001 
1002  // conditional assignment of depths for barrel/endcap
1003  // Some additional tuning may be required in the transitional region
1004  // 14<|iEta|<19
1005  double momEmDepth = 0.;
1006  double momHadDepth = 0.;
1007  if (id.ietaAbs()<=17) {
1008  momHadDepth = theMomHBDepth;
1009  momEmDepth = theMomEBDepth;
1010  }
1011  else {
1012  momHadDepth = theMomHEDepth;
1013  momEmDepth = theMomEEDepth;
1014  }
1015 
1016 
1017 
1018  switch (theMomConstrMethod) {
1019 
1020  // FIXME : move to simple cartesian algebra
1021  case 0 :
1022  { // Simple 4-momentum assignment
1024  towerP4 = p.basicVector().unit();
1025  towerP4[3] = 1.f; // energy
1026  towerP4 *=E;
1027 
1028  // double pf=1.0/cosh(p.eta());
1029  // if (E>0) towerP4 = CaloTower::PolarLorentzVector(E*pf, p.eta(), p.phi(), 0);
1030 
1031  emPoint = p;
1032  hadPoint = p;
1033  } // end case 0
1034  break;
1035 
1036  case 1 :
1037  { // separate 4-vectors for ECAL, HCAL, add to get the 4-vector of the tower (=>tower has mass!)
1038  if (id.ietaAbs()<theTowerTopology->firstHFRing()) {
1039  Basic3DVectorF emP4;
1040  if (E_em>0) {
1041  emPoint = emShwrPos(metaContains, momEmDepth, E_em);
1042  emP4 = emPoint.basicVector().unit();
1043  emP4[3] = 1.f; // energy
1044  towerP4 = emP4*E_em;
1045 
1046  // double emPf = 1.0/cosh(emPoint.eta());
1047  // towerP4 += CaloTower::PolarLorentzVector(E_em*emPf, emPoint.eta(), emPoint.phi(), 0);
1048  }
1049  if ( (E_had + E_outer) >0) {
1050  massless = (E_em<=0);
1051  hadPoint = hadShwrPos(id, momHadDepth);
1052  auto lP4 = hadPoint.basicVector().unit();
1053  lP4[3] = 1.f; // energy
1054  if (!massless) {
1055  auto diff = lP4-emP4; mass2 = std::sqrt(E_em*E_had_tot*diff.mag2());
1056  }
1057  lP4 *=E_had_tot;
1058  towerP4 +=lP4;
1059  /*
1060  if (!massless) {
1061  auto p = towerP4;
1062  double m2 = double(p[3]*p[3]) - double(p[0]*p[0])+double(p[1]*p[1])+double(p[2]*p[2]); mass1 = m2>0 ? std::sqrt(m2) : 0;
1063  }
1064  */
1065  // double hadPf = 1.0/cosh(hadPoint.eta());
1066  // if (E_had_tot>0) {
1067  // towerP4 += CaloTower::PolarLorentzVector(E_had_tot*hadPf, hadPoint.eta(), hadPoint.phi(), 0);
1068  // }
1069  }
1070  }
1071  else { // forward detector: use the CaloTower position
1073  towerP4 = p.basicVector().unit();
1074  towerP4[3] = 1.f; // energy
1075  towerP4 *=E;
1076  // double pf=1.0/cosh(p.eta());
1077  // if (E>0) towerP4 = CaloTower::PolarLorentzVector(E*pf, p.eta(), p.phi(), 0); // simple momentum assignment, same position
1078  emPoint = p;
1079  hadPoint = p;
1080  }
1081  } // end case 1
1082  break;
1083 
1084  case 2:
1085  { // use ECAL position for the tower (when E_cal>0), else default CaloTower position (massless tower)
1086  if (id.ietaAbs()<theTowerTopology->firstHFRing()) {
1087  if (E_em>0) emPoint = emShwrLogWeightPos(metaContains, momEmDepth, E_em);
1088  else emPoint = theTowerGeometry->getGeometry(id)->getPosition();
1089  towerP4 = emPoint.basicVector().unit();
1090  towerP4[3] = 1.f; // energy
1091  towerP4 *=E;
1092 
1093  // double sumPf = 1.0/cosh(emPoint.eta());
1095 
1096  hadPoint = emPoint;
1097  }
1098  else { // forward detector: use the CaloTower position
1100  towerP4 = p.basicVector().unit();
1101  towerP4[3] = 1.f; // energy
1102  towerP4 *=E;
1103 
1104  // double pf=1.0/cosh(p.eta());
1105  // if (E>0) towerP4 = CaloTower::PolarLorentzVector(E*pf, p.eta(), p.phi(), 0); // simple momentum assignment, same position
1106  emPoint = p;
1107  hadPoint = p;
1108  }
1109  } // end case 2
1110  break;
1111 
1112  } // end of decision on p4 reconstruction method
1113 
1114 
1115  // insert in collection (remove and return if below threshold)
1116  if unlikely ( (towerP4[3]==0) & (E_outer>0) ) {
1117  float val = theHOIsUsed ? 0 : 1E-9; // to keep backwards compatibility for theHOIsUsed == true
1118  collection.emplace_back(id, E_em, E_had, E_outer, -1, -1, CaloTower::PolarLorentzVector(val,hadPoint.eta(), hadPoint.phi(),0), emPoint, hadPoint);
1119  } else {
1120  collection.emplace_back(id, E_em, E_had, E_outer, -1, -1, GlobalVector(towerP4), towerP4[3], mass2, emPoint, hadPoint);
1121  }
1122  auto & caloTower = collection.back();
1123 
1124  // if (!massless) std::cout << "massive " << id <<' ' << mass1 <<' ' << mass2 <<' ' << caloTower.mass() << std::endl;
1125  // std::cout << "CaloTowerVI " <<theMomConstrMethod <<' ' << id <<' '<< E_em <<' '<< E_had <<' '<< E_outer <<' '<< GlobalVector(towerP4) <<' '<< towerP4[3] <<' '<< emPoint <<' '<< hadPoint << std::endl;
1126  //if (towerP4[3]==0) std::cout << "CaloTowerVIzero " << theEcutTower << ' ' << collection.back().eta() <<' '<< collection.back().phi() << std::endl;
1127 
1128  if(caloTower.energy() < theEcutTower) { collection.pop_back(); return;}
1129 
1130  // set the timings
1131  float ecalTime = (mt.emSumEForTime>0)? mt.emSumTimeTimesE/mt.emSumEForTime : -9999;
1132  float hcalTime = (mt.hadSumEForTime>0)? mt.hadSumTimeTimesE/mt.hadSumEForTime : -9999;
1133  caloTower.setEcalTime(compactTime(ecalTime));
1134  caloTower.setHcalTime(compactTime(hcalTime));
1135  //add topology info
1136  caloTower.setHcalSubdet(theTowerTopology->lastHBRing(),
1140 
1141  // set the CaloTower status word =====================================
1142  // Channels must be counter exclusively in the defined cathegories
1143  // "Bad" channels (not used in energy assignment) can be flagged during
1144  // CaloTower creation only if specified in the configuration file
1145 
1146  unsigned int numBadHcalChan = mt.numBadHcalCells;
1147  // unsigned int numBadEcalChan = mt.numBadEcalCells;
1148  unsigned int numBadEcalChan = 0; //
1149 
1150  unsigned int numRecHcalChan = mt.numRecHcalCells;
1151  unsigned int numRecEcalChan = mt.numRecEcalCells;
1152  unsigned int numProbHcalChan = mt.numProbHcalCells;
1153  unsigned int numProbEcalChan = mt.numProbEcalCells;
1154 
1155  // now add dead/off/... channels not used in RecHit reconstruction for HCAL
1156  HcalDropChMap::iterator dropChItr = hcalDropChMap.find(id);
1157  if (dropChItr != hcalDropChMap.end()) numBadHcalChan += dropChItr->second;
1158 
1159 
1160  // for ECAL the number of all bad channels is obtained here -----------------------
1161 
1162  /*
1163  // old hyper slow algorithm
1164  // get all possible constituents of the tower
1165  std::vector<DetId> allConstituents = theTowerConstituentsMap->constituentsOf(id);
1166 
1167  for (std::vector<DetId>::iterator ac_it=allConstituents.begin();
1168  ac_it!=allConstituents.end(); ++ac_it) {
1169 
1170  if (ac_it->det()!=DetId::Ecal) continue;
1171 
1172  int thisEcalSevLvl = -999;
1173 
1174  if (ac_it->subdetId() == EcalBarrel && theEbHandle.isValid()) {
1175  thisEcalSevLvl = theEcalSevLvlAlgo->severityLevel( *ac_it, *theEbHandle);//, *theEcalChStatus);
1176  }
1177  else if (ac_it->subdetId() == EcalEndcap && theEeHandle.isValid()) {
1178  thisEcalSevLvl = theEcalSevLvlAlgo->severityLevel( *ac_it, *theEeHandle);//, *theEcalChStatus);
1179  }
1180 
1181  // check if the Ecal severity is ok to keep
1182  std::vector<int>::const_iterator sevit = std::find(theEcalSeveritiesToBeExcluded.begin(),
1183  theEcalSeveritiesToBeExcluded.end(),
1184  thisEcalSevLvl);
1185  if (sevit!=theEcalSeveritiesToBeExcluded.end()) {
1186  ++numBadEcalChan;
1187  }
1188 
1189  }
1190 
1191  // compare with fast version
1192 
1193  // hcal:
1194  int inEcals[2] = {0,0};
1195  for (std::vector<std::pair<DetId,float> >::iterator i=metaContains.begin(); i!=metaContains.end(); ++i) {
1196  DetId detId = i->first;
1197  if(detId.det() == DetId::Ecal){
1198  if( detId.subdetId()==EcalBarrel ) inEcals[0] =1;
1199  else if( detId.subdetId()==EcalEndcap ) inEcals[1] =1;
1200  }
1201  }
1202 
1203  auto numBadEcalChanNew = ecalBadChs[theTowerTopology->denseIndex(id)]+mt.numBadEcalCells; // - mt.numRecEcalCells
1204  if (int(numBadEcalChanNew)!=int(numBadEcalChan)) {
1205  std::cout << "VI wrong " << ((inEcals[1]==1) ? "EE" : "" ) << id << " " << numBadEcalChanNew << " " << numBadEcalChan
1206  << " " << mt.numBadEcalCells << " " << mt.numRecEcalCells << std::endl;
1207  }
1208  */
1209 
1210  numBadEcalChan = ecalBadChs[theTowerTopology->denseIndex(id)]+mt.numBadEcalCells; // - mt.numRecEcalCells
1211 
1212  //--------------------------------------------------------------------------------------
1213 
1214  caloTower.setCaloTowerStatus(numBadHcalChan, numBadEcalChan,
1215  numRecHcalChan, numRecEcalChan,
1216  numProbHcalChan, numProbEcalChan);
1217 
1218  double maxCellE = -999.0; // for storing the hottest cell E in the calotower
1219 
1220  std::vector<DetId> contains;
1221  contains.reserve(metaContains.size());
1222  for (std::vector<std::pair<DetId,float> >::iterator i=metaContains.begin(); i!=metaContains.end(); ++i) {
1223 
1224  contains.push_back(i->first);
1225 
1226  if (maxCellE < i->second) {
1227  // need an extra check because of the funny towers that are empty except for the presence of an HO
1228  // hit in the constituents (JetMET wanted them saved)
1229  // This constituent is only used for storing the tower, but should not be concidered as a hot cell canditate for
1230  // configurations with useHO = false
1231 
1232 
1233  if (i->first.det()==DetId::Ecal) { // ECAL
1234  maxCellE = i->second;
1235  }
1236  else { // HCAL
1237  if (HcalDetId(i->first).subdet() != HcalOuter)
1238  maxCellE = i->second;
1239  else if (theHOIsUsed) maxCellE = i->second;
1240  }
1241 
1242  } // found higher E cell
1243 
1244  } // loop over matacontains
1245 
1246  caloTower.setConstituents(std::move(contains));
1247  caloTower.setHottestCellE(maxCellE);
1248 
1249  // std::cout << "CaloTowerVI " << nalgo << ' ' << caloTower.id() << ((inEcals[1]==1) ? "EE " : " " ) << caloTower.pt() << ' ' << caloTower.et() << ' ' << caloTower.mass() << ' '
1250  // << caloTower.constituentsSize() <<' '<< caloTower.towerStatusWord() << std::endl;
1251 
1252 }
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:38
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
Basic3DVector unit() const
GlobalPoint emShwrPos(const std::vector< std::pair< DetId, float > > &metaContains, float fracDepth, double totEmE)
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
#define unlikely(x)
U second(std::pair< T, U > const &p)
GlobalPoint hadShwrPos(const std::vector< std::pair< DetId, float > > &metaContains, float fracDepth, double hadE)
const CaloSubdetectorGeometry * theTowerGeometry
int lastHFRing() const
T sqrt(T t)
Definition: SSEVec.h:18
GlobalPoint emShwrLogWeightPos(const std::vector< std::pair< DetId, float > > &metaContains, float fracDepth, double totEmE)
const CaloTowerTopology * theTowerTopology
bool theHOIsUsed
only affects energy and ET calculation. HO is still recorded in the tower
uint32_t denseIndex(const DetId &id) const
T eta() const
Definition: PV3DBase.h:76
std::vector< unsigned short > ecalBadChs
int lastHERing() const
if(dp >Float(M_PI)) dp-
int lastHORing() const
int lastHBRing() const
int firstHFRing() const
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
def move(src, dest)
Definition: eostools.py:510
const_reference back() const
Global3DVector GlobalVector
Definition: GlobalVector.h:10
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:39
std::tuple< unsigned int, bool > CaloTowersCreationAlgo::ecalChanStatusForCaloTower ( const EcalRecHit hit)

Definition at line 1807 of file CaloTowersCreationAlgo.cc.

References BadChan, spr::find(), GoodChan, IgnoredChan, EcalSeverityLevel::kBad, EcalSeverityLevel::kGood, EcalSeverityLevel::kRecovered, ProblematicChan, RecoveredChan, interestingDetIdCollectionProducer_cfi::severityLevel, EcalSeverityLevelAlgo::severityLevel(), theEcalSeveritiesToBeExcluded, theEcalSeveritiesToBeUsedInBadTowers, theEcalSevLvlAlgo, theRecoveredEcalHitsAreUsed, useRejectedHitsOnly, and useRejectedRecoveredEcalHits.

Referenced by assignHitEcal(), and setEcalChStatusFromDB().

1807  {
1808 
1809  // const DetId id = hit->detid();
1810 
1811  // uint16_t dbStatus = theEcalChStatus->find(id)->getStatusCode();
1812  // uint32_t rhFlags = hit->flags();
1813  // int severityLevel = theEcalSevLvlAlgo->severityLevel(rhFlags, dbStatus);
1814  // The methods above will become private and cannot be usef for flagging ecal spikes.
1815  // Use the recommended interface - we leave the parameters for spilke removal to be specified by ECAL.
1816 
1817 
1818  // int severityLevel = 999;
1819 
1820  EcalRecHit const & rh = *reinterpret_cast<EcalRecHit const *>(hit);
1822 
1823 // if (id.subdetId() == EcalBarrel) severityLevel = theEcalSevLvlAlgo->severityLevel( id, *theEbHandle);//, *theEcalChStatus);
1824 // else if (id.subdetId() == EcalEndcap) severityLevel = theEcalSevLvlAlgo->severityLevel( id, *theEeHandle);//, *theEcalChStatus);
1825 
1826  // there should be no other ECAL types used in this reconstruction
1827 
1828  // The definition of ECAL severity levels uses categories that
1829  // are similar to the defined for CaloTower. (However, the categorization
1830  // for CaloTowers depends on the specified maximum acceptabel severity and therefore cannnot
1831  // be exact correspondence between the two. ECAL has additional categories describing modes of failure.)
1832  // This approach is different from the initial idea and from
1833  // the implementation for HCAL. Still make the logic similar to HCAL so that one has the ability to
1834  // exclude problematic channels as defined by ECAL.
1835  // For definitions of ECAL severity levels see RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h
1836 
1837  bool isBad = (severityLevel == EcalSeverityLevel::kBad);
1838 
1839  bool isRecovered = (severityLevel == EcalSeverityLevel::kRecovered);
1840 
1841  // check if the severity is compatible with our configuration
1842  // This applies to the "default" tower cleaning
1843  std::vector<int>::const_iterator sevit = std::find(theEcalSeveritiesToBeExcluded.begin(),
1845  severityLevel);
1846  bool accepted = (sevit==theEcalSeveritiesToBeExcluded.end()) ;
1847 
1848  // For use with hits that were rejected in the regular reconstruction:
1849  // This is for creating calotowers with lower level of cleaning by merging
1850  // the information from the default towers and a collection of towers created from
1851  // bad rechits
1852 
1853 
1854  if (useRejectedHitsOnly) {
1855 
1856  if (!isRecovered) {
1857 
1858  if (accepted ||
1861  return std::make_tuple(CaloTowersCreationAlgo::IgnoredChan,isBad);
1862  // this hit was either already accepted, or is not eligible for inclusion
1863  }
1864  else {
1865 
1867  // skip recovered hits either because they were already used or because there was an explicit instruction
1868  return std::make_tuple(CaloTowersCreationAlgo::IgnoredChan,isBad);;
1869  }
1870  else if (useRejectedRecoveredEcalHits) {
1871  return std::make_tuple(CaloTowersCreationAlgo::RecoveredChan,isBad);
1872  }
1873 
1874  } // recovered channels
1875 
1876  // clasify channels as problematic
1877  return std::make_tuple(CaloTowersCreationAlgo::ProblematicChan,isBad);
1878 
1879  } // treatment of rejected hits
1880 
1881 
1882 
1883  // for normal reconstruction
1884  if (severityLevel == EcalSeverityLevel::kGood) return std::make_tuple(CaloTowersCreationAlgo::GoodChan,false);
1885 
1886  if (isRecovered) {
1887  return std::make_tuple( (theRecoveredEcalHitsAreUsed) ?
1889  }
1890  else {
1891  return std::make_tuple(accepted ? CaloTowersCreationAlgo::ProblematicChan : CaloTowersCreationAlgo::BadChan,isBad);
1892 
1893  }
1894 
1895 
1896 }
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
std::vector< int > theEcalSeveritiesToBeUsedInBadTowers
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
std::vector< int > theEcalSeveritiesToBeExcluded
const EcalSeverityLevelAlgo * theEcalSevLvlAlgo
GlobalPoint CaloTowersCreationAlgo::emCrystalShwrPos ( DetId  detId,
float  fracDepth 
)

Definition at line 1395 of file CaloTowersCreationAlgo.cc.

References CaloCellGeometry::getBackPoint(), CaloGeometry::getGeometry(), CaloCellGeometry::getPosition(), point, and theGeometry.

Referenced by emShwrLogWeightPos(), emShwrPos(), hadSegmentShwrPos(), and setEeHandle().

1395  {
1396  const CaloCellGeometry* cellGeometry = theGeometry->getGeometry(detId);
1397  GlobalPoint point = cellGeometry->getPosition(); // face of the cell
1398 
1399  if (fracDepth<=0) return point;
1400  if (fracDepth>1) fracDepth=1;
1401 
1402  GlobalPoint backPoint = cellGeometry->getBackPoint();
1403  point += fracDepth * (backPoint-point);
1404 
1405  return point;
1406 }
const GlobalPoint & getBackPoint() const
const CaloGeometry * theGeometry
const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:78
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
*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
Definition: invegas.h:5
GlobalPoint CaloTowersCreationAlgo::emShwrLogWeightPos ( const std::vector< std::pair< DetId, float > > &  metaContains,
float  fracDepth,
double  totEmE 
)

Definition at line 1588 of file CaloTowersCreationAlgo.cc.

References DetId::Ecal, emCrystalShwrPos(), cmsBatch::log, AlCaHLTBitMon_ParallelJobs::p, mps_merge::weight, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by convert(), and setEeHandle().

1589  {
1590 
1591  double emX = 0.0;
1592  double emY = 0.0;
1593  double emZ = 0.0;
1594 
1595  double weight = 0;
1596  double sumWeights = 0;
1597  double sumEmE = 0; // add crystals with E/E_EM > 1.5%
1598  double crystalThresh = 0.015 * emE;
1599 
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;
1604  }
1605 
1606  for (mc_it = metaContains.begin(); mc_it!=metaContains.end(); ++mc_it) {
1607 
1608  if (mc_it->first.det() != DetId::Ecal || mc_it->second < crystalThresh) continue;
1609 
1610  GlobalPoint p = emCrystalShwrPos(mc_it->first, fracDepth);
1611 
1612  weight = 4.2 + log(mc_it->second/sumEmE);
1613  sumWeights += weight;
1614 
1615  emX += p.x() * weight;
1616  emY += p.y() * weight;
1617  emZ += p.z() * weight;
1618  }
1619 
1620  return GlobalPoint(emX/sumWeights, emY/sumWeights, emZ/sumWeights);
1621 }
GlobalPoint emCrystalShwrPos(DetId detId, float fracDepth)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
Definition: weight.py:1
T z() const
Definition: PV3DBase.h:64
T x() const
Definition: PV3DBase.h:62
GlobalPoint CaloTowersCreationAlgo::emShwrPos ( const std::vector< std::pair< DetId, float > > &  metaContains,
float  fracDepth,
double  totEmE 
)

Definition at line 1558 of file CaloTowersCreationAlgo.cc.

References MillePedeFileConverter_cfg::e, DetId::Ecal, emCrystalShwrPos(), AlCaHLTBitMon_ParallelJobs::p, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by convert(), and setEeHandle().

1559  {
1560 
1561  if (emE<=0) return GlobalPoint(0,0,0);
1562 
1563  double emX = 0.0;
1564  double emY = 0.0;
1565  double emZ = 0.0;
1566 
1567  double eSum = 0;
1568 
1569  std::vector<std::pair<DetId,float> >::const_iterator mc_it = metaContains.begin();
1570  for (; mc_it!=metaContains.end(); ++mc_it) {
1571  if (mc_it->first.det() != DetId::Ecal) continue;
1572  GlobalPoint p = emCrystalShwrPos(mc_it->first, fracDepth);
1573  double e = mc_it->second;
1574 
1575  if (e>0) {
1576  emX += p.x() * e;
1577  emY += p.y() * e;
1578  emZ += p.z() * e;
1579  eSum += e;
1580  }
1581 
1582  }
1583 
1584  return GlobalPoint(emX/eSum, emY/eSum, emZ/eSum);
1585 }
GlobalPoint emCrystalShwrPos(DetId detId, float fracDepth)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
T z() const
Definition: PV3DBase.h:64
T x() const
Definition: PV3DBase.h:62
CaloTowersCreationAlgo::MetaTower & CaloTowersCreationAlgo::find ( const CaloTowerDetId id)
private

looks for a given tower in the internal cache. If it can't find it, it makes it.

Definition at line 928 of file CaloTowersCreationAlgo.cc.

References CaloTowerTopology::denseIndex(), CaloTowerTopology::firstHFRing(), CaloTowerDetId::ietaAbs(), TtSemiLepEvtBuilder_cfi::mt, CaloTowerTopology::sizeForDenseIndexing(), theTowerMap, theTowerMapSize, and theTowerTopology.

Referenced by assignHitEcal(), assignHitHcal(), and rescale().

928  {
929  if (theTowerMap.empty()) {
931  }
932 
933  auto & mt = theTowerMap[theTowerTopology->denseIndex(detId)];
934 
935  if (mt.empty()) {
936  mt.id=detId;
937  mt.metaConstituents.reserve(detId.ietaAbs()<theTowerTopology->firstHFRing() ? 12 : 2);
938  ++theTowerMapSize;
939  }
940 
941  return mt;
942 }
const CaloTowerTopology * theTowerTopology
uint32_t denseIndex(const DetId &id) const
int firstHFRing() const
uint32_t sizeForDenseIndexing() const
void CaloTowersCreationAlgo::finish ( CaloTowerCollection destCollection)

Definition at line 417 of file CaloTowersCreationAlgo.cc.

References convert(), TtSemiLepEvtBuilder_cfi::mt, edm::SortedCollection< T, SORT >::reserve(), theTowerMap, and theTowerMapSize.

Referenced by progressbar.ProgressBar::__next__(), CaloTowersCreator::produce(), and setEcalChStatusFromDB().

417  {
418  // now copy this map into the final collection
419  result.reserve(theTowerMapSize);
420  // auto k=0U;
421  // if (!theEbHandle.isValid()) std::cout << "VI ebHandle not valid" << std::endl;
422  // if (!theEeHandle.isValid()) std::cout << "VI eeHandle not valid" << std::endl;
423 
424  for(auto const & mt : theTowerMap ) {
425  // Convert only if there is at least one constituent in the metatower.
426  // The check of constituents size in the coverted tower is still needed!
427  if (!mt.empty() ) { convert(mt.id, mt, result); } // ++k;}
428  }
429 
430  // assert(k==theTowerMapSize);
431  // std::cout << "VI TowerMap " << theTowerMapSize << " " << k << std::endl;
432 
433  theTowerMap.clear(); // save the memory
434  theTowerMapSize=0;
435 }
void convert(const CaloTowerDetId &id, const MetaTower &mt, CaloTowerCollection &collection)
void CaloTowersCreationAlgo::getThresholdAndWeight ( const DetId detId,
double &  threshold,
double &  weight 
) const
private

helper method to look up the appropriate threshold & weight

Definition at line 1256 of file CaloTowersCreationAlgo.cc.

References HcalDetId::depth(), DetId::det(), DetId::Ecal, EcalBarrel, EcalEndcap, HcalTopology::firstHEDoublePhiRing(), DetId::Hcal, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalDetId::ieta(), HcalDetId::ietaAbs(), fftjetcommon_cfi::Interpolator, HcalDetId::subdet(), DetId::subdetId(), theEBEScale, theEBGrid, theEBthreshold, theEBweight, theEBWeights, theEEEScale, theEEGrid, theEEthreshold, theEEweight, theEEWeights, theHBEScale, theHBGrid, theHBthreshold, theHBweight, theHBWeights, theHcalTopology, theHEDEScale, theHEDGrid, theHEDthreshold, theHEDweight, theHEDWeights, theHESEScale, theHESGrid, theHESthreshold, theHESweight, theHESWeights, theHF1EScale, theHF1Grid, theHF1threshold, theHF1weight, theHF1Weights, theHF2EScale, theHF2Grid, theHF2threshold, theHF2weight, theHF2Weights, theHOEScale, theHOGrid, theHOthreshold0, theHOthresholdMinus1, theHOthresholdMinus2, theHOthresholdPlus1, theHOthresholdPlus2, theHOweight, and theHOWeights.

Referenced by assignHitEcal(), assignHitHcal(), rescale(), and rescaleTowers().

1256  {
1257  DetId::Detector det = detId.det();
1258  weight=0; // in case the hit is not identified
1259 
1260  if(det == DetId::Ecal) {
1261  // may or may not be EB. We'll find out.
1262 
1263  EcalSubdetector subdet = (EcalSubdetector)(detId.subdetId());
1264  if(subdet == EcalBarrel) {
1266  weight = theEBweight;
1267  if (weight <= 0.) {
1268  ROOT::Math::Interpolator my(theEBGrid,theEBWeights,ROOT::Math::Interpolation::kAKIMA);
1269  weight = my.Eval(theEBEScale);
1270  }
1271  }
1272  else if(subdet == EcalEndcap) {
1274  weight = theEEweight;
1275  if (weight <= 0.) {
1276  ROOT::Math::Interpolator my(theEEGrid,theEEWeights,ROOT::Math::Interpolation::kAKIMA);
1277  weight = my.Eval(theEEEScale);
1278  }
1279  }
1280  }
1281  else if(det == DetId::Hcal) {
1282  HcalDetId hcalDetId(detId);
1283  HcalSubdetector subdet = hcalDetId.subdet();
1284 
1285  if(subdet == HcalBarrel) {
1287  weight = theHBweight;
1288  if (weight <= 0.) {
1289  ROOT::Math::Interpolator my(theHBGrid,theHBWeights,ROOT::Math::Interpolation::kAKIMA);
1290  weight = my.Eval(theHBEScale);
1291  }
1292  }
1293 
1294  else if(subdet == HcalEndcap) {
1295  // check if it's single or double tower
1296  if(hcalDetId.ietaAbs() < theHcalTopology->firstHEDoublePhiRing()) {
1298  weight = theHESweight;
1299  if (weight <= 0.) {
1300  ROOT::Math::Interpolator my(theHESGrid,theHESWeights,ROOT::Math::Interpolation::kAKIMA);
1301  weight = my.Eval(theHESEScale);
1302  }
1303  }
1304  else {
1306  weight = theHEDweight;
1307  if (weight <= 0.) {
1308  ROOT::Math::Interpolator my(theHEDGrid,theHEDWeights,ROOT::Math::Interpolation::kAKIMA);
1309  weight = my.Eval(theHEDEScale);
1310  }
1311  }
1312  }
1313 
1314  else if(subdet == HcalOuter) {
1315  //check if it's ring 0 or +1 or +2 or -1 or -2
1316  if(hcalDetId.ietaAbs() <= 4) threshold = theHOthreshold0;
1317  else if(hcalDetId.ieta() < 0) {
1318  // set threshold for ring -1 or -2
1319  threshold = (hcalDetId.ietaAbs() <= 10) ? theHOthresholdMinus1 : theHOthresholdMinus2;
1320  } else {
1321  // set threshold for ring +1 or +2
1322  threshold = (hcalDetId.ietaAbs() <= 10) ? theHOthresholdPlus1 : theHOthresholdPlus2;
1323  }
1324  weight = theHOweight;
1325  if (weight <= 0.) {
1326  ROOT::Math::Interpolator my(theHOGrid,theHOWeights,ROOT::Math::Interpolation::kAKIMA);
1327  weight = my.Eval(theHOEScale);
1328  }
1329  }
1330 
1331  else if(subdet == HcalForward) {
1332  if(hcalDetId.depth() == 1) {
1334  weight = theHF1weight;
1335  if (weight <= 0.) {
1336  ROOT::Math::Interpolator my(theHF1Grid,theHF1Weights,ROOT::Math::Interpolation::kAKIMA);
1337  weight = my.Eval(theHF1EScale);
1338  }
1339  } else {
1341  weight = theHF2weight;
1342  if (weight <= 0.) {
1343  ROOT::Math::Interpolator my(theHF2Grid,theHF2Weights,ROOT::Math::Interpolation::kAKIMA);
1344  weight = my.Eval(theHF2EScale);
1345  }
1346  }
1347  }
1348  }
1349  else {
1350  edm::LogError("CaloTowersCreationAlgo") << "Bad cell: " << det << std::endl;
1351  }
1352 }
std::vector< double > theHBGrid
std::vector< double > theHESGrid
std::vector< double > theHEDGrid
Definition: weight.py:1
std::vector< double > theHOWeights
std::vector< double > theEEGrid
std::vector< double > theEEWeights
std::vector< double > theHESWeights
std::vector< double > theHF2Grid
std::vector< double > theHEDWeights
HcalSubdetector
Definition: HcalAssistant.h:31
std::vector< double > theHOGrid
std::vector< double > theHF1Weights
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:96
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
std::vector< double > theHBWeights
Detector
Definition: DetId.h:24
const HcalTopology * theHcalTopology
std::vector< double > theHF1Grid
std::vector< double > theEBGrid
std::vector< double > theHF2Weights
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
EcalSubdetector
std::vector< double > theEBWeights
GlobalPoint CaloTowersCreationAlgo::hadSegmentShwrPos ( DetId  detId,
float  fracDepth 
)

Definition at line 1408 of file CaloTowersCreationAlgo.cc.

References emCrystalShwrPos().

Referenced by hadShwrPos(), and setEeHandle().

1408  {
1409  // same code as above
1410  return emCrystalShwrPos(detId, fracDepth);
1411 }
GlobalPoint emCrystalShwrPos(DetId detId, float fracDepth)
GlobalPoint CaloTowersCreationAlgo::hadShwPosFromCells ( DetId  frontCell,
DetId  backCell,
float  fracDepth 
)

Definition at line 1529 of file CaloTowersCreationAlgo.cc.

References gather_cfg::cout, CaloCellGeometry::getBackPoint(), CaloGeometry::getGeometry(), CaloCellGeometry::getPosition(), HcalTopology::idBack(), HcalTopology::idFront(), point, theGeometry, theHcalTopology, and HcalTopology::withSpecialRBXHBHE().

Referenced by hadShwrPos(), and setEeHandle().

1529  {
1530 
1531  // uses the "front" and "back" cells
1532  // to determine the axis. point set by the predefined depth.
1533 
1534  HcalDetId hid1(frontCellId), hid2(backCellId);
1536  hid1 = theHcalTopology->idFront(frontCellId);
1537 #ifdef EDM_ML_DEBUG
1538  std::cout << "Front " << HcalDetId(frontCellId) << " " << hid1 << "\n";
1539 #endif
1540  hid2 = theHcalTopology->idBack(backCellId);
1541 #ifdef EDM_ML_DEBUG
1542  std::cout << "Back " << HcalDetId(backCellId) << " " << hid2 << "\n";
1543 #endif
1544  }
1545 
1546  const CaloCellGeometry* frontCellGeometry = theGeometry->getGeometry(DetId(hid1));
1547  const CaloCellGeometry* backCellGeometry = theGeometry->getGeometry(DetId(hid2));
1548 
1549  GlobalPoint point = frontCellGeometry->getPosition();
1550  GlobalPoint backPoint = backCellGeometry->getBackPoint();
1551 
1552  point += fracDepth * (backPoint - point);
1553 
1554  return point;
1555 }
const GlobalPoint & getBackPoint() const
const CaloGeometry * theGeometry
Definition: DetId.h:18
const HcalTopology * theHcalTopology
HcalDetId idBack(const HcalDetId &id) const
Definition: HcalTopology.h:171
const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:78
HcalDetId idFront(const HcalDetId &id) const
Definition: HcalTopology.h:170
bool withSpecialRBXHBHE() const
Definition: HcalTopology.h:162
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
*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
Definition: invegas.h:5
GlobalPoint CaloTowersCreationAlgo::hadShwrPos ( const std::vector< std::pair< DetId, float > > &  metaContains,
float  fracDepth,
double  hadE 
)

Definition at line 1414 of file CaloTowersCreationAlgo.cc.

References gather_cfg::cout, hadSegmentShwrPos(), DetId::Hcal, HcalOuter, AlCaHLTBitMon_ParallelJobs::p, HcalDetId::subdet(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by convert(), and setEeHandle().

1415  {
1416 
1417  // this is based on available RecHits, can lead to different actual depths if
1418  // hits in multi-depth towers are not all there
1419 #ifdef EDM_ML_DEBUG
1420  std::cout << "hadShwrPos called with " << metaContains.size()
1421  << " elements and energy " << hadE << ":" << fracDepth
1422  << std::endl;
1423 #endif
1424  if (hadE<=0) return GlobalPoint(0,0,0);
1425 
1426  double hadX = 0.0;
1427  double hadY = 0.0;
1428  double hadZ = 0.0;
1429 
1430  int nConst = 0;
1431 
1432  std::vector<std::pair<DetId,float> >::const_iterator mc_it = metaContains.begin();
1433  for (; mc_it!=metaContains.end(); ++mc_it) {
1434  if (mc_it->first.det() != DetId::Hcal) continue;
1435  // do not use HO for deirection calculations for now
1436  if (HcalDetId(mc_it->first).subdet() == HcalOuter) continue;
1437  ++nConst;
1438 
1439  GlobalPoint p = hadSegmentShwrPos(mc_it->first, fracDepth);
1440 
1441  // longitudinal segmentation: do not weight by energy,
1442  // get the geometrical position
1443  hadX += p.x();
1444  hadY += p.y();
1445  hadZ += p.z();
1446  }
1447 
1448  return GlobalPoint(hadX/nConst, hadY/nConst, hadZ/nConst);
1449 }
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
T z() const
Definition: PV3DBase.h:64
GlobalPoint hadSegmentShwrPos(DetId detId, float fracDepth)
T x() const
Definition: PV3DBase.h:62
GlobalPoint CaloTowersCreationAlgo::hadShwrPos ( CaloTowerDetId  id,
float  fracDepth 
)

Definition at line 1452 of file CaloTowersCreationAlgo.cc.

References funct::abs(), CaloTowerConstituentsMap::constituentsOf(), CaloTowerTopology::convertCTtoHcal(), gather_cfg::cout, HcalDetId::depth(), CaloTowerTopology::firstHFRing(), hadShwPosFromCells(), DetId::Hcal, HcalForward, HcalOuter, mps_fire::i, HcalTopology::idBack(), HcalTopology::idFront(), CaloTowerDetId::ieta(), CaloTowerDetId::ietaAbs(), CaloTowerDetId::iphi(), mps_monitormerge::items, gen::k, CaloTowerTopology::lastHERing(), point, HcalDetId::subdet(), theHcalPhase, theHcalTopology, theTowerConstituentsMap, theTowerTopology, HcalTopology::validHcal(), and CaloTowerDetId::zside().

1452  {
1453 
1454  // set depth using geometry of cells that are associated with the
1455  // tower (regardless if they have non-zero energies)
1456 
1457  // if (hadE <= 0) return GlobalPoint(0, 0, 0);
1458 #ifdef EDM_ML_DEBUG
1459  std::cout << "hadShwrPos " << towerId << " frac " << fracDepth << std::endl;
1460 #endif
1461  if (fracDepth < 0) fracDepth = 0;
1462  else if (fracDepth > 1) fracDepth = 1;
1463 
1464  GlobalPoint point(0,0,0);
1465 
1466  int iEta = towerId.ieta();
1467  int iPhi = towerId.iphi();
1468 
1469  HcalDetId frontCellId, backCellId;
1470 
1471  if(towerId.ietaAbs() >= theTowerTopology->firstHFRing()){
1472  // forward, take the geometry for long fibers
1473  frontCellId = HcalDetId(HcalForward, towerId.zside()*theTowerTopology->convertCTtoHcal(abs(iEta)), iPhi, 1);
1474  backCellId = HcalDetId(HcalForward, towerId.zside()*theTowerTopology->convertCTtoHcal(abs(iEta)), iPhi, 1);
1475  }
1476  else {
1477  //use constituents map
1478  std::vector<DetId> items = theTowerConstituentsMap->constituentsOf(towerId);
1479  int frontDepth = 1000;
1480  int backDepth = -1000;
1481  for(unsigned i = 0; i < items.size(); i++){
1482  if(items[i].det()!=DetId::Hcal) continue;
1483  HcalDetId hid(items[i]);
1484  if(hid.subdet() == HcalOuter) continue;
1485  if(!theHcalTopology->validHcal(hid,2)) continue;
1486 
1487  if (theHcalTopology->idFront(hid).depth()<frontDepth) {
1488  frontCellId = hid;
1489  frontDepth = theHcalTopology->idFront(hid).depth();
1490  }
1491  if (theHcalTopology->idBack(hid).depth()>backDepth) {
1492  backCellId = hid;
1493  backDepth = theHcalTopology->idBack(hid).depth();
1494  }
1495  }
1496 #ifdef EDM_ML_DEBUG
1497  std::cout << "Front " << frontCellId << " Back " << backCellId
1498  << " Depths " << frontDepth << ":" << backDepth << std::endl;
1499 #endif
1500  //fix for tower 28/29 - no tower 29 at highest depths
1501  if(towerId.ietaAbs()==theTowerTopology->lastHERing() && (theHcalPhase==0 || theHcalPhase==1)){
1502  CaloTowerDetId towerId28(towerId.ieta()-towerId.zside(),towerId.iphi());
1503  std::vector<DetId> items28 = theTowerConstituentsMap->constituentsOf(towerId28);
1504 #ifdef EDM_ML_DEBUG
1505  std::cout << towerId28 << " with " << items28.size() <<" constituents:";
1506  for (unsigned k=0; k<items28.size(); ++k)
1507  if (items28[k].det()==DetId::Hcal) std::cout << " " << HcalDetId(items28[k]);
1508  std::cout << std::endl;
1509 #endif
1510  for(unsigned i = 0; i < items28.size(); i++){
1511  if(items28[i].det()!=DetId::Hcal) continue;
1512  HcalDetId hid(items28[i]);
1513  if(hid.subdet() == HcalOuter) continue;
1514 
1515  if(theHcalTopology->idBack(hid).depth()>backDepth) {
1516  backCellId = hid;
1517  backDepth = theHcalTopology->idBack(hid).depth(); }
1518  }
1519  }
1520 #ifdef EDM_ML_DEBUG
1521  std::cout << "Back " << backDepth << " ID " << backCellId << std::endl;
1522 #endif
1523  }
1524  point = hadShwPosFromCells(DetId(frontCellId), DetId(backCellId), fracDepth);
1525 
1526  return point;
1527 }
bool validHcal(const HcalDetId &id) const
std::vector< DetId > constituentsOf(const CaloTowerDetId &id) const
Get the constituent detids for this tower id ( not yet implemented )
int depth() const
get the tower depth
Definition: HcalDetId.cc:108
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const CaloTowerConstituentsMap * theTowerConstituentsMap
const CaloTowerTopology * theTowerTopology
unsigned towerId(DetId const &)
int k[5][pyjets_maxn]
Definition: DetId.h:18
GlobalPoint hadShwPosFromCells(DetId frontCell, DetId backCell, float fracDepth)
const HcalTopology * theHcalTopology
HcalDetId idBack(const HcalDetId &id) const
Definition: HcalTopology.h:171
int lastHERing() const
int convertCTtoHcal(int ct_ieta) const
HcalDetId idFront(const HcalDetId &id) const
Definition: HcalTopology.h:170
int firstHFRing() 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
Definition: invegas.h:5
unsigned int CaloTowersCreationAlgo::hcalChanStatusForCaloTower ( const CaloRecHit hit)

Definition at line 1741 of file CaloTowersCreationAlgo.cc.

References BadChan, gather_cfg::cout, CaloRecHit::detid(), CaloRecHit::flags(), HcalSeverityLevelComputer::getSeverityLevel(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), GoodChan, HcalTopology::idFront(), IgnoredChan, ProblematicChan, RecoveredChan, HcalSeverityLevelComputer::recoveredRecHit(), interestingDetIdCollectionProducer_cfi::severityLevel, theHcalAcceptSeverityLevel, theHcalAcceptSeverityLevelForRejectedHit, theHcalChStatus, theHcalSevLvlComputer, theHcalTopology, theRecoveredHcalHitsAreUsed, useRejectedHitsOnly, and useRejectedRecoveredHcalHits.

Referenced by assignHitHcal(), and setEcalChStatusFromDB().

1741  {
1742 
1743  HcalDetId hid(hit->detid());
1744  DetId id = theHcalTopology->idFront(hid);
1745 #ifdef EDM_ML_DEBUG
1746  std::cout << "ChanStatusForCaloTower for " << hid << " to " << HcalDetId(id)
1747  << std::endl;
1748 #endif
1749  const uint32_t recHitFlag = hit->flags();
1750  const uint32_t dbStatusFlag = theHcalChStatus->getValues(id)->getValue();
1751 
1752  int severityLevel = theHcalSevLvlComputer->getSeverityLevel(id, recHitFlag, dbStatusFlag);
1753  bool isRecovered = theHcalSevLvlComputer->recoveredRecHit(id, recHitFlag);
1754 
1755 
1756  // For use with hits rejected in the default reconstruction
1757  if (useRejectedHitsOnly) {
1758 
1759  if (!isRecovered) {
1760 
1761  if (severityLevel <= int(theHcalAcceptSeverityLevel) ||
1763  // this hit was either already accepted or is worse than
1764  }
1765  else {
1766 
1768  // skip recovered hits either because they were already used or because there was an explicit instruction
1770  }
1771  else if (useRejectedRecoveredHcalHits) {
1773  }
1774 
1775  } // recovered channels
1776 
1777  // clasify channels as problematic: no good hits are supposed to be present in the
1778  // extra rechit collections
1780 
1781  } // treatment of rejected hits
1782 
1783 
1784 
1785 
1786  // this is for the regular reconstruction sequence
1787 
1788  if (severityLevel == 0) return CaloTowersCreationAlgo::GoodChan;
1789 
1790  if (isRecovered) {
1791  return (theRecoveredHcalHitsAreUsed) ?
1793  }
1794  else {
1795  if (severityLevel > int(theHcalAcceptSeverityLevel)) {
1797  }
1798  else {
1800  }
1801  }
1802 
1803 }
const HcalChannelQuality * theHcalChStatus
const DetId & detid() const
Definition: CaloRecHit.h:21
const Item * getValues(DetId fId, bool throwOnFail=true) const
bool recoveredRecHit(const DetId &myid, const uint32_t &myflag) const
uint32_t flags() const
Definition: CaloRecHit.h:22
const HcalSeverityLevelComputer * theHcalSevLvlComputer
Definition: DetId.h:18
int getSeverityLevel(const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
const HcalTopology * theHcalTopology
HcalDetId idFront(const HcalDetId &id) const
Definition: HcalTopology.h:170
uint32_t getValue() const
unsigned int theHcalAcceptSeverityLevelForRejectedHit
void CaloTowersCreationAlgo::makeEcalBadChs ( )

Definition at line 1692 of file CaloTowersCreationAlgo.cc.

References CaloTowerConstituentsMap::constituentsOf(), CaloTowerTopology::detIdFromDenseIndex(), DetId::Ecal, ecalBadChs, spr::find(), EcalSeverityLevelAlgo::severityLevel(), CaloTowerTopology::sizeForDenseIndexing(), theEcalSeveritiesToBeExcluded, theEcalSevLvlAlgo, theTowerConstituentsMap, theTowerTopology, and mitigatedMETSequence_cff::U.

Referenced by CaloTowersCreator::produce(), and setEcalChStatusFromDB().

1692  {
1693 
1694  // std::cout << "VI making EcalBadChs ";
1695 
1696  // for ECAL the number of all bad channels is obtained here -----------------------
1697 
1698  for (auto ind=0U; ind<theTowerTopology->sizeForDenseIndexing(); ++ind) {
1699 
1700  auto & numBadEcalChan = ecalBadChs[ind];
1701  numBadEcalChan=0;
1702  auto id = theTowerTopology->detIdFromDenseIndex(ind);
1703 
1704  // this is utterly slow... (can be optmized if really needed)
1705 
1706  // get all possible constituents of the tower
1707  std::vector<DetId> allConstituents = theTowerConstituentsMap->constituentsOf(id);
1708 
1709  for (std::vector<DetId>::iterator ac_it=allConstituents.begin();
1710  ac_it!=allConstituents.end(); ++ac_it) {
1711 
1712  if (ac_it->det()!=DetId::Ecal) continue;
1713 
1714  auto thisEcalSevLvl = theEcalSevLvlAlgo->severityLevel( *ac_it);
1715 
1716  // check if the Ecal severity is ok to keep
1717  std::vector<int>::const_iterator sevit = std::find(theEcalSeveritiesToBeExcluded.begin(),
1719  thisEcalSevLvl);
1720  if (sevit!=theEcalSeveritiesToBeExcluded.end()) {
1721  ++numBadEcalChan;
1722  }
1723  }
1724 
1725  // if (0!=numBadEcalChan) std::cout << id << ":" << numBadEcalChan << ", ";
1726  }
1727 
1728  /*
1729  int tot=0;
1730  for (auto ind=0U; ind<theTowerTopology->sizeForDenseIndexing(); ++ind) {
1731  if (ecalBadChs[ind]!=0) ++tot;
1732  }
1733  std::cout << " | " << tot << std::endl;
1734  */
1735 
1736 }
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
std::vector< DetId > constituentsOf(const CaloTowerDetId &id) const
Get the constituent detids for this tower id ( not yet implemented )
CaloTowerDetId detIdFromDenseIndex(uint32_t din) const
const CaloTowerConstituentsMap * theTowerConstituentsMap
const CaloTowerTopology * theTowerTopology
std::vector< int > theEcalSeveritiesToBeExcluded
std::vector< unsigned short > ecalBadChs
const EcalSeverityLevelAlgo * theEcalSevLvlAlgo
uint32_t sizeForDenseIndexing() const
void CaloTowersCreationAlgo::makeHcalDropChMap ( )

Definition at line 1647 of file CaloTowersCreationAlgo.cc.

References gather_cfg::cout, HcalDetId::depth(), HcalSeverityLevelComputer::dropChannel(), spr::find(), HcalCondObjectContainer< Item >::getAllChannels(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), hcalDropChMap, HcalEndcap, CaloTowerDetId::ieta(), HcalDetId::ietaAbs(), CaloTowerDetId::iphi(), HcalDetId::iphi(), HcalTopology::lastHERing(), MatrixUtil::merge(), HcalTopology::mergedDepthDetId(), mergedDepths, mergedDepthsOne, phizOne, HcalDetId::subdet(), subdetOne, theHcalChStatus, theHcalPhase, theHcalSevLvlComputer, theHcalTopology, theTowerConstituentsMap, CaloTowerConstituentsMap::towerOf(), CaloTowerDetId::zside(), and HcalDetId::zside().

Referenced by CaloTowersCreator::produce(), and setEcalChStatusFromDB().

1647  {
1648 
1649  // This method fills the map of number of dead channels for the calotower,
1650  // The key of the map is CaloTowerDetId.
1651  // By definition these channels are not going to be in the RecHit collections.
1652  hcalDropChMap.clear();
1653  std::vector<DetId> allChanInStatusCont = theHcalChStatus->getAllChannels();
1654 
1655 #ifdef EDM_ML_DEBUG
1656  std::cout << "DropChMap with " << allChanInStatusCont.size() << " channels"
1657  << std::endl;
1658 #endif
1659  for (std::vector<DetId>::iterator it = allChanInStatusCont.begin(); it!=allChanInStatusCont.end(); ++it) {
1660  const uint32_t dbStatusFlag = theHcalChStatus->getValues(*it)->getValue();
1661  if (theHcalSevLvlComputer->dropChannel(dbStatusFlag)) {
1662 
1664 
1666 
1667  hcalDropChMap[twrId] +=1;
1668 
1669  HcalDetId hid(*it);
1670 
1671  // special case for tower 29: if HCAL hit is in depth 3 add to twr 29 as well
1672  if (hid.subdet()==HcalEndcap &&
1673  (theHcalPhase==0 || theHcalPhase==1) &&
1674  hid.ietaAbs()==theHcalTopology->lastHERing()-1) {
1675  bool merge(false);
1676  if (subdetOne == HcalEndcap && (std::find(phizOne.begin(),phizOne.end(),std::pair<int,int>(hid.iphi(),hid.zside())) != phizOne.end())) {
1677  merge = (std::find(mergedDepthsOne.begin(), mergedDepthsOne.end(), hid.depth())!=mergedDepthsOne.end());
1678  } else {
1679  merge = (std::find(mergedDepths.begin(), mergedDepths.end(), hid.depth())!=mergedDepths.end());
1680  }
1681  if (merge) {
1682  CaloTowerDetId twrId29(twrId.ieta()+twrId.zside(), twrId.iphi());
1683  hcalDropChMap[twrId29] +=1;
1684  }
1685  }
1686  }
1687 
1688  }
1689 }
Definition: merge.py:1
const HcalChannelQuality * theHcalChStatus
std::vector< std::pair< int, int > > phizOne
const Item * getValues(DetId fId, bool throwOnFail=true) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
HcalDetId mergedDepthDetId(const HcalDetId &id) const
Definition: HcalTopology.h:163
CaloTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
std::vector< DetId > getAllChannels() const
int iphi() const
get the tower iphi
bool dropChannel(const uint32_t &mystatus) const
const CaloTowerConstituentsMap * theTowerConstituentsMap
std::vector< int > mergedDepths
const HcalSeverityLevelComputer * theHcalSevLvlComputer
Definition: DetId.h:18
int zside() const
get the z-side of the tower (1/-1)
const HcalTopology * theHcalTopology
std::vector< int > mergedDepthsOne
int ieta() const
get the tower ieta
uint32_t getValue() const
int lastHERing() const
Definition: HcalTopology.h:90
def merge(dictlist, TELL=False)
Definition: MatrixUtil.py:191
void CaloTowersCreationAlgo::process ( const HBHERecHitCollection hbhe)

Definition at line 380 of file CaloTowersCreationAlgo.cc.

References assignHitHcal(), edm::SortedCollection< T, SORT >::begin(), and edm::SortedCollection< T, SORT >::end().

Referenced by ConfigBuilder.ConfigBuilder::addExtraStream(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), ConfigBuilder.ConfigBuilder::prepare(), ConfigBuilder.ConfigBuilder::prepare_ALCA(), ConfigBuilder.ConfigBuilder::prepare_DQM(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_PATFILTER(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), CaloTowersCreator::produce(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), ConfigBuilder.ConfigBuilder::scheduleSequence(), and setEcalChStatusFromDB().

380  {
381  for(HBHERecHitCollection::const_iterator hbheItr = hbhe.begin();
382  hbheItr != hbhe.end(); ++hbheItr)
383  assignHitHcal(&(*hbheItr));
384 }
void assignHitHcal(const CaloRecHit *recHit)
std::vector< HBHERecHit >::const_iterator const_iterator
const_iterator end() const
const_iterator begin() const
void CaloTowersCreationAlgo::process ( const HORecHitCollection ho)
void CaloTowersCreationAlgo::process ( const HFRecHitCollection hf)
void CaloTowersCreationAlgo::process ( const EcalRecHitCollection ecal)
void CaloTowersCreationAlgo::process ( const CaloTowerCollection ctc)
void CaloTowersCreationAlgo::rescale ( const CaloTower ct)
private

Definition at line 883 of file CaloTowersCreationAlgo.cc.

References CaloTower::constituent(), CaloTower::constituentsSize(), HcalDetId::depth(), DetId::det(), CaloTowersCreationAlgo::MetaTower::E, CaloTowersCreationAlgo::MetaTower::E_em, CaloTowersCreationAlgo::MetaTower::E_had, CaloTowersCreationAlgo::MetaTower::E_outer, DetId::Ecal, CaloTower::ecalTime(), CaloTower::emEnergy(), CaloTowersCreationAlgo::MetaTower::emSumEForTime, CaloTowersCreationAlgo::MetaTower::emSumTimeTimesE, find(), getThresholdAndWeight(), CaloTower::hadEnergy(), CaloTowersCreationAlgo::MetaTower::hadSumEForTime, CaloTowersCreationAlgo::MetaTower::hadSumTimeTimesE, HcalForward, HcalOuter, CaloTower::hcalTime(), mps_fire::i, CaloTower::id(), CaloTowersParam_cfi::mc, CaloTowersCreationAlgo::MetaTower::metaConstituents, DetId::null(), CaloTower::outerEnergy(), HcalDetId::subdet(), theTowerConstituentsMap, ctppsDiamondLocalTracks_cfi::threshold, CaloTowerConstituentsMap::towerOf(), and mps_merge::weight.

Referenced by process().

883  {
884  double threshold, weight;
885  CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(ct->id());
886  if (towerDetId.null()) return;
887  MetaTower & tower = find(towerDetId);
888 
889  tower.E_em = 0.;
890  tower.E_had = 0.;
891  tower.E_outer = 0.;
892  for (unsigned int i=0; i<ct->constituentsSize(); i++) {
893  DetId detId = ct->constituent(i);
894  getThresholdAndWeight(detId, threshold, weight);
895  DetId::Detector det = detId.det();
896  if(det == DetId::Ecal) {
897  tower.E_em = ct->emEnergy()*weight;
898  }
899  else {
900  HcalDetId hcalDetId(detId);
901  if(hcalDetId.subdet() == HcalForward) {
902  if (hcalDetId.depth()==1) tower.E_em = ct->emEnergy()*weight;
903  if (hcalDetId.depth()==2) tower.E_had = ct->hadEnergy()*weight;
904  }
905  else if(hcalDetId.subdet() == HcalOuter) {
906  tower.E_outer = ct->outerEnergy()*weight;
907  }
908  else {
909  tower.E_had = ct->hadEnergy()*weight;
910  }
911  }
912  tower.E = tower.E_had+tower.E_em+tower.E_outer;
913 
914  // this is to be compliant with the new MetaTower setup
915  // used only for the default simple vector assignment
916  std::pair<DetId, float> mc(detId, 0);
917  tower.metaConstituents.push_back(mc);
918  }
919 
920  // preserve time inforamtion
921  tower.emSumTimeTimesE = ct->ecalTime();
922  tower.hadSumTimeTimesE = ct->hcalTime();
923  tower.emSumEForTime = 1.0;
924  tower.hadSumEForTime = 1.0;
925 }
size_t constituentsSize() const
Definition: CaloTower.h:105
DetId constituent(size_t i) const
Definition: CaloTower.h:106
float ecalTime() const
Definition: CaloTower.h:181
MetaTower & find(const CaloTowerDetId &id)
looks for a given tower in the internal cache. If it can&#39;t find it, it makes it.
CaloTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
double emEnergy() const
Definition: CaloTower.h:110
const CaloTowerConstituentsMap * theTowerConstituentsMap
double hadEnergy() const
Definition: CaloTower.h:111
Definition: DetId.h:18
CaloTowerDetId id() const
Definition: CaloTower.h:103
float hcalTime() const
Definition: CaloTower.h:182
Detector
Definition: DetId.h:24
bool null() const
is this a null id ?
Definition: DetId.h:45
void getThresholdAndWeight(const DetId &detId, double &threshold, double &weight) const
helper method to look up the appropriate threshold & weight
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
double outerEnergy() const
Definition: CaloTower.h:112
void CaloTowersCreationAlgo::rescaleTowers ( const CaloTowerCollection ctInput,
CaloTowerCollection ctResult 
)

Definition at line 438 of file CaloTowersCreationAlgo.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::contains(), DetId::det(), DetId::Ecal, edm::SortedCollection< T, SORT >::end(), PV3DBase< T, PVType, FrameType >::eta(), CaloTowerTopology::firstHERing(), CaloTowerTopology::firstHFRing(), getThresholdAndWeight(), DetId::Hcal, HcalOuter, CaloTowerDetId::ietaAbs(), CaloTowerTopology::lastHBRing(), CaloTowerTopology::lastHERing(), CaloTowerTopology::lastHFRing(), CaloTowerTopology::lastHORing(), PV3DBase< T, PVType, FrameType >::phi(), edm::SortedCollection< T, SORT >::push_back(), HcalDetId::subdet(), theHF1weight, theHF2weight, theHOIsUsed, theTowerTopology, ctppsDiamondLocalTracks_cfi::threshold, and mps_merge::weight.

Referenced by CaloTowersReCreator::produce(), and setEcalChStatusFromDB().

438  {
439 
440  for (CaloTowerCollection::const_iterator ctcItr = ctc.begin();
441  ctcItr != ctc.end(); ++ctcItr) {
442 
443  CaloTowerDetId twrId = ctcItr->id();
444  double newE_em = ctcItr->emEnergy();
445  double newE_had = ctcItr->hadEnergy();
446  double newE_outer = ctcItr->outerEnergy();
447 
448  double threshold = 0.0; // not used: we do not change thresholds
449  double weight = 1.0;
450 
451  // HF
452  if (ctcItr->ietaAbs()>=theTowerTopology->firstHFRing()) {
453  double E_short = 0.5 * newE_had; // from the definitions for HF
454  double E_long = newE_em + 0.5 * newE_had; //
455  // scale
456  E_long *= theHF1weight;
457  E_short *= theHF2weight;
458  // convert
459  newE_em = E_long - E_short;
460  newE_had = 2.0 * E_short;
461  }
462 
463  else { // barrel/endcap
464 
465  // find if its in EB, or EE; determine from first ecal constituent found
466  for (unsigned int iConst = 0; iConst < ctcItr->constituentsSize(); ++iConst) {
467  DetId constId = ctcItr->constituent(iConst);
468  if (constId.det()!=DetId::Ecal) continue;
469  getThresholdAndWeight(constId, threshold, weight);
470  newE_em *= weight;
471  break;
472  }
473  // HO
474  for (unsigned int iConst = 0; iConst < ctcItr->constituentsSize(); ++iConst) {
475  DetId constId = ctcItr->constituent(iConst);
476  if (constId.det()!=DetId::Hcal) continue;
477  if (HcalDetId(constId).subdet()!=HcalOuter) continue;
478  getThresholdAndWeight(constId, threshold, weight);
479  newE_outer *= weight;
480  break;
481  }
482  // HB/HE
483  for (unsigned int iConst = 0; iConst < ctcItr->constituentsSize(); ++iConst) {
484  DetId constId = ctcItr->constituent(iConst);
485  if (constId.det()!=DetId::Hcal) continue;
486  if (HcalDetId(constId).subdet()==HcalOuter) continue;
487  getThresholdAndWeight(constId, threshold, weight);
488  newE_had *= weight;
489  if (ctcItr->ietaAbs()>theTowerTopology->firstHERing()) newE_outer *= weight;
490  break;
491  }
492 
493  } // barrel/endcap region
494 
495  // now make the new tower
496 
497  double newE_hadTot = (theHOIsUsed && twrId.ietaAbs()<=theTowerTopology->lastHORing())? newE_had+newE_outer : newE_had;
498 
499  GlobalPoint emPoint = ctcItr->emPosition();
500  GlobalPoint hadPoint = ctcItr->emPosition();
501 
502  double f_em = 1.0/cosh(emPoint.eta());
503  double f_had = 1.0/cosh(hadPoint.eta());
504 
506 
507  if (ctcItr->ietaAbs()<theTowerTopology->firstHFRing()) {
508  if (newE_em>0) towerP4 += CaloTower::PolarLorentzVector(newE_em*f_em, emPoint.eta(), emPoint.phi(), 0);
509  if (newE_hadTot>0) towerP4 += CaloTower::PolarLorentzVector(newE_hadTot*f_had, hadPoint.eta(), hadPoint.phi(), 0);
510  }
511  else {
512  double newE_tot = newE_em + newE_had;
513  // for HF we use common point for ecal, hcal shower positions regardless of the method
514  if (newE_tot>0) towerP4 += CaloTower::PolarLorentzVector(newE_tot*f_had, hadPoint.eta(), hadPoint.phi(), 0);
515  }
516 
517 
518 
519  CaloTower rescaledTower(twrId, newE_em, newE_had, newE_outer, -1, -1, towerP4, emPoint, hadPoint);
520  // copy the timings, have to convert back to int, 1 unit = 0.01 ns
521  rescaledTower.setEcalTime( int(ctcItr->ecalTime()*100.0 + 0.5) );
522  rescaledTower.setHcalTime( int(ctcItr->hcalTime()*100.0 + 0.5) );
523  //add topology info
524  rescaledTower.setHcalSubdet(theTowerTopology->lastHBRing(),
528 
529  std::vector<DetId> contains;
530  for (unsigned int iConst = 0; iConst < ctcItr->constituentsSize(); ++iConst) {
531  contains.push_back(ctcItr->constituent(iConst));
532  }
533  rescaledTower.addConstituents(contains);
534 
535  rescaledTower.setCaloTowerStatus(ctcItr->towerStatusWord());
536 
537  ctcResult.push_back(rescaledTower);
538 
539  } // end of loop over towers
540 
541 
542 }
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:38
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
int ietaAbs() const
get the absolute value of the tower ieta
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: LeafCandidate.h:25
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
std::vector< CaloTower >::const_iterator const_iterator
Definition: weight.py:1
int firstHERing() const
int lastHFRing() const
const CaloTowerTopology * theTowerTopology
bool theHOIsUsed
only affects energy and ET calculation. HO is still recorded in the tower
Definition: DetId.h:18
void getThresholdAndWeight(const DetId &detId, double &threshold, double &weight) const
helper method to look up the appropriate threshold & weight
T eta() const
Definition: PV3DBase.h:76
int lastHERing() const
int lastHORing() const
int lastHBRing() const
int firstHFRing() const
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:39
void CaloTowersCreationAlgo::setEBEScale ( double  scale)

Definition at line 1354 of file CaloTowersCreationAlgo.cc.

References Scenarios_cff::scale, and theEBEScale.

Referenced by CaloTowersReCreator::produce(), CaloTowersCreator::produce(), and setEcalChStatusFromDB().

1354  {
1355  if (scale>0.00001) *&theEBEScale = scale;
1356  else *&theEBEScale = 50.;
1357 }
void CaloTowersCreationAlgo::setEbHandle ( const edm::Handle< EcalRecHitCollection eb)
inline

Definition at line 192 of file CaloTowersCreationAlgo.h.

References theEbHandle.

Referenced by CaloTowersCreator::produce().

192 { theEbHandle = eb; }
edm::Handle< EcalRecHitCollection > theEbHandle
void CaloTowersCreationAlgo::setEcalChStatusFromDB ( const EcalChannelStatus s)
inline
void CaloTowersCreationAlgo::setEcalSeveritiesToBeExcluded ( const std::vector< int > &  ecalSev)
inline

Definition at line 159 of file CaloTowersCreationAlgo.h.

References theEcalSeveritiesToBeExcluded.

Referenced by CaloTowersCreator::produce().

std::vector< int > theEcalSeveritiesToBeExcluded
void CaloTowersCreationAlgo::SetEcalSeveritiesToBeUsedInBadTowers ( const std::vector< int > &  ecalSev)
inline

Definition at line 180 of file CaloTowersCreationAlgo.h.

References theEcalSeveritiesToBeUsedInBadTowers.

Referenced by CaloTowersCreator::produce().

std::vector< int > theEcalSeveritiesToBeUsedInBadTowers
void CaloTowersCreationAlgo::setEcalSevLvlAlgo ( const EcalSeverityLevelAlgo a)
inline

Definition at line 169 of file CaloTowersCreationAlgo.h.

References a, and theEcalSevLvlAlgo.

Referenced by CaloTowersCreator::produce().

169 { theEcalSevLvlAlgo = a; }
const EcalSeverityLevelAlgo * theEcalSevLvlAlgo
double a
Definition: hdecay.h:121
void CaloTowersCreationAlgo::setEEEScale ( double  scale)

Definition at line 1359 of file CaloTowersCreationAlgo.cc.

References Scenarios_cff::scale, and theEEEScale.

Referenced by CaloTowersReCreator::produce(), CaloTowersCreator::produce(), and setEcalChStatusFromDB().

1359  {
1360  if (scale>0.00001) *&theEEEScale = scale;
1361  else *&theEEEScale = 50.;
1362 }
void CaloTowersCreationAlgo::setEeHandle ( const edm::Handle< EcalRecHitCollection ee)
inline
void CaloTowersCreationAlgo::setGeometry ( const CaloTowerTopology cttopo,
const CaloTowerConstituentsMap ctmap,
const HcalTopology htopo,
const CaloGeometry geo 
)

Definition at line 305 of file CaloTowersCreationAlgo.cc.

References DetId::Calo, gather_cfg::cout, HcalTopology::depthBinInformation(), ecalBadChs, plotBeamSpotDB::first, HcalTopology::getDepthSegmentation(), HcalTopology::getPhiZOne(), CaloGeometry::getSubdetectorGeometry(), HcalEndcap, mps_fire::i, gen::k, HcalTopology::lastHERing(), mergedDepths, mergedDepthsOne, min(), phizOne, edm::second(), CaloTowerTopology::sizeForDenseIndexing(), CaloTowerDetId::SubdetId, subdetOne, theGeometry, theHcalPhase, theHcalTopology, theTowerConstituentsMap, theTowerGeometry, theTowerTopology, and HcalDigiParam_cfi::zside.

Referenced by CaloTowersReCreator::produce(), and CaloTowersCreator::produce().

305  {
306  theTowerTopology = cttopo;
307  theTowerConstituentsMap = ctmap;
308  theHcalTopology = htopo;
309  theGeometry = geo;
311 
312  //initialize ecal bad channel map
314 
315  //store some specific geom info
316 
317  //which depths of tower 28/29 are merged?
318  //the merging starts at layer 5 in phase 0 or phase 1 configurations
319  mergedDepths.clear(); mergedDepthsOne.clear();
320  if(theHcalPhase==0 || theHcalPhase==1){
321  std::vector<int> tower28depths;
322  int ndepths, startdepth;
324  int zside = (subdetOne > 0) ? -phizOne[0].second : 1;
325  int iphi = (subdetOne > 0) ? phizOne[0].first : 1;
328 
329  //keep track of which depths are merged
330  //layer 5 = index 6 (layers start at -1)
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;
334  }
335 
336  //store true merged depths
337  for(int i = 0; i < ndepths; i++){
338  if(isMergedDepth[i]) mergedDepths.push_back(i+startdepth);
339  }
340 
341  //Now for the one RBX
342  if (subdetOne > 0) {
343  zside = phizOne[0].second;
344  std::vector<int> tower28depthsOne;
345  theHcalTopology->getDepthSegmentation(theHcalTopology->lastHERing()-1,tower28depthsOne,true);
347 
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;
351  }
352 
353  for(int i = 0; i < ndepths; i++){
354  if(isMergedDepthOne[i]) mergedDepthsOne.push_back(i+startdepth);
355  }
356  }
357  }
358 #ifdef EDM_ML_DEBUG
359  std::cout << "mergedDepths with " << mergedDepths.size() << " entries:";
360  for (unsigned int k=0; k<mergedDepths.size(); ++k)
361  std::cout << " " << k << ":" << mergedDepths[k];
362  std::cout << std::endl << "Special subdetector " << subdetOne << " with "
363  << phizOne.size() << " phis" << std::endl;
364  for (unsigned int k=0; k<phizOne.size(); ++k)
365  std::cout << "PhiZOne[" << k << "] " << phizOne[k].first << ":"
366  << phizOne[k].second << std::endl;
367  std::cout << "mergedDeptshOne with " << mergedDepthsOne.size() <<" entries:";
368  for (unsigned int k=0; k<mergedDepthsOne.size(); ++k)
369  std::cout << " " << k << ":" << mergedDepthsOne[k];
370  std::cout << std::endl;
371 #endif
372 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
void getDepthSegmentation(const unsigned ring, std::vector< int > &readoutDepths, const bool flag=false) const
std::vector< std::pair< int, int > > phizOne
int getPhiZOne(std::vector< std::pair< int, int > > &phiz) const
Definition: HcalTopology.h:130
U second(std::pair< T, U > const &p)
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
static const int SubdetId
const CaloGeometry * theGeometry
const CaloTowerConstituentsMap * theTowerConstituentsMap
const CaloTowerTopology * theTowerTopology
T min(T a, T b)
Definition: MathUtil.h:58
std::vector< int > mergedDepths
int k[5][pyjets_maxn]
const HcalTopology * theHcalTopology
std::vector< int > mergedDepthsOne
std::vector< unsigned short > ecalBadChs
uint32_t sizeForDenseIndexing() const
int lastHERing() const
Definition: HcalTopology.h:90
void CaloTowersCreationAlgo::setHBEScale ( double  scale)

Definition at line 1364 of file CaloTowersCreationAlgo.cc.

References Scenarios_cff::scale, and theHBEScale.

Referenced by CaloTowersReCreator::produce(), CaloTowersCreator::produce(), and setEcalChStatusFromDB().

1364  {
1365  if (scale>0.00001) *&theHBEScale = scale;
1366  else *&theHBEScale = 50.;
1367 }
void CaloTowersCreationAlgo::setHcalAcceptSeverityLevel ( unsigned int  level)
inline
void CaloTowersCreationAlgo::setHcalAcceptSeverityLevelForRejectedHit ( unsigned int  level)
inline
void CaloTowersCreationAlgo::setHcalChStatusFromDB ( const HcalChannelQuality s)
inline

Definition at line 114 of file CaloTowersCreationAlgo.h.

References alignCSCRings::s, and theHcalChStatus.

Referenced by CaloTowersCreator::produce().

114 { theHcalChStatus = s; }
const HcalChannelQuality * theHcalChStatus
void CaloTowersCreationAlgo::setHcalSevLvlComputer ( const HcalSeverityLevelComputer c)
inline

Definition at line 166 of file CaloTowersCreationAlgo.h.

References EnergyCorrector::c, and theHcalSevLvlComputer.

Referenced by CaloTowersCreator::produce().

const HcalSeverityLevelComputer * theHcalSevLvlComputer
void CaloTowersCreationAlgo::setHEDEScale ( double  scale)

Definition at line 1374 of file CaloTowersCreationAlgo.cc.

References Scenarios_cff::scale, and theHEDEScale.

Referenced by CaloTowersReCreator::produce(), CaloTowersCreator::produce(), and setEcalChStatusFromDB().

1374  {
1375  if (scale>0.00001) *&theHEDEScale = scale;
1376  else *&theHEDEScale = 50.;
1377 }
void CaloTowersCreationAlgo::setHESEScale ( double  scale)

Definition at line 1369 of file CaloTowersCreationAlgo.cc.

References Scenarios_cff::scale, and theHESEScale.

Referenced by CaloTowersReCreator::produce(), CaloTowersCreator::produce(), and setEcalChStatusFromDB().

1369  {
1370  if (scale>0.00001) *&theHESEScale = scale;
1371  else *&theHESEScale = 50.;
1372 }
void CaloTowersCreationAlgo::setHF1EScale ( double  scale)

Definition at line 1384 of file CaloTowersCreationAlgo.cc.

References Scenarios_cff::scale, and theHF1EScale.

Referenced by CaloTowersReCreator::produce(), CaloTowersCreator::produce(), and setEcalChStatusFromDB().

1384  {
1385  if (scale>0.00001) *&theHF1EScale = scale;
1386  else *&theHF1EScale = 50.;
1387 }
void CaloTowersCreationAlgo::setHF2EScale ( double  scale)

Definition at line 1389 of file CaloTowersCreationAlgo.cc.

References Scenarios_cff::scale, and theHF2EScale.

Referenced by CaloTowersReCreator::produce(), CaloTowersCreator::produce(), and setEcalChStatusFromDB().

1389  {
1390  if (scale>0.00001) *&theHF2EScale = scale;
1391  else *&theHF2EScale = 50.;
1392 }
void CaloTowersCreationAlgo::setHOEScale ( double  scale)

Definition at line 1379 of file CaloTowersCreationAlgo.cc.

References Scenarios_cff::scale, and theHOEScale.

Referenced by CaloTowersReCreator::produce(), CaloTowersCreator::produce(), and setEcalChStatusFromDB().

1379  {
1380  if (scale>0.00001) *&theHOEScale = scale;
1381  else *&theHOEScale = 50.;
1382 }
void CaloTowersCreationAlgo::setRecoveredEcalHitsAreUsed ( bool  flag)
inline
void CaloTowersCreationAlgo::setRecoveredHcalHitsAreUsed ( bool  flag)
inline
void CaloTowersCreationAlgo::setUseRejectedHitsOnly ( bool  flag)
inline
void CaloTowersCreationAlgo::setUseRejectedRecoveredEcalHits ( bool  flag)
inline
void CaloTowersCreationAlgo::setUseRejectedRecoveredHcalHits ( bool  flag)
inline

Member Data Documentation

std::vector<unsigned short> CaloTowersCreationAlgo::ecalBadChs
private

Definition at line 342 of file CaloTowersCreationAlgo.h.

Referenced by convert(), makeEcalBadChs(), and setGeometry().

HcalDropChMap CaloTowersCreationAlgo::hcalDropChMap
private

Definition at line 338 of file CaloTowersCreationAlgo.h.

Referenced by convert(), and makeHcalDropChMap().

std::vector<HcalDetId> CaloTowersCreationAlgo::ids_
private

Definition at line 363 of file CaloTowersCreationAlgo.h.

std::vector<int> CaloTowersCreationAlgo::mergedDepths
private

Definition at line 358 of file CaloTowersCreationAlgo.h.

Referenced by assignHitHcal(), makeHcalDropChMap(), and setGeometry().

std::vector<int> CaloTowersCreationAlgo::mergedDepthsOne
private

Definition at line 358 of file CaloTowersCreationAlgo.h.

Referenced by assignHitHcal(), makeHcalDropChMap(), and setGeometry().

int CaloTowersCreationAlgo::nalgo =-1

Definition at line 52 of file CaloTowersCreationAlgo.h.

std::vector<std::pair<int,int> > CaloTowersCreationAlgo::phizOne
private

Definition at line 361 of file CaloTowersCreationAlgo.h.

Referenced by assignHitHcal(), makeHcalDropChMap(), and setGeometry().

int CaloTowersCreationAlgo::subdetOne
private

Definition at line 360 of file CaloTowersCreationAlgo.h.

Referenced by assignHitHcal(), makeHcalDropChMap(), and setGeometry().

double CaloTowersCreationAlgo::theEBEScale
private

Definition at line 268 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight(), and setEBEScale().

std::vector<double> CaloTowersCreationAlgo::theEBGrid
private

Definition at line 256 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

edm::Handle<EcalRecHitCollection> CaloTowersCreationAlgo::theEbHandle
private

Definition at line 352 of file CaloTowersCreationAlgo.h.

Referenced by setEbHandle().

double CaloTowersCreationAlgo::theEBSumThreshold
private

Definition at line 266 of file CaloTowersCreationAlgo.h.

Referenced by convert().

double CaloTowersCreationAlgo::theEBthreshold
private

Definition at line 246 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theEBweight
private

Definition at line 264 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

std::vector<double> CaloTowersCreationAlgo::theEBWeights
private

Definition at line 256 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

const EcalChannelStatus* CaloTowersCreationAlgo::theEcalChStatus
private

Definition at line 283 of file CaloTowersCreationAlgo.h.

Referenced by setEcalChStatusFromDB().

std::vector<int> CaloTowersCreationAlgo::theEcalSeveritiesToBeExcluded
private
std::vector<int> CaloTowersCreationAlgo::theEcalSeveritiesToBeUsedInBadTowers
private
const EcalSeverityLevelAlgo* CaloTowersCreationAlgo::theEcalSevLvlAlgo
private
double CaloTowersCreationAlgo::theEcutTower
private

Definition at line 266 of file CaloTowersCreationAlgo.h.

Referenced by convert().

double CaloTowersCreationAlgo::theEEEScale
private

Definition at line 269 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight(), and setEEEScale().

std::vector<double> CaloTowersCreationAlgo::theEEGrid
private

Definition at line 257 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

edm::Handle<EcalRecHitCollection> CaloTowersCreationAlgo::theEeHandle
private

Definition at line 353 of file CaloTowersCreationAlgo.h.

Referenced by setEeHandle().

double CaloTowersCreationAlgo::theEESumThreshold
private

Definition at line 266 of file CaloTowersCreationAlgo.h.

Referenced by convert().

double CaloTowersCreationAlgo::theEEthreshold
private

Definition at line 246 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theEEweight
private

Definition at line 264 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

std::vector<double> CaloTowersCreationAlgo::theEEWeights
private

Definition at line 257 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

const CaloGeometry* CaloTowersCreationAlgo::theGeometry
private
double CaloTowersCreationAlgo::theHBEScale
private

Definition at line 270 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight(), and setHBEScale().

std::vector<double> CaloTowersCreationAlgo::theHBGrid
private

Definition at line 258 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHBthreshold
private

Definition at line 253 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHBweight
private

Definition at line 265 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

std::vector<double> CaloTowersCreationAlgo::theHBWeights
private

Definition at line 258 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

unsigned int CaloTowersCreationAlgo::theHcalAcceptSeverityLevel
private
unsigned int CaloTowersCreationAlgo::theHcalAcceptSeverityLevelForRejectedHit
private
const HcalChannelQuality* CaloTowersCreationAlgo::theHcalChStatus
private
int CaloTowersCreationAlgo::theHcalPhase
private
const HcalSeverityLevelComputer* CaloTowersCreationAlgo::theHcalSevLvlComputer
private
double CaloTowersCreationAlgo::theHcalThreshold
private

Definition at line 251 of file CaloTowersCreationAlgo.h.

Referenced by convert().

const HcalTopology* CaloTowersCreationAlgo::theHcalTopology
private
double CaloTowersCreationAlgo::theHEDEScale
private

Definition at line 272 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight(), and setHEDEScale().

std::vector<double> CaloTowersCreationAlgo::theHEDGrid
private

Definition at line 260 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHEDthreshold
private

Definition at line 253 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHEDweight
private

Definition at line 265 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

std::vector<double> CaloTowersCreationAlgo::theHEDWeights
private

Definition at line 260 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHESEScale
private

Definition at line 271 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight(), and setHESEScale().

std::vector<double> CaloTowersCreationAlgo::theHESGrid
private

Definition at line 259 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHESthreshold
private

Definition at line 253 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHESweight
private

Definition at line 265 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

std::vector<double> CaloTowersCreationAlgo::theHESWeights
private

Definition at line 259 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHF1EScale
private

Definition at line 274 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight(), and setHF1EScale().

std::vector<double> CaloTowersCreationAlgo::theHF1Grid
private

Definition at line 262 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHF1threshold
private

Definition at line 255 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHF1weight
private

Definition at line 265 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight(), and rescaleTowers().

std::vector<double> CaloTowersCreationAlgo::theHF1Weights
private

Definition at line 262 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHF2EScale
private

Definition at line 275 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight(), and setHF2EScale().

std::vector<double> CaloTowersCreationAlgo::theHF2Grid
private

Definition at line 263 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHF2threshold
private

Definition at line 255 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHF2weight
private

Definition at line 265 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight(), and rescaleTowers().

std::vector<double> CaloTowersCreationAlgo::theHF2Weights
private

Definition at line 263 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHOEScale
private

Definition at line 273 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight(), and setHOEScale().

std::vector<double> CaloTowersCreationAlgo::theHOGrid
private

Definition at line 261 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

bool CaloTowersCreationAlgo::theHOIsUsed
private

only affects energy and ET calculation. HO is still recorded in the tower

Definition at line 314 of file CaloTowersCreationAlgo.h.

Referenced by assignHitHcal(), convert(), and rescaleTowers().

double CaloTowersCreationAlgo::theHOthreshold0
private

Definition at line 254 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHOthresholdMinus1
private

Definition at line 254 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHOthresholdMinus2
private

Definition at line 255 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHOthresholdPlus1
private

Definition at line 254 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHOthresholdPlus2
private

Definition at line 255 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHOweight
private

Definition at line 265 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

std::vector<double> CaloTowersCreationAlgo::theHOWeights
private

Definition at line 261 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

int CaloTowersCreationAlgo::theMomConstrMethod
private

Definition at line 318 of file CaloTowersCreationAlgo.h.

Referenced by convert().

double CaloTowersCreationAlgo::theMomEBDepth
private

Definition at line 321 of file CaloTowersCreationAlgo.h.

Referenced by convert().

double CaloTowersCreationAlgo::theMomEEDepth
private

Definition at line 322 of file CaloTowersCreationAlgo.h.

Referenced by convert().

double CaloTowersCreationAlgo::theMomHBDepth
private

Definition at line 319 of file CaloTowersCreationAlgo.h.

Referenced by convert().

double CaloTowersCreationAlgo::theMomHEDepth
private

Definition at line 320 of file CaloTowersCreationAlgo.h.

Referenced by convert().

bool CaloTowersCreationAlgo::theRecoveredEcalHitsAreUsed
private
bool CaloTowersCreationAlgo::theRecoveredHcalHitsAreUsed
private
const CaloTowerConstituentsMap* CaloTowersCreationAlgo::theTowerConstituentsMap
private
const CaloSubdetectorGeometry* CaloTowersCreationAlgo::theTowerGeometry
private

Definition at line 280 of file CaloTowersCreationAlgo.h.

Referenced by convert(), and setGeometry().

MetaTowerMap CaloTowersCreationAlgo::theTowerMap
private

Definition at line 332 of file CaloTowersCreationAlgo.h.

Referenced by begin(), find(), and finish().

unsigned int CaloTowersCreationAlgo::theTowerMapSize =0
private

Definition at line 333 of file CaloTowersCreationAlgo.h.

Referenced by begin(), find(), and finish().

const CaloTowerTopology* CaloTowersCreationAlgo::theTowerTopology
private
bool CaloTowersCreationAlgo::theUseEtEBTresholdFlag
private

Definition at line 247 of file CaloTowersCreationAlgo.h.

Referenced by assignHitEcal().

bool CaloTowersCreationAlgo::theUseEtEETresholdFlag
private

Definition at line 247 of file CaloTowersCreationAlgo.h.

Referenced by assignHitEcal().

bool CaloTowersCreationAlgo::theUseSymEBTresholdFlag
private

Definition at line 248 of file CaloTowersCreationAlgo.h.

Referenced by assignHitEcal().

bool CaloTowersCreationAlgo::theUseSymEETresholdFlag
private

Definition at line 248 of file CaloTowersCreationAlgo.h.

Referenced by assignHitEcal().

bool CaloTowersCreationAlgo::useRejectedHitsOnly
private
unsigned int CaloTowersCreationAlgo::useRejectedRecoveredEcalHits
private
unsigned int CaloTowersCreationAlgo::useRejectedRecoveredHcalHits
private