CMS 3D CMS Logo

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 MyElectronicsId &id, HistType ht, EventType et)
 
TH1 * GetAHistogram (const MyHcalDetId &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

◆ EventType

Enumerator
UNKNOWN 
PEDESTAL 
LED 
LASER 
BEAM 
NUMEVTTYPES 

Definition at line 11 of file HistoManager.h.

11 { UNKNOWN=0, PEDESTAL=1, LED=2, LASER=3, BEAM=4, NUMEVTTYPES=5 };

◆ HistType

Enumerator
ENERGY 
TIME 
PULSE 
ADC 
NUMHISTTYPES 

Definition at line 10 of file HistoManager.h.

10 { ENERGY=0, TIME=1, PULSE=2, ADC=3, NUMHISTTYPES=4 };

Constructor & Destructor Documentation

◆ HistoManager()

HistoManager::HistoManager ( TDirectory *  parent)

Definition at line 5 of file HistoManager.cc.

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 }

References beamHistDir, laserHistDir, ledHistDir, otherHistDir, class-composition::parent, and pedHistDir.

Member Function Documentation

◆ GetAHistogram() [1/2]

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

Definition at line 88 of file HistoManager.cc.

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 }

References BEAM, beamHistDir, runTauDisplay::eid, EgHLTOffHistBins_cfi::et, LASER, laserHistDir, LED, ledHistDir, Skims_PA_cff::name, nameForFlavor(), otherHistDir, PEDESTAL, pedHistDir, AlCaHLTBitMon_QueryRunRegistry::string, and UNKNOWN.

◆ GetAHistogram() [2/2]

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

Definition at line 36 of file HistoManager.cc.

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 }

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

◆ getDetIdsForType()

std::vector< MyHcalDetId > HistoManager::getDetIdsForType ( HistType  ht,
EventType  et 
)

Definition at line 132 of file HistoManager.cc.

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 }

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

◆ getElecIdsForType()

std::vector< MyElectronicsId > HistoManager::getElecIdsForType ( HistType  ht,
EventType  et 
)

Definition at line 185 of file HistoManager.cc.

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 }

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

◆ nameForEvent()

std::string HistoManager::nameForEvent ( EventType  et)
static

Definition at line 25 of file HistoManager.cc.

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 }

References BEAM, writedatasetfile::default, EgHLTOffHistBins_cfi::et, LASER, LED, and PEDESTAL.

◆ nameForFlavor()

std::string HistoManager::nameForFlavor ( HistType  ht)
static

Definition at line 14 of file HistoManager.cc.

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 }

References writedatasetfile::default, ENERGY, PULSE, and TIME.

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

Member Data Documentation

◆ beamHistDir

TDirectory* HistoManager::beamHistDir
private

Definition at line 34 of file HistoManager.h.

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

◆ laserHistDir

TDirectory* HistoManager::laserHistDir
private

Definition at line 33 of file HistoManager.h.

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

◆ ledHistDir

TDirectory* HistoManager::ledHistDir
private

Definition at line 32 of file HistoManager.h.

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

◆ m_writeMode

bool HistoManager::m_writeMode
private

Definition at line 30 of file HistoManager.h.

◆ otherHistDir

TDirectory* HistoManager::otherHistDir
private

Definition at line 35 of file HistoManager.h.

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

◆ pedHistDir

TDirectory* HistoManager::pedHistDir
private

Definition at line 31 of file HistoManager.h.

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

HistoManager::PULSE
Definition: HistoManager.h:10
HistoManager::PEDESTAL
Definition: HistoManager.h:11
HistoManager::ledHistDir
TDirectory * ledHistDir
Definition: HistoManager.h:32
MyHcalDetId::depth
int depth
Definition: MyHcalClasses.h:15
HistoManager::beamHistDir
TDirectory * beamHistDir
Definition: HistoManager.h:34
MyElectronicsId::Slot
int Slot
Definition: MyHcalClasses.h:26
MyHcalDetId::subdet
MyHcalSubdetector subdet
Definition: MyHcalClasses.h:12
HcalBarrel
Definition: HcalAssistant.h:33
HistoManager::laserHistDir
TDirectory * laserHistDir
Definition: HistoManager.h:33
MyElectronicsId::tb
char tb
Definition: MyHcalClasses.h:27
HistoManager::pedHistDir
TDirectory * pedHistDir
Definition: HistoManager.h:31
MyElectronicsId::fiber
int fiber
Definition: MyHcalClasses.h:22
MyElectronicsId
Definition: MyHcalClasses.h:20
HistoManager::TIME
Definition: HistoManager.h:10
MyHcalDetId::iphi
int iphi
Definition: MyHcalClasses.h:14
HistoManager::NUMEVTTYPES
Definition: HistoManager.h:11
MyHcalDetId::ieta
int ieta
Definition: MyHcalClasses.h:13
MyElectronicsId::crate
int crate
Definition: MyHcalClasses.h:24
ADC
Definition: ZdcTBAnalysis.h:46
HcalOuter
Definition: HcalAssistant.h:35
HistoManager::NUMHISTTYPES
Definition: HistoManager.h:10
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HistoManager::UNKNOWN
Definition: HistoManager.h:11
writedatasetfile.default
default
Definition: writedatasetfile.py:11
MyHcalDetId
Definition: MyHcalClasses.h:11
HistoManager::LASER
Definition: HistoManager.h:11
MyElectronicsId::fiberChan
int fiberChan
Definition: MyHcalClasses.h:23
HistoManager::nameForFlavor
static std::string nameForFlavor(HistType ht)
Definition: HistoManager.cc:14
runTauDisplay.eid
eid
Definition: runTauDisplay.py:298
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
HistoManager::LED
Definition: HistoManager.h:11
fileCollector2.converted
converted
Definition: fileCollector2.py:211
HcalForward
Definition: HcalAssistant.h:36
HistoManager::otherHistDir
TDirectory * otherHistDir
Definition: HistoManager.h:35
HistoManager::BEAM
Definition: HistoManager.h:11
HcalEndcap
Definition: HcalAssistant.h:34
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
HistoManager::ENERGY
Definition: HistoManager.h:10
class-composition.parent
parent
Definition: class-composition.py:88