Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:15:08

0001 ///////////////////////////////////////////////////////////
0002 //         Jennifer James, Charles Hughes                //
0003 //          derived from files created by                //
0004 //         Aditya Dash and Thomas Marshall               //
0005 //                  May 19, 2023                         //
0006 ///////////////////////////////////////////////////////////
0007 
0008 // includes
0009 #ifndef __CINT__
0010 #include <algorithm>
0011 #include <cmath>
0012 #include "TCanvas.h"
0013 #include "TApplication.h"
0014 #include "TH1D.h"
0015 #include "TH1F.h"
0016 #include "TH2D.h"
0017 #include "TH2F.h"
0018 #include "TH3D.h"
0019 #include "TH3F.h"
0020 #include "TString.h"
0021 #include "TStyle.h"
0022 #include "TFile.h"
0023 #include "TGraphPolar.h"
0024 #include "TGraphPolargram.h"
0025 #include "TAxis.h"
0026 #include "TLatex.h"
0027 #include "TLegend.h"
0028 #include "TApplication.h"
0029 #include "TCanvas.h"
0030 #include "TMath.h"
0031 #include "TVirtualFitter.h"
0032 #include "Math/MinimizerOptions.h"
0033 #include "TFitResultPtr.h"
0034 #include "TFitResult.h"
0035 #include "TF1.h"
0036 #include "TPaveLabel.h"
0037 #include <string.h>
0038 #include <vector>
0039 #include <iostream>
0040 #include <RtypesCore.h>
0041 #endif
0042 
0043 using namespace std;
0044 
0045 void Locate(Int_t id, Bool_t is_ASIDE, Double_t *rbin, Double_t *thbin);
0046 
0047 
0048 void Noise_ModuleDisplay(){
0049 
0050   //  std::vector <pair<int,int>> vec1;
0051 
0052   bool skip_empty_fees = false;
0053 
0054   std::vector<pair<int,int>> vec; 
0055 
0056   char name[100];
0057   int run_num;
0058 
0059   cout << "Input run number: ";
0060   cin >> run_num;
0061 
0062   const TString filename3( Form( "./pedestal-%d-outfile.root",run_num,run_num) );
0063   //const TString filename3( Form( "/sphenix/u/jamesj3j3/workfest_Charles_mistake/sPHENIXProjects/pedestal-10131-outfile.root") );
0064 
0065   //    std::cout << "Analyze - filename2: " << filename2 << std::endl;
0066   //
0067   TFile *infile3 = TFile::Open(filename3);
0068   //        TFile* infile2 = TFile::Open(filename2);
0069   //
0070   if(!infile3) return;
0071 
0072   TNtuple * liveTntuple ;
0073   liveTntuple = (TNtuple*) infile3->Get("h_Alive");
0074 
0075   TNtuple * totTntuple ;
0076   totTntuple = (TNtuple*) infile3->Get("h_AliveTot");
0077   
0078   TH3F * dm2 = new TH3F("dm2","TPC map",26, -0.5, 25.5, 24, -0.5, 23.5, 3, 0.5, 3.5 );
0079   liveTntuple->Draw("module_id:sec_id:fee_id>>dm2","",""); //x axis = FEE ID, y axis = SEC ID, z axis = MODULE ID
0080 
0081   TH3F * h_AlivePedestalNoise = new TH3F("h_AlivePedestalNoise","TPC Alive Pedestal Noise of Std. Dev,",26, -0.5, 25.5, 24, -0.5, 23.5, 3, 0.5, 3.5 );
0082   liveTntuple->Draw("module_id:sec_id:fee_id>>h_AlivePedestalNoise","pedStdi * (pedStdi < 20)",""); //x axis = FEE ID, y axis = SEC ID, z axis = MODULE ID 
0083 
0084   TH3F * tot = new TH3F("tot"," TPC Tot Map", 26, -0.5, 25.5, 24, -0.5, 23.5, 3, 0.5, 3.5 );
0085   totTntuple->Draw("module_id:sec_id:fee_id>>tot","",""); //x axis = FEE ID, y axis = SEC ID, z axis = MODULE ID
0086   //h3->Draw("colz");
0087 
0088   dm2->Print();
0089   tot->Print(); 
0090 
0091   // std::vector<Float_t> frac_val;
0092   std::vector<Float_t> sub_arrA;
0093   std::vector<Float_t> sub_arrC;
0094 
0095   Float_t frac[dm2->GetNbinsX()][dm2->GetNbinsY()]; // array to store fractions                                                         
0096   std::vector<Float_t> module_std_dev; 
0097   
0098   for (Int_t i = 0; i < dm2->GetNbinsY(); i++) { // i is looping over sec ID                                                           
0099     //    if(fee->GetBinContent(i)<1){
0100     // continue;
0101     // }
0102     for (Int_t j = 0; j < dm2->GetNbinsZ(); j++) { // j is looping over Module ID 
0103 
0104       Float_t num=0; // numerator (live)                                      
0105       Float_t denom=0; // denominator (total)   
0106       Float_t sum_noise=0;
0107 
0108       for (Int_t k = 0; k < dm2->GetNbinsX(); k++) { // k is looping over FEE ID
0109 
0110     Float_t FEE_noise_sum = 0.0;
0111         
0112     if(h_AlivePedestalNoise->GetBinContent(k+1,i+1,j+1) > 0.0){
0113       if( skip_empty_fees){ //if you want to skip empty fees
0114         if( dm2->GetBinContent(k+1,i+1,j+1) >= 1){ //only add to numerator and denominator if FEE has at least 1 live channel
0115           num+=dm2->GetBinContent(k+1,i+1,j+1);
0116           denom+=tot->GetBinContent(k+1,i+1,j+1);
0117           sum_noise+=h_AlivePedestalNoise->GetBinContent(k+1,i+1,j+1);
0118         }
0119       }
0120       else { //if you don't want to skip empty fees
0121         num+=dm2->GetBinContent(k+1,i+1,j+1);
0122         denom+=tot->GetBinContent(k+1,i+1,j+1); 
0123         sum_noise+=h_AlivePedestalNoise->GetBinContent(k+1,i+1,j+1);
0124       }
0125     }
0126     FEE_noise_sum = h_AlivePedestalNoise->GetBinContent(k+1,i+1,j+1);
0127     std::cout << "Sec ID = " << i+1 << ", Module ID = " << j+1 << ", FEE ID = " << k+1 << ", Std. Dev. sum = " << FEE_noise_sum << std::endl;
0128       }     
0129                                                            
0130       Float_t frac_val= ( num / denom) * 100.0; // calculate the fraction 
0131       Float_t noise_value = sum_noise/num;
0132                                                                
0133       frac[i+1][j+1] = frac_val; // store fraction in array                                                                              
0134       std::cout << "Sec ID = " << i+1 << ", Module ID = " << j+1 << ", Live fraction = " << frac_val << "%" << std::endl;
0135       std::cout << "Sec ID = " << i+1 << ", Module ID = " << j+1 << ", Avg. Std. Dev. = " << noise_value << std::endl;
0136       if (i < 12) {
0137     sub_arrC.push_back(noise_value);
0138     //std::cout <<  " Live fraction C = " << sub_arrC.size() << " %" << std::endl;
0139     //std::cout << "sub_arrC[" << i << "] = " << frac_val << std::endl;
0140       }else {
0141     sub_arrA.push_back(noise_value);
0142     //std::cout << "sub_arrA[" << i << "] = " << frac_val << std::endl;
0143     //std::cout <<  " Size = " << sub_arrA.size() <<" %" << std::endl;
0144       }
0145     }
0146   }
0147 
0148   //////////////////////////////////////////////////////////////////////// 
0149   //       A Side   South Label Conventions                                  //  
0150   ///////////////////////////////////////////////////////////////////////  
0151   //   1 - 12_R1   16 - 17_R1   31 - 22_R1    
0152   //   2 - 12_R2   17 - 17_R2   32 - 22_R2   
0153   //   3 - 12_R3   18 - 17_R3   33 - 22_R3 
0154   //   4 - 13_R1   19 - 18_R1   34 - 23_R1
0155   //   5 - 13_R2   20 - 18_R2   35 - 23_R2
0156   //   6 - 13_R3   21 - 18_R3   36 - 23_R3
0157   //   7 - 14_R1   22 - 19_R1
0158   //   8 - 14_R2   23 - 19_R2
0159   //   9 - 14_R3   24 - 19_R3
0160   //  10 - 15_R1   25 - 20_R1
0161   //  11 - 15_R2   26 - 20_R2
0162   //  12 - 15_R3   27 - 20_R3
0163   //  13 - 16_R1   28 - 21_R1
0164   //  14 - 16_R2   29 - 21_R2
0165   //  15 - 16_R3   30 - 21_R3
0166   
0167   ////////////////////////////////////////////////////////////////////////
0168   //       C Side North Label Conventions                              //
0169   ///////////////////////////////////////////////////////////////////////
0170   //   1 - 00_R1   16 - 05_R1   31 - 10_R1    
0171   //   2 - 00_R2   17 - 05_R2   32 - 10_R2   
0172   //   3 - 00_R3   18 - 05_R3   33 - 10_R3 
0173   //   4 - 01_R1   19 - 06_R1   34 - 11_R1
0174   //   5 - 01_R2   20 - 06_R2   35 - 11_R2
0175   //   6 - 01_R3   21 - 06_R3   36 - 11_R3
0176   //   7 - 02_R1   22 - 07_R1
0177   //   8 - 02_R2   23 - 07_R2
0178   //   9 - 02_R3   24 - 07_R3
0179   //  10 - 03_R1   25 - 08_R1
0180   //  11 - 03_R2   26 - 08_R2
0181   //  12 - 03_R3   27 - 08_R3
0182   //  13 - 04_R1   28 - 09_R1
0183   //  14 - 04_R2   29 - 09_R2
0184   //  15 - 04_R3   30 - 09_R3
0185 
0186 
0187   gStyle->SetOptStat(0);
0188    
0189   // if have lists inside input file - create pointer to list
0190  
0191   /* // Open up the histograms from the infile and give new names
0192   THnSparseD* sparse = (THnSparseD *)infile1->Get("histsparse"); //get the sparse object and store it in memory
0193   if(!sparse){
0194   cout<<"sparse does not exist in "<<input1<<endl; //double check that it's in the file it should be !
0195     return;
0196   }
0197   sparse->THnSparse::GetAxis(2)->SetRange(1,15); //limit to ONLY real trips
0198   */ 
0199   //____________________________________________________________________________________________________// 
0200 
0201   // Heat map Visualization
0202 
0203   const Int_t N_rBins = 4; //(one inner bin NOT to be filled, 2nd bin is R1, 3rd bin is R2, 4th bin is R3)
0204   const Int_t N_thBins = 12; //(12 theta bins of uniform angle (360/12 = 30 degrees = TMath::Pi()/6 ~= 0.523 rad) )
0205 
0206   Double_t rBin_edges[N_rBins + 1] = {0.0, 0.256, 0.504, 0.752, 1.00}; //variable edges for the radial dimensions
0207 
0208   TGraphPolargram* polardummy1 = new TGraphPolargram("polardummy1",0,1,0,2.*TMath::Pi()); //dummy plots to get the canvas right (not to be filled)
0209   polardummy1->SetToGrad();
0210   polardummy1->SetNdivPolar(N_thBins);
0211   polardummy1->SetLineColor(0);
0212   polardummy1->SetRadialLabelSize(0);
0213 
0214   TGraphPolargram* polardummy2 = new TGraphPolargram("polardummy2",0,1,0,2.*TMath::Pi());
0215   polardummy2->SetToGrad();
0216   polardummy2->SetNdivPolar( N_thBins);
0217   polardummy2->SetLineColor(0);
0218   polardummy2->SetRadialLabelSize(0);
0219 
0220   for(Int_t i = 0 ; i < 12 ; i++){ //setting the axis label (CCW from horizontal right axis)
0221     char labelstr1[128];
0222     char labelstr2[128];
0223     if(i<=9){ // i -> [0:9]
0224       sprintf(labelstr2,"C0%d",i);
0225 
0226       if(i<=6){ // i -> [0:6] (halfway)
0227     sprintf(labelstr1,"A%d",18-i);
0228       }
0229       else if(i>6){ // i -> [7:9]
0230     sprintf(labelstr1,"A%d",30-i);
0231       }
0232 
0233     } 
0234     else { // i -> [10:11]
0235       sprintf(labelstr2,"C%d",i);
0236       sprintf(labelstr1,"A%d",30-i);
0237     }
0238     polardummy1->SetPolarLabel(i,labelstr1);
0239     polardummy2->SetPolarLabel(i,labelstr2);
0240   }
0241 
0242   TH2D* ErrASide = new TH2D( "ASide" , "ADC Counts North Side" , N_thBins, -TMath::Pi()/12. , 23.*TMath::Pi()/12. , N_rBins , rBin_edges ); // X maps to theta, Y maps to R
0243 
0244   TH2D* ErrCSide = new TH2D( "CSide" , "ADC Counts South Side" , N_thBins, -TMath::Pi()/12. , 23.*TMath::Pi()/12. , N_rBins , rBin_edges ); // X maps to theta, Y maps to R
0245 
0246 
0247   Double_t r, theta;
0248   Int_t trip_count_total = 0;
0249   Bool_t is_ASIDE = true;
0250 
0251   for (Int_t i = 0; i < 36; i++) {
0252     if(sub_arrA[i] > 0.0){
0253       Locate(i + 1, true, &r, &theta);
0254       ErrASide->Fill(theta, r, sub_arrA[i]);
0255       // cout<<"Region # A "<<(i)<<" Alive Fraction = "<<sub_arrA[i]<<endl; 
0256     }  
0257   }
0258 
0259   for (Int_t i = 0; i < 36; i++) {
0260     if(sub_arrC[i] > 0.0){
0261       Locate(i + 1,false, &r, &theta);
0262       ErrCSide->Fill(theta, r, sub_arrC[i]);
0263       // cout<<"Region # C "<<(i)<<" Alive Fraction = "<<sub_arrC[i]<<endl;   
0264     }
0265   }
0266    
0267   sprintf(name, "%d-Noise Std. Dev. in ADC (North Side)",run_num);
0268   TH2D* dummy_his1 = new TH2D("dummy1", name, 100, -1.5, 1.5, 100, -1.5, 1.5);
0269   //TH2D* dummy_his1 = new TH2D("dummy1", "10616-Noise map in ADC unit North Side", 100, -1.5, 1.5, 100, -1.5, 1.5); //dummy histos for titles
0270   sprintf(name, "%d-Noise Std. Dev. in ADC (South Side)",run_num);
0271   TH2D* dummy_his2 = new TH2D("dummy2", name, 100, -1.5, 1.5, 100, -1.5, 1.5);
0272   //TH2D* dummy_his2 = new TH2D("dummy2", "10616-Noise map in ADC unit South Side", 100, -1.5, 1.5, 100, -1.5, 1.5);
0273   //TPaveLabels for sector labels
0274   TPaveLabel* A00 = new TPaveLabel( 1.046586,-0.1938999,1.407997,0.2144871, "18" );
0275   TPaveLabel* A01 = new TPaveLabel( 0.962076,0.4382608,1.323487,0.8466479 , "17" );
0276   TPaveLabel* A02 = new TPaveLabel( 0.4801947,0.8802139,0.8416056,1.288601 , "16" );
0277   TPaveLabel* A03 = new TPaveLabel( -0.1823921,1.011681,0.1790189,1.425662, "15" );
0278   TPaveLabel* A04 = new TPaveLabel( -0.8449788,0.8690253,-0.4835679,1.288601 , "14" );
0279   TPaveLabel* A05 = new TPaveLabel( -1.30879,0.441058,-0.9473786,0.8550394 , "13" );
0280   TPaveLabel* A06 = new TPaveLabel( -1.411009,-0.2050886,-1.049598,0.2144871, "12" );
0281   TPaveLabel* A07 = new TPaveLabel( -1.302585,-0.7757116,-0.9471979,-0.3561359 , "23" );
0282   TPaveLabel* A08 = new TPaveLabel( -0.8449788,-1.309971,-0.4835679,-0.8848013 , "22" );
0283   TPaveLabel* A09 = new TPaveLabel( -0.1823921,-1.426557,0.1790189,-1.006982 , "21" );
0284   TPaveLabel* A10 = new TPaveLabel( 0.4801947,-1.309076,0.8416056,-0.8839062 , "20" );
0285   TPaveLabel* A11 = new TPaveLabel( 0.9622567,-0.7785088,1.323668,-0.3533387 , "19" );
0286 
0287   TPaveLabel* C00 = new TPaveLabel( 1.046586,-0.1938999,1.407997,0.2144871, "00" );
0288   TPaveLabel* C01 = new TPaveLabel( 0.962076,0.4382608,1.323487,0.8466479 , "01" );
0289   TPaveLabel* C02 = new TPaveLabel( 0.4801947,0.8802139,0.8416056,1.288601 , "02" );
0290   TPaveLabel* C03 = new TPaveLabel( -0.1823921,1.011681,0.1790189,1.425662, "03" );
0291   TPaveLabel* C04 = new TPaveLabel( -0.8449788,0.8690253,-0.4835679,1.288601 , "04" );
0292   TPaveLabel* C05 = new TPaveLabel( -1.30879,0.441058,-0.9473786,0.8550394 , "05" );
0293   TPaveLabel* C06 = new TPaveLabel( -1.411009,-0.2050886,-1.049598,0.2144871, "06" );
0294   TPaveLabel* C07 = new TPaveLabel( -1.302585,-0.7757116,-0.9471979,-0.3561359 , "07" );
0295   TPaveLabel* C08 = new TPaveLabel( -0.8449788,-1.309971,-0.4835679,-0.8848013 , "08" );
0296   TPaveLabel* C09 = new TPaveLabel( -0.1823921,-1.426557,0.1790189,-1.006982 , "09" );
0297   TPaveLabel* C10 = new TPaveLabel( 0.4801947,-1.309076,0.8416056,-0.8839062 , "10" );
0298   TPaveLabel* C11 = new TPaveLabel( 0.9622567,-0.7785088,1.323668,-0.3533387 , "11" );
0299 
0300   A00->SetFillColor(0);
0301   A01->SetFillColor(0);
0302   A02->SetFillColor(0);
0303   A03->SetFillColor(0);
0304   A04->SetFillColor(0);
0305   A05->SetFillColor(0);
0306   A06->SetFillColor(0);
0307   A07->SetFillColor(0);
0308   A08->SetFillColor(0);
0309   A09->SetFillColor(0);
0310   A10->SetFillColor(0);
0311   A11->SetFillColor(0);
0312 
0313   C00->SetFillColor(0);
0314   C01->SetFillColor(0);
0315   C02->SetFillColor(0);
0316   C03->SetFillColor(0);
0317   C04->SetFillColor(0);
0318   C05->SetFillColor(0);
0319   C06->SetFillColor(0);
0320   C07->SetFillColor(0);
0321   C08->SetFillColor(0);
0322   C09->SetFillColor(0);
0323   C10->SetFillColor(0);
0324   C11->SetFillColor(0);
0325 
0326   gStyle->SetPalette(kBird);
0327 
0328   TCanvas *Error_Viz = new TCanvas("Error_Viz", "Error_Viz", 1248, 598);
0329   Error_Viz->Divide(2,1);
0330   Error_Viz->cd(1);
0331   dummy_his1->Draw("");
0332   //polardummy1->Draw("same");
0333   ErrCSide->Draw("colpolzsame0");
0334   C00->Draw("same");
0335   C01->Draw("same");
0336   C02->Draw("same");
0337   C03->Draw("same");
0338   C04->Draw("same");
0339   C05->Draw("same");
0340   C06->Draw("same");
0341   C07->Draw("same");
0342   C08->Draw("same");
0343   C09->Draw("same");
0344   C10->Draw("same");
0345   C11->Draw("same");  
0346   Error_Viz->cd(2);
0347   dummy_his2->Draw("");
0348   //polardummy2->Draw("");
0349   ErrASide->Draw("colpolzsame0");
0350   A00->Draw("same");
0351   A01->Draw("same");
0352   A02->Draw("same");
0353   A03->Draw("same");
0354   A04->Draw("same");
0355   A05->Draw("same");
0356   A06->Draw("same");
0357   A07->Draw("same");
0358   A08->Draw("same");
0359   A09->Draw("same");
0360   A10->Draw("same");
0361   A11->Draw("same");
0362 
0363   ErrCSide->SetMaximum(4);
0364   ErrASide->SetMaximum(4);
0365 
0366   ErrCSide->SetMinimum(0);
0367   ErrASide->SetMinimum(0);
0368   
0369 
0370   //Set Same Scale for A and C side displays
0371 
0372   Double_t Maxval = TMath::Max(ErrASide->GetBinContent(ErrASide->GetMaximumBin()),ErrCSide->GetBinContent(ErrCSide->GetMaximumBin()));
0373   //ErrASide->SetMaximum(Maxval);
0374   //ErrCSide->SetMaximum(Maxval);
0375 
0376   //ErrASide->SetMinimum(0);
0377   //ErrCSide->SetMinimum(0);
0378 
0379   //  std::cout <<"A Side Entries=" << ErrASide->GetBinContent() << std::endl;
0380   // std::cout <<"C Side Entries=" << ErrCSide->GetBinContent() << std::endl;
0381   // std::cout <<" Min A Side Bin" << ErrASide->GetMinimumBin() << std::endl;
0382   // std::cout <<" Min C Side Bin" << ErrCSide->GetMinimumBin() << std::endl;
0383 
0384   //____________________________________________________________________________________________________// 
0385 
0386 
0387   TFile *outf = new TFile("Trip_Histos.root","RECREATE");
0388   Error_Viz->Write();
0389   //Trip_per_stack_dist->Scale(1./trip_count_total);
0390   //Trip_per_stack_dist->Fit("PoissonFit","ERS");
0391   //cout<< "\nThe total trips = " << trip_count_total << endl;
0392   //delete sparsforVIZ;
0393 
0394   sprintf(name,"/sphenix/user/llegnosky/run_%d/run_%d_Noise.png",run_num,run_num);
0395   Error_Viz->Print(name);
0396 
0397   outf->Write();
0398 }
0399 
0400 void Locate(Int_t id, Bool_t is_ASIDE, Double_t *rbin, Double_t *thbin) {
0401   
0402   Double_t ASIDE_angle_bins[12] = { 0.1*2.*TMath::Pi()/12 , 1.1*2.*TMath::Pi()/12 , 2.1*2.*TMath::Pi()/12 , 3.1*2.*TMath::Pi()/12 , 4.1*2.*TMath::Pi()/12 , 5.1*2.*TMath::Pi()/12 , 6.1*2.*TMath::Pi()/12 , 7.1*2.*TMath::Pi()/12 , 8.1*2.*TMath::Pi()/12 , 9.1*2.*TMath::Pi()/12 , 10.1*2.*TMath::Pi()/12 , 11.1*2.*TMath::Pi()/12 }; //CCW from x = 0 (RHS horizontal)
0403   /*
0404     Double_t CSIDE_angle_bins[12] = { 0.1*2.*TMath::Pi()/12 , 1.1*2.*TMath::Pi()/12 , 2.1*2.*TMath::Pi()/12 , 3.1*2.*TMath::Pi()/12 , 4.1*2.*TMath::Pi()/12 , 5.1*2.*TMath::Pi()/12 , 6.1*2.*TMath::Pi()/12 , 7.1*2.*TMath::Pi()/12 , 8.1*2.*TMath::Pi()/12 , 9.1*2.*TMath::Pi()/12 , 10.1*2.*TMath::Pi()/12 , 11.1*2.*TMath::Pi()/12 }; // CW from x = 0 (RHS horizontal)*/
0405                  
0406   Double_t CSIDE_angle_bins[12] = { 6.1*2.*TMath::Pi()/12 , 5.1*2.*TMath::Pi()/12 , 4.1*2.*TMath::Pi()/12 , 3.1*2.*TMath::Pi()/12 , 2.1*2.*TMath::Pi()/12 , 1.1*2.*TMath::Pi()/12 , 0.1*2.*TMath::Pi()/12 , 11.1*2.*TMath::Pi()/12 , 10.1*2.*TMath::Pi()/12 , 9.1*2.*TMath::Pi()/12 , 8.1*2.*TMath::Pi()/12 , 7.1*2.*TMath::Pi()/12  }; //CCW from x = 0 (RHS horizontal)
0407   /*
0408     Double_t ASIDE_angle_bins[12] = { 6.1*2.*TMath::Pi()/12 , 5.1*2.*TMath::Pi()/12 , 4.1*2.*TMath::Pi()/12 , 3.1*2.*TMath::Pi()/12 , 2.1*2.*TMath::Pi()/12 , 1.1*2.*TMath::Pi()/12 , 0.1*2.*TMath::Pi()/12 , 11.1*2.*TMath::Pi()/12 , 10.1*2.*TMath::Pi()/12 , 9.1*2.*TMath::Pi()/12 , 8.1*2.*TMath::Pi()/12 , 7.1*2.*TMath::Pi()/12  }; //CCW from x = 0 (RHS horizontal)
0409   */ 
0410   Int_t modid3 = id % 3;
0411 
0412   switch(modid3) {
0413   case 1:
0414     *rbin = 0.4; //R1
0415     break;
0416   case 2:
0417     *rbin = 0.6; //R2
0418     break;
0419   case 0:
0420     *rbin = 0.8; //R3
0421     break;
0422   }
0423 
0424 
0425   if( is_ASIDE ){
0426     *thbin = CSIDE_angle_bins[TMath::FloorNint((id-1)/3)];
0427   }
0428   else{
0429     *thbin = ASIDE_angle_bins[TMath::FloorNint((id-1)/3)];
0430   }
0431 
0432 }