track_class Class Reference

#include <track_class_data.h>

List of all members.

Public Member Functions

void fittrkU (int n_iter)
void fittrkV (int n_iter)
void datread ()
void moddat (int planeOr)
void print_off (int n_iter)
int getZI (int iplane, int tOr)
void offgen ()
void offsetread ()
 track_class ()
void fittrkU (int n_iter)
void fittrkV (int n_iter)
void datread ()
void moddat (int planeOr)
void print_off (int n_iter)
int getZI (int iplane, int tOr)
void offgen ()
void offsetread ()
 track_class ()

Public Attributes

double dataU [nPlanes][nTracks]
double dataV [nPlanes][nTracks]
double dataUZ [nPlanes]
double dataVZ [nPlanes]
double offsetU [nPlanes]
double offsetV [nPlanes]
double sig [nPlanes]
double avgresU [nPlanes]
double avgresV [nPlanes]
double resU [nPlanes]
double resV [nPlanes]
double stdresU [nPlanes]
double stdresV [nPlanes]
double mavg
double bavg
double mstd
double bstd
TH1F * h1
TH1F * h2
TH1F * h3
TH1F * h4
TH1F * h5
TH1F * h6
TH1F * h20
TH1F * h50
TH1F * h60
TH1F * h11
TH1F * h12
TH1F * h13
TH1F * h14
TH1F * h15
TH1F * h16
TH1F * h21
TH1F * h51
TH1F * h61
TH1F * h101
TH1F * h102
TH1F * h103
TH1F * h104
TH1F * h105
TH1F * h111
TH1F * h112
TH1F * h113
TH1F * h114
TH1F * h115
TH1F * h121
TH1F * h122
TH1F * h123
TH1F * h124
TH1F * h125
TH1F * h201
TH1F * h202
TH1F * h203
TH1F * h204
TH1F * h205
TH1F * h211
TH1F * h212
TH1F * h213
TH1F * h214
TH1F * h215
TH1F * h221
TH1F * h222
TH1F * h223
TH1F * h224
TH1F * h225
TH2F * h30
TH2F * h31
TH2F * h40
TH2F * h41
TH2F * h70
TH2F * h71
TProfile * h90
TProfile * h80
TProfile * h91
TProfile * h81
TH1F * h7
TH1F * h17

Detailed Description

Definition at line 27 of file track_class_data.h.


Constructor & Destructor Documentation

track_class::track_class (  ) 

Definition at line 9 of file track_class_data.cxx.

References dataU, dataV, nPlanes, nTracks, resU, and resV.

00009                         {
00010 
00011   // cout << "Entering constructor for track_class." << endl;
00012   for(int ii=0; ii<nPlanes; ii++){
00013     resU[ii] = 0.;
00014     resV[ii] = 0.;
00015        for(int jj=0; jj<nTracks; jj++){
00016          dataU[ii][jj] = -9999.;
00017        }
00018        for(int jj=0; jj<nTracks; jj++){
00019          dataV[ii][jj] = -9999.;
00020        }
00021   }
00022 
00023 }

track_class::track_class (  ) 

Member Function Documentation

void track_class::datread (  ) 
void track_class::datread (  ) 

Definition at line 466 of file track_class_data.cxx.

References dataU, dataUZ, dataV, dataVZ, detectorRMS, getZI(), maxTDiff, nPlanes, nTracks, sig, and trackFileName.

00466                          {
00467 
00468 
00469   ifstream tracks(trackFileName);
00470 
00471   int nLines, iev, ior, iplane, icount, iZPos, iZPosBef, iOrBef, iDoubCount;
00472   int nBadEvents, ievBef, iDummy, inumb;
00473   double tpos, zpos, tPosBef, tPosBefBef, tPosTmp, tmpres, tpulse, tdiff;
00474   double addto, rcount, rcountsu, rcountsv,tPulseBef,tPulseBefBef;
00475 
00476   icount = 0;
00477   ievBef = 1;
00478   iDoubCount = 0;
00479   rcount = 0;
00480   rcountsu = 0;
00481   rcountsv = 0;
00482   iZPosBef = 999; 
00483   tPosBef = 999;
00484   tPosBefBef = 999;
00485   nBadEvents = 0;
00486   tracks >> nLines;
00487   while (tracks.good()&& (icount < nTracks)){
00488     
00489     tracks >> iev >> ior >> inumb >> zpos >> tpos >> iplane >> tpulse;
00490 //        cout << iev << " " << ior << " " << iplane  << " " <<
00491 //                zpos << " " << tpos  << " " << trutpos << endl;
00492 
00493     cout << iev << endl;
00494 
00495     zpos*=100; tpos*=100; 
00496 
00497     if (iev > ievBef)  icount++; 
00498 
00499     iZPos = getZI(iplane, ior);
00500 
00501     tmpres = gRandom -> Gaus(0.,detectorRMS); 
00502 
00503     if (!( (iZPos==iZPosBef)&&(ior==iOrBef)&&(iev==ievBef) )){
00504       if (ior==0) dataU[iZPos][icount] = tpos;
00505       if (ior==1) dataV[iZPos][icount] = tpos;   
00506 
00507       iDoubCount =0;  
00508      } else {
00509         iDoubCount++;
00510         if (iDoubCount == 1 && (TMath::Abs(tpos-tPosBef)<maxTDiff) ){
00511           tPosTmp = (tpulse*tpos + tPulseBef*tPosBef) / (tpulse+tPulseBef);
00512           if (ior==0) dataU[iZPos][icount] = tPosTmp;
00513           if (ior==1) dataV[iZPos][icount] = tPosTmp;
00514         } else {
00515           if (iDoubCount == 2 && TMath::Abs(tpos-tPosBef)<maxTDiff 
00516                               && TMath::Abs(tPosBef-tPosBefBef)<maxTDiff){
00517             tPosTmp = (tpulse*tpos +tPulseBef*tPosBef + tPulseBefBef*tPosBefBef ) / (tpulse+tPulseBef+tPulseBefBef);
00518             if (ior==0) dataU[iZPos][icount] = tPosTmp;
00519             if (ior==1) dataV[iZPos][icount] = tPosTmp;
00520           } else {
00521             cout << " more the 3 hits/z in event " << iev << 
00522               ", icount=" << icount << endl;
00523             for(int ij=0; ij<nPlanes; ij++){
00524               dataU[ij][icount] = -9999.;
00525               dataV[ij][icount] = -9999.;
00526             }
00527           }
00528         }
00529      }
00530 
00531 
00532 
00533 
00534     ievBef = iev;
00535     iZPosBef = iZPos;
00536     tPosBefBef =  tPosBef; 
00537     tPosBef =  tpos; 
00538     tPulseBefBef =  tPulseBef; 
00539     tPulseBef =  tpulse; 
00540     iOrBef = ior;  
00541   } 
00542 
00543 
00544   tracks.close();
00545 
00546 //  ofstream trackout("tracks_controll.out");
00547 //  for (int ii=0; ii<nTracks; ii++){
00548 //     for (int jj=0; jj<nPlanes; jj++){
00549 //     trackout << dataU[jj][ii] << " " ;
00550 //     }
00551 //     trackout << endl << endl;
00552 //  }
00553 //  trackout.close();
00554 
00555 
00556   float rfrshu=rcountsu/rcount;
00557   float rfrshv=rcountsv/rcount;
00558   cout << "fraction of shifts: " << rfrshu << " " <<  rfrshv << endl;
00559 
00560 
00561 
00562 // fill sigmas
00563   for(int j=0; j<nPlanes; j++){
00564     sig[j] = detectorRMS;
00565   }
00566 
00567 
00568 // fill Z positions:
00569   for(int j=0; j<nPlanes; j++){
00570     dataUZ[j] = 11.88*j - 0.55;
00571     dataVZ[j] = 5.39 + 11.88*j;
00572   }
00573 
00574 
00575 }

void track_class::fittrkU ( int  n_iter  ) 
void track_class::fittrkU ( int  n_iter  ) 

Definition at line 27 of file track_class_data.cxx.

References avgresU, dataU, dataUZ, datPointsMax, datPointsMin, h1, h101, h102, h103, h104, h105, h111, h112, h113, h114, h115, h121, h122, h123, h124, h125, h2, h20, h3, h30, h4, h40, h5, h50, h6, h60, h70, h80, h90, maxIter, nPlanes, nTracks, offsetU, residMax, resU, sig, and stdresU.

00027                                    {
00028 
00029 
00030         double sumsig,sumx,sumy,sumxy,sumx2;
00031         double sumx_new,sumy_new,sumxy_new,sumx2_new;
00032         double delta,m_slope,b_intcpt;
00033         double delta_new,slope_new,intcpt_new;
00034         double predict,resid;
00035         double predict_soudan;
00036         double ftracks[nPlanes];
00037         double sumres[nPlanes];
00038         double sumsqr[nPlanes];
00039         
00040         double bsum,msum;
00041         double bsum2,msum2;     
00042         double tmpTh;
00043 
00044         int iCountPlanes, iFirst;
00045 
00046 cout << "Entering fittrk U, iteration " << n_iter <<endl;
00047 //Inits
00048 
00049         double* p = &ftracks[nPlanes];
00050         while(p!=ftracks) *--p = 0.0;
00051 
00052 
00053 // Init residuals
00054 
00055         for (int ii=0; ii<nPlanes; ii++) {
00056            sumres[ii] = 0.;
00057            sumsqr[ii] = 0.;
00058         }
00059 
00060 // Init sums for slope and intercept
00061 
00062         bsum = 0.;
00063         msum = 0.;
00064         bsum2 = 0.;
00065         msum2 = 0.;
00066 
00067 //NT init histos 
00068         if (n_iter == 1) {              
00069           h1 = new TH1F("h1","Resid 1",40,-4,+4);
00070           h2 = new TH1F("h2","Resid 2",40,-4,+4);
00071           h3 = new TH1F("h3","Resid 3",40,-4,+4);
00072           h4 = new TH1F("h4","Resid 6",40,-4,+4);
00073           h5 = new TH1F("h5","Resid 10",40,-4,+4);
00074           h6 = new TH1F("h6","Resid maxIter",40,-4,+4);         
00075           h101 = new TH1F("h101","Resid 1",40,-4,+4);
00076           h102 = new TH1F("h102","Resid 2",40,-4,+4);
00077           h103 = new TH1F("h103","Resid 3",40,-4,+4);
00078           h104 = new TH1F("h104","Resid 6",40,-4,+4);
00079           h105 = new TH1F("h105","Resid 10",40,-4,+4);          
00080           h111 = new TH1F("h111","Resid 1",40,-4,+4);
00081           h112 = new TH1F("h112","Resid 2",40,-4,+4);
00082           h113 = new TH1F("h113","Resid 3",40,-4,+4);
00083           h114 = new TH1F("h114","Resid 6",40,-4,+4);
00084           h115 = new TH1F("h115","Resid 10",40,-4,+4);          
00085           h121 = new TH1F("h121","Resid 1",40,-4,+4);
00086           h122 = new TH1F("h122","Resid 2",40,-4,+4);
00087           h123 = new TH1F("h123","Resid 3",40,-4,+4);
00088           h124 = new TH1F("h124","Resid 6",40,-4,+4);
00089           h125 = new TH1F("h125","Resid 10",40,-4,+4);
00090           h20 = new TH1F("h20","resid - offset U",nPlanes,-1.,1.);
00091           h40 = new TH2F("h40","plane offsets U",600,0,nPlanes,100,-4.,4.);
00092           h30 = new TH2F("h30","difference vs. offset U",80,-2.,2.,80,-1.,1.);
00093           h50 = new TH1F("h50","offsets U",11,-4.,4.);
00094           h60 = new TH1F("h60","ftracks",nPlanes,0.,nPlanes); 
00095           h70 = new TH2F("h70","res -offsets / plane  U",600,0,2*nPlanes,100,-3.,3.); 
00096           h80 = new TProfile("h80"," av. |resid| / theta",20,0.,90,0,10);
00097           h90 = new TProfile("h90"," av. |resid| / plane U",nPlanes,0.,nPlanes,0,10);
00098         } 
00099 
00100 // Track fit sections
00101 
00102         for (int jj=1; jj<nTracks; jj++) {
00103            
00104            iCountPlanes = 0;
00105            for (int ii=0;ii<nPlanes; ii++){
00106              if(dataU[ii][jj] > -8888) iCountPlanes++;
00107            }
00108 
00109            iFirst = 1;
00110            for (int ii=0;ii<nPlanes; ii++){
00111              if(dataU[ii][jj] < -8888) iFirst=0;             
00112            }
00113           
00114            for (int ii=0;ii<nPlanes; ii++){     // Loop over planes, drop one       
00115 
00116               if(dataU[ii][jj] > -8888) {
00117 
00118                 ftracks[ii]++;
00119 
00120                 sumsig = 0.;
00121                 sumx = 0.;
00122                 sumy = 0.;
00123                 sumxy = 0.;
00124                 sumx2 =0.;
00125 
00126 // Do simple calculation to compare
00127 
00128                 sumx_new = 0.;
00129                 sumy_new = 0.;  
00130                 sumxy_new = 0.;
00131                 sumx2_new = 0.;
00132 
00133                 for (int kk=0; kk<nPlanes ;kk++){  //Loop over remaining
00134                    if (kk != ii) {              //Exclude one plane
00135                       if(dataU[kk][jj] > -8888) {
00136                         sumsig = sumsig +
00137                            ( 1./ ( sig[kk]*sig[kk]) );
00138 
00139                         sumx = sumx + ( dataUZ[kk] / 
00140                            ( sig[kk]*sig[kk] ) );
00141 
00142                         sumy = sumy + ( dataU[kk][jj]/
00143                            ( sig[kk]*sig[kk]) );
00144 
00145                         sumx2 = sumx2 + ( (dataUZ[kk]*dataUZ[kk])/
00146                            (sig[kk]*sig[kk]) );
00147 
00148                         sumxy = sumxy + ( ( dataUZ[kk]*dataU[kk][jj])/
00149                            (sig[kk]*sig[kk]) );
00150 
00151 // Do simple calculation to compare
00152 
00153                         sumx_new = sumx_new + dataUZ[kk];
00154                         sumy_new = sumy_new + dataU[kk][jj];
00155                         sumx2_new = sumx2_new + (dataUZ[kk]*dataUZ[kk]);
00156                         sumxy_new = sumxy_new + 
00157                                         (dataUZ[kk]*dataU[kk][jj]);
00158                       }
00159                    }
00160                   
00161                 }
00162 
00163                 delta = (sumsig*sumx2) - (sumx*sumx);
00164                 m_slope = (1./delta) * ((sumsig*sumxy) -
00165                                                 (sumx*sumy) );
00166                 b_intcpt = (1./delta) * ((sumx2*sumy) -
00167                                            (sumx*sumxy) );
00168 
00169 
00170                 tmpTh = (180. / 3.14159) *
00171                 TMath::ASin(TMath::Abs(m_slope)/(TMath::Sqrt(m_slope*m_slope+1.)));
00172 
00173 // Do simple calculation to compare
00174 
00175                 delta_new = (29.*sumx2_new)-(sumx_new*sumx_new);
00176                 slope_new = (1./delta_new) * 
00177                                 ((29.*sumxy_new) - (sumx_new*sumy_new)); 
00178                 intcpt_new = (1./delta_new) *
00179                         ((sumx2_new*sumy_new) - (sumx_new*sumxy_new));
00180                                         
00181 // Make residuals for ii-th plane
00182 
00183                 predict = (m_slope * dataUZ[ii]) + b_intcpt;
00184                 resid = dataU[ii][jj] - predict;
00185 
00186                 if (iCountPlanes >= datPointsMin &&
00187                     iCountPlanes <= datPointsMax &&
00188                     TMath::Abs(resid) <= residMax) {
00189                   sumres[ii] = sumres[ii] + resid;
00190                   sumsqr[ii] = sumsqr[ii] + (resid*resid);
00191                 } else {
00192                   ftracks[ii]--;
00193                 }
00194                 
00195 
00196 // Compute sums for average track slope and intercept.
00197 
00198                 bsum = bsum + b_intcpt;
00199                 msum = msum + m_slope;
00200                 bsum2 = bsum2 + (b_intcpt*b_intcpt);
00201                 msum2 = msum2 + (m_slope*m_slope);
00202 
00203 
00204 
00205 // Fill histos
00206 
00207                 if (n_iter == 1) {
00208                         h1->Fill(resid);
00209                 }
00210                 if (n_iter == 2) {
00211                         h2->Fill(resid);
00212 
00213                 }
00214                 if (n_iter == 3) {
00215                         h3 -> Fill(resid);
00216                 }
00217                 if (n_iter == 4) {
00218                         h4 -> Fill(resid);
00219                 }
00220                 if (n_iter == 5) {
00221                         h5 -> Fill(resid);
00222                 }
00223                 if (n_iter == 10) {
00224                         h6 -> Fill(resid);
00225                         if (TMath::Abs(resid)<10)
00226                         h90 -> Fill(float(ii),TMath::Abs(resid),1);
00227                         if (tmpTh<90)
00228                         h80 -> Fill(tmpTh,TMath::Abs(resid),1);
00229                                          }
00230              }
00231            } 
00232         
00233         }
00234 
00235 // Make average residuals
00236 
00237            for (int ii=0;ii<nPlanes;ii++) {
00238 
00239               avgresU[ii] = sumres[ii]/ ftracks[ii]; 
00240               resU[ii] += avgresU[ii];
00241               stdresU[ii] = sqrt( (sumsqr[ii] - 
00242                 ftracks[ii]*(avgresU[ii]*avgresU[ii]))/(ftracks[ii] -1.) );
00243 
00244               if (n_iter == maxIter) h20 -> Fill(resU[ii]-offsetU[ii]);
00245               if (n_iter == maxIter) h60 -> Fill(ii,ftracks[ii]);
00246            }
00247 
00248 }

void track_class::fittrkV ( int  n_iter  ) 
void track_class::fittrkV ( int  n_iter  ) 

Definition at line 250 of file track_class_data.cxx.

References avgresV, dataV, dataVZ, datPointsMax, datPointsMin, h11, h12, h13, h14, h15, h16, h201, h202, h203, h204, h205, h21, h211, h212, h213, h214, h215, h221, h222, h223, h224, h225, h31, h41, h51, h61, h71, h81, h91, maxIter, nPlanes, nTracks, offsetV, residMax, resV, sig, and stdresV.

00250                                    {
00251 
00252 
00253 
00254         double sumsig,sumx,sumy,sumxy,sumx2;
00255         double sumx_new,sumy_new,sumxy_new,sumx2_new;
00256         double delta,m_slope,b_intcpt;
00257         double delta_new,slope_new,intcpt_new;
00258         double predict,resid;
00259         double predict_soudan;
00260         double ftracks[nPlanes];
00261         double sumres[nPlanes];
00262         double sumsqr[nPlanes];
00263         
00264         double bsum,msum;
00265         double bsum2,msum2;
00266         double tmpTh;
00267 
00268         int iCountPlanes;
00269 
00270 cout << "Entering fittrk V, iteration " << n_iter <<endl;
00271 //Inits
00272 
00273         double* p = &ftracks[nPlanes];
00274         while(p!=ftracks) *--p = 0.0;
00275 
00276 // Init residuals
00277 
00278         for (int ii=0; ii<nPlanes; ii++) {
00279            sumres[ii] = 0.;
00280            sumsqr[ii] = 0.;
00281         }
00282 
00283 // Init sums for slope and intercept
00284 
00285         bsum = 0.;
00286         msum = 0.;
00287         bsum2 = 0.;
00288         msum2 = 0.;
00289 
00290 
00291 //NT init histos 
00292         if (n_iter == 1) {              
00293           h11 = new TH1F("h11","Resid 1",40,-4,+4);
00294           h12 = new TH1F("h12","Resid 2",40,-4,+4);
00295           h13 = new TH1F("h13","Resid 3",40,-4,+4);
00296           h14 = new TH1F("h14","Resid 6",40,-4,+4);
00297           h15 = new TH1F("h15","Resid 10",40,-4,+4);
00298           h16 = new TH1F("h16","Resid maxIter",40,-4,+4);               
00299           h201 = new TH1F("h201","Resid 1",40,-4,+4);
00300           h202 = new TH1F("h202","Resid 2",40,-4,+4);
00301           h203 = new TH1F("h203","Resid 3",40,-4,+4);
00302           h204 = new TH1F("h204","Resid 6",40,-4,+4);
00303           h205 = new TH1F("h205","Resid 10",40,-4,+4);          
00304           h211 = new TH1F("h211","Resid 1",40,-4,+4);
00305           h212 = new TH1F("h212","Resid 2",40,-4,+4);
00306           h213 = new TH1F("h213","Resid 3",40,-4,+4);
00307           h214 = new TH1F("h214","Resid 6",40,-4,+4);
00308           h215 = new TH1F("h215","Resid 10",40,-4,+4);          
00309           h221 = new TH1F("h221","Resid 1",40,-4,+4);
00310           h222 = new TH1F("h222","Resid 2",40,-4,+4);
00311           h223 = new TH1F("h223","Resid 3",40,-4,+4);
00312           h224 = new TH1F("h224","Resid 6",40,-4,+4);
00313           h225 = new TH1F("h225","Resid 10",40,-4,+4);
00314           h21 = new TH1F("h21","resid - offset V",nPlanes,-1.,1.);
00315           h41 = new TH2F("h41","plane offsets V",600,0,nPlanes,100,-4.,4.);
00316           h31 = new TH2F("h31","difference vs. offset V",80,-2.,2.,80,-1.,1.);
00317           h51 = new TH1F("h51","offsets V",11,-4.,4.);
00318           h61 = new TH1F("h61","ftracks",nPlanes,0.,nPlanes);
00319           h71 = new TH2F("h71","res -offsets / plane  V",600,0,2*nPlanes,100,-3.,3.); 
00320           h81 = new TProfile("h81"," av. |resid| / theta",20,0.,90,0,10);
00321           h91 = new TProfile("h91"," av. |resid| / plane V",nPlanes,0.,nPlanes,-2,2);
00322         } 
00323 
00324 // Track fit sections
00325 
00326         for (int jj=1; jj<nTracks; jj++) {
00327            
00328            iCountPlanes = 0;
00329            for (int ii=0;ii<nPlanes; ii++){
00330              if(dataV[ii][jj] > -8888) iCountPlanes++;
00331            }
00332 
00333            for (int ii=0;ii<nPlanes; ii++){     // Loop over planes, drop one       
00334 
00335               if(dataV[ii][jj] > -8888) {
00336 
00337                 ftracks[ii]++;
00338 
00339                 sumsig = 0.;
00340                 sumx = 0.;
00341                 sumy = 0.;
00342                 sumxy = 0.;
00343                 sumx2 =0.;
00344 
00345 // Do simple calculation to compare
00346 
00347                 sumx_new = 0.;
00348                 sumy_new = 0.;  
00349                 sumxy_new = 0.;
00350                 sumx2_new = 0.;
00351 
00352                 for (int kk=0; kk<nPlanes ;kk++){  //Loop over remaining
00353                    if (kk != ii) {              //Exclude one plane
00354                       if(dataV[kk][jj] > -8888) {
00355                         sumsig = sumsig +
00356                            ( 1./ ( sig[kk]*sig[kk]) );
00357 
00358                         sumx = sumx + ( dataVZ[kk] / 
00359                            ( sig[kk]*sig[kk] ) );
00360 
00361                         sumy = sumy + ( dataV[kk][jj]/
00362                            ( sig[kk]*sig[kk]) );
00363 
00364                         sumx2 = sumx2 + ( (dataVZ[kk]*dataVZ[kk])/
00365                            (sig[kk]*sig[kk]) );
00366 
00367                         sumxy = sumxy + ( ( dataVZ[kk]*dataV[kk][jj])/
00368                            (sig[kk]*sig[kk]) );
00369 
00370 // Do simple calculation to compare
00371 
00372                         sumx_new = sumx_new + dataVZ[kk];
00373                         sumy_new = sumy_new + dataV[kk][jj];
00374                         sumx2_new = sumx2_new + (dataVZ[kk]*dataVZ[kk]);
00375                         sumxy_new = sumxy_new + 
00376                                         (dataVZ[kk]*dataV[kk][jj]);
00377                       }
00378                    }
00379                   
00380                 }
00381 
00382                 delta = (sumsig*sumx2) - (sumx*sumx);
00383                 m_slope = (1./delta) * ((sumsig*sumxy) -
00384                                                 (sumx*sumy) );
00385                 b_intcpt = (1./delta) * ((sumx2*sumy) -
00386                                            (sumx*sumxy) );
00387 
00388                 tmpTh = (180. / 3.14159) *
00389                 TMath::ASin(TMath::Abs(m_slope)/(TMath::Sqrt(m_slope*m_slope+1.)));
00390 
00391 // Do simple calculation to compare
00392 
00393                 delta_new = (29.*sumx2_new)-(sumx_new*sumx_new);
00394                 slope_new = (1./delta_new) * 
00395                                 ((29.*sumxy_new) - (sumx_new*sumy_new)); 
00396                 intcpt_new = (1./delta_new) *
00397                         ((sumx2_new*sumy_new) - (sumx_new*sumxy_new));
00398                                         
00399 // Make residuals for ii-th plane
00400 
00401                 predict = (m_slope * dataVZ[ii]) + b_intcpt;
00402                 resid = dataV[ii][jj] - predict;
00403                 
00404                 if (iCountPlanes >= datPointsMin &&
00405                     iCountPlanes <= datPointsMax &&
00406                     TMath::Abs(resid) <= residMax) {
00407                   sumres[ii] = sumres[ii] + resid;
00408                   sumsqr[ii] = sumsqr[ii] + (resid*resid);
00409                 } else {
00410                   ftracks[ii]--;
00411                 }
00412 
00413 
00414 // Compute sums for average track slope and intercept.
00415 
00416                 bsum = bsum + b_intcpt;
00417                 msum = msum + m_slope;
00418                 bsum2 = bsum2 + (b_intcpt*b_intcpt);
00419                 msum2 = msum2 + (m_slope*m_slope);
00420 
00421 
00422 
00423 // Fill histos
00424 
00425                 if (n_iter == 1) {
00426                         h11->Fill(resid);
00427                 }
00428                 if (n_iter == 2) {
00429                         h12->Fill(resid);
00430 
00431                 }
00432                 if (n_iter == 3) {
00433                         h13 -> Fill(resid);
00434                 }
00435                 if (n_iter == 4) {
00436                         h14 -> Fill(resid);
00437                 }
00438                 if (n_iter == 5) {
00439                         h15 -> Fill(resid);
00440                 }
00441                 if (n_iter == 10) {
00442                         h16 -> Fill(resid);
00443                         if (TMath::Abs(resid)<10)
00444                           h91 -> Fill(float(ii),TMath::Abs(resid),1);
00445                         if (tmpTh<90)
00446                         h81 -> Fill(tmpTh,TMath::Abs(resid),1);
00447                 }
00448              }
00449            } 
00450         
00451         }
00452 
00453 // Make average residuals
00454 
00455            for (int ii=0;ii<nPlanes;ii++) {
00456               avgresV[ii] = sumres[ii]/ ftracks[ii]; 
00457               resV[ii] += avgresV[ii];
00458               stdresV[ii] = sqrt( (sumsqr[ii] - 
00459                 ftracks[ii]*(avgresV[ii]*avgresV[ii]))/(ftracks[ii] -1.) );
00460               if (n_iter == maxIter) h21 -> Fill(resV[ii]-offsetV[ii]);
00461               if (n_iter == maxIter) h61 -> Fill(ii,ftracks[ii]);
00462            }
00463 
00464 }

int track_class::getZI ( int  iplane,
int  tOr 
)
int track_class::getZI ( int  iplane,
int  tOr 
)

Definition at line 694 of file track_class_data.cxx.

Referenced by datread().

00694                                          {
00695 
00696 
00697    Int_t ij = -1;
00698 
00699    if (iplane < 245) {
00700      if (tOr == 0) ij = iplane/2 ;
00701      if (tOr == 1) ij = (iplane-1)/2;
00702    }
00703  
00704    if (iplane > 245) {
00705      if (tOr == 0) ij = (iplane-1)/2 ;
00706      if (tOr == 1) ij = iplane/2;
00707    }          
00708 
00709    if (ij == -1)  cout << "error in getZI" << endl;
00710    return ij;
00711 }

void track_class::moddat ( int  planeOr  ) 
void track_class::moddat ( int  planeOr  ) 

Definition at line 579 of file track_class_data.cxx.

References avgresU, avgresV, dataU, dataV, nPlanes, and nTracks.

00579                                    {
00580 
00581   if(planeOr == 0){
00582         for(int jj=0; jj<nTracks; jj++) {
00583            for(int ii=0; ii<nPlanes; ii++) {
00584              if(dataU[ii][jj] > -8888) {
00585                 dataU[ii][jj] = dataU[ii][jj] - avgresU[ii];
00586              }
00587            }
00588         }
00589   }
00590 
00591   if(planeOr == 1){
00592         for(int jj=0; jj<nTracks; jj++) {
00593            for(int ii=0; ii<nPlanes; ii++) {
00594 
00595                 dataV[ii][jj] = dataV[ii][jj] - avgresV[ii];
00596            }
00597         }
00598   }
00599 }

void track_class::offgen (  ) 
void track_class::offgen (  ) 

Definition at line 713 of file track_class_data.cxx.

References offsetU, and offsetV.

00713                         {
00714 
00715         offsetU[0] = 0;
00716         offsetV[0] = 0;
00717         float randTmp;
00718 
00719         for (int i=0;i<=29;++i){
00720 
00721           //       randTmp =  gRandom -> Gaus(0.,offsetRMS);
00722            offsetV[i] = 0;
00723            offsetU[i] = 0;
00724         }
00725         
00726         for (int i=0;i<=29;++i){
00727 
00728           //offsetU[i] = gRandom -> Gaus(0.,offsetRMS);
00729            //randTmp =  gRandom -> Gaus(0.,offsetRMS);
00730 
00731         }
00732 
00733         //      offsetU[5] = 0.75; offsetU[20] = -1.; offsetU[29] = 1.5;
00734         offsetV[0]*=0.3;       
00735         //offsetV[5] = 0.75; offsetV[15] = 0.5; offsetV[29] = -1.5;
00736 
00737 
00738         cout << "Offsets U:" << endl;
00739         for (int i=0;i<=25;i=i+5){
00740 
00741            printf("   %8.2f  %8.2f  %8.2f  %8.2f  %8.2f\n",
00742             offsetU[i],offsetU[i+1],offsetU[i+2],offsetU[i+3],offsetU[i+4]);
00743         }
00744 
00745         cout << "Offsets V:" << endl;
00746         for (int i=0;i<=25;i=i+5){
00747 
00748            printf("   %8.2f  %8.2f  %8.2f  %8.2f  %8.2f\n",
00749             offsetV[i],offsetV[i+1],offsetV[i+2],offsetV[i+3],offsetV[i+4]);
00750         }
00751 }

void track_class::offsetread (  ) 
void track_class::offsetread (  ) 

Definition at line 754 of file track_class_data.cxx.

References offsetU, and offsetV.

00754                             {
00755 
00756 // Read Offsets
00757 
00758    Double_t shift1, shift2, shift3, shift4, shift5, shift6;
00759    Int_t iCount = 0;
00760    Int_t iCountU = 0;
00761    Int_t iCountV = 0;
00762    ifstream shifts("shifts.txt"); 
00763 //   ifstream shifts("noshifts.txt"); 
00764    while (shifts.good()){ 
00765      iCount++;
00766      shifts >>  shift1 >>  shift2 >>  shift3 >>  shift4 >> shift5 >> shift6;
00767      if(iCount%2==1){  
00768        offsetU[iCountU] = shift1; iCountU++;
00769        offsetU[iCountU] = shift2; iCountU++;
00770        offsetU[iCountU] = shift3; iCountU++;
00771        offsetU[iCountU] = shift4; iCountU++;
00772        offsetU[iCountU] = shift5; iCountU++;
00773        offsetU[iCountU] = shift6; iCountU++;
00774      } else {
00775        offsetV[iCountV] = -shift1; iCountV++;
00776        offsetV[iCountV] = -shift2; iCountV++;
00777        offsetV[iCountV] = -shift3; iCountV++;
00778        offsetV[iCountV] = -shift4; iCountV++;
00779        offsetV[iCountV] = -shift5; iCountV++;
00780        offsetV[iCountV] = -shift6; iCountV++;     
00781      }
00782    }
00783    shifts.close();     
00784 
00785 
00786         cout << "Offsets U:" << endl;
00787         for (int i=0;i<=25;i=i+5){
00788 
00789            printf("   %8.2f  %8.2f  %8.2f  %8.2f  %8.2f\n",
00790             offsetU[i],offsetU[i+1],offsetU[i+2],offsetU[i+3],offsetU[i+4]);
00791         }
00792 
00793         cout << "Offsets V:" << endl;
00794         for (int i=0;i<=25;i=i+5){
00795 
00796            printf("   %8.2f  %8.2f  %8.2f  %8.2f  %8.2f\n",
00797             offsetV[i],offsetV[i+1],offsetV[i+2],offsetV[i+3],offsetV[i+4]);
00798         }
00799 }

void track_class::print_off ( int  n_iter  ) 
void track_class::print_off ( int  n_iter  ) 

Definition at line 601 of file track_class_data.cxx.

References h30, h31, h40, h41, h50, h51, h70, h71, maxIter, nPlanes, offsetU, offsetV, resU, and resV.

00601                                       {
00602 
00603         cout << " Offsets U:" << endl;
00604 
00605         for (int i=0;i<=25;i=i+5){
00606 
00607            printf("   %8.2f  %8.2f  %8.2f  %8.2f  %8.2f\n",
00608                 offsetU[i],offsetU[i+1],offsetU[i+2],
00609                 offsetU[i+3],offsetU[i+4]);
00610         }
00611 
00612         cout << " summed Residuals U:" << endl;
00613 
00614         for (int i=0;i<=25;i=i+5){
00615 
00616            printf("   %8.2f  %8.2f  %8.2f  %8.2f  %8.2f\n",
00617                 resU[i],resU[i+1],resU[i+2],resU[i+3],resU[i+4]);
00618         }
00619 
00620         cout << " difference:" << endl;
00621 
00622         for (int i=0;i<=25;i=i+5){
00623 
00624            printf("   %8.2f  %8.2f  %8.2f  %8.2f  %8.2f\n",
00625                 resU[i]-offsetU[i],resU[i+1]-offsetU[i+1],resU[i+2]-offsetU[i+2],
00626                 resU[i+3]-offsetU[i+3],resU[i+4]-offsetU[i+4]);
00627         }
00628         
00629         float tmpDiff;
00630         if(n_iter == maxIter){
00631           for (int i=0;i<nPlanes;i++){
00632               tmpDiff = offsetU[i]-resU[i];
00633               h30->Fill(offsetU[i],tmpDiff);
00634               h40->Fill(i+0.5,offsetU[i]);
00635               h50->Fill(offsetU[i]); 
00636               h70->Fill(2*(i+0.5),tmpDiff);  
00637               cout << "residual U plane" << 2*(i+0.5) <<": " << tmpDiff << endl;
00638           }
00639         }
00640 
00641         cout << " Offsets V:" << endl;
00642 
00643         for (int i=0;i<=25;i=i+5){
00644 
00645            printf("   %8.2f  %8.2f  %8.2f  %8.2f  %8.2f\n",
00646                 offsetV[i],offsetV[i+1],offsetV[i+2],
00647                 offsetV[i+3],offsetV[i+4]);
00648         }
00649 
00650         cout << " summed Residuals V:" << endl;
00651 
00652         for (int i=0;i<=25;i=i+5){
00653 
00654            printf("   %8.2f  %8.2f  %8.2f  %8.2f  %8.2f\n",
00655                 resV[i],resV[i+1],resV[i+2],resV[i+3],resV[i+4]);
00656         }
00657 
00658         cout << " difference:" << endl;
00659 
00660         for (int i=0;i<=25;i=i+5){
00661 
00662            printf("   %8.2f  %8.2f  %8.2f  %8.2f  %8.2f\n",
00663                 resV[i]-offsetV[i],resV[i+1]-offsetV[i+1],resV[i+2]-offsetV[i+2],
00664                 resV[i+3]-offsetV[i+3],resV[i+4]-offsetV[i+4]);
00665         }
00666 
00667 
00668         if(n_iter == maxIter){
00669           for (int i=0;i<nPlanes;i++){
00670               tmpDiff = offsetV[i]-resV[i];
00671               h31->Fill(offsetV[i],tmpDiff);
00672               h41->Fill(i+0.5,offsetV[i]);
00673               h51->Fill(offsetV[i]); 
00674               h71->Fill(2*(i+0.5)-1,tmpDiff); 
00675               cout << "residual V plane" << 2*(i+0.5)-1 <<": " << tmpDiff << endl;
00676           }
00677         }
00678 
00679         double moffU = 0.;
00680         double moffV = 0.;
00681         for (int i=0;i<nPlanes;i++){
00682           moffU += offsetU[i];
00683           moffV += offsetV[i];    
00684         }
00685         moffU /= nPlanes;
00686         moffV /= nPlanes;
00687 
00688         cout << "average offsets U, V: " << moffU << " " << moffV << endl;
00689 
00690         
00691 }


Member Data Documentation

Definition at line 40 of file track_class_data.h.

Referenced by fittrkU(), and moddat().

Definition at line 41 of file track_class_data.h.

Referenced by fittrkV(), and moddat().

Definition at line 47 of file track_class_data.h.

Definition at line 47 of file track_class_data.h.

Definition at line 32 of file track_class_data.h.

Referenced by datread(), fittrkU(), moddat(), and track_class().

Definition at line 34 of file track_class_data.h.

Referenced by datread(), and fittrkU().

Definition at line 33 of file track_class_data.h.

Referenced by datread(), fittrkV(), moddat(), and track_class().

Definition at line 35 of file track_class_data.h.

Referenced by datread(), and fittrkV().

Definition at line 60 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 63 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 63 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 63 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 63 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 63 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 61 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 64 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 64 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 64 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 64 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 64 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 61 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 65 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 65 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 65 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 65 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 65 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 61 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 61 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 61 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 61 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 60 of file track_class_mc.h.

Definition at line 60 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 60 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 66 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 66 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 66 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 66 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 66 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 61 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 67 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 67 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 67 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 67 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 67 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 68 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 68 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 68 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 68 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 68 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 60 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 70 of file track_class_data.h.

Referenced by fittrkU(), and print_off().

Definition at line 70 of file track_class_data.h.

Referenced by fittrkV(), and print_off().

Definition at line 60 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 70 of file track_class_data.h.

Referenced by fittrkU(), and print_off().

Definition at line 70 of file track_class_data.h.

Referenced by fittrkV(), and print_off().

Definition at line 60 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 60 of file track_class_data.h.

Referenced by fittrkU(), and print_off().

Definition at line 61 of file track_class_data.h.

Referenced by fittrkV(), and print_off().

Definition at line 60 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 60 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 61 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 59 of file track_class_mc.h.

Definition at line 70 of file track_class_data.h.

Referenced by fittrkU(), and print_off().

Definition at line 70 of file track_class_data.h.

Referenced by fittrkV(), and print_off().

TProfile * track_class::h80

Definition at line 70 of file track_class_data.h.

Referenced by fittrkU().

TProfile * track_class::h81

Definition at line 73 of file track_class_data.h.

Referenced by fittrkV().

TProfile * track_class::h90

Definition at line 70 of file track_class_data.h.

Referenced by fittrkU().

TProfile * track_class::h91

Definition at line 73 of file track_class_data.h.

Referenced by fittrkV().

Definition at line 47 of file track_class_data.h.

Definition at line 47 of file track_class_data.h.

Definition at line 37 of file track_class_data.h.

Referenced by fittrkU(), offgen(), offsetread(), and print_off().

Definition at line 38 of file track_class_data.h.

Referenced by fittrkV(), offgen(), offsetread(), and print_off().

Definition at line 42 of file track_class_data.h.

Referenced by fittrkU(), print_off(), and track_class().

Definition at line 43 of file track_class_data.h.

Referenced by fittrkV(), print_off(), and track_class().

Definition at line 39 of file track_class_data.h.

Referenced by datread(), fittrkU(), and fittrkV().

Definition at line 45 of file track_class_data.h.

Referenced by fittrkU().

Definition at line 46 of file track_class_data.h.

Referenced by fittrkV().


The documentation for this class was generated from the following files:

Generated on 15 Jul 2018 for loon by  doxygen 1.6.1