macros/analysis/TwoSideDraw.C

00001 00002 // $Id: TwoSideDraw.C,v 1.11 2000/01/20 02:19:41 snelling Exp $ 00003 // 00004 // $Log: TwoSideDraw.C,v $ 00005 // Revision 1.11 2000/01/20 02:19:41 snelling 00006 // removed tss dependencies 00007 // 00008 // Revision 1.10 2000/01/10 22:06:09 kathy 00009 // add owner name and comments 00010 // 00011 // Revision 1.9 1999/12/11 20:13:53 snelling 00012 // Fixed logic between DAQ data and similators 00013 // 00014 // Revision 1.8 1999/12/06 21:49:58 snelling 00015 // Fixed bug (exchanged x and z) 00016 // 00017 // Revision 1.7 1999/11/23 19:49:54 snelling 00018 // Changed from table draw to loop to fill histograms 00019 // (Valeri suggestion to speed things up) 00020 // 00021 // Revision 1.6 1999/11/20 23:45:51 snelling 00022 // Used Table member function Draw instead of making TableNtuple 00023 // 00024 // Revision 1.5 1999/11/16 19:28:25 snelling 00025 // Changed kOption to "Option" in chain->GetOption() 00026 // 00027 // Revision 1.4 1999/11/10 00:15:36 snelling 00028 // removed drawing of pseudo-padrow hits for geant points 00029 // 00030 // Revision 1.3 1999/09/23 21:52:18 snelling 00031 // added gSystem->Load("StAnalysisUtilities") because that's not in bfc anymore 00032 // 00033 // Revision 1.2 1999/08/10 19:01:25 snelling 00034 // changed for new bfc 00035 // 00036 // Revision 1.1.1.1 1999/08/10 18:48:22 snelling 00037 // macro to draw pixels and hits 00038 // 00040 // 00041 // owner: Raimond Snellings 00042 // 00043 // what it does: 00044 // Macro for plotting hits and pixels in combination with bfc.C 00045 // plotting both sides of tpc separately 00046 // 00048 St_tfc_adcxyz *GetPixels() { 00049 /* 00050 * ----------------------------------------------------------------- 00051 * draw TPC pixels 00052 * -----------------------------------------------------------------*/ 00053 00054 St_tfc_adcxyz* phtfc = (St_tfc_adcxyz*) chain->GetDataSet("adcxyz"); 00055 if (!phtfc) 00056 cout << "Warning: adcxyz table header does not exist " << endl; 00057 else if (!phtfc->GetNRows()) 00058 cout << "Warning: adcxyz table does not exist " << endl; 00059 return phtfc; 00060 } 00061 00062 //----------------------------------------------------------------------- 00063 00064 St_tcl_tphit *GetHits() { 00065 /* 00066 * ----------------------------------------------------------------- 00067 * draw TPC hits 00068 * -----------------------------------------------------------------*/ 00069 00070 // get pointers to tpc hit table 00071 St_tcl_tphit* phtcl = (St_tcl_tphit*) chain->GetDataSet("tphit"); 00072 if (!phtcl) 00073 cout << "Error: tphit table header does not exist " << endl; 00074 else if (!phtcl->GetNRows()) 00075 cout << "Error: tphit table does not exist " << endl; 00076 return phtcl; 00077 } 00078 //----------------------------------------------------------------------- 00079 St_g2t_tpc_hit *GetGeantHits() { 00080 /* 00081 * ----------------------------------------------------------------- 00082 * Look for g2t_tpc table pointer 00083 * -----------------------------------------------------------------*/ 00084 00085 St_g2t_tpc_hit* phg2t = (St_g2t_tpc_hit*) chain->GetDataSet("g2t_tpc_hit"); 00086 if (!phg2t) 00087 cout << "Warning: g2t tpc hit table header does not exist " << endl; 00088 else if (!phg2t->GetNRows()) 00089 cout << "Warning: g2t tpc hit table does not exist " << endl; 00090 return phg2t; 00091 } 00092 00093 //----------------------------------------------------------------------- 00094 00095 void TwoSideDraw() { 00096 /* 00097 * ----------------------------------------------------------------- 00098 * draw TPC sectors with some options 00099 * -----------------------------------------------------------------*/ 00100 00101 gStyle->SetCanvasColor(10); // white 00102 gStyle->SetPadColor(10); // white 00103 gStyle->SetFrameFillColor(10); // white 00104 gStyle->SetOptFit(1); 00105 00106 TCanvas *canvas1 = new TCanvas("canvas1","pixels, hits, geant data",100,100,700,700); 00107 canvas1->SetFillColor(0); 00108 canvas1->SetBorderMode(0); 00109 canvas1->SetBorderSize(0); 00110 00111 TPaveText *title = new TPaveText(.2,0.96,.8,.995); 00112 title->SetFillColor(33); 00113 title->AddText("pixels and hits"); 00114 title->Draw(); 00115 00116 TPad *pad1 = new TPad("pad1","x vs y positive z",0.01,0.48,0.49,0.95); 00117 TPad *pad2 = new TPad("pad2","x vs z positive z",0.51,0.48,0.98,0.95); 00118 TPad *pad3 = new TPad("pad3","x vs y negative z",0.01,0.01,0.49,0.48); 00119 TPad *pad4 = new TPad("pad4","x vs z negative z",0.51,0.01,0.98,0.48); 00120 00121 pad1->SetFillColor(0); 00122 pad1->SetBorderMode(0); 00123 pad1->SetBorderSize(0); 00124 pad1->Draw(); 00125 00126 pad2->SetFillColor(0); 00127 pad2->SetBorderMode(0); 00128 pad2->SetBorderSize(0); 00129 pad2->Draw(); 00130 00131 pad3->SetFillColor(0); 00132 pad3->SetBorderMode(0); 00133 pad3->SetBorderSize(0); 00134 pad3->Draw(); 00135 00136 pad4->SetFillColor(0); 00137 pad4->SetBorderMode(0); 00138 pad4->SetBorderSize(0); 00139 pad4->Draw(); 00140 00141 // Book histograms 00142 TH2F *hyx = 0; TH2F *hzx = 0; 00143 TH2F *hyx_g2t = 0; TH2F *hzx_g2t = 0; 00144 TH2F *hzx_pixels = 0; TH2F *hyx_pixels = 0; 00145 00146 TH2F *nhyx = 0; TH2F *nhzx = 0; 00147 TH2F *nhyx_g2t = 0; TH2F *nhzx_g2t = 0; 00148 TH2F *nhzx_pixels = 0; TH2F *nhyx_pixels = 0; 00149 00150 St_Table *hits = 0; Int_t nHitsRows = 0; 00151 00152 // ---------- Fill Hits ------------- 00153 if (hits = GetHits() && nHitsRows = hits->GetNRows()) { 00154 00155 hyx = new TH2F("x vs y (hits pos z)","x vs y (z > 0)",50,-100,100,50,-100,100); 00156 hzx = new TH2F("x vs z (hits pos z)","x vs z (z > 0)",50,-100,100,50,-100,100); 00157 hyx->SetMarkerStyle(20); hzx->SetMarkerStyle(20); 00158 hyx->SetMarkerColor(2); hzx->SetMarkerColor(2); 00159 hyx->SetXTitle("y [cm]"); hyx->SetYTitle("x [cm]"); 00160 hzx->SetXTitle("z [cm]"); hzx->SetYTitle("x [cm]"); 00161 00162 00163 nhyx = new TH2F("x vs y (hits neg z)","x vs y (z < 0)",50,-100,100,50,-100,100); 00164 nhzx = new TH2F("x vs z (hits neg z)","x vs z (z < 0)",50,-100,100,50,-100,100); 00165 nhyx->SetMarkerStyle(20); nhzx->SetMarkerStyle(20); 00166 nhyx->SetMarkerColor(2); nhzx->SetMarkerColor(2); 00167 nhyx->SetXTitle("y [cm]"); nhyx->SetYTitle("x [cm]"); 00168 nhzx->SetXTitle("z [cm]"); nhzx->SetYTitle("x [cm]"); 00169 00170 tcl_tphit_st *pttphit = ((St_tcl_tphit *)hits)->GetTable(); 00171 for (Int_t i = 0; i < nHitsRows; i++) { 00172 if (pttphit[i].z > 0) { 00173 hyx->Fill(pttphit[i].y, pttphit[i].x); 00174 hzx->Fill(pttphit[i].z, pttphit[i].x); 00175 } 00176 else { 00177 nhyx->Fill(pttphit[i].y, pttphit[i].x); 00178 nhzx->Fill(pttphit[i].z, pttphit[i].x); 00179 } 00180 } // Fill hits 00181 } 00182 00183 // --------- Fill Geant Hits ------------ 00184 Bool_t noDAQ = !chain->GetOption("miniDAQ") && !chain->GetOption("TDAQ"); 00185 if (noDAQ && hits = GetGeantHits() && nHitsRows = hits->GetNRows() ) { 00186 00187 hyx_g2t = new TH2F("x vs y (geant pos z)","x vs y (z > 0)",50,-100,100,50,-100,100); 00188 hzx_g2t = new TH2F("x vs z (geant pos z)","x vs z (z > 0)",50,-100,100,50,-100,100); 00189 hyx_g2t->SetMarkerStyle(24); hzx_g2t->SetMarkerStyle(24); 00190 hyx_g2t->SetMarkerColor(3); hzx_g2t->SetMarkerColor(3); 00191 00192 nhyx_g2t = new TH2F("x vs y (geant neg z)","x vs y (z < 0)",50,-100,100,50,-100,100); 00193 nhzx_g2t = new TH2F("x vs z (geant neg z)","x vs z (z < 0)",50,-100,100,50,-100,100); 00194 nhyx_g2t->SetMarkerStyle(24); nhzx_g2t->SetMarkerStyle(24); 00195 nhyx_g2t->SetMarkerColor(3); nhzx_g2t->SetMarkerColor(3); 00196 00197 g2t_tpc_hit_st *ptg2t = ((St_g2t_tpc_hit *)hits)->GetTable(); 00198 for (Int_t i = 0; i < nHitsRows; i++) { 00199 if (ptg2t[i].volume_id < 2446) { 00200 if (ptg2t[i].x[2] > 0) { 00201 hyx_g2t->Fill(ptg2t[i].x[1], ptg2t[i].x[0]); 00202 hzx_g2t->Fill(ptg2t[i].x[2], ptg2t[i].x[0]); 00203 } 00204 else { 00205 nhyx_g2t->Fill(ptg2t[i].x[1], ptg2t[i].x[0]); 00206 nhzx_g2t->Fill(ptg2t[i].x[2], ptg2t[i].x[0]); 00207 } 00208 } 00209 } 00210 } // Fill GEANT hits 00211 00212 // -------- Fill pixels ---------- 00213 Bool_t isSimulator = chain->GetOption("trs"); 00214 00215 if ((!noDAQ || isSimulator) && hits = GetPixels() && nHitsRows = hits->GetNRows() ) { 00216 00217 hyx_pixels = new TH2F("x vs y (pixels pos z)","x vs y (z > 0)",50,-100,100,50,-100,100); 00218 hzx_pixels = new TH2F("x vs z (pixels pos z)","x vs z (z > 0)",50,-100,100,50,-100,100); 00219 hzx_pixels->SetMarkerStyle(26); hyx_pixels->SetMarkerStyle(26); 00220 hzx_pixels->SetMarkerColor(4); hyx_pixels->SetMarkerColor(4); 00221 00222 nhyx_pixels = new TH2F("x vs y (pixels neg z)","x vs y (z < 0)",50,-100,100,50,-100,100); 00223 nhzx_pixels = new TH2F("x vs z (pixels neg z)","x vs z (z < 0)",50,-100,100,50,-100,100); 00224 nhzx_pixels->SetMarkerStyle(26); nhyx_pixels->SetMarkerStyle(26); 00225 nhzx_pixels->SetMarkerColor(4); nhyx_pixels->SetMarkerColor(4); 00226 00227 tfc_adcxyz_st *ptpixel = ((St_tfc_adcxyz *)hits)->GetTable(); 00228 for (Int_t i = 0; i < nHitsRows; i++) { 00229 if (ptpixel[i].adc>2) { 00230 if (ptpixel[i].z > 0) { 00231 hzx_pixels->Fill(ptpixel[i].z, ptpixel[i].x, ptpixel[i].adc); 00232 hyx_pixels->Fill(ptpixel[i].y, ptpixel[i].x, ptpixel[i].adc); 00233 } 00234 else { 00235 nhzx_pixels->Fill(ptpixel[i].z, ptpixel[i].x, ptpixel[i].adc); 00236 nhyx_pixels->Fill(ptpixel[i].y, ptpixel[i].x, ptpixel[i].adc); 00237 } 00238 } 00239 } 00240 } // Fill pixels 00241 00242 // Draw histograms 00243 00244 pad1->cd(); 00245 00246 if (hyx) hyx->Draw(); 00247 if (hzx_pixels) hyx_pixels->Draw("box,same"); 00248 if (hyx_g2t) hyx_g2t->Draw("same"); 00249 00250 pad2->cd(); 00251 00252 if (hzx) hzx->Draw(); 00253 if (hzx_pixels) hzx_pixels->Draw("box,same"); 00254 if (hyx_g2t) hzx_g2t->Draw("same"); 00255 00256 pad3->cd(); 00257 if (nhyx) nhyx->Draw(); 00258 if (nhyx_pixels) nhyx_pixels->Draw("box,same"); 00259 if (nhyx_g2t) nhyx_g2t->Draw("same"); 00260 00261 pad4->cd(); 00262 if (nhzx) nhzx->Draw(); 00263 if (nhzx_pixels) nhzx_pixels->Draw("box,same"); 00264 if (nhzx_g2t) nhzx_g2t->Draw("same"); 00265 00266 canvas1->Update(); 00267 } 00268 00269

Generated on Sun Mar 15 04:50:46 2009 for StRoot by doxygen 1.3.7