CMS 3D CMS Logo

HcalDigiTester.cc

Go to the documentation of this file.
00001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00002 #include "FWCore/ServiceRegistry/interface/Service.h"
00003 #include "Validation/HcalDigis/interface/HcalDigiTester.h"
00004 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
00005 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
00006 #include "DataFormats/HcalDetId/interface/HcalElectronicsId.h"
00007 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00008 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
00009 #include "DataFormats/HcalDigi/interface/HcalQIESample.h"
00010 
00011 #include "Geometry/Records/interface/CaloGeometryRecord.h"
00012 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
00013 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
00014 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
00015 
00016 #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
00017 #include "CalibFormats/HcalObjects/interface/HcalCoderDb.h"
00018 #include "CalibFormats/HcalObjects/interface/HcalCalibrations.h"
00019 
00020 #include "DQMServices/Core/interface/DQMStore.h"
00021 
00022 #include "DataFormats/HcalDigi/interface/HBHEDataFrame.h"
00023 #include "DataFormats/HcalDigi/interface/HFDataFrame.h"
00024 #include "DataFormats/HcalDigi/interface/HODataFrame.h"
00025 #include "SimDataFormats/HepMCProduct/interface/HepMCProduct.h"
00026 #include <vector>
00027 #include <utility>
00028 #include <ostream>
00029 #include <string>
00030 #include <algorithm>
00031 #include <cmath>
00032 
00033 #include "CondFormats/HcalObjects/interface/HcalGain.h"
00034 #include "CondFormats/HcalObjects/interface/HcalGainWidth.h"
00035 #include "CondFormats/HcalObjects/interface/HcalPedestal.h"
00036 #include "CondFormats/HcalObjects/interface/HcalPedestalWidth.h"
00037 
00038 template<class Digi>
00039 
00040 void HcalDigiTester::reco(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
00041   double fphi_mc = -999999.;  // phi of initial particle from HepMC
00042   double feta_mc = -999999.;  // eta of initial particle from HepMC
00043   
00044   bool MC = false;
00045   
00046   // double deltaR = 0.05;
00047   
00048   edm::Handle<edm::HepMCProduct> evtMC;
00049   //  iEvent.getByLabel("VtxSmeared",evtMC);
00050   iEvent.getByLabel("source",evtMC);
00051   if (!evtMC.isValid()) {
00052     MC=false;
00053     std::cout << "no HepMCProduct found" << std::endl;    
00054   } else {
00055     MC=true;
00056     //    std::cout << "source HepMCProduct found"<< std::endl;
00057   }
00058   
00059   HepMC::GenEvent * myGenEvent = new  HepMC::GenEvent(*(evtMC->GetEvent()));
00060   for ( HepMC::GenEvent::particle_iterator p = myGenEvent->particles_begin();
00061         p != myGenEvent->particles_end(); ++p ) {
00062     fphi_mc = (*p)->momentum().phi();
00063     feta_mc = (*p)->momentum().eta();
00064   }
00065 
00066 
00067   typename   edm::Handle<edm::SortedCollection<Digi> > digiCollection;
00068   typename edm::SortedCollection<Digi>::const_iterator digiItr;
00069   
00070    
00071   // ADC2fC 
00072 
00073   const HcalQIEShape* shape = conditions->getHcalShape();
00074   HcalCalibrations calibrations;
00075   CaloSamples tool;
00076 
00077 
00078   iEvent.getByLabel (inputTag_, digiCollection);
00079 
00080   int subdet = 0;
00081   if (hcalselector_ == "HB"  ) subdet = 1;
00082   if (hcalselector_ == "HE"  ) subdet = 2;
00083   if (hcalselector_ == "HO"  ) subdet = 3;
00084   if (hcalselector_ == "HF"  ) subdet = 4; 
00085 
00086   if(subdet == 1) nevent1++;
00087   if(subdet == 2) nevent2++;
00088   if(subdet == 3) nevent3++;
00089   if(subdet == 4) nevent4++;
00090   
00091   int zsign = 0;
00092   if (zside_ == "+")  zsign =  1;
00093   if (zside_ == "-")  zsign = -1;
00094 
00095   int ndigis = 0;
00096   //  amplitude for signal cell at diff. depths
00097   double ampl1    = 0.;
00098   double ampl2    = 0.;
00099   double ampl3    = 0.;
00100   double ampl4    = 0.;
00101   double ampl_all_depths = 0.;
00102 
00103   /*
00104   std::cout << " HcalDigiTester::reco :  "
00105             << "subdet=" << subdet << "  noise="<< noise_ << std::endl;
00106   */
00107 
00108   // CYCLE OVER CELLS ========================================================
00109 
00110   for (digiItr=digiCollection->begin();digiItr!=digiCollection->end();digiItr++) {
00111     
00112     HcalDetId cell(digiItr->id()); 
00113     int depth = cell.depth();
00114     int iphi  = cell.iphi()-1;
00115     int ieta  = cell.ieta();
00116     int sub   = cell.subdet();
00117     if(ieta > 0) ieta--;
00118     
00119     // Gains, pedestals (once !) and only for "noise" case  
00120     if ( ((nevent1 == 1 && subdet == 1) || 
00121           (nevent2 == 1 && subdet == 2) ||
00122           (nevent3 == 1 && subdet == 3) ||
00123           (nevent4 == 1 && subdet == 4)) && noise_ == 1 && sub == subdet) { 
00124 
00125       HcalGenericDetId hcalGenDetId(digiItr->id());
00126       const HcalPedestal* pedestal = conditions->getPedestal(hcalGenDetId);
00127       const HcalGain*  gain = conditions->getGain(hcalGenDetId); 
00128       const HcalGainWidth* gainWidth = 
00129         conditions->getGainWidth(hcalGenDetId); 
00130       const HcalPedestalWidth* pedWidth =
00131         conditions-> getPedestalWidth(hcalGenDetId);  
00132       
00133       double gainValue0 = gain->getValue(0);
00134       double gainValue1 = gain->getValue(1);
00135       double gainValue2 = gain->getValue(2);
00136       double gainValue3 = gain->getValue(3);
00137 
00138       double gainWidthValue0 = gainWidth->getValue(0);
00139       double gainWidthValue1 = gainWidth->getValue(1);
00140       double gainWidthValue2 = gainWidth->getValue(2);
00141       double gainWidthValue3 = gainWidth->getValue(3);
00142       
00143       /*     
00144         std::cout << " ieta, iphi, depth : " 
00145         << ieta << " " << iphi << " " << depth 
00146         << "  gain0 " << gainValue0 << "  gainWidth0 " << gainWidthValue0
00147         << std::endl;
00148       */
00149       
00150       double pedValue0 = pedestal->getValue(0);
00151       double pedValue1 = pedestal->getValue(1);
00152       double pedValue2 = pedestal->getValue(2);
00153       double pedValue3 = pedestal->getValue(3);
00154       
00155       double pedWidth0 = pedWidth->getWidth(0);
00156       double pedWidth1 = pedWidth->getWidth(1);
00157       double pedWidth2 = pedWidth->getWidth(2);
00158       double pedWidth3 = pedWidth->getWidth(3);
00159       
00160       if (depth == 1) {
00161         monitor()->fillmeGain0Depth1(gainValue0);
00162         monitor()->fillmeGain1Depth1(gainValue1);
00163         monitor()->fillmeGain2Depth1(gainValue2);
00164         monitor()->fillmeGain3Depth1(gainValue3);
00165 
00166         monitor()->fillmeGainWidth0Depth1(gainWidthValue0);
00167         monitor()->fillmeGainWidth1Depth1(gainWidthValue1);
00168         monitor()->fillmeGainWidth2Depth1(gainWidthValue2);
00169         monitor()->fillmeGainWidth3Depth1(gainWidthValue3);
00170 
00171         monitor()->fillmePed0Depth1(pedValue0);
00172         monitor()->fillmePed1Depth1(pedValue1);
00173         monitor()->fillmePed2Depth1(pedValue2);
00174         monitor()->fillmePed3Depth1(pedValue3);
00175 
00176         monitor()->fillmePedWidth0Depth1(pedWidth0);
00177         monitor()->fillmePedWidth1Depth1(pedWidth1);
00178         monitor()->fillmePedWidth2Depth1(pedWidth2);
00179         monitor()->fillmePedWidth3Depth1(pedWidth3);
00180 
00181         monitor()->fillmeGainMap1  (double(ieta), double(iphi), gainValue0);
00182         monitor()->fillmePwidthMap1(double(ieta), double(iphi), pedWidth0) ;  
00183       }
00184 
00185       if (depth == 2) {
00186         monitor()->fillmeGain0Depth2(gainValue0);
00187         monitor()->fillmeGain1Depth2(gainValue1);
00188         monitor()->fillmeGain2Depth2(gainValue2);
00189         monitor()->fillmeGain3Depth2(gainValue3);
00190 
00191         monitor()->fillmeGainWidth0Depth2(gainWidthValue0);
00192         monitor()->fillmeGainWidth1Depth2(gainWidthValue1);
00193         monitor()->fillmeGainWidth2Depth2(gainWidthValue2);
00194         monitor()->fillmeGainWidth3Depth2(gainWidthValue3);
00195 
00196         monitor()->fillmePed0Depth2(pedValue0);
00197         monitor()->fillmePed1Depth2(pedValue1);
00198         monitor()->fillmePed2Depth2(pedValue2);
00199         monitor()->fillmePed3Depth2(pedValue3);
00200 
00201         monitor()->fillmePedWidth0Depth2(pedWidth0);
00202         monitor()->fillmePedWidth1Depth2(pedWidth1);
00203         monitor()->fillmePedWidth2Depth2(pedWidth2);
00204         monitor()->fillmePedWidth3Depth2(pedWidth3);
00205 
00206         monitor()->fillmeGainMap1  (double(ieta), double(iphi), gainValue0);
00207         monitor()->fillmePwidthMap1(double(ieta), double(iphi), pedWidth0) ;  
00208       }
00209 
00210       if (depth == 3) {
00211         monitor()->fillmeGain0Depth3(gainValue0);
00212         monitor()->fillmeGain1Depth3(gainValue1);
00213         monitor()->fillmeGain2Depth3(gainValue2);
00214         monitor()->fillmeGain3Depth3(gainValue3);
00215 
00216         monitor()->fillmeGainWidth0Depth3(gainWidthValue0);
00217         monitor()->fillmeGainWidth1Depth3(gainWidthValue1);
00218         monitor()->fillmeGainWidth2Depth3(gainWidthValue2);
00219         monitor()->fillmeGainWidth3Depth3(gainWidthValue3);
00220 
00221         monitor()->fillmePed0Depth3(pedValue0);
00222         monitor()->fillmePed1Depth3(pedValue1);
00223         monitor()->fillmePed2Depth3(pedValue2);
00224         monitor()->fillmePed3Depth3(pedValue3);
00225 
00226         monitor()->fillmePedWidth0Depth3(pedWidth0);
00227         monitor()->fillmePedWidth1Depth3(pedWidth1);
00228         monitor()->fillmePedWidth2Depth3(pedWidth2);
00229         monitor()->fillmePedWidth3Depth3(pedWidth3);
00230 
00231         monitor()->fillmeGainMap1  (double(ieta), double(iphi), gainValue0);
00232         monitor()->fillmePwidthMap1(double(ieta), double(iphi), pedWidth0) ;  
00233       }
00234 
00235       if (depth == 4) {
00236         monitor()->fillmeGain0Depth4(gainValue0);
00237         monitor()->fillmeGain1Depth4(gainValue1);
00238         monitor()->fillmeGain2Depth4(gainValue2);
00239         monitor()->fillmeGain3Depth4(gainValue3);
00240 
00241         monitor()->fillmeGainWidth0Depth4(gainWidthValue0);
00242         monitor()->fillmeGainWidth1Depth4(gainWidthValue1);
00243         monitor()->fillmeGainWidth2Depth4(gainWidthValue2);
00244         monitor()->fillmeGainWidth3Depth4(gainWidthValue3);
00245 
00246         monitor()->fillmePed0Depth4(pedValue0);
00247         monitor()->fillmePed1Depth4(pedValue1);
00248         monitor()->fillmePed2Depth4(pedValue2);
00249         monitor()->fillmePed3Depth4(pedValue3);
00250 
00251         monitor()->fillmePedWidth0Depth4(pedWidth0);
00252         monitor()->fillmePedWidth1Depth4(pedWidth1);
00253         monitor()->fillmePedWidth2Depth4(pedWidth2);
00254         monitor()->fillmePedWidth3Depth4(pedWidth3);
00255 
00256         monitor()->fillmeGainMap1  (double(ieta), double(iphi), gainValue0);
00257         monitor()->fillmePwidthMap1(double(ieta), double(iphi), pedWidth0) ;  
00258 
00259       }
00260     }     // end of event #1 
00261     
00262     
00263     // No-noise case, only subdet selected  =================================
00264     if ( sub == subdet && noise_ == 0 ) {   
00265       
00266       const CaloCellGeometry* cellGeometry =
00267         geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
00268       double fEta = cellGeometry->getPosition ().eta () ;
00269       double fPhi = cellGeometry->getPosition ().phi () ;
00270       int depth   = cell.depth();
00271       
00272       // old version 
00273       //      conditions->makeHcalCalibration(cell, &calibrations);
00274       HcalCalibrations calibrations = conditions->getHcalCalibrations(cell);
00275 
00276       const HcalQIECoder* channelCoder = conditions->getHcalCoder(cell);
00277       HcalCoderDb coder (*channelCoder, *shape);
00278       coder.adc2fC(*digiItr,tool);
00279       
00280       double noiseADC =  (*digiItr)[0].adc();     
00281       double noisefC  =  tool[0];     
00282       
00283       if(depth == 1) { 
00284         monitor()->fillmeADC0_depth1  (noiseADC);
00285         monitor()->fillmeADC0fC_depth1(noisefC);
00286       }
00287       if(depth == 2) { 
00288         monitor()->fillmeADC0_depth2  (noiseADC);
00289         monitor()->fillmeADC0fC_depth2(noisefC);
00290       }
00291       if(depth == 3) { 
00292         monitor()->fillmeADC0_depth3  (noiseADC);
00293         monitor()->fillmeADC0fC_depth3(noisefC);
00294       }
00295       if(depth == 4) { 
00296         monitor()->fillmeADC0_depth4  (noiseADC);
00297         monitor()->fillmeADC0fC_depth4(noisefC);
00298       }
00299       
00300       // Cycle on time slices 
00301       
00302       double ampl = 0.;
00303       int closen  = 0;
00304       if(fabs(feta_mc-fEta) < 0.087/2. && acos(cos(fphi_mc-fPhi))<0.087/2.)
00305         closen = 1;
00306 
00307       for  (int ii=0;ii<tool.size();ii++) {
00308         int capid  = (*digiItr)[ii].capid();
00309         double val = (tool[ii]-calibrations.pedestal(capid));
00310         
00311         monitor()->fillmeAll10slices(double(ii), val);
00312 
00313         
00314         if( closen == 1 && ( ieta * zsign >= 0 )) { 
00315           monitor()->fillmeSignalTimeSlice(double(ii), val);
00316         }
00317 
00318         // HB/HE/HO
00319         if (subdet != 4 && ii>=4 && ii<=7) { 
00320           ampl += val;    
00321           if( closen == 1 && ( ieta * zsign >= 0 )) { 
00322             
00323             if(depth == 1) ampl1 += val;   
00324             if(depth == 2) ampl2 += val;   
00325             if(depth == 3) ampl3 += val;   
00326             if(depth == 4) ampl4 += val;
00327             
00328           }
00329         }
00330         
00331         // HF
00332         if (subdet == 4 && ii==3 )      {
00333           ampl += val;
00334           if( closen == 1 && ( ieta * zsign >= 0 )) { 
00335             //    if( dR(feta_mc, fphi_mc, fEta, fPhi) < deltaR) {  
00336             
00337             if(depth == 1)  ampl1 += val;
00338             if(depth == 2)  ampl2 += val;
00339             if(depth == 3)  ampl3 += val;
00340             if(depth == 4)  ampl4 += val;
00341 
00342           }
00343         }
00344       }
00345       // end of time bucket sample      
00346       
00347       monitor()->fillmeAmplIetaIphi(double(ieta),double(iphi), ampl);
00348       monitor()->fillmeSumAmp      (ampl);
00349       
00350       
00351       if(ampl > 10.) ndigis++;
00352       
00353       // fraction 5,6 bins if ampl. is big.
00354       if(ampl1 > 50. &&  depth == 1 && closen == 1 ) { 
00355           double fBin5  = tool[4] - calibrations.pedestal((*digiItr)[4].capid());
00356         double fBin67 = tool[5] + tool[6] 
00357           - calibrations.pedestal((*digiItr)[5].capid())
00358           - calibrations.pedestal((*digiItr)[6].capid());
00359         fBin5  /= ampl1;
00360         fBin67 /= ampl1;
00361         monitor()->fillmeBin5Frac (fBin5);
00362         monitor()->fillmeBin67Frac(fBin67);
00363       }
00364       
00365     }   
00366   }    // End of CYCLE OVER CELLS =============================================
00367   
00368   
00369   if ( subdet != 0 && noise_ == 0) { // signal only 
00370 
00371     ampl_all_depths = ampl1+ampl2+ampl3+ampl4;
00372     monitor()->fillmeSignalAmp (ampl_all_depths); 
00373     monitor()->fillmeSignalAmp1(ampl1); 
00374     monitor()->fillmeSignalAmp2(ampl2); 
00375     monitor()->fillmeSignalAmp3(ampl3); 
00376     monitor()->fillmeSignalAmp4(ampl4); 
00377     
00378     monitor()->fillmenDigis(ndigis);
00379     
00380     // SimHits 
00381     
00382     edm::Handle<edm::PCaloHitContainer> hcalHits ;
00383     iEvent.getByLabel("g4SimHits","HcalHits",hcalHits);
00384     
00385     const edm::PCaloHitContainer * simhitResult = hcalHits.product () ;
00386     
00387     double ehits  = 0.; 
00388     double ehits1 = 0.; 
00389     double ehits2 = 0.; 
00390     double ehits3 = 0.; 
00391     double ehits4 = 0.; 
00392  
00393     for (std::vector<PCaloHit>::const_iterator simhits = simhitResult->begin ();         simhits != simhitResult->end () ;  ++simhits) {
00394       
00395       HcalDetId cell(simhits->id());
00396       const CaloCellGeometry* cellGeometry =
00397         geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
00398       double fEta  = cellGeometry->getPosition ().eta () ;
00399       double fPhi  = cellGeometry->getPosition ().phi () ;
00400       
00401       if (cell.subdet() == subdet &&  
00402           (fabs(feta_mc-fEta) < 0.087/2. && acos(cos(fphi_mc-fPhi))<0.087/2.)){  
00403         int depth = cell.depth();
00404         double en = simhits->energy();
00405         
00406         ehits += en;
00407         if(depth == 1)  ehits1 += en; 
00408         if(depth == 2)  ehits2 += en; 
00409         if(depth == 3)  ehits3 += en; 
00410         if(depth == 4)  ehits4 += en; 
00411       }
00412     }
00413     
00414     
00415     monitor()->fillmeDigiSimhit (ehits,  ampl_all_depths);
00416     monitor()->fillmeDigiSimhit1(ehits1, ampl1);
00417     monitor()->fillmeDigiSimhit2(ehits2, ampl2);
00418     monitor()->fillmeDigiSimhit3(ehits3, ampl3);
00419     monitor()->fillmeDigiSimhit4(ehits4, ampl4);
00420     
00421     monitor()->fillmeDigiSimhitProfile (ehits,  ampl_all_depths);
00422     monitor()->fillmeDigiSimhitProfile1(ehits1, ampl1);
00423     monitor()->fillmeDigiSimhitProfile2(ehits2, ampl2);
00424     monitor()->fillmeDigiSimhitProfile3(ehits3, ampl3);
00425     monitor()->fillmeDigiSimhitProfile4(ehits4, ampl4);
00426     
00427     if(ehits  > 0) monitor()->fillmeRatioDigiSimhit (ampl_all_depths / ehits);
00428     if(ehits1 > 0) monitor()->fillmeRatioDigiSimhit1(ampl1 / ehits1);
00429     if(ehits2 > 0) monitor()->fillmeRatioDigiSimhit2(ampl2 / ehits2);
00430     if(ehits3 > 0) monitor()->fillmeRatioDigiSimhit3(ampl3 / ehits3);
00431     if(ehits4 > 0) monitor()->fillmeRatioDigiSimhit4(ampl4 / ehits4);
00432     
00433   }  
00434 }
00435 
00436 
00437 HcalDigiTester::HcalDigiTester(const edm::ParameterSet& iConfig)
00438   : dbe_(edm::Service<DQMStore>().operator->()),
00439     inputTag_(iConfig.getParameter<edm::InputTag>("digiLabel")),
00440     outputFile_(iConfig.getUntrackedParameter<std::string>("outputFile", "")),
00441     hcalselector_(iConfig.getUntrackedParameter<std::string>("hcalselector", "all")),
00442     zside_(iConfig.getUntrackedParameter<std::string>("zside", "*")),
00443     monitors_()
00444 {
00445   if ( outputFile_.size() != 0 ) {
00446     edm::LogInfo("OutputInfo") << " Hcal Digi Task histograms will be saved to '" << outputFile_.c_str() << "'";
00447   } else {
00448     edm::LogInfo("OutputInfo") << " Hcal Digi Task histograms will NOT be saved";
00449   }
00450 
00451 
00452 }
00453    
00454 
00455 HcalDigiTester::~HcalDigiTester() { 
00456   if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
00457 }
00458 
00459 
00460 void HcalDigiTester::endJob() { }
00461 
00462 void HcalDigiTester::beginJob(const edm::EventSetup& c){
00463 
00464   nevent1 = 0;
00465   nevent2 = 0;
00466   nevent3 = 0;
00467   nevent4 = 0;
00468 
00469 }
00470 
00471 
00472 HcalSubdetDigiMonitor * HcalDigiTester::monitor()
00473 {
00474   std::map<std::string, HcalSubdetDigiMonitor*>::iterator monitorItr
00475     = monitors_.find(hcalselector_);
00476 
00477   if(monitorItr == monitors_.end())
00478     {
00479       HcalSubdetDigiMonitor* m = new HcalSubdetDigiMonitor(dbe_, hcalselector_, noise_);
00480       std::pair<std::string, HcalSubdetDigiMonitor*> mapElement(
00481                                                                 hcalselector_, m);
00482       monitorItr = monitors_.insert(mapElement).first;
00483     }
00484   return monitorItr->second;
00485 }
00486 
00487 void 
00488 HcalDigiTester::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00489 {
00490 
00491   iSetup.get<CaloGeometryRecord>().get (geometry);
00492   iSetup.get<HcalDbRecord>().get(conditions);
00493 
00494   noise_ = 0;
00495                                                           
00496   if (hcalselector_ == "HB" ) reco<HBHEDataFrame>(iEvent,iSetup);
00497   if (hcalselector_ == "HE" ) reco<HBHEDataFrame>(iEvent,iSetup);
00498   if (hcalselector_ == "HO" ) reco<HODataFrame>(iEvent,iSetup);
00499   if (hcalselector_ == "HF" ) reco<HFDataFrame>(iEvent,iSetup);  
00500 
00501   if (hcalselector_ == "noise") {
00502     noise_ = 1;
00503     
00504     hcalselector_ = "HB";
00505     reco<HBHEDataFrame>(iEvent,iSetup);
00506     hcalselector_ = "HE";
00507     reco<HBHEDataFrame>(iEvent,iSetup);
00508     hcalselector_ = "HO";
00509     reco<HODataFrame>(iEvent,iSetup);
00510     hcalselector_ = "HF";
00511     reco<HFDataFrame>(iEvent,iSetup);
00512   }
00513 
00514 }
00515 double HcalDigiTester::dR(double eta1, double phi1, double eta2, double phi2) { 
00516   double PI = 3.1415926535898;
00517   double deltaphi= phi1 - phi2;
00518   if( phi2 > phi1 ) { deltaphi= phi2 - phi1;}
00519   if(deltaphi > PI) { deltaphi = 2.*PI - deltaphi;}
00520   double deltaeta = eta2 - eta1;
00521   double tmp = sqrt(deltaeta* deltaeta + deltaphi*deltaphi);
00522   return tmp;
00523 }
00524 

Generated on Tue Jun 9 17:49:23 2009 for CMSSW by  doxygen 1.5.4