Back to home page

Project CMSSW displayed by LXR

 
 

    


Warning, /Validation/DTRecHits/test/plotHitReso.r is written in an unsupported language. File is not indexed.

0001 
0002 /*
0003  * Format plots of resolutions, etc. produced by DTRecHits validation.
0004  * The root tree containing the histograms must be already open when 
0005  * executing this macro.
0006  * 
0007  * G. Cerminara 2004
0008  */
0009 
0010 // class hRHit;
0011 class HRes1DHit;
0012 class HRes2DHit;
0013 class HRes4DHit;
0014 
0015 void plotHitReso();
0016 void plotWWWHitReso(TString dirBase, int dimSwitch = 1, TString nameDir = "");
0017 void drawReso(bool do1DRecHit, bool do2DRecHit, bool do2DSLPhiRecHit, bool do4DRecHit, bool ThreeIn1, int form);
0018 void plot1DResiduals(HRes1DHit * h1, HRes1DHit * h2, HRes1DHit * h3, bool ThreeIn1);
0019 void plot2DResiduals(HRes2DHit * h1);
0020 
0021 void plot4DResiduals(HRes4DHit * h1);
0022 void plot4DResVsEta(HRes4DHit * h1);
0023 void plot4DResVsPhi(HRes4DHit * h1);
0024 
0025 void plot2DAngles(HRes2DHit * h1, bool ThreeIn1);
0026 void plot4DAngles(HRes4DHit * h1, bool ThreeIn1);
0027 
0028 // Read user input
0029 bool setPreferences(bool& do1DRecHit, bool& do2DRecHit, bool& do2DSLPhiRecHit, bool& do4DRecHit, bool& ThreeIn1);
0030 // 
0031 
0032 
0033 
0034 
0035 // This is the main function
0036 void plotHitReso(){
0037   // Load needed macros and files
0038   gROOT->LoadMacro("macros.C");     // Load service macros
0039   gROOT->LoadMacro("Histograms.h"); // Load definition of histograms
0040 
0041   // Get the style
0042   TStyle * style = getStyle("tdr");
0043   /// TStyle * style = getStyle();
0044 
0045   //Main switches
0046   bool do1DRecHit = false; 
0047   bool do2DRecHit = false; 
0048   bool do2DSLPhiRecHit = false; 
0049   bool do4DRecHit = false; 
0050   bool ThreeIn1 = false;  // Plot the 3 steps in a single canvas (where appl.)
0051 
0052   //--------------------------------------------------------------------------------------
0053   //-------------------- Set your preferences here ---------------------------------------
0054 
0055   // Read user input, namely what plots should be produced
0056 
0057   while(!setPreferences(do1DRecHit, do2DRecHit, do2DSLPhiRecHit, do4DRecHit, ThreeIn1));
0058   //   do1DRecHit = true; 
0059   //   do2DRecHit = true; 
0060   //   do4DRecHit = true; 
0061 
0062 
0063   int form = 2;          // Form factor of the canvases (where applicable)
0064   //       1. For rectangular shape
0065   //       2. For squared shape
0066 
0067 
0068   // Style options
0069   //  style->SetOptStat("OURMEN");
0070   // style->SetOptStat("RME");
0071   style->SetOptStat(0);
0072   style->SetFitFormat("5.3g");
0073   style->SetOptFit(11);
0074 
0075   //--------------------------------------------------------------------------------------
0076 
0077   // Check the choice
0078   if(!do1DRecHit && !do2DRecHit && !do2DSLPhiRecHit && !do4DRecHit) {
0079     cout << "[plotHitReso]***Error: Nothing to do! Set do1DRecHit, do2DRecHit, do4DRecHit correctly!"
0080       << endl;
0081     return;
0082   }
0083   style->cd();                      // Apply style 
0084 
0085   drawReso(do1DRecHit, do2DRecHit, do2DSLPhiRecHit, do4DRecHit, ThreeIn1, form);
0086 
0087 }
0088 
0089 void plotWWWHitReso(TString dirBase, int dimSwitch, TString nameDir) {
0090   // Load needed macros and files
0091   gROOT->LoadMacro("macros.C");     // Load service macros
0092   gROOT->LoadMacro("Histograms.h"); // Load definition of histograms
0093 
0094   // Get the style
0095   TStyle * style = getStyle();
0096 
0097   //Main switches
0098   bool do1DRecHit = false; 
0099   bool do2DRecHit = false; 
0100   bool do2DSLPhiRecHit = false; 
0101   bool do4DRecHit = false; 
0102 
0103   if(dimSwitch == 1) {
0104     do1DRecHit = true;
0105   } else if(dimSwitch == 2) {
0106     do2DRecHit = true;
0107   } else if(dimSwitch == 3) {
0108     do2DSLPhiRecHit = true;
0109   } else if(dimSwitch == 4) {
0110     do4DRecHit = true;
0111   } else {
0112     cout << "Not a valid option!" << endl;
0113     return;
0114   }
0115 
0116 
0117 
0118   bool ThreeIn1 = false;  // Plot the 3 steps in a single canvas (where appl.)
0119 
0120   int form = 2;          // Form factor of the canvases (where applicable)
0121   //       1. For rectangular shape
0122   //       2. For squared shape
0123 
0124 
0125   // Style options
0126   //  style->SetOptStat("OURMEN");
0127   style->SetOptStat("RME");
0128   style->SetOptFit(101);
0129 
0130   //--------------------------------------------------------------------------------------
0131 
0132   // Check the choice
0133   if(!do1DRecHit && !do2DRecHit && !do2DSLPhiRecHit && !do4DRecHit) {
0134     cout << "[plotHitReso]***Error: Nothing to do! Set do1DRecHit, do2DRecHit, do4DRecHit correctly!"
0135       << endl;
0136     return;
0137   }
0138   style->cd();                      // Apply style 
0139 
0140 
0141   drawReso(do1DRecHit, do2DRecHit, do2DSLPhiRecHit, do4DRecHit, ThreeIn1, form);
0142   TString nameS;
0143   if(nameDir == "") {
0144     cout << "Set the name of the www directory: " << endl;
0145     cin >> nameS;
0146   } else {
0147     nameS = nameDir;
0148   }
0149   TString pwd = gSystem->WorkingDirectory();
0150   gSystem->MakeDirectory(dirBase+nameS);
0151   gSystem->ChangeDirectory(dirBase+nameS);
0152 
0153 
0154   printCanvases(".gif");
0155   gSystem->ChangeDirectory(pwd.Data());
0156 
0157 }
0158 
0159 
0160 void drawReso(bool do1DRecHit, bool do2DRecHit, bool do2DSLPhiRecHit, bool do4DRecHit, bool ThreeIn1, int form) {
0161   // Retrieve histogram sets
0162   TFile *f = gROOT->GetListOfFiles()->Last();
0163   cout << "Loading file: " << f->GetName() << endl;
0164 
0165   HRes1DHit *h1RPhi = 0;
0166   HRes1DHit *h2RPhi = 0;
0167   HRes1DHit *h3RPhi = 0;
0168                   
0169   HRes1DHit *h1RZ= 0;
0170   HRes1DHit *h2RZ = 0;
0171   HRes1DHit *h3RZ = 0;
0172                   
0173   HRes1DHit *h1RZ_W0= 0;
0174   HRes1DHit *h2RZ_W0= 0;
0175   HRes1DHit *h3RZ_W0= 0;
0176                   
0177   HRes1DHit *h1RZ_W1= 0;
0178   HRes1DHit *h2RZ_W1= 0;
0179   HRes1DHit *h3RZ_W1= 0;
0180                   
0181   HRes1DHit *h1RZ_W2= 0;
0182   HRes1DHit *h2RZ_W2= 0;
0183   HRes1DHit *h3RZ_W2= 0;
0184 
0185   HRes1DHit *h1RPhi_W0= 0;
0186   HRes1DHit *h2RPhi_W0= 0;
0187   HRes1DHit *h3RPhi_W0= 0;
0188                   
0189   HRes1DHit *h1RPhi_W1= 0;
0190   HRes1DHit *h2RPhi_W1= 0;
0191   HRes1DHit *h3RPhi_W1= 0;
0192                   
0193   HRes1DHit *h1RPhi_W2= 0;
0194   HRes1DHit *h2RPhi_W2= 0;
0195   HRes1DHit *h3RPhi_W2= 0;
0196 
0197 
0198   if(do1DRecHit) {
0199     h1RPhi = new HRes1DHit("S1RPhi",f);     // RecHits, 1. step, RPhi
0200     h2RPhi = new HRes1DHit("S2RPhi",f);     // RecHits, 2. step, RPhi
0201     h3RPhi = new HRes1DHit("S3RPhi",f);     // RecHits, 3. step, RPhi
0202 
0203     h1RZ = new HRes1DHit("S1RZ",f);         // RecHits, 1. step, RZ
0204     h2RZ = new HRes1DHit("S2RZ",f);         // RecHits, 2. step, RZ
0205     h3RZ = new HRes1DHit("S3RZ",f);         // RecHits, 3. step, RZ
0206 
0207     h1RZ_W0 = new HRes1DHit("S1RZ_W0",f);   // RecHits, 1. step, RZ, wheel 0
0208     h2RZ_W0 = new HRes1DHit("S2RZ_W0",f);   // RecHits, 2. step, RZ, wheel 0
0209     h3RZ_W0 = new HRes1DHit("S3RZ_W0",f);   // RecHits, 3. step, RZ, wheel 0
0210 
0211     h1RZ_W1 = new HRes1DHit("S1RZ_W1",f);   // RecHits, 1. step, RZ, wheel +-1
0212     h2RZ_W1 = new HRes1DHit("S2RZ_W1",f);   // RecHits, 2. step, RZ, wheel +-1
0213     h3RZ_W1 = new HRes1DHit("S3RZ_W1",f);   // RecHits, 3. step, RZ, wheel +-1
0214 
0215     h1RZ_W2 = new HRes1DHit("S1RZ_W2",f);   // RecHits, 1. step, RZ, wheel +-2
0216     h2RZ_W2 = new HRes1DHit("S2RZ_W2",f);   // RecHits, 2. step, RZ, wheel +-2
0217     h3RZ_W2 = new HRes1DHit("S3RZ_W2",f);   // RecHits, 3. step, RZ, wheel +-2
0218 
0219     h1RPhi_W0 = new HRes1DHit("S1RPhi_W0",f);   // RecHits, 1. step, RPhi, wheel 0
0220     h2RPhi_W0 = new HRes1DHit("S2RPhi_W0",f);   // RecHits, 2. step, RPhi, wheel 0
0221     h3RPhi_W0 = new HRes1DHit("S3RPhi_W0",f);   // RecHits, 3. step, RPhi, wheel 0
0222 
0223     h1RPhi_W1 = new HRes1DHit("S1RPhi_W1",f);   // RecHits, 1. step, RPhi, wheel +-1
0224     h2RPhi_W1 = new HRes1DHit("S2RPhi_W1",f);   // RecHits, 2. step, RPhi, wheel +-1
0225     h3RPhi_W1 = new HRes1DHit("S3RPhi_W1",f);   // RecHits, 3. step, RPhi, wheel +-1
0226 
0227     h1RPhi_W2 = new HRes1DHit("S1RPhi_W2",f);   // RecHits, 1. step, RPhi, wheel +-2
0228     h2RPhi_W2 = new HRes1DHit("S2RPhi_W2",f);   // RecHits, 2. step, RPhi, wheel +-2
0229     h3RPhi_W2 = new HRes1DHit("S3RPhi_W2",f);   // RecHits, 3. step, RPhi, wheel +-2
0230   }
0231 
0232   HRes2DHit *h2DHitRPhi= 0;
0233   HRes2DHit *h2DHitRZ= 0;
0234   HRes2DHit *h2DHitRZ_W0 = 0;
0235   HRes2DHit *h2DHitRZ_W1 = 0;
0236   HRes2DHit *h2DHitRZ_W2 = 0;
0237   if(do2DRecHit) {
0238     h2DHitRPhi = new HRes2DHit("RPhi",f);
0239     h2DHitRZ = new HRes2DHit("RZ",f);
0240     h2DHitRZ_W0 = new HRes2DHit("RZ_W0",f);
0241     h2DHitRZ_W1 = new HRes2DHit("RZ_W1",f);
0242     h2DHitRZ_W2 = new HRes2DHit("RZ_W2",f);
0243   }
0244 
0245   HRes2DHit *h2DSLPhiHit= 0;
0246   if(do2DSLPhiRecHit) {
0247     h2DSLPhiHit = new HRes2DHit("SuperPhi",f);
0248   }
0249 
0250 
0251   HRes4DHit *h4DHit= 0;
0252   HRes4DHit *h4DHit_W0= 0;
0253   HRes4DHit *h4DHit_W1= 0;
0254   HRes4DHit *h4DHit_W2= 0;
0255   if(do4DRecHit) {
0256     h4DHit = new HRes4DHit("All", f);
0257     h4DHit_W0 = new HRes4DHit("W0", f);
0258     h4DHit_W1 = new HRes4DHit("W1", f);
0259     h4DHit_W2 = new HRes4DHit("W2", f);
0260   }
0261 
0262 
0263   TCanvas * c1;
0264   int i = 1;
0265 
0266 
0267   if(do1DRecHit) {
0268     // Residual, Rphi
0269     plot1DResiduals(h1RPhi,h2RPhi,h3RPhi,ThreeIn1);
0270 
0271     // Residual, RZ 
0272     plot1DResiduals(h1RZ,h2RZ,h3RZ,ThreeIn1);
0273 
0274     // Residual, RZ, per wheel
0275     plot1DResiduals(h1RZ_W0,h2RZ_W0,h3RZ_W0,ThreeIn1);
0276     plot1DResiduals(h1RZ_W1,h2RZ_W1,h3RZ_W1,ThreeIn1);
0277     plot1DResiduals(h1RZ_W2,h2RZ_W2,h3RZ_W2,ThreeIn1);
0278 
0279     // Residual, RPhi, per wheel
0280     plot1DResiduals(h1RPhi_W0,h2RPhi_W0,h3RPhi_W0,ThreeIn1);
0281     plot1DResiduals(h1RPhi_W1,h2RPhi_W1,h3RPhi_W1,ThreeIn1);
0282     plot1DResiduals(h1RPhi_W2,h2RPhi_W2,h3RPhi_W2,ThreeIn1);
0283   }
0284 
0285   if(do2DRecHit) {
0286     cout << "h2DHitRPhi " << h2DHitRPhi << endl;
0287     plot2DResiduals(h2DHitRPhi);
0288     plot2DResiduals(h2DHitRZ);
0289     // plot2DResiduals(h2DHitRZ_W0);
0290     // plot2DResiduals(h2DHitRZ_W1);
0291     // plot2DResiduals(h2DHitRZ_W2);
0292   }
0293 
0294   if(do2DSLPhiRecHit) {
0295     plot2DResiduals(h2DSLPhiHit);
0296   }
0297 
0298   if(do4DRecHit) {
0299     plot4DResiduals(h4DHit);
0300     plot4DResidualsRZ(h4DHit);
0301     // plot4DResiduals(h4DHit_W0);
0302     // plot4DResiduals(h4DHit_W1);
0303     // plot4DResiduals(h4DHit_W2);
0304   }
0305 
0306   // resovseta:
0307 
0308   if(do1DRecHit) {
0309     const float min = -0.6;
0310     const float max =  0.6;
0311     c1 = newCanvas("c_1D_S1RPhi_hResVsEta",form);
0312     plotAndProfileX(h1RPhi->hResVsEta,min,max);
0313 
0314     c1 = newCanvas("c_1D_S2RPhi_hResVsEta",form);
0315     //plotAndProfileX(h2RPhi->hResVsEta,min,max);
0316 
0317     c1 = newCanvas("c_1D_S3RPhi_hResVsEta",form);
0318     plotAndProfileX(h3RPhi->hResVsEta,min,max);
0319 
0320     c1 = newCanvas("c_1D_S1RZ_hResVsEta",form);
0321     plotAndProfileX(h1RZ->hResVsEta,min,max);
0322 
0323     c1 = newCanvas("c_1D_S2RZ_hResVsEta",form);
0324     //plotAndProfileX(h2RZ->hResVsEta,min,max);
0325 
0326     c1 = newCanvas("c_1D_S3RZ_hResVsEta",form);
0327     plotAndProfileX(h3RZ->hResVsEta,min,max);
0328 
0329     c1 = newCanvas("c_1D_S1RZ_W0_hResVsEta",form);
0330     plotAndProfileX(h1RZ_W0->hResVsEta,min,max);
0331     c1 = newCanvas("c_1D_S1RZ_W1_hResVsEta",form);
0332     plotAndProfileX(h1RZ_W1->hResVsEta,min,max);
0333     c1 = newCanvas("c_1D_S1RZ_W2_hResVsEta",form);
0334     plotAndProfileX(h1RZ_W2->hResVsEta,min,max);
0335 
0336     c1 = newCanvas("c_1D_S1RPhi_W0_hResVsEta",form);
0337     plotAndProfileX(h1RPhi_W0->hResVsPhi,min,max);
0338     c1 = newCanvas("c_1D_S1RPhi_W1_hResVsEta",form);
0339     plotAndProfileX(h1RPhi_W1->hResVsPhi,min,max);
0340     c1 = newCanvas("c_1D_S1RPhi_W2_hResVsEta",form);
0341     plotAndProfileX(h1RPhi_W2->hResVsPhi,min,max);
0342 
0343     c1 = newCanvas("c_1D_S3RZ_W0_hResVsEta",form);
0344     plotAndProfileX(h3RZ_W0->hResVsEta,min,max);
0345     c1 = newCanvas("c_1D_S3RZ_W1_hResVsEta",form);
0346     plotAndProfileX(h3RZ_W1->hResVsEta,min,max);
0347     c1 = newCanvas("c_1D_S3RZ_W2_hResVsEta",form);
0348     plotAndProfileX(h3RZ_W2->hResVsEta,min,max);
0349 
0350     c1 = newCanvas("c_1D_S3RPhi_W0_hResVsEta",form);
0351     plotAndProfileX(h3RPhi_W0->hResVsPhi,min,max);
0352     c1 = newCanvas("c_1D_S3RPhi_W1_hResVsEta",form);
0353     plotAndProfileX(h3RPhi_W1->hResVsPhi,min,max);
0354     c1 = newCanvas("c_1D_S3RPhi_W2_hResVsEta",form);
0355     plotAndProfileX(h3RPhi_W2->hResVsPhi,min,max);
0356   }
0357 
0358   if(false && do2DRecHit) {
0359     c1 = newCanvas("c_2D_RPhi_hResPosVsEta",form);
0360     plotAndProfileX(h2DHitRPhi->hResPosVsEta,-3,3);
0361 
0362     c1 = newCanvas("c_2D_RZ_hResPosVsEta",form);
0363     plotAndProfileX(h2DHitRZ->hResPosVsEta,-3,3);
0364 
0365     c1 = newCanvas("c_2D_RZ_W0_hResPosVsEta",form);
0366     plotAndProfileX(h2DHitRZ_W0->hResPosVsEta,-3,3);
0367 
0368     c1 = newCanvas("c_2D_RZ_W1_hResPosVsEta",form);
0369     plotAndProfileX(h2DHitRZ_W1->hResPosVsEta,-3,3);
0370 
0371     c1 = newCanvas("c_2D_RZ_W2_hResPosVsEta",form);
0372     plotAndProfileX(h2DHitRZ_W2->hResPosVsEta,-3,3);
0373 
0374     c1 = newCanvas("c_2D_RPhi_hResAngleVsEta",form);
0375     plotAndProfileX(h2DHitRPhi->hResAngleVsEta,-3,3);
0376 
0377     c1 = newCanvas("c_2D_RZ_hResAngleVsEta",form);
0378     plotAndProfileX(h2DHitRZ->hResAngleVsEta,-3,3);
0379 
0380     c1 = newCanvas("c_2D_RZ_W0_hResAngleVsEta",form);
0381     plotAndProfileX(h2DHitRZ_W0->hResAngleVsEta,-3,3);
0382 
0383     c1 = newCanvas("c_2D_RZ_W1_hResAngleVsEta",form);
0384     plotAndProfileX(h2DHitRZ_W1->hResAngleVsEta,-3,3);
0385 
0386     c1 = newCanvas("c_2D_RZ_W2_hResAngleVsEta",form);
0387     plotAndProfileX(h2DHitRZ_W2->hResAngleVsEta,-3,3);
0388 
0389   }
0390 
0391   if(do2DSLPhiRecHit) {
0392     c1 = newCanvas("c_2D_SuperPhi_hResPosVsEta",form);
0393     plotAndProfileX(h2DSLPhiHit->hResPosVsEta,-3,3);
0394 
0395     c1 = newCanvas("c_2D_SuperPhi_hResAngleVsEta",form);
0396     plotAndProfileX(h2DSLPhiHit->hResAngleVsEta,-3,3);
0397 
0398   }
0399 
0400   if(do4DRecHit) {
0401     plot4DResVsEta(h4DHit);
0402     plot4DResVsEtaRZ(h4DHit);
0403     // plot4DResVsEta(h4DHit_W0);
0404     // plot4DResVsEta(h4DHit_W1);
0405     // plot4DResVsEta(h4DHit_W2);
0406   }
0407 
0408   // resovsphi:
0409 
0410   if(do1DRecHit) {
0411     const float min = -0.6;
0412     const float max =  0.6;
0413     c1 = newCanvas("c_1D_S1RPhi_hResVsPhi",form);
0414     plotAndProfileX(h1RPhi->hResVsPhi,min, max);
0415 
0416     c1 = newCanvas("c_1D_S2RPhi_hResVsPhi",form);
0417     //plotAndProfileX(h2RPhi->hResVsPhi,min, max);
0418 
0419     c1 = newCanvas("c_1D_S3RPhi_hResVsPhi",form);
0420     plotAndProfileX(h3RPhi->hResVsPhi,min, max);
0421 
0422     c1 = newCanvas("c_1D_S1RZ_hResVsPhi",form);
0423     plotAndProfileX(h1RZ->hResVsPhi,min, max);
0424 
0425     c1 = newCanvas("c_1D_S2RZ_hResVsPhi",form);
0426     //plotAndProfileX(h2RZ->hResVsPhi,min, max);
0427 
0428     c1 = newCanvas("c_1D_S3RZ_hResVsPhi",form);
0429     plotAndProfileX(h3RZ->hResVsPhi,min, max);
0430 
0431     c1 = newCanvas("c_1D_S1RZ_W0_hResVsPhi",form);
0432     plotAndProfileX(h1RZ_W0->hResVsPhi,min,max);
0433     c1 = newCanvas("c_1D_S1RZ_W1_hResVsPhi",form);
0434     plotAndProfileX(h1RZ_W1->hResVsPhi,min,max);
0435     c1 = newCanvas("c_1D_S1RZ_W2_hResVsPhi",form);
0436     plotAndProfileX(h1RZ_W2->hResVsPhi,min,max);
0437 
0438     c1 = newCanvas("c_1D_S1RPhi_W0_hResVsPhi",form);
0439     plotAndProfileX(h1RPhi_W0->hResVsPhi,min,max);
0440     c1 = newCanvas("c_1D_S1RPhi_W1_hResVsPhi",form);
0441     plotAndProfileX(h1RPhi_W1->hResVsPhi,min,max);
0442     c1 = newCanvas("c_1D_S1RPhi_W2_hResVsPhi",form);
0443     plotAndProfileX(h1RPhi_W2->hResVsPhi,min,max);
0444 
0445     c1 = newCanvas("c_1D_S3RZ_W0_hResVsPhi",form);
0446     plotAndProfileX(h3RZ_W0->hResVsPhi,min,max);
0447     c1 = newCanvas("c_1D_S3RZ_W1_hResVsPhi",form);
0448     plotAndProfileX(h3RZ_W1->hResVsPhi,min,max);
0449     c1 = newCanvas("c_1D_S3RZ_W2_hResVsPhi",form);
0450     plotAndProfileX(h3RZ_W2->hResVsPhi,min,max);
0451 
0452     c1 = newCanvas("c_1D_S3RPhi_W0_hResVsPhi",form);
0453     plotAndProfileX(h3RPhi_W0->hResVsPhi,min,max);
0454     c1 = newCanvas("c_1D_S3RPhi_W1_hResVsPhi",form);
0455     plotAndProfileX(h3RPhi_W1->hResVsPhi,min,max);
0456     c1 = newCanvas("c_1D_S3RPhi_W2_hResVsPhi",form);
0457     plotAndProfileX(h3RPhi_W2->hResVsPhi,min,max);
0458   }
0459 
0460   if(false && do2DRecHit) {
0461     c1 = newCanvas("c_2D_RPhi_hResPosVsPhi",form);
0462     plotAndProfileX(h2DHitRPhi->hResPosVsPhi,-3,3);
0463 
0464     c1 = newCanvas("c_2D_RZ_hResPosVsPhi",form);
0465     plotAndProfileX(h2DHitRZ->hResPosVsPhi,-3,3);
0466 
0467     c1 = newCanvas("c_2D_RZ_W0_hResPosVsPhi",form);
0468     plotAndProfileX(h2DHitRZ_W0->hResPosVsPhi,-3,3);
0469 
0470     c1 = newCanvas("c_2D_RZ_W1_hResPosVsPhi",form);
0471     plotAndProfileX(h2DHitRZ_W1->hResPosVsPhi,-3,3);
0472 
0473     c1 = newCanvas("c_2D_RZ_W2_hResPosVsPhi",form);
0474     plotAndProfileX(h2DHitRZ_W2->hResPosVsPhi,-3,3);
0475 
0476     c1 = newCanvas("c_2D_RPhi_hResAngleVsPhi",form);
0477     plotAndProfileX(h2DHitRPhi->hResAngleVsPhi,-3,3);
0478 
0479     c1 = newCanvas("c_2D_RZ_hResAngleVsPhi",form);
0480     plotAndProfileX(h2DHitRZ->hResAngleVsPhi,-3,3);
0481 
0482     c1 = newCanvas("c_2D_RZ_W0_hResAngleVsPhi",form);
0483     plotAndProfileX(h2DHitRZ_W0->hResAngleVsPhi,-3,3);
0484 
0485     c1 = newCanvas("c_2D_RZ_W1_hResAngleVsPhi",form);
0486     plotAndProfileX(h2DHitRZ_W1->hResAngleVsPhi,-3,3);
0487 
0488     c1 = newCanvas("c_2D_RZ_W2_hResAngleVsPhi",form);
0489     plotAndProfileX(h2DHitRZ_W2->hResAngleVsPhi,-3,3);
0490 
0491   }
0492 
0493   if(do2DSLPhiRecHit) {
0494     c1 = newCanvas("c_2D_SuperPhi_hResPosVsPhi",form);
0495     plotAndProfileX(h2DSLPhiHit->hResPosVsPhi,-3,3);
0496 
0497     c1 = newCanvas("c_2D_SuperPhi_hResAngleVsPhi",form);
0498     plotAndProfileX(h2DSLPhiHit->hResAngleVsPhi,-3,3);
0499   }
0500 
0501   if(do4DRecHit) {
0502     plot4DResVsPhi(h4DHit);
0503     plot4DResVsPhiRZ(h4DHit);
0504     // plot4DResVsPhi(h4DHit_W0);
0505     // plot4DResVsPhi(h4DHit_W1);
0506     // plot4DResVsPhi(h4DHit_W2);
0507   }
0508 
0509 
0510 
0511   // resovspos:
0512 
0513   if(do1DRecHit) {
0514     bool profile = true;
0515     const float min = -1;
0516     const float max =  1;
0517     c1 = newCanvas("c_1D_S1RPhi_hResVsPos",form);
0518     plotAndProfileX(h1RPhi->hResVsPos, min, max, profile);
0519 
0520     //c1 = newCanvas("c_1D_S2RPhi_hResVsPos",form);
0521     //plotAndProfileX(h2RPhi->hResVsPos, min, max, profile);
0522 
0523     c1 = newCanvas("c_1D_S3RPhi_hResVsPos",form);
0524     plotAndProfileX(h3RPhi->hResVsPos, min, max, profile);
0525 
0526     c1 = newCanvas("c_1D_S1RZ_hResVsPos",form);
0527     plotAndProfileX(h1RZ->hResVsPos, min, max, profile);
0528 
0529     c1 = newCanvas("c_1D_S1RZ_W0_hResVsPos",form);
0530     plotAndProfileX(h1RZ_W0->hResVsPos, min, max, profile);
0531 
0532     c1 = newCanvas("c_1D_S1RZ_W1_hResVsPos",form);
0533     plotAndProfileX(h1RZ_W1->hResVsPos, min, max, profile);
0534 
0535     c1 = newCanvas("c_1D_S1RZ_W2_hResVsPos",form);
0536     plotAndProfileX(h1RZ_W2->hResVsPos, min, max, profile);
0537 
0538 
0539     c1 = newCanvas("c_1D_S1RPhi_W0_hResVsPos",form);
0540     plotAndProfileX(h1RPhi_W0->hResVsPos, min, max, profile);
0541 
0542     c1 = newCanvas("c_1D_S1RPhi_W1_hResVsPos",form);
0543     plotAndProfileX(h1RPhi_W1->hResVsPos, min, max, profile);
0544 
0545     c1 = newCanvas("c_1D_S1RPhi_W2_hResVsPos",form);
0546     plotAndProfileX(h1RPhi_W2->hResVsPos, min, max, profile);
0547 
0548     //c1 = newCanvas("c_1D_S2RZ_hResVsPos",form);
0549     //plotAndProfileX(h2RZ->hResVsPos, min, max, profile);
0550 
0551     //c1 = newCanvas("c_1D_S2RZ_W0_hResVsPos",form);
0552     //plotAndProfileX(h2RZ_W0->hResVsPos, min, max, profile);
0553 
0554     //c1 = newCanvas("c_1D_S2RZ_W1_hResVsPos",form);
0555     //plotAndProfileX(h2RZ_W1->hResVsPos, min, max, profile);
0556 
0557     //c1 = newCanvas("c_1D_S2RZ_W2_hResVsPos",form);
0558     //plotAndProfileX(h2RZ_W2->hResVsPos, min, max, profile);
0559 
0560     c1 = newCanvas("c_1D_S3RZ_hResVsPos",form);
0561     plotAndProfileX(h3RZ->hResVsPos, min, max, profile);
0562 
0563     c1 = newCanvas("c_1D_S3RZ_W0_hResVsPos",form);
0564     plotAndProfileX(h3RZ_W0->hResVsPos, min, max, profile);
0565 
0566     c1 = newCanvas("c_1D_S3RZ_W1_hResVsPos",form);
0567     plotAndProfileX(h3RZ_W1->hResVsPos, min, max, profile);
0568 
0569     c1 = newCanvas("c_1D_S3RZ_W2_hResVsPos",form);
0570     plotAndProfileX(h3RZ_W2->hResVsPos, min, max, profile);
0571 
0572     c1 = newCanvas("c_1D_S3RPhi_W0_hResVsPos",form);
0573     plotAndProfileX(h3RPhi_W0->hResVsPos, min, max, profile);
0574 
0575     c1 = newCanvas("c_1D_S3RPhi_W1_hResVsPos",form);
0576     plotAndProfileX(h3RPhi_W1->hResVsPos, min, max, profile);
0577 
0578     c1 = newCanvas("c_1D_S3RPhi_W2_hResVsPos",form);
0579     plotAndProfileX(h3RPhi_W2->hResVsPos, min, max, profile);
0580   }
0581 
0582   // resovsangle:
0583 
0584   if(do1DRecHit) {
0585     bool profile = true;
0586     const float min = -1;
0587     const float max =  1;
0588     c1 = newCanvas("c_1D_S1RPhi_hResVsAngle",form);
0589     plotAndProfileX(h1RPhi->hResVsAngle, min, max, profile);
0590 
0591     c1 = newCanvas("c_1D_S2RPhi_hResVsAngle",form);
0592     //plotAndProfileX(h2RPhi->hResVsAngle, min, max, profile);
0593 
0594     c1 = newCanvas("c_1D_S3RPhi_hResVsAngle",form);
0595     plotAndProfileX(h3RPhi->hResVsAngle, min, max, profile);
0596 
0597     c1 = newCanvas("c_1D_S1RZ_hResVsAngle",form);
0598     plotAndProfileX(h1RZ->hResVsAngle, min, max, profile);
0599 
0600     c1 = newCanvas("c_1D_S1RZ_W0_hResVsAngle",form);
0601     plotAndProfileX(h1RZ_W0->hResVsAngle, min, max, profile);
0602 
0603     c1 = newCanvas("c_1D_S1RZ_W1_hResVsAngle",form);
0604     plotAndProfileX(h1RZ_W1->hResVsAngle, min, max, profile);
0605 
0606     c1 = newCanvas("c_1D_S1RZ_W2_hResVsAngle",form);
0607     plotAndProfileX(h1RZ_W2->hResVsAngle, min, max, profile);
0608 
0609     c1 = newCanvas("c_1D_S1RPhi_W0_hResVsAngle",form);
0610     plotAndProfileX(h1RPhi_W0->hResVsAngle, min, max, profile);
0611 
0612     c1 = newCanvas("c_1D_S1RPhi_W1_hResVsAngle",form);
0613     plotAndProfileX(h1RPhi_W1->hResVsAngle, min, max, profile);
0614 
0615     c1 = newCanvas("c_1D_S1RPhi_W2_hResVsAngle",form);
0616     plotAndProfileX(h1RPhi_W2->hResVsAngle, min, max, profile);
0617 
0618     //c1 = newCanvas("c_1D_S2RZ_hResVsAngle",form);
0619     //plotAndProfileX(h2RZ->hResVsAngle, min, max, profile);
0620 
0621     //c1 = newCanvas("c_1D_S2RZ_W0_hResVsAngle",form);
0622     //plotAndProfileX(h2RZ_W0->hResVsAngle, min, max, profile);
0623 
0624     //c1 = newCanvas("c_1D_S2RZ_W1_hResVsAngle",form);
0625     //plotAndProfileX(h2RZ_W1->hResVsAngle, min, max, profile);
0626 
0627     //c1 = newCanvas("c_1D_S2RZ_W2_hResVsAngle",form);
0628     //plotAndProfileX(h2RZ_W2->hResVsAngle, min, max, profile);
0629 
0630     c1 = newCanvas("c_1D_S3RZ_hResVsAngle",form);
0631     plotAndProfileX(h3RZ->hResVsAngle, min, max, profile);
0632 
0633     c1 = newCanvas("c_1D_S3RZ_W0_hResVsAngle",form);
0634     plotAndProfileX(h3RZ_W0->hResVsAngle, min, max, profile);
0635 
0636     c1 = newCanvas("c_1D_S3RZ_W1_hResVsAngle",form);
0637     plotAndProfileX(h3RZ_W1->hResVsAngle, min, max, profile);
0638 
0639     c1 = newCanvas("c_1D_S3RZ_W2_hResVsAngle",form);
0640     plotAndProfileX(h3RZ_W2->hResVsAngle, min, max, profile);
0641 
0642     c1 = newCanvas("c_1D_S3RPhi_W0_hResVsAngle",form);
0643     plotAndProfileX(h3RPhi_W0->hResVsAngle, min, max, profile);
0644 
0645     c1 = newCanvas("c_1D_S3RPhi_W1_hResVsAngle",form);
0646     plotAndProfileX(h3RPhi_W1->hResVsAngle, min, max, profile);
0647 
0648     c1 = newCanvas("c_1D_S3RPhi_W2_hResVsAngle",form);
0649     plotAndProfileX(h3RPhi_W2->hResVsAngle, min, max, profile);
0650 
0651   }
0652 
0653 
0654   // if(do2DRecHit) {
0655   //   //cout << "h2DHitRPhi: " << (int)h2DHitRPhi << endl;
0656   //   plot2DAngles(h2DHitRPhi, ThreeIn1);
0657   //   plot2DAngles(h2DHitRZ, ThreeIn1);
0658   //   plot2DAngles(h2DHitRZ_W0, ThreeIn1);
0659   //   plot2DAngles(h2DHitRZ_W1, ThreeIn1);
0660   //   plot2DAngles(h2DHitRZ_W2, ThreeIn1);
0661   // }
0662 
0663   // if(do2DSLPhiRecHit) {
0664   //   plot2DAngles(h2DSLPhiHit, ThreeIn1);
0665   // }
0666 
0667   // if(do4DRecHit) {
0668   //   plot4DAngles(h4DHit, ThreeIn1);
0669   //   plot4DAngles(h4DHit_W0, ThreeIn1);
0670   //   plot4DAngles(h4DHit_W1, ThreeIn1);
0671   //   plot4DAngles(h4DHit_W2, ThreeIn1);
0672   // }
0673 
0674   return;
0675 
0676 }
0677 
0678 
0679 void plot1DResiduals(HRes1DHit * h1, HRes1DHit * h2, HRes1DHit * h3, bool ThreeIn1) {
0680   int i = 2;
0681 
0682   if(ThreeIn1)
0683     cout << "ThreeIn1 = true!" << endl;
0684   else
0685     cout << "ThreeIn1 = false!" << endl;
0686 
0687   TString N1 = "c_1D_" + h1->name;
0688   TString N2 = "c_1D_" + h2->name;
0689   TString N3 = "c_1D_" + h3->name;
0690   int form = 2;
0691   if (ThreeIn1) c1 = newCanvas(N1.Remove(5,2)+"_hRes",3,1,1200,500);
0692   else newCanvas(N1+"_hRes",form);
0693   drawGFit(h1->hRes, -0.2,0.2,-0.1,0.1);
0694 
0695   if (ThreeIn1) c1->cd(i++);
0696   else c1 = newCanvas(N2+"_hRes",form);
0697   //drawGFit(h2->hRes, -0.2,0.2,-0.1,0.1);
0698 
0699   if (ThreeIn1) c1->cd(i++);
0700   else c1 = newCanvas(N3+"_hRes",form);
0701   drawGFit(h3->hRes, -0.2,0.2,-0.1,0.1);
0702 
0703   newCanvas(N1+"_hResSt1",form);
0704   drawGFit(h1->hResSt[0], -0.2,0.2,-0.1,0.1);
0705 
0706   newCanvas(N1+"_hResSt2",form);
0707   drawGFit(h1->hResSt[1], -0.2,0.2,-0.1,0.1);
0708 
0709   newCanvas(N1+"_hResSt3",form);
0710   drawGFit(h1->hResSt[2], -0.2,0.2,-0.1,0.1);
0711 
0712   newCanvas(N1+"_hResSt4",form);
0713   drawGFit(h1->hResSt[3], -0.2,0.2,-0.1,0.1);
0714 
0715 
0716   newCanvas(N3+"_hResSt1",form);
0717   drawGFit(h3->hResSt[0], -0.2,0.2,-0.1,0.1);
0718 
0719   newCanvas(N3+"_hResSt2",form);
0720   drawGFit(h3->hResSt[1], -0.2,0.2,-0.1,0.1);
0721 
0722   newCanvas(N3+"_hResSt3",form);
0723   drawGFit(h3->hResSt[2], -0.2,0.2,-0.1,0.1);
0724 
0725   newCanvas(N3+"_hResSt4",form);
0726   drawGFit(h3->hResSt[3], -0.2,0.2,-0.1,0.1);
0727 }
0728 
0729 void plot2DResiduals(HRes2DHit * h1) {
0730   int i = 2;
0731 
0732   TString N1 = "c_2D_" + h1->name;
0733 
0734   int form = 2;
0735   newCanvas(N1+"_hResPos",form);
0736   cout << "h1->hResPos " << h1->hResPos << endl;
0737   drawGFit(h1->hResPos, -0.1,0.1,-0.1,0.1);
0738 
0739   newCanvas(N1+"_hResAngle",form);
0740   cout << "h1->hResAngle " << h1->hResAngle << endl;
0741   drawGFit(h1->hResAngle, -0.1,0.1,-0.1,0.1);
0742 }
0743 
0744 void plot4DResiduals(HRes4DHit * h1) {
0745   int i = 2;
0746 
0747   TString N1 = "c_4D_" + h1->name;
0748 
0749   int form = 2;
0750   newCanvas(N1+"_hResX",form);
0751   drawGFit(h1->hResX, -0.2,0.2,-0.1,0.1);
0752 
0753   newCanvas(N1+"_hResY",form);
0754   drawGFit(h1->hResY, -0.2,0.2,-0.1,0.1);
0755 
0756   newCanvas(N1+"_hResAlpha",form);
0757   drawGFit(h1->hResAlpha, -0.2,0.2,-0.1,0.1);
0758 
0759   newCanvas(N1+"_hResBeta",form);
0760   drawGFit(h1->hResBeta, -0.2,0.2,-0.1,0.1);
0761 
0762 }
0763 
0764 void plot4DResVsEta(HRes4DHit * h1) {
0765   int i = 2;
0766 
0767   TString N1 = "c_4D_" + h1->name;
0768 
0769   int form = 2;
0770   newCanvas(N1+"_hResXVsEta",form);
0771   plotAndProfileX(h1->hResXVsEta,-3,3);
0772 
0773   newCanvas(N1+"_hResYVsEta",form);
0774   plotAndProfileX(h1->hResYVsEta,-3,3);
0775 
0776   newCanvas(N1+"_hResAlphaVsEta",form);
0777   plotAndProfileX(h1->hResAlphaVsEta,-3,3);
0778 
0779   newCanvas(N1+"_hResBetaVsEta",form);
0780   plotAndProfileX(h1->hResBetaVsEta,-3,3);
0781 }
0782 
0783 void plot4DResVsPhi(HRes4DHit * h1) {
0784   int i = 2;
0785 
0786   TString N1 = "c_4D_" + h1->name;
0787 
0788   int form = 2;
0789   newCanvas(N1+"_hResXVsPhi",form);
0790   plotAndProfileX(h1->hResXVsPhi,-3,3);
0791 
0792   newCanvas(N1+"_hResYVsPhi",form);
0793   plotAndProfileX(h1->hResYVsPhi,-3,3);
0794 
0795   newCanvas(N1+"_hResAlphaVsPhi",form);
0796   plotAndProfileX(h1->hResAlphaVsPhi,-3,3);
0797 
0798   newCanvas(N1+"_hResBetaVsPhi",form);
0799   plotAndProfileX(h1->hResBetaVsPhi,-3,3);
0800 }
0801 
0802 void plot2DAngles(HRes2DHit * h1, bool ThreeIn1) {
0803   int i = 2;
0804 
0805   TString N1 = "c_2D_" + h1->name;
0806 
0807   int form = 2;
0808   if (ThreeIn1) c1 = newCanvas(N1+"_hAngle",3,1,1200,500);
0809   else newCanvas(N1+"_hRecAngle",form);
0810   h1->hRecAngle->Draw();
0811 
0812   if (ThreeIn1) c1->cd(i++);
0813   else c1 = newCanvas(N1+"_hSimAngle",form);
0814   h1->hSimAngle->Draw();
0815 
0816   //cout << "h1->hRecVsSimAngle: " << (int)h1->hRecVsSimAngle << endl;
0817 
0818   if (ThreeIn1) c1->cd(i++);
0819   else c1 = newCanvas(N1+"_hRecVsSimAngle",form);
0820   plotAndProfileX(h1->hRecVsSimAngle,-3,3);
0821 
0822 }
0823 
0824 void plot4DAngles(HRes4DHit * h1, bool ThreeIn1) {
0825   int i = 2;
0826 
0827   TString N1 = "c_4D_" + h1->name;
0828 
0829   int form = 2;
0830   if (ThreeIn1) c1 = newCanvas(N1+"_hAlpha",3,1,1200,500);
0831   else newCanvas(N1+"_hRecAlpha",form);
0832   h1->hRecAlpha->Draw();
0833 
0834   if (ThreeIn1) c1->cd(i++);
0835   else c1 = newCanvas(N1+"_hSimAlpha",form);
0836   h1->hSimAlpha->Draw();
0837 
0838   if (ThreeIn1) c1->cd(i++);
0839   else c1 = newCanvas(N1+"_hRecVsSimAlpha",form);
0840   plotAndProfileX(h1->hRecVsSimAlpha,-3,3);
0841 
0842   i=2;
0843 
0844   if (ThreeIn1) c2 = newCanvas(N1+"_hBeta",3,1,1200,500);
0845   else newCanvas(N1+"_hRecBeta",form);
0846   h1->hRecBeta->Draw();
0847 
0848   if (ThreeIn1) c2->cd(i++);
0849   else c1 = newCanvas(N1+"_hSimBeta",form);
0850   h1->hSimBeta->Draw();
0851 
0852   if (ThreeIn1) c2->cd(i++);
0853   else c1 = newCanvas(N1+"_hRecVsSimBeta",form);
0854   plotAndProfileX(h1->hRecVsSimBeta,-3,3);
0855 
0856 }
0857 
0858 void plot4DResidualsRZ(HRes4DHit * h1) {
0859   int i = 2;
0860 
0861   TString N1 = "c_4D_" + h1->name;
0862 
0863   int form = 2;
0864   newCanvas(N1+"_hResYRZ",form);
0865   drawGFit(h1->hResYRZ, -0.1,0.1,-0.1,0.1);
0866 
0867   newCanvas(N1+"_hResBetaRZ",form);
0868   drawGFit(h1->hResBetaRZ, -0.1,0.1,-0.1,0.1);
0869 
0870 }
0871 
0872 void plot4DResVsEtaRZ(HRes4DHit * h1) {
0873   int i = 2;
0874 
0875   TString N1 = "c_4D_" + h1->name;
0876 
0877   int form = 2;
0878   newCanvas(N1+"_hResYVsEtaRZ",form);
0879   plotAndProfileX(h1->hResYVsEtaRZ,-3,3);
0880 
0881   newCanvas(N1+"_hResBetaVsEtaRZ",form);
0882   plotAndProfileX(h1->hResBetaVsEtaRZ,-3,3);
0883 }
0884 
0885 void plot4DResVsPhiRZ(HRes4DHit * h1) {
0886   int i = 2;
0887 
0888   TString N1 = "c_4D_" + h1->name;
0889 
0890   int form = 2;
0891   newCanvas(N1+"_hResYVsPhiRZ",form);
0892   plotAndProfileX(h1->hResYVsPhiRZ,-3,3);
0893 
0894   newCanvas(N1+"_hResBetaVsPhiRZ",form);
0895   plotAndProfileX(h1->hResBetaVsPhiRZ,-3,3);
0896 }
0897 
0898 
0899 bool setPreferences(bool& do1DRecHit,
0900     bool& do2DRecHit,
0901     bool& do2DSLPhiRecHit,
0902     bool& do4DRecHit,
0903     bool& ThreeIn1) {
0904 
0905 
0906 
0907   int dimension = 0;
0908 
0909   cout << "===================================================" << endl;
0910   cout << "==== plotHitReso User Menu =====================" << endl;
0911   cout << "Chose the plot you want to produce:" << endl;
0912   cout << "1 - 1D RecHit Plots" << endl;
0913   cout << "2 - 2D RecHit Plots" << endl;
0914   cout << "3 - 2D RecHit Plots (only SLPhi from 4D RecHit)" << endl;
0915   cout << "4 - 4D RecHit Plots" << endl;
0916   cout << "-->";
0917   cin >> dimension;
0918 
0919   switch(dimension) 
0920   {
0921     case 1:
0922       {
0923         do1DRecHit = true;
0924         break;
0925       }
0926     case 2:
0927       {
0928         do2DRecHit = true;
0929         break;
0930       }
0931     case 3:
0932       {
0933         do2DSLPhiRecHit = true;
0934         break;
0935       }
0936     case 4:
0937       {
0938         do4DRecHit = true;
0939         break;
0940       }
0941     default:
0942       {
0943         cout << "Error: option not Valid, try again!" << endl;
0944         return false;
0945         //setPreferences(do1DRecHit, do2DRecHit, do2DSLPhiRecHit, do4DRecHit, ThreeIn1);
0946         break;
0947       }
0948   }
0949 
0950   return true;
0951   int threeInOne = 0;
0952 
0953   cout << "" << endl;
0954   cout << "Do you want to Plot three histos in one?" << endl;
0955   cout << "0 - No" << endl;
0956   cout << "1 - Yes" << endl;
0957   cout << "-->";
0958 
0959   cin >> threeInOne;
0960 
0961   switch(threeInOne) 
0962   {
0963     case 0:
0964       {
0965         ThreeIn1 = false;
0966         break;
0967       }
0968     case 1:
0969       {
0970         ThreeIn1 = true;
0971         break;
0972       }
0973     default:
0974       {
0975         cout << "Not a valid option: default used!" << endl;    
0976         ThreeIn1 = true;
0977         break;
0978       }
0979   }
0980 
0981   return true;
0982 }
0983