Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:30:44

0001 /**
0002    \file
0003    Test suit for DTDigitizer
0004 
0005    \author Riccardo Bellan
0006    \version
0007    \date 15 Feb 2006
0008 
0009    \note
0010     Compute the DT drift time using the DT prarametrization,
0011     prompting the user for the parameters.
0012 
0013 */
0014 
0015 #include "SimMuon/DTDigitizer/src/DTDriftTimeParametrization.cc"
0016 
0017 #include <iostream>
0018 
0019 void average() {
0020   short interpolate = 1;
0021   DTDriftTimeParametrization::drift_time DT;
0022   static const DTDriftTimeParametrization p;
0023   double alpha = 0;
0024   double Bwire = 0;
0025   double Bnorm = 0;
0026 
0027   float mean = 0;
0028   int count = 0;
0029   for (int i = 1; i < 21; i++) {
0030     p.MB_DT_drift_time(i, alpha, Bwire, Bnorm, 0, &DT, interpolate);
0031     mean += DT.v_drift;
0032     count++;
0033   }
0034 
0035   mean /= count;
0036 
0037   std::cout << " mean vd = " << mean;
0038 }
0039 
0040 void printDt(double x, double alpha, double Bwire, double Bnorm, int ifl) {
0041   short interpolate = 1;
0042   //  DRIFT_TIME * DT;
0043   DTDriftTimeParametrization::drift_time DT;
0044   static const DTDriftTimeParametrization p;
0045   unsigned short status = p.MB_DT_drift_time(x, alpha, Bwire, Bnorm, ifl, &DT, interpolate);
0046 
0047   std::cout << "(x = " << x << ", alpha = " << alpha << ", Bwire = " << Bwire << ", Bnorm = " << Bnorm
0048             << ", ifl = " << ifl << "):" << std::endl
0049             << "\tt_drift (ns) = " << DT.t_drift << " t_width_m = " << DT.t_width_m << " t_width_p = " << DT.t_width_p
0050             << " v_drift (ns) = " << DT.v_drift << " status " << status << std::endl;
0051 
0052 }  // end printDt()
0053 
0054 int main() {
0055   average();
0056 
0057   std::cout << "Enter x(mm), alpha(deg), Bwire(T), Bnorm(T), ifl(0=x from "
0058                "wire; 1=x fom cell edge)"
0059             << std::endl;
0060 
0061   while (true) {
0062     double x = 0, alpha = 0, Bwire = 0, Bnorm = 0;
0063     int ifl = 1;
0064     std::cin >> x >> alpha >> Bwire >> Bnorm >> ifl;
0065     if (!std::cin)
0066       break;
0067     printDt(x, alpha, Bwire, Bnorm, ifl);
0068   }
0069 }