Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:14:37

0001 #include "Geometry/EcalTestBeam/interface/EcalTBCrystalMap.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003 #include "FWCore/ParameterSet/interface/FileInPath.h"
0004 #include "CLHEP/Random/RandFlat.h"
0005 
0006 #include <string>
0007 
0008 int main() {
0009   edm::FileInPath dataFile("Geometry/EcalTestBeam/data/BarrelSM1CrystalCenterElectron120GeV.dat");
0010   EcalTBCrystalMap theTestMap(dataFile.fullPath());
0011 
0012   long nCrystal = 1700;
0013 
0014   for (int i = 0; i < 10; ++i) {
0015     int thisCrystal = CLHEP::RandFlat::shootInt(nCrystal);
0016     double thisEta = 0.;
0017     double thisPhi = 0.;
0018 
0019     theTestMap.findCrystalAngles(thisCrystal, thisEta, thisPhi);
0020 
0021     edm::LogVerbatim("EcalTestBeam") << "Crystal number " << thisCrystal << " eta = " << thisEta
0022                                      << " phi = " << thisPhi;
0023 
0024     int checkThisCrystal = theTestMap.CrystalIndex(thisEta, thisPhi);
0025 
0026     edm::LogVerbatim("EcalTestBeam") << "(eta,phi) = " << thisEta << " , " << thisPhi
0027                                      << " corresponds to crystal n. = " << checkThisCrystal;
0028   }
0029 
0030   return 0;
0031 }