detDesigner2.C

Go to the documentation of this file.
00001 
00002 
00003 void detDesigner2() {
00004 
00005 
00006 
00007   const Int_t NUM_RANGES = 11;
00008   const Int_t NUM_DETS = 6;
00009 
00010   const Int_t E_START = 2750;
00011   const Int_t E_STEP = 250;
00012 
00013   Double_t zTarg[NUM_DETS] = {14010,15510,17260,19510,21260,25000};
00014   //Double_t zTarg[NUM_DETS] = {17260,20010,21010,21510,22760,25000};
00015 
00016   Double_t rmin[NUM_DETS] = { 77.5,100,115,135,160,20};
00017   Double_t rmax[NUM_DETS] = {107.5,120,132.5,155,200,250};
00018 
00019 
00020   Double_t rad[NUM_DETS][NUM_RANGES], rad_rms[NUM_DETS][NUM_RANGES],
00021     low[NUM_DETS][NUM_RANGES], high[NUM_DETS][NUM_RANGES],
00022     num[NUM_DETS][NUM_RANGES];
00023     
00024 
00025   TH1D *hist[NUM_DETS][NUM_RANGES];
00026 
00027   TH1D *dets[NUM_DETS];
00028 
00029 
00030   TString cut = "ion&&z==11965&&";
00031 
00032   cut+="kineE>";
00033   cut+=E_START;
00034   cut+="&&kineE<5500";
00035 
00036 
00037   geant->Draw("num",cut,"goff");
00038 
00039   Double_t *id = geant->GetV1();
00040 
00041   Int_t tot = htemp->GetEntries();
00042   const Int_t N = tot;
00043 
00044   cout << N << endl;
00045 
00046   Double_t index[N];
00047 
00048   //List of Moller particles that make it to the detectors
00049   for (int i=0; i<N; i++) {
00050     index[i]= *(id +i);
00051   }
00052 
00053 
00054   //This will be a list of particles that have already been seen.
00055   Double_t hit_list[N];
00056 
00057   Int_t count;
00058 
00059 
00060   TCanvas *c1 = new TCanvas();
00061   c1->Divide(3,2);
00062 
00063   for (int j=0; j<NUM_DETS; j++) {
00064 
00065     TString title = "det";
00066 
00067     title+=(j+1);
00068 
00069     dets[j] = new TH1D(title,"",100,E_START-E_STEP,5500+E_STEP);
00070 
00071     for (int i=0; i<NUM_RANGES; i++) {
00072       
00073       low[j][i] = E_START + i*E_STEP;
00074       high[j][i] = low[j][i] + E_STEP;
00075       
00076       TString cut;
00077 
00078       cut+="ion&&z==";
00079       cut+=zTarg[j];
00080       cut+="&&kineE>";
00081       cut+=low[j][i];
00082       cut+="&&kineE<";
00083       cut+=high[j][i];
00084       cut+="&&r>";
00085       cut+=rmin[j];
00086       cut+="&&r<";
00087       cut+=rmax[j];
00088 
00089 
00090       Double_t radius[2000], particle[2000], energy[2000];
00091 
00092 
00093 
00094       geant->Draw("num>>h1",cut,"goff");
00095 
00096       Int_t tot = h1->GetEntries();
00097 
00098      
00099       Double_t *id = geant->GetV1();
00100 
00101       for (int k=0; k<tot; k++) {
00102   particle[k]= *(id + k);
00103       }
00104       
00105       geant->Draw("r>>h1",cut,"goff");
00106       
00107       Double_t *r = geant->GetV1();
00108 
00109       for (int k=0; k<tot; k++) {
00110   radius[k]= *(r + k);
00111       }
00112 
00113       
00114       geant->Draw("kineE>>h1",cut,"goff");
00115       
00116       Double_t *en = geant->GetV1();
00117 
00118       for (int k=0; k<tot; k++) {
00119   energy[k]= *(en + k);
00120       }
00121 
00122 
00123       hist[j][i] = new TH1D("hist","",100,rmin[j],rmax[j]);
00124 
00125       
00126       for (int k=0; k<tot; k++) {
00127   if (notInList(particle[k],hit_list,N)) {
00128     hist[j][i]->Fill(radius[k]);
00129     dets[j]->Fill(energy[k]);
00130 
00131     hit_list[count]=particle[k];
00132     count++;
00133   }
00134       }
00135   
00136   
00137       rad[j][i]=hist[j][i]->GetMean();
00138       rad_rms[j][i]=hist[j][i]->GetRMS();
00139       num[j][i]=hist[j][i]->GetEntries();
00140 
00141       hist[j][i]->Delete();
00142       
00143     }
00144     c1->cd(j+1);
00145     dets[j]->Draw();
00146 
00147     //dets[j]->Delete();
00148     
00149   }
00150 
00151 
00152   Double_t total;
00153 
00154 
00155   TCanvas *c2 = new TCanvas();
00156   c2->Divide(3,2);
00157 
00158 
00159   for (int j=0; j<NUM_DETS; j++) {
00160 
00161     TGraph *gr = new TGraph();
00162 
00163     for (int i=0; i<NUM_RANGES; i++) {
00164       total+=num[j][i];
00165 
00166       gr->SetPoint(i,low[j][i],num[j][i]);
00167       gr->SetMarkerStyle(20);
00168 
00169      
00170 
00171     }
00172 
00173     c2->cd(j+1);
00174 
00175     gr->Draw("apc");
00176 
00177     }
00178 
00179   
00180   
00181   for (int j=0; j<NUM_DETS; j++) {
00182     
00183     cout << "\nDet " << (j+1) << " at z=" << zTarg[j] << "\n" << endl;
00184 
00185     for (int i=0; i<NUM_RANGES; i++) {
00186       
00187       cout << "N = " << num[j][i] 
00188      << " For kineE0=[" << low[j][i] 
00189      << "," << high[j][i] 
00190      << "]   <R>=\t" << rad[j][i]/10 
00191      << "\t\t+-\t" << rad_rms[j][i]/10 << endl;
00192       
00193     }
00194   }
00195 
00196   cout << total << endl;
00197 
00198 }
00199 
00200 
00201 Int_t notInList(Double_t thisid, Double_t* index, Int_t N) {
00202 
00203   Int_t isHere = 0;
00204 
00205   for (int i=0; i<N; i++) {
00206     if (index[i]==thisid) isHere=1;
00207   }
00208 
00209   return isHere-1;
00210   
00211 }

Generated on 16 Jun 2013 for mollersim by  doxygen 1.6.1