Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:20:35

0001 /*
0002  * DrawTPCFEE.C
0003  *
0004  *  Created on: Sep 22, 2018
0005  *      Author: jinhuang
0006  */
0007 
0008 #include <TChain.h>
0009 #include <TFile.h>
0010 #include <TGraphAsymmErrors.h>
0011 #include <TGraphErrors.h>
0012 #include <TH1.h>
0013 #include <TH2.h>
0014 #include <TH3.h>
0015 #include <TLatex.h>
0016 #include <TLegend.h>
0017 #include <TString.h>
0018 #include <cassert>
0019 #include <cmath>
0020 #include "SaveCanvas.C"
0021 #include "sPhenixStyle.C"
0022 
0023 TFile *_file0 = NULL;
0024 TString description;
0025 
0026 TFile *_file0 = NULL;
0027 TChain *eventT = NULL;
0028 TChain *chanT = NULL;
0029 
0030 TH1 *hNormalization = NULL;
0031 
0032 int total_event = 0;
0033 
0034 void DrawTPCFEE(
0035     //                      const char *infile = "data/tpcfee_00002658-0000.evt_TPCFEETestRecov1.root"  // button source
0036     //                          const char *infile = "data/tpcfee_00002681-0000.evt_TPCFEETestRecov1.root"  // check pad 13,9
0037     //        const char *infile = "data/tpcfee_00002697-0000.evt_TPCFEETestRecov1.root"  // check pad 13,9
0038     //    const char *infile = "data/xraygen/tpc_fee_xraygen-ALL-0000.evt_TPCFEETestRecov1.root"  // check pad 13,9
0039     //    const char *infile = "data/xraygen/run2/tpc_fee_xraygen-0000287ALL-0000.evt_TPCFEETestRecov1.root"  // check pad 13,9
0040     //    const char *infile = "data/xraygen/run2/tpc_fee_xraygen-ALL-0000.evt_TPCFEETestRecov1.root"  // check pad 13,9
0041         const char *infile = "data/pulser/tpc_fee_pulser-0000ALL-0000.evt_TPCFEETestRecov1.root" //
0042 //    const TString infile = "data/xraygen_motorscan/tpc_fee_xraygen_pos_scan-00003600-0000.evt_TPCFEETestRecov1.root"  //
0043 )
0044 {
0045   gSystem->Load("libtpcdaq.so");
0046 
0047   SetsPhenixStyle();
0048   gStyle->SetOptStat(0);
0049   gStyle->SetOptFit(1111);
0050   TVirtualFitter::SetDefaultFitter("Minuit2");
0051 
0052   gSystem->Load("libg4eval.so");
0053 
0054   if (!_file0)
0055   {
0056     TString chian_str = infile;
0057     chian_str.ReplaceAll("ALL", "*");
0058 
0059     eventT = new TChain("eventT");
0060     const int n = eventT->Add(chian_str);
0061     cout << "Loaded eventT from " << n << " root files with " << chian_str << " and " << eventT->GetEntries() << " events." << endl;
0062     assert(n > 0);
0063 
0064     chanT = new TChain("chanT");
0065     const int n = chanT->Add(chian_str);
0066     cout << "Loaded chanT from " << n << " root files with " << chian_str << endl;
0067     assert(n > 0);
0068 
0069     _file0 = new TFile;
0070     _file0->SetName(infile);
0071 
0072     TObjArray *fileElements = eventT->GetListOfFiles();
0073     TIter next(fileElements);
0074     TChainElement *chEl = 0;
0075     while ((chEl = (TChainElement *) next()))
0076     {
0077       TFile f(chEl->GetTitle());
0078 
0079       TH1 *h = (TH1 *) f.GetObjectChecked("hNormalization", "TH1");
0080       assert(h);
0081       if (hNormalization == NULL)
0082       {
0083         hNormalization = (TH1 *) h->Clone("hNormalization");
0084         hNormalization->SetDirectory(NULL);
0085       }
0086       else
0087       {
0088         hNormalization->Add(h);
0089       }
0090     }
0091   }
0092 
0093   TFile *ftmp = TFile::Open(infile + TString("_tmp.root"), "recreate");
0094   assert(ftmp);
0095   assert(hNormalization);
0096   hNormalization->SetDirectory(ftmp);
0097 
0098   const double nEvent = hNormalization->GetBinContent(1);
0099 
0100   AmplitudeCheck();
0101 
0102   HitPositionCheck();
0103   EventCheck();
0104   ChannelCheck();
0105 }
0106 
0107 void HitPositionCheck()
0108 {
0109   assert(_file0);
0110 
0111   const double nEvent = hNormalization->GetBinContent(1);
0112 
0113   TCanvas *c1 = new TCanvas("HitPositionCheck", "HitPositionCheck", 1900, 900);
0114   c1->Divide(2, 1);
0115   int idx = 1;
0116   TPad *p;
0117 
0118   p = (TPad *) c1->cd(idx++);
0119   c1->Update();
0120   //  p->SetLogy();
0121 
0122   eventT->Draw("Clusters.avg_padx:xray_x >>hSingleClusterXMap(50,-.5,49.5,50,-.5,49.5)",
0123                "Clusters[0].peak * (nClusters==1)", "colz");
0124   //  hSingleClusterPeak1->Scale(1. / nEvent);
0125   hSingleClusterXMap->SetTitle(";X-ray Gun x-position;Single cluster <x>");
0126 
0127   p = (TPad *) c1->cd(idx++);
0128   c1->Update();
0129   //  p->SetLogy();
0130 
0131   eventT->Draw("Clusters.avg_pady:xray_y >>hSingleClusterYMap(10,-.5,9.5,10,-.5,9.5)",
0132                "Clusters[0].peak * (nClusters==1)", "colz");
0133   //  hSingleClusterPeak1->Scale(1. / nEvent);
0134   hSingleClusterYMap->SetTitle(";X-ray Gun y-position;Single cluster <y>");
0135 
0136   SaveCanvas(c1, TString(_file0->GetName()) + TString(c1->GetName()), kTRUE);
0137 }
0138 
0139 void AmplitudeCheck()
0140 {
0141   assert(_file0);
0142 
0143   const double nEvent = hNormalization->GetBinContent(1);
0144 
0145   TCanvas *c1 = new TCanvas("AmplitudeCheck", "AmplitudeCheck", 1900, 960);
0146   c1->Divide(1, 2);
0147   int idx = 1;
0148   TPad *p;
0149 
0150   p = (TPad *) c1->cd(idx++);
0151   c1->Update();
0152   //  p->SetLogy();
0153 
0154   eventT->Draw("Clusters[0].peak:(Clusters.avg_pady - 6)*50 + Clusters.avg_padx>>hSingleClusterAmplitudeStrip(250,-.5,249.5,200,0,1000)",
0155                "nClusters==1", "colz");
0156   //  hSingleClusterPeak1->Scale(1. / nEvent);
0157   hSingleClusterAmplitudeStrip->SetTitle(";Single 1-pad Cluster Central Strip index: (Pad_Y-6)*50 + Pad_X;Single Cluster Energy [adc]");
0158 
0159   p = (TPad *) c1->cd(idx++);
0160   c1->Update();
0161   //  p->SetLogy();
0162 
0163   eventT->Draw("Clusters[0].peak:(Clusters.avg_pady - 6)*50 + Clusters.avg_padx>>hSingle1PadClusterAmplitudeStrip(250,-.5,249.5,200,0,1000)",
0164                "nClusters==1 && Clusters[0].size_pad_x == 1 && Clusters[0].size_pad_y == 1", "colz");
0165   //  hSingleClusterPeak1->Scale(1. / nEvent);
0166   hSingle1PadClusterAmplitudeStrip->SetTitle(";Single 1-pad Cluster Central Strip index: (Pad_Y-6)*50 + Pad_X;Single 1-pad Cluster Energy [adc]");
0167 
0168   SaveCanvas(c1, TString(_file0->GetName()) + TString(c1->GetName()), kTRUE);
0169 }
0170 
0171 void EventCheck()
0172 {
0173   assert(_file0);
0174 
0175   const double nEvent = hNormalization->GetBinContent(1);
0176 
0177   TCanvas *c1 = new TCanvas("EventCheck", "EventCheck", 1900, 960);
0178   c1->Divide(4, 2);
0179   int idx = 1;
0180   TPad *p;
0181   p = (TPad *) c1->cd(idx++);
0182   c1->Update();
0183   p->SetLogy();
0184   //  p->SetLeftMargin(.2);
0185   //  p->SetRightMargin(.15);
0186   //  p->SetTopMargin(.15);
0187 
0188   //  p->DrawFrame(-200,-200,200,200);
0189 
0190   eventT->Draw("nClusters>>hnClusters(10,-.5,9.5)");
0191   //  hsampa_address->Scale(1. / nEvent);
0192   hnClusters->SetTitle(";Number of clusters;event count");
0193 
0194   p = (TPad *) c1->cd(idx++);
0195   c1->Update();
0196   //  p->SetLogz();
0197   //  p->SetLeftMargin(.2);
0198   //  p->SetRightMargin(.15);
0199   //  p->SetTopMargin(.15);
0200 
0201   //  p->DrawFrame(-200,-200,200,200);
0202 
0203   eventT->Draw("bx_counter>>hbx_counter(1000,0,1000000)");
0204   //  hsampa_address->Scale(1. / nEvent);
0205   hbx_counter->SetTitle(";bx_counter;event count");
0206 
0207   p = (TPad *) c1->cd(idx++);
0208   c1->Update();
0209   p->SetLogz();
0210   //  p->SetLeftMargin(.2);
0211   p->SetRightMargin(.15);
0212   //  p->SetTopMargin(.15);
0213 
0214   //  p->DrawFrame(-200,-200,200,200);
0215 
0216   eventT->Draw("Clusters.avg_pady:Clusters.avg_padx>>hAllClusterPad(50,-.5,49.5,12,-.5,11.5)", "nClusters>=1", "colz");
0217   hAllClusterPad->SetTitle(";All Cluster <Pad X>;All Cluster <Pad Y>");
0218 
0219   p = (TPad *) c1->cd(idx++);
0220   c1->Update();
0221   p->SetLogy();
0222   //  p->SetLeftMargin(.2);
0223   //  p->SetRightMargin(.15);
0224   //  p->SetTopMargin(.15);
0225 
0226   //  p->DrawFrame(-200,-200,200,200);
0227 
0228   eventT->Draw("Clusters.peak>>hAllClusterPeak(180,0,1800)", "nClusters>=1");
0229   hAllClusterPeak->Scale(1. / nEvent);
0230   hAllClusterPeak->SetTitle(";All Cluster Energy [adc];cluster count/event/adc bin");
0231 
0232   p = (TPad *) c1->cd(idx++);
0233   c1->Update();
0234   p->SetLogz();
0235   //  p->SetLeftMargin(.2);
0236   p->SetRightMargin(.15);
0237   //  p->SetTopMargin(.15);
0238 
0239   //  p->DrawFrame(-200,-200,200,200);
0240 
0241   eventT->Draw("Clusters[0].avg_pady:Clusters[0].avg_padx>>hSingleClusterPad(50,-.5,49.5,12,-.5,11.5)", "nClusters==1", "colz");
0242   hSingleClusterPad->SetTitle(";Single Cluster <Pad X>;Single Cluster <Pad Y>");
0243 
0244   p = (TPad *) c1->cd(idx++);
0245   c1->Update();
0246   p->SetLogy();
0247   //  p->SetLeftMargin(.2);
0248   //  p->SetRightMargin(.15);
0249   //  p->SetTopMargin(.15);
0250 
0251   //  p->DrawFrame(-200,-200,200,200);
0252 
0253   eventT->Draw("Clusters[0].peak>>hSingleClusterPeak(180,0,1800)", "nClusters==1");
0254   hSingleClusterPeak->Scale(1. / nEvent);
0255   hSingleClusterPeak->SetTitle(";Single Cluster Energy [adc];Single cluster count/event/adc bin");
0256 
0257   p = (TPad *) c1->cd(idx++);
0258   c1->Update();
0259   p->SetLogz();
0260   //  p->SetLeftMargin(.2);
0261   p->SetRightMargin(.15);
0262   //  p->SetTopMargin(.15);
0263 
0264   //  p->DrawFrame(-200,-200,200,200);
0265 
0266   eventT->Draw("Clusters[0].avg_pady:Clusters[0].avg_padx>>hSingleClusterPad1(50,-.5,49.5,12,-.5,11.5)", "nClusters==1 && Clusters[0].size_pad_x == 1 && Clusters[0].size_pad_y == 1", "colz");
0267   hSingleClusterPad1->SetTitle(";Single 1-pad Cluster <Pad X>;Single 1-pad Cluster <Pad Y>");
0268 
0269   p = (TPad *) c1->cd(idx++);
0270   c1->Update();
0271   p->SetLogy();
0272   //  p->SetLeftMargin(.2);
0273   //  p->SetRightMargin(.15);
0274   //  p->SetTopMargin(.15);
0275 
0276   //  p->DrawFrame(-200,-200,200,200);
0277 
0278   eventT->Draw("Clusters[0].peak>>hSingleClusterPeak1(180,0,1800)", "nClusters==1 && Clusters[0].size_pad_x == 1 && Clusters[0].size_pad_y == 1");
0279   hSingleClusterPeak1->Scale(1. / nEvent);
0280   hSingleClusterPeak1->SetTitle(";Single 1-pad Cluster Energy [adc];Single cluster count/event/adc bin");
0281   //  p = (TPad *) c1->cd(idx++);
0282   //  c1->Update();
0283   //  p->SetLogz();
0284   //  //  p->SetLeftMargin(.2);
0285   //  p->SetRightMargin(.15);
0286   //  //  p->SetTopMargin(.15);
0287   //
0288   //  //  p->DrawFrame(-200,-200,200,200);
0289   //
0290   //  eventT->Draw("Clusters[0].avg_pady:Clusters[0].avg_padx>>hSingleClusterPad11(50,-.5,49.5,12,-.5,11.5)", "nClusters==1 && Clusters[0].avg_padx<=11", "colz");
0291   //  hSingleClusterPad11->SetTitle(";Single Cluster <Pad X> | Padx<=11;Single Cluster <Pad Y>");
0292   //
0293   //  p = (TPad *) c1->cd(idx++);
0294   //  c1->Update();
0295   //  p->SetLogy();
0296   //  //  p->SetLeftMargin(.2);
0297   //  //  p->SetRightMargin(.15);
0298   //  //  p->SetTopMargin(.15);
0299   //
0300   //  //  p->DrawFrame(-200,-200,200,200);
0301   //
0302   //  eventT->Draw("Clusters[0].peak>>hSingleClusterPeak11(180,0,1800)", "nClusters==1 && Clusters[0].avg_padx<=11");
0303   //  hSingleClusterPeak11->Scale(1. / nEvent);
0304   //  hSingleClusterPeak11->SetTitle(";Single Cluster Energy [adc] | Padx<=11;Single cluster count/event/adc bin");
0305 
0306   SaveCanvas(c1, TString(_file0->GetName()) + TString(c1->GetName()), kTRUE);
0307 
0308   ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0309 
0310   TCanvas *c1 = new TCanvas("EventCheck_MultiClusterEvent", "EventCheck_MultiClusterEvent", 1900, 960);
0311   c1->Divide(4, 2);
0312   int idx = 1;
0313   TPad *p;
0314 
0315   p = (TPad *) c1->cd(idx++);
0316   c1->Update();
0317   p->SetLogz();
0318   //  p->SetLeftMargin(.2);
0319   p->SetRightMargin(.15);
0320   //  p->SetTopMargin(.15);
0321 
0322   //  p->DrawFrame(-200,-200,200,200);
0323 
0324   eventT->Draw("Sum$(Clusters[].avg_pady * Clusters[].peak)/Sum$(Clusters[].peak):Sum$(Clusters[].avg_padx * Clusters[].peak)/Sum$(Clusters[].peak)>>hSumClusterPad(50,-.5,49.5,12,-.5,11.5)", "nClusters>=2", "colz");
0325   hSumClusterPad->SetTitle(";Energy Weighted Multi-Cluster <Pad X>;Energy Weighted Multi-Cluster <Pad Y>");
0326 
0327   p = (TPad *) c1->cd(idx++);
0328   c1->Update();
0329   p->SetLogy();
0330   //  p->SetLeftMargin(.2);
0331   //  p->SetRightMargin(.15);
0332   //  p->SetTopMargin(.15);
0333 
0334   //  p->DrawFrame(-200,-200,200,200);
0335 
0336   eventT->Draw("Sum$(Clusters[].peak)>>hSumlusterPeak(180,0,1800)", "nClusters>=2");
0337   hSumlusterPeak->Scale(1. / nEvent);
0338   hSumlusterPeak->SetTitle(";Multi-cluster Sum Cluster Energy [adc];Multi-cluster event/all event/adc bin");
0339 
0340   p = (TPad *) c1->cd(idx++);
0341   c1->Update();
0342   p->SetLogz();
0343   //  p->SetLeftMargin(.2);
0344   p->SetRightMargin(.15);
0345   //  p->SetTopMargin(.15);
0346 
0347   //  p->DrawFrame(-200,-200,200,200);
0348 
0349   eventT->Draw("Clusters[0].avg_pady:Clusters[0].avg_padx>>hLeadClusterPad(50,-.5,49.5,12,-.5,11.5)", "nClusters>=2", "colz");
0350   hLeadClusterPad->SetTitle(";Lead Cluster <Pad X>;Lead Cluster <Pad Y>");
0351 
0352   p = (TPad *) c1->cd(idx++);
0353   c1->Update();
0354   p->SetLogy();
0355   //  p->SetLeftMargin(.2);
0356   //  p->SetRightMargin(.15);
0357   //  p->SetTopMargin(.15);
0358 
0359   //  p->DrawFrame(-200,-200,200,200);
0360 
0361   eventT->Draw("Clusters[0].peak>>hLeadClusterPeak(180,0,1800)", "nClusters>=2");
0362   hLeadClusterPeak->Scale(1. / nEvent);
0363   hLeadClusterPeak->SetTitle(";Lead Cluster Energy [adc];cluster count/event/adc bin");
0364 
0365   p = (TPad *) c1->cd(idx++);
0366   c1->Update();
0367   p->SetLogz();
0368   //  p->SetLeftMargin(.2);
0369   p->SetRightMargin(.15);
0370   //  p->SetTopMargin(.15);
0371 
0372   //  p->DrawFrame(-200,-200,200,200);
0373 
0374   eventT->Draw("Clusters.avg_pady:Clusters.avg_padx>>hNonLeadClusterPad(50,-.5,49.5,12,-.5,11.5)", "nClusters>=2 && Iteration$>=2", "colz");
0375   hNonLeadClusterPad->SetTitle(";Secondary+ Cluster <Pad X>;Secondary+ Cluster <Pad Y>");
0376 
0377   p = (TPad *) c1->cd(idx++);
0378   c1->Update();
0379   p->SetLogy();
0380   //  p->SetLeftMargin(.2);
0381   //  p->SetRightMargin(.15);
0382   //  p->SetTopMargin(.15);
0383 
0384   //  p->DrawFrame(-200,-200,200,200);
0385 
0386   eventT->Draw("Clusters.peak>>hNonLeadClusterPeak(180,0,1800)", "nClusters>=2 && Iteration$>=2");
0387   hNonLeadClusterPeak->Scale(1. / nEvent);
0388   hNonLeadClusterPeak->SetTitle(";Secondary+ Cluster Energy [adc];cluster count/event/adc bin");
0389 
0390   p = (TPad *) c1->cd(idx++);
0391   c1->Update();
0392   p->SetLogy();
0393   //  p->SetLeftMargin(.2);
0394   //  p->SetRightMargin(.15);
0395   //  p->SetTopMargin(.15);
0396 
0397   //  p->DrawFrame(-200,-200,200,200);
0398   eventT->Draw("Clusters[].min_sample +  Clusters[].peak_sample - (Clusters[0].min_sample + Clusters[0].peak_sample)>>htimediff(600,-30,30)", "nClusters>=2 && Iteration$>=1");
0399   htimediff->Scale(1. / nEvent);
0400   htimediff->SetTitle(";2nd+ - Primary Cluster Time [ADC Sample];Secondary clusters/all event/bin");
0401 
0402   p = (TPad *) c1->cd(idx++);
0403   c1->Update();
0404   p->SetLogy();
0405   //  p->SetLeftMargin(.2);
0406   //  p->SetRightMargin(.15);
0407   //  p->SetTopMargin(.15);
0408 
0409   //  p->DrawFrame(-200,-200,200,200);
0410   eventT->Draw("Clusters[].avg_padx - Clusters[0].avg_padx>>hpadxdiff(180,-30,30)", "nClusters>=2 && Iteration$>=1");
0411   hpadxdiff->Scale(1. / nEvent);
0412   hpadxdiff->SetTitle(";2nd+ - Primary Cluster <X> [pad x];Secondary clusters/all event/bin");
0413 
0414   SaveCanvas(c1, TString(_file0->GetName()) + TString(c1->GetName()), kTRUE);
0415 }
0416 
0417 void ChannelCheck()
0418 {
0419   assert(_file0);
0420 
0421   const double nEvent = hNormalization->GetBinContent(1);
0422 
0423   TCanvas *c1 = new TCanvas("ChannelCheck", "ChannelCheck", 1900, 960);
0424   c1->Divide(4, 2);
0425   int idx = 1;
0426   TPad *p;
0427 
0428   p = (TPad *) c1->cd(idx++);
0429   c1->Update();
0430   //  p->SetLogz();
0431   //  p->SetLeftMargin(.2);
0432   //  p->SetRightMargin(.15);
0433   //  p->SetTopMargin(.15);
0434 
0435   //  p->DrawFrame(-200,-200,200,200);
0436 
0437   chanT->Draw("sampa_address>>hsampa_address(8,-.5,7.5)");
0438   hsampa_address->Scale(1. / nEvent);
0439   hsampa_address->SetTitle(";sampa_address;channel count/event");
0440 
0441   p = (TPad *) c1->cd(idx++);
0442   c1->Update();
0443   //  p->SetLogz();
0444   //  p->SetLeftMargin(.2);
0445   //  p->SetRightMargin(.15);
0446   //  p->SetTopMargin(.15);
0447 
0448   //  p->DrawFrame(-200,-200,200,200);
0449 
0450   chanT->Draw("sampa_channel>>hsampa_channel(50,-10.5,39.5)");
0451   hsampa_channel->Scale(1. / nEvent);
0452   hsampa_channel->SetTitle(";sampa_channel;channel count/event");
0453 
0454   p = (TPad *) c1->cd(idx++);
0455   c1->Update();
0456   //  p->SetLogz();
0457   //  p->SetLeftMargin(.2);
0458   //  p->SetRightMargin(.15);
0459   //  p->SetTopMargin(.15);
0460 
0461   //  p->DrawFrame(-200,-200,200,200);
0462 
0463   chanT->Draw("fee_channel>>hfee_channel(256,-.5,255.5)");
0464   hfee_channel->Scale(1. / nEvent);
0465   hfee_channel->SetTitle(";fee_channel;channel count/event");
0466 
0467   p = (TPad *) c1->cd(idx++);
0468   c1->Update();
0469   //  p->SetLogz();
0470   //  p->SetLeftMargin(.2);
0471   //  p->SetRightMargin(.15);
0472   //  p->SetTopMargin(.15);
0473 
0474   //  p->DrawFrame(-200,-200,200,200);
0475 
0476   chanT->Draw("size>>hsize(1000,0,1000)");
0477   hsize->Scale(1. / nEvent);
0478   hsize->SetTitle(";size;channel count/event");
0479 
0480   p = (TPad *) c1->cd(idx++);
0481   c1->Update();
0482   //  p->SetLogz();
0483   //  p->SetLeftMargin(.2);
0484   //  p->SetRightMargin(.15);
0485   //  p->SetTopMargin(.15);
0486 
0487   //  p->DrawFrame(-200,-200,200,200);
0488 
0489   chanT->Draw("packet_type>>hpacket_type(10,-.5,9.5)");
0490   hpacket_type->Scale(1. / nEvent);
0491   hpacket_type->SetTitle(";packet_type;channel count/event");
0492 
0493   p = (TPad *) c1->cd(idx++);
0494   c1->Update();
0495   p->SetLogz();
0496   //  p->SetLeftMargin(.2);
0497   p->SetRightMargin(.15);
0498   //  p->SetTopMargin(.15);
0499 
0500   //  p->DrawFrame(-200,-200,200,200);
0501 
0502   chanT->Draw("adc:Iteration$>>hpersistent(150,-.5,149.5,1100,-.5,1099.5)", "", "colz");
0503   hpersistent->SetTitle(";ADC Sample ID;adc");
0504 
0505   p = (TPad *) c1->cd(idx++);
0506   c1->Update();
0507   p->SetLogy();
0508   p->SetLogz();
0509   //  p->SetLeftMargin(.2);
0510   p->SetRightMargin(.15);
0511   //  p->SetTopMargin(.15);
0512 
0513   //  p->DrawFrame(-200,-200,200,200);
0514 
0515   chanT->Draw("pedestal:fee_channel>>h_pedestalfee_channel(256,-.5,255.5,1100,-.5,1099.5)", "", "colz");
0516   h_pedestalfee_channel->SetTitle(";fee_channel;Median sample as pedestal [adc]");
0517 
0518   p = (TPad *) c1->cd(idx++);
0519   c1->Update();
0520   p->SetLogz();
0521   //  p->SetLeftMargin(.2);
0522   p->SetRightMargin(.15);
0523   //  p->SetTopMargin(.15);
0524 
0525   //  p->DrawFrame(-200,-200,200,200);
0526 
0527   chanT->Draw("max - pedestal:fee_channel>>h_maxfee_channel(256,-.5,255.5,1100,.5,1100.5)", "", "colz");
0528   h_maxfee_channel->SetTitle(";fee_channel;max sample - pedestal [adc]");
0529 
0530   SaveCanvas(c1, TString(_file0->GetName()) + TString(c1->GetName()), kTRUE);
0531 
0532   //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0533   TCanvas *c1 = new TCanvas("ChannelCheck_ChannelMap", "ChannelCheck_ChannelMap", 1000, 560);
0534   //  c1->Divide(4, 2);
0535   int idx = 1;
0536   TPad *p;
0537   p = (TPad *) c1->cd(idx++);
0538   c1->Update();
0539   p->SetLogz();
0540   //  p->SetLeftMargin(.2);
0541   p->SetRightMargin(.15);
0542   //  p->SetTopMargin(.15);
0543 
0544   chanT->Draw("pad_y:pad_x>>hpadMap(60,-10.5,49.5,15,.5,15.5)", "max - pedestal", "colz");
0545   TH2 *hpadMap = (TH2 *) gDirectory->FindObject("hpadMap");
0546   hpadMap->Scale(1. / nEvent);
0547   hpadMap->SetTitle(";pad X;pad Y");
0548   //  TPaletteAxis *pal = (TPaletteAxis *) (hpadMap->GetListOfFunctions()->FindObject( "palette"  ));
0549   //  pal->GetAxis()->SetTitle("(max - pedestal)/event [adc]");
0550 
0551   SaveCanvas(c1, TString(_file0->GetName()) + TString(c1->GetName()), kTRUE);
0552 }