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 16 of file HcalTestHistoClass.h.

Constructor & Destructor Documentation

HcalTestHistoClass::HcalTestHistoClass ( int  i)
inline

Definition at line 18 of file HcalTestHistoClass.h.

18 {}
HcalTestHistoClass::HcalTestHistoClass ( )
inlineexplicit

Definition at line 19 of file HcalTestHistoClass.h.

19 {}
virtual HcalTestHistoClass::~HcalTestHistoClass ( )
inlinevirtual

Member Function Documentation

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

Definition at line 38 of file HcalTestHistoClass.cc.

References TauDecayModes::dec, PVValHelper::eta, edmIntegrityCheck::group, hits, mps_fire::i, LogDebug, nHits, phi, jetUpdater_cfi::sort, protons_cff::t, HcalTestNumbering::unpackHcalIndex(), and ecaldqm::zside().

Referenced by HcalTestAnalysis::qieAnalysis(), and ~HcalTestHistoClass().

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

Definition at line 21 of file HcalTestHistoClass.cc.

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

Referenced by HcalTestAnalysis::layerAnalysis(), and ~HcalTestHistoClass().

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

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

Referenced by HcalTestAnalysis::qieAnalysis(), and ~HcalTestHistoClass().

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

Definition at line 13 of file HcalTestHistoClass.cc.

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

Referenced by HcalTestAnalysis::update(), and ~HcalTestHistoClass().

Member Data Documentation

float HcalTestHistoClass::eHBHE
private

Definition at line 67 of file HcalTestHistoClass.h.

Referenced by fillLayers().

float HcalTestHistoClass::eHO
private

Definition at line 67 of file HcalTestHistoClass.h.

Referenced by fillLayers().

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

Definition at line 70 of file HcalTestHistoClass.h.

Referenced by fillHits().

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

Definition at line 66 of file HcalTestHistoClass.h.

Referenced by fillLayers().

int HcalTestHistoClass::nGroupQIE
private

Definition at line 72 of file HcalTestHistoClass.h.

Referenced by fillQie(), and setCounters().

int HcalTestHistoClass::nHits
private

Definition at line 69 of file HcalTestHistoClass.h.

Referenced by fillHits(), and setCounters().

int HcalTestHistoClass::nLayers
private

Definition at line 65 of file HcalTestHistoClass.h.

Referenced by fillLayers(), and setCounters().

const int HcalTestHistoClass::nLayersMAX = 20
staticprivate

Definition at line 64 of file HcalTestHistoClass.h.

Referenced by fillLayers().

int HcalTestHistoClass::nQIE
private

Definition at line 72 of file HcalTestHistoClass.h.

Referenced by fillQie(), and setCounters().

int HcalTestHistoClass::nTowerQIE
private

Definition at line 72 of file HcalTestHistoClass.h.

Referenced by fillQie(), and setCounters().

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

Definition at line 73 of file HcalTestHistoClass.h.

Referenced by fillQie().