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/RawDec.C at main · MFTDecoding/DecodingScripts Expand file tree/ Copy pathRawDec.CMore file actions 102 lines (96 loc) · 2.88 KB / Copy pathRawDec.CFile metadata and controls102 lines (96 loc) · 2.88 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 #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> using namespace o2::base; using namespace o2::detectors; using o2::itsmft::Digit; vector <int> getChipDec() { fstream inputDec; //read chip_ID.txt in order to have the number of chip in raw data file inputDec.open("/home/alice/alice/output/Chip_ID.txt", ios_base::in); vector <int> vecChipDec; int ChipDecod; int sizeVecDec=vecChipDec.size(); while(inputDec >> ChipDecod) { vecChipDec.push_back(ChipDecod); } for(int n=0;n<sizeVecDec;n++) cout << vecChipDec[n] << endl; inputDec.close(); return vecChipDec; } vector<int> getTrans() { fstream inputTrans; //read chip_ID.txt in order to have the number of chip in raw data file inputTrans.open("/home/alice/alice/output/trans.txt", ios_base::in); vector <int> vecChipTrans; int ChipTransod; int sizeVecTrans=vecChipTrans.size(); while(inputTrans >> ChipTransod) { vecChipTrans.push_back(ChipTransod); } for(int n=0;n<sizeVecTrans;n++) cout << vecChipTrans[n] << endl; inputTrans.close(); return vecChipTrans; } void RawDec(const Char_t *inFile="/home/alice/alice/output/data-charge29.root",const Char_t *vpulselow="50"){ TFile *inputFile =new TFile(inFile); vector<int> vecChipDec=getChipDec(); int sizeVecDec=vecChipDec.size(); std::cout<<"How many chips? "<<sizeVecDec<<std::endl; Int_t vpulsel=std::stoi(vpulselow); Int_t vpulseh=170; Int_t chargeinj=vpulseh-vpulsel; vector<int> vecTrans=getTrans(); vector<vector<vector<short int>>> vecColRow(sizeVecDec); for(int i=0;i<sizeVecDec;i++){ for(int col=0;col<1024;col++){ std::vector<short int> vector1(512,0); vecColRow[i].push_back(vector1); } } TTree *tree=(TTree*)inputFile->Get("o2sim"); auto nentries=tree->GetEntries(); std::vector<o2::itsmft::Digit>* digArr = nullptr; tree->SetBranchAddress("MFTDigit", &digArr); for(int i=0;i<nentries;i++){ tree->GetEvent(i); Int_t nd = digArr->size(); cout<<"Number of digits: "<<nd<<endl; while (nd--) { Int_t binx,biny, bin, binmax; const Digit* d = &(*digArr)[nd]; Int_t chipID = d->getChipIndex(); for(int j=0;j<=sizeVecDec;j++){ if (chipID==vecChipDec[j]) vecColRow[j][d->getColumn()][d->getRow()]++; } } } ofstream output; output.open ("digit_coordinate.txt"); Int_t bin; for(int k=0;k<sizeVecDec;k++){ // to store the coordinate for the thr scan int kk = vecTrans[k]; for(int binx=0;binx<1024;binx++){ for(int biny=0;biny<512;biny++){ bin=vecColRow[k][binx][biny]; if(bin!=0)output<<kk<<" "<<binx-1<<" "<<biny-1<<" "<<bin-1<<" "<<vpulsel<<"\n"; } } } output.close(); } |
| 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. |