CMS 3D CMS Logo

TmTestWidget.cc

Go to the documentation of this file.
00001 #include "CommonTools/TrackerMap/interface/TmTestWidget.h"
00002 TmTestWidget::TmTestWidget(QWidget *parent, const char *wname)
00003         : QWidget(parent,wname)
00004  {
00005     VisTrackerMapBox* tkMapBox = new VisTrackerMapBox(0,"trackermap");
00006    QGridLayout *grid = new QGridLayout( this, 1, 1, 10 );
00007     TrackerMap *tm = tkMapBox->getTrackerMap();
00008     tkMapBox->show();
00009     f = new TFile("Tracker.root");   
00010    char  name[10];
00011     TString title;
00012      string s;
00013     int key;
00014    Int_t i;
00015      i=0;
00016      cout << "Be patient: I have to process around 17,000 histograms!" << endl;
00017      map<const int,TmModule*>::iterator imod;
00018     for (imod=tm->imoduleMap.begin();imod != tm->imoduleMap.end(); imod++){
00019      i++;if(i%100==0)cout << i << endl;
00020      sprintf(name,"%d",imod->second->idex);
00021      TH1F *h = (TH1F*)f->Get(name);
00022      if(h>0){
00023      title= h->GetTitle();
00024     tm->fill(imod->second->idex,(float) h->GetMean());
00025     ostringstream outs;
00026     outs<< "Mean Adc "<<h->GetMean()<<"  RMS ADC "<<h->GetRMS()<<"  ;"<<h->GetEntries()<<" digi in this module";
00027     s = outs.str();
00028      //cout <<key << " "<< s  << endl;
00029     tm->setText(imod->second->idex,s);
00030     }
00031     }
00032 
00033 
00034       TCanvas* c=new TCanvas( "c", "Adc map", 400, 500);
00035    //setup paint options defines the same variables that where used before
00036   //calling the print method of trackermap
00037     tkMapBox->setPaintOptions(true,0,500);
00038    //grid->addWidget( tkMapBox, 0, 0 );
00039    QObject::connect(tkMapBox, SIGNAL(moduleSelected(int)),this,SLOT(write(int)));
00040                                                                                 
00041   //to be called when you want to repaint the trackemap
00042     tkMapBox->update();
00043 
00044  }
00045   void TmTestWidget::paintEvent(QPaintEvent *){
00046              QPainter *p = new QPainter( this );
00047              QPixmap pxm;
00048             pxm.load("1000001.ppm");
00049             p->drawPixmap(0,0,pxm);
00050   }
00051   void TmTestWidget::write(int moduleGeomdetId){cout <<  "module" << moduleGeomdetId <<"  clicked!" << endl;
00052       char  name[10];
00053      sprintf(name,"%d",moduleGeomdetId);
00054      TH1F *h = (TH1F*)f->Get(name);
00055      if(h>0){
00056      TPostScript myps("1000.ps",113);
00057      h->Draw();
00058      myps.Close();
00059      system("pstopnm 1000.ps");
00060      system("rm -f 1000.ps");
00061      repaint();
00062       }
00063 } 
00064 TmTestWidget::~TmTestWidget(){
00065     f->Close();
00066     }

Generated on Tue Jun 9 17:26:03 2009 for CMSSW by  doxygen 1.5.4