00001 #include "comparisonPlots.h"
00002 #include <string>
00003 #include <sstream>
00004
00005 #include "TProfile.h"
00006 #include "TList.h"
00007 #include "TNtuple.h"
00008 #include "TString.h"
00009 #include <iostream>
00010 #include "TStyle.h"
00011 #include "TGraph.h"
00012 #include "TMultiGraph.h"
00013 #include "THStack.h"
00014
00015
00016 comparisonPlots::comparisonPlots(std::string filename, std::string outputDir, std::string outputFilename)
00017 {
00018
00019 _outputDir = outputDir;
00020
00021 fin = new TFile(filename.c_str());
00022 fin->cd();
00023
00024 output = new TFile((outputDir+outputFilename).c_str(),"recreate");
00025 output->cd();
00026
00027 readTree();
00028
00029 }
00030
00031 void comparisonPlots::readTree(){
00032
00033 data = (TTree*)fin->Get("alignTree");
00034 data->SetBranchAddress("id",&id_);
00035 data->SetBranchAddress("mid",&mid_);
00036 data->SetBranchAddress("level",&level_);
00037 data->SetBranchAddress("mlevel",&mlevel_);
00038 data->SetBranchAddress("sublevel",&sublevel_);
00039 data->SetBranchAddress("x",&x_);
00040 data->SetBranchAddress("y",&y_);
00041 data->SetBranchAddress("z",&z_);
00042 data->SetBranchAddress("alpha",&alpha_);
00043 data->SetBranchAddress("beta",&beta_);
00044 data->SetBranchAddress("gamma",&gamma_);
00045 data->SetBranchAddress("phi",&phi_);
00046 data->SetBranchAddress("eta",&eta_);
00047 data->SetBranchAddress("r",&r_);
00048 data->SetBranchAddress("dx",&dx_);
00049 data->SetBranchAddress("dy",&dy_);
00050 data->SetBranchAddress("dz",&dz_);
00051 data->SetBranchAddress("dphi",&dphi_);
00052 data->SetBranchAddress("dr",&dr_);
00053 data->SetBranchAddress("dalpha",&dalpha_);
00054 data->SetBranchAddress("dbeta",&dbeta_);
00055 data->SetBranchAddress("dgamma",&dgamma_);
00056 data->SetBranchAddress("useDetId",&useDetId_);
00057 data->SetBranchAddress("detDim",&detDim_);
00058 }
00059
00060 void comparisonPlots::plotTwist(TCut Cut, char* dirName, bool savePlot, std::string plotName, bool autolimits,int ColorCode)
00061 {
00062 gStyle->SetTitleAlign(22);
00063 gStyle->SetTitleX(0.5);
00064 gStyle->SetTitleY(0.97);
00065 gStyle->SetTitleFont(62);
00066
00067 TDirectory* plotDir = output->mkdir( dirName );
00068
00069 double minimum, maximum;
00070
00071 if (autolimits)
00072 {
00073 TH1F* phdphi = new TH1F("phdphi", "phdphi", 200, -10, 10);
00074 data->Project("phdphi","dphi",Cut);
00075 getHistMaxMin(phdphi, maximum, minimum, 1);
00076 delete phdphi;
00077 }
00078 else
00079 {
00080 minimum = -0.0004, maximum = 0.0004;
00081 }
00082
00083
00084 TH2F* h_dphiVz = new TH2F("h_dphiVz","#Delta #phi vs. z", 200,minimum,maximum, 200,minimum,maximum);
00085 h_dphiVz->SetMarkerStyle(6);
00086
00087 int j = 2;
00088 TCut zCut[6];
00089 zCut[0] = "z < 0";
00090 zCut[1] = "z >= 0";
00091
00092
00093 if (ColorCode == 1) {
00094 j = 6;
00095
00096 zCut[0] = "sublevel==1";
00097 zCut[1] = "sublevel==2";
00098 zCut[2] = "sublevel==3";
00099 zCut[3] = "sublevel==4";
00100 zCut[4] = "sublevel==5";
00101 zCut[5] = "sublevel==6";
00102 }
00103
00104 std::stringstream st;
00105 st << "dphi > " << minimum << " && dphi < " << maximum;
00106
00107 TCut minmaxCut(st.str().c_str());
00108
00109 data->Project("h_dphiVz", "dphi:z",Cut+minmaxCut);
00110 TGraph* gr_dphiVz_Array[j];
00111 TMultiGraph* mgr_dphiVz=new TMultiGraph();
00112 for ( int i = 0; i < j; i++) {
00113 data->Draw("dphi:z",Cut+zCut[i]+minmaxCut);
00114 gr_dphiVz_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00115 gr_dphiVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
00116 gr_dphiVz_Array[i]->SetMarkerStyle(6);
00117 gr_dphiVz_Array[i]->SetMaximum(maximum);
00118 gr_dphiVz_Array[i]->SetMinimum(minimum);
00119 mgr_dphiVz->Add(gr_dphiVz_Array[i],"p");
00120 }
00121
00122
00123
00124
00125 TCanvas* c = new TCanvas("c_twist", "c_twist", 200, 10, 600, 600);
00126 c->SetFillColor(0);
00127 data->SetMarkerSize(0.5);
00128 data->SetMarkerStyle(6);
00129 c->Divide(1,1);
00130
00131 mgr_dphiVz->SetTitle("#Delta #phi vs. z");
00132
00133
00134
00135 mgr_dphiVz->SetMaximum(maximum);
00136 mgr_dphiVz->SetMinimum(minimum);
00137 mgr_dphiVz->Draw("a");
00138
00139 c->Update();
00140 plotDir->cd();
00141
00142
00143 if (savePlot) c->Print((_outputDir+"plotTwist_"+plotName).c_str());
00144
00145 delete c;
00146 delete h_dphiVz;
00147 }
00148
00149 void comparisonPlots::plot3x3Rot(TCut Cut, char* dirName, bool savePlot, std::string plotName, bool autolimits, int ColorCode ){
00150
00151 gStyle->SetTitleFont(62);
00152 gStyle->SetOptTitle(0);
00153
00154 gStyle->SetFrameBorderMode(0);
00155 gStyle->SetCanvasBorderMode(0);
00156 gStyle->SetPadBorderMode(0);
00157 gStyle->SetPadColor(0);
00158 gStyle->SetCanvasColor(0);
00159 gStyle->SetTitleColor(1);
00160 gStyle->SetStatColor(0);
00161 gStyle->SetStatBorderSize(1);
00162 gStyle->SetFrameFillColor(0);
00163
00164 gStyle->SetTextFont(132);
00165 gStyle->SetTextSize(0.08);
00166 gStyle->SetLabelFont(132,"x");
00167 gStyle->SetLabelFont(132,"y");
00168 gStyle->SetLabelFont(132,"z");
00169 gStyle->SetTitleSize(0.08,"x");
00170 gStyle->SetTitleSize(0.08,"y");
00171 gStyle->SetTitleSize(0.08,"z");
00172 gStyle->SetLabelSize(0.08,"x");
00173 gStyle->SetLabelSize(0.08,"y");
00174 gStyle->SetLabelSize(0.08,"z");
00175
00176 gStyle->SetMarkerStyle(8);
00177 gStyle->SetHistLineWidth(1.85);
00178 gStyle->SetLineStyleString(2,"[12 12]");
00179
00180 gStyle->SetPadTickX(1);
00181 gStyle->SetPadTickY(1);
00182
00183 TDirectory* plotDir = output->mkdir( dirName );
00184
00185 double minimumR, maximumR;
00186 double minimumZ, maximumZ;
00187 double minimumPhi, maximumPhi;
00188 double minimumDalpha, maximumDalpha;
00189 double minimumDbeta, maximumDbeta;
00190 double minimumDgamma, maximumDgamma;
00191
00192 if (autolimits){
00193
00194 TH1F* phr = new TH1F("phr", "phr", 200, 0, 200);
00195 TH1F* phz = new TH1F("phz", "phz", 400, -300, 300);
00196 TH1F* phphi = new TH1F("phphi", "phphi", 200, -3.15, 3.15);
00197 TH1F* phdalpha = new TH1F("phdalpha", "phdalpha", 2000, -10, 10);
00198 TH1F* phdbeta = new TH1F("phdbeta", "phdbeta", 2000, -10, 10);
00199 TH1F* phdgamma = new TH1F("phdgamma", "phdgamma", 200, -10, 10);
00200 data->Project("phr","r",Cut);
00201 data->Project("phz","z",Cut);
00202 data->Project("phphi","phi",Cut);
00203 data->Project("phdalpha","dalpha",Cut);
00204 data->Project("phdbeta","dbeta",Cut);
00205 data->Project("phdgamma","dgamma",Cut);
00206 getHistMaxMin(phr, maximumR, minimumR, 0);
00207 getHistMaxMin(phz, maximumZ, minimumZ, 0);
00208 getHistMaxMin(phphi, maximumPhi, minimumPhi, 0);
00209 getHistMaxMin(phdalpha, maximumDalpha, minimumDalpha, 1);
00210 getHistMaxMin(phdbeta, maximumDbeta, minimumDbeta, 1);
00211 getHistMaxMin(phdgamma, maximumDgamma, minimumDgamma, 1);
00212 }
00213 else{
00214 minimumR = 0., maximumR = 200.;
00215 minimumZ = -300., maximumZ = 300.;
00216 minimumPhi = -3.15, maximumPhi = 3.15;
00217 minimumDalpha = -1, maximumDalpha = 1;
00218 minimumDbeta = -1, maximumDbeta = 1;
00219 minimumDgamma = -1, maximumDgamma = 1;
00220 }
00221
00222
00223 TH2F* h_dalphaVr = new TH2F("h_dalphaVr","#Delta #alpha vs. r",200,minimumR,maximumR,200,minimumDalpha,maximumDalpha);
00224 TH2F* h_dbetaVr = new TH2F("h_dbetaVr", "#Delta #beta vs. r", 200,minimumR,maximumR,200,minimumDbeta, maximumDbeta);
00225 TH2F* h_dgammaVr = new TH2F("h_dgammaVr","#Delta #gamma vs. r",200,minimumR,maximumR,200,minimumDgamma,maximumDgamma);
00226
00227 TH2F* h_dalphaVz = new TH2F("h_dalphaVz","#Delta #alpha vs. z", 200,minimumZ,maximumZ, 200,minimumDalpha,maximumDalpha);
00228 TH2F* h_dbetaVz = new TH2F("h_dbetaVz", "#Delta #beta vs. z", 200,minimumZ,maximumZ, 200,minimumDbeta, maximumDbeta);
00229 TH2F* h_dgammaVz = new TH2F("h_dgammaVz","#Delta #gama vs. z", 200,minimumZ,maximumZ, 200,minimumDgamma,maximumDgamma);
00230
00231 TH2F* h_dalphaVphi = new TH2F("h_dalphaVphi","#Delta #alpha vs. #phi", 200,minimumPhi,maximumPhi,200,minimumDalpha,maximumDalpha);
00232 TH2F* h_dbetaVphi = new TH2F("h_dbetaVphi", "#Delta #beta vs. #phi", 200,minimumPhi,maximumPhi,200,minimumDbeta, maximumDbeta);
00233 TH2F* h_dgammaVphi = new TH2F("h_dgammaVphi","#Delta #gamma vs. #phi", 200,minimumPhi,maximumPhi,200,minimumDgamma,maximumDgamma);
00234
00235 h_dalphaVr ->SetMarkerStyle(6) ;
00236 h_dbetaVr ->SetMarkerStyle(6) ;
00237 h_dgammaVr ->SetMarkerStyle(6) ;
00238
00239 h_dalphaVz ->SetMarkerStyle(6) ;
00240 h_dbetaVz ->SetMarkerStyle(6) ;
00241 h_dgammaVz ->SetMarkerStyle(6) ;
00242
00243 h_dalphaVphi ->SetMarkerStyle(6) ;
00244 h_dbetaVphi ->SetMarkerStyle(6) ;
00245 h_dgammaVphi ->SetMarkerStyle(6) ;
00246
00247 int j = 2;
00248 TCut zCut[6];
00249 zCut[0] = "z < 0";
00250 zCut[1] = "z >= 0";
00251
00252 if (ColorCode == 1) {
00253 j = 6;
00254
00255 zCut[0] = "sublevel==1";
00256 zCut[1] = "sublevel==2";
00257 zCut[2] = "sublevel==3";
00258 zCut[3] = "sublevel==4";
00259 zCut[4] = "sublevel==5";
00260 zCut[5] = "sublevel==6";
00261 }
00262
00263 data->Project("h_dalphaVr", "dalpha*1000:r",Cut);
00264 TGraph* gr_dalphaVr_Array[j];
00265 TMultiGraph* mgr_dalphaVr=new TMultiGraph();
00266 for ( int i = 0; i < j; i++) {
00267 data->Draw("dalpha*1000:r",Cut+zCut[i]);
00268 gr_dalphaVr_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00269 gr_dalphaVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
00270 gr_dalphaVr_Array[i]->SetMarkerStyle(6);
00271 mgr_dalphaVr->Add(gr_dalphaVr_Array[i],"p");
00272 }
00273
00274 data->Project("h_dbetaVr", "dbeta*1000:r",Cut);
00275 TGraph* gr_dbetaVr_Array[j];
00276 TMultiGraph* mgr_dbetaVr=new TMultiGraph();
00277 for ( int i = 0; i < j; i++) {
00278 data->Draw("dbeta*1000:r",Cut+zCut[i]);
00279 gr_dbetaVr_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00280 gr_dbetaVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
00281 gr_dbetaVr_Array[i]->SetMarkerStyle(6);
00282 mgr_dbetaVr->Add(gr_dbetaVr_Array[i],"p");
00283 }
00284
00285 data->Project("h_dgammaVr", "dgamma*1000:r",Cut);
00286 TGraph* gr_dgammaVr_Array[j];
00287 TMultiGraph* mgr_dgammaVr=new TMultiGraph();
00288 for ( int i = 0; i < j; i++) {
00289 data->Draw("dgamma*1000:r",Cut+zCut[i]);
00290 gr_dgammaVr_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00291 gr_dgammaVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
00292 gr_dgammaVr_Array[i]->SetMarkerStyle(6);
00293 mgr_dgammaVr->Add(gr_dgammaVr_Array[i],"p");
00294 }
00295
00296 data->Project("h_dalphaVz", "dalpha*1000:z",Cut);
00297 TGraph* gr_dalphaVz_Array[j];
00298 TMultiGraph* mgr_dalphaVz=new TMultiGraph();
00299 for ( int i = 0; i < j; i++) {
00300 data->Draw("dalpha*1000:z",Cut+zCut[i]);
00301 gr_dalphaVz_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00302 gr_dalphaVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
00303 gr_dalphaVz_Array[i]->SetMarkerStyle(6);
00304 mgr_dalphaVz->Add(gr_dalphaVz_Array[i],"p");
00305 }
00306
00307 data->Project("h_dbetaVz", "dbeta*1000:z",Cut);
00308 TGraph* gr_dbetaVz_Array[j];
00309 TMultiGraph* mgr_dbetaVz=new TMultiGraph();
00310 for ( int i = 0; i < j; i++) {
00311 data->Draw("dbeta*1000:z",Cut+zCut[i]);
00312 gr_dbetaVz_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00313 gr_dbetaVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
00314 gr_dbetaVz_Array[i]->SetMarkerStyle(6);
00315 mgr_dbetaVz->Add(gr_dbetaVz_Array[i],"p");
00316 }
00317
00318 data->Project("h_dgammaVz", "dgamma*1000:z",Cut);
00319 TGraph* gr_dgammaVz_Array[j];
00320 TMultiGraph* mgr_dgammaVz=new TMultiGraph();
00321 for ( int i = 0; i < j; i++) {
00322 data->Draw("dgamma*1000:z",Cut+zCut[i]);
00323 gr_dgammaVz_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00324 gr_dgammaVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
00325 gr_dgammaVz_Array[i]->SetMarkerStyle(6);
00326 mgr_dgammaVz->Add(gr_dgammaVz_Array[i],"p");
00327 }
00328
00329 data->Project("h_dalphaVphi", "dalpha*1000:phi",Cut);
00330 TGraph* gr_dalphaVphi_Array[j];
00331 TMultiGraph* mgr_dalphaVphi=new TMultiGraph();
00332 for ( int i = 0; i < j; i++) {
00333 data->Draw("dalpha*1000:phi",Cut+zCut[i]);
00334 gr_dalphaVphi_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00335 gr_dalphaVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
00336 gr_dalphaVphi_Array[i]->SetMarkerStyle(6);
00337 mgr_dalphaVphi->Add(gr_dalphaVphi_Array[i],"p");
00338 }
00339
00340 data->Project("h_dbetaVphi", "dbeta*1000:phi",Cut);
00341 TGraph* gr_dbetaVphi_Array[j];
00342 TMultiGraph* mgr_dbetaVphi=new TMultiGraph();
00343 for ( int i = 0; i < j; i++) {
00344 data->Draw("dbeta*1000:phi",Cut+zCut[i]);
00345 gr_dbetaVphi_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00346 gr_dbetaVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
00347 gr_dbetaVphi_Array[i]->SetMarkerStyle(6);
00348 mgr_dbetaVphi->Add(gr_dbetaVphi_Array[i],"p");
00349 }
00350
00351 data->Project("h_dgammaVphi", "dgamma*1000:phi",Cut);
00352 TGraph* gr_dgammaVphi_Array[j];
00353 TMultiGraph* mgr_dgammaVphi=new TMultiGraph();
00354 for ( int i = 0; i < j; i++) {
00355 data->Draw("dgamma*1000:phi",Cut+zCut[i]);
00356 gr_dgammaVphi_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00357 gr_dgammaVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
00358 gr_dgammaVphi_Array[i]->SetMarkerStyle(6);
00359 mgr_dgammaVphi->Add(gr_dgammaVphi_Array[i],"p");
00360 }
00361
00362
00363 TCanvas* c = new TCanvas("c", "c", 200, 10, 1200, 700);
00364 c->SetFillColor(0);
00365 data->SetMarkerSize(0.5);
00366 data->SetMarkerStyle(6);
00367 c->Divide(3,3);
00368 c->cd(1);
00369 if (!autolimits) h_dalphaVr->Draw();
00370 if (autolimits) mgr_dalphaVr->Draw("a");
00371 c->Update();
00372 c->cd(2);
00373 if (!autolimits) h_dbetaVr->Draw();
00374 if (autolimits) mgr_dbetaVr->Draw("a");
00375 c->Update();
00376 c->cd(3);
00377 if (!autolimits) h_dgammaVr->Draw();
00378 if (autolimits) mgr_dgammaVr->Draw("a");
00379 c->cd(4);
00380 if (!autolimits) h_dalphaVz->Draw();
00381 if (autolimits) mgr_dalphaVz->Draw("a");
00382 c->cd(5);
00383 if (!autolimits) h_dbetaVz->Draw();
00384 if (autolimits) mgr_dbetaVz->Draw("a");
00385 c->cd(6);
00386 if (!autolimits) h_dgammaVz->Draw();
00387 if (autolimits) mgr_dgammaVz->Draw("a");
00388 c->cd(7);
00389 if (!autolimits) h_dalphaVphi->Draw();
00390 if (autolimits) mgr_dalphaVphi->Draw("a");
00391 c->cd(8);
00392 if (!autolimits) h_dbetaVphi->Draw();
00393 if (autolimits) mgr_dbetaVphi->Draw("a");
00394 c->cd(9);
00395 if (!autolimits) h_dgammaVphi->Draw();
00396 if (autolimits) mgr_dgammaVphi->Draw("a");
00397
00398 mgr_dalphaVr->GetXaxis() ->SetTitle("r (cm)");
00399 mgr_dbetaVr->GetXaxis() ->SetTitle("r (cm)");
00400 mgr_dgammaVr->GetXaxis() ->SetTitle("r (cm)");
00401 mgr_dalphaVz->GetXaxis() ->SetTitle("z (cm)");
00402 mgr_dbetaVz->GetXaxis() ->SetTitle("z (cm)");
00403 mgr_dgammaVz->GetXaxis() ->SetTitle("z (cm)");
00404 mgr_dalphaVphi->GetXaxis()->SetTitle("#phi");
00405 mgr_dbetaVphi->GetXaxis() ->SetTitle("#phi");
00406 mgr_dgammaVphi->GetXaxis()->SetTitle("#phi");
00407
00408 mgr_dalphaVr->GetYaxis() ->SetTitle("#Delta #alpha (mrad)");
00409 mgr_dbetaVr->GetYaxis() ->SetTitle("#Delta #beta (mrad)");
00410 mgr_dgammaVr->GetYaxis() ->SetTitle("#Delta #gamma (mrad)");
00411 mgr_dalphaVz->GetYaxis() ->SetTitle("#Delta #alpha (mrad)");
00412 mgr_dbetaVz->GetYaxis() ->SetTitle("#Delta #beta (mrad)");
00413 mgr_dgammaVz->GetYaxis() ->SetTitle("#Delta #gamma (mrad)");
00414 mgr_dalphaVphi->GetYaxis()->SetTitle("#Delta #alpha (mrad)");
00415 mgr_dbetaVphi->GetYaxis() ->SetTitle("#Delta #beta (mrad)");
00416 mgr_dgammaVphi->GetYaxis()->SetTitle("#Delta #gamma (mrad)");
00417
00418 c->Update();
00419
00420
00421
00422
00423
00424
00425
00426 if (savePlot) c->Print((_outputDir+"plot3x3Rot_"+plotName).c_str());
00427
00428 }
00429
00430 void comparisonPlots::plot3x5(TCut Cut, char* dirName, bool savePlot, std::string plotName, bool autolimits, int ColorCode ){
00431
00432
00433
00434
00435
00436 gStyle->SetTitleFont(62);
00437 gStyle->SetOptTitle(0);
00438
00439 gStyle->SetFrameBorderMode(0);
00440 gStyle->SetCanvasBorderMode(0);
00441 gStyle->SetPadBorderMode(0);
00442 gStyle->SetPadColor(0);
00443 gStyle->SetCanvasColor(0);
00444 gStyle->SetTitleColor(1);
00445 gStyle->SetStatColor(0);
00446 gStyle->SetStatBorderSize(1);
00447 gStyle->SetFrameFillColor(0);
00448
00449 gStyle->SetTextFont(132);
00450 gStyle->SetTextSize(0.08);
00451 gStyle->SetLabelFont(132,"x");
00452 gStyle->SetLabelFont(132,"y");
00453 gStyle->SetLabelFont(132,"z");
00454 gStyle->SetTitleSize(0.08,"x");
00455 gStyle->SetTitleSize(0.08,"y");
00456 gStyle->SetTitleSize(0.08,"z");
00457 gStyle->SetLabelSize(0.08,"x");
00458 gStyle->SetLabelSize(0.08,"y");
00459 gStyle->SetLabelSize(0.08,"z");
00460
00461 gStyle->SetMarkerStyle(8);
00462 gStyle->SetHistLineWidth(1.85);
00463 gStyle->SetLineStyleString(2,"[12 12]");
00464
00465 gStyle->SetTitleAlign(22);
00466 gStyle->SetTitleX(0.5);
00467 gStyle->SetTitleY(0.97);
00468 gStyle->SetTitleFont(62);
00469
00470 gStyle->SetPadTickX(1);
00471 gStyle->SetPadTickY(1);
00472
00473 gStyle->SetPadTopMargin(0.1);
00474 gStyle->SetPadRightMargin(0.05);
00475 gStyle->SetPadBottomMargin(0.16);
00476 gStyle->SetPadLeftMargin(0.18);
00477
00478
00479
00480 TDirectory* plotDir = output->mkdir( dirName );
00481
00482
00483 double minimumR, maximumR;
00484 double minimumZ, maximumZ;
00485 double minimumPhi, maximumPhi;
00486 double minimumDR, maximumDR;
00487 double minimumDZ, maximumDZ;
00488 double minimumRDPhi, maximumRDPhi;
00489 double minimumDX, maximumDX;
00490 double minimumDY, maximumDY;
00491 if (autolimits){
00492
00493 TH1F* phr = new TH1F("phr", "phr", 200, 0, 200 );
00494 TH1F* phz = new TH1F("phz", "phz", 400, -300, 300 );
00495 TH1F* phphi = new TH1F("phphi", "phphi", 200, -3.15, 3.15);
00496 TH1F* phdr = new TH1F("phdr", "phdr", 20000,-1000, 1000 );
00497 TH1F* phdz = new TH1F("phdz", "phdz", 20000,-1000, 1000 );
00498 TH1F* phrdphi = new TH1F("phrdphi", "phrdphi", 20000,-1000, 1000 );
00499 TH1F* phdx = new TH1F("phdx", "phy", 20000,-1000, 1000 );
00500 TH1F* phdy = new TH1F("phdy", "phy", 20000,-1000, 1000 );
00501 data->Project("phr","r",Cut);
00502 data->Project("phz","z",Cut);
00503 data->Project("phphi","phi",Cut);
00504 data->Project("phdr","dr*10000",Cut);
00505 data->Project("phdz","dz*10000",Cut);
00506 data->Project("phrdphi","r*dphi*10000",Cut);
00507 data->Project("phdx","dx*10000",Cut);
00508 data->Project("phdy","dy*10000",Cut);
00509 getHistMaxMin(phr, maximumR, minimumR, 0);
00510 getHistMaxMin(phz, maximumZ, minimumZ, 0);
00511 getHistMaxMin(phphi, maximumPhi, minimumPhi, 0);
00512 getHistMaxMin(phdr, maximumDR, minimumDR, 1);
00513 getHistMaxMin(phdz, maximumDZ, minimumDZ, 1);
00514 getHistMaxMin(phrdphi, maximumRDPhi, minimumRDPhi, 1);
00515 getHistMaxMin(phdx, maximumDX, minimumDX, 1);
00516 getHistMaxMin(phdy, maximumDY, minimumDY, 1);
00517 }
00518 else{
00519 minimumR = 0., maximumR = 200.;
00520 minimumZ = -300., maximumZ = 300.;
00521 minimumPhi = -3.15, maximumPhi = 3.15;
00522 minimumDR = -1, maximumDR = 1;
00523 minimumDZ = -1, maximumDZ = 1;
00524 minimumRDPhi = -1, maximumRDPhi = 1;
00525 minimumDX = -1, maximumDX = 1;
00526 minimumDY = -1, maximumDY = 1;
00527 }
00528
00529
00530
00531 TH1F* h_dr = new TH1F("h_dr", "#Delta r", 2000, minimumDR, maximumDR);
00532 TH1F* h_dz = new TH1F("h_dz", "#Delta z", 2000, minimumDZ, maximumDZ);
00533 TH1F* h_rdphi = new TH1F("h_rdphi", "r* #Delta #phi", 2000, minimumRDPhi, maximumRDPhi);
00534 TH2F* h_drVr = new TH2F("h_drVr","#Delta r vs. r",200,minimumR,maximumR,200,minimumDR,maximumDR);
00535 TH2F* h_dzVr = new TH2F("h_dzVr","#Delta z vs. r",200,minimumR,maximumR,200,minimumDZ,maximumDZ);
00536 TH2F* h_rdphiVr = new TH2F("h_rdphiVr","r#Delta #phi vs. r",200,minimumR,maximumR,200,minimumRDPhi,maximumRDPhi);
00537 TH2F* h_dxVr = new TH2F("h_dxVr","#Delta x vs. r", 200,minimumR,maximumR, 200,minimumDX,maximumDX);
00538 TH2F* h_dyVr = new TH2F("h_dyVr","#Delta y vs. r", 200,minimumR,maximumR, 200,minimumDY,maximumDY);
00539 TH2F* h_drVz = new TH2F("h_drVz","#Delta r vs. z", 200,minimumZ,maximumZ, 200,minimumDR,maximumDR);
00540 TH2F* h_dzVz = new TH2F("h_dzVz","#Delta z vs. z", 200,minimumZ,maximumZ, 200,minimumDZ,maximumDZ);
00541 TH2F* h_rdphiVz = new TH2F("h_rdphiVz","r#Delta #phi vs. z", 200,minimumZ,maximumZ, 200,minimumRDPhi,maximumRDPhi);
00542 TH2F* h_dxVz = new TH2F("h_dxVz","#Delta x vs. z", 200,minimumZ,maximumZ, 200,minimumDX,maximumDX);
00543 TH2F* h_dyVz = new TH2F("h_dyVz","#Delta y vs. z", 200,minimumZ,maximumZ, 200,minimumDY,maximumDY);
00544 TH2F* h_drVphi = new TH2F("h_drVphi","#Delta r vs. #phi", 200,minimumPhi,maximumPhi,200,minimumDR,maximumDR);
00545 TH2F* h_dzVphi = new TH2F("h_dzVphi","#Delta z vs. #phi", 200,minimumPhi,maximumPhi, 200,minimumDZ,maximumDZ);
00546 TH2F* h_rdphiVphi = new TH2F("h_rdphiVphi","r#Delta #phi vs. #phi", 200,minimumPhi,maximumPhi,200,minimumRDPhi,maximumRDPhi);
00547 TH2F* h_dxVphi = new TH2F("h_dxVphi","#Delta x vs. #phi", 200,minimumPhi,maximumPhi, 200,minimumDX,maximumDX);
00548 TH2F* h_dyVphi = new TH2F("h_dyVphi","#Delta y vs. #phi", 200,minimumPhi,maximumPhi, 200,minimumDY,maximumDY);
00549
00550 h_drVr->SetMarkerStyle(6);
00551 h_dzVr->SetMarkerStyle(6);
00552 h_rdphiVr->SetMarkerStyle(6);
00553 h_dxVr->SetMarkerStyle(6);
00554 h_dyVr->SetMarkerStyle(6);
00555 h_drVz->SetMarkerStyle(6);
00556 h_dzVz->SetMarkerStyle(6);
00557 h_rdphiVz->SetMarkerStyle(6);
00558 h_dxVz->SetMarkerStyle(6);
00559 h_dyVz->SetMarkerStyle(6);
00560 h_drVphi->SetMarkerStyle(6);
00561 h_dzVphi->SetMarkerStyle(6);
00562 h_rdphiVphi->SetMarkerStyle(6);
00563 h_dxVphi->SetMarkerStyle(6);
00564 h_dyVphi->SetMarkerStyle(6);
00565
00566
00567 int j = 2;
00568 TCut zCut[6];
00569 zCut[0] = "z < 0";
00570 zCut[1] = "z >= 0";
00571
00572
00573 if (ColorCode == 1) {
00574 j = 6;
00575
00576 zCut[0] = "sublevel==1";
00577 zCut[1] = "sublevel==2";
00578 zCut[2] = "sublevel==3";
00579 zCut[3] = "sublevel==4";
00580 zCut[4] = "sublevel==5";
00581 zCut[5] = "sublevel==6";
00582 }
00583
00584
00585 data->Project("h_dr","dr*10000",Cut);
00586 data->Project("h_dz","dz*10000",Cut);
00587 data->Project("h_rdphi","r*dphi*10000",Cut);
00588
00589
00590 data->Project("h_drVr", "dr*10000:r",Cut);
00591 TGraph* gr_drVr_Array[j];
00592 TMultiGraph* mgr_drVr=new TMultiGraph();
00593 for ( int i = 0; i < j; i++) {
00594 data->Draw("dr*10000:r",Cut+zCut[i]);
00595 gr_drVr_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00596 gr_drVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
00597 gr_drVr_Array[i]->SetMarkerStyle(6);
00598 mgr_drVr->Add(gr_drVr_Array[i],"p");
00599 }
00600
00601 data->Project("h_dzVr", "dz*10000:r",Cut);
00602 TGraph* gr_dzVr_Array[j];
00603 TMultiGraph* mgr_dzVr=new TMultiGraph();
00604 for ( int i = 0; i < j; i++) {
00605 data->Draw("dz*10000:r",Cut+zCut[i]);
00606 gr_dzVr_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00607 gr_dzVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
00608 gr_dzVr_Array[i]->SetMarkerStyle(6);
00609 mgr_dzVr->Add(gr_dzVr_Array[i],"p");
00610 }
00611
00612 data->Project("h_rdphiVr", "r*dphi*10000:r",Cut);
00613 TGraph* gr_rdphiVr_Array[j];
00614 TMultiGraph* mgr_rdphiVr=new TMultiGraph();
00615 for ( int i = 0; i < j; i++) {
00616 data->Draw("r*dphi*10000:r",Cut+zCut[i]);
00617 gr_rdphiVr_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00618 gr_rdphiVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
00619 gr_rdphiVr_Array[i]->SetMarkerStyle(6);
00620 mgr_rdphiVr->Add(gr_rdphiVr_Array[i],"p");
00621 }
00622
00623 data->Project("h_dxVr", "dx*10000:r",Cut);
00624 TGraph* gr_dxVr_Array[j];
00625 TMultiGraph* mgr_dxVr=new TMultiGraph();
00626 for ( int i = 0; i < j; i++) {
00627 data->Draw("dx*10000:r",Cut+zCut[i]);
00628 gr_dxVr_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00629 gr_dxVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
00630 gr_dxVr_Array[i]->SetMarkerStyle(6);
00631 mgr_dxVr->Add(gr_dxVr_Array[i],"p");
00632 }
00633
00634 data->Project("h_dyVr", "dy*10000:r",Cut);
00635 TGraph* gr_dyVr_Array[j];
00636 TMultiGraph* mgr_dyVr=new TMultiGraph();
00637 for ( int i = 0; i < j; i++) {
00638 data->Draw("dy*10000:r",Cut+zCut[i]);
00639 gr_dyVr_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00640 gr_dyVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
00641 gr_dyVr_Array[i]->SetMarkerStyle(6);
00642 mgr_dyVr->Add(gr_dyVr_Array[i],"p");
00643 }
00644
00645 data->Project("h_drVz", "dr*10000:z",Cut);
00646 TGraph* gr_drVz_Array[j];
00647 TMultiGraph* mgr_drVz=new TMultiGraph();
00648 for ( int i = 0; i < j; i++) {
00649 data->Draw("dr*10000:z",Cut+zCut[i]);
00650 gr_drVz_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00651 gr_drVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
00652 gr_drVz_Array[i]->SetMarkerStyle(6);
00653 mgr_drVz->Add(gr_drVz_Array[i],"p");
00654 }
00655
00656 data->Project("h_dzVz", "dz*10000:z",Cut);
00657 TGraph* gr_dzVz_Array[j];
00658 TMultiGraph* mgr_dzVz=new TMultiGraph();
00659 for ( int i = 0; i < j; i++) {
00660 data->Draw("dz*10000:z",Cut+zCut[i]);
00661 gr_dzVz_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00662 gr_dzVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
00663 gr_dzVz_Array[i]->SetMarkerStyle(6);
00664 mgr_dzVz->Add(gr_dzVz_Array[i],"p");
00665 }
00666
00667 data->Project("h_rdphiVz", "r*dphi*10000:z",Cut);
00668 TGraph* gr_rdphiVz_Array[j];
00669 TMultiGraph* mgr_rdphiVz=new TMultiGraph();
00670 for ( int i = 0; i < j; i++) {
00671 data->Draw("r*dphi*10000:z",Cut+zCut[i]);
00672 gr_rdphiVz_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00673 gr_rdphiVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
00674 gr_rdphiVz_Array[i]->SetMarkerStyle(6);
00675 mgr_rdphiVz->Add(gr_rdphiVz_Array[i],"p");
00676 }
00677
00678 data->Project("h_dxVz", "dx*10000:z",Cut);
00679 TGraph* gr_dxVz_Array[j];
00680 TMultiGraph* mgr_dxVz=new TMultiGraph();
00681 for ( int i = 0; i < j; i++) {
00682 data->Draw("dx*10000:z",Cut+zCut[i]);
00683 gr_dxVz_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00684 gr_dxVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
00685 gr_dxVz_Array[i]->SetMarkerStyle(6);
00686 mgr_dxVz->Add(gr_dxVz_Array[i],"p");
00687 }
00688
00689 data->Project("h_dyVz", "dy*10000:z",Cut);
00690 TGraph* gr_dyVz_Array[j];
00691 TMultiGraph* mgr_dyVz=new TMultiGraph();
00692 for ( int i = 0; i < j; i++) {
00693 data->Draw("dy*10000:z",Cut+zCut[i]);
00694 gr_dyVz_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00695 gr_dyVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
00696 gr_dyVz_Array[i]->SetMarkerStyle(6);
00697 mgr_dyVz->Add(gr_dyVz_Array[i],"p");
00698 }
00699
00700 data->Project("h_drVphi", "dr*10000:phi",Cut);
00701 TGraph* gr_drVphi_Array[j];
00702 TMultiGraph* mgr_drVphi=new TMultiGraph();
00703 for ( int i = 0; i < j; i++) {
00704 data->Draw("dr*10000:phi",Cut+zCut[i]);
00705 gr_drVphi_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00706 gr_drVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
00707 gr_drVphi_Array[i]->SetMarkerStyle(6);
00708 mgr_drVphi->Add(gr_drVphi_Array[i],"p");
00709 }
00710
00711 data->Project("h_dzVphi", "dz*10000:phi",Cut);
00712 TGraph* gr_dzVphi_Array[j];
00713 TMultiGraph* mgr_dzVphi=new TMultiGraph();
00714 for ( int i = 0; i < j; i++) {
00715 data->Draw("dz*10000:phi",Cut+zCut[i]);
00716 gr_dzVphi_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00717 gr_dzVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
00718 gr_dzVphi_Array[i]->SetMarkerStyle(6);
00719 mgr_dzVphi->Add(gr_dzVphi_Array[i],"p");
00720 }
00721
00722 data->Project("h_rdphiVphi", "r*dphi*10000:phi",Cut);
00723 TGraph* gr_rdphiVphi_Array[j];
00724 TMultiGraph* mgr_rdphiVphi=new TMultiGraph();
00725 for ( int i = 0; i < j; i++) {
00726 data->Draw("r*dphi*10000:phi",Cut+zCut[i]);
00727 gr_rdphiVphi_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00728 gr_rdphiVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
00729 gr_rdphiVphi_Array[i]->SetMarkerStyle(6);
00730 mgr_rdphiVphi->Add(gr_rdphiVphi_Array[i],"p");
00731 }
00732
00733 data->Project("h_dxVphi", "dx*10000:phi",Cut);
00734 TGraph* gr_dxVphi_Array[j];
00735 TMultiGraph* mgr_dxVphi=new TMultiGraph();
00736 for ( int i = 0; i < j; i++) {
00737 data->Draw("dx*10000:phi",Cut+zCut[i]);
00738 gr_dxVphi_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00739 gr_dxVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
00740 gr_dxVphi_Array[i]->SetMarkerStyle(6);
00741 mgr_dxVphi->Add(gr_dxVphi_Array[i],"p");
00742 }
00743
00744 data->Project("h_dyVphi", "dy*10000:phi",Cut);
00745 TGraph* gr_dyVphi_Array[j];
00746 TMultiGraph* mgr_dyVphi=new TMultiGraph();
00747 for ( int i = 0; i < j; i++) {
00748 data->Draw("dy*10000:phi",Cut+zCut[i]);
00749 gr_dyVphi_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
00750 gr_dyVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
00751 gr_dyVphi_Array[i]->SetMarkerStyle(6);
00752 mgr_dyVphi->Add(gr_dyVphi_Array[i],"p");
00753 }
00754
00755
00756
00757
00758 TCanvas* c0 = new TCanvas("c0", "c0", 200, 10, 900, 300);
00759 c0->SetFillColor(0);
00760 c0->Divide(3,1);
00761 c0->cd(1);
00762 h_dr->Draw();
00763 c0->cd(2);
00764 h_dz->Draw();
00765 c0->cd(3);
00766 h_rdphi->Draw();
00767 if (savePlot) c0->Print((_outputDir+"plot3x1_"+plotName).c_str());
00768
00769
00770 mgr_drVr->SetTitle("#Delta r vs. r");
00771 mgr_dzVr->SetTitle("#Delta z vs. r");
00772 mgr_rdphiVr->SetTitle("r#Delta #phi vs. r");
00773 mgr_dxVr->SetTitle("#Delta x vs. r");
00774 mgr_dyVr->SetTitle("#Delta y vs. r");
00775 mgr_drVz->SetTitle("#Delta r vs. z");
00776 mgr_dzVz->SetTitle("#Delta z vs. z");
00777 mgr_rdphiVz->SetTitle("r#Delta #phi vs. z");
00778 mgr_dxVz->SetTitle("#Delta x vs. z");
00779 mgr_dyVz->SetTitle("#Delta y vs. z");
00780 mgr_drVphi->SetTitle("#Delta r vs. #phi");
00781 mgr_dzVphi->SetTitle("#Delta z vs. #phi");
00782 mgr_rdphiVphi->SetTitle("r#Delta #phi vs. #phi");
00783 mgr_dxVphi->SetTitle("#Delta x vs. #phi");
00784 mgr_dyVphi->SetTitle("#Delta y vs. #phi");
00785
00786
00787 TCanvas* c = new TCanvas("c", "c", 200, 10, 1200, 700);
00788 c->SetFillColor(0);
00789 data->SetMarkerSize(0.5);
00790 data->SetMarkerStyle(6);
00791 c->Divide(5,3);
00792 c->cd(1);
00793 if (!autolimits) h_drVr->Draw();
00794 if (autolimits) mgr_drVr->Draw("a");
00795 c->Update();
00796 c->cd(2);
00797 if (!autolimits) h_dzVr->Draw();
00798 if (autolimits) mgr_dzVr->Draw("a");
00799 c->Update();
00800 c->cd(3);
00801 if (!autolimits) h_rdphiVr->Draw();
00802 if (autolimits) mgr_rdphiVr->Draw("a");
00803 c->cd(4);
00804 if (!autolimits) h_dxVr->Draw();
00805 if (autolimits) mgr_dxVr->Draw("a");
00806 c->cd(5);
00807 if (!autolimits) h_dyVr->Draw();
00808 if (autolimits) mgr_dyVr->Draw("a");
00809 c->cd(6);
00810 if (!autolimits) h_drVz->Draw();
00811 if (autolimits) mgr_drVz->Draw("a");
00812 c->cd(7);
00813 if (!autolimits) h_dzVz->Draw();
00814 if (autolimits) mgr_dzVz->Draw("a");
00815 c->cd(8);
00816 if (!autolimits) h_rdphiVz->Draw();
00817 if (autolimits) mgr_rdphiVz->Draw("a");
00818 c->cd(9);
00819 if (!autolimits) h_dxVz->Draw();
00820 if (autolimits) mgr_dxVz->Draw("a");
00821 c->cd(10);
00822 if (!autolimits) h_dyVz->Draw();
00823 if (autolimits) mgr_dyVz->Draw("a");
00824 c->cd(11);
00825 if (!autolimits) h_drVphi->Draw();
00826 if (autolimits) mgr_drVphi->Draw("a");
00827 c->cd(12);
00828 if (!autolimits) h_dzVphi->Draw();
00829 if (autolimits) mgr_dzVphi->Draw("a");
00830 c->cd(13);
00831 if (!autolimits) h_rdphiVphi->Draw();
00832 if (autolimits) mgr_rdphiVphi->Draw("a");
00833 c->cd(14);
00834 if (!autolimits) h_dxVphi->Draw();
00835 if (autolimits) mgr_dxVphi->Draw("a");
00836 c->cd(15);
00837 if (!autolimits) h_dyVphi->Draw();
00838 if (autolimits) mgr_dyVphi->Draw("a");
00839
00840 mgr_drVr->GetXaxis()->SetTitle("r (cm)");
00841 mgr_dzVr->GetXaxis()->SetTitle("r (cm)");
00842 mgr_rdphiVr->GetXaxis()->SetTitle("r (cm)");
00843 mgr_dxVr->GetXaxis()->SetTitle("r (cm)");
00844 mgr_dyVr->GetXaxis()->SetTitle("r (cm)");
00845 mgr_drVz->GetXaxis()->SetTitle("z (cm)");
00846 mgr_dzVz->GetXaxis()->SetTitle("z (cm)");
00847 mgr_rdphiVz->GetXaxis()->SetTitle("z (cm)");
00848 mgr_dxVz->GetXaxis()->SetTitle("z (cm)");
00849 mgr_dyVz->GetXaxis()->SetTitle("z (cm)");
00850 mgr_drVphi->GetXaxis()->SetTitle("#phi");
00851 mgr_dzVphi->GetXaxis()->SetTitle("#phi");
00852 mgr_rdphiVphi->GetXaxis()->SetTitle("#phi");
00853 mgr_dxVphi->GetXaxis()->SetTitle("#phi");
00854 mgr_dyVphi->GetXaxis()->SetTitle("#phi");
00855
00856 mgr_drVr->GetYaxis()->SetTitle("#Delta r (#mum)");
00857 mgr_dzVr->GetYaxis()->SetTitle("#Delta z (#mum)");
00858 mgr_rdphiVr->GetYaxis()->SetTitle("r#Delta #phi (#mum)");
00859 mgr_dxVr->GetYaxis()->SetTitle("#Delta x (#mum)");
00860 mgr_dyVr->GetYaxis()->SetTitle("#Delta y (#mum)");
00861 mgr_drVz->GetYaxis()->SetTitle("#Delta r (#mum)");
00862 mgr_dzVz->GetYaxis()->SetTitle("#Delta z (#mum)");
00863 mgr_rdphiVz->GetYaxis()->SetTitle("r#Delta #phi (#mum)");
00864 mgr_dxVz->GetYaxis()->SetTitle("#Delta x (#mum)");
00865 mgr_dyVz->GetYaxis()->SetTitle("#Delta y (#mum)");
00866 mgr_drVphi->GetYaxis()->SetTitle("#Delta r (#mum)");
00867 mgr_dzVphi->GetYaxis()->SetTitle("#Delta z (#mum)");
00868 mgr_rdphiVphi->GetYaxis()->SetTitle("r#Delta #phi (#mum)");
00869 mgr_dxVphi->GetYaxis()->SetTitle("#Delta x (#mum)");
00870 mgr_dyVphi->GetYaxis()->SetTitle("#Delta y (#mum)");
00871
00872 mgr_drVr->GetYaxis()->SetTitleOffset(1.15);
00873 mgr_dzVr->GetYaxis()->SetTitleOffset(1.15);
00874 mgr_rdphiVr->GetYaxis()->SetTitleOffset(1.15);
00875 mgr_dxVr->GetYaxis()->SetTitleOffset(1.15);
00876 mgr_dyVr->GetYaxis()->SetTitleOffset(1.15);
00877 mgr_drVz->GetYaxis()->SetTitleOffset(1.15);
00878 mgr_dzVz->GetYaxis()->SetTitleOffset(1.15);
00879 mgr_rdphiVz->GetYaxis()->SetTitleOffset(1.15);
00880 mgr_dxVz->GetYaxis()->SetTitleOffset(1.15);
00881 mgr_dyVz->GetYaxis()->SetTitleOffset(1.15);
00882 mgr_drVphi->GetYaxis()->SetTitleOffset(1.15);
00883 mgr_dzVphi->GetYaxis()->SetTitleOffset(1.15);
00884 mgr_rdphiVphi->GetYaxis()->SetTitleOffset(1.15);
00885 mgr_dxVphi->GetYaxis()->SetTitleOffset(1.15);
00886 mgr_dyVphi->GetYaxis()->SetTitleOffset(1.15);
00887
00888 c->Update();
00889
00890
00891 plotDir->cd();
00892 h_dr->Write(); h_dz->Write(); h_rdphi->Write();
00893 h_drVr->Write(); h_dzVr->Write(); h_rdphiVr->Write(); h_dxVr->Write(); h_dyVr->Write();
00894 h_drVz->Write(); h_dzVz->Write(); h_rdphiVz->Write(); h_dxVz->Write(); h_dyVz->Write();
00895 h_drVphi->Write(); h_dzVphi->Write(); h_rdphiVphi->Write(); h_dxVphi->Write(); h_dyVphi->Write();
00896
00897 if (savePlot) c->Print((_outputDir+"plot3x5_"+plotName).c_str());
00898
00899 }
00900
00901 void comparisonPlots::plot3x5Profile(TCut Cut, char* dirName, int nBins, bool savePlot, std::string plotName, bool autolimits,int ColorCode ){
00902
00903
00904
00905
00906
00907
00908 gStyle->SetTitleFont(62);
00909 gStyle->SetOptTitle(0);
00910
00911 gStyle->SetFrameBorderMode(0);
00912 gStyle->SetCanvasBorderMode(0);
00913 gStyle->SetPadBorderMode(0);
00914 gStyle->SetPadColor(0);
00915 gStyle->SetCanvasColor(0);
00916 gStyle->SetTitleColor(1);
00917 gStyle->SetStatColor(0);
00918 gStyle->SetStatBorderSize(1);
00919 gStyle->SetFrameFillColor(0);
00920
00921 gStyle->SetTextFont(132);
00922 gStyle->SetTextSize(0.08);
00923 gStyle->SetLabelFont(132,"x");
00924 gStyle->SetLabelFont(132,"y");
00925 gStyle->SetLabelFont(132,"z");
00926 gStyle->SetTitleSize(0.08,"x");
00927 gStyle->SetTitleSize(0.08,"y");
00928 gStyle->SetTitleSize(0.08,"z");
00929 gStyle->SetLabelSize(0.08,"x");
00930 gStyle->SetLabelSize(0.08,"y");
00931 gStyle->SetLabelSize(0.08,"z");
00932
00933 gStyle->SetTitleAlign(22);
00934 gStyle->SetTitleX(0.5);
00935 gStyle->SetTitleY(0.97);
00936 gStyle->SetTitleFont(62);
00937
00938 gStyle->SetPadTickX(1);
00939 gStyle->SetPadTickY(1);
00940
00941 gStyle->SetPadTopMargin(0.1);
00942 gStyle->SetPadRightMargin(0.05);
00943 gStyle->SetPadBottomMargin(0.16);
00944 gStyle->SetPadLeftMargin(0.18);
00945
00946
00947
00948 string s;
00949 s = s + dirName;
00950 s.append("_profile");
00951 TDirectory* plotDir = output->mkdir( s.data() );
00952
00953
00954 int j = 2;
00955 TCut zCut[6];
00956 zCut[0] = "z < 0";
00957 zCut[1] = "z >= 0";
00958
00959
00960 if (ColorCode == 1) {
00961 j = 6;
00962
00963 zCut[0] = "sublevel==1";
00964 zCut[1] = "sublevel==2";
00965 zCut[2] = "sublevel==3";
00966 zCut[3] = "sublevel==4";
00967 zCut[4] = "sublevel==5";
00968 zCut[5] = "sublevel==6";
00969
00970 }
00971
00972 double minimumR, maximumR;
00973 double minimumZ, maximumZ;
00974 double minimumPhi, maximumPhi;
00975 double minimumDR, maximumDR;
00976 double minimumDZ, maximumDZ;
00977 double minimumRDPhi, maximumRDPhi;
00978 double minimumDX, maximumDX;
00979 double minimumDY, maximumDY;
00980 if (autolimits){
00981
00982 TH1F* phr = new TH1F("phr", "phr", 200, 0, 200 );
00983 TH1F* phz = new TH1F("phz", "phz", 400, -300, 300 );
00984 TH1F* phphi = new TH1F("phphi", "phphi", 200, -3.15, 3.15);
00985 TH1F* phdr = new TH1F("phdr", "phdr", 20000,-1000, 1000 );
00986 TH1F* phdz = new TH1F("phdz", "phdz", 20000,-1000, 1000 );
00987 TH1F* phrdphi = new TH1F("phrdphi", "phrdphi", 20000,-1000, 1000 );
00988 TH1F* phdx = new TH1F("phdx", "phy", 20000,-1000, 1000 );
00989 TH1F* phdy = new TH1F("phdy", "phy", 20000,-1000, 1000 );
00990 data->Project("phr","r",Cut);
00991 data->Project("phz","z",Cut);
00992 data->Project("phphi","phi",Cut);
00993 data->Project("phdr","dr*10000",Cut);
00994 data->Project("phdz","dz*10000",Cut);
00995 data->Project("phrdphi","r*dphi*10000",Cut );
00996 data->Project("phdx","dx*10000",Cut );
00997 data->Project("phdy","dy*10000",Cut );
00998 getHistMaxMin(phr, maximumR, minimumR, 0);
00999 getHistMaxMin(phz, maximumZ, minimumZ, 0);
01000 getHistMaxMin(phphi, maximumPhi, minimumPhi, 0);
01001 getHistMaxMin(phdr, maximumDR, minimumDR, 1);
01002 getHistMaxMin(phdz, maximumDZ, minimumDZ, 1);
01003 getHistMaxMin(phrdphi, maximumRDPhi, minimumRDPhi, 1);
01004 getHistMaxMin(phdx, maximumDX, minimumDX, 1);
01005 getHistMaxMin(phdy, maximumDY, minimumDY, 1);
01006 }
01007 else{
01008 minimumR = 0., maximumR = 200.;
01009 minimumZ = -300., maximumZ = 300.;
01010 minimumPhi = -3.15, maximumPhi = 3.15;
01011 minimumDR = -1, maximumDR = 1;
01012 minimumDZ = -1, maximumDZ = 1;
01013 minimumRDPhi = -1, maximumRDPhi = 1;
01014 minimumDX = -1, maximumDX = 1;
01015 minimumDY = -1, maximumDY = 1;
01016 }
01017
01018
01019 TProfile* hprof_drVr = new TProfile("hprof_drVr","#Delta r vs. r",nBins,minimumR,maximumR,minimumDR,maximumDR);
01020 TProfile* hprof_dzVr = new TProfile("hprof_dzVr","#Delta z vs. r",nBins,minimumR,maximumR,minimumDZ,maximumDZ);
01021 TProfile* hprof_rdphiVr = new TProfile("hprof_rdphiVr","r#Delta #phi vs. r",nBins,minimumR,maximumR,minimumRDPhi,maximumRDPhi);
01022 TProfile* hprof_dxVr = new TProfile("hprof_dxVr","#Delta x vs. r", nBins,minimumR,maximumR,minimumDX,maximumDX);
01023 TProfile* hprof_dyVr = new TProfile("hprof_dyVr","#Delta y vs. r", nBins,minimumR,maximumR,minimumDY,maximumDY);
01024 TProfile* hprof_drVz = new TProfile("hprof_drVz","#Delta r vs. z", nBins,minimumZ,maximumZ,minimumDR,maximumDR);
01025 TProfile* hprof_dzVz = new TProfile("hprof_dzVz","#Delta z vs. z", nBins,minimumZ,maximumZ,minimumDZ,maximumDZ);
01026 TProfile* hprof_rdphiVz = new TProfile("hprof_rdphiVz","r#Delta #phi vs. z", nBins,minimumZ,maximumZ,minimumRDPhi,maximumRDPhi);
01027 TProfile* hprof_dxVz = new TProfile("hprof_dxVz","#Delta x vs. z", nBins,minimumZ,maximumZ,minimumDX,maximumDX);
01028 TProfile* hprof_dyVz = new TProfile("hprof_dyVz","#Delta y vs. z", nBins,minimumZ,maximumZ,minimumDY,maximumDY);
01029 TProfile* hprof_drVphi = new TProfile("hprof_drVphi","#Delta r vs. #phi", nBins,minimumPhi,maximumPhi,minimumDR,maximumDR);
01030 TProfile* hprof_dzVphi = new TProfile("hprof_dzVphi","#Delta z vs. #phi", nBins,minimumPhi,maximumPhi,minimumDZ,maximumDZ);
01031 TProfile* hprof_rdphiVphi = new TProfile("hprof_rdphiVphi","r#Delta #phi vs. #phi", nBins,minimumPhi,maximumPhi,minimumRDPhi,maximumRDPhi);
01032 TProfile* hprof_dxVphi = new TProfile("hprof_dxVphi","#Delta x vs. #phi", nBins,minimumPhi,maximumPhi,minimumDX,maximumDX);
01033 TProfile* hprof_dyVphi = new TProfile("hprof_dyVphi","#Delta y vs. #phi", nBins,minimumPhi,maximumPhi,minimumDY,maximumDY);
01034
01035 TProfile* gr_drVr_Array[j];
01036 THStack* mgr_drVr=new THStack("mgr_drVr","");
01037
01038 for ( int i = 0; i < j; i++) {
01039 data->Draw("dr*10000:r>>hprof_drVr",Cut+zCut[i],"prof");
01040 if (hprof_drVr->GetEntries()>0){
01041 gr_drVr_Array[i] =(TProfile*)hprof_drVr->Clone() ;
01042 gr_drVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
01043 gr_drVr_Array[i]->SetLineColor(int(i/4)+i+1);
01044 mgr_drVr->Add(gr_drVr_Array[i]);
01045 }
01046 }
01047
01048
01049 if ( (mgr_drVr->GetMaximum("nostack")>0.0005*10000)||(mgr_drVr->GetMinimum("nostack")<-0.0005*10000) ){
01050 mgr_drVr->SetMaximum( 2.*mgr_drVr->GetMaximum("nostack") );
01051 mgr_drVr->SetMinimum( 2.*mgr_drVr->GetMinimum("nostack") );
01052 }
01053 else{
01054 mgr_drVr->SetMaximum(10.);
01055 mgr_drVr->SetMinimum( -10.);
01056 }
01057
01058
01059 TProfile* gr_dzVr_Array[j];
01060 THStack* mgr_dzVr=new THStack("mgr_dzVr","");
01061 for ( int i = 0; i < j; i++) {
01062 data->Draw("dz*10000:r>>hprof_dzVr",Cut+zCut[i],"prof");
01063 if (hprof_dzVr->GetEntries()>0){
01064 gr_dzVr_Array[i] =(TProfile*)hprof_dzVr->Clone() ;
01065 gr_dzVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
01066 gr_dzVr_Array[i]->SetLineColor(int(i/4)+i+1);
01067 mgr_dzVr->Add(gr_dzVr_Array[i]);
01068 }
01069 }
01070 if ( (mgr_dzVr->GetMaximum("nostack")>0.0005*10000)||(mgr_dzVr->GetMinimum("nostack")<-0.0005*10000) ){
01071 mgr_dzVr->SetMaximum( 2.*mgr_dzVr->GetMaximum("nostack") );
01072 mgr_dzVr->SetMinimum( 2.*mgr_dzVr->GetMinimum("nostack") );
01073 }
01074 else{
01075 mgr_dzVr->SetMaximum( 10.);
01076 mgr_dzVr->SetMinimum( -10.);
01077 }
01078
01079
01080 TProfile* gr_rdphiVr_Array[j];
01081 THStack* mgr_rdphiVr=new THStack();
01082 for ( int i = 0; i < j; i++) {
01083 data->Draw("r*dphi*10000:r>>hprof_rdphiVr",Cut+zCut[i],"prof");
01084 if (hprof_rdphiVr->GetEntries()>0){
01085 gr_rdphiVr_Array[i] = (TProfile*)hprof_rdphiVr->Clone() ;
01086 gr_rdphiVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
01087 gr_rdphiVr_Array[i]->SetLineColor(int(i/4)+i+1);
01088 mgr_rdphiVr->Add(gr_rdphiVr_Array[i]);
01089 }
01090 }
01091 if ( (mgr_rdphiVr->GetMaximum("nostack")>0.0005*10000)||(mgr_rdphiVr->GetMinimum("nostack")<-0.0005*10000) ){
01092 mgr_rdphiVr->SetMaximum( 2.*mgr_rdphiVr->GetMaximum("nostack") );
01093 mgr_rdphiVr->SetMinimum( 2.*mgr_rdphiVr->GetMinimum("nostack") );
01094 }
01095 else{
01096 mgr_rdphiVr->SetMaximum( 10.);
01097 mgr_rdphiVr->SetMinimum( -10.);
01098 }
01099
01100
01101 TProfile* gr_dxVr_Array[j];
01102 THStack* mgr_dxVr=new THStack();
01103 for ( int i = 0; i < j; i++) {
01104 data->Draw("dx*10000:r>>hprof_dxVr",Cut+zCut[i],"prof");
01105 if (hprof_dxVr->GetEntries()>0){
01106 gr_dxVr_Array[i] = (TProfile*)hprof_dxVr->Clone() ;
01107 gr_dxVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
01108 gr_dxVr_Array[i]->SetLineColor(int(i/4)+i+1);
01109 mgr_dxVr->Add(gr_dxVr_Array[i]);
01110 }
01111 }
01112 if ( (mgr_dxVr->GetMaximum("nostack")>0.0005*10000)||(mgr_dxVr->GetMinimum("nostack")<-0.0005*10000) ){
01113 mgr_dxVr->SetMaximum( 2.*mgr_dxVr->GetMaximum("nostack") );
01114 mgr_dxVr->SetMinimum( 2.*mgr_dxVr->GetMinimum("nostack") );
01115 }
01116 else{
01117 mgr_dxVr->SetMaximum( 10.);
01118 mgr_dxVr->SetMinimum( -10.);
01119 }
01120
01121
01122 TProfile* gr_dyVr_Array[j];
01123 THStack* mgr_dyVr=new THStack();
01124 for ( int i = 0; i < j; i++) {
01125 data->Draw("dy*1000:r>>hprof_dyVr",Cut+zCut[i],"prof");
01126 if (hprof_dyVr->GetEntries()>0){
01127 gr_dyVr_Array[i] = (TProfile*)hprof_dyVr->Clone() ;
01128 gr_dyVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
01129 gr_dyVr_Array[i]->SetLineColor(int(i/4)+i+1);
01130 mgr_dyVr->Add(gr_dyVr_Array[i]);
01131 }
01132 }
01133 if ( (mgr_dyVr->GetMaximum("nostack")>0.0005*10000)||(mgr_dyVr->GetMinimum("nostack")<-0.0005*10000) ){
01134 mgr_dyVr->SetMaximum( 2.*mgr_dyVr->GetMaximum("nostack") );
01135 mgr_dyVr->SetMinimum( 2.*mgr_dyVr->GetMinimum("nostack") );
01136 }
01137 else{
01138 mgr_dyVr->SetMaximum( 10.);
01139 mgr_dyVr->SetMinimum( -10.);
01140 }
01141
01142
01143 TProfile* gr_drVz_Array[j];
01144 THStack* mgr_drVz=new THStack();
01145 for ( int i = 0; i < j; i++) {
01146 data->Draw("dr*10000:z>>hprof_drVz",Cut+zCut[i],"prof");
01147 if (hprof_drVz->GetEntries()>0){
01148 gr_drVz_Array[i] = (TProfile*)hprof_drVz->Clone() ;
01149 gr_drVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
01150 gr_drVz_Array[i]->SetLineColor(int(i/4)+i+1);
01151 mgr_drVz->Add(gr_drVz_Array[i]);
01152 }
01153 }
01154 if ( (mgr_drVz->GetMaximum("nostack")>0.0005*10000)||(mgr_drVz->GetMinimum("nostack")<-0.0005*10000) ){
01155 mgr_drVz->SetMaximum( 2.*mgr_drVz->GetMaximum("nostack") );
01156 mgr_drVz->SetMinimum( 2.*mgr_drVz->GetMinimum("nostack") );
01157 }
01158 else{
01159 mgr_drVz->SetMaximum( 10.);
01160 mgr_drVz->SetMinimum( -10.);
01161 }
01162
01163
01164 TProfile* gr_dzVz_Array[j];
01165 THStack* mgr_dzVz=new THStack();
01166 for ( int i = 0; i < j; i++) {
01167 data->Draw("dz*10000:z>>hprof_dzVz",Cut+zCut[i],"prof");
01168 if (hprof_dzVz->GetEntries()>0){
01169 gr_dzVz_Array[i] = (TProfile*)hprof_dzVz->Clone() ;
01170 gr_dzVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
01171 gr_dzVz_Array[i]->SetLineColor(int(i/4)+i+1);
01172 mgr_dzVz->Add(gr_dzVz_Array[i]);
01173 }
01174 }
01175 if ( (mgr_dzVz->GetMaximum("nostack")>0.0005*10000)||(mgr_dzVz->GetMinimum("nostack")<-0.0005*10000) ){
01176 mgr_dzVz->SetMaximum( 2.*mgr_dzVz->GetMaximum("nostack") );
01177 mgr_dzVz->SetMinimum( 2.*mgr_dzVz->GetMinimum("nostack") );
01178 }
01179 else{
01180 mgr_dzVz->SetMaximum( 10.);
01181 mgr_dzVz->SetMinimum( -10.);
01182 }
01183
01184
01185 TProfile* gr_rdphiVz_Array[j];
01186 THStack* mgr_rdphiVz=new THStack();
01187 for ( int i = 0; i < j; i++) {
01188 data->Draw("r*dphi*10000:z>>hprof_rdphiVz",Cut+zCut[i],"prof");
01189 if (hprof_rdphiVz->GetEntries()>0){
01190 gr_rdphiVz_Array[i] = (TProfile*)hprof_rdphiVz->Clone() ;
01191 gr_rdphiVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
01192 gr_rdphiVz_Array[i]->SetLineColor(int(i/4)+i+1);
01193 mgr_rdphiVz->Add(gr_rdphiVz_Array[i]);
01194 }
01195 }
01196 if ( (mgr_rdphiVz->GetMaximum("nostack")>0.0005*10000)||(mgr_rdphiVz->GetMinimum("nostack")<-0.0005*10000) ){
01197 mgr_rdphiVz->SetMaximum( 2.*mgr_rdphiVz->GetMaximum("nostack") );
01198 mgr_rdphiVz->SetMinimum( 2.*mgr_rdphiVz->GetMinimum("nostack") );
01199 }
01200 else{
01201 mgr_rdphiVz->SetMaximum( 10.);
01202 mgr_rdphiVz->SetMinimum( -10.);
01203 }
01204
01205
01206 TProfile* gr_dxVz_Array[j];
01207 THStack* mgr_dxVz=new THStack();
01208 for ( int i = 0; i < j; i++) {
01209 data->Draw("dx*10000:z>>hprof_dxVz",Cut+zCut[i],"prof");
01210 if (hprof_dxVz->GetEntries()>0){
01211 gr_dxVz_Array[i] = (TProfile*)hprof_dxVz->Clone() ;
01212 gr_dxVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
01213 gr_dxVz_Array[i]->SetLineColor(int(i/4)+i+1);
01214 mgr_dxVz->Add(gr_dxVz_Array[i]);
01215 }
01216 }
01217 if ( (mgr_dxVz->GetMaximum("nostack")>0.0005*10000)||(mgr_dxVz->GetMinimum("nostack")<-0.0005*10000) ){
01218 mgr_dxVz->SetMaximum( 2.*mgr_dxVz->GetMaximum("nostack") );
01219 mgr_dxVz->SetMinimum( 2.*mgr_dxVz->GetMinimum("nostack") );
01220 }
01221 else{
01222 mgr_dxVz->SetMaximum( 10.);
01223 mgr_dxVz->SetMinimum( -10.);
01224 }
01225
01226
01227 TProfile* gr_dyVz_Array[j];
01228 THStack* mgr_dyVz=new THStack();
01229 for ( int i = 0; i < j; i++) {
01230 data->Draw("dy*10000:z>>hprof_dyVz",Cut+zCut[i],"prof");
01231 if (hprof_dyVz->GetEntries()>0){
01232 gr_dyVz_Array[i] = (TProfile*)hprof_dyVz->Clone() ;
01233 gr_dyVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
01234 gr_dyVz_Array[i]->SetLineColor(int(i/4)+i+1);
01235 mgr_dyVz->Add(gr_dyVz_Array[i],"p");
01236 }
01237 }
01238 if ( (mgr_dyVz->GetMaximum("nostack")>0.0005*10000)||(mgr_dyVz->GetMinimum("nostack")<-0.0005*10000) ){
01239 mgr_dyVz->SetMaximum( 2.*mgr_dyVz->GetMaximum("nostack") );
01240 mgr_dyVz->SetMinimum( 2.*mgr_dyVz->GetMinimum("nostack") );
01241 }
01242 else{
01243 mgr_dyVz->SetMaximum( 10.);
01244 mgr_dyVz->SetMinimum( -10.);
01245 }
01246
01247
01248 TProfile* gr_drVphi_Array[j];
01249 THStack* mgr_drVphi=new THStack();
01250 for ( int i = 0; i < j; i++) {
01251 data->Draw("dr*10000:phi>>hprof_drVphi",Cut+zCut[i],"prof");
01252 if (hprof_drVphi->GetEntries()>0){
01253 gr_drVphi_Array[i] = (TProfile*)hprof_drVphi->Clone() ;
01254 gr_drVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
01255 gr_drVphi_Array[i]->SetLineColor(int(i/4)+i+1);
01256 mgr_drVphi->Add(gr_drVphi_Array[i],"p");
01257 }
01258 }
01259 if ( (mgr_drVphi->GetMaximum("nostack")>0.0005*10000)||(mgr_drVphi->GetMinimum("nostack")<-0.0005*10000) ){
01260 mgr_drVphi->SetMaximum( 2.*mgr_drVphi->GetMaximum("nostack") );
01261 mgr_drVphi->SetMinimum( 2.*mgr_drVphi->GetMinimum("nostack") );
01262 }
01263 else{
01264 mgr_drVphi->SetMaximum( 10.);
01265 mgr_drVphi->SetMinimum( -10.);
01266 }
01267
01268
01269 TProfile* gr_dzVphi_Array[j];
01270 THStack* mgr_dzVphi=new THStack();
01271 for ( int i = 0; i < j; i++) {
01272 data->Draw("dz*10000:phi>>hprof_dzVphi",Cut+zCut[i],"prof");
01273 if (hprof_dzVphi->GetEntries()>0){
01274 gr_dzVphi_Array[i] = (TProfile*)hprof_dzVphi->Clone() ;
01275 gr_dzVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
01276 gr_dzVphi_Array[i]->SetLineColor(int(i/4)+i+1);
01277 mgr_dzVphi->Add(gr_dzVphi_Array[i],"p");
01278 }
01279 }
01280 if ( (mgr_dzVphi->GetMaximum("nostack")>0.0005*10000)||(mgr_dzVphi->GetMinimum("nostack")<-0.0005*10000) ){
01281 mgr_dzVphi->SetMaximum( 2.*mgr_dzVphi->GetMaximum("nostack") );
01282 mgr_dzVphi->SetMinimum( 2.*mgr_dzVphi->GetMinimum("nostack") );
01283 }
01284 else{
01285 mgr_dzVphi->SetMaximum( 10.);
01286 mgr_dzVphi->SetMinimum( -10.);
01287 }
01288
01289
01290 TProfile* gr_rdphiVphi_Array[j];
01291 THStack* mgr_rdphiVphi=new THStack();
01292 for ( int i = 0; i < j; i++) {
01293 data->Draw("r*dphi*10000:phi>>hprof_rdphiVphi",Cut+zCut[i],"prof");
01294 if (hprof_rdphiVphi->GetEntries()>0){
01295 gr_rdphiVphi_Array[i] = (TProfile*)hprof_rdphiVphi->Clone() ;
01296 gr_rdphiVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
01297 gr_rdphiVphi_Array[i]->SetLineColor(int(i/4)+i+1);
01298 mgr_rdphiVphi->Add(gr_rdphiVphi_Array[i],"p");
01299 }
01300 }
01301 if ( (mgr_rdphiVphi->GetMaximum("nostack")>0.0005*10000)||(mgr_rdphiVphi->GetMinimum("nostack")<-0.0005*10000) ){
01302 mgr_rdphiVphi->SetMaximum( 2.*mgr_rdphiVphi->GetMaximum("nostack") );
01303 mgr_rdphiVphi->SetMinimum( 2.*mgr_rdphiVphi->GetMinimum("nostack") );
01304 }
01305 else{
01306 mgr_rdphiVphi->SetMaximum( 10.);
01307 mgr_rdphiVphi->SetMinimum( -10.);
01308 }
01309
01310
01311 TProfile* gr_dxVphi_Array[j];
01312 THStack* mgr_dxVphi=new THStack();
01313 for ( int i = 0; i < j; i++) {
01314 data->Draw("dx*10000:phi>>hprof_dxVphi",Cut+zCut[i],"prof");
01315 if (hprof_dxVphi->GetEntries()>0){
01316 gr_dxVphi_Array[i] = (TProfile*)hprof_dxVphi->Clone() ;
01317 gr_dxVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
01318 gr_dxVphi_Array[i]->SetLineColor(int(i/4)+i+1);
01319 mgr_dxVphi->Add(gr_dxVphi_Array[i],"p");
01320 }
01321 }
01322 if ( (mgr_dxVphi->GetMaximum("nostack")>0.0005*10000)||(mgr_dxVphi->GetMinimum("nostack")<-0.0005*10000) ){
01323 mgr_dxVphi->SetMaximum( 2.*mgr_dxVphi->GetMaximum("nostack") );
01324 mgr_dxVphi->SetMinimum( 2.*mgr_dxVphi->GetMinimum("nostack") );
01325 }
01326 else{
01327 mgr_dxVphi->SetMaximum( 10.);
01328 mgr_dxVphi->SetMinimum( -10.);
01329 }
01330
01331
01332 TProfile* gr_dyVphi_Array[j];
01333 THStack* mgr_dyVphi=new THStack();
01334 for ( int i = 0; i < j; i++) {
01335 data->Draw("dy*10000:phi>>hprof_dyVphi",Cut+zCut[i],"prof");
01336 if (hprof_dyVphi->GetEntries()>0){
01337 gr_dyVphi_Array[i] = (TProfile*)hprof_dyVphi->Clone() ;
01338 gr_dyVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
01339 gr_dyVphi_Array[i]->SetLineColor(int(i/4)+i+1);
01340 mgr_dyVphi->Add(gr_dyVphi_Array[i],"p");
01341 }
01342 }
01343 if ( (mgr_dyVphi->GetMaximum("nostack")>0.0005*10000)||(mgr_dyVphi->GetMinimum("nostack")<-0.0005*10000) ){
01344 mgr_dyVphi->SetMaximum( 2.*mgr_dyVphi->GetMaximum("nostack") );
01345 mgr_dyVphi->SetMinimum( 2.*mgr_dyVphi->GetMinimum("nostack") );
01346 }
01347 else{
01348 mgr_dyVphi->SetMaximum( 10.);
01349 mgr_dyVphi->SetMinimum( -10.);
01350 }
01351
01352 mgr_drVr->SetTitle("#Delta r vs. r");
01353 mgr_dzVr->SetTitle("#Delta z vs. r");
01354 mgr_rdphiVr->SetTitle("r#Delta #phi vs. r");
01355 mgr_dxVr->SetTitle("#Delta x vs. r");
01356 mgr_dyVr->SetTitle("#Delta y vs. r");
01357 mgr_drVz->SetTitle("#Delta r vs. z");
01358 mgr_dzVz->SetTitle("#Delta z vs. z");
01359 mgr_rdphiVz->SetTitle("r#Delta #phi vs. z");
01360 mgr_dxVz->SetTitle("#Delta x vs. z");
01361 mgr_dyVz->SetTitle("#Delta y vs. z");
01362 mgr_drVphi->SetTitle("#Delta r vs. #phi");
01363 mgr_dzVphi->SetTitle("#Delta z vs. #phi");
01364 mgr_rdphiVphi->SetTitle("r#Delta #phi vs. #phi");
01365 mgr_dxVphi->SetTitle("#Delta x vs. #phi");
01366 mgr_dyVphi->SetTitle("#Delta y vs. #phi");
01367
01368
01369 TCanvas* c = new TCanvas("c", "c", 200, 10, 1200, 700);
01370 c->SetFillColor(0);
01371 data->SetMarkerSize(0.5);
01372 data->SetMarkerStyle(6);
01373 c->Divide(5,3);
01374 c->cd(1);
01375 if (!autolimits) mgr_drVr->Draw("nostack");
01376 if (autolimits) mgr_drVr->Draw("nostack");
01377 c->Update();
01378 c->cd(2);
01379 if (!autolimits) mgr_dzVr->Draw("nostack");
01380 if (autolimits) mgr_dzVr->Draw("nostack");
01381 c->Update();
01382 c->cd(3);
01383 if (!autolimits) mgr_rdphiVr->Draw("nostack");
01384 if (autolimits) mgr_rdphiVr->Draw("nostack");
01385 c->cd(4);
01386 if (!autolimits) mgr_dxVr->Draw("nostack");
01387 if (autolimits) mgr_dxVr->Draw("nostack");
01388 c->cd(5);
01389 if (!autolimits) mgr_dyVr->Draw("nostack");
01390 if (autolimits) mgr_dyVr->Draw("nostack");
01391 c->cd(6);
01392 if (!autolimits) mgr_drVz->Draw("nostack");
01393 if (autolimits) mgr_drVz->Draw("nostack");
01394 c->cd(7);
01395 if (!autolimits) mgr_dzVz->Draw("nostack");
01396 if (autolimits) mgr_dzVz->Draw("nostack");
01397 c->cd(8);
01398 if (!autolimits) mgr_rdphiVz->Draw("nostack");
01399 if (autolimits) mgr_rdphiVz->Draw("nostack");
01400 c->cd(9);
01401 if (!autolimits) mgr_dxVz->Draw("nostack");
01402 if (autolimits) mgr_dxVz->Draw("nostack");
01403 c->cd(10);
01404 if (!autolimits) mgr_dyVz->Draw("nostack");
01405 if (autolimits) mgr_dyVz->Draw("nostack");
01406 c->cd(11);
01407 if (!autolimits) mgr_drVphi->Draw("nostack");
01408 if (autolimits) mgr_drVphi->Draw("nostack");
01409 c->cd(12);
01410 if (!autolimits) mgr_dzVphi->Draw("nostack");
01411 if (autolimits) mgr_dzVphi->Draw("nostack");
01412 c->cd(13);
01413 if (!autolimits) mgr_rdphiVphi->Draw("nostack");
01414 if (autolimits) mgr_rdphiVphi->Draw("nostack");
01415 c->cd(14);
01416 if (!autolimits) mgr_dxVphi->Draw("nostack");
01417 if (autolimits) mgr_dxVphi->Draw("nostack");
01418 c->cd(15);
01419 if (!autolimits) mgr_dyVphi->Draw("nostack");
01420 if (autolimits) mgr_dyVphi->Draw("nostack");
01421
01422 mgr_drVr->GetXaxis()->SetTitle("r (cm)");
01423 mgr_dzVr->GetXaxis()->SetTitle("r (cm)");
01424 mgr_rdphiVr->GetXaxis()->SetTitle("r (cm)");
01425 mgr_dxVr->GetXaxis()->SetTitle("r (cm)");
01426 mgr_dyVr->GetXaxis()->SetTitle("r (cm)");
01427 mgr_drVz->GetXaxis()->SetTitle("z (cm)");
01428 mgr_dzVz->GetXaxis()->SetTitle("z (cm)");
01429 mgr_rdphiVz->GetXaxis()->SetTitle("z (cm)");
01430 mgr_dxVz->GetXaxis()->SetTitle("z (cm)");
01431 mgr_dyVz->GetXaxis()->SetTitle("z (cm)");
01432 mgr_drVphi->GetXaxis()->SetTitle("#phi");
01433 mgr_dzVphi->GetXaxis()->SetTitle("#phi");
01434 mgr_rdphiVphi->GetXaxis()->SetTitle("#phi");
01435 mgr_dxVphi->GetXaxis()->SetTitle("#phi");
01436 mgr_dyVphi->GetXaxis()->SetTitle("#phi");
01437
01438 mgr_drVr->GetYaxis()->SetTitle("#Delta r (#mum)");
01439 mgr_dzVr->GetYaxis()->SetTitle("#Delta z (#mum)");
01440 mgr_rdphiVr->GetYaxis()->SetTitle("r#Delta #phi (#mum)");
01441 mgr_dxVr->GetYaxis()->SetTitle("#Delta x (#mum)");
01442 mgr_dyVr->GetYaxis()->SetTitle("#Delta y (#mum)");
01443 mgr_drVz->GetYaxis()->SetTitle("#Delta r (#mum)");
01444 mgr_dzVz->GetYaxis()->SetTitle("#Delta z (#mum)");
01445 mgr_rdphiVz->GetYaxis()->SetTitle("r#Delta #phi (#mum)");
01446 mgr_dxVz->GetYaxis()->SetTitle("#Delta x (#mum)");
01447 mgr_dyVz->GetYaxis()->SetTitle("#Delta y (#mum)");
01448 mgr_drVphi->GetYaxis()->SetTitle("#Delta r (#mum)");
01449 mgr_dzVphi->GetYaxis()->SetTitle("#Delta z (#mum)");
01450 mgr_rdphiVphi->GetYaxis()->SetTitle("r#Delta #phi (#mum)");
01451 mgr_dxVphi->GetYaxis()->SetTitle("#Delta x (#mum)");
01452 mgr_dyVphi->GetYaxis()->SetTitle("#Delta y (#mum)");
01453
01454 mgr_drVr->GetYaxis()->SetTitleOffset(1.15);
01455 mgr_dzVr->GetYaxis()->SetTitleOffset(1.15);
01456 mgr_rdphiVr->GetYaxis()->SetTitleOffset(1.15);
01457 mgr_dxVr->GetYaxis()->SetTitleOffset(1.15);
01458 mgr_dyVr->GetYaxis()->SetTitleOffset(1.15);
01459 mgr_drVz->GetYaxis()->SetTitleOffset(1.15);
01460 mgr_dzVz->GetYaxis()->SetTitleOffset(1.15);
01461 mgr_rdphiVz->GetYaxis()->SetTitleOffset(1.15);
01462 mgr_dxVz->GetYaxis()->SetTitleOffset(1.15);
01463 mgr_dyVz->GetYaxis()->SetTitleOffset(1.15);
01464 mgr_drVphi->GetYaxis()->SetTitleOffset(1.15);
01465 mgr_dzVphi->GetYaxis()->SetTitleOffset(1.15);
01466 mgr_rdphiVphi->GetYaxis()->SetTitleOffset(1.15);
01467 mgr_dxVphi->GetYaxis()->SetTitleOffset(1.15);
01468 mgr_dyVphi->GetYaxis()->SetTitleOffset(1.15);
01469
01470 c->Update();
01471
01472
01473 plotDir->cd();
01474
01475 hprof_drVr->Write(); hprof_dzVr->Write(); hprof_rdphiVr->Write(); hprof_dxVr->Write(); hprof_dyVr->Write();
01476 hprof_drVz->Write(); hprof_dzVz->Write(); hprof_rdphiVz->Write(); hprof_dxVz->Write(); hprof_dyVz->Write();
01477 hprof_drVphi->Write(); hprof_dzVphi->Write(); hprof_rdphiVphi->Write(); hprof_dxVphi->Write(); hprof_dyVphi->Write();
01478
01479
01480
01481
01482
01483
01484
01485
01486
01487
01488
01489
01490
01491
01492
01493
01494
01495
01496
01497
01498
01499
01500
01501
01502
01503
01504
01505
01506
01507
01508
01509
01510
01511
01512
01513
01514
01515
01516
01517
01518
01519
01520
01521
01522
01523
01524
01525
01526
01527
01528
01529
01530
01531
01532
01533
01534
01535
01536
01537
01538
01539
01540 if (savePlot) c->Print((_outputDir+"plot3x5Prof_"+plotName).c_str());
01541 }
01542
01543
01544 void comparisonPlots::getMaxMin(){
01545
01546 data->GetEntry(0);
01547 minR = r_; maxR = r_;
01548 minZ = z_; maxZ = z_;
01549 minPhi = phi_; maxPhi = phi_;
01550 minDR = dr_; maxDR = dr_;
01551 minDZ = dz_; maxDZ = dz_;
01552 minRDPhi = r_*dphi_; maxRDPhi = r_*dphi_;
01553 minDX = dx_; maxDX = dx_;
01554 minDY = dy_; maxDY = dy_;
01555
01556 int nEntries = data->GetEntries();
01557 for (int i = 1; i < nEntries; ++i){
01558 data->GetEntry(i);
01559
01560 if (r_ < minR) minR = r_;
01561 if (r_ > maxR) maxR = r_;
01562 if (z_ < minZ) minZ = z_;
01563 if (z_ > maxZ) maxZ = z_;
01564 if (phi_ < minPhi) minPhi = phi_;
01565 if (phi_ > maxPhi) maxPhi = phi_;
01566 if (dr_ < minDR) minDR = dr_;
01567 if (dr_ > maxDR) maxDR = dr_;
01568 if (dz_ < minDZ) minDZ = dz_;
01569 if (dz_ > maxDZ) maxDZ = dz_;
01570 if (r_*dphi_ < minRDPhi) minRDPhi = r_*dphi_;
01571 if (r_*dphi_ > maxRDPhi) maxRDPhi = r_*dphi_;
01572 if (dx_ < minDX) minDX = dx_;
01573 if (dx_ > maxDX) maxDX = dx_;
01574 if (dy_ < minDY) minDY = dy_;
01575 if (dy_ > maxDY) maxDY = dy_;
01576 }
01577 }
01578
01579
01580 void comparisonPlots::getHistMaxMin(TH1* hist, double &max, double &min, int flag){
01581
01582 int nBins = hist->GetNbinsX();
01583 for (int i = 0; i < nBins; ++i){
01584 double binContent = hist->GetBinContent(i);
01585 if (binContent > 0){
01586
01587
01588 if (flag == 0) max = hist->GetBinLowEdge(i) + 2.*hist->GetBinWidth(i) + 0.1*hist->GetBinLowEdge(i);
01589 if (flag == 1) max = hist->GetBinLowEdge(i) + hist->GetBinWidth(i) + 0.1*hist->GetBinLowEdge(i);
01590 }
01591 }
01592 for (int i = (nBins-1); i >= 0; i--){
01593 double binContent = hist->GetBinContent(i);
01594 if (binContent > 0) min = hist->GetBinLowEdge(i) - 0.1*hist->GetBinLowEdge(i);
01595 }
01596
01597 }
01598
01599 void comparisonPlots::Write()
01600 {
01601 output->Write();
01602 }
01603
01604