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5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/extended/medical/dna/chem6/plotG_LET.C (Version 11.3.0) and /examples/extended/medical/dna/chem6/plotG_LET.C (Version 10.2.p1)


  1 struct SpeciesInfo                                  1 
  2 {                                                 
  3    SpeciesInfo()                                  
  4    {                                              
  5    }                                              
  6    SpeciesInfo(const SpeciesInfo& right) :        
  7       fG(right.fG),                               
  8       fGerr(right.fGerr),                         
  9       fLET(right.fLET),                           
 10       fLETerr(right.fLETerr),                     
 11       fName(right.fName)                          
 12    {}                                             
 13    SpeciesInfo& operator=(const SpeciesInfo& r    
 14    {                                              
 15       if(this == &right) return *this;            
 16       fG = right.fG;                              
 17       fGerr = right.fGerr;                        
 18       fLET = right.fLET;                          
 19       fLETerr = right.fLETerr;                    
 20       fName = right.fName;                        
 21       return *this;                               
 22    }                                              
 23                                                   
 24    std::vector<Double_t> fG;                      
 25    std::vector<Double_t> fGerr;                   
 26    std::vector<Double_t> fLET;                    
 27    std::vector<Double_t> fLETerr;                 
 28    string fName;                                  
 29 };                                                
 30                                                   
 31 const char* filetypes[] = {                       
 32    "PostScript", "*.ps",                          
 33    "Encapsulated PostScript", "*.eps",            
 34    "PDF files", "*.pdf",                          
 35    "Gif files", "*.gif",                          
 36    "PNG files", "*.png",                          
 37    "All files", "*",                              
 38    0, 0                                           
 39 };                                                
 40                                                   
 41 TGTab *gTab = nullptr;                            
 42                                                   
 43 void Save()                                       
 44 {                                                 
 45   TGFileInfo fi;                                  
 46   fi.fFileTypes = filetypes;                      
 47                                                   
 48   new TGFileDialog(gClient->GetRoot(),gClient-    
 49   gROOT->GetListOfCanvases()->At(gTab->GetCurr    
 50 }                                                 
 51                                                   
 52 void plotG_LET()                                  
 53 {                                                 
 54                                                   
 55    std::map<Int_t, SpeciesInfo> speciesInfo;      
 56                                                   
 57    gROOT->SetStyle("Plain");                      
 58    gStyle->SetPalette(1);                         
 59    gStyle->SetCanvasBorderMode(0);                
 60    gStyle->SetFrameBorderMode(0);                 
 61    gStyle->SetPadTickX(1);                        
 62    gStyle->SetPadTickY(1);                        
 63                                                   
 64    TGMainFrame *main = new TGMainFrame(gClient    
 65    gTab = new TGTab(main, 200, 200);              
 66                                                   
 67    Int_t ncols, tag, runID;                       
 68    Double_t LET, LET_sigma, Gvalue, Gvalue_sig    
 69    string name;                                   
 70    string dummy;                                  
 71    string string_key, string_value;               
 72                                                   
 73    ifstream file;                                 
 74    file.open("Species.txt",std::ios::in);         
 75                                                   
 76    runID = 0;                                     
 77                                                   
 78    while(1) {                                     
 79       // Read LET values                          
 80       file >> dummy >> LET >> dummy >> LET_sig    
 81       if (file.eof()) break;                      
 82                                                   
 83       std::getline(file,dummy);                   
 84                                                   
 85       if (!std::getline(file,string_key)) brea    
 86       std::istringstream key(string_key); // R    
 87       if (!std::getline(file,string_value)) br    
 88       std::istringstream value(string_value);     
 89       while(1) {                                  
 90          key >> name >> tag;                      
 91          value >> Gvalue >> Gvalue_sigma;         
 92          if (!key || !value) break;               
 93          speciesInfo[tag].fName = name;           
 94          speciesInfo[tag].fG.resize(runID+1);     
 95          speciesInfo[tag].fGerr.resize(runID+1    
 96          speciesInfo[tag].fLET.resize(runID+1)    
 97          speciesInfo[tag].fLETerr.resize(runID    
 98                                                   
 99          speciesInfo[tag].fG[runID] = Gvalue;     
100          speciesInfo[tag].fGerr[runID] = Gvalu    
101          speciesInfo[tag].fLET[runID] = LET;      
102          speciesInfo[tag].fLETerr[runID] = LET    
103       }                                           
104       runID++;                                    
105    }                                              
106    file.close();                                  
107                                                   
108    for (auto it_map : speciesInfo) {              
109                                                   
110       auto map = it_map.second;                   
111       TGraphErrors* gSpecies = new TGraphError    
112                                                   
113                                                   
114                                                   
115                                                   
116                                                   
117       Int_t color = (2+it_map.first)%TColor::G    
118       if (color == 5 || color == 10 || color =    
119                                                   
120                                                   
121       TGCompositeFrame *tf = gTab->AddTab(map.    
122       TGCompositeFrame *frame = new TGComposit    
123                                                   
124                                                   
125       tf->AddFrame(frame, new TGLayoutHints(kL    
126                    10,10,10,2));                  
127                                                   
128       TRootEmbeddedCanvas *c1 = new TRootEmbed    
129                                                   
130       frame->AddFrame(c1, new TGLayoutHints(kL    
131                       10,10,10,2));               
132       c1->GetCanvas()->SetLogx();                 
133                                                   
134       TGHorizontalFrame* hframe = new TGHorizo    
135                                                   
136       TGTextButton* save = new TGTextButton(hf    
137                                             "S    
138       hframe->AddFrame(save, new TGLayoutHints    
139                                                   
140       TGTextButton *exit = new TGTextButton(hf    
141                                             "g    
142       hframe->AddFrame(exit, new TGLayoutHints    
143                                                   
144       tf->AddFrame(hframe, new TGLayoutHints(k    
145                                                   
146       gSpecies->SetTitle(map.fName.c_str());      
147       gSpecies->SetMarkerStyle(20+it_map.first    
148       gSpecies->SetMarkerColor(color);            
149       gSpecies->GetXaxis()->SetTitle("LET (keV    
150       gSpecies->GetXaxis()->SetTitleOffset(1.1    
151       gSpecies->GetYaxis()->SetTitle("G value     
152       gSpecies->GetYaxis()->SetTitleOffset(1.2    
153       gSpecies->Draw("AP");                       
154    }                                              
155                                                   
156    main->AddFrame(gTab, new TGLayoutHints(kLHi    
157                                           kLHi    
158                                                   
159    main->MapSubwindows();                         
160    main->Resize();   // resize to default size    
161    main->MapWindow();                             
162 }                                                 
163                                                   
164