CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes | Static Private Attributes
HcalTestHistoClass Class Reference

#include <HcalTestHistoClass.h>

Classes

struct  Hit
 
struct  Layer
 
struct  QIE
 

Public Member Functions

void fillHits (std::vector< CaloHit > &)
 
void fillLayers (double el[], double ho, double hbhe, double muxy[])
 
void fillQie (int id, double esimtot, double eqietot, int nGroup, const std::vector< double > &longs, const std::vector< double > &longq, int nTower, const std::vector< double > &latphi, const std::vector< double > &latfs, const std::vector< double > &latfq)
 
 HcalTestHistoClass (int i)
 
 HcalTestHistoClass ()
 
void setCounters ()
 
virtual ~HcalTestHistoClass ()
 

Private Attributes

float eHBHE
 
float eHO
 
std::vector< Hithits
 
std::vector< Layerlayers
 
int nGroupQIE
 
int nHits
 
int nLayers
 
int nQIE
 
int nTowerQIE
 
std::vector< QIEqie
 

Static Private Attributes

static const int nLayersMAX = 20
 

Detailed Description

Definition at line 14 of file HcalTestHistoClass.h.

Constructor & Destructor Documentation

◆ HcalTestHistoClass() [1/2]

HcalTestHistoClass::HcalTestHistoClass ( int  i)
inline

Definition at line 16 of file HcalTestHistoClass.h.

16 {}

◆ HcalTestHistoClass() [2/2]

HcalTestHistoClass::HcalTestHistoClass ( )
inlineexplicit

Definition at line 17 of file HcalTestHistoClass.h.

17 {}

◆ ~HcalTestHistoClass()

virtual HcalTestHistoClass::~HcalTestHistoClass ( )
inlinevirtual

Definition at line 18 of file HcalTestHistoClass.h.

18 {}

Member Function Documentation

◆ fillHits()

void HcalTestHistoClass::fillHits ( std::vector< CaloHit > &  hitcache)

Definition at line 39 of file HcalTestHistoClass.cc.

References TauDecayModes::dec, PVValHelper::eta, watchdog::group, hits, mps_fire::i, hcalRecHitTable_cff::ieta, hcalRecHitTable_cff::iphi, relval_steps::k2, LogDebug, nHits, phi, jetUpdater_cfi::sort, submitPVValidationJobs::t, HcalTestNumbering::unpackHcalIndex(), and ecaldqm::zside().

39  {
40  int nHit = hitcache.size();
41  int hit = 0;
42  int i;
43  std::vector<CaloHit>::iterator itr;
44  std::vector<CaloHit*> lhits(nHit);
45  for (i = 0, itr = hitcache.begin(); itr != hitcache.end(); i++, itr++) {
46  uint32_t unitID = itr->id();
47  int subdet, zside, group, ieta, iphi, lay;
48  HcalTestNumbering::unpackHcalIndex(unitID, subdet, zside, group, ieta, iphi, lay);
49  subdet = itr->det();
50  lay = itr->layer();
51  group = (subdet & 15) << 20;
52  group += ((lay - 1) & 31) << 15;
53  group += (zside & 1) << 14;
54  group += (ieta & 127) << 7;
55  group += (iphi & 127);
56  itr->setId(group);
57  lhits[i] = &hitcache[i];
58  LogDebug("HcalSim") << "HcalTestHistoClass::fillHits:Original " << i << " " << hitcache[i];
59  LogDebug("HcalSim") << "HcalTestHistoClass::fillHits:Copied " << i << " " << *lhits[i];
60  }
61  sort(lhits.begin(), lhits.end(), CaloHitIdMore());
62  std::vector<CaloHit*>::iterator k1, k2;
63  for (i = 0, k1 = lhits.begin(); k1 != lhits.end(); i++, k1++)
64  LogDebug("HcalSim") << "HcalTestHistoClass::fillHits:Sorted " << i << " " << **k1;
65 
66  hits.resize(lhits.size());
67  for (i = 0, k1 = lhits.begin(); k1 != lhits.end(); i++, k1++) {
68  double ehit = (**k1).e();
69  double jitter = (**k1).t();
70  unsigned int unitID = (**k1).id();
71  int jump = 0;
72  LogDebug("HcalSim") << "HcalTestHistoClass::fillHits:Start " << i << " U/T/E 0x" << std::hex << unitID << std::dec
73  << " " << jitter << " " << ehit;
74  for (k2 = k1 + 1;
75  k2 != lhits.end() && (jitter - (**k2).t()) < 1. && (jitter - (**k2).t()) > -1. && unitID == (**k2).id();
76  k2++) {
77  ehit += (**k2).e();
78  LogDebug("HcalSim") << " + " << (**k2).e();
79  jump++;
80  }
81  LogDebug("HcalSim") << " = " << ehit << " in " << jump;
82 
83  float eta = itr->eta();
84  float phi = itr->phi();
85  float t = itr->t();
86  int lay = ((unitID >> 15) & 31) + 1;
87 
88  hits[nHits].layer = lay;
89  hits[nHits].id = unitID;
90  hits[nHits].eta = eta;
91  hits[nHits].phi = phi;
92  hits[nHits].e = ehit;
93  hits[nHits].t = t;
94  hits[nHits].jitter = jitter;
95  nHits++;
96  hit++;
97 
98  int subdet = (unitID >> 20) & 15;
99  int zside = (unitID >> 14) & 1;
100  int ieta = (unitID >> 7) & 127;
101  int iphi = (unitID) & 127;
102  LogDebug("HcalSim") << "HcalTestHistoClass::fillHits:Hit " << hit << " " << i << " ID 0x" << std::hex << unitID
103  << std::dec << " " << subdet << " " << lay << " " << zside << " " << ieta << " " << iphi
104  << " Time " << jitter << " E " << ehit;
105 
106  i += jump;
107  k1 += jump;
108  }
109 
110  LogDebug("HcalSim") << "HcalTestHistoClass::fillHits called with " << nHit << " hits"
111  << " and writes out " << nHits << '(' << hit << ") hits";
112 }
int zside(DetId const &)
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
std::vector< Hit > hits
#define LogDebug(id)

◆ fillLayers()

void HcalTestHistoClass::fillLayers ( double  el[],
double  ho,
double  hbhe,
double  muxy[] 
)

Definition at line 22 of file HcalTestHistoClass.cc.

References eHBHE, eHO, mps_fire::i, layers, LogDebug, nLayers, and nLayersMAX.

22  {
23  nLayers = 0;
24  layers.resize(nLayersMAX);
25  for (int i = 0; i < 20; i++) {
26  double ed = 0.001 * edepl[i];
27  LogDebug("HcalSim") << "HcalTestHistoClass:: fillLayer: nLayers, ed " << i << " " << ed;
28  if (nLayers < nLayersMAX) {
29  layers[i].e = ed;
30  layers[i].muDist = muxy[i];
31  nLayers++;
32  }
33  }
34 
35  eHO = edepHO;
36  eHBHE = edepHBHE;
37 }
std::vector< Layer > layers
static const int nLayersMAX
#define LogDebug(id)

◆ fillQie()

void HcalTestHistoClass::fillQie ( int  id,
double  esimtot,
double  eqietot,
int  nGroup,
const std::vector< double > &  longs,
const std::vector< double > &  longq,
int  nTower,
const std::vector< double > &  latphi,
const std::vector< double > &  latfs,
const std::vector< double > &  latfq 
)

Definition at line 114 of file HcalTestHistoClass.cc.

References mps_fire::i, EcalPhiSymFlatTableProducers_cfi::id, createfilelist::int, LogDebug, nGroupQIE, nQIE, nTowerQIE, and qie.

123  {
124  nGroupQIE = 0;
125  nTowerQIE = 0;
126 
127  if (id >= 0 && id < 4) {
128  unsigned int qiesiz = (unsigned int)(id + 1);
129  if (qie.size() < qiesiz) {
130  qie.resize(qiesiz);
131  }
132 
133  qie[id].sim = esimtot;
134  qie[id].qie = eqietot;
135  qie[id].id = id;
136  nQIE++;
137 
138  LogDebug("HcalSim") << "HcalTestHistoClass::fillQie: id, esimtot, eqietot"
139  << " = " << id << " " << esimtot << " " << eqietot;
140 
141  for (int i = 0; i < nGroup; i++) {
142  LogDebug("HcalSim") << "HcalTestHistoClass::fillQie: id, nGroupQIE, "
143  << "longs, longq = " << id << " " << nGroupQIE << " " << longs[i] << " " << longq[i];
144  qie[id].lngs.push_back(longs[i]);
145  qie[id].lngq.push_back(longq[i]);
146  nGroupQIE++;
147  }
148 
149  for (int i = 0; i < nTower; i++) {
150  int tow = (int)latphi[i];
151  LogDebug("HcalSim") << "HcalTestHistoClass::fillQie: id, nTowerQIE, "
152  << "tower, latfs, latfq = " << id << " " << nTowerQIE << " " << tow << " " << latfs[i] << " "
153  << latfq[i];
154  qie[id].lats.push_back(latfs[i]);
155  qie[id].latq.push_back(latfq[i]);
156  qie[id].tow.push_back(tow);
157  nTowerQIE++;
158  }
159  }
160  LogDebug("HcalSim") << "HcalTestHistoClass::fillQie: Called with ID " << id << " nQIE " << nQIE << " nGroup "
161  << nGroupQIE << " nTower " << nTowerQIE;
162 }
std::vector< QIE > qie
#define LogDebug(id)

◆ setCounters()

void HcalTestHistoClass::setCounters ( )

Definition at line 14 of file HcalTestHistoClass.cc.

References nGroupQIE, nHits, nLayers, nQIE, and nTowerQIE.

Member Data Documentation

◆ eHBHE

float HcalTestHistoClass::eHBHE
private

Definition at line 65 of file HcalTestHistoClass.h.

Referenced by fillLayers().

◆ eHO

float HcalTestHistoClass::eHO
private

Definition at line 65 of file HcalTestHistoClass.h.

Referenced by fillLayers().

◆ hits

std::vector<Hit> HcalTestHistoClass::hits
private

Definition at line 68 of file HcalTestHistoClass.h.

Referenced by fillHits().

◆ layers

std::vector<Layer> HcalTestHistoClass::layers
private

Definition at line 64 of file HcalTestHistoClass.h.

Referenced by fillLayers().

◆ nGroupQIE

int HcalTestHistoClass::nGroupQIE
private

Definition at line 70 of file HcalTestHistoClass.h.

Referenced by fillQie(), and setCounters().

◆ nHits

int HcalTestHistoClass::nHits
private

Definition at line 67 of file HcalTestHistoClass.h.

Referenced by fillHits(), and setCounters().

◆ nLayers

int HcalTestHistoClass::nLayers
private

Definition at line 63 of file HcalTestHistoClass.h.

Referenced by fillLayers(), and setCounters().

◆ nLayersMAX

const int HcalTestHistoClass::nLayersMAX = 20
staticprivate

Definition at line 62 of file HcalTestHistoClass.h.

Referenced by fillLayers().

◆ nQIE

int HcalTestHistoClass::nQIE
private

Definition at line 70 of file HcalTestHistoClass.h.

Referenced by fillQie(), and setCounters().

◆ nTowerQIE

int HcalTestHistoClass::nTowerQIE
private

Definition at line 70 of file HcalTestHistoClass.h.

Referenced by fillQie(), and setCounters().

◆ qie

std::vector<QIE> HcalTestHistoClass::qie
private

Definition at line 71 of file HcalTestHistoClass.h.

Referenced by fillQie().