CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
HistoManager Class Reference

#include <HistoManager.h>

Public Types

enum  EventType {
  UNKNOWN =0, PEDESTAL =1, LED =2, LASER =3,
  BEAM =4, NUMEVTTYPES =5
}
 
enum  HistType {
  ENERGY =0, TIME =1, PULSE =2, ADC =3,
  NUMHISTTYPES =4
}
 

Public Member Functions

TH1 * GetAHistogram (const MyHcalDetId &id, HistType ht, EventType et)
 
TH1 * GetAHistogram (const MyElectronicsId &id, HistType ht, EventType et)
 
std::vector< MyHcalDetIdgetDetIdsForType (HistType ht, EventType et)
 
std::vector< MyElectronicsIdgetElecIdsForType (HistType ht, EventType et)
 
 HistoManager (TDirectory *parent)
 

Static Public Member Functions

static std::string nameForEvent (EventType et)
 
static std::string nameForFlavor (HistType ht)
 

Private Attributes

TDirectory * beamHistDir
 
TDirectory * laserHistDir
 
TDirectory * ledHistDir
 
bool m_writeMode
 
TDirectory * otherHistDir
 
TDirectory * pedHistDir
 

Detailed Description

Definition at line 8 of file HistoManager.h.

Member Enumeration Documentation

Enumerator
UNKNOWN 
PEDESTAL 
LED 
LASER 
BEAM 
NUMEVTTYPES 

Definition at line 11 of file HistoManager.h.

Enumerator
ENERGY 
TIME 
PULSE 
ADC 
NUMHISTTYPES 

Definition at line 10 of file HistoManager.h.

Constructor & Destructor Documentation

HistoManager::HistoManager ( TDirectory *  parent)

Definition at line 5 of file HistoManager.cc.

References beamHistDir, laserHistDir, ledHistDir, otherHistDir, and pedHistDir.

6 {
7  pedHistDir = (TDirectory*)parent->Get("PEDESTAL");
8  ledHistDir = (TDirectory*)parent->Get("LED");
9  laserHistDir = (TDirectory*)parent->Get("LASER");
10  beamHistDir = (TDirectory*)parent->Get("BEAM");
11  otherHistDir = (TDirectory*)parent->Get("OTHER");
12 }
list parent
Definition: dbtoconf.py:74
TDirectory * laserHistDir
Definition: HistoManager.h:33
TDirectory * ledHistDir
Definition: HistoManager.h:32
TDirectory * pedHistDir
Definition: HistoManager.h:31
TDirectory * otherHistDir
Definition: HistoManager.h:35
TDirectory * beamHistDir
Definition: HistoManager.h:34

Member Function Documentation

TH1 * HistoManager::GetAHistogram ( const MyHcalDetId id,
HistType  ht,
EventType  et 
)

Definition at line 36 of file HistoManager.cc.

References BEAM, beamHistDir, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, LASER, laserHistDir, LED, ledHistDir, mergeVDriftHistosByStation::name, nameForFlavor(), otherHistDir, PEDESTAL, pedHistDir, AlCaHLTBitMon_QueryRunRegistry::string, and UNKNOWN.

39 {
40  std::string flavor=nameForFlavor(ht);
41  TDirectory* td;
42 
43  switch (et) {
44  case(PEDESTAL) : td=pedHistDir; break;
45  case(LED) : td=ledHistDir; break;
46  case(LASER) : td=laserHistDir; break;
47  case(BEAM) : td=beamHistDir; break;
48  case(UNKNOWN) : td=otherHistDir; break;
49  default : td=0; break;
50  }
51 
52  if (!td) {
53  printf("Event type not known, et=%d\n", et);
54  return 0;
55  }
56 
57  char name[120];
58 
59  std::string subdetStr;
60  switch (id.subdet) {
61  case (HcalBarrel) : subdetStr="HB"; break;
62  case (HcalEndcap) : subdetStr="HE"; break;
63  case (HcalOuter) : subdetStr="HO"; break;
64  case (HcalForward) : subdetStr="HF"; break;
65  default : subdetStr="Other"; break;
66  }
67 
68  TH1* retval=0;
69  sprintf(name,"%s_%s_%d_%d_%d",
70  flavor.c_str(),subdetStr.c_str(),id.ieta,id.iphi,id.depth);
71 
72  TList* keyList = td->GetListOfKeys();
73 
74  for(int keyindex = 0; keyindex<keyList->GetEntries(); ++keyindex) {
75  std::string keyname = keyList->At(keyindex)->GetName();
76  if (strstr(keyname.c_str(),name)) {
77  retval=(TH1*)td->Get(keyname.c_str());
78  break;
79  }
80  }
81 
82  return retval;
83 }
TDirectory * laserHistDir
Definition: HistoManager.h:33
TDirectory * ledHistDir
Definition: HistoManager.h:32
TDirectory * pedHistDir
Definition: HistoManager.h:31
TDirectory * otherHistDir
Definition: HistoManager.h:35
static std::string nameForFlavor(HistType ht)
Definition: HistoManager.cc:14
TDirectory * beamHistDir
Definition: HistoManager.h:34
TH1 * HistoManager::GetAHistogram ( const MyElectronicsId id,
HistType  ht,
EventType  et 
)

Definition at line 88 of file HistoManager.cc.

References BEAM, beamHistDir, MyElectronicsId::crate, MyElectronicsId::fiber, MyElectronicsId::fiberChan, LASER, laserHistDir, LED, ledHistDir, mergeVDriftHistosByStation::name, nameForFlavor(), otherHistDir, PEDESTAL, pedHistDir, MyElectronicsId::Slot, AlCaHLTBitMon_QueryRunRegistry::string, MyElectronicsId::tb, and UNKNOWN.

91 {
92  std::string flavor=nameForFlavor(ht);
93  TDirectory* td;
94 
95  switch (et) {
96  case(PEDESTAL): td=pedHistDir; break;
97  case(LED): td=ledHistDir; break;
98  case(LASER): td=laserHistDir; break;
99  case(BEAM): td=beamHistDir; break;
100  case(UNKNOWN): td=otherHistDir; break;
101  default: td=0; break;
102  }
103 
104  if (td==0) {
105  printf("Unknown %d !\n", et);
106  return 0;
107  }
108 
109  char name[120];
110 
111 
112  char topbot;
113  if (eid.tb==0){topbot = 'b';}
114  else{topbot='t';}
115  TH1* retval=0;
116  sprintf(name,"%d_%d_HTR_%d:%d%c",
117  eid.fiber, eid.fiberChan, eid.crate, eid.Slot,topbot);
118  TList* keyList = td->GetListOfKeys();
119 
120  for(int keyindex = 0; keyindex<keyList->GetEntries(); ++keyindex) {
121  std::string keyname = keyList->At(keyindex)->GetName();
122  if ((strstr(keyname.c_str(),name))&&(strstr(keyname.c_str(),flavor.c_str()))) {
123  retval=(TH1*)td->Get(keyname.c_str());
124  break;
125  }
126  }
127 
128  return retval;
129 }
TDirectory * laserHistDir
Definition: HistoManager.h:33
TDirectory * ledHistDir
Definition: HistoManager.h:32
TDirectory * pedHistDir
Definition: HistoManager.h:31
TDirectory * otherHistDir
Definition: HistoManager.h:35
static std::string nameForFlavor(HistType ht)
Definition: HistoManager.cc:14
TDirectory * beamHistDir
Definition: HistoManager.h:34
std::vector< MyHcalDetId > HistoManager::getDetIdsForType ( HistType  ht,
EventType  et 
)

Definition at line 132 of file HistoManager.cc.

References BEAM, beamHistDir, MyHcalDetId::depth, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, MyHcalDetId::ieta, if(), MyHcalDetId::iphi, LASER, laserHistDir, LED, ledHistDir, nameForFlavor(), otherHistDir, PEDESTAL, pedHistDir, AlCaHLTBitMon_QueryRunRegistry::string, MyHcalDetId::subdet, and UNKNOWN.

134 {
135  char keyflavor[100];
136  char keysubDet[100];
137  MyHcalDetId mydetid;
138  TDirectory* td;
139  TList* keyList;
140  std::vector<MyHcalDetId> retvals;
141 
142  std::string flavor=nameForFlavor(ht);
143 
144  switch (et) {
145  case(PEDESTAL) : td=pedHistDir; break;
146  case(LED) : td=ledHistDir; break;
147  case(LASER) : td=laserHistDir; break;
148  case(BEAM) : td=beamHistDir; break;
149  case(UNKNOWN) : td=otherHistDir; break;
150  default : td=0; break;
151  }
152 
153  if (!td) {
154  printf("Event type not known, et=%d\n", et);
155  return retvals;
156  }
157 
158  keyList = td->GetListOfKeys();
159 
160  for(int keyindex = 0; keyindex<keyList->GetEntries(); ++keyindex) {
161  int converted;
162  std::string keyname = keyList->At(keyindex)->GetName();
163  // cout << keyindex << " " << keyname << endl;
164  while (keyname.find("_")!=std::string::npos)
165  keyname.replace(keyname.find("_"),1," ");
166  converted = sscanf(keyname.c_str(),"%s %s %d %d %d",
167  keyflavor,keysubDet,
168  &mydetid.ieta,&mydetid.iphi,&mydetid.depth);
169  if( (flavor==keyflavor) && (converted==5) ) {
170  if (!strcmp(keysubDet,"HB")) mydetid.subdet=HcalBarrel;
171  else if (!strcmp(keysubDet,"HE")) mydetid.subdet=HcalEndcap;
172  else if (!strcmp(keysubDet,"HO")) mydetid.subdet=HcalOuter;
173  else if (!strcmp(keysubDet,"HF")) mydetid.subdet=HcalForward;
174  else continue; // and do not include this in the list!
175 
176  retvals.push_back(mydetid);
177  }
178  }
179 
180 
181  return retvals;
182 }
MyHcalSubdetector subdet
Definition: MyHcalClasses.h:12
TDirectory * laserHistDir
Definition: HistoManager.h:33
TDirectory * ledHistDir
Definition: HistoManager.h:32
TDirectory * pedHistDir
Definition: HistoManager.h:31
TDirectory * otherHistDir
Definition: HistoManager.h:35
static std::string nameForFlavor(HistType ht)
Definition: HistoManager.cc:14
if(conf.exists("allCellsPositionCalc"))
TDirectory * beamHistDir
Definition: HistoManager.h:34
std::vector< MyElectronicsId > HistoManager::getElecIdsForType ( HistType  ht,
EventType  et 
)

Definition at line 185 of file HistoManager.cc.

References BEAM, beamHistDir, MyElectronicsId::crate, MyElectronicsId::fiber, MyElectronicsId::fiberChan, LASER, laserHistDir, LED, ledHistDir, nameForFlavor(), otherHistDir, PEDESTAL, pedHistDir, MyElectronicsId::Slot, AlCaHLTBitMon_QueryRunRegistry::string, MyElectronicsId::tb, and UNKNOWN.

187 {
188  char keyflavor[100];
189  char keysubDet[100];
190  MyElectronicsId mydeteid;
191  TDirectory* td;
192  TList* keyList;
193  std::vector<MyElectronicsId> retvals;
194 
195  std::string flavor=nameForFlavor(ht);
196 
197  switch (et) {
198  case(PEDESTAL): td=pedHistDir; break;
199  case(LED): td=ledHistDir; break;
200  case(LASER): td=laserHistDir; break;
201  case(BEAM): td=beamHistDir; break;
202  case(UNKNOWN): td=otherHistDir; break;
203  default: td=0; break;
204  }
205  if (!td) {
206  printf("Event type not known, et=%d\n", et);
207  return retvals;
208  }
209 
210  keyList = td->GetListOfKeys();
211  if (keyList==0) return retvals;
212 
213  for(int keyindex = 0; keyindex<keyList->GetEntries(); ++keyindex) {
214  int converted;
215  std::string keyname = keyList->At(keyindex)->GetName();
216  while (keyname.find("_")!=std::string::npos)
217  keyname.replace(keyname.find("_"),1," ");
218  char bottop;
219 
220  //printf("%s\n",keyname.c_str());
221 
222  if(strstr(keyname.c_str(),"CALIB")){
223  converted = sscanf(keyname.c_str(),"%s %*s %s %*d %*d chan=%*s eid=%*d %*d %d %d HTR %d:%d%c ",
224  keyflavor,keysubDet, &mydeteid.fiber,&mydeteid.fiberChan,&mydeteid.crate,&mydeteid.Slot,&bottop);
225 
226  if (bottop=='t')
227  {mydeteid.tb=1;}
228  else
229  {mydeteid.tb=0;}
230 
231  // printf("%d converts to %d %d %d %d %c\n",converted,mydeteid.fiber,mydeteid.fiberChan,mydeteid.crate,mydeteid.Slot,bottop);
232 
233  }else{
234  converted = sscanf(keyname.c_str(),"%s %s %*d %*d %*d eid=%*d %*d %d %d HTR %d:%d%c ",
235  keyflavor,keysubDet, &mydeteid.fiber,&mydeteid.fiberChan,&mydeteid.crate,&mydeteid.Slot,&bottop);
236 
237 
238  if (bottop=='t')
239  {mydeteid.tb=1;}
240  else
241  {mydeteid.tb=0;}
242  }
243  //printf("converts to %d %d %d %d %d\n",mydeteid.fiber,mydeteid.fiberChan,mydeteid.crate,mydeteid.Slot,mydeteid.tb);
244 
245 
246  if( (flavor==keyflavor) && (converted==7) )
247 
248  retvals.push_back(mydeteid);
249 
250  }
251 
252 
253  return retvals;
254 }
TDirectory * laserHistDir
Definition: HistoManager.h:33
TDirectory * ledHistDir
Definition: HistoManager.h:32
TDirectory * pedHistDir
Definition: HistoManager.h:31
TDirectory * otherHistDir
Definition: HistoManager.h:35
static std::string nameForFlavor(HistType ht)
Definition: HistoManager.cc:14
TDirectory * beamHistDir
Definition: HistoManager.h:34
std::string HistoManager::nameForEvent ( EventType  et)
static

Definition at line 25 of file HistoManager.cc.

References BEAM, LASER, LED, and PEDESTAL.

26 {
27  switch(et) {
28  case(PEDESTAL) : return "Pedestal"; break;
29  case(LED) : return "LED"; break;
30  case(LASER) : return "Laser"; break;
31  case(BEAM) : return "Beam"; break;
32  default : return "Other"; break;
33  }
34 }
std::string HistoManager::nameForFlavor ( HistType  ht)
static

Definition at line 14 of file HistoManager.cc.

References ENERGY, PULSE, and TIME.

Referenced by GetAHistogram(), getDetIdsForType(), and getElecIdsForType().

15 {
16  switch (ht) {
17  case(ENERGY) : return "Energy"; break;
18  case(TIME) : return "Time"; break;
19  case(PULSE) : return "Pulse"; break;
20  case(ADC) : return "ADC"; break;
21  default : return ""; break;
22  }
23 }

Member Data Documentation

TDirectory* HistoManager::beamHistDir
private

Definition at line 34 of file HistoManager.h.

Referenced by GetAHistogram(), getDetIdsForType(), getElecIdsForType(), and HistoManager().

TDirectory* HistoManager::laserHistDir
private

Definition at line 33 of file HistoManager.h.

Referenced by GetAHistogram(), getDetIdsForType(), getElecIdsForType(), and HistoManager().

TDirectory* HistoManager::ledHistDir
private

Definition at line 32 of file HistoManager.h.

Referenced by GetAHistogram(), getDetIdsForType(), getElecIdsForType(), and HistoManager().

bool HistoManager::m_writeMode
private

Definition at line 30 of file HistoManager.h.

TDirectory* HistoManager::otherHistDir
private

Definition at line 35 of file HistoManager.h.

Referenced by GetAHistogram(), getDetIdsForType(), getElecIdsForType(), and HistoManager().

TDirectory* HistoManager::pedHistDir
private

Definition at line 31 of file HistoManager.h.

Referenced by GetAHistogram(), getDetIdsForType(), getElecIdsForType(), and HistoManager().