CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/DQM/HcalMonitorTasks/interface/HcalEtaPhiHists.h

Go to the documentation of this file.
00001 #ifndef DQM_HCALMONITORTASKS_HCALETAPHIHISTS_H
00002 #define DQM_HCALMONITORTASKS_HCALETAPHIHISTS_H
00003 
00004 #include "TH1F.h"
00005 #include "TH2F.h"
00006 
00007 #include "DQMServices/Core/interface/DQMStore.h"
00008 #include "DQMServices/Core/interface/MonitorElement.h"
00009 #include "DataFormats/DetId/interface/DetId.h"
00010 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00011 #include "DQMServices/Core/interface/DQMStore.h"
00012 
00013 #include <iostream>
00014 
00015 
00016 // Define EtaPhi histograms
00017 
00018 class EtaPhiHists{
00019   // Make a set of eta-phi histograms (one for each depth)
00020  public:
00021   EtaPhiHists(){};
00022   ~EtaPhiHists(){};
00023 
00024   void setup(DQMStore* &m_dbe,std::string Name, std::string Units="")
00025     {
00026       std::stringstream name;
00027       name<<Name;
00028 
00029       std::stringstream unitname;
00030       std::stringstream unittitle;
00031       std::string s(Units);
00032       if (s.empty())
00033         {
00034           unitname<<Units;
00035           unittitle<<"No Units";
00036         }
00037       else
00038         {
00039           unitname<<" "<<Units;
00040           unittitle<<Units;
00041         }
00042       
00043       // Push back depth plots
00044       depth.push_back(m_dbe->book2D(("HB HE HF Depth 1 "+name.str()+unitname.str()).c_str(),
00045                                     (name.str()+" Depth 1 -- HB HE HF ("+unittitle.str().c_str()+")"),
00046                                     85,-42.5,42.5,
00047                                     72,0.5,72.5));
00048       float ybins[73];
00049       for (int i=0;i<=72;i++) ybins[i]=(float)(i+0.5);
00050       float xbinsd2[]={-42.5,-41.5,-40.5,-39.5,-38.5,-37.5,-36.5,-35.5,-34.5,-33.5,-32.5,-31.5,-30.5,-29.5,
00051                        -28.5,-27.5,-26.5,-25.5,-24.5,-23.5,-22.5,-21.5,-20.5,-19.5,-18.5,-17.5,-16.5,
00052                        -15.5,-14.5,
00053                        14.5, 15.5,
00054                        16.5,17.5,18.5,19.5,20.5,21.5,22.5,23.5,24.5,25.5,26.5,27.5,28.5,29.5,30.5,
00055                        31.5,32.5,33.5,34.5,35.5,36.5,37.5,38.5,39.5,40.5,41.5,42.5};
00056       depth.push_back(m_dbe->book2D(("HB HE HF Depth 2 "+name.str()+unitname.str()).c_str(),
00057                                     (name.str()+" Depth 2 -- HB HE HF ("+unittitle.str().c_str()+")"),
00058                                     57, xbinsd2, 72, ybins));
00059       
00060       // Set up variable-sized bins for HE depth 3 (MonitorElement also requires phi bins to be entered in array format)
00061       float xbins[]={-28.5,-27.5,-26.5,-16.5,-15.5,
00062                      15.5,16.5,26.5,27.5,28.5};
00063       
00064       depth.push_back(m_dbe->book2D(("HE Depth 3 "+name.str()+unitname.str()).c_str(),
00065                                     (name.str()+" Depth 3 -- HE ("+unittitle.str().c_str()+")"),
00066                                     // Use variable-sized eta bins 
00067                                     9, xbins, 72, ybins));
00068       // HO bins are fixed width, but cover a smaller eta range (-15 -> 15)
00069       depth.push_back(m_dbe->book2D(("HO Depth 4 "+name.str()+unitname.str()).c_str(),
00070                                     (name.str()+" Depth 4 -- HO ("+unittitle.str().c_str()+")"),
00071                                     31,-15.5,15.5,
00072                                     72,0.5,72.5));
00073       for (unsigned int i=0;i<depth.size();++i)
00074         (depth[i]->getTH2F())->SetOption("colz");
00075       setBinLabels(); // set axis titles, special bins
00076       
00077     } // void setup(...)
00078   
00079   int getEtaBins(int depth)
00080   {
00081     if (depth==1) return 85;
00082     if (depth==2) return 57;
00083     if (depth==3) return 9;
00084     if (depth==4) return 31;
00085     return 0;
00086   }
00087   
00088   int getPhiBins(int depth)
00089   {
00090     if (depth>0 && depth<5)
00091       return 72;
00092     return 0;
00093   }
00094 
00095   void setBinLabels()
00096     {
00097       // Set labels for all depth histograms
00098       for (unsigned int i=0;i<depth.size();++i)
00099         {
00100           depth[i]->setAxisTitle("i#eta",1);
00101           depth[i]->setAxisTitle("i#phi",2);
00102         }
00103 
00104       std::stringstream label;
00105       // set label on every other bin
00106       for (int i=-41;i<=-29;i=i+2)
00107         {
00108           label<<i;
00109           depth[0]->setBinLabel(i+42,label.str().c_str());
00110           depth[1]->setBinLabel(i+42,label.str().c_str());
00111           label.str("");
00112         }
00113       depth[0]->setBinLabel(14,"-29HE");
00114       depth[1]->setBinLabel(14,"-29HE");
00115 
00116       // offset by one for HE
00117       for (int i=-27;i<=27;i=i+2)
00118         {
00119           label<<i;
00120           depth[0]->setBinLabel(i+43,label.str().c_str());
00121           label.str("");
00122         }
00123       depth[0]->setBinLabel(72,"29HE");
00124       for (int i=29;i<=41;i=i+2)
00125         {
00126           label<<i;
00127           depth[0]->setBinLabel(i+44,label.str().c_str());
00128           label.str("");
00129         }
00130       for (int i=16;i<=28;i=i+2)
00131         {
00132           label<<i-43;
00133           depth[1]->setBinLabel(i,label.str().c_str());
00134           label.str("");
00135         }
00136       depth[1]->setBinLabel(29,"NULL");
00137       for (int i=15;i<=27;i=i+2)
00138         {
00139           label<<i;
00140           depth[1]->setBinLabel(i+15,label.str().c_str());
00141           label.str("");
00142         }
00143 
00144       depth[1]->setBinLabel(44,"29HE");
00145       for (int i=29;i<=41;i=i+2)
00146         {
00147           label<<i;
00148           depth[1]->setBinLabel(i+16,label.str().c_str());
00149           label.str("");
00150         }
00151 
00152       // HE depth 3 labels;
00153       depth[2]->setBinLabel(1,"-28");
00154       depth[2]->setBinLabel(2,"-27");
00155       depth[2]->setBinLabel(3,"Null");
00156       depth[2]->setBinLabel(4,"-16");
00157       depth[2]->setBinLabel(5,"Null");
00158       depth[2]->setBinLabel(6,"16");
00159       depth[2]->setBinLabel(7,"Null");
00160       depth[2]->setBinLabel(8,"27");
00161       depth[2]->setBinLabel(9,"28");
00162      
00163       for (int d=0;d<4;++d)
00164         {
00165           depth[d]->setAxisTitle("i#eta",1);
00166           depth[d]->setAxisTitle("i#phi",2); 
00167         }
00168     };
00169   // special fill call based on detid -- eventually will need special treatment
00170   void Fill(HcalDetId& id, double val=1)
00171     { 
00172       // If in HF, need to shift by 1 bin (-1 bin lower in -HF, +1 bin higher in +HF)
00173       if (id.subdet()==HcalForward)
00174         depth[id.depth()-1]->Fill(id.ieta()<0 ? id.ieta()-1 : id.ieta()+1, id.iphi(), val);
00175       else 
00176         depth[id.depth()-1]->Fill(id.ieta(),id.iphi(),val);
00177     };
00178 
00179   void Reset(void) 
00180     {
00181       for (unsigned int d=0;d<depth.size();d++)
00182         if(depth[d]) depth[d]->Reset();
00183     }; // void Reset(void)
00184 
00185   //******************************************************************************************
00186   std::vector<MonitorElement*> depth;
00187 
00188 };
00189 
00190 // Now define functions that can be used in conjunction with EtaPhi histograms
00191 
00192 // This arrays the eta binning for depth 2 histograms (with a gap between -15 -> +15)
00193 const int binmapd2[]={-42,-41,-40,-39,-38,-37,-36,-35,-34,-33,-32,-31,-30,
00194                                        -29,-28,-27,-26,-25,-24,-23,-22,-21,-20,-19,-18,-17,
00195                                        -16,-15,-9999, 15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,
00196                                        30,31,32,33,34,35,36,37,38,39,40,41,42};
00197 
00198 // This stores eta binning in depth 3 (where HE is only present at a few ieta values)
00199 
00200 const int binmapd3[]={-28,-27,-9999,-16,-9999,16,-9999,27,28};
00201 
00202 inline int CalcEtaBin(int subdet, int ieta, int depth)
00203 {
00204   // This takes the eta value from a subdetector and return an eta counter value as used by eta-phi array
00205   // (ieta=-41 corresponds to bin 0, +41 to bin 85 -- there are two offsets to deal with the overlap at |ieta|=29).
00206   // For HO, ieta = -15 corresponds to bin 0, and ieta=15 is bin 30
00207   // For HE depth 3, things are more complicated, but feeding the ieta value will give back the corresponding counter eta value
00208   
00209   // The CalcEtaBin value is the value as used within our array counters, and thus starts at 0.
00210   // If you are using it with getBinContent or setBinContent, you will need to add +1 to the result of this function
00211   
00212   int etabin=-9999; // default invalid value
00213 
00214   if (depth==1)
00215     {
00216       // Depth 1 is fairly straightforward -- just shift HF-, HF+ by -/+1
00217       etabin=ieta+42;
00218       if (subdet==HcalForward)
00219         {
00220           ieta < 0 ? etabin-- : etabin++;
00221         }
00222     }
00223 
00224   else if (depth==2)
00225     {
00226       // Depth 2 is more complicated, given that there are no cells in the range |ieta|<15
00227       if (ieta<-14)
00228         {
00229           etabin=ieta+42;
00230           if (subdet==HcalForward) etabin--;
00231         }
00232       else if (ieta>14)
00233         {
00234           etabin=ieta+14;
00235           if (subdet==HcalForward) etabin++;
00236         }
00237       
00238     }
00239   // HO is also straightforward; a simple offset to the ieta value is applied
00240   else if (subdet==HcalOuter && abs(ieta)<16)
00241     etabin=ieta+15;
00242   else if (subdet==HcalEndcap)
00243     {
00244       // HE depth 3 has spotty coverage; hard-code the bin response
00245       if (depth==3)
00246         {
00247           if (ieta==-28) etabin=0;
00248           else if (ieta==-27) etabin=1;
00249           else if (ieta==-16) etabin=3;
00250           else if (ieta==16)  etabin=5;
00251           else if (ieta==27)  etabin=7;
00252           else if (ieta==28)  etabin=8;
00253         }
00254     }
00255   return etabin;
00256 }
00257 
00258 inline int CalcIeta(int subdet, int eta, int depth)
00259 {
00260   // This function returns the 'true' ieta value given subdet, eta, and depth
00261   // Here 'eta' is the index from our arrays (it starts at 0);
00262   // remember that histogram bins start with bin 1, so there's an offset of 1
00263   // to consider if using getBinContent(eta,phi)
00264 
00265   // eta runs from 0...X  (X depends on depth)
00266   int ieta=-9999; // default value is nonsensical
00267   if (subdet==HcalBarrel)
00268     {
00269       if (depth==1) 
00270         {
00271           ieta=eta-42;
00272           if (ieta==0) return -9999;
00273           return ieta;
00274         }
00275       else if (depth==2)
00276         {
00277           ieta=binmapd2[eta];
00278           if (ieta==0) return -9999;
00279           if (ieta==17 || ieta == -17) 
00280             return -9999; // no depth 2 cells at |ieta| = 17
00281           return ieta;
00282         }
00283       else
00284         return -9999; // non-physical value
00285     }
00286   else if (subdet==HcalForward)
00287     {
00288       if (depth==1)
00289         {
00290           ieta=eta-42;
00291           if (eta<13) ieta++;
00292           else if (eta>71) ieta--;
00293           else return -9999; // if outside forward range, return dummy
00294           return ieta;
00295         }
00296       else if (depth==2)
00297         {
00298           ieta=binmapd2[eta]; // special map for depth 2
00299           if (ieta<=-30) ieta++;
00300           else if (ieta>=30) ieta--;
00301           else return -9999;
00302           return ieta;
00303         }
00304       else return -9999;
00305     }
00306 
00307   else if (subdet==HcalEndcap)
00308     {
00309       if (depth==1) 
00310         ieta=eta-42;
00311       else if (depth==2) 
00312         {
00313           ieta=binmapd2[eta];
00314           if (abs(ieta)>29 || abs(ieta)<18) return -9999; // outside HE
00315           if (ieta==0) return -9999;
00316           return ieta;
00317         }
00318       else if (depth==3)
00319         {
00320           if (eta<0 || eta>8) return -9999;
00321           else
00322             ieta=binmapd3[eta]; // special map for depth 3
00323           if (ieta==0) return -9999;
00324           return ieta;
00325         }
00326       else return -9999;
00327     } // HcalEndcap
00328   else if ( subdet==HcalOuter)
00329     {
00330       if (depth!=4)
00331         return -9999;
00332       else
00333         {
00334           ieta= eta-15;  // bin 0 is ieta=-15, all bins increment normally from there
00335           if (abs(ieta)>15) return -9999;
00336           if (ieta==0) return -9999;
00337           return ieta;
00338         }
00339     } // HcalOuter
00340   if (ieta==0) return -9999;
00341   return ieta;
00342 }
00343 
00344 inline int CalcIeta(int eta, int depth)
00345 {
00346   // This version of CalcIeta does the same as the function above,
00347   // but does not require that 'subdet' be specified.
00348 
00349   // returns ieta value give an eta counter.
00350   // eta runs from 0...X  (X depends on depth)
00351   int ieta=-9999;
00352   if (eta<0) return ieta;
00353   if (depth==1)
00354     {
00355       ieta=eta-42; // default shift: bin 0 corresponds to a histogram ieta of -42 (which is offset by 1 from true HF value of -41)
00356       if (eta<13) ieta++;
00357       else if (eta>71) ieta--;
00358       if (ieta==0) ieta=-9999;
00359       return ieta;
00360     }
00361   else if (depth==2)
00362     {
00363       if (eta>57) return -9999;
00364       else
00365         {
00366           ieta=binmapd2[eta];
00367           if (ieta==-9999) return ieta;
00368           if (ieta==0) return -9999;
00369           if (ieta==17 || ieta == -17) return -9999; // no depth 2 cells at |ieta| = 17
00370           else if (ieta<=-30) ieta++;
00371           else if (ieta>=30) ieta--;
00372           return ieta;
00373         }
00374     }
00375   else if (depth==3)
00376     {
00377       if (eta>8) return -9999;
00378       else
00379         ieta=binmapd3[eta];
00380       if (ieta==0) return -9999;
00381       return ieta;
00382     }
00383   else if (depth==4)
00384     {
00385       ieta= eta-15;  // bin 0 is ieta=-15, all bins increment normally from there
00386       if (abs(ieta)>15) return -9999;
00387       if (ieta==0) return -9999;
00388       return ieta;
00389     }
00390   return ieta; // avoids compilation warning
00391 }
00392 
00393 
00394 // Functions to check whether a given (eta,depth) value is valid for a given subdetector
00395 
00396 inline std::vector<std::string> HcalEtaPhiHistNames()
00397 {
00398   std::vector<std::string> name;
00399   name.push_back("HB HE HF Depth 1 ");
00400   name.push_back("HB HE HF Depth 2 ");
00401   name.push_back("HE Depth 3 ");
00402   name.push_back("HO Depth 4 ");
00403   return name;
00404 }
00405 
00406 
00407 inline bool isHB(int etabin, int depth)
00408 {
00409   if (depth>2) return false;
00410   else if (depth<1) return false;
00411   else
00412     {
00413       int ieta=CalcIeta(etabin,depth);
00414       if (ieta==-9999) return false;
00415       if (depth==1)
00416         {
00417           if (abs(ieta)<=16 ) return true;
00418           else return false;
00419         }
00420       else if (depth==2)
00421         {
00422           if (abs(ieta)==15 || abs(ieta)==16) return true;
00423           else return false;
00424         }
00425     }
00426   return false;
00427 }
00428 
00429 inline bool isHE(int etabin, int depth)
00430 {
00431   if (depth>3) return false;
00432   else if (depth<1) return false;
00433   else
00434     {
00435       int ieta=CalcIeta(etabin,depth);
00436       if (ieta==-9999) return false;
00437       if (depth==1)
00438         {
00439           if (abs(ieta)>=17 && abs(ieta)<=28 ) return true;
00440           if (ieta==-29 && etabin==13) return true; // HE -29
00441           if (ieta==29 && etabin == 71) return true; // HE +29
00442         }
00443       else if (depth==2)
00444         {
00445           if (abs(ieta)>=17 && abs(ieta)<=28 ) return true;
00446           if (ieta==-29 && etabin==13) return true; // HE -29
00447           if (ieta==29 && etabin == 43) return true; // HE +29
00448         }
00449       else if (depth==3)
00450         return true;
00451     }
00452   return false;
00453 }
00454 
00455 inline bool isHF(int etabin, int depth)
00456 {
00457   if (depth>2) return false;
00458   else if (depth<1) return false;
00459   else
00460     {
00461       int ieta=CalcIeta(etabin,depth);
00462       if (ieta==-9999) return false;
00463       if (depth==1)
00464         {
00465           if (ieta==-29 && etabin==13) return false; // HE -29
00466           else if (ieta==29 && etabin == 71) return false; // HE +29
00467           else if (abs(ieta)>=29 ) return true;
00468         }
00469       else if (depth==2)
00470         {
00471           if (ieta==-29 && etabin==13) return false; // HE -29
00472           else if (ieta==29 && etabin==43) return false; // HE +29
00473           else if (abs(ieta)>=29 ) return true;
00474         }
00475     }
00476   return false;
00477 }
00478 
00479 inline bool isHO(int etabin, int depth)
00480 {
00481   if (depth!=4) return false;
00482   int ieta=CalcIeta(etabin,depth);
00483   if (ieta!=-9999) return true;
00484   return false;
00485 }
00486 
00487 // Checks whether HO region contains SiPM
00488 
00489 inline bool isSiPM(int ieta, int iphi, int depth)
00490 {
00491   if (depth!=4) return false;
00492   // HOP1
00493   if (ieta>=5 && ieta <=10 && iphi>=47 && iphi<=58) return true;  
00494   // HOP2
00495   if (ieta>=11 && ieta<=15 && iphi>=59 && iphi<=70) return true;
00496   return false;
00497 }  // bool isSiPM
00498 
00499 
00500 // Checks whether (subdet, ieta, iphi, depth) value is a valid Hcal cell
00501 
00502 inline bool validDetId(HcalSubdetector sd, int ies, int ip, int dp)
00503 {
00504   // inputs are (subdetector, ieta, iphi, depth)
00505   // stolen from latest version of DataFormats/HcalDetId/src/HcalDetId.cc (not yet available in CMSSW_2_1_9)
00506 
00507   const int ie ( abs( ies ) ) ;
00508 
00509   return ( ( ip >=  1         ) &&
00510            ( ip <= 72         ) &&
00511            ( dp >=  1         ) &&
00512            ( ie >=  1         ) &&
00513            ( ( ( sd == HcalBarrel ) &&
00514                ( ( ( ie <= 14         ) &&
00515                    ( dp ==  1         )    ) ||
00516                  ( ( ( ie == 15 ) || ( ie == 16 ) ) && 
00517                    ( dp <= 2          )                ) ) ) ||
00518              (  ( sd == HcalEndcap ) &&
00519                 ( ( ( ie == 16 ) &&
00520                     ( dp ==  3 )          ) ||
00521                   ( ( ie == 17 ) &&
00522                     ( dp ==  1 )          ) ||
00523                   ( ( ie >= 18 ) &&
00524                     ( ie <= 20 ) &&
00525                     ( dp <=  2 )          ) ||
00526                   ( ( ie >= 21 ) &&
00527                     ( ie <= 26 ) &&
00528                     ( dp <=  2 ) &&
00529                     ( ip%2 == 1 )         ) ||
00530                   ( ( ie >= 27 ) &&
00531                     ( ie <= 28 ) &&
00532                     ( dp <=  3 ) &&
00533                     ( ip%2 == 1 )         ) ||
00534                   ( ( ie == 29 ) &&
00535                     ( dp <=  2 ) &&
00536                     ( ip%2 == 1 )         )          )      ) ||
00537              (  ( sd == HcalOuter ) &&
00538                 ( ie <= 15 ) &&
00539                 ( dp ==  4 )           ) ||
00540              (  ( sd == HcalForward ) &&
00541                 ( dp <=  2 )          &&
00542                 ( ( ( ie >= 29 ) &&
00543                     ( ie <= 39 ) &&
00544                     ( ip%2 == 1 )    ) ||
00545                   ( ( ie >= 40 ) &&
00546                     ( ie <= 41 ) &&
00547                     ( ip%4 == 3 )         )  ) ) ) ) ;
00548 
00549 
00550 
00551 } // bool validDetId(HcalSubdetector sd, int ies, int ip, int dp)
00552 
00553 
00554 // Sets eta, phi labels for 'summary' eta-phi plots (identical to Depth 1 Eta-Phi labelling)
00555 
00556 inline void SetEtaPhiLabels(MonitorElement* h)
00557 {
00558   std::stringstream label;
00559   for (int i=-41;i<=-29;i=i+2)
00560     {
00561       label<<i;
00562       h->setBinLabel(i+42,label.str().c_str());
00563       label.str("");
00564     }
00565   h->setBinLabel(14,"-29HE");
00566     
00567   // offset by one for HE
00568   for (int i=-27;i<=27;i=i+2)
00569     {
00570       label<<i;
00571       h->setBinLabel(i+43,label.str().c_str());
00572       label.str("");
00573     }
00574   h->setBinLabel(72,"29HE");
00575   for (int i=29;i<=41;i=i+2)
00576     {
00577       label<<i;
00578       h->setBinLabel(i+44,label.str().c_str());
00579       label.str("");
00580     }
00581   return;
00582 }
00583 
00584 
00585 // Fill Unphysical bins in histograms
00586 
00587 inline void FillUnphysicalHEHFBins(EtaPhiHists &hh)
00588 {
00589   int ieta=0;
00590   int iphi=0;
00591   // First 2 depths have 5-10-20 degree corrections
00592   for (unsigned int d=0;d<3;++d)
00593     {
00594       if (!hh.depth[d]) continue;
00595       for (int eta=0;eta<hh.depth[d]->getNbinsX();++eta)
00596         {
00597           ieta=CalcIeta(eta,d+1);
00598           if (ieta==-9999 || abs(ieta)<21) continue;
00599           for (int phi=0;phi<hh.depth[d]->getNbinsY();++phi)
00600             {
00601               iphi=phi+1;
00602               if (iphi%2==1 && abs(ieta)<40 && iphi<73)
00603                 {
00604                   hh.depth[d]->setBinContent(eta+1,iphi+1,hh.depth[d]->getBinContent(eta+1,iphi));
00605                 }
00606               // last two eta strips span 20 degrees in phi
00607               // Fill the phi cell above iphi, and the 2 below it
00608               else  if (abs(ieta)>39 && iphi%4==3 && iphi<73)
00609                 {
00610                   //ieta=40, iphi=3 covers iphi 3,4,5,6
00611                   hh.depth[d]->setBinContent(eta+1,(iphi)%72+1, hh.depth[d]->getBinContent(eta+1,iphi));
00612                   hh.depth[d]->setBinContent(eta+1,(iphi+1)%72+1, hh.depth[d]->getBinContent(eta+1,iphi));
00613                   hh.depth[d]->setBinContent(eta+1,(iphi+2)%72+1, hh.depth[d]->getBinContent(eta+1,iphi));
00614                 }
00615             } // for (int phi...)
00616         } // for (int eta...)
00617     } // for (int d=0;...)
00618   // no corrections needed for HO (depth 4)
00619   return;
00620 } // FillUnphysicalHEHFBins(MonitorElement* hh)
00621 
00622 
00623 // Fill unphysical bins for single ME
00624 inline void FillUnphysicalHEHFBins(MonitorElement* hh)
00625 {
00626   // Fills unphysical HE/HF bins for Summary Histogram
00627   // Summary Histogram is binned with the same binning as the Depth 1 EtaPhiHists
00628   if (hh==0) return; 
00629   int ieta=0;
00630   int iphi=0;
00631   int etabins = hh->getNbinsX();
00632   int phibins = hh->getNbinsY();
00633   float binval=0;
00634   for (int eta=0;eta<etabins;++eta) // loop over eta bins
00635     {
00636       ieta=CalcIeta(eta,1);
00637       if (ieta==-9999 || abs(ieta)<21) continue;  // ignore etas that don't exist, or that have 5 degree phi binning
00638 
00639       for (int phi=0;phi<phibins;++phi)
00640         {
00641           iphi=phi+1;
00642           if (iphi%2==1 && abs(ieta)<40 && iphi<73) // 10 degree phi binning condition
00643             {
00644               binval=hh->getBinContent(eta+1,iphi);
00645               hh->setBinContent(eta+1,iphi+1,binval);
00646             } // if (iphi%2==1...) 
00647           else if (abs(ieta)>39 && iphi%4==3 && iphi<73) // 20 degree phi binning condition
00648             {
00649               // Set last two eta strips where each cell spans 20 degrees in phi
00650               // Set next phi cell above iphi, and 2 cells below the actual cell 
00651               hh->setBinContent(eta+1, (iphi)%72+1, hh->getBinContent(eta+1,iphi));
00652               hh->setBinContent(eta+1, (iphi+1)%72+1, hh->getBinContent(eta+1,iphi));
00653               hh->setBinContent(eta+1, (iphi+2)%72+1, hh->getBinContent(eta+1,iphi));
00654             } // else if (abs(ieta)>39 ...)
00655         } // for (int phi=0;phi<72;++phi)
00656 
00657     } // for (int eta=0; eta< (etaBins_-2);++eta)
00658 
00659   return;
00660 } // FillUnphysicalHEHFBins(std::vector<MonitorElement*> &hh)
00661 
00662 
00663 
00664 
00665 #endif