00001 #ifndef PixelToFEDAssociateFromAscii_H 00002 #define PixelToFEDAssociateFromAscii_H 00003 00009 #include <vector> 00010 #include <string> 00011 00012 #include "CalibTracker/SiPixelConnectivity/interface/TRange.h" 00013 #include "CalibTracker/SiPixelConnectivity/interface/PixelToFEDAssociate.h" 00014 00015 class PixelBarrelName; 00016 class PixelEndcapName; 00017 class PixelModuleName; 00018 00019 00020 00021 class PixelToFEDAssociateFromAscii : public PixelToFEDAssociate { 00022 public: 00023 00024 PixelToFEDAssociateFromAscii(const std::string & fileName); 00025 00027 virtual int operator()(const PixelModuleName &) const; 00028 00030 virtual std::string version() const; 00031 00032 00034 virtual int operator()(const PixelBarrelName &) const; 00035 00037 virtual int operator()(const PixelEndcapName &) const; 00038 00039 private: 00041 void init( const std::string & fileName); 00042 00043 00044 typedef TRange<int> Range; 00045 00048 struct Bdu { int b; Range l,z,f; bool operator()(const PixelBarrelName&) const;}; 00049 00052 struct Edu { int e; Range d,b; bool operator()(const PixelEndcapName&) const;}; 00053 00054 typedef std::vector< std::pair< int, std::vector<Bdu> > > BarrelConnections; 00055 typedef std::vector< std::pair< int, std::vector<Edu> > > EndcapConnections; 00056 static BarrelConnections theBarrel; 00057 static EndcapConnections theEndcap; 00058 00059 private: 00060 00061 std::string theVersion; 00062 00064 void send (std::pair< int, std::vector<Bdu> > & , 00065 std::pair< int, std::vector<Edu> > & ) const; 00066 Bdu getBdu( std::string ) const; 00067 Edu getEdu( std::string ) const; 00068 Range readRange( const std::string &) const; 00069 }; 00070 #endif