GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — DecodingScripts/macro/PlotMacro.C at main · MFTDecoding/DecodingScripts Expand file tree/ Copy pathPlotMacro.CMore file actions 121 lines (104 loc) · 3.12 KB / Copy pathPlotMacro.CFile metadata and controls121 lines (104 loc) · 3.12 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 #include <stdio.h> #include <math.h> #include "TROOT.h" #include "TFile.h" #include "TTree.h" #include "TBrowser.h" #include "TMath.h" #include "TRandom.h" #include "TCanvas.h" #include "TGraph.h" #include <sstream> #include <vector> #include <fstream> #include <string> using namespace std; using namespace o2::base; using namespace o2::detectors; using o2::itsmft::DigitHW; void PlotMacro(){ TFile *inputFile =new TFile("../output/data-d2-2020_12_08__16_03_04__-1.raw.root"); TTree *tree=(TTree*)inputFile->Get("o2sim"); UShort_t half, plane, zone, disk, chipindex, row, col, charge, counter, ninj, chargeinj, cableHW; auto nentries=tree->GetEntries(); vector<o2::itsmft::DigitHW>* digArr = nullptr; tree->SetBranchAddress("MFTDigit", &digArr); vector<int> vecChipDec; vector <string> vecHistoName; ostringstream os2; string str1; Int_t nd=0; for(int i=0;i<nentries;i++){ tree->GetEvent(0); nd = digArr->size(); while (nd--) { const DigitHW* d = &(*digArr)[nd]; chipindex = d->getChipIndex(); cableHW = d->getCableHW(); half = d->getHalf(); disk = d->getDisk(); plane = d->getPlane(); zone = d->getZone(); if(find (vecChipDec.begin(), vecChipDec.end(), chipindex)==vecChipDec.end()){ vecChipDec.push_back(chipindex); cout << chipindex << endl; os2<<"h" <<half<<"-f"<<plane<<"-d"<<disk<<"-z"<<zone<<"-trans"<<cableHW; str1 = os2.str(); os2.str(""); os2.clear(); cout << str1 << endl; vecHistoName.push_back(str1); } } } int sizeVecDec=vecChipDec.size(); int sizeVecHisto=vecHistoName.size(); if (sizeVecDec != sizeVecHisto) { cout << "Error size" <<endl; return 1; } gStyle->SetPalette(55); // Rainbow TCanvas *c1[sizeVecDec]; TH2F *hplot[sizeVecDec]; char *histoname = new char[sizeVecDec]; for(int i=0;i<sizeVecDec;i++){ hplot[i] = new TH2F(histoname,histoname,1024,0,1024,512,0,512); TString os1=vecHistoName[i]+";Cols;Rows"; TString os2=vecHistoName[i]; hplot[i]->SetName(os2); hplot[i]->SetTitle(os1); hplot[i]->GetName(); hplot[i]->GetTitle(); } for(int i=0;i<nentries;i++){ tree->GetEvent(i); nd = digArr->size(); cout<<"Events? "<<nd<<endl; while (nd--) { const DigitHW* d2 = &(*digArr)[nd]; chipindex = d2->getChipIndex(); // cout << "Transiever : " << cableHW << ", Half : " << half << ", Disk : " << disk << ", Plane : "<< plane << ", Zone : " << zone << endl; for(int j=0;j<sizeVecDec;j++){ if (chipindex==vecChipDec[j]){ hplot[j]->Fill(d2->getColumn(), d2->getRow()); } } } } for(int k=0;k<sizeVecDec;k++){ //to have the plot TString os2=vecHistoName[k]; c1[k]= new TCanvas(); c1[k]->SetName(os2); c1[k]->SetTitle(os2); c1[k]->GetName(); c1[k]->GetTitle(); c1[k]->cd(k); gStyle->SetOptStat(0); hplot[k]->Draw("colz PMC"); string histnamesave = "hist_"; histnamesave +=os2; histnamesave += ".pdf"; const char *finalname = histnamesave.c_str(); c1[k]->SaveAs(finalname); } } |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |