CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/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 if (mapIOV==4) IOVlabel = "D";
00102   else                IOVlabel = "E";
00103 
00104   HBEFmapstr  = "./HCALmapHBEF_"+IOVlabel+".txt";
00105   HOXmapstr   = "./HCALmapHO_"+IOVlabel+".txt";
00106   CALIBmapstr = "./HCALmapCALIB_"+IOVlabel+".txt";
00107   ZDCmapstr   = "./ZDCmap_"+IOVlabel+".txt";
00108   HTmapstr    = "./HCALmapHT_"+IOVlabel+".txt";
00109 
00110 //  HBEFmapstr  = "./HCALmapHBEF_"+date+".txt";
00111 //  HOXmapstr   = "./HCALmapHO_"+date+"_"+IOVlabel+".txt";
00112 //  CALIBmapstr = "./HCALmapCALIB_"+date+".txt";
00113 //  ZDCmapstr   = "./ZDCmap_"+date+".txt";
00114 //  HTmapstr    = "./HCALmapHT_"+date+".txt";
00115   
00116   HBEFmap     = fopen(HBEFmapstr.c_str(),"w");
00117   HOXmap      = fopen(HOXmapstr.c_str(),"w");
00118   CALIBmap    = fopen(CALIBmapstr.c_str(),"w");
00119   ZDCmap      = fopen(ZDCmapstr.c_str(),"w");
00120   HTmap       = fopen(HTmapstr.c_str(),"w");
00121   /**********************/
00122 
00123   if(HBEFmap) {
00124     fprintf(HBEFmap,"## file created %s ##\n",date.c_str());
00125     printHBEFMap(HBEFmap);
00126   }
00127   else cout <<HBEFmapstr<<" not found!"<<endl;
00128 
00129   if(HOXmap) {
00130     fprintf(HOXmap,"## file created %s ##\n",date.c_str());
00131     printHOXMap(HOXmap);
00132   }
00133   else cout <<HOXmapstr<<" not found!"<<endl;
00134 
00135   if(CALIBmap) {
00136     fprintf(CALIBmap,"## file created %s ##\n",date.c_str());
00137     printCalibMap(CALIBmap);
00138   }
00139   else cout <<CALIBmapstr<<" not found!"<<endl;
00140 
00141   if(ZDCmap) {
00142     fprintf(ZDCmap,"## file created %s ##\n",date.c_str());
00143     printZDCMap(ZDCmap);
00144   }
00145   else cout <<ZDCmapstr<<" not found!"<<endl;
00146 
00147   if(HTmap) {
00148     fprintf(HTmap,"## file created %s ##\n",date.c_str());
00149     printHTMap(HTmap);
00150   }
00151   else cout <<HTmapstr<<" not found!"<<endl;
00152 
00153 }
00154 
00155 /**************/
00156 HcalElectronicsMap HcalLogicalMap::generateHcalElectronicsMap()
00157 {
00158   HcalElectronicsMap* theemap = new HcalElectronicsMap();
00159   
00160   for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
00161     theemap->mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
00162   for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
00163     theemap->mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
00164   for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
00165     theemap->mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
00166   for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
00167     theemap->mapEId2chId( it->getHcalElectronicsId(), it->getDetId() );}
00168   for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it!=HTEntries_.end(); ++it) {
00169     theemap->mapEId2tId( it->getHcalTrigElectronicsId(), it->getDetId() );}
00170   theemap->sort();
00171   return *theemap;
00172 }
00173 /**************/
00174 
00175 void HcalLogicalMap::printHBEFMap(FILE* hbefmapfile){
00176   int titlecounter = 0;
00177 
00178   for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
00179     titlecounter = titlecounter % 21;
00180     if (titlecounter == 0){
00181       fprintf(hbefmapfile,"#   side    eta    phi   dphi  depth    det     rbx  wedge     rm  pixel   qie    adc");
00182       fprintf(hbefmapfile,"  rm_fi  fi_ch  crate    htr   fpga  htr_fi  dcc_sl  spigo    dcc    slb  slbin  slbin2");
00183       fprintf(hbefmapfile,"           slnam    rctcra rctcar rctcon               rctnam     fedid\n");
00184     }
00185     titlecounter++;
00186     fprintf(hbefmapfile,"%s",it->printLMapLine());
00187   }
00188 }
00189 
00190 void HcalLogicalMap::printHOXMap(FILE* hoxmapfile){
00191 
00192   int titlecounter = 0;
00193 
00194   for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
00195     titlecounter = titlecounter % 21;
00196     if (titlecounter == 0){
00197       fprintf(hoxmapfile,"#   side    eta    phi   dphi  depth    det     rbx  sector    rm  pixel   qie    adc");
00198       fprintf(hoxmapfile,"  rm_fi  fi_ch let_code  crate    htr   fpga  htr_fi  dcc_sl  spigo    dcc  fedid\n");
00199     }
00200     titlecounter++;
00201     fprintf(hoxmapfile,"%s",it->printLMapLine());
00202   }    
00203 }
00204 
00205 void HcalLogicalMap::printCalibMap(FILE* calibmapfile){
00206 
00207   int titlecounter = 0;
00208 
00209   for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
00210     titlecounter = titlecounter % 21;
00211     if (titlecounter == 0){       
00212       fprintf(calibmapfile,"#   side    eta    phi   dphi    det     rbx  sector  rm  rm_fi ");
00213       fprintf(calibmapfile," fi_ch  crate  htr  fpga  htr_fi  dcc_sl  spigo  dcc  fedid  ch_type      name\n");
00214     }
00215     titlecounter++;
00216     fprintf(calibmapfile,"%s",it->printLMapLine());
00217   }
00218 }
00219 
00220 void HcalLogicalMap::printZDCMap(FILE* zdcmapfile){
00221 
00222   int titlecounter = 0;
00223 
00224   for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
00225     titlecounter = titlecounter % 21;
00226     if (titlecounter == 0){
00227       fprintf(zdcmapfile,"#  side  x  y  dx  depth     det  det_ch  cable  rm  qie ");
00228       fprintf(zdcmapfile," adc  rm_fi  fi_ch  crate  htr  fpga  htr_fi  dcc_sl  spigo  dcc  fedid\n");
00229     }
00230     titlecounter++;
00231     fprintf(zdcmapfile,"%s",it->printLMapLine());
00232   }
00233 }
00234 
00235 void HcalLogicalMap::printHTMap(FILE* htmapfile){
00236 
00237   int titlecounter = 0;
00238 
00239   for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it!=HTEntries_.end(); ++it) {
00240     titlecounter = titlecounter % 21;
00241       if (titlecounter == 0){
00242         fprintf(htmapfile,"#  side  eta  phi  dphi  depth  det   wedge  crate");
00243         fprintf(htmapfile,"  htr  fpga  dcc_sl  spigo  dcc  slb  slbin  slbin2  nDat    ");
00244         fprintf(htmapfile,"     slnam  rctcra  rctcar  rctcon            rctnam  fedid\n");
00245       }
00246     titlecounter++;
00247     fprintf(htmapfile,"%s",it->printLMapLine());
00248   }
00249 }
00250 
00251 
00252 const DetId HcalLogicalMap::getDetId(const HcalElectronicsId& eid)
00253 {
00254   const uint32_t entry=LinearIndex2Entry_.at(eid.linearIndex());
00255   if ( !(entry&0x1) ) return DetId(0);
00256   if ( ((entry>>1)&0x3)==0) return HBHEHFEntries_.at(entry>>3).getDetId();
00257   if ( ((entry>>1)&0x3)==1) return HOHXEntries_.at(entry>>3).getDetId();
00258   if ( ((entry>>1)&0x3)==2) return CALIBEntries_.at(entry>>3).getDetId();
00259   if ( ((entry>>1)&0x3)==3) return ZDCEntries_.at(entry>>3).getDetId();
00260   return DetId(0);
00261 }
00262 
00263 const HcalFrontEndId HcalLogicalMap::getHcalFrontEndId(const DetId& did)
00264 {
00265   const HcalGenericDetId hgdi(did);
00266   const HcalGenericDetId::HcalGenericSubdetector hgsd=hgdi.genericSubdet();
00267   const int hashedId=hgdi.hashedId(false);
00268   if (hgsd==HcalGenericDetId::HcalGenBarrel) {
00269     const uint32_t entry=HbHash2Entry_.at(hashedId)-1;
00270     return HBHEHFEntries_.at(entry).getHcalFrontEndId();
00271   }
00272   else if (hgsd==HcalGenericDetId::HcalGenEndcap) {
00273     const uint32_t entry=HeHash2Entry_.at(hashedId)-1;
00274     return HBHEHFEntries_.at(entry).getHcalFrontEndId();
00275   }
00276   else if (hgsd==HcalGenericDetId::HcalGenForward) {
00277     const uint32_t entry=HfHash2Entry_.at(hashedId)-1;
00278     return HBHEHFEntries_.at(entry).getHcalFrontEndId();
00279   }
00280   else if (hgsd==HcalGenericDetId::HcalGenOuter) {
00281     const uint32_t entry=HoHash2Entry_.at(hashedId)-1;
00282     return HOHXEntries_.at(entry).getHcalFrontEndId();
00283   }
00284   else if (hgsd==HcalGenericDetId::HcalGenCalibration) {
00285     HcalCalibDetId hcid(did);
00286     if (hcid.calibFlavor()==HcalCalibDetId::HOCrosstalk) {
00287       const uint32_t entry=HxCalibHash2Entry_.at(hashedId)-1;
00288       return HOHXEntries_.at(entry).getHcalFrontEndId();
00289     }
00290     else if (hcid.calibFlavor()==HcalCalibDetId::CalibrationBox) {
00291       const uint32_t entry=HxCalibHash2Entry_.at(hashedId)-1;
00292       return CALIBEntries_.at(entry).getHcalFrontEndId();
00293     }
00294   }
00295   return HcalFrontEndId(0);
00296 }
00297 
00298 void HcalLogicalMap::checkIdFunctions() {
00299   int HBHEHF_EID_pass=0;
00300   int HBHEHF_EID_fail=0;
00301   int HOHX_EID_pass=0;
00302   int HOHX_EID_fail=0;
00303   int CALIB_EID_pass=0;
00304   int CALIB_EID_fail=0;
00305   int ZDC_EID_pass=0;
00306   int ZDC_EID_fail=0;
00307 
00308   int HBHEHF_FEID_pass=0;
00309   int HBHEHF_FEID_fail=0;
00310   int HOHX_FEID_pass=0;
00311   int HOHX_FEID_fail=0;
00312   int CALIB_FEID_pass=0;
00313   int CALIB_FEID_fail=0;
00314 
00315   cout << "\nRunning the id function checker..." << endl;
00316 
00317   for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
00318     const HcalElectronicsId heid=it->getHcalElectronicsId();
00319     const DetId did0=it->getDetId();
00320     const DetId did1=getDetId(heid);
00321     if (did0==did1) HBHEHF_EID_pass++;
00322     else HBHEHF_EID_fail++;
00323 
00324     const HcalFrontEndId hfeid0=it->getHcalFrontEndId();
00325     const HcalFrontEndId hfeid1=getHcalFrontEndId(did0);
00326     if (hfeid0==hfeid1) HBHEHF_FEID_pass++;
00327     else HBHEHF_FEID_fail++;
00328   }
00329   for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
00330     const HcalElectronicsId heid=it->getHcalElectronicsId();
00331     const DetId did0=it->getDetId();
00332     const DetId did1=getDetId(heid);
00333     if (did0==did1) HOHX_EID_pass++;
00334     else HOHX_EID_fail++;
00335 
00336     const HcalFrontEndId hfeid0=it->getHcalFrontEndId();
00337     const HcalFrontEndId hfeid1=getHcalFrontEndId(did0);
00338     if (hfeid0==hfeid1) HOHX_FEID_pass++;
00339     else HOHX_FEID_fail++;
00340   }
00341   for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
00342     const HcalElectronicsId heid=it->getHcalElectronicsId();
00343     const DetId did0=it->getDetId();
00344     const DetId did1=getDetId(heid);
00345     if (did0==did1) CALIB_EID_pass++;
00346     else CALIB_EID_fail++;
00347 
00348     const HcalFrontEndId hfeid0=it->getHcalFrontEndId();
00349     const HcalFrontEndId hfeid1=getHcalFrontEndId(did0);
00350     if (hfeid0==hfeid1) CALIB_FEID_pass++;
00351     else CALIB_FEID_fail++;
00352   }
00353   for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
00354     const HcalElectronicsId heid=it->getHcalElectronicsId();
00355     const DetId did0=it->getDetId();
00356     const DetId did1=getDetId(heid);
00357     if (did0==did1) ZDC_EID_pass++;
00358     else ZDC_EID_fail++;
00359   }
00360   
00361   cout << "Checking detIds from electronics ids..." << endl;
00362   cout << "HBHEHF EID (pass,fail) = (" << HBHEHF_EID_pass << "," << HBHEHF_EID_fail << ")" << endl;
00363   cout << "HOHX EID (pass,fail) = (" << HOHX_EID_pass << "," << HOHX_EID_fail << ")" << endl;
00364   cout << "CALIB EID (pass,fail) = (" << CALIB_EID_pass << "," << CALIB_EID_fail << ")" << endl;
00365   cout << "ZDC EID (pass,fail) = (" << ZDC_EID_pass << "," << ZDC_EID_fail << ")" << endl;
00366   cout << endl;
00367   cout << "Checking frontEndIds from electronics ids..." << endl;
00368   cout << "HBHEHF FEID (pass,fail) = (" << HBHEHF_FEID_pass << "," << HBHEHF_FEID_fail << ")" << endl;
00369   cout << "HOHX FEID (pass,fail) = (" << HOHX_FEID_pass << "," << HOHX_FEID_fail << ")" << endl;
00370   cout << "CALIB FEID (pass,fail) = (" << CALIB_FEID_pass << "," << CALIB_FEID_fail << ")" << endl;
00371 }
00372 
00373 
00374 void HcalLogicalMap::checkHashIds() {
00375   std::vector<int> HB_Hashes_;     // index 0
00376   std::vector<int> HE_Hashes_;     // index 1
00377   std::vector<int> HF_Hashes_;     // index 2
00378   std::vector<int> HO_Hashes_;     // index 3
00379   std::vector<int> CALIBHX_Hashes_;// index 4
00380   std::vector<int> ZDC_Hashes_;    // index 5
00381   std::vector<int> HT_Hashes_;     // index 6
00382 
00383   int numfails[7]    = {0,0,0,0,0,0,0};
00384   int numpass[7]     = {0,0,0,0,0,0,0};
00385   int numnotdense[7] = {0,0,0,0,0,0,0};
00386 
00387   cout << "\nRunning the hash checker for detIds..." << endl;
00388   for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
00389     if (it->getDetId().subdetId()==HcalBarrel) {
00390       HB_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
00391     }
00392     else if (it->getDetId().subdetId()==HcalEndcap) {
00393       HE_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
00394     }
00395     else if (it->getDetId().subdetId()==HcalForward) {
00396       HF_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
00397     }
00398   }
00399   for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
00400     if (HcalGenericDetId(it->getDetId().rawId()).isHcalCalibDetId() ) {
00401       CALIBHX_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
00402     }
00403     else {
00404       HO_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
00405     }
00406   }
00407   for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
00408     CALIBHX_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
00409   }
00410   for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
00411     ZDC_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
00412   }
00413   for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it!=HTEntries_.end(); ++it) {
00414     HT_Hashes_.push_back(HcalGenericDetId(it->getDetId().rawId()).hashedId(false));
00415   }
00416 
00417   sort(HB_Hashes_.begin()     , HB_Hashes_.end());
00418   sort(HE_Hashes_.begin()     , HE_Hashes_.end());
00419   sort(HF_Hashes_.begin()     , HF_Hashes_.end());
00420   sort(HO_Hashes_.begin()     , HO_Hashes_.end());
00421   sort(CALIBHX_Hashes_.begin(), CALIBHX_Hashes_.end());
00422   sort(ZDC_Hashes_.begin()    , ZDC_Hashes_.end());
00423   sort(HT_Hashes_.begin()     , HT_Hashes_.end());
00424 
00425   for(unsigned int i = 0; i<HB_Hashes_.size()-1; i++) {
00426     int diff = HB_Hashes_.at(i+1)-HB_Hashes_.at(i);
00427     if (diff==0) numfails[0]++;
00428     else if (diff>1) numnotdense[0]++;
00429     else numpass[0]++;
00430   }
00431   for(unsigned int i = 0; i<HE_Hashes_.size()-1; i++) {
00432     int diff = HE_Hashes_.at(i+1)-HE_Hashes_.at(i);
00433     if (diff==0) numfails[1]++;
00434     else if (diff>1) numnotdense[1]++;
00435     else numpass[1]++;
00436   }
00437   for(unsigned int i = 0; i<HF_Hashes_.size()-1; i++) {
00438     int diff = HF_Hashes_.at(i+1)-HF_Hashes_.at(i);
00439     if (diff==0) numfails[2]++;
00440     else if (diff>1) numnotdense[2]++;
00441     else numpass[2]++;
00442   }
00443   for(unsigned int i = 0; i<HO_Hashes_.size()-1; i++) {
00444     int diff = HO_Hashes_.at(i+1)-HO_Hashes_.at(i);
00445     if (diff==0) numfails[3]++;
00446     else if (diff>1) numnotdense[3]++;
00447     else numpass[3]++;
00448   }
00449   for(unsigned int i = 0; i<CALIBHX_Hashes_.size()-1; i++) {
00450     int diff = CALIBHX_Hashes_.at(i+1)-CALIBHX_Hashes_.at(i);
00451     if (diff==0) numfails[4]++;
00452     else if (diff>1) numnotdense[4]++;
00453     else numpass[4]++;
00454   }
00455   for(unsigned int i = 0; i<ZDC_Hashes_.size()-1; i++) {
00456     int diff = ZDC_Hashes_.at(i+1)-ZDC_Hashes_.at(i);
00457     if (diff==0) numfails[5]++;
00458     else if (diff>1) numnotdense[5]++;
00459     else numpass[5]++;
00460   }
00461   for(unsigned int i = 0; i<HT_Hashes_.size()-1; i++) {
00462     int diff = HT_Hashes_.at(i+1)-HT_Hashes_.at(i);
00463     if (diff==0) numfails[6]++;
00464     else if (diff>1) numnotdense[6]++;
00465     else numpass[6]++;
00466   }
00467   cout << "HB HashIds (pass, collisions, non-dense) = (" << numpass[0] << "," << numfails[0] << "," << numnotdense[0] << ")" << endl;
00468   cout << "HE HashIds (pass, collisions, non-dense) = (" << numpass[1] << "," << numfails[1] << "," << numnotdense[1] << ")" << endl;
00469   cout << "HF HashIds (pass, collisions, non-dense) = (" << numpass[2] << "," << numfails[2] << "," << numnotdense[2] << ")" << endl;
00470   cout << "HO HashIds (pass, collisions, non-dense) = (" << numpass[3] << "," << numfails[3] << "," << numnotdense[3] << ")" << endl;
00471   cout << "CALIB/HX HashIds (pass, collisions, non-dense) = (" << numpass[4] << "," << numfails[4] << "," << numnotdense[4] << ")" << endl;
00472   cout << "ZDC HashIds (pass, collisions, non-dense) = (" << numpass[5] << "," << numfails[5] << "," << numnotdense[5] << ")" << endl;
00473   cout << "HT HashIds (pass, collisions, non-dense) = (" << numpass[6] << "," << numfails[6] << "," << numnotdense[6] << ")" << endl;
00474 }
00475 
00476 void HcalLogicalMap::checkElectronicsHashIds() {
00477   std::vector<int> Electronics_Hashes_;
00478 
00479   int numfails = 0;
00480   int numpass  = 0;
00481   int numnotdense = 0;
00482 
00483   cout << "\nRunning the hash checker for electronics Ids..." << endl;
00484   for (std::vector<HBHEHFLogicalMapEntry>::iterator it = HBHEHFEntries_.begin(); it!=HBHEHFEntries_.end(); ++it) {
00485     Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
00486   }
00487   for (std::vector<ZDCLogicalMapEntry>::iterator it = ZDCEntries_.begin(); it!=ZDCEntries_.end(); ++it) {
00488     Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
00489   }
00490   for (std::vector<CALIBLogicalMapEntry>::iterator it = CALIBEntries_.begin(); it!=CALIBEntries_.end(); ++it) {
00491     Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
00492   }
00493   for (std::vector<HOHXLogicalMapEntry>::iterator it = HOHXEntries_.begin(); it!=HOHXEntries_.end(); ++it) {
00494     Electronics_Hashes_.push_back((it->getHcalElectronicsId()).linearIndex());
00495   }
00496   for (std::vector<HTLogicalMapEntry>::iterator it = HTEntries_.begin(); it!=HTEntries_.end(); ++it) {
00497     Electronics_Hashes_.push_back((it->getHcalTrigElectronicsId()).linearIndex());
00498   }
00499 
00500   sort(Electronics_Hashes_.begin() , Electronics_Hashes_.end());
00501 
00502   for(unsigned int i = 0; i<Electronics_Hashes_.size()-1; i++) {
00503     int diff = Electronics_Hashes_.at(i+1)-Electronics_Hashes_.at(i);
00504     if (diff==0) numfails++;
00505     else if (diff>1) numnotdense++;
00506     else numpass++;
00507   }
00508   cout << "Electronics Id linearIndex (pass, collisions, nondense) = (" << numpass << "," << numfails << "," << numnotdense << ")" << endl;
00509 }
00510