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 HBthreshold1, double HBthreshold2, double HESthreshold, double HESthreshold1, double HEDthreshold, double HEDthreshold1, 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 HBthreshold1, double HBthreshold2, double HESthreshold, double HESthreshold1, double HEDthreshold, double HEDthreshold1, 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 setMissingHcalRescaleFactorForEcal (float factor)
 
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, std::pair< short int, bool > > 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_
 
float missingHcalRescaleFactorForEcal
 
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 theHBthreshold1
 
double theHBthreshold2
 
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 theHEDthreshold1
 
double theHEDweight
 
std::vector< double > theHEDWeights
 
double theHESEScale
 
std::vector< double > theHESGrid
 
double theHESthreshold
 
double theHESthreshold1
 
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, std::pair<short int,bool> > CaloTowersCreationAlgo::HcalDropChMap
private

Definition at line 346 of file CaloTowersCreationAlgo.h.

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

Definition at line 340 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  theHBthreshold1(-1000.),
27  theHBthreshold2(-1000.),
28  theHESthreshold(-1000.),
29  theHESthreshold1(-1000.),
30  theHEDthreshold(-1000.),
31  theHEDthreshold1(-1000.),
32  theHOthreshold0(-1000.),
33  theHOthresholdPlus1(-1000.),
34  theHOthresholdMinus1(-1000.),
35  theHOthresholdPlus2(-1000.),
36  theHOthresholdMinus2(-1000.),
37  theHF1threshold(-1000.),
38  theHF2threshold(-1000.),
39  theEBGrid(std::vector<double>(5,10.)),
40  theEBWeights(std::vector<double>(5,1.)),
41  theEEGrid(std::vector<double>(5,10.)),
42  theEEWeights(std::vector<double>(5,1.)),
43  theHBGrid(std::vector<double>(5,10.)),
44  theHBWeights(std::vector<double>(5,1.)),
45  theHESGrid(std::vector<double>(5,10.)),
46  theHESWeights(std::vector<double>(5,1.)),
47  theHEDGrid(std::vector<double>(5,10.)),
48  theHEDWeights(std::vector<double>(5,1.)),
49  theHOGrid(std::vector<double>(5,10.)),
50  theHOWeights(std::vector<double>(5,1.)),
51  theHF1Grid(std::vector<double>(5,10.)),
52  theHF1Weights(std::vector<double>(5,1.)),
53  theHF2Grid(std::vector<double>(5,10.)),
54  theHF2Weights(std::vector<double>(5,1.)),
55  theEBweight(1.),
56  theEEweight(1.),
57  theHBweight(1.),
58  theHESweight(1.),
59  theHEDweight(1.),
60  theHOweight(1.),
61  theHF1weight(1.),
62  theHF2weight(1.),
63  theEcutTower(-1000.),
64  theEBSumThreshold(-1000.),
65  theEESumThreshold(-1000.),
66  theEBEScale(50.),
67  theEEEScale(50.),
68  theHBEScale(50.),
69  theHESEScale(50.),
70  theHEDEScale(50.),
71  theHOEScale(50.),
72  theHF1EScale(50.),
73  theHF2EScale(50.),
74  theHcalTopology(nullptr),
75  theGeometry(nullptr),
76  theTowerConstituentsMap(nullptr),
80  useRejectedHitsOnly(false),
85  theHOIsUsed(true),
86  // (for momentum reconstruction algorithm)
88  theMomHBDepth(0.),
89  theMomHEDepth(0.),
90  theMomEBDepth(0.),
91  theMomEEDepth(0.),
92  theHcalPhase(0)
93 {
94 }
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  HBthreshold1,
double  HBthreshold2,
double  HESthreshold,
double  HESthreshold1,
double  HEDthreshold,
double  HEDthreshold1,
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 96 of file CaloTowersCreationAlgo.cc.

123  : theEBthreshold(EBthreshold),
124  theEEthreshold(EEthreshold),
125 
126  theUseEtEBTresholdFlag(useEtEBTreshold),
127  theUseEtEETresholdFlag(useEtEETreshold),
128  theUseSymEBTresholdFlag(useSymEBTreshold),
129  theUseSymEETresholdFlag(useSymEETreshold),
130 
132  theHBthreshold(HBthreshold),
133  theHBthreshold1(HBthreshold1),
134  theHBthreshold2(HBthreshold2),
135  theHESthreshold(HESthreshold),
136  theHESthreshold1(HESthreshold1),
137  theHEDthreshold(HEDthreshold),
138  theHEDthreshold1(HEDthreshold1),
139  theHOthreshold0(HOthreshold0),
140  theHOthresholdPlus1(HOthresholdPlus1),
141  theHOthresholdMinus1(HOthresholdMinus1),
142  theHOthresholdPlus2(HOthresholdPlus2),
143  theHOthresholdMinus2(HOthresholdMinus2),
144  theHF1threshold(HF1threshold),
145  theHF2threshold(HF2threshold),
146  theEBGrid(std::vector<double>(5,10.)),
147  theEBWeights(std::vector<double>(5,1.)),
148  theEEGrid(std::vector<double>(5,10.)),
149  theEEWeights(std::vector<double>(5,1.)),
150  theHBGrid(std::vector<double>(5,10.)),
151  theHBWeights(std::vector<double>(5,1.)),
152  theHESGrid(std::vector<double>(5,10.)),
153  theHESWeights(std::vector<double>(5,1.)),
154  theHEDGrid(std::vector<double>(5,10.)),
155  theHEDWeights(std::vector<double>(5,1.)),
156  theHOGrid(std::vector<double>(5,10.)),
157  theHOWeights(std::vector<double>(5,1.)),
158  theHF1Grid(std::vector<double>(5,10.)),
159  theHF1Weights(std::vector<double>(5,1.)),
160  theHF2Grid(std::vector<double>(5,10.)),
161  theHF2Weights(std::vector<double>(5,1.)),
162  theEBweight(EBweight),
163  theEEweight(EEweight),
164  theHBweight(HBweight),
165  theHESweight(HESweight),
166  theHEDweight(HEDweight),
167  theHOweight(HOweight),
168  theHF1weight(HF1weight),
169  theHF2weight(HF2weight),
173  theEBEScale(50.),
174  theEEEScale(50.),
175  theHBEScale(50.),
176  theHESEScale(50.),
177  theHEDEScale(50.),
178  theHOEScale(50.),
179  theHF1EScale(50.),
180  theHF2EScale(50.),
181  theHcalTopology(nullptr),
182  theGeometry(nullptr),
183  theTowerConstituentsMap(nullptr),
187  useRejectedHitsOnly(false),
193  // (momentum reconstruction algorithm)
194  theMomConstrMethod(momConstrMethod),
195  theMomHBDepth(momHBDepth),
196  theMomHEDepth(momHEDepth),
197  theMomEBDepth(momEBDepth),
198  theMomEEDepth(momEEDepth),
199  theHcalPhase(hcalPhase)
200 {
201 }
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  HBthreshold1,
double  HBthreshold2,
double  HESthreshold,
double  HESthreshold1,
double  HEDthreshold,
double  HEDthreshold1,
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 203 of file CaloTowersCreationAlgo.cc.

237  : theEBthreshold(EBthreshold),
238  theEEthreshold(EEthreshold),
239 
240  theUseEtEBTresholdFlag(useEtEBTreshold),
241  theUseEtEETresholdFlag(useEtEETreshold),
242  theUseSymEBTresholdFlag(useSymEBTreshold),
243  theUseSymEETresholdFlag(useSymEETreshold),
244 
246  theHBthreshold(HBthreshold),
247  theHBthreshold1(HBthreshold1),
248  theHBthreshold2(HBthreshold2),
249  theHESthreshold(HESthreshold),
250  theHESthreshold1(HESthreshold1),
251  theHEDthreshold(HEDthreshold),
252  theHEDthreshold1(HEDthreshold1),
253  theHOthreshold0(HOthreshold0),
254  theHOthresholdPlus1(HOthresholdPlus1),
255  theHOthresholdMinus1(HOthresholdMinus1),
256  theHOthresholdPlus2(HOthresholdPlus2),
257  theHOthresholdMinus2(HOthresholdMinus2),
258  theHF1threshold(HF1threshold),
259  theHF2threshold(HF2threshold),
260  theEBGrid(EBGrid),
262  theEEGrid(EEGrid),
264  theHBGrid(HBGrid),
270  theHOGrid(HOGrid),
276  theEBweight(EBweight),
277  theEEweight(EEweight),
278  theHBweight(HBweight),
279  theHESweight(HESweight),
280  theHEDweight(HEDweight),
281  theHOweight(HOweight),
282  theHF1weight(HF1weight),
283  theHF2weight(HF2weight),
287  theEBEScale(50.),
288  theEEEScale(50.),
289  theHBEScale(50.),
290  theHESEScale(50.),
291  theHEDEScale(50.),
292  theHOEScale(50.),
293  theHF1EScale(50.),
294  theHF2EScale(50.),
295  theHcalTopology(nullptr),
296  theGeometry(nullptr),
297  theTowerConstituentsMap(nullptr),
301  useRejectedHitsOnly(false),
307  // (momentum reconstruction algorithm)
308  theMomConstrMethod(momConstrMethod),
309  theMomHBDepth(momHBDepth),
310  theMomHEDepth(momHEDepth),
311  theMomEBDepth(momEBDepth),
312  theMomEEDepth(momEEDepth),
313  theHcalPhase(hcalPhase)
314 {
315  // static int N = 0;
316  // std::cout << "VI Algo " << ++N << std::endl;
317  // nalgo=N;
318 }
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 746 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(), PVValHelper::eta, spr::find(), find(), CaloGeometry::getGeometry(), 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, electronIdCutBased_cfi::threshold, EcalRecHit::time(), CaloTowerConstituentsMap::towerOf(), and mps_merge::weight.

Referenced by process().

746  {
747  DetId detId = recHit->detid();
748 
749  unsigned int chStatusForCT;
750  bool ecalIsBad=false;
751  std::tie(chStatusForCT,ecalIsBad) = ecalChanStatusForCaloTower(recHit);
752 
753  // this is for skipping channls: mostly needed for the creation of
754  // bad towers from hits i the bad channel collections.
755  if (chStatusForCT==CaloTowersCreationAlgo::IgnoredChan) return;
756 
757  double threshold, weight;
758  getThresholdAndWeight(detId, threshold, weight);
759 
760  double energy = recHit->energy(); // original RecHit energy is used to apply thresholds
761  double e = energy * weight; // energies scaled by user weight: used in energy assignments
762 
764 
765  // For ECAL we count all bad channels after the metatower is complete
766 
767  // Include options for symmetric thresholds and cut on Et
768  // for ECAL RecHits
769 
770  bool passEmThreshold = false;
771 
772  if (detId.subdetId() == EcalBarrel) {
773  if (theUseEtEBTresholdFlag) energy /= cosh( (theGeometry->getGeometry(detId)->getPosition()).eta() ) ;
774  if (theUseSymEBTresholdFlag) passEmThreshold = (fabs(energy) >= threshold);
775  else passEmThreshold = (energy >= threshold);
776 
777  }
778  else if (detId.subdetId() == EcalEndcap) {
779  if (theUseEtEETresholdFlag) energy /= cosh( (theGeometry->getGeometry(detId)->getPosition()).eta() ) ;
780  if (theUseSymEETresholdFlag) passEmThreshold = (fabs(energy) >= threshold);
781  else passEmThreshold = (energy >= threshold);
782  }
783 
784  CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(detId);
785  if (towerDetId.null()) return;
786  MetaTower & tower = find(towerDetId);
787 
788 
789  // count bad cells and avoid double counting with those from DB (Recovered are counted bad)
790 
791  // somehow misses some
792  // if ( (chStatusForCT == CaloTowersCreationAlgo::BadChan) & (!ecalIsBad) ) ++tower.numBadEcalCells;
793 
794  // a bit slower...
795  if ( chStatusForCT == CaloTowersCreationAlgo::BadChan ) {
796  auto thisEcalSevLvl = theEcalSevLvlAlgo->severityLevel(detId);
797  // check if the Ecal severity is ok to keep
798  auto sevit = std::find(theEcalSeveritiesToBeExcluded.begin(),
800  thisEcalSevLvl);
801  if (sevit==theEcalSeveritiesToBeExcluded.end()) ++tower.numBadEcalCells; // notinDB
802  }
803 
804 
805  // if (chStatusForCT != CaloTowersCreationAlgo::BadChan && energy >= threshold) {
806  if (chStatusForCT != CaloTowersCreationAlgo::BadChan && passEmThreshold) {
807 
808  tower.E_em += e;
809  tower.E += e;
810 
811  if (chStatusForCT == CaloTowersCreationAlgo::RecoveredChan) {
812  tower.numRecEcalCells += 1;
813  }
814  else if (chStatusForCT == CaloTowersCreationAlgo::ProblematicChan) {
815  tower.numProbEcalCells += 1;
816  }
817 
818  // change when full status info is available
819  // for now use only good channels
820 
821  // add e>0 check (new options allow e<0)
822  if (chStatusForCT == CaloTowersCreationAlgo::GoodChan && e>0 ) {
823  tower.emSumTimeTimesE += ( e * recHit->time() );
824  tower.emSumEForTime += e; // see above
825  }
826 
827  std::pair<DetId,float> mc(detId,e);
828  tower.metaConstituents.push_back(mc);
829  }
830 } // end of assignHitEcal method
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
constexpr bool null() const
is this a null id ?
Definition: DetId.h:49
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
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
float energy() const
Definition: EcalRecHit.h:68
const CaloTowerConstituentsMap * theTowerConstituentsMap
Definition: DetId.h:18
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
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:85
std::tuple< unsigned int, bool > ecalChanStatusForCaloTower(const EcalRecHit *hit)
void CaloTowersCreationAlgo::assignHitHcal ( const CaloRecHit recHit)
private

Definition at line 503 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(), find(), HcalTopology::getMergePositionFlag(), getThresholdAndWeight(), GoodChan, CaloTowersCreationAlgo::MetaTower::hadSumEForTime, CaloTowersCreationAlgo::MetaTower::hadSumTimeTimesE, DetId::Hcal, hcalChanStatusForCaloTower(), HcalEndcap, HcalForward, HcalOuter, HcalTopology::idFront(), CaloTowerDetId::ieta(), HcalDetId::ietaAbs(), IgnoredChan, CaloTowerDetId::iphi(), HcalTopology::lastHERing(), CaloTowersParam_cfi::mc, MatrixUtil::merge(), HcalTopology::mergedDepth29(), CaloTowersCreationAlgo::MetaTower::metaConstituents, DetId::null(), CaloTowersCreationAlgo::MetaTower::numBadHcalCells, CaloTowersCreationAlgo::MetaTower::numProbHcalCells, CaloTowersCreationAlgo::MetaTower::numRecHcalCells, ProblematicChan, RecoveredChan, HcalDetId::subdet(), theHcalPhase, theHcalTopology, theHOIsUsed, theTowerConstituentsMap, electronIdCutBased_cfi::threshold, CaloRecHit::time(), CaloTowerConstituentsMap::towerOf(), mps_merge::weight, and CaloTowerDetId::zside().

Referenced by process().

503  {
504  DetId detId = recHit->detid();
505  DetId detIdF(detId);
506  if (detId.det() == DetId::Hcal && theHcalTopology->getMergePositionFlag()) {
507  detIdF = theHcalTopology->idFront(HcalDetId(detId));
508 #ifdef EDM_ML_DEBUG
509  std::cout << "AssignHitHcal DetId " << HcalDetId(detId) << " Front "
510  << HcalDetId(detIdF) << std::endl;
511 #endif
512  }
513 
514  unsigned int chStatusForCT = hcalChanStatusForCaloTower(recHit);
515 
516  // this is for skipping channls: mostly needed for the creation of
517  // bad towers from hits i the bad channel collections.
518  if (chStatusForCT==CaloTowersCreationAlgo::IgnoredChan) return;
519 
520  double threshold, weight;
521  getThresholdAndWeight(detId, threshold, weight);
522 
523  double energy = recHit->energy(); // original RecHit energy is used to apply thresholds
524  double e = energy * weight; // energies scaled by user weight: used in energy assignments
525 
526  // SPECIAL handling of tower 28 merged depths --> half into tower 28 and half into tower 29
527  bool merge(false);
528  if (detIdF.det()==DetId::Hcal &&
529  HcalDetId(detIdF).subdet()==HcalEndcap &&
530  (theHcalPhase==0 || theHcalPhase==1) &&
531  //HcalDetId(detId).depth()==3 &&
532  HcalDetId(detIdF).ietaAbs()==theHcalTopology->lastHERing()-1) {
534 #ifdef EDM_ML_DEBUG
535  std::cout << "Merge " << HcalDetId(detIdF) << ":" << merge << std::endl;
536 #endif
537  }
538  if (merge) {
539 
541 
542  // bad channels are counted regardless of energy threshold
543 
544  if (chStatusForCT == CaloTowersCreationAlgo::BadChan) {
545  CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(detId);
546  if (towerDetId.null()) return;
547  MetaTower & tower28 = find(towerDetId);
548  CaloTowerDetId towerDetId29(towerDetId.ieta()+towerDetId.zside(),
549  towerDetId.iphi());
550  MetaTower & tower29 = find(towerDetId29);
551  tower28.numBadHcalCells += 1;
552  tower29.numBadHcalCells += 1;
553  }
554 
555  else if (0.5*energy >= threshold) { // not bad channel: use energy if above threshold
556 
557  CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(detId);
558  if (towerDetId.null()) return;
559  MetaTower & tower28 = find(towerDetId);
560  CaloTowerDetId towerDetId29(towerDetId.ieta()+towerDetId.zside(),
561  towerDetId.iphi());
562  MetaTower & tower29 = find(towerDetId29);
563 
564  if (chStatusForCT == CaloTowersCreationAlgo::RecoveredChan) {
565  tower28.numRecHcalCells += 1;
566  tower29.numRecHcalCells += 1;
567  }
568  else if (chStatusForCT == CaloTowersCreationAlgo::ProblematicChan) {
569  tower28.numProbHcalCells += 1;
570  tower29.numProbHcalCells += 1;
571  }
572 
573  // NOTE DIVIDE BY 2!!!
574  double e28 = 0.5 * e;
575  double e29 = 0.5 * e;
576 
577  tower28.E_had += e28;
578  tower28.E += e28;
579  std::pair<DetId,float> mc(detId,e28);
580  tower28.metaConstituents.push_back(mc);
581 
582  tower29.E_had += e29;
583  tower29.E += e29;
584  tower29.metaConstituents.push_back(mc);
585 
586  // time info: do not use in averaging if timing error is found: need
587  // full set of status info to implement: use only "good" channels for now
588 
589  if (chStatusForCT == CaloTowersCreationAlgo::GoodChan) {
590  tower28.hadSumTimeTimesE += ( e28 * recHit->time() );
591  tower28.hadSumEForTime += e28;
592  tower29.hadSumTimeTimesE += ( e29 * recHit->time() );
593  tower29.hadSumEForTime += e29;
594  }
595 
596  // store the energy in layer 3 also in E_outer
597  tower28.E_outer += e28;
598  tower29.E_outer += e29;
599  } // not a "bad" hit
600  } // end of special case
601 
602  else {
603  HcalDetId hcalDetId(detId);
604 
606 
607  if(hcalDetId.subdet() == HcalOuter) {
608 
609  CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(detId);
610  if (towerDetId.null()) return;
611  MetaTower & tower = find(towerDetId);
612 
613  if (chStatusForCT == CaloTowersCreationAlgo::BadChan) {
614  if (theHOIsUsed) tower.numBadHcalCells += 1;
615  }
616 
617  else if (energy >= threshold) {
618  tower.E_outer += e; // store HO energy even if HO is not used
619  // add energy of the tower and/or flag if theHOIsUsed
620  if(theHOIsUsed) {
621  tower.E += e;
622 
623  if (chStatusForCT == CaloTowersCreationAlgo::RecoveredChan) {
624  tower.numRecHcalCells += 1;
625  }
626  else if (chStatusForCT == CaloTowersCreationAlgo::ProblematicChan) {
627  tower.numProbHcalCells += 1;
628  }
629  } // HO is used
630 
631 
632  // add HO to constituents even if it is not used: JetMET wants to keep these towers
633  std::pair<DetId,float> mc(detId,e);
634  tower.metaConstituents.push_back(mc);
635 
636  } // not a bad channel, energy above threshold
637 
638  } // HO hit
639 
640  // HF calculates EM fraction differently
641  else if(hcalDetId.subdet() == HcalForward) {
642 
643  if (chStatusForCT == CaloTowersCreationAlgo::BadChan) {
644  CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(detId);
645  if (towerDetId.null()) return;
646  MetaTower & tower = find(towerDetId);
647  tower.numBadHcalCells += 1;
648  }
649 
650  else if (energy >= threshold) {
651  CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(detId);
652  if (towerDetId.null()) return;
653  MetaTower & tower = find(towerDetId);
654 
655  if (hcalDetId.depth() == 1) {
656  // long fiber, so E_EM = E(Long) - E(Short)
657  tower.E_em += e;
658  }
659  else {
660  // short fiber, EHAD = 2 * E(Short)
661  tower.E_em -= e;
662  tower.E_had += 2. * e;
663  }
664  tower.E += e;
665  if (chStatusForCT == CaloTowersCreationAlgo::RecoveredChan) {
666  tower.numRecHcalCells += 1;
667  }
668  else if (chStatusForCT == CaloTowersCreationAlgo::ProblematicChan) {
669  tower.numProbHcalCells += 1;
670  }
671 
672  // put the timing in HCAL -> have to check timing errors when available
673  // for now use only good channels
674  if (chStatusForCT == CaloTowersCreationAlgo::GoodChan) {
675  tower.hadSumTimeTimesE += ( e * recHit->time() );
676  tower.hadSumEForTime += e;
677  }
678 
679  std::pair<DetId,float> mc(detId,e);
680  tower.metaConstituents.push_back(mc);
681 
682  } // not a bad HF channel, energy above threshold
683 
684  } // HF hit
685 
686  else {
687  // HCAL situation normal in HB/HE
688  if (chStatusForCT == CaloTowersCreationAlgo::BadChan) {
689  CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(detId);
690  if (towerDetId.null()) return;
691  MetaTower & tower = find(towerDetId);
692  tower.numBadHcalCells += 1;
693  }
694  else if (energy >= threshold) {
695  CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(detId);
696  if (towerDetId.null()) return;
697  MetaTower & tower = find(towerDetId);
698  tower.E_had += e;
699  tower.E += e;
700  if (chStatusForCT == CaloTowersCreationAlgo::RecoveredChan) {
701  tower.numRecHcalCells += 1;
702  }
703  else if (chStatusForCT == CaloTowersCreationAlgo::ProblematicChan) {
704  tower.numProbHcalCells += 1;
705  }
706 
707  // Timing information: need specific accessors
708  // for now use only good channels
709  if (chStatusForCT == CaloTowersCreationAlgo::GoodChan) {
710  tower.hadSumTimeTimesE += ( e * recHit->time() );
711  tower.hadSumEForTime += e;
712  }
713  // store energy in highest depth for towers 18-27 (for electron,photon ID in endcap)
714  // also, store energy in HE part of tower 16 (for JetMET cleanup)
715  HcalDetId hcalDetId(detId);
716  if (hcalDetId.subdet()==HcalEndcap){
717  if(theHcalPhase==0) {
718  if ( (hcalDetId.depth()==2 && hcalDetId.ietaAbs()>=18 && hcalDetId.ietaAbs()<27) ||
719  (hcalDetId.depth()==3 && hcalDetId.ietaAbs()==27) ||
720  (hcalDetId.depth()==3 && hcalDetId.ietaAbs()==16) ) {
721  tower.E_outer += e;
722  }
723  }
724  //combine depths in phase0-like way
725  else if(theHcalPhase==1) {
726  if ( (hcalDetId.depth()>=3 && hcalDetId.ietaAbs()>=18 && hcalDetId.ietaAbs()<26) ||
727  (hcalDetId.depth()>=4 && (hcalDetId.ietaAbs()==26 || hcalDetId.ietaAbs()==27)) ||
728  (hcalDetId.depth()==3 && hcalDetId.ietaAbs()==17) ||
729  (hcalDetId.depth()==4 && hcalDetId.ietaAbs()==16) ) {
730  tower.E_outer += e;
731  }
732  }
733  }
734 
735  std::pair<DetId,float> mc(detId,e);
736  tower.metaConstituents.push_back(mc);
737 
738  } // not a "bad" channel, energy above threshold
739 
740  } // channel in HBHE (excluding twrs 28,29)
741 
742  } // recHit normal case (not in HE towers 28,29)
743 
744 } // end of assignHitHcal method
constexpr float energy() const
Definition: CaloRecHit.h:31
Definition: merge.py:1
bool mergedDepth29(HcalDetId id) const
Definition: HcalTopology.h:107
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:142
constexpr bool null() const
is this a null id ?
Definition: DetId.h:49
constexpr const DetId & detid() const
Definition: CaloRecHit.h:35
MetaTower & find(const CaloTowerDetId &id)
looks for a given tower in the internal cache. If it can&#39;t find it, it makes it.
bool getMergePositionFlag() const
Definition: HcalTopology.h:170
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)
constexpr float time() const
Definition: CaloRecHit.h:33
int iphi() const
get the tower iphi
const CaloTowerConstituentsMap * theTowerConstituentsMap
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.h:150
Definition: DetId.h:18
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
HcalDetId idFront(const HcalDetId &id) const
Definition: HcalTopology.h:176
int ieta() const
get the tower ieta
int lastHERing() const
Definition: HcalTopology.h:90
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39
def merge(dictlist, TELL=False)
Definition: MatrixUtil.py:193
void CaloTowersCreationAlgo::begin ( void  )

Definition at line 332 of file CaloTowersCreationAlgo.cc.

References theTowerMap, and theTowerMapSize.

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

332  {
333  theTowerMap.clear();
334  theTowerMapSize=0;
335  //hcalDropChMap.clear();
336 }
int CaloTowersCreationAlgo::compactTime ( float  time)
private

Definition at line 1592 of file CaloTowersCreationAlgo.cc.

References createfilelist::int.

Referenced by convert().

1592  {
1593 
1594  const float timeUnit = 0.01; // discretization (ns)
1595 
1596  if (time> 300.0) return 30000;
1597  if (time< -300.0) return -30000;
1598 
1599  return int(time/timeUnit + 0.5);
1600 
1601 }
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 901 of file CaloTowersCreationAlgo.cc.

References edm::SortedCollection< T, SORT >::back(), PV3DBase< T, PVType, FrameType >::basicVector(), compactTime(), edm::contains(), CaloTowerTopology::denseIndex(), diffTreeTool::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(), hadShwrPos(), CaloTowersCreationAlgo::MetaTower::hadSumEForTime, CaloTowersCreationAlgo::MetaTower::hadSumTimeTimesE, DetId::Hcal, hcalDropChMap, HcalOuter, mps_fire::i, CaloTowerTopology::lastHBRing(), CaloTowerTopology::lastHERing(), CaloTowerTopology::lastHFRing(), CaloTowerTopology::lastHORing(), match(), CaloTowersCreationAlgo::MetaTower::metaConstituents, missingHcalRescaleFactorForEcal, 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().

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

Definition at line 1790 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().

1790  {
1791 
1792  // const DetId id = hit->detid();
1793 
1794  // uint16_t dbStatus = theEcalChStatus->find(id)->getStatusCode();
1795  // uint32_t rhFlags = hit->flags();
1796  // int severityLevel = theEcalSevLvlAlgo->severityLevel(rhFlags, dbStatus);
1797  // The methods above will become private and cannot be usef for flagging ecal spikes.
1798  // Use the recommended interface - we leave the parameters for spilke removal to be specified by ECAL.
1799 
1800 
1801  // int severityLevel = 999;
1802 
1803  EcalRecHit const & rh = *reinterpret_cast<EcalRecHit const *>(hit);
1805 
1806 // if (id.subdetId() == EcalBarrel) severityLevel = theEcalSevLvlAlgo->severityLevel( id, *theEbHandle);//, *theEcalChStatus);
1807 // else if (id.subdetId() == EcalEndcap) severityLevel = theEcalSevLvlAlgo->severityLevel( id, *theEeHandle);//, *theEcalChStatus);
1808 
1809  // there should be no other ECAL types used in this reconstruction
1810 
1811  // The definition of ECAL severity levels uses categories that
1812  // are similar to the defined for CaloTower. (However, the categorization
1813  // for CaloTowers depends on the specified maximum acceptabel severity and therefore cannnot
1814  // be exact correspondence between the two. ECAL has additional categories describing modes of failure.)
1815  // This approach is different from the initial idea and from
1816  // the implementation for HCAL. Still make the logic similar to HCAL so that one has the ability to
1817  // exclude problematic channels as defined by ECAL.
1818  // For definitions of ECAL severity levels see RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h
1819 
1820  bool isBad = (severityLevel == EcalSeverityLevel::kBad);
1821 
1822  bool isRecovered = (severityLevel == EcalSeverityLevel::kRecovered);
1823 
1824  // check if the severity is compatible with our configuration
1825  // This applies to the "default" tower cleaning
1826  std::vector<int>::const_iterator sevit = std::find(theEcalSeveritiesToBeExcluded.begin(),
1828  severityLevel);
1829  bool accepted = (sevit==theEcalSeveritiesToBeExcluded.end()) ;
1830 
1831  // For use with hits that were rejected in the regular reconstruction:
1832  // This is for creating calotowers with lower level of cleaning by merging
1833  // the information from the default towers and a collection of towers created from
1834  // bad rechits
1835 
1836 
1837  if (useRejectedHitsOnly) {
1838 
1839  if (!isRecovered) {
1840 
1841  if (accepted ||
1844  return std::make_tuple(CaloTowersCreationAlgo::IgnoredChan,isBad);
1845  // this hit was either already accepted, or is not eligible for inclusion
1846  }
1847  else {
1848 
1850  // skip recovered hits either because they were already used or because there was an explicit instruction
1851  return std::make_tuple(CaloTowersCreationAlgo::IgnoredChan,isBad);;
1852  }
1853  else if (useRejectedRecoveredEcalHits) {
1854  return std::make_tuple(CaloTowersCreationAlgo::RecoveredChan,isBad);
1855  }
1856 
1857  } // recovered channels
1858 
1859  // clasify channels as problematic
1860  return std::make_tuple(CaloTowersCreationAlgo::ProblematicChan,isBad);
1861 
1862  } // treatment of rejected hits
1863 
1864 
1865 
1866  // for normal reconstruction
1867  if (severityLevel == EcalSeverityLevel::kGood) return std::make_tuple(CaloTowersCreationAlgo::GoodChan,false);
1868 
1869  if (isRecovered) {
1870  return std::make_tuple( (theRecoveredEcalHitsAreUsed) ?
1872  }
1873  else {
1874  return std::make_tuple(accepted ? CaloTowersCreationAlgo::ProblematicChan : CaloTowersCreationAlgo::BadChan,isBad);
1875 
1876  }
1877 
1878 
1879 }
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 1360 of file CaloTowersCreationAlgo.cc.

References CaloGeometry::getGeometry(), point, and theGeometry.

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

1360  {
1361  auto cellGeometry = theGeometry->getGeometry(detId);
1362  GlobalPoint point = cellGeometry->getPosition(); // face of the cell
1363 
1364  if (fracDepth<=0) return point;
1365  if (fracDepth>1) fracDepth=1;
1366 
1367  const GlobalPoint& backPoint = cellGeometry->getBackPoint();
1368  point += fracDepth * (backPoint-point);
1369 
1370  return point;
1371 }
const CaloGeometry * theGeometry
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:85
*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 1553 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().

1554  {
1555 
1556  double emX = 0.0;
1557  double emY = 0.0;
1558  double emZ = 0.0;
1559 
1560  double weight = 0;
1561  double sumWeights = 0;
1562  double sumEmE = 0; // add crystals with E/E_EM > 1.5%
1563  double crystalThresh = 0.015 * emE;
1564 
1565  std::vector<std::pair<DetId,float> >::const_iterator mc_it = metaContains.begin();
1566  for (; mc_it!=metaContains.end(); ++mc_it) {
1567  if (mc_it->second < 0) continue;
1568  if (mc_it->first.det() == DetId::Ecal && mc_it->second > crystalThresh) sumEmE += mc_it->second;
1569  }
1570 
1571  for (mc_it = metaContains.begin(); mc_it!=metaContains.end(); ++mc_it) {
1572 
1573  if (mc_it->first.det() != DetId::Ecal || mc_it->second < crystalThresh) continue;
1574 
1575  GlobalPoint p = emCrystalShwrPos(mc_it->first, fracDepth);
1576 
1577  weight = 4.2 + log(mc_it->second/sumEmE);
1578  sumWeights += weight;
1579 
1580  emX += p.x() * weight;
1581  emY += p.y() * weight;
1582  emZ += p.z() * weight;
1583  }
1584 
1585  return GlobalPoint(emX/sumWeights, emY/sumWeights, emZ/sumWeights);
1586 }
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 1523 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().

1524  {
1525 
1526  if (emE<=0) return GlobalPoint(0,0,0);
1527 
1528  double emX = 0.0;
1529  double emY = 0.0;
1530  double emZ = 0.0;
1531 
1532  double eSum = 0;
1533 
1534  std::vector<std::pair<DetId,float> >::const_iterator mc_it = metaContains.begin();
1535  for (; mc_it!=metaContains.end(); ++mc_it) {
1536  if (mc_it->first.det() != DetId::Ecal) continue;
1537  GlobalPoint p = emCrystalShwrPos(mc_it->first, fracDepth);
1538  double e = mc_it->second;
1539 
1540  if (e>0) {
1541  emX += p.x() * e;
1542  emY += p.y() * e;
1543  emZ += p.z() * e;
1544  eSum += e;
1545  }
1546 
1547  }
1548 
1549  return GlobalPoint(emX/eSum, emY/eSum, emZ/eSum);
1550 }
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 884 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().

884  {
885  if (theTowerMap.empty()) {
887  }
888 
889  auto & mt = theTowerMap[theTowerTopology->denseIndex(detId)];
890 
891  if (mt.empty()) {
892  mt.id=detId;
893  mt.metaConstituents.reserve(detId.ietaAbs()<theTowerTopology->firstHFRing() ? 12 : 2);
894  ++theTowerMapSize;
895  }
896 
897  return mt;
898 }
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 375 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().

375  {
376  // now copy this map into the final collection
377  result.reserve(theTowerMapSize);
378  // auto k=0U;
379  // if (!theEbHandle.isValid()) std::cout << "VI ebHandle not valid" << std::endl;
380  // if (!theEeHandle.isValid()) std::cout << "VI eeHandle not valid" << std::endl;
381 
382  for(auto const & mt : theTowerMap ) {
383  // Convert only if there is at least one constituent in the metatower.
384  // The check of constituents size in the coverted tower is still needed!
385  if (!mt.empty() ) { convert(mt.id, mt, result); } // ++k;}
386  }
387 
388  // assert(k==theTowerMapSize);
389  // std::cout << "VI TowerMap " << theTowerMapSize << " " << k << std::endl;
390 
391  theTowerMap.clear(); // save the memory
392  theTowerMapSize=0;
393 }
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 1220 of file CaloTowersCreationAlgo.cc.

References egammaForCoreTracking_cff::depth, 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, theHBthreshold1, theHBthreshold2, theHBweight, theHBWeights, theHcalTopology, theHEDEScale, theHEDGrid, theHEDthreshold, theHEDthreshold1, theHEDweight, theHEDWeights, theHESEScale, theHESGrid, theHESthreshold, theHESthreshold1, 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().

1220  {
1221  DetId::Detector det = detId.det();
1222  weight=0; // in case the hit is not identified
1223 
1224  if(det == DetId::Ecal) {
1225  // may or may not be EB. We'll find out.
1226 
1227  EcalSubdetector subdet = (EcalSubdetector)(detId.subdetId());
1228  if(subdet == EcalBarrel) {
1230  weight = theEBweight;
1231  if (weight <= 0.) {
1232  ROOT::Math::Interpolator my(theEBGrid,theEBWeights,ROOT::Math::Interpolation::kAKIMA);
1233  weight = my.Eval(theEBEScale);
1234  }
1235  }
1236  else if(subdet == EcalEndcap) {
1238  weight = theEEweight;
1239  if (weight <= 0.) {
1240  ROOT::Math::Interpolator my(theEEGrid,theEEWeights,ROOT::Math::Interpolation::kAKIMA);
1241  weight = my.Eval(theEEEScale);
1242  }
1243  }
1244  }
1245  else if(det == DetId::Hcal) {
1246  HcalDetId hcalDetId(detId);
1247  HcalSubdetector subdet = hcalDetId.subdet();
1248  int depth = hcalDetId.depth();
1249 
1250  if(subdet == HcalBarrel) {
1251  threshold = (depth == 1) ? theHBthreshold1 : (depth == 2) ? theHBthreshold2 : theHBthreshold;
1252  weight = theHBweight;
1253  if (weight <= 0.) {
1254  ROOT::Math::Interpolator my(theHBGrid,theHBWeights,ROOT::Math::Interpolation::kAKIMA);
1255  weight = my.Eval(theHBEScale);
1256  }
1257  }
1258 
1259  else if(subdet == HcalEndcap) {
1260  // check if it's single or double tower
1261  if(hcalDetId.ietaAbs() < theHcalTopology->firstHEDoublePhiRing()) {
1262  threshold = (depth == 1) ? theHESthreshold1 : theHESthreshold;
1263  weight = theHESweight;
1264  if (weight <= 0.) {
1265  ROOT::Math::Interpolator my(theHESGrid,theHESWeights,ROOT::Math::Interpolation::kAKIMA);
1266  weight = my.Eval(theHESEScale);
1267  }
1268  }
1269  else {
1270  threshold = (depth == 1) ? theHEDthreshold1 : theHEDthreshold;
1271  weight = theHEDweight;
1272  if (weight <= 0.) {
1273  ROOT::Math::Interpolator my(theHEDGrid,theHEDWeights,ROOT::Math::Interpolation::kAKIMA);
1274  weight = my.Eval(theHEDEScale);
1275  }
1276  }
1277  }
1278 
1279  else if(subdet == HcalOuter) {
1280  //check if it's ring 0 or +1 or +2 or -1 or -2
1281  if(hcalDetId.ietaAbs() <= 4) threshold = theHOthreshold0;
1282  else if(hcalDetId.ieta() < 0) {
1283  // set threshold for ring -1 or -2
1284  threshold = (hcalDetId.ietaAbs() <= 10) ? theHOthresholdMinus1 : theHOthresholdMinus2;
1285  } else {
1286  // set threshold for ring +1 or +2
1287  threshold = (hcalDetId.ietaAbs() <= 10) ? theHOthresholdPlus1 : theHOthresholdPlus2;
1288  }
1289  weight = theHOweight;
1290  if (weight <= 0.) {
1291  ROOT::Math::Interpolator my(theHOGrid,theHOWeights,ROOT::Math::Interpolation::kAKIMA);
1292  weight = my.Eval(theHOEScale);
1293  }
1294  }
1295 
1296  else if(subdet == HcalForward) {
1297  if(hcalDetId.depth() == 1) {
1299  weight = theHF1weight;
1300  if (weight <= 0.) {
1301  ROOT::Math::Interpolator my(theHF1Grid,theHF1Weights,ROOT::Math::Interpolation::kAKIMA);
1302  weight = my.Eval(theHF1EScale);
1303  }
1304  } else {
1306  weight = theHF2weight;
1307  if (weight <= 0.) {
1308  ROOT::Math::Interpolator my(theHF2Grid,theHF2Weights,ROOT::Math::Interpolation::kAKIMA);
1309  weight = my.Eval(theHF2EScale);
1310  }
1311  }
1312  }
1313  }
1314  else {
1315  edm::LogError("CaloTowersCreationAlgo") << "Bad cell: " << det << std::endl;
1316  }
1317 }
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
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
HcalSubdetector
Definition: HcalAssistant.h:31
std::vector< double > theHOGrid
std::vector< double > theHF1Weights
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:96
std::vector< double > theHBWeights
Detector
Definition: DetId.h:26
const HcalTopology * theHcalTopology
std::vector< double > theHF1Grid
std::vector< double > theEBGrid
std::vector< double > theHF2Weights
EcalSubdetector
std::vector< double > theEBWeights
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39
GlobalPoint CaloTowersCreationAlgo::hadSegmentShwrPos ( DetId  detId,
float  fracDepth 
)

Definition at line 1373 of file CaloTowersCreationAlgo.cc.

References emCrystalShwrPos().

Referenced by hadShwrPos(), and setEeHandle().

1373  {
1374  // same code as above
1375  return emCrystalShwrPos(detId, fracDepth);
1376 }
GlobalPoint emCrystalShwrPos(DetId detId, float fracDepth)
GlobalPoint CaloTowersCreationAlgo::hadShwPosFromCells ( DetId  frontCell,
DetId  backCell,
float  fracDepth 
)

Definition at line 1494 of file CaloTowersCreationAlgo.cc.

References gather_cfg::cout, CaloGeometry::getGeometry(), HcalTopology::getMergePositionFlag(), HcalTopology::idBack(), HcalTopology::idFront(), point, theGeometry, and theHcalTopology.

Referenced by hadShwrPos(), and setEeHandle().

1494  {
1495 
1496  // uses the "front" and "back" cells
1497  // to determine the axis. point set by the predefined depth.
1498 
1499  HcalDetId hid1(frontCellId), hid2(backCellId);
1501  hid1 = theHcalTopology->idFront(frontCellId);
1502 #ifdef EDM_ML_DEBUG
1503  std::cout << "Front " << HcalDetId(frontCellId) << " " << hid1 << "\n";
1504 #endif
1505  hid2 = theHcalTopology->idBack(backCellId);
1506 #ifdef EDM_ML_DEBUG
1507  std::cout << "Back " << HcalDetId(backCellId) << " " << hid2 << "\n";
1508 #endif
1509  }
1510 
1511  auto frontCellGeometry = theGeometry->getGeometry(DetId(hid1));
1512  auto backCellGeometry = theGeometry->getGeometry(DetId(hid2));
1513 
1514  GlobalPoint point = frontCellGeometry->getPosition();
1515  const GlobalPoint& backPoint = backCellGeometry->getBackPoint();
1516 
1517  point += fracDepth * (backPoint - point);
1518 
1519  return point;
1520 }
bool getMergePositionFlag() const
Definition: HcalTopology.h:170
const CaloGeometry * theGeometry
Definition: DetId.h:18
const HcalTopology * theHcalTopology
HcalDetId idBack(const HcalDetId &id) const
Definition: HcalTopology.h:177
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:85
HcalDetId idFront(const HcalDetId &id) const
Definition: HcalTopology.h:176
*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 1379 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().

1380  {
1381 
1382  // this is based on available RecHits, can lead to different actual depths if
1383  // hits in multi-depth towers are not all there
1384 #ifdef EDM_ML_DEBUG
1385  std::cout << "hadShwrPos called with " << metaContains.size()
1386  << " elements and energy " << hadE << ":" << fracDepth
1387  << std::endl;
1388 #endif
1389  if (hadE<=0) return GlobalPoint(0,0,0);
1390 
1391  double hadX = 0.0;
1392  double hadY = 0.0;
1393  double hadZ = 0.0;
1394 
1395  int nConst = 0;
1396 
1397  std::vector<std::pair<DetId,float> >::const_iterator mc_it = metaContains.begin();
1398  for (; mc_it!=metaContains.end(); ++mc_it) {
1399  if (mc_it->first.det() != DetId::Hcal) continue;
1400  // do not use HO for deirection calculations for now
1401  if (HcalDetId(mc_it->first).subdet() == HcalOuter) continue;
1402  ++nConst;
1403 
1404  GlobalPoint p = hadSegmentShwrPos(mc_it->first, fracDepth);
1405 
1406  // longitudinal segmentation: do not weight by energy,
1407  // get the geometrical position
1408  hadX += p.x();
1409  hadY += p.y();
1410  hadZ += p.z();
1411  }
1412 
1413  return GlobalPoint(hadX/nConst, hadY/nConst, hadZ/nConst);
1414 }
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:142
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 1417 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().

1417  {
1418 
1419  // set depth using geometry of cells that are associated with the
1420  // tower (regardless if they have non-zero energies)
1421 
1422  // if (hadE <= 0) return GlobalPoint(0, 0, 0);
1423 #ifdef EDM_ML_DEBUG
1424  std::cout << "hadShwrPos " << towerId << " frac " << fracDepth << std::endl;
1425 #endif
1426  if (fracDepth < 0) fracDepth = 0;
1427  else if (fracDepth > 1) fracDepth = 1;
1428 
1429  GlobalPoint point(0,0,0);
1430 
1431  int iEta = towerId.ieta();
1432  int iPhi = towerId.iphi();
1433 
1434  HcalDetId frontCellId, backCellId;
1435 
1436  if(towerId.ietaAbs() >= theTowerTopology->firstHFRing()){
1437  // forward, take the geometry for long fibers
1438  frontCellId = HcalDetId(HcalForward, towerId.zside()*theTowerTopology->convertCTtoHcal(abs(iEta)), iPhi, 1);
1439  backCellId = HcalDetId(HcalForward, towerId.zside()*theTowerTopology->convertCTtoHcal(abs(iEta)), iPhi, 1);
1440  }
1441  else {
1442  //use constituents map
1443  std::vector<DetId> items = theTowerConstituentsMap->constituentsOf(towerId);
1444  int frontDepth = 1000;
1445  int backDepth = -1000;
1446  for(unsigned i = 0; i < items.size(); i++){
1447  if(items[i].det()!=DetId::Hcal) continue;
1448  HcalDetId hid(items[i]);
1449  if(hid.subdet() == HcalOuter) continue;
1450  if(!theHcalTopology->validHcal(hid,2)) continue;
1451 
1452  if (theHcalTopology->idFront(hid).depth()<frontDepth) {
1453  frontCellId = hid;
1454  frontDepth = theHcalTopology->idFront(hid).depth();
1455  }
1456  if (theHcalTopology->idBack(hid).depth()>backDepth) {
1457  backCellId = hid;
1458  backDepth = theHcalTopology->idBack(hid).depth();
1459  }
1460  }
1461 #ifdef EDM_ML_DEBUG
1462  std::cout << "Front " << frontCellId << " Back " << backCellId
1463  << " Depths " << frontDepth << ":" << backDepth << std::endl;
1464 #endif
1465  //fix for tower 28/29 - no tower 29 at highest depths
1466  if(towerId.ietaAbs()==theTowerTopology->lastHERing() && (theHcalPhase==0 || theHcalPhase==1)){
1467  CaloTowerDetId towerId28(towerId.ieta()-towerId.zside(),towerId.iphi());
1468  std::vector<DetId> items28 = theTowerConstituentsMap->constituentsOf(towerId28);
1469 #ifdef EDM_ML_DEBUG
1470  std::cout << towerId28 << " with " << items28.size() <<" constituents:";
1471  for (unsigned k=0; k<items28.size(); ++k)
1472  if (items28[k].det()==DetId::Hcal) std::cout << " " << HcalDetId(items28[k]);
1473  std::cout << std::endl;
1474 #endif
1475  for(unsigned i = 0; i < items28.size(); i++){
1476  if(items28[i].det()!=DetId::Hcal) continue;
1477  HcalDetId hid(items28[i]);
1478  if(hid.subdet() == HcalOuter) continue;
1479 
1480  if(theHcalTopology->idBack(hid).depth()>backDepth) {
1481  backCellId = hid;
1482  backDepth = theHcalTopology->idBack(hid).depth(); }
1483  }
1484  }
1485 #ifdef EDM_ML_DEBUG
1486  std::cout << "Back " << backDepth << " ID " << backCellId << std::endl;
1487 #endif
1488  }
1489  point = hadShwPosFromCells(DetId(frontCellId), DetId(backCellId), fracDepth);
1490 
1491  return point;
1492 }
short zside() const
Definition: HGCalTowerID.h:18
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.h:162
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const CaloTowerConstituentsMap * theTowerConstituentsMap
const CaloTowerTopology * theTowerTopology
int k[5][pyjets_maxn]
Definition: DetId.h:18
GlobalPoint hadShwPosFromCells(DetId frontCell, DetId backCell, float fracDepth)
const HcalTopology * theHcalTopology
l1t::HGCalTowerID towerId
Definition: classes.h:34
HcalDetId idBack(const HcalDetId &id) const
Definition: HcalTopology.h:177
int lastHERing() const
int convertCTtoHcal(int ct_ieta) const
HcalDetId idFront(const HcalDetId &id) const
Definition: HcalTopology.h:176
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 1724 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().

1724  {
1725 
1726  HcalDetId hid(hit->detid());
1727  DetId id = theHcalTopology->idFront(hid);
1728 #ifdef EDM_ML_DEBUG
1729  std::cout << "ChanStatusForCaloTower for " << hid << " to " << HcalDetId(id)
1730  << std::endl;
1731 #endif
1732  const uint32_t recHitFlag = hit->flags();
1733  const uint32_t dbStatusFlag = theHcalChStatus->getValues(id)->getValue();
1734 
1735  int severityLevel = theHcalSevLvlComputer->getSeverityLevel(id, recHitFlag, dbStatusFlag);
1736  bool isRecovered = theHcalSevLvlComputer->recoveredRecHit(id, recHitFlag);
1737 
1738 
1739  // For use with hits rejected in the default reconstruction
1740  if (useRejectedHitsOnly) {
1741 
1742  if (!isRecovered) {
1743 
1744  if (severityLevel <= int(theHcalAcceptSeverityLevel) ||
1746  // this hit was either already accepted or is worse than
1747  }
1748  else {
1749 
1751  // skip recovered hits either because they were already used or because there was an explicit instruction
1753  }
1754  else if (useRejectedRecoveredHcalHits) {
1756  }
1757 
1758  } // recovered channels
1759 
1760  // clasify channels as problematic: no good hits are supposed to be present in the
1761  // extra rechit collections
1763 
1764  } // treatment of rejected hits
1765 
1766 
1767 
1768 
1769  // this is for the regular reconstruction sequence
1770 
1771  if (severityLevel == 0) return CaloTowersCreationAlgo::GoodChan;
1772 
1773  if (isRecovered) {
1774  return (theRecoveredHcalHitsAreUsed) ?
1776  }
1777  else {
1778  if (severityLevel > int(theHcalAcceptSeverityLevel)) {
1780  }
1781  else {
1783  }
1784  }
1785 
1786 }
const HcalChannelQuality * theHcalChStatus
constexpr const DetId & detid() const
Definition: CaloRecHit.h:35
const Item * getValues(DetId fId, bool throwOnFail=true) const
bool recoveredRecHit(const DetId &myid, const uint32_t &myflag) const
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:176
uint32_t getValue() const
unsigned int theHcalAcceptSeverityLevelForRejectedHit
constexpr uint32_t flags() const
Definition: CaloRecHit.h:36
void CaloTowersCreationAlgo::makeEcalBadChs ( )

Definition at line 1675 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().

1675  {
1676 
1677  // std::cout << "VI making EcalBadChs ";
1678 
1679  // for ECAL the number of all bad channels is obtained here -----------------------
1680 
1681  for (auto ind=0U; ind<theTowerTopology->sizeForDenseIndexing(); ++ind) {
1682 
1683  auto & numBadEcalChan = ecalBadChs[ind];
1684  numBadEcalChan=0;
1685  auto id = theTowerTopology->detIdFromDenseIndex(ind);
1686 
1687  // this is utterly slow... (can be optmized if really needed)
1688 
1689  // get all possible constituents of the tower
1690  std::vector<DetId> allConstituents = theTowerConstituentsMap->constituentsOf(id);
1691 
1692  for (std::vector<DetId>::iterator ac_it=allConstituents.begin();
1693  ac_it!=allConstituents.end(); ++ac_it) {
1694 
1695  if (ac_it->det()!=DetId::Ecal) continue;
1696 
1697  auto thisEcalSevLvl = theEcalSevLvlAlgo->severityLevel( *ac_it);
1698 
1699  // check if the Ecal severity is ok to keep
1700  std::vector<int>::const_iterator sevit = std::find(theEcalSeveritiesToBeExcluded.begin(),
1702  thisEcalSevLvl);
1703  if (sevit!=theEcalSeveritiesToBeExcluded.end()) {
1704  ++numBadEcalChan;
1705  }
1706  }
1707 
1708  // if (0!=numBadEcalChan) std::cout << id << ":" << numBadEcalChan << ", ";
1709  }
1710 
1711  /*
1712  int tot=0;
1713  for (auto ind=0U; ind<theTowerTopology->sizeForDenseIndexing(); ++ind) {
1714  if (ecalBadChs[ind]!=0) ++tot;
1715  }
1716  std::cout << " | " << tot << std::endl;
1717  */
1718 
1719 }
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 1612 of file CaloTowersCreationAlgo.cc.

References CaloTowerConstituentsMap::constituentsOf(), gather_cfg::cout, HcalSeverityLevelComputer::dropChannel(), HcalCondObjectContainer< Item >::getAllChannels(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), DetId::Hcal, HcalBarrel, hcalDropChMap, HcalEndcap, CaloTowerDetId::ieta(), HcalDetId::ietaAbs(), CaloTowerDetId::iphi(), HcalTopology::lastHERing(), HcalTopology::mergedDepth29(), HcalTopology::mergedDepthDetId(), missingHcalRescaleFactorForEcal, HcalDetId::subdet(), theHcalChStatus, theHcalPhase, theHcalSevLvlComputer, theHcalTopology, theTowerConstituentsMap, CaloTowerConstituentsMap::towerOf(), and CaloTowerDetId::zside().

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

1612  {
1613 
1614  // This method fills the map of number of dead channels for the calotower,
1615  // The key of the map is CaloTowerDetId.
1616  // By definition these channels are not going to be in the RecHit collections.
1617  hcalDropChMap.clear();
1618  std::vector<DetId> allChanInStatusCont = theHcalChStatus->getAllChannels();
1619 
1620 #ifdef EDM_ML_DEBUG
1621  std::cout << "DropChMap with " << allChanInStatusCont.size() << " channels"
1622  << std::endl;
1623 #endif
1624  for (std::vector<DetId>::iterator it = allChanInStatusCont.begin(); it!=allChanInStatusCont.end(); ++it) {
1625  const uint32_t dbStatusFlag = theHcalChStatus->getValues(*it)->getValue();
1626  if (theHcalSevLvlComputer->dropChannel(dbStatusFlag)) {
1627 
1629 
1631 
1632  hcalDropChMap[twrId].first +=1;
1633 
1634  HcalDetId hid(*it);
1635 
1636  // special case for tower 29: if HCAL hit is in depth 3 add to twr 29 as well
1637  if (hid.subdet()==HcalEndcap &&
1638  (theHcalPhase==0 || theHcalPhase==1) &&
1639  hid.ietaAbs()==theHcalTopology->lastHERing()-1) {
1640  bool merge = theHcalTopology->mergedDepth29(hid);
1641  if (merge) {
1642  CaloTowerDetId twrId29(twrId.ieta()+twrId.zside(), twrId.iphi());
1643  hcalDropChMap[twrId29].first +=1;
1644  }
1645  }
1646  }
1647  }
1648  // now I know how many bad channels, but I also need to know if there's any good ones
1650  for (auto & pair : hcalDropChMap) {
1651  if (pair.second.first == 0) continue; // unexpected, but just in case
1652  int ngood = 0, nbad = 0;
1653  for (DetId id : theTowerConstituentsMap->constituentsOf(pair.first)) {
1654  if (id.det() != DetId::Hcal) continue;
1655  HcalDetId hid(id);
1656  if (hid.subdet() != HcalBarrel && hid.subdet() != HcalEndcap) continue;
1657  const uint32_t dbStatusFlag = theHcalChStatus->getValues(id)->getValue();
1658  if (dbStatusFlag == 0 || ! theHcalSevLvlComputer->dropChannel(dbStatusFlag)) {
1659  ngood += 1;
1660  } else {
1661  nbad += 1; // recount, since pair.second.first may include HO
1662  }
1663  }
1664  if (nbad > 0 && nbad >= ngood) {
1665  //uncomment for debug (may be useful to tune the criteria above)
1666  //CaloTowerDetId id(pair.first);
1667  //std::cout << "CaloTower at ieta = " << id.ieta() << ", iphi " << id.iphi() << ": set Hcal as not efficient (ngood =" << ngood << ", nbad = " << nbad << ")" << std::endl;
1668  pair.second.second = true;
1669  }
1670  }
1671  }
1672 }
Definition: merge.py:1
const HcalChannelQuality * theHcalChStatus
bool mergedDepth29(HcalDetId id) const
Definition: HcalTopology.h:107
const Item * getValues(DetId fId, bool throwOnFail=true) const
std::vector< DetId > constituentsOf(const CaloTowerDetId &id) const
Get the constituent detids for this tower id ( not yet implemented )
HcalDetId mergedDepthDetId(const HcalDetId &id) const
Definition: HcalTopology.h:169
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
const HcalSeverityLevelComputer * theHcalSevLvlComputer
Definition: DetId.h:18
int zside() const
get the z-side of the tower (1/-1)
const HcalTopology * theHcalTopology
int ieta() const
get the tower ieta
uint32_t getValue() const
int lastHERing() const
Definition: HcalTopology.h:90
void CaloTowersCreationAlgo::process ( const HBHERecHitCollection hbhe)

Definition at line 338 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().

338  {
339  for(HBHERecHitCollection::const_iterator hbheItr = hbhe.begin();
340  hbheItr != hbhe.end(); ++hbheItr)
341  assignHitHcal(&(*hbheItr));
342 }
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 839 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, electronIdCutBased_cfi::threshold, CaloTowerConstituentsMap::towerOf(), and mps_merge::weight.

Referenced by process().

839  {
840  double threshold, weight;
841  CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(ct->id());
842  if (towerDetId.null()) return;
843  MetaTower & tower = find(towerDetId);
844 
845  tower.E_em = 0.;
846  tower.E_had = 0.;
847  tower.E_outer = 0.;
848  for (unsigned int i=0; i<ct->constituentsSize(); i++) {
849  DetId detId = ct->constituent(i);
850  getThresholdAndWeight(detId, threshold, weight);
851  DetId::Detector det = detId.det();
852  if(det == DetId::Ecal) {
853  tower.E_em = ct->emEnergy()*weight;
854  }
855  else {
856  HcalDetId hcalDetId(detId);
857  if(hcalDetId.subdet() == HcalForward) {
858  if (hcalDetId.depth()==1) tower.E_em = ct->emEnergy()*weight;
859  if (hcalDetId.depth()==2) tower.E_had = ct->hadEnergy()*weight;
860  }
861  else if(hcalDetId.subdet() == HcalOuter) {
862  tower.E_outer = ct->outerEnergy()*weight;
863  }
864  else {
865  tower.E_had = ct->hadEnergy()*weight;
866  }
867  }
868  tower.E = tower.E_had+tower.E_em+tower.E_outer;
869 
870  // this is to be compliant with the new MetaTower setup
871  // used only for the default simple vector assignment
872  std::pair<DetId, float> mc(detId, 0);
873  tower.metaConstituents.push_back(mc);
874  }
875 
876  // preserve time inforamtion
877  tower.emSumTimeTimesE = ct->ecalTime();
878  tower.hadSumTimeTimesE = ct->hcalTime();
879  tower.emSumEForTime = 1.0;
880  tower.hadSumEForTime = 1.0;
881 }
size_t constituentsSize() const
Definition: CaloTower.h:105
DetId constituent(size_t i) const
Definition: CaloTower.h:106
constexpr bool null() const
is this a null id ?
Definition: DetId.h:49
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:26
void getThresholdAndWeight(const DetId &detId, double &threshold, double &weight) const
helper method to look up the appropriate threshold & weight
double outerEnergy() const
Definition: CaloTower.h:112
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39
void CaloTowersCreationAlgo::rescaleTowers ( const CaloTowerCollection ctInput,
CaloTowerCollection ctResult 
)

Definition at line 396 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, electronIdCutBased_cfi::threshold, and mps_merge::weight.

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

396  {
397 
398  for (CaloTowerCollection::const_iterator ctcItr = ctc.begin();
399  ctcItr != ctc.end(); ++ctcItr) {
400 
401  CaloTowerDetId twrId = ctcItr->id();
402  double newE_em = ctcItr->emEnergy();
403  double newE_had = ctcItr->hadEnergy();
404  double newE_outer = ctcItr->outerEnergy();
405 
406  double threshold = 0.0; // not used: we do not change thresholds
407  double weight = 1.0;
408 
409  // HF
410  if (ctcItr->ietaAbs()>=theTowerTopology->firstHFRing()) {
411  double E_short = 0.5 * newE_had; // from the definitions for HF
412  double E_long = newE_em + 0.5 * newE_had; //
413  // scale
414  E_long *= theHF1weight;
415  E_short *= theHF2weight;
416  // convert
417  newE_em = E_long - E_short;
418  newE_had = 2.0 * E_short;
419  }
420 
421  else { // barrel/endcap
422 
423  // find if its in EB, or EE; determine from first ecal constituent found
424  for (unsigned int iConst = 0; iConst < ctcItr->constituentsSize(); ++iConst) {
425  DetId constId = ctcItr->constituent(iConst);
426  if (constId.det()!=DetId::Ecal) continue;
427  getThresholdAndWeight(constId, threshold, weight);
428  newE_em *= weight;
429  break;
430  }
431  // HO
432  for (unsigned int iConst = 0; iConst < ctcItr->constituentsSize(); ++iConst) {
433  DetId constId = ctcItr->constituent(iConst);
434  if (constId.det()!=DetId::Hcal) continue;
435  if (HcalDetId(constId).subdet()!=HcalOuter) continue;
436  getThresholdAndWeight(constId, threshold, weight);
437  newE_outer *= weight;
438  break;
439  }
440  // HB/HE
441  for (unsigned int iConst = 0; iConst < ctcItr->constituentsSize(); ++iConst) {
442  DetId constId = ctcItr->constituent(iConst);
443  if (constId.det()!=DetId::Hcal) continue;
444  if (HcalDetId(constId).subdet()==HcalOuter) continue;
445  getThresholdAndWeight(constId, threshold, weight);
446  newE_had *= weight;
447  if (ctcItr->ietaAbs()>theTowerTopology->firstHERing()) newE_outer *= weight;
448  break;
449  }
450 
451  } // barrel/endcap region
452 
453  // now make the new tower
454 
455  double newE_hadTot = (theHOIsUsed && twrId.ietaAbs()<=theTowerTopology->lastHORing())? newE_had+newE_outer : newE_had;
456 
457  GlobalPoint emPoint = ctcItr->emPosition();
458  GlobalPoint hadPoint = ctcItr->emPosition();
459 
460  double f_em = 1.0/cosh(emPoint.eta());
461  double f_had = 1.0/cosh(hadPoint.eta());
462 
464 
465  if (ctcItr->ietaAbs()<theTowerTopology->firstHFRing()) {
466  if (newE_em>0) towerP4 += CaloTower::PolarLorentzVector(newE_em*f_em, emPoint.eta(), emPoint.phi(), 0);
467  if (newE_hadTot>0) towerP4 += CaloTower::PolarLorentzVector(newE_hadTot*f_had, hadPoint.eta(), hadPoint.phi(), 0);
468  }
469  else {
470  double newE_tot = newE_em + newE_had;
471  // for HF we use common point for ecal, hcal shower positions regardless of the method
472  if (newE_tot>0) towerP4 += CaloTower::PolarLorentzVector(newE_tot*f_had, hadPoint.eta(), hadPoint.phi(), 0);
473  }
474 
475 
476 
477  CaloTower rescaledTower(twrId, newE_em, newE_had, newE_outer, -1, -1, towerP4, emPoint, hadPoint);
478  // copy the timings, have to convert back to int, 1 unit = 0.01 ns
479  rescaledTower.setEcalTime( int(ctcItr->ecalTime()*100.0 + 0.5) );
480  rescaledTower.setHcalTime( int(ctcItr->hcalTime()*100.0 + 0.5) );
481  //add topology info
482  rescaledTower.setHcalSubdet(theTowerTopology->lastHBRing(),
486 
487  std::vector<DetId> contains;
488  for (unsigned int iConst = 0; iConst < ctcItr->constituentsSize(); ++iConst) {
489  contains.push_back(ctcItr->constituent(iConst));
490  }
491  rescaledTower.addConstituents(contains);
492 
493  rescaledTower.setCaloTowerStatus(ctcItr->towerStatusWord());
494 
495  ctcResult.push_back(rescaledTower);
496 
497  } // end of loop over towers
498 
499 
500 }
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:38
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:142
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
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:39
void CaloTowersCreationAlgo::setEBEScale ( double  scale)

Definition at line 1319 of file CaloTowersCreationAlgo.cc.

References Scenarios_cff::scale, and theEBEScale.

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

1319  {
1320  if (scale>0.00001) *&theEBEScale = scale;
1321  else *&theEBEScale = 50.;
1322 }
void CaloTowersCreationAlgo::setEbHandle ( const edm::Handle< EcalRecHitCollection eb)
inline

Definition at line 197 of file CaloTowersCreationAlgo.h.

References theEbHandle.

Referenced by CaloTowersCreator::produce().

197 { 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 163 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 184 of file CaloTowersCreationAlgo.h.

References theEcalSeveritiesToBeUsedInBadTowers.

Referenced by CaloTowersCreator::produce().

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

Definition at line 173 of file CaloTowersCreationAlgo.h.

References a, and theEcalSevLvlAlgo.

Referenced by CaloTowersCreator::produce().

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

Definition at line 1324 of file CaloTowersCreationAlgo.cc.

References Scenarios_cff::scale, and theEEEScale.

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

1324  {
1325  if (scale>0.00001) *&theEEEScale = scale;
1326  else *&theEEEScale = 50.;
1327 }
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 321 of file CaloTowersCreationAlgo.cc.

References DetId::Calo, ecalBadChs, CaloGeometry::getSubdetectorGeometry(), CaloTowerTopology::sizeForDenseIndexing(), CaloTowerDetId::SubdetId, theGeometry, theHcalTopology, theTowerConstituentsMap, theTowerGeometry, and theTowerTopology.

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

321  {
322  theTowerTopology = cttopo;
323  theTowerConstituentsMap = ctmap;
324  theHcalTopology = htopo;
325  theGeometry = geo;
327 
328  //initialize ecal bad channel map
330 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:49
const CaloSubdetectorGeometry * theTowerGeometry
static const int SubdetId
const CaloGeometry * theGeometry
const CaloTowerConstituentsMap * theTowerConstituentsMap
const CaloTowerTopology * theTowerTopology
const HcalTopology * theHcalTopology
std::vector< unsigned short > ecalBadChs
uint32_t sizeForDenseIndexing() const
void CaloTowersCreationAlgo::setHBEScale ( double  scale)

Definition at line 1329 of file CaloTowersCreationAlgo.cc.

References Scenarios_cff::scale, and theHBEScale.

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

1329  {
1330  if (scale>0.00001) *&theHBEScale = scale;
1331  else *&theHBEScale = 50.;
1332 }
void CaloTowersCreationAlgo::setHcalAcceptSeverityLevel ( unsigned int  level)
inline
void CaloTowersCreationAlgo::setHcalAcceptSeverityLevelForRejectedHit ( unsigned int  level)
inline
void CaloTowersCreationAlgo::setHcalChStatusFromDB ( const HcalChannelQuality s)
inline

Definition at line 118 of file CaloTowersCreationAlgo.h.

References alignCSCRings::s, and theHcalChStatus.

Referenced by CaloTowersCreator::produce().

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

Definition at line 170 of file CaloTowersCreationAlgo.h.

References EnergyCorrector::c, and theHcalSevLvlComputer.

Referenced by CaloTowersCreator::produce().

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

Definition at line 1339 of file CaloTowersCreationAlgo.cc.

References Scenarios_cff::scale, and theHEDEScale.

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

1339  {
1340  if (scale>0.00001) *&theHEDEScale = scale;
1341  else *&theHEDEScale = 50.;
1342 }
void CaloTowersCreationAlgo::setHESEScale ( double  scale)

Definition at line 1334 of file CaloTowersCreationAlgo.cc.

References Scenarios_cff::scale, and theHESEScale.

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

1334  {
1335  if (scale>0.00001) *&theHESEScale = scale;
1336  else *&theHESEScale = 50.;
1337 }
void CaloTowersCreationAlgo::setHF1EScale ( double  scale)

Definition at line 1349 of file CaloTowersCreationAlgo.cc.

References Scenarios_cff::scale, and theHF1EScale.

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

1349  {
1350  if (scale>0.00001) *&theHF1EScale = scale;
1351  else *&theHF1EScale = 50.;
1352 }
void CaloTowersCreationAlgo::setHF2EScale ( double  scale)

Definition at line 1354 of file CaloTowersCreationAlgo.cc.

References Scenarios_cff::scale, and theHF2EScale.

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

1354  {
1355  if (scale>0.00001) *&theHF2EScale = scale;
1356  else *&theHF2EScale = 50.;
1357 }
void CaloTowersCreationAlgo::setHOEScale ( double  scale)

Definition at line 1344 of file CaloTowersCreationAlgo.cc.

References Scenarios_cff::scale, and theHOEScale.

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

1344  {
1345  if (scale>0.00001) *&theHOEScale = scale;
1346  else *&theHOEScale = 50.;
1347 }
void CaloTowersCreationAlgo::setMissingHcalRescaleFactorForEcal ( float  factor)
inline
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 351 of file CaloTowersCreationAlgo.h.

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

HcalDropChMap CaloTowersCreationAlgo::hcalDropChMap
private

Definition at line 347 of file CaloTowersCreationAlgo.h.

Referenced by convert(), and makeHcalDropChMap().

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

Definition at line 366 of file CaloTowersCreationAlgo.h.

float CaloTowersCreationAlgo::missingHcalRescaleFactorForEcal
private
int CaloTowersCreationAlgo::nalgo =-1

Definition at line 52 of file CaloTowersCreationAlgo.h.

double CaloTowersCreationAlgo::theEBEScale
private

Definition at line 275 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight(), and setEBEScale().

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

Definition at line 263 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

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

Definition at line 361 of file CaloTowersCreationAlgo.h.

Referenced by setEbHandle().

double CaloTowersCreationAlgo::theEBSumThreshold
private

Definition at line 273 of file CaloTowersCreationAlgo.h.

Referenced by convert().

double CaloTowersCreationAlgo::theEBthreshold
private

Definition at line 251 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theEBweight
private

Definition at line 271 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

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

Definition at line 263 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

const EcalChannelStatus* CaloTowersCreationAlgo::theEcalChStatus
private

Definition at line 290 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 273 of file CaloTowersCreationAlgo.h.

Referenced by convert().

double CaloTowersCreationAlgo::theEEEScale
private

Definition at line 276 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight(), and setEEEScale().

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

Definition at line 264 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

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

Definition at line 362 of file CaloTowersCreationAlgo.h.

Referenced by setEeHandle().

double CaloTowersCreationAlgo::theEESumThreshold
private

Definition at line 273 of file CaloTowersCreationAlgo.h.

Referenced by convert().

double CaloTowersCreationAlgo::theEEthreshold
private

Definition at line 251 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theEEweight
private

Definition at line 271 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

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

Definition at line 264 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

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

Definition at line 277 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight(), and setHBEScale().

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

Definition at line 265 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHBthreshold
private

Definition at line 258 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHBthreshold1
private

Definition at line 258 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHBthreshold2
private

Definition at line 258 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHBweight
private

Definition at line 272 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

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

Definition at line 265 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

Definition at line 364 of file CaloTowersCreationAlgo.h.

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

const HcalSeverityLevelComputer* CaloTowersCreationAlgo::theHcalSevLvlComputer
private
double CaloTowersCreationAlgo::theHcalThreshold
private

Definition at line 256 of file CaloTowersCreationAlgo.h.

Referenced by convert().

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

Definition at line 279 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight(), and setHEDEScale().

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

Definition at line 267 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHEDthreshold
private

Definition at line 260 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHEDthreshold1
private

Definition at line 260 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHEDweight
private

Definition at line 272 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

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

Definition at line 267 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHESEScale
private

Definition at line 278 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight(), and setHESEScale().

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

Definition at line 266 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHESthreshold
private

Definition at line 259 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHESthreshold1
private

Definition at line 259 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHESweight
private

Definition at line 272 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

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

Definition at line 266 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHF1EScale
private

Definition at line 281 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight(), and setHF1EScale().

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

Definition at line 269 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHF1threshold
private

Definition at line 262 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHF1weight
private

Definition at line 272 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight(), and rescaleTowers().

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

Definition at line 269 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHF2EScale
private

Definition at line 282 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight(), and setHF2EScale().

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

Definition at line 270 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHF2threshold
private

Definition at line 262 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHF2weight
private

Definition at line 272 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight(), and rescaleTowers().

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

Definition at line 270 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHOEScale
private

Definition at line 280 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight(), and setHOEScale().

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

Definition at line 268 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 323 of file CaloTowersCreationAlgo.h.

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

double CaloTowersCreationAlgo::theHOthreshold0
private

Definition at line 261 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHOthresholdMinus1
private

Definition at line 261 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHOthresholdMinus2
private

Definition at line 262 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHOthresholdPlus1
private

Definition at line 261 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHOthresholdPlus2
private

Definition at line 262 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

double CaloTowersCreationAlgo::theHOweight
private

Definition at line 272 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

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

Definition at line 268 of file CaloTowersCreationAlgo.h.

Referenced by getThresholdAndWeight().

int CaloTowersCreationAlgo::theMomConstrMethod
private

Definition at line 327 of file CaloTowersCreationAlgo.h.

Referenced by convert().

double CaloTowersCreationAlgo::theMomEBDepth
private

Definition at line 330 of file CaloTowersCreationAlgo.h.

Referenced by convert().

double CaloTowersCreationAlgo::theMomEEDepth
private

Definition at line 331 of file CaloTowersCreationAlgo.h.

Referenced by convert().

double CaloTowersCreationAlgo::theMomHBDepth
private

Definition at line 328 of file CaloTowersCreationAlgo.h.

Referenced by convert().

double CaloTowersCreationAlgo::theMomHEDepth
private

Definition at line 329 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 287 of file CaloTowersCreationAlgo.h.

Referenced by convert(), and setGeometry().

MetaTowerMap CaloTowersCreationAlgo::theTowerMap
private

Definition at line 341 of file CaloTowersCreationAlgo.h.

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

unsigned int CaloTowersCreationAlgo::theTowerMapSize =0
private

Definition at line 342 of file CaloTowersCreationAlgo.h.

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

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

Definition at line 252 of file CaloTowersCreationAlgo.h.

Referenced by assignHitEcal().

bool CaloTowersCreationAlgo::theUseEtEETresholdFlag
private

Definition at line 252 of file CaloTowersCreationAlgo.h.

Referenced by assignHitEcal().

bool CaloTowersCreationAlgo::theUseSymEBTresholdFlag
private

Definition at line 253 of file CaloTowersCreationAlgo.h.

Referenced by assignHitEcal().

bool CaloTowersCreationAlgo::theUseSymEETresholdFlag
private

Definition at line 253 of file CaloTowersCreationAlgo.h.

Referenced by assignHitEcal().

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