Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:30:14

0001 
0002 /*
0003  * This class collects code fome the pakage MBDigitizer, which interfaces
0004  * the Rovelli-Gresele parametrization used with ORCA 6. It is included here
0005  * for comparison with the current parametrization.
0006  *
0007  */
0008 
0009 #include "Utils.h"
0010 
0011 #include "DTAngleParam.h"
0012 #include "DTBNormParam.h"
0013 
0014 #include <cmath>
0015 #include <iostream>
0016 
0017 // cfr. DTTimeDrift::ShortDistCorrect
0018 float ShortDistCorrect(float x) {
0019   float mu_drift_corr = fabs(x);  // cfr. DTSpaceDrift:69
0020   float min_dist = 0.03;
0021 
0022   const float factor_range = 2.0;
0023   float short_range = factor_range * min_dist;
0024   float punch_dist = short_range - mu_drift_corr;
0025   if (punch_dist > 0.0)
0026     mu_drift_corr = short_range - punch_dist * (factor_range - 1.0) / factor_range;
0027 
0028   return mu_drift_corr;
0029 }
0030 
0031 // x in cm; B in T
0032 // Bwire = By in ORCA r.f.
0033 // Bnorm = Bz in ORCA r.f.
0034 
0035 float oldParametrization(float x, float theta, float Bwire, float Bnorm) {
0036   // Change coordinates.
0037   Bwire = -Bwire;  // correct BUG in ORCA.
0038 
0039   //**********************************************************************
0040 
0041   // CFR DTTimeDrift::ShortDistCorrect
0042   x = ShortDistCorrect(x);
0043 
0044   // CFR DTTimeDrift::TimeCompute
0045 
0046   // set some cell parameters
0047   const float cell_width = 2.1;  // (mu_wire->wireType()->width())/2;
0048 
0049   const float volume_lim = cell_width - 0.0025;
0050   const float volume_par = cell_width - 0.1;
0051   const float edge_width = volume_lim - volume_par;
0052 
0053   // define coordinate with 0 inside the I beam
0054   // mu_drift_corr = x
0055   float xcoor = cell_width - fabs(x);
0056 
0057   if (xcoor < 0.0)
0058     xcoor = 0.0;
0059 
0060   if (xcoor > volume_lim) {
0061     return 0.0;
0062   }
0063 
0064   xcoor *= (2 / cell_width);
0065 
0066   // ****** patch to use the old parametrization with the new geometry ******
0067   //   bool extrapolate = ( mu_drift_corr > cell_width );
0068   //  float mu_drift_extr = ( extrapolate ? cell_width : mu_drift_corr );
0069   // ****** ********************************************************** ******
0070   float angle = theta;
0071   while (angle > 360.0)
0072     angle -= 360.0;
0073   if ((angle > 90.0) && (angle <= 270.0))
0074     angle -= 180.0;
0075   else if ((angle > 270.0) && (angle <= 360.0))
0076     angle -= 360.0;
0077 
0078   // access to CMS Magnetic Field
0079   if (Bwire < 0.0) {
0080     Bwire = fabs(Bwire);
0081     angle = -angle;
0082   }
0083 
0084   // handle cell edge cases
0085   bool out_of_volume = (xcoor > volume_par);
0086   float xpos = xcoor;
0087   if (out_of_volume) {
0088     xpos = xcoor;
0089     xcoor = volume_par;
0090   }
0091 
0092   float mu_time_drift = 0.;
0093 
0094   // call parametrization for the actual angle
0095   DTAngleParam angle_func(angle);
0096   mu_time_drift = angle_func.time(Bwire, xcoor);
0097 
0098   //  add correction for norma B field
0099   //@@ magnetic field not yet available
0100   DTBNormParam bnorm_func(Bnorm);
0101   mu_time_drift += bnorm_func.tcor(xcoor);
0102 
0103   // correct for cell edge cases
0104   if (out_of_volume)
0105     mu_time_drift *= (1.0 - ((xpos - volume_par) / edge_width));
0106 
0107   // correzione lunghezza cella
0108   mu_time_drift *= cell_width / 2.;
0109 
0110   mu_time_drift *= 1000.0;
0111   return mu_time_drift;
0112 }