CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/TBDataFormats/HcalTBObjects/src/HcalTBEventPosition.cc

Go to the documentation of this file.
00001 #include "TBDataFormats/HcalTBObjects/interface/HcalTBEventPosition.h"
00002 #include <cstdio>
00003 
00004 using namespace std;
00005 
00006   HcalTBEventPosition::HcalTBEventPosition() :
00007     hfTableX_(-1e24),
00008     hfTableY_(-1e24),
00009     hfTableV_(-1e24),
00010     hbheTableEta_(-1000),
00011     hbheTablePhi_(-1000),
00012     ax_(),
00013     ay_(),
00014     bx_(),
00015     by_(),
00016     cx_(),
00017     cy_(),
00018     dx_(),
00019     dy_(),
00020     ex_(),
00021     ey_(),
00022     fx_(),
00023     fy_(),
00024     gx_(),
00025     gy_(),
00026     hx_(),
00027     hy_() {
00028   }
00029 
00030   void HcalTBEventPosition::getChamberHits ( char chamberch,
00031                                              vector<double>& xvec,
00032                                              vector<double>& yvec ) const {
00033     switch (chamberch) {
00034     case 'A': xvec = ax_; yvec = ay_; break;
00035     case 'B': xvec = bx_; yvec = by_; break;
00036     case 'C': xvec = cx_; yvec = cy_; break;
00037     case 'D': xvec = dx_; yvec = dy_; break;
00038     case 'E': xvec = ex_; yvec = ey_; break;
00039     case 'F': xvec = fx_; yvec = fy_; break;
00040     case 'G': xvec = gx_; yvec = gy_; break;
00041     case 'H': xvec = hx_; yvec = hy_; break;
00042     default:
00043       cerr << "Unrecognized chamber character " << chamberch << endl;
00044       return;
00045     }
00046   }
00047 
00048   void HcalTBEventPosition::setChamberHits ( char chamberch,
00049                                              const vector<double>& xvec,
00050                                              const vector<double>& yvec ) {
00051     switch (chamberch) {
00052     case 'A': ax_ = xvec; ay_ = yvec; break;
00053     case 'B': bx_ = xvec; by_ = yvec; break;
00054     case 'C': cx_ = xvec; cy_ = yvec; break;
00055     case 'D': dx_ = xvec; dy_ = yvec; break;
00056     case 'E': ex_ = xvec; ey_ = yvec; break;
00057     case 'F': fx_ = xvec; fy_ = yvec; break;
00058     case 'G': gx_ = xvec; gy_ = yvec; break;
00059     case 'H': hx_ = xvec; hy_ = yvec; break;
00060     default:
00061       cerr << "Unrecognized chamber character " << chamberch << endl;
00062       return;
00063     }
00064   }
00065 
00066   void HcalTBEventPosition::setHFtableCoords( double x, double y, double v ) {
00067     hfTableX_ = x;
00068     hfTableY_ = y;
00069     hfTableV_ = v;
00070   }
00071 
00072   void HcalTBEventPosition::setHBHEtableCoords( double eta, double phi ) {
00073     hbheTableEta_ = eta;
00074     hbheTablePhi_ = phi;
00075   }
00076 
00077   ostream& operator<<(ostream& s, const HcalTBEventPosition& htbep) {
00078     char str[180];
00079 
00080     snprintf (str,180, "HF Table (X,Y,V) = (%f,%f,%f)\n",
00081              htbep.hfTableX(),htbep.hfTableY(),htbep.hfTableV());
00082     s << str;
00083 
00084     snprintf (str, 180, "HB/HE Table (eta,phi) = (%f,%f)\n",
00085              htbep.hbheTableEta(),htbep.hbheTablePhi());
00086     s << str;
00087 
00088     vector<double> xvec, yvec;
00089     vector<double>::const_iterator j;
00090 
00091     htbep.getChamberHits('A', xvec, yvec);
00092 
00093     s << "WC Ax: ";
00094     for (j=xvec.begin(); j!=xvec.end(); j++) {
00095       if (j!=xvec.begin()) s << ", ";
00096       s << *j;
00097     }
00098     s << endl;
00099 
00100     s << "WC Ay: ";
00101     for (j=yvec.begin(); j!=yvec.end(); j++) {
00102       if (j!=yvec.begin()) s << ", ";
00103       s << *j;
00104     }
00105     s << endl;
00106 
00107     htbep.getChamberHits('B', xvec, yvec);
00108 
00109     s << "WC Bx: ";
00110     for (j=xvec.begin(); j!=xvec.end(); j++) {
00111       if (j!=xvec.begin()) s << ", ";
00112       s << *j;
00113     }
00114     s << endl;
00115 
00116     s << "WC By: ";
00117     for (j=yvec.begin(); j!=yvec.end(); j++) {
00118       if (j!=yvec.begin()) s << ", ";
00119       s << *j;
00120     }
00121     s << endl;
00122 
00123     htbep.getChamberHits('C', xvec, yvec);
00124 
00125     s << "WC Cx: ";
00126     for (j=xvec.begin(); j!=xvec.end(); j++) {
00127       if (j!=xvec.begin()) s << ", ";
00128       s << *j;
00129     }
00130     s << endl;
00131 
00132     s << "WC Cy: ";
00133     for (j=yvec.begin(); j!=yvec.end(); j++) {
00134       if (j!=yvec.begin()) s << ", ";
00135       s << *j;
00136     }
00137     s << endl;
00138 
00139     htbep.getChamberHits('D', xvec, yvec);
00140 
00141     s << "WC Dx: ";
00142     for (j=xvec.begin(); j!=xvec.end(); j++) {
00143       if (j!=xvec.begin()) s << ", ";
00144       s << *j;
00145     }
00146     s << endl;
00147 
00148     s << "WC Dy: ";
00149     for (j=yvec.begin(); j!=yvec.end(); j++) {
00150       if (j!=yvec.begin()) s << ", ";
00151       s << *j;
00152     }
00153     s << endl;
00154 
00155     htbep.getChamberHits('E', xvec, yvec);
00156 
00157     s << "WC Ex: ";
00158     for (j=xvec.begin(); j!=xvec.end(); j++) {
00159       if (j!=xvec.begin()) s << ", ";
00160       s << *j;
00161     }
00162     s << endl;
00163 
00164     s << "WC Ey: ";
00165     for (j=yvec.begin(); j!=yvec.end(); j++) {
00166       if (j!=yvec.begin()) s << ", ";
00167       s << *j;
00168     }
00169     s << endl;
00170 
00171     htbep.getChamberHits('F', xvec, yvec);
00172 
00173     s << "WC Fx: ";
00174     for (j=xvec.begin(); j!=xvec.end(); j++) {
00175       if (j!=xvec.begin()) s << ", ";
00176       s << *j;
00177     }
00178     s << endl;
00179 
00180     s << "WC Fy: ";
00181     for (j=yvec.begin(); j!=yvec.end(); j++) {
00182       if (j!=yvec.begin()) s << ", ";
00183       s << *j;
00184     }
00185     s << endl;
00186 
00187     htbep.getChamberHits('G', xvec, yvec);
00188 
00189     s << "WC Gx: ";
00190     for (j=xvec.begin(); j!=xvec.end(); j++) {
00191       if (j!=xvec.begin()) s << ", ";
00192       s << *j;
00193     }
00194     s << endl;
00195 
00196     s << "WC Gy: ";
00197     for (j=yvec.begin(); j!=yvec.end(); j++) {
00198       if (j!=yvec.begin()) s << ", ";
00199       s << *j;
00200     }
00201     s << endl;
00202 
00203     htbep.getChamberHits('H', xvec, yvec);
00204 
00205     s << "WC Hx: ";
00206     for (j=xvec.begin(); j!=xvec.end(); j++) {
00207       if (j!=xvec.begin()) s << ", ";
00208       s << *j;
00209     }
00210     s << endl;
00211 
00212     s << "WC Hy: ";
00213     for (j=yvec.begin(); j!=yvec.end(); j++) {
00214       if (j!=yvec.begin()) s << ", ";
00215       s << *j;
00216     }
00217     s << endl;
00218 
00219     return s;
00220   }