MuonSpectrometer.h

Go to the documentation of this file.
00001 #ifndef ATLFAST_MUONSPECTROMETER_H
00002 #define ATLFAST_MUONSPECTROMETER_H
00003 
00004 #include <map>
00005 
00006 #include "AtlfastAlgs/XMLHelpers.h"
00007 #include "CLHEP/Vector/LorentzVector.h"
00008 
00009 namespace Atlfast{
00010   
00011   // ============================================
00012 
00013   class EtaBin{
00014   public:
00015     EtaBin(double deltaponp, int bin);    
00016     void setEtaStuff(double etaFirst, double deltaEta);
00017     void combine(EtaBin& otherEtaBin, double thispt, double nextpt);
00018     double calculateResolution(const HepLorentzVector& avec);
00019     void dump(std::string indent);
00020     double getEtaMin(){return m_etamin;}
00021     double getEtaMax(){return m_etamax;}
00022   private:
00023     int m_etabin;
00024     double m_etamin;
00025     double m_etamax;
00026     double m_etavalue;
00027     double m_deltaponp;
00028     double m_constterm;
00029     double m_ptterm;
00030   };
00031   
00032   // ============================================
00033 
00034   class PhiBin{
00035   public:
00036     PhiBin(DOMNode* boundaries, DOMNode* phi);
00037     ~PhiBin();
00038     void setPhiStuff(double sectorPhimin, double sectorPhimax, double deltaPhi, int phipoints);
00039     void combine(PhiBin &otherPhiBin, double thispt, double nextpt);
00040     double calculateResolution(const HepLorentzVector& avec);
00041     void dump(std::string indent);
00042     double getPhiMin(){return m_phimin;}
00043     double getPhiMax(){return m_phimax;}
00044   private:
00045     int m_phibin;
00046     double m_phimin;
00047     double m_phimax;
00048     double m_phivalue;
00049     std::vector<EtaBin> m_etas;
00050   };
00051   
00052   // ============================================
00053   
00054   class Sector{
00055   public:
00056     Sector(DOMNode* boundaries, DOMNode* sector);
00057     ~Sector();
00058     void combine(Sector& otherSec, double thispt, double nextpt);
00059     double calculateResolution(const HepLorentzVector& avec);
00060     void dump(std::string indent);
00061     std::string getSectorType(){return m_sectorType;}
00062   private:
00063     std::string  m_sectorType;
00064     double m_phimin;
00065     double m_phimax;
00066     std::vector<PhiBin> m_phis;
00067   };
00068   
00069   // ============================================
00070   
00071   class MuonSpectrometer{
00072   public:
00073     MuonSpectrometer(double ptmin, double ptmax, std::vector<Sector> sectors);
00074     double calculateResolution(const HepLorentzVector& avec);
00075     void dump(std::string indent);
00076     void setSectorMap(std::map<int,std::string> sectortypes);
00077     double getPtMin(){return m_ptmin;}
00078     double getPtMax(){return m_ptmax;}
00079   private:
00080     double m_ptmin;
00081     double m_ptmax;
00082     double m_sectorsize;
00083     std::vector<Sector> m_sectors;
00084     std::map<int,std::string> m_sectortypes;
00085   };
00086 
00087   // ============================================ 
00088   
00089   class ProtoSpectrometer{
00090   public:
00091     // find the ptbin number in the constructor
00092     ProtoSpectrometer(DOMNode* boundaries, DOMNode* ptbinres, bool lowestpT, bool highestpT);
00093     ~ProtoSpectrometer();
00094     double getPtValue() const {return m_ptvalue;}
00095     MuonSpectrometer combine(ProtoSpectrometer& otherPS);
00096     void dump(std::string indent);
00097   private:
00098     std::vector<Sector> m_sectors;
00099     int m_ptbin;
00100     double m_ptvalue;
00101     bool m_lowestpT;
00102     bool m_highestpT;
00103   };
00104 
00105   // ============================================
00106 
00107   class MuonResolutionCalculator{
00108   public:
00109     MuonResolutionCalculator(const char* filename);
00110     ~MuonResolutionCalculator(){};
00111     double calculateResolution(const HepLorentzVector& avec);
00112     void dump(std::string indent);
00113   private:
00114     std::map<int,std::string> makeSectorMap(DOMNode* boundaries);
00115     std::vector<ProtoSpectrometer> m_protoSpectrometers;
00116     std::vector<MuonSpectrometer> m_muonSpectrometers;
00117   };
00118   
00119   // ============================================
00120 
00121   class IsCorrectEtaBin{
00122   public:
00123     IsCorrectEtaBin(double eta);
00124     bool operator()(EtaBin&);
00125   private:
00126     double m_eta;
00127   };  
00128 
00129   // ============================================
00130 
00131   class IsCorrectPhiBin{
00132   public:
00133     IsCorrectPhiBin(double phi);
00134     bool operator()(PhiBin&);
00135   private:
00136     double m_phi;
00137   };  
00138 
00139   // ============================================
00140 
00141   class IsCorrectSector{
00142   public:
00143     IsCorrectSector(std::string sectortype);
00144     bool operator()(Sector&);
00145   private:
00146     std::string m_sectortype;
00147   };  
00148 
00149   // ============================================
00150 
00151   class IsCorrectMuonSpectrometer{
00152   public:
00153     IsCorrectMuonSpectrometer(double pT);
00154     bool operator()(MuonSpectrometer&);
00155   private:
00156     double m_pT;
00157   };  
00158 
00159   // ============================================
00160 
00161   class AddToDump{
00162   public:
00163     AddToDump(std::string indent):m_indent(indent){}
00164     template<class T>
00165       void operator()(T t){
00166       t.dump(m_indent);
00167     }
00168   private:
00169     std::string m_indent;
00170   };
00171   
00172   // ============================================
00173   
00174   class AddToMap{
00175   public:
00176     AddToMap():m_sectorcount(0){}
00177     void operator()(DOMNode* sectorTypeNode){
00178       char* s = getText(sectorTypeNode);
00179       std::string sectortype(s);
00180       XMLString::release(&s);
00181       ++m_sectorcount;
00182       m_map[m_sectorcount] = sectortype;
00183     }
00184     std::map<int,std::string> getMap(){return m_map;}
00185   private:
00186     std::map<int,std::string> m_map;
00187     int m_sectorcount;
00188   };
00189   
00190   // ===========================================
00191   
00192   template <class T>
00193     class SpectrometerComponentInstantiator{
00194     public:
00195     SpectrometerComponentInstantiator(DOMNode* boundaries):
00196       m_boundaries(boundaries){}
00197     
00198     void operator()(DOMNode* node){
00199       m_objs.push_back(T(m_boundaries, node));
00200     }
00201     std::vector<T> objects() const{
00202       return m_objs;}
00203     private:
00204     DOMNode* m_boundaries;
00205     std::vector<T> m_objs;
00206   };
00207   
00208   // ===========================================
00209   
00210   template <class T>
00211     class SpectrometerComponentBinInstantiator{
00212     public:
00213     SpectrometerComponentBinInstantiator(DOMNode* boundaries):
00214       m_boundaries(boundaries), m_bin(0){}
00215     
00216     void operator()(double resolution){
00217       m_objs.push_back(T(resolution, m_bin++));
00218     }
00219     std::vector<T> objects() const{return m_objs;}
00220     private:
00221     DOMNode* m_boundaries;
00222     int m_bin;
00223     std::vector<T> m_objs;
00224   };
00225   
00226   // ============================================
00227   
00228 } // namespace Atlfast
00229 
00230 #endif

Generated on Mon Sep 24 14:19:11 2007 for AtlfastAlgs by  doxygen 1.5.1