CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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, std::vector< double > longs, std::vector< double > longq, int nTower, std::vector< double > latphi, std::vector< double > latfs, 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 20 of file HcalTestHistoClass.h.

20 {}
HcalTestHistoClass::HcalTestHistoClass ( )
inlineexplicit

Definition at line 21 of file HcalTestHistoClass.h.

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

Definition at line 22 of file HcalTestHistoClass.h.

22 {}

Member Function Documentation

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

Definition at line 41 of file HcalTestHistoClass.cc.

References eta(), hits, i, LogDebug, nHits, phi, python.multivaluedict::sort(), lumiQTWidget::t, and HcalTestNumbering::unpackHcalIndex().

Referenced by HcalTestAnalysis::qieAnalysis().

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

Definition at line 21 of file HcalTestHistoClass.cc.

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

Referenced by HcalTestAnalysis::layerAnalysis().

22  {
23 
24  nLayers = 0;
25  layers.resize(nLayersMAX);
26  for (int i = 0; i < 20; i++) {
27  double ed = 0.001*edepl[i];
28  LogDebug("HcalSim") << "HcalTestHistoClass:: fillLayer: nLayers, ed " << i
29  << " " << ed;
30  if (nLayers < nLayersMAX) {
31  layers[i].e = ed;
32  layers[i].muDist = muxy[i];
33  nLayers++;
34  }
35  }
36 
37  eHO = edepHO;
38  eHBHE = edepHBHE;
39 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< Layer > layers
static const int nLayersMAX
void HcalTestHistoClass::fillQie ( int  id,
double  esimtot,
double  eqietot,
int  nGroup,
std::vector< double >  longs,
std::vector< double >  longq,
int  nTower,
std::vector< double >  latphi,
std::vector< double >  latfs,
std::vector< double >  latfq 
)

Definition at line 125 of file HcalTestHistoClass.cc.

References i, errorMatrix2Lands_multiChannel::id, LogDebug, nGroupQIE, nQIE, nTowerQIE, and qie.

Referenced by HcalTestAnalysis::qieAnalysis().

130  {
131 
132  nGroupQIE = 0;
133  nTowerQIE = 0;
134 
135  if (id>=0 && id<4) {
136  unsigned int qiesiz = (unsigned int)(id+1);
137  if (qie.size()<qiesiz) {
138  qie.resize(qiesiz);
139  }
140 
141  qie[id].sim=esimtot;
142  qie[id].qie=eqietot;
143  qie[id].id = id;
144  nQIE++;
145 
146  LogDebug("HcalSim") << "HcalTestHistoClass::fillQie: id, esimtot, eqietot"
147  << " = " << id << " " << esimtot << " " << eqietot;
148 
149  for (int i=0; i<nGroup; i++) {
150  LogDebug("HcalSim") << "HcalTestHistoClass::fillQie: id, nGroupQIE, "
151  << "longs, longq = " << id << " " << nGroupQIE
152  << " " << longs[i] << " " << longq[i];
153  qie[id].lngs.push_back(longs[i]);
154  qie[id].lngq.push_back(longq[i]);
155  nGroupQIE++;
156  }
157 
158  for (int i=0; i<nTower; i++) {
159  int tow = (int)latphi[i];
160  LogDebug("HcalSim") << "HcalTestHistoClass::fillQie: id, nTowerQIE, "
161  << "tower, latfs, latfq = " << id << " " << nTowerQIE
162  << " " << tow << " " << latfs[i] << " " << latfq[i];
163  qie[id].lats.push_back(latfs[i]);
164  qie[id].latq.push_back(latfq[i]);
165  qie[id].tow.push_back(tow);
166  nTowerQIE++;
167  }
168  }
169  LogDebug("HcalSim") << "HcalTestHistoClass::fillQie: Called with ID " << id
170  << " nQIE " << nQIE << " nGroup " << nGroupQIE
171  << " nTower " << nTowerQIE;
172 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
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().

Member Data Documentation

float HcalTestHistoClass::eHBHE
private

Definition at line 64 of file HcalTestHistoClass.h.

Referenced by fillLayers().

float HcalTestHistoClass::eHO
private

Definition at line 64 of file HcalTestHistoClass.h.

Referenced by fillLayers().

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

Definition at line 67 of file HcalTestHistoClass.h.

Referenced by fillHits().

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

Definition at line 63 of file HcalTestHistoClass.h.

Referenced by fillLayers().

int HcalTestHistoClass::nGroupQIE
private

Definition at line 69 of file HcalTestHistoClass.h.

Referenced by fillQie(), and setCounters().

int HcalTestHistoClass::nHits
private

Definition at line 66 of file HcalTestHistoClass.h.

Referenced by fillHits(), and setCounters().

int HcalTestHistoClass::nLayers
private

Definition at line 62 of file HcalTestHistoClass.h.

Referenced by fillLayers(), and setCounters().

const int HcalTestHistoClass::nLayersMAX = 20
staticprivate

Definition at line 61 of file HcalTestHistoClass.h.

Referenced by fillLayers().

int HcalTestHistoClass::nQIE
private

Definition at line 69 of file HcalTestHistoClass.h.

Referenced by fillQie(), and setCounters().

int HcalTestHistoClass::nTowerQIE
private

Definition at line 69 of file HcalTestHistoClass.h.

Referenced by fillQie(), and setCounters().

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

Definition at line 70 of file HcalTestHistoClass.h.

Referenced by fillQie().