Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-11 03:33:47

0001 #ifndef PixelToFEDAssociateFromAscii_H
0002 #define PixelToFEDAssociateFromAscii_H
0003 
0004 /** \class PixelToFEDAssociateFromAscii
0005  *  Check to which FED pixel module belongs to.
0006  *  The associacions are read from the datafile
0007  */
0008 
0009 #include <vector>
0010 #include <string>
0011 
0012 #include "CalibTracker/SiPixelConnectivity/interface/TRange.h"
0013 #include "CalibTracker/SiPixelConnectivity/interface/PixelToFEDAssociate.h"
0014 
0015 class PixelBarrelName;
0016 class PixelEndcapName;
0017 class PixelModuleName;
0018 
0019 class PixelToFEDAssociateFromAscii : public PixelToFEDAssociate {
0020 public:
0021   PixelToFEDAssociateFromAscii(const std::string &fileName);
0022 
0023   /// FED id for module
0024   int operator()(const PixelModuleName &) const override;
0025 
0026   /// version
0027   std::string version() const override;
0028 
0029   /// FED id to which barrel modul (identified by name) should be assigned
0030   int operator()(const PixelBarrelName &) const;
0031 
0032   /// FED id to which endcape modul (identified by name) should be assigned
0033   int operator()(const PixelEndcapName &) const;
0034 
0035 private:
0036   /// initialisatin (read file)
0037   void init(const std::string &fileName);
0038 
0039   typedef TRange<int> Range;
0040 
0041   /// define allowed (layer,module,ladder) ranges for barrel units,
0042   /// check if module represented by name falls in allowed ranges
0043   struct Bdu {
0044     int b;
0045     Range l, z, f;
0046     bool operator()(const PixelBarrelName &) const;
0047   };
0048 
0049   /// define allowed (endcap,disk,blade) ranges for endcap units,
0050   /// check if module represented by name falls in allowed ranges
0051   struct Edu {
0052     int e;
0053     Range d, b;
0054     bool operator()(const PixelEndcapName &) const;
0055   };
0056 
0057   typedef std::vector<std::pair<int, std::vector<Bdu> > > BarrelConnections;
0058   typedef std::vector<std::pair<int, std::vector<Edu> > > EndcapConnections;
0059   BarrelConnections theBarrel;
0060   EndcapConnections theEndcap;
0061 
0062 private:
0063   std::string theVersion;
0064 
0065   /// initialisation (read input file)
0066   void send(std::pair<int, std::vector<Bdu> > &, std::pair<int, std::vector<Edu> > &);
0067   Bdu getBdu(std::string) const;
0068   Edu getEdu(std::string) const;
0069   Range readRange(const std::string &) const;
0070 
0071   using PixelToFEDAssociate::operator();
0072 };
0073 #endif