Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:24:43

0001 #!/bin/bash
0002 
0003 # to run this script, do
0004 # ./checkCalib.sh <filepath>
0005 # where <filepath> is the path to the output root file from CSCValiation
0006 
0007 # example:  ./checkCalib.sh ~/work/DEV/CMSSW_1_8_0_pre8/src/RecoLocalMuon/CSCValidation/test/validationHists_muongun.root
0008 
0009 ARG1=$1
0010 
0011 MACRO=checkCalib_temp.C
0012 cat > ${MACRO}<<EOF
0013 
0014 {
0015   std::string newReleaseFile = "${ARG1}";
0016   std::string refReleaseFile = "fakeCalibReference.root";
0017 
0018   ofstream out;
0019   out.open("calib_compare_results.txt");
0020 
0021   TFile *fn = new TFile(newReleaseFile.c_str(),"READ");
0022   TFile *fo = new TFile(refReleaseFile.c_str(),"READ");
0023 
0024   vector<TH1F*> hCo;
0025   vector<TH1F*> hCn;
0026 
0027   hCn.push_back((TH1F*)fn->Get("Calib/hCalibGainsS"));
0028   hCn.push_back((TH1F*)fn->Get("Calib/hCalibXtalkSL"));
0029   hCn.push_back((TH1F*)fn->Get("Calib/hCalibXtalkSR"));
0030   hCn.push_back((TH1F*)fn->Get("Calib/hCalibXtalkIL"));
0031   hCn.push_back((TH1F*)fn->Get("Calib/hCalibXtalkIR"));
0032   hCn.push_back((TH1F*)fn->Get("Calib/hCalibPedsP"));
0033   hCn.push_back((TH1F*)fn->Get("Calib/hCalibPedsR"));
0034   hCn.push_back((TH1F*)fn->Get("Calib/hCalibNoise33"));
0035   hCn.push_back((TH1F*)fn->Get("Calib/hCalibNoise34"));
0036   hCn.push_back((TH1F*)fn->Get("Calib/hCalibNoise35"));
0037   hCn.push_back((TH1F*)fn->Get("Calib/hCalibNoise44"));
0038   hCn.push_back((TH1F*)fn->Get("Calib/hCalibNoise45"));
0039   hCn.push_back((TH1F*)fn->Get("Calib/hCalibNoise46"));
0040   hCn.push_back((TH1F*)fn->Get("Calib/hCalibNoise55"));
0041   hCn.push_back((TH1F*)fn->Get("Calib/hCalibNoise56"));
0042   hCn.push_back((TH1F*)fn->Get("Calib/hCalibNoise57"));
0043   hCn.push_back((TH1F*)fn->Get("Calib/hCalibNoise66"));
0044   hCn.push_back((TH1F*)fn->Get("Calib/hCalibNoise67"));
0045   hCn.push_back((TH1F*)fn->Get("Calib/hCalibNoise77"));
0046 
0047   hCo.push_back((TH1F*)fo->Get("Calib/hCalibGainsS"));
0048   hCo.push_back((TH1F*)fo->Get("Calib/hCalibXtalkSL"));
0049   hCo.push_back((TH1F*)fo->Get("Calib/hCalibXtalkSR"));
0050   hCo.push_back((TH1F*)fo->Get("Calib/hCalibXtalkIL"));
0051   hCo.push_back((TH1F*)fo->Get("Calib/hCalibXtalkIR"));
0052   hCo.push_back((TH1F*)fo->Get("Calib/hCalibPedsP"));
0053   hCo.push_back((TH1F*)fo->Get("Calib/hCalibPedsR"));
0054   hCo.push_back((TH1F*)fo->Get("Calib/hCalibNoise33"));
0055   hCo.push_back((TH1F*)fo->Get("Calib/hCalibNoise34"));
0056   hCo.push_back((TH1F*)fo->Get("Calib/hCalibNoise35"));
0057   hCo.push_back((TH1F*)fo->Get("Calib/hCalibNoise44"));
0058   hCo.push_back((TH1F*)fo->Get("Calib/hCalibNoise45"));
0059   hCo.push_back((TH1F*)fo->Get("Calib/hCalibNoise46"));
0060   hCo.push_back((TH1F*)fo->Get("Calib/hCalibNoise55"));
0061   hCo.push_back((TH1F*)fo->Get("Calib/hCalibNoise56"));
0062   hCo.push_back((TH1F*)fo->Get("Calib/hCalibNoise57"));
0063   hCo.push_back((TH1F*)fo->Get("Calib/hCalibNoise66"));
0064   hCo.push_back((TH1F*)fo->Get("Calib/hCalibNoise67"));
0065   hCo.push_back((TH1F*)fo->Get("Calib/hCalibNoise77"));
0066 
0067   float diff = 0;
0068   vector<int> ndiff;
0069   vector<float> vdiff;
0070 
0071   for (int k = 0; k < 19; k++){
0072     ndiff.push_back(0);
0073     for (int i = 0; i < 400; i++){
0074       float vo = hCo[k]->GetBinContent(i+1);
0075       float vn = hCn[k]->GetBinContent(i+1);
0076       diff = (vn - vo)/vo;
0077       if (fabs(diff) > 0.01){ ndiff[k] = ndiff[k] + 1; vdiff.push_back(diff); }
0078     }
0079   }
0080 
0081   out << "Results: " << endl;
0082   out << "Number of channels with diff from reference > 1% for... " << endl;
0083   out << "Gain Slopes: " << ndiff[0] << endl;
0084   out << "Xtalk Slopes Left: " << ndiff[1] << endl;
0085   out << "Xtalk Slopes Right: " << ndiff[2] << endl;
0086   out << "Xtalk Intercepts Left: " << ndiff[3] << endl;
0087   out << "Xtalk Intercepts Right: " << ndiff[4] << endl;
0088   out << "Peds: " << ndiff[5] << endl;
0089   out << "Ped RMS: " << ndiff[6] << endl;
0090   out << "Noise Matrix 33: " << ndiff[7] << endl;
0091   out << "Noise Matrix 34: " << ndiff[8] << endl;
0092   out << "Noise Matrix 35: " << ndiff[9] << endl;
0093   out << "Noise Matrix 44: " << ndiff[10] << endl;
0094   out << "Noise Matrix 45: " << ndiff[11] << endl;
0095   out << "Noise Matrix 46: " << ndiff[12] << endl;
0096   out << "Noise Matrix 55: " << ndiff[13] << endl;
0097   out << "Noise Matrix 56: " << ndiff[14] << endl;
0098   out << "Noise Matrix 57: " << ndiff[15] << endl;
0099   out << "Noise Matrix 66: " << ndiff[16] << endl;
0100   out << "Noise Matrix 67: " << ndiff[17] << endl;
0101   out << "Noise Matrix 77: " << ndiff[18] << endl;
0102 
0103   out.close();
0104 }
0105 
0106 EOF
0107 
0108 root -l -q ${MACRO}
0109 
0110 rm checkCalib_temp.C
0111