Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-06 07:38:45

0001 #include "MagneticField/Interpolation/interface/MFGridFactory.h"
0002 #include "MagneticField/Interpolation/interface/binary_ifstream.h"
0003 #include "DataFormats/GeometrySurface/interface/GloballyPositioned.h"
0004 
0005 #include "RectangularCartesianMFGrid.h"
0006 #include "RectangularCylindricalMFGrid.h"
0007 #include "TrapezoidalCartesianMFGrid.h"
0008 #include "TrapezoidalCylindricalMFGrid.h"
0009 #include "SpecialCylindricalMFGrid.h"
0010 #include "CylinderFromSectorMFGrid.h"
0011 
0012 #include <iostream>
0013 
0014 using namespace std;
0015 
0016 MFGrid* MFGridFactory::build(const string& name, const GloballyPositioned<float>& vol) {
0017   magneticfield::interpolation::binary_ifstream inFile(name);
0018   return build(inFile, vol);
0019 }
0020 
0021 MFGrid* MFGridFactory::build(binary_ifstream& inFile, const GloballyPositioned<float>& vol) {
0022   int gridType;
0023   inFile >> gridType;
0024 
0025   MFGrid* result;
0026   switch (gridType) {
0027     case 1:
0028       result = new RectangularCartesianMFGrid(inFile, vol);
0029       break;
0030     case 2:
0031       result = new TrapezoidalCartesianMFGrid(inFile, vol);
0032       break;
0033     case 3:
0034       result = new RectangularCylindricalMFGrid(inFile, vol);
0035       break;
0036     case 4:
0037       result = new TrapezoidalCylindricalMFGrid(inFile, vol);
0038       break;
0039     case 5:
0040       result = new SpecialCylindricalMFGrid(inFile, vol, gridType);
0041       break;
0042     case 6:
0043       result = new SpecialCylindricalMFGrid(inFile, vol, gridType);
0044       break;
0045     default:
0046       cout << "ERROR Grid type unknown: " << gridType << endl;
0047       //    result = new GlobalGridWrapper(vol, name);
0048       result = nullptr;
0049       break;
0050   }
0051   return result;
0052 }
0053 
0054 MFGrid* MFGridFactory::build(const string& name, const GloballyPositioned<float>& vol, double phiMin, double phiMax) {
0055   MFGrid* sectorGrid = build(name, vol);
0056   return new CylinderFromSectorMFGrid(vol, phiMin, phiMax, sectorGrid);
0057 }