00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "Alignment/AlignChamW0.h"
00012 #include "Geometry/GChamGeo.h"
00013
00014 #include <TChain.h>
00015 #include <TFile.h>
00016 #include <TProfile.h>
00017
00018 #include <iostream>
00019
00020 using namespace std;
00021
00022 int main(int argc, char** argv) {
00023
00024 AlResidNt* nt = new AlResidNt;
00025 TChain* restree = new TChain("AlignChamW0_CAlign/resid0");
00026 for (int i = 1; i < argc; ++i) restree->Add(argv[i]);
00027 restree->SetBranchAddress("fNt", &nt);
00028
00029 int nEnt = restree->GetEntries();
00030 cout << "Got " << nEnt << " entries" << endl;
00031
00032 TFile* f = TFile::Open("alignSummary.root", "recreate");
00033
00034 TProfile* resVsQP1[9][4];
00035 TProfile* resVsQP2[9][4];
00036 TProfile* resVsU1[9][4];
00037 TProfile* resVsU2[9][4];
00038 TProfile* resVsUperp1[9][4];
00039 TProfile* resVsUperp2[9][4];
00040
00041 double limu[9] = {
00042 10, 10, 10,
00043 50, 50, 50,
00044 80, 80, 100
00045 };
00046
00047
00048 char name[256], title[256];
00049 for (int c = 0; c < kNCham; ++c) {
00050 for (int p = 0; p < kNPlane; ++p) {
00051 sprintf(name, "resqp1%s%d", GChamGeo::Name(c), p + 1);
00052 sprintf(title,
00053 "Residual vs Q/P, no BC, %s%d;Q/P (1/GeV/c);U_{cham}-U_{Fit} (w.s.)",
00054 GChamGeo::Name(c), p + 1);
00055 resVsQP1[c][p] = new TProfile(name, title, 500, -0.25, 0.25);
00056
00057 sprintf(name, "resqp2%s%d", GChamGeo::Name(c), p + 1);
00058 sprintf(title,
00059 "Residual vs Q/P, with BC, %s%d;Q/P (1/GeV/c);U_{cham}-U_{Fit} (w.s.)",
00060 GChamGeo::Name(c), p + 1);
00061 resVsQP2[c][p] = new TProfile(name, title, 500, -0.25, 0.25);
00062
00063 sprintf(name, "resu1%s%d", GChamGeo::Name(c), p + 1);
00064 sprintf(title,
00065 "Residual vs U, no BC, %s%d;U (cm);U_{cham}-U_{Fit} (w.s.)",
00066 GChamGeo::Name(c), p + 1);
00067 resVsU1[c][p] = new TProfile(name, title, 500, -limu[c], limu[c]);
00068
00069 sprintf(name, "resu2%s%d", GChamGeo::Name(c), p + 1);
00070 sprintf(title,
00071 "Residual vs U, with BC, %s%d;U (cm);U_{cham}-U_{Fit} (w.s.)",
00072 GChamGeo::Name(c), p + 1);
00073 resVsU2[c][p] = new TProfile(name, title, 500, -limu[c], limu[c]);
00074
00075 sprintf(name, "resuperp1%s%d", GChamGeo::Name(c), p + 1);
00076 sprintf(title,
00077 "Residual vs U_{perp}, no BC, %s%d;U_{perp} (cm);U_{cham}-U_{Fit} (w.s.)",
00078 GChamGeo::Name(c), p + 1);
00079 resVsUperp1[c][p] = new TProfile(name, title, 500, -limu[c], limu[c]);
00080
00081 sprintf(name, "resuperp2%s%d", GChamGeo::Name(c), p + 1);
00082 sprintf(title,
00083 "Residual vs U_{perp}, with BC, %s%d;U_{perp} (cm);U_{cham}-U_{Fit} (w.s.)",
00084 GChamGeo::Name(c), p + 1);
00085 resVsUperp2[c][p] = new TProfile(name, title, 500, -limu[c], limu[c]);
00086
00087 }
00088 }
00089
00090
00091 for (int ent = 0; ent < nEnt; ++ent) {
00092 restree->GetEntry(ent);
00093 if (nt->poq > 150) continue;
00094
00095 for (int c = 0; c < kNCham; ++c) {
00096 if (nt->poq < -limu[c]) continue;
00097
00098 for (int p = 0; p < kNPlane; ++p) {
00099 if (nt->u[c][p] > 1000) continue;
00100
00101 double res = nt->resid[c][p] / GChamGeo::Pitch(c);
00102
00103 if (nt->nclust < 24) {
00104 resVsQP1[c][p]->Fill(1/nt->poq, res);
00105 resVsU1[c][p]->Fill(nt->u[c][p], res);
00106 resVsUperp1[c][p]->Fill(nt->uperp[c][p], res);
00107 }
00108 else {
00109 resVsQP2[c][p]->Fill(1/nt->poq, res);
00110 resVsU2[c][p]->Fill(nt->u[c][p], res);
00111 resVsUperp2[c][p]->Fill(nt->uperp[c][p], res);
00112 }
00113 }
00114 }
00115 }
00116
00117 f->Write();
00118 delete f;
00119 }
00120
00121