CMS 3D CMS Logo

presh_detectors.cc

Go to the documentation of this file.
00001 #include "DetectorDescription/Algorithm/src/presh_detectors.h"
00002 
00003 #include <vector>
00004 #include <cmath>
00005 
00006 #include "DetectorDescription/Base/interface/DDdebug.h"
00007 #include "DetectorDescription/Core/interface/DDVector.h"
00008 #include "DetectorDescription/Core/interface/DDLogicalPart.h"
00009 #include "DetectorDescription/Core/interface/DDConstant.h"
00010 #include "DetectorDescription/Core/interface/DDCurrentNamespace.h"
00011 #include "DetectorDescription/Core/interface/DDPosPart.h"
00012 
00013 #include "CLHEP/Units/SystemOfUnits.h"
00014 
00015 typedef std::vector<double> dbl_t;
00016 void preshPrepareTubs();
00017 //void preshDefineConstants();
00018 
00019 presh_detectors::presh_detectors(AlgoPos* p,std::string label) 
00020  : AlgoImpl(p,label)
00021 { 
00022 }
00023   
00025 presh_detectors::~presh_detectors()
00026   { }
00027   
00028 bool presh_detectors::checkParameters() 
00029 {
00030   static bool once_ = false;
00031   if (!once_) {
00032    // preshPrepareTubs();
00033     defineConstants();
00034     once_=true;
00035   }
00036   
00037   topHalfXPlane();
00038   return true;
00039 }
00040   
00041   
00042 DDTranslation presh_detectors::translation()
00043 {
00044   // pseudo-implementation
00045   return DDTranslation();
00046 }
00047   
00048   
00049 DDRotationMatrix presh_detectors::rotation()
00050 {
00051   // pseudo-implementation
00052   return DDRotationMatrix();
00053 }
00054 
00055 
00056 int presh_detectors::copyno() const
00057 {
00058   return 0;
00059 }
00060   
00061 
00062 void presh_detectors::topHalfXPlane()
00063 {
00064    int NX(0), icopy(0);
00065   
00066    DDLogicalPart SF(DDName("SF","preshower"));
00067    
00068    DDLogicalPart SWED(DDName("SWED","preshower"));
00069    DDLogicalPart BOX(DDName("SFBX","preshower"));
00070   
00071    DDRotation w_rot(DDName("MROT_1001","preshower"));
00072    DDRotation b_rot(DDName("MROT_1000","preshower"));
00073    double zlead1=0;
00074    for(int I=1; I<=20; ++I) {
00075      for(int J=IQUAD_MAX_[I]; J>=IQUAD_MIN_[I]; --J) {
00076        ++NX;
00077        ++icopy;
00078        double XPOS = -1.*(J*waf_intra_col_sep_+(int(J/2))*waf_inter_col_sep_ - waf_intra_col_sep_/2.);
00079        double YPOS = (20-I)*waf_active_ + wedge_length_/2. + 0.05*cm;
00080        DDTranslation trans(XPOS,YPOS,zlead1+wedge_offset_);
00081        DDpos(SWED,SF,icopy,trans,w_rot);
00082        trans = DDTranslation(XPOS,YPOS,zlead1+zwedge_ceramic_diff_);
00083        DDpos(BOX ,SF,icopy,trans,b_rot);
00084      }
00085      for(int J=IQUAD_MIN_[I]; J<=IQUAD_MAX_[I]; ++J) {
00086        ++NX;
00087        ++icopy;
00088        // = -XPOS from above
00089        double XPOS = (J*waf_intra_col_sep_ + (int(J/2))*waf_inter_col_sep_ - waf_intra_col_sep_/2.);              
00090        // = same as YPOS from above
00091        double YPOS = (20-I)*waf_active_ + wedge_length_/2. + 0.05*cm;
00092        DDTranslation trans(XPOS,YPOS,zlead1+wedge_offset_);
00093        DDpos(SWED,SF,icopy,trans,w_rot);
00094        trans = DDTranslation(XPOS,YPOS,zlead1+zwedge_ceramic_diff_);
00095        DDpos(BOX ,SF,icopy,trans,b_rot);
00096      }
00097    }
00098    
00099 }
00100     
00101 void presh_detectors::stream(std::ostream & os) const
00102 {
00103   os << "algorithm to place wedges & silicon strip detectors of the ecal preshower";
00104 }
00105 
00106 
00107 // The constants defined here should come from the XML ....
00108 void presh_detectors::defineConstants()
00109 {
00110    std::vector<double> & gmx = *(new std::vector<double>(21,19));
00111    std::vector<double> & gmn = *(new std::vector<double>(21,1));
00112    
00113    gmx[1] = 5;
00114    gmx[2] = 7;
00115    gmx[3] = 10;
00116    gmx[4] = 11;
00117    gmx[5] = 13;
00118    gmx[6] = 13;
00119    gmx[7] = 14;
00120    gmx[8] = 15;
00121    gmx[9] = 16;
00122    gmx[10] = 17;
00123    gmx[11] = 17;
00124    gmx[12] = 17;
00125    gmx[13] = 18;
00126    
00127    gmn[14] = 4;
00128    gmn[15] = 4;
00129    gmn[16] = 6;
00130    gmn[17] = 6;
00131    gmn[18] = 8;
00132    gmn[19] = 8;
00133    gmn[20] = 8;
00134    
00135    /* These are 'global' parameters in the sense that they are always the
00136       same in subsequent usage of the algorithm */
00137    DDVector iquad_max(DDName("IQUAD_MAX","preshower"),&gmx);
00138    DDVector iquad_min(DDName("IQUAD_MIN","preshower"),&gmn);
00139    
00140    waf_intra_col_sep_ = DDConstant(DDName("waf_intra_col_sep","preshower"));
00141    waf_inter_col_sep_ = DDConstant(DDName("waf_inter_col_sep","preshower"));
00142    waf_active_   = DDConstant(DDName("waf_active","preshower"));
00143    wedge_length_ = DDConstant(DDName("wedge_length","preshower")); 
00144    wedge_offset_ = DDConstant(DDName("wedge_offset","preshower")); 
00145    zwedge_ceramic_diff_ = DDConstant(DDName("zwedge_ceramic_diff","preshower"));
00146    
00147    IQUAD_MAX_ = DDVector(DDName("IQUAD_MAX","preshower"));
00148    IQUAD_MIN_ = DDVector(DDName("IQUAD_MIN","preshower"));
00149 }
00150     
00151 void preshPrepareTubs()
00152 {
00153   DDCurrentNamespace::ns() = "presh";
00154  
00155   /* all constants from the titles file esfx.tz;
00156      in future: they'll be defined in XML */
00157   //preshDefineConstants();
00158   
00159   
00160   dbl_t PAR(21);
00161   double PRESH_Z_TOTAL = DDConstant("PRESH_Z_TOTAL");
00162   double PRES_Z = DDConstant("PRESH_Z");
00163   double PRESH_Z = PRES_Z;
00164 
00165   PAR[3] = PRESH_Z_TOTAL /2.;
00166   double THETA_MIN = 2.*atan(exp(-double(DDConstant("PRE_ETA_MIN"))));
00167   double THETA_MAX = 2.*atan(exp(-double(DDConstant("PRE_ETA_MAX"))));
00168   DCOUT('E', "THETA_MIN=" << THETA_MIN/deg << "THETA_MAX=" << THETA_MAX/deg);
00169 
00170   double ECAL_Z = DDConstant("ECAL_Z");
00171   double R_MIN = ECAL_Z * tan(THETA_MIN);
00172   double R_MAX = PRESH_Z*tan(THETA_MAX);
00173   DCOUT('E', "R_MIN=" << R_MIN/cm << "cm   R_MAX=" << R_MAX/cm << "cm");
00174 
00175 
00176 } 
00177     
00178 
00179 // Check constraints of input parameters
00180 presh_detectorsChecker::presh_detectorsChecker()
00181 {
00182 }
00183 
00184 presh_detectorsChecker::~presh_detectorsChecker()
00185 {
00186 }

Generated on Tue Jun 9 17:31:49 2009 for CMSSW by  doxygen 1.5.4