CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/CondFormats/HcalObjects/src/HcalLogicalMap.cc

Go to the documentation of this file.
00001 #include "DataFormats/HcalDetId/interface/HcalGenericDetId.h"
00002 #include "DataFormats/HcalDetId/interface/HcalOtherDetId.h"
00003 
00004 #include "CondFormats/HcalObjects/interface/HcalLogicalMap.h"
00005 
00006 #include <string>
00007 #include <cstring>
00008 #include <iostream>
00009 #include <fstream>
00010 #include <sstream>
00011 #include <stdio.h>
00012 #include <time.h>
00013 
00014 using namespace std;
00015 
00016 HcalLogicalMap::HcalLogicalMap(std::vector<HBHEHFLogicalMapEntry>& HBHEHFEntries,
00017                                std::vector<HOHXLogicalMapEntry>& HOHXEntries,
00018                                std::vector<CALIBLogicalMapEntry>& CALIBEntries,
00019                                std::vector<ZDCLogicalMapEntry>& ZDCEntries,
00020                                std::vector<HTLogicalMapEntry>& HTEntries,
00021                                std::vector<uint32_t>& LinearIndex2Entry,
00022                                std::vector<uint32_t>& HbHash2Entry,
00023                                std::vector<uint32_t>& HeHash2Entry,
00024                                std::vector<uint32_t>& HfHash2Entry,
00025                                std::vector<uint32_t>& HtHash2Entry,
00026                                std::vector<uint32_t>& HoHash2Entry,
00027                                std::vector<uint32_t>& HxCalibHash2Entry,
00028                                std::vector<uint32_t>& ZdcHash2Entry)
00029 
00030 {
00031   HBHEHFEntries_.resize(HBHEHFEntries.size());
00032   HOHXEntries_.resize(HOHXEntries.size());
00033   CALIBEntries_.resize(CALIBEntries.size());
00034   ZDCEntries_.resize(ZDCEntries.size());
00035   HTEntries_.resize(HTEntries.size());
00036 
00037   LinearIndex2Entry_.resize(LinearIndex2Entry.size());
00038   HbHash2Entry_.resize(HbHash2Entry.size());
00039   HeHash2Entry_.resize(HeHash2Entry.size());
00040   HfHash2Entry_.resize(HfHash2Entry.size());
00041   HtHash2Entry_.resize(HtHash2Entry.size());
00042   HoHash2Entry_.resize(HoHash2Entry.size());
00043   HxCalibHash2Entry_.resize(HxCalibHash2Entry.size());
00044   ZdcHash2Entry_.resize(ZdcHash2Entry.size());
00045   
00046   copy(HBHEHFEntries.begin(),HBHEHFEntries.end(),HBHEHFEntries_.begin());
00047   copy(HOHXEntries.begin(),HOHXEntries.end(),HOHXEntries_.begin());
00048   copy(CALIBEntries.begin(),CALIBEntries.end(),CALIBEntries_.begin());
00049   copy(ZDCEntries.begin(),ZDCEntries.end(),ZDCEntries_.begin());
00050   copy(HTEntries.begin(),HTEntries.end(),HTEntries_.begin());
00051   copy(LinearIndex2Entry.begin(),LinearIndex2Entry.end(),LinearIndex2Entry_.begin());
00052   copy(HbHash2Entry.begin(),HbHash2Entry.end(),HbHash2Entry_.begin());
00053   copy(HeHash2Entry.begin(),HeHash2Entry.end(),HeHash2Entry_.begin());
00054   copy(HfHash2Entry.begin(),HfHash2Entry.end(),HfHash2Entry_.begin());
00055   copy(HtHash2Entry.begin(),HtHash2Entry.end(),HtHash2Entry_.begin());
00056   copy(HoHash2Entry.begin(),HoHash2Entry.end(),HoHash2Entry_.begin());
00057   copy(HxCalibHash2Entry.begin(),HxCalibHash2Entry.end(),HxCalibHash2Entry_.begin());
00058   copy(ZdcHash2Entry.begin(),ZdcHash2Entry.end(),ZdcHash2Entry_.begin());
00059 }
00060 
00061 HcalLogicalMap::~HcalLogicalMap()
00062 {
00063 }
00064 
00065 uint32_t HcalLogicalMap::makeEntryNumber(bool isvalid, int vectorid, int entry)
00066 {
00067   uint32_t answer=0;
00068   answer|=isvalid;
00069   answer|=(vectorid&0x3)<<1;
00070   answer|=entry<<3;
00071   return answer;
00072 }
00073 
00074 void HcalLogicalMap::printMap( unsigned int mapIOV ){  
00075   using namespace std;
00076 
00077   static FILE* HBEFmap; 
00078   static FILE* HOXmap;
00079   static FILE* CALIBmap; 
00080   static FILE* ZDCmap; 
00081   static FILE* HTmap;  
00082   
00083   char tempbuff[30];
00084 
00085   stringstream mystream;
00086   string HBEFmapstr, HOXmapstr, CALIBmapstr, ZDCmapstr, HTmapstr;
00087   string date;
00088   string IOVlabel;
00089   
00090   time_t myTime;
00091   time(&myTime);
00092   
00093   strftime(tempbuff,128,"%d.%b.%Y",localtime(&myTime) );
00094   mystream<<tempbuff;
00095   date= mystream.str();
00096 
00097   mystream.str("");
00098   if      (mapIOV==1) IOVlabel = "A";
00099   else if (mapIOV==2) IOVlabel = "B";
00100   else if (mapIOV==3) IOVlabel = "C";
00101   else                IOVlabel = "D";
00102 
00103   HBEFmapstr  = "./HCALmapHBEF_"+IOVlabel+".txt";
00104   HOXmapstr   = "./HCALmapHO_"+IOVlabel+".txt";
00105   CALIBmapstr = "./HCALmapCALIB_"+IOVlabel+".txt";
00106   ZDCmapstr   = "./ZDCmap_"+IOVlabel+".txt";
00107   HTmapstr    = "./HCALmapHT_"+IOVlabel+".txt";
00108 
00109 //  HBEFmapstr  = "./HCALmapHBEF_"+date+".txt";
00110 //  HOXmapstr   = "./HCALmapHO_"+date+"_"+IOVlabel+".txt";
00111 //  CALIBmapstr = "./HCALmapCALIB_"+date+".txt";
00112 //  ZDCmapstr   = "./ZDCmap_"+date+".txt";
00113 //  HTmapstr    = "./HCALmapHT_"+date+".txt";
00114   
00115   HBEFmap     = fopen(HBEFmapstr.c_str(),"w");
00116   HOXmap      = fopen(HOXmapstr.c_str(),"w");
00117   CALIBmap    = fopen(CALIBmapstr.c_str(),"w");
00118   ZDCmap      = fopen(ZDCmapstr.c_str(),"w");
00119   HTmap       = fopen(HTmapstr.c_str(),"w");
00120   /**********************/
00121 
00122   if(HBEFmap) {
00123     fprintf(HBEFmap,"## file created %s ##\n",date.c_str());
00124     printHBEFMap(HBEFmap);
00125   }
00126   else cout <<HBEFmapstr<<" not found!"<<endl;
00127 
00128   if(HOXmap) {
00129     fprintf(HOXmap,"## file created %s ##\n",date.c_str());
00130     printHOXMap(HOXmap);
00131   }
00132   else cout <<HOXmapstr<<" not found!"<<endl;
00133 
00134   if(CALIBmap) {
00135     fprintf(CALIBmap,"## file created %s ##\n",date.c_str());
00136     printCalibMap(CALIBmap);
00137   }
00138   else cout <<CALIBmapstr<<" not found!"<<endl;
00139 
00140   if(ZDCmap) {
00141     fprintf(ZDCmap,"## file created %s ##\n",date.c_str());
00142     printZDCMap(ZDCmap);
00143   }
00144   else cout <<ZDCmapstr<<" not found!"<<endl;
00145 
00146   if(HTmap) {
00147     fprintf(HTmap,"## file created %s ##\n",date.c_str());
00148     printHTMap(HTmap);
00149   }
00150   else cout <<HTmapstr<<" not found!"<<endl;
00151 
00152 }
00153 
00154 /**************/
00155 HcalElectronicsMap HcalLogicalMap::generateHcalElectronicsMap()
00156 {
00157   HcalElectronicsMap* theemap = new HcalElectronicsMap();
00158   
00159   for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
00160     theemap->mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
00161   for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
00162     theemap->mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
00163   for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
00164     theemap->mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
00165   for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
00166     theemap->mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
00167   for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it!=HTEntries_.end(); ++it) {
00168     theemap->mapEId2tId( it->getHcalTrigElectronicsId(), it->getDetId() );}
00169   theemap->sort();
00170   return *theemap;
00171 }
00172 /**************/
00173 
00174 void HcalLogicalMap::printHBEFMap(FILE* hbefmapfile){
00175   int titlecounter = 0;
00176 
00177   for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
00178     titlecounter = titlecounter % 21;
00179     if (titlecounter == 0){
00180       fprintf(hbefmapfile,"#   side    eta    phi   dphi  depth    det     rbx  wedge     rm  pixel   qie    adc");
00181       fprintf(hbefmapfile,"  rm_fi  fi_ch  crate    htr   fpga  htr_fi  dcc_sl  spigo    dcc    slb  slbin  slbin2");
00182       fprintf(hbefmapfile,"           slnam    rctcra rctcar rctcon               rctnam     fedid\n");
00183     }
00184     titlecounter++;
00185     fprintf(hbefmapfile,"%s",it->printLMapLine());
00186   }
00187 }
00188 
00189 void HcalLogicalMap::printHOXMap(FILE* hoxmapfile){
00190 
00191   int titlecounter = 0;
00192 
00193   for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
00194     titlecounter = titlecounter % 21;
00195     if (titlecounter == 0){
00196       fprintf(hoxmapfile,"#   side    eta    phi   dphi  depth    det     rbx  sector    rm  pixel   qie    adc");
00197       fprintf(hoxmapfile,"  rm_fi  fi_ch let_code  crate    htr   fpga  htr_fi  dcc_sl  spigo    dcc  fedid\n");
00198     }
00199     titlecounter++;
00200     fprintf(hoxmapfile,"%s",it->printLMapLine());
00201   }    
00202 }
00203 
00204 void HcalLogicalMap::printCalibMap(FILE* calibmapfile){
00205 
00206   int titlecounter = 0;
00207 
00208   for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
00209     titlecounter = titlecounter % 21;
00210     if (titlecounter == 0){       
00211       fprintf(calibmapfile,"#   side    eta    phi   dphi    det     rbx  sector  rm  rm_fi ");
00212       fprintf(calibmapfile," fi_ch  crate  htr  fpga  htr_fi  dcc_sl  spigo  dcc  fedid  ch_type      name\n");
00213     }
00214     titlecounter++;
00215     fprintf(calibmapfile,"%s",it->printLMapLine());
00216   }
00217 }
00218 
00219 void HcalLogicalMap::printZDCMap(FILE* zdcmapfile){
00220 
00221   int titlecounter = 0;
00222 
00223   for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
00224     titlecounter = titlecounter % 21;
00225     if (titlecounter == 0){
00226       fprintf(zdcmapfile,"#  side  x  y  dx  depth     det  det_ch  cable  rm  qie ");
00227       fprintf(zdcmapfile," adc  rm_fi  fi_ch  crate  htr  fpga  htr_fi  dcc_sl  spigo  dcc  fedid\n");
00228     }
00229     titlecounter++;
00230     fprintf(zdcmapfile,"%s",it->printLMapLine());
00231   }
00232 }
00233 
00234 void HcalLogicalMap::printHTMap(FILE* htmapfile){
00235 
00236   int titlecounter = 0;
00237 
00238   for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it!=HTEntries_.end(); ++it) {
00239     titlecounter = titlecounter % 21;
00240       if (titlecounter == 0){
00241         fprintf(htmapfile,"#  side  eta  phi  dphi  depth  det   wedge  crate");
00242         fprintf(htmapfile,"  htr  fpga  dcc_sl  spigo  dcc  slb  slbin  slbin2  nDat    ");
00243         fprintf(htmapfile,"     slnam  rctcra  rctcar  rctcon            rctnam  fedid\n");
00244       }
00245     titlecounter++;
00246     fprintf(htmapfile,"%s",it->printLMapLine());
00247   }
00248 }
00249 
00250 
00251 const DetId HcalLogicalMap::getDetId(const HcalElectronicsId& eid)
00252 {
00253   const uint32_t entry=LinearIndex2Entry_.at(eid.linearIndex());
00254   if ( !(entry&0x1) ) return DetId(0);
00255   if ( ((entry>>1)&0x3)==0) return HBHEHFEntries_.at(entry>>3).getDetId();
00256   if ( ((entry>>1)&0x3)==1) return HOHXEntries_.at(entry>>3).getDetId();
00257   if ( ((entry>>1)&0x3)==2) return CALIBEntries_.at(entry>>3).getDetId();
00258   if ( ((entry>>1)&0x3)==3) return ZDCEntries_.at(entry>>3).getDetId();
00259   return DetId(0);
00260 }
00261 
00262 const HcalFrontEndId HcalLogicalMap::getHcalFrontEndId(const DetId& did)
00263 {
00264   const HcalGenericDetId hgdi(did);
00265   const HcalGenericDetId::HcalGenericSubdetector hgsd=hgdi.genericSubdet();
00266   const int hashedId=hgdi.hashedId(false);
00267   if (hgsd==HcalGenericDetId::HcalGenBarrel) {
00268     const uint32_t entry=HbHash2Entry_.at(hashedId)-1;
00269     return HBHEHFEntries_.at(entry).getHcalFrontEndId();
00270   }
00271   else if (hgsd==HcalGenericDetId::HcalGenEndcap) {
00272     const uint32_t entry=HeHash2Entry_.at(hashedId)-1;
00273     return HBHEHFEntries_.at(entry).getHcalFrontEndId();
00274   }
00275   else if (hgsd==HcalGenericDetId::HcalGenForward) {
00276     const uint32_t entry=HfHash2Entry_.at(hashedId)-1;
00277     return HBHEHFEntries_.at(entry).getHcalFrontEndId();
00278   }
00279   else if (hgsd==HcalGenericDetId::HcalGenOuter) {
00280     const uint32_t entry=HoHash2Entry_.at(hashedId)-1;
00281     return HOHXEntries_.at(entry).getHcalFrontEndId();
00282   }
00283   else if (hgsd==HcalGenericDetId::HcalGenCalibration) {
00284     HcalCalibDetId hcid(did);
00285     if (hcid.calibFlavor()==HcalCalibDetId::HOCrosstalk) {
00286       const uint32_t entry=HxCalibHash2Entry_.at(hashedId)-1;
00287       return HOHXEntries_.at(entry).getHcalFrontEndId();
00288     }
00289     else if (hcid.calibFlavor()==HcalCalibDetId::CalibrationBox) {
00290       const uint32_t entry=HxCalibHash2Entry_.at(hashedId)-1;
00291       return CALIBEntries_.at(entry).getHcalFrontEndId();
00292     }
00293   }
00294   return HcalFrontEndId(0);
00295 }
00296 
00297 void HcalLogicalMap::checkIdFunctions() {
00298   int HBHEHF_EID_pass=0;
00299   int HBHEHF_EID_fail=0;
00300   int HOHX_EID_pass=0;
00301   int HOHX_EID_fail=0;
00302   int CALIB_EID_pass=0;
00303   int CALIB_EID_fail=0;
00304   int ZDC_EID_pass=0;
00305   int ZDC_EID_fail=0;
00306 
00307   int HBHEHF_FEID_pass=0;
00308   int HBHEHF_FEID_fail=0;
00309   int HOHX_FEID_pass=0;
00310   int HOHX_FEID_fail=0;
00311   int CALIB_FEID_pass=0;
00312   int CALIB_FEID_fail=0;
00313 
00314   cout << "\nRunning the id function checker..." << endl;
00315 
00316   for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
00317     const HcalElectronicsId heid=it->getHcalElectronicsId();
00318     const DetId did0=it->getDetId();
00319     const DetId did1=getDetId(heid);
00320     if (did0==did1) HBHEHF_EID_pass++;
00321     else HBHEHF_EID_fail++;
00322 
00323     const HcalFrontEndId hfeid0=it->getHcalFrontEndId();
00324     const HcalFrontEndId hfeid1=getHcalFrontEndId(did0);
00325     if (hfeid0==hfeid1) HBHEHF_FEID_pass++;
00326     else HBHEHF_FEID_fail++;
00327   }
00328   for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
00329     const HcalElectronicsId heid=it->getHcalElectronicsId();
00330     const DetId did0=it->getDetId();
00331     const DetId did1=getDetId(heid);
00332     if (did0==did1) HOHX_EID_pass++;
00333     else HOHX_EID_fail++;
00334 
00335     const HcalFrontEndId hfeid0=it->getHcalFrontEndId();
00336     const HcalFrontEndId hfeid1=getHcalFrontEndId(did0);
00337     if (hfeid0==hfeid1) HOHX_FEID_pass++;
00338     else HOHX_FEID_fail++;
00339   }
00340   for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
00341     const HcalElectronicsId heid=it->getHcalElectronicsId();
00342     const DetId did0=it->getDetId();
00343     const DetId did1=getDetId(heid);
00344     if (did0==did1) CALIB_EID_pass++;
00345     else CALIB_EID_fail++;
00346 
00347     const HcalFrontEndId hfeid0=it->getHcalFrontEndId();
00348     const HcalFrontEndId hfeid1=getHcalFrontEndId(did0);
00349     if (hfeid0==hfeid1) CALIB_FEID_pass++;
00350     else CALIB_FEID_fail++;
00351   }
00352   for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
00353     const HcalElectronicsId heid=it->getHcalElectronicsId();
00354     const DetId did0=it->getDetId();
00355     const DetId did1=getDetId(heid);
00356     if (did0==did1) ZDC_EID_pass++;
00357     else ZDC_EID_fail++;
00358   }
00359   
00360   cout << "Checking detIds from electronics ids..." << endl;
00361   cout << "HBHEHF EID (pass,fail) = (" << HBHEHF_EID_pass << "," << HBHEHF_EID_fail << ")" << endl;
00362   cout << "HOHX EID (pass,fail) = (" << HOHX_EID_pass << "," << HOHX_EID_fail << ")" << endl;
00363   cout << "CALIB EID (pass,fail) = (" << CALIB_EID_pass << "," << CALIB_EID_fail << ")" << endl;
00364   cout << "ZDC EID (pass,fail) = (" << ZDC_EID_pass << "," << ZDC_EID_fail << ")" << endl;
00365   cout << endl;
00366   cout << "Checking frontEndIds from electronics ids..." << endl;
00367   cout << "HBHEHF FEID (pass,fail) = (" << HBHEHF_FEID_pass << "," << HBHEHF_FEID_fail << ")" << endl;
00368   cout << "HOHX FEID (pass,fail) = (" << HOHX_FEID_pass << "," << HOHX_FEID_fail << ")" << endl;
00369   cout << "CALIB FEID (pass,fail) = (" << CALIB_FEID_pass << "," << CALIB_FEID_fail << ")" << endl;
00370 }
00371 
00372 
00373 void HcalLogicalMap::checkHashIds() {
00374   std::vector<int> HB_Hashes_;     // index 0
00375   std::vector<int> HE_Hashes_;     // index 1
00376   std::vector<int> HF_Hashes_;     // index 2
00377   std::vector<int> HO_Hashes_;     // index 3
00378   std::vector<int> CALIBHX_Hashes_;// index 4
00379   std::vector<int> ZDC_Hashes_;    // index 5
00380   std::vector<int> HT_Hashes_;     // index 6
00381 
00382   int numfails[7]    = {0,0,0,0,0,0,0};
00383   int numpass[7]     = {0,0,0,0,0,0,0};
00384   int numnotdense[7] = {0,0,0,0,0,0,0};
00385 
00386   cout << "\nRunning the hash checker for detIds..." << endl;
00387   for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
00388     if (it->getDetId().subdetId()==HcalBarrel) {
00389       HB_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
00390     }
00391     else if (it->getDetId().subdetId()==HcalEndcap) {
00392       HE_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
00393     }
00394     else if (it->getDetId().subdetId()==HcalForward) {
00395       HF_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
00396     }
00397   }
00398   for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
00399     if (HcalGenericDetId(it->getDetId().rawId()).isHcalCalibDetId() ) {
00400       CALIBHX_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
00401     }
00402     else {
00403       HO_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
00404     }
00405   }
00406   for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
00407     CALIBHX_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
00408   }
00409   for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
00410     ZDC_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
00411   }
00412   for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it!=HTEntries_.end(); ++it) {
00413     HT_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
00414   }
00415 
00416   sort(HB_Hashes_.begin()     , HB_Hashes_.end());
00417   sort(HE_Hashes_.begin()     , HE_Hashes_.end());
00418   sort(HF_Hashes_.begin()     , HF_Hashes_.end());
00419   sort(HO_Hashes_.begin()     , HO_Hashes_.end());
00420   sort(CALIBHX_Hashes_.begin(), CALIBHX_Hashes_.end());
00421   sort(ZDC_Hashes_.begin()    , ZDC_Hashes_.end());
00422   sort(HT_Hashes_.begin()     , HT_Hashes_.end());
00423 
00424   for(unsigned int i = 0; i<HB_Hashes_.size()-1; i++) {
00425     int diff = HB_Hashes_.at(i+1)-HB_Hashes_.at(i);
00426     if (diff==0) numfails[0]++;
00427     else if (diff>1) numnotdense[0]++;
00428     else numpass[0]++;
00429   }
00430   for(unsigned int i = 0; i<HE_Hashes_.size()-1; i++) {
00431     int diff = HE_Hashes_.at(i+1)-HE_Hashes_.at(i);
00432     if (diff==0) numfails[1]++;
00433     else if (diff>1) numnotdense[1]++;
00434     else numpass[1]++;
00435   }
00436   for(unsigned int i = 0; i<HF_Hashes_.size()-1; i++) {
00437     int diff = HF_Hashes_.at(i+1)-HF_Hashes_.at(i);
00438     if (diff==0) numfails[2]++;
00439     else if (diff>1) numnotdense[2]++;
00440     else numpass[2]++;
00441   }
00442   for(unsigned int i = 0; i<HO_Hashes_.size()-1; i++) {
00443     int diff = HO_Hashes_.at(i+1)-HO_Hashes_.at(i);
00444     if (diff==0) numfails[3]++;
00445     else if (diff>1) numnotdense[3]++;
00446     else numpass[3]++;
00447   }
00448   for(unsigned int i = 0; i<CALIBHX_Hashes_.size()-1; i++) {
00449     int diff = CALIBHX_Hashes_.at(i+1)-CALIBHX_Hashes_.at(i);
00450     if (diff==0) numfails[4]++;
00451     else if (diff>1) numnotdense[4]++;
00452     else numpass[4]++;
00453   }
00454   for(unsigned int i = 0; i<ZDC_Hashes_.size()-1; i++) {
00455     int diff = ZDC_Hashes_.at(i+1)-ZDC_Hashes_.at(i);
00456     if (diff==0) numfails[5]++;
00457     else if (diff>1) numnotdense[5]++;
00458     else numpass[5]++;
00459   }
00460   for(unsigned int i = 0; i<HT_Hashes_.size()-1; i++) {
00461     int diff = HT_Hashes_.at(i+1)-HT_Hashes_.at(i);
00462     if (diff==0) numfails[6]++;
00463     else if (diff>1) numnotdense[6]++;
00464     else numpass[6]++;
00465   }
00466   cout << "HB HashIds (pass, collisions, non-dense) = (" << numpass[0] << "," << numfails[0] << "," << numnotdense[0] << ")" << endl;
00467   cout << "HE HashIds (pass, collisions, non-dense) = (" << numpass[1] << "," << numfails[1] << "," << numnotdense[1] << ")" << endl;
00468   cout << "HF HashIds (pass, collisions, non-dense) = (" << numpass[2] << "," << numfails[2] << "," << numnotdense[2] << ")" << endl;
00469   cout << "HO HashIds (pass, collisions, non-dense) = (" << numpass[3] << "," << numfails[3] << "," << numnotdense[3] << ")" << endl;
00470   cout << "CALIB/HX HashIds (pass, collisions, non-dense) = (" << numpass[4] << "," << numfails[4] << "," << numnotdense[4] << ")" << endl;
00471   cout << "ZDC HashIds (pass, collisions, non-dense) = (" << numpass[5] << "," << numfails[5] << "," << numnotdense[5] << ")" << endl;
00472   cout << "HT HashIds (pass, collisions, non-dense) = (" << numpass[6] << "," << numfails[6] << "," << numnotdense[6] << ")" << endl;
00473 }
00474 
00475 void HcalLogicalMap::checkElectronicsHashIds() {
00476   std::vector<int> Electronics_Hashes_;
00477 
00478   int numfails = 0;
00479   int numpass  = 0;
00480   int numnotdense = 0;
00481 
00482   cout << "\nRunning the hash checker for electronics Ids..." << endl;
00483   for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
00484     Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
00485   }
00486   for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
00487     Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
00488   }
00489   for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
00490     Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
00491   }
00492   for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
00493     Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
00494   }
00495   for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it!=HTEntries_.end(); ++it) {
00496     Electronics_Hashes_.push_back((it->getHcalTrigElectronicsId()).linearIndex());
00497   }
00498 
00499   sort(Electronics_Hashes_.begin() , Electronics_Hashes_.end());
00500 
00501   for(unsigned int i = 0; i<Electronics_Hashes_.size()-1; i++) {
00502     int diff = Electronics_Hashes_.at(i+1)-Electronics_Hashes_.at(i);
00503     if (diff==0) numfails++;
00504     else if (diff>1) numnotdense++;
00505     else numpass++;
00506   }
00507   cout << "Electronics Id linearIndex (pass, collisions, nondense) = (" << numpass << "," << numfails << "," << numnotdense << ")" << endl;
00508 }
00509