CMS 3D CMS Logo

HistoManager Class Reference

#include <RecoTBCalo/HcalPlotter/scripts/HistoManager.h>

List of all members.

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

enum HistoManager::EventType

Enumerator:
UNKNOWN 
PEDESTAL 
LED 
LASER 
BEAM 
NUMEVTTYPES 

Definition at line 11 of file HistoManager.h.

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

enum HistoManager::HistType

Enumerator:
ENERGY 
TIME 
PULSE 
ADC 
NUMHISTTYPES 

Definition at line 10 of file HistoManager.h.

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


Constructor & Destructor Documentation

HistoManager::HistoManager ( TDirectory *  parent  ) 

Definition at line 5 of file HistoManager.cc.

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

00006 {
00007   pedHistDir   = (TDirectory*)parent->Get("PEDESTAL");
00008   ledHistDir   = (TDirectory*)parent->Get("LED");
00009   laserHistDir = (TDirectory*)parent->Get("LASER");
00010   beamHistDir  = (TDirectory*)parent->Get("BEAM");
00011   otherHistDir = (TDirectory*)parent->Get("OTHER");
00012 }


Member Function Documentation

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, name, nameForFlavor(), otherHistDir, PEDESTAL, pedHistDir, MyElectronicsId::Slot, MyElectronicsId::tb, getDQMSummary::td, and UNKNOWN.

00091 {
00092   std::string flavor=nameForFlavor(ht);
00093   TDirectory* td;
00094 
00095   switch (et) {
00096   case(PEDESTAL): td=pedHistDir; break;
00097   case(LED): td=ledHistDir; break;
00098   case(LASER): td=laserHistDir; break;
00099   case(BEAM): td=beamHistDir; break;
00100   case(UNKNOWN): td=otherHistDir; break;
00101   default: td=0; break;
00102   }
00103 
00104   if (td==0) {
00105     printf("Unknown %d !\n", et);
00106     return 0;
00107   }
00108 
00109   char name[120];
00110 
00111 
00112   char topbot;
00113   if (eid.tb==0){topbot = 'b';}
00114   else{topbot='t';}
00115   TH1* retval=0;
00116   sprintf(name,"%d_%d_HTR_%d:%d%c",
00117           eid.fiber, eid.fiberChan, eid.crate, eid.Slot,topbot);
00118   TList* keyList = td->GetListOfKeys();
00119   
00120   for(int keyindex = 0; keyindex<keyList->GetEntries(); ++keyindex) {
00121     std::string keyname = keyList->At(keyindex)->GetName();
00122     if ((strstr(keyname.c_str(),name))&&(strstr(keyname.c_str(),flavor.c_str()))) {
00123       retval=(TH1*)td->Get(keyname.c_str());
00124       break;
00125     }
00126   }
00127 
00128   return retval;
00129 }

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, name, nameForFlavor(), otherHistDir, PEDESTAL, pedHistDir, getDQMSummary::td, and UNKNOWN.

00039 {
00040   std::string flavor=nameForFlavor(ht);
00041   TDirectory* td;
00042 
00043   switch (et) {
00044   case(PEDESTAL) : td=pedHistDir;   break;
00045   case(LED)      : td=ledHistDir;   break;
00046   case(LASER)    : td=laserHistDir; break;
00047   case(BEAM)     : td=beamHistDir;  break;
00048   case(UNKNOWN)  : td=otherHistDir; break;
00049   default        : td=0;            break;
00050   }
00051 
00052   if (!td) {
00053     printf("Event type not known, et=%d\n", et);
00054     return 0;
00055   }
00056 
00057   char name[120];
00058 
00059   std::string subdetStr;
00060   switch (id.subdet) {
00061   case (HcalBarrel)  : subdetStr="HB"; break;
00062   case (HcalEndcap)  : subdetStr="HE"; break;
00063   case (HcalOuter)   : subdetStr="HO"; break;
00064   case (HcalForward) : subdetStr="HF"; break;
00065   default            : subdetStr="Other"; break;
00066   }
00067 
00068   TH1* retval=0;
00069   sprintf(name,"%s_%s_%d_%d_%d",
00070           flavor.c_str(),subdetStr.c_str(),id.ieta,id.iphi,id.depth);
00071 
00072   TList* keyList = td->GetListOfKeys();
00073   
00074   for(int keyindex = 0; keyindex<keyList->GetEntries(); ++keyindex) {
00075     std::string keyname = keyList->At(keyindex)->GetName();
00076     if (strstr(keyname.c_str(),name)) {
00077       retval=(TH1*)td->Get(keyname.c_str());
00078       break;
00079     }
00080   }
00081 
00082   return retval;
00083 }

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, MyHcalDetId::subdet, getDQMSummary::td, and UNKNOWN.

00134 {
00135   char keyflavor[100];
00136   char keysubDet[100];
00137   MyHcalDetId mydetid;
00138   TDirectory* td;
00139   TList* keyList;
00140   std::vector<MyHcalDetId> retvals;
00141 
00142   std::string flavor=nameForFlavor(ht);
00143 
00144   switch (et) {
00145   case(PEDESTAL) : td=pedHistDir;   break;
00146   case(LED)      : td=ledHistDir;   break;
00147   case(LASER)    : td=laserHistDir; break;
00148   case(BEAM)     : td=beamHistDir;  break;
00149   case(UNKNOWN)  : td=otherHistDir; break;
00150   default        : td=0;            break;
00151   }
00152 
00153   if (!td) {
00154     printf("Event type not known, et=%d\n", et);
00155     return retvals;
00156   }
00157 
00158   keyList = td->GetListOfKeys();
00159   
00160   for(int keyindex = 0; keyindex<keyList->GetEntries(); ++keyindex) {
00161     int converted;
00162     std::string keyname = keyList->At(keyindex)->GetName();
00163     // cout << keyindex << " " << keyname << endl;
00164     while (keyname.find("_")!=std::string::npos)
00165       keyname.replace(keyname.find("_"),1," ");
00166     converted = sscanf(keyname.c_str(),"%s %s %d %d %d",
00167                        keyflavor,keysubDet,
00168                        &mydetid.ieta,&mydetid.iphi,&mydetid.depth);
00169     if( (flavor==keyflavor) && (converted==5) ) {
00170       if (!strcmp(keysubDet,"HB")) mydetid.subdet=HcalBarrel;
00171       else if (!strcmp(keysubDet,"HE")) mydetid.subdet=HcalEndcap;
00172       else if (!strcmp(keysubDet,"HO")) mydetid.subdet=HcalOuter;
00173       else if (!strcmp(keysubDet,"HF")) mydetid.subdet=HcalForward;
00174       else continue; // and do not include this in the list!
00175 
00176       retvals.push_back(mydetid);
00177     }
00178   }
00179 
00180 
00181   return retvals;
00182 }

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, MyElectronicsId::tb, getDQMSummary::td, and UNKNOWN.

00187 {
00188   char keyflavor[100];
00189   char keysubDet[100];
00190   MyElectronicsId mydeteid;
00191   TDirectory* td;
00192   TList* keyList;
00193   std::vector<MyElectronicsId> retvals;
00194 
00195   std::string flavor=nameForFlavor(ht);
00196 
00197   switch (et) {
00198   case(PEDESTAL): td=pedHistDir; break;
00199   case(LED): td=ledHistDir; break;
00200   case(LASER): td=laserHistDir; break;
00201   case(BEAM): td=beamHistDir; break;
00202   case(UNKNOWN): td=otherHistDir; break;
00203   default: td=0; break;
00204   }
00205   if (!td) {
00206     printf("Event type not known, et=%d\n", et);
00207     return retvals;
00208   }
00209 
00210   keyList = td->GetListOfKeys();
00211   if (keyList==0) return retvals;
00212   
00213   for(int keyindex = 0; keyindex<keyList->GetEntries(); ++keyindex) {
00214     int converted;
00215     std::string keyname = keyList->At(keyindex)->GetName();
00216     while (keyname.find("_")!=std::string::npos)
00217       keyname.replace(keyname.find("_"),1," ");
00218     char bottop;
00219     
00220     //printf("%s\n",keyname.c_str());
00221  
00222     if(strstr(keyname.c_str(),"CALIB")){
00223        converted = sscanf(keyname.c_str(),"%s %*s %s %*d %*d chan=%*s eid=%*d %*d %d %d HTR %d:%d%c ",
00224                           keyflavor,keysubDet, &mydeteid.fiber,&mydeteid.fiberChan,&mydeteid.crate,&mydeteid.Slot,&bottop);
00225             
00226    if (bottop=='t')
00227       {mydeteid.tb=1;}
00228     else
00229       {mydeteid.tb=0;} 
00230 
00231    // printf("%d converts to %d %d %d %d %c\n",converted,mydeteid.fiber,mydeteid.fiberChan,mydeteid.crate,mydeteid.Slot,bottop);
00232 
00233     }else{
00234       converted = sscanf(keyname.c_str(),"%s %s %*d %*d %*d eid=%*d %*d %d %d HTR %d:%d%c ",
00235                          keyflavor,keysubDet, &mydeteid.fiber,&mydeteid.fiberChan,&mydeteid.crate,&mydeteid.Slot,&bottop);
00236       
00237         
00238     if (bottop=='t')
00239       {mydeteid.tb=1;}
00240     else
00241       {mydeteid.tb=0;}
00242     }
00243     //printf("converts to %d %d %d %d %d\n",mydeteid.fiber,mydeteid.fiberChan,mydeteid.crate,mydeteid.Slot,mydeteid.tb);
00244 
00245 
00246     if( (flavor==keyflavor) && (converted==7) )
00247 
00248       retvals.push_back(mydeteid);
00249     
00250   }
00251 
00252   
00253   return retvals;
00254 }

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

Definition at line 25 of file HistoManager.cc.

References BEAM, LASER, LED, and PEDESTAL.

00026 {
00027   switch(et) {
00028   case(PEDESTAL) : return "Pedestal"; break;
00029   case(LED)      : return "LED";      break;
00030   case(LASER)    : return "Laser";    break;
00031   case(BEAM)     : return "Beam";     break;
00032   default        : return "Other";    break;
00033   }     
00034 }

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().

00015 {
00016   switch (ht) {
00017   case(ENERGY) : return "Energy"; break;
00018   case(TIME)   : return "Time";   break;
00019   case(PULSE)  : return "Pulse";  break;
00020   case(ADC)    : return "ADC";    break;
00021   default      : return "";       break;
00022   }
00023 }


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().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:24:16 2009 for CMSSW by  doxygen 1.5.4