Subversion Repositories f9daq

Rev

Rev 25 | Rev 70 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 25 Rev 54
Line 169... Line 169...
169
{
169
{
170
  CDetector *detector = new CDetector(CENTER, parameters);
170
  CDetector *detector = new CDetector(CENTER, parameters);
171
        Init();
171
        Init();
172
        double izkoristek = Single(detector, parameters, TVector3(xh,yh,zh),theta, phi);
172
        double izkoristek = Single(detector, parameters, TVector3(xh,yh,zh),theta, phi);
173
        PrintGuideHead();
173
        PrintGuideHead();
174
        PrintGuideStat(detector, 1);
174
        PrintGuideStat(izkoristek);
175
        DrawData(detector, parameters, theta, izkoristek);
175
        DrawData(detector, parameters, theta, izkoristek);
176
}
176
}
177
//------------------------------------------------------------------------------------------
177
//------------------------------------------------------------------------------------------
178
// Propagate NN rays generated as grid and show the statistics
178
// Propagate NN rays generated as grid and show the statistics
179
void LGG(int NN = 10, double theta = 0.0)
179
void LGG(int NN = 10, double theta = 0.0)
Line 181... Line 181...
181
  CDetector *detector = new CDetector(TVector3(-2,0,0), parameters);
181
  CDetector *detector = new CDetector(TVector3(-2,0,0), parameters);
182
        Init();
182
        Init();
183
        double izkoristek = Grid(detector, parameters, NN, theta);
183
        double izkoristek = Grid(detector, parameters, NN, theta);
184
        //printf("izkoristek = %.3lf\n", izkoristek);
184
        //printf("izkoristek = %.3lf\n", izkoristek);
185
        PrintGuideHead();
185
        PrintGuideHead();
186
        PrintGuideStat(detector, (NN+1)*(NN+1));
186
        PrintGuideStat(izkoristek);
187
        DrawData(detector, parameters, theta, izkoristek);
187
        DrawData(detector, parameters, theta, izkoristek);
188
}
188
}
189
//------------------------------------------------------------------------------------------
189
//------------------------------------------------------------------------------------------
190
// Propagate NN rays genarated under the same angle theta, phi with random spacing and statistics
190
// Propagate NN rays genarated under the same angle theta, phi with random spacing and statistics
191
void LGR(int NN = 1e4, double theta = 0.0, double phi = 0.0)
191
void LGR(int NN = 1e4, double theta = 0.0, double phi = 0.0)
192
{
192
{
193
  CDetector *detector = new CDetector(TVector3(-2,0,0), parameters);
193
  CDetector *detector = new CDetector(TVector3(-2,0,0), parameters);
194
        Init();
194
        Init();
195
        double izkoristek = RandYZ(detector, parameters, NN, theta, phi);
195
        double izkoristek = RandYZ(detector, parameters, NN, theta, phi);
196
        //printf("izkoristek = %.3lf\n", izkoristek);
196
        //printf("izkoristek = %.3lf\n", izkoristek);
197
        PrintGuideHead(); PrintGuideStat(detector, NN);
197
        PrintGuideHead(); PrintGuideStat(izkoristek);
198
        DrawData(detector, parameters, theta, izkoristek);
198
        DrawData(detector, parameters, theta, izkoristek);
199
}
199
}
200
//------------------------------------------------------------------------------------------
200
//------------------------------------------------------------------------------------------
201
// Propagate NN rays isotropically generated in solid angle theta and show the statistics
201
// Propagate NN rays isotropically generated in solid angle theta and show the statistics
202
void LGI(int NN = 1e4, double theta = 30.0, int nnrays = 30, int showr = 0)
202
void LGI(int NN = 1e4, double theta = 30.0, int nnrays = 30, int showr = 0)
Line 204... Line 204...
204
  Init();
204
  Init();
205
  CDetector *detector = new CDetector(CENTER, parameters);
205
  CDetector *detector = new CDetector(CENTER, parameters);
206
  //CDetector detector = new CDetector();
206
  //CDetector detector = new CDetector();
207
        double izkoristek = RandIso(detector, parameters, NN, theta, nnrays, showr);
207
        double izkoristek = RandIso(detector, parameters, NN, theta, nnrays, showr);
208
        //printf("izkoristek = %.3lf\n", izkoristek);
208
        //printf("izkoristek = %.3lf\n", izkoristek);
209
        PrintGuideHead(); PrintGuideStat(detector, NN);
209
        PrintGuideHead(); PrintGuideStat(izkoristek);
210
        DrawData(detector, parameters, theta, izkoristek);
210
        DrawData(detector, parameters, theta, izkoristek);
211
        //TCanvas *canvasDetector = new TCanvas("canvasDetector","canvasDetector",500,500);
211
        //TCanvas *canvasDetector = new TCanvas("canvasDetector","canvasDetector",500,500);
212
        //canvasDetector->cd();
212
        //canvasDetector->cd();
213
        //detector->Draw();
213
        //detector->Draw();
214
        //delete detector;
-
 
215
}
214
}
216
 
215
 
217
       
216
       
218
       
217
       
219
//------------------------------------------------------------------------------------------
218
//------------------------------------------------------------------------------------------
Line 231... Line 230...
231
                parameters.setGap(step[i], 0.0, 0.0);
230
                parameters.setGap(step[i], 0.0, 0.0);
232
                CDetector *detector = new CDetector(CENTER, parameters);
231
                CDetector *detector = new CDetector(CENTER, parameters);
233
                Init();
232
                Init();
234
                acc[i] = RandIso(detector, parameters, NN, theta);
233
                acc[i] = RandIso(detector, parameters, NN, theta);
235
                //printf("%6.2lf |%6.1lf\n", step[i], acc[i]*100.0);
234
                //printf("%6.2lf |%6.1lf\n", step[i], acc[i]*100.0);
236
                PrintGuideStat(detector, NN);
235
                PrintGuideStat(acc[i]);
237
        }
236
        }
238
       
237
       
239
        //char sbuff[256];
238
        //char sbuff[256];
240
        //sprintf(sbuff, "SiPM = %.1lf, M = %.1lf, d = %.1lf | gap(y,z) = (%.1lf, %.1lf) | #theta = %.1lf",
239
        //sprintf(sbuff, "SiPM = %.1lf, M = %.1lf, d = %.1lf | gap(y,z) = (%.1lf, %.1lf) | #theta = %.1lf",
241
                //      detector->GetSiPM(), detector->GetM(), detector->GetD(), 
240
                //      detector->GetSiPM(), detector->GetM(), detector->GetD(), 
Line 261... Line 260...
261
                Init();
260
                Init();
262
                step[i] = min + i*(max - min)/(double)steps;
261
                step[i] = min + i*(max - min)/(double)steps;
263
                CDetector *detector = new CDetector(TVector3(-2,0,0), parameters);
262
                CDetector *detector = new CDetector(TVector3(-2,0,0), parameters);
264
                acc[i] = RandYZ(detector, parameters, NN, step[i], phi);
263
                acc[i] = RandYZ(detector, parameters, NN, step[i], phi);
265
                //printf("%6.1lf |%6.1lf\n", step[i], acc[i]*100.0);
264
                //printf("%6.1lf |%6.1lf\n", step[i], acc[i]*100.0);
266
                PrintGuideStat(detector, NN);
265
                PrintGuideStat(acc[i]);
267
                delete detector;
266
                //delete detector;
268
        }
267
        }
269
       
268
       
270
        //char sbuff[256];
269
        //char sbuff[256];
271
        //sprintf(sbuff, "SiPM = %.1lf, M = %.1lf, d = %.1lf | gap = (%.1lf, %.1lf, %.1lf)",
270
        //sprintf(sbuff, "SiPM = %.1lf, M = %.1lf, d = %.1lf | gap = (%.1lf, %.1lf, %.1lf)",
272
                //      detector->GetSiPM(), detector->GetM(), detector->GetD(), 
271
                //      detector->GetSiPM(), detector->GetM(), detector->GetD(), 
Line 311... Line 310...
311
                  double acceptance = RandIso(detector, parameters, NN, theta, 0, 0);
310
                  double acceptance = RandIso(detector, parameters, NN, theta, 0, 0);
312
                  //double acceptance = Grid(NN, theta);
311
                  //double acceptance = Grid(NN, theta);
313
                  //double acceptance = -1.0;
312
                  //double acceptance = -1.0;
314
                  hAcceptance->Fill(d, a, acceptance);
313
                  hAcceptance->Fill(d, a, acceptance);
315
                  //printf("%.2lf | %.2lf | ", x,y);
314
                  //printf("%.2lf | %.2lf | ", x,y);
316
                  //PrintGuideStat(detector, NN);
315
                  //PrintGuideStat(izkoristek);
317
                  //delete detector; //works fine, 50x50 grid takes ~4MB of RAM
316
                  delete detector; //works fine, 50x50 grid takes ~4MB of RAM
318
                  }
317
                  }
319
        }
318
        }
320
       
319
       
321
 
320
 
322
       
321
       
Line 328... Line 327...
328
        pacc->SetTopMargin(0.10);
327
        pacc->SetTopMargin(0.10);
329
       
328
       
330
        TFile *file = new TFile("acceptance.root","RECREATE");
329
        TFile *file = new TFile("acceptance.root","RECREATE");
331
        hAcceptance->Write();
330
        hAcceptance->Write();
332
        file->Close();
331
        file->Close();
333
        delete file;
332
        //delete file;
334
       
333
       
335
        //hAcceptance->SetContour(100);
334
        //hAcceptance->SetContour(100);
336
        //gStyle->SetPalette(1,0);
335
        //gStyle->SetPalette(1,0);
337
        hAcceptance->SetTitle(";d [mm];a [mm]");
336
        hAcceptance->SetTitle(";d [mm];a [mm]");
338
        hAcceptance->GetXaxis()->SetRangeUser(minD,maxD);
337
        hAcceptance->GetXaxis()->SetRangeUser(minD,maxD);
Line 368... Line 367...
368
                parameters.setGuide(sipm_d, M0/sipm_d, step[i]);
367
                parameters.setGuide(sipm_d, M0/sipm_d, step[i]);
369
                //printf("sipm = %lf, M = %lf, d = %lf\n", detector->GetSiPM(), detector->GetM(), step[i]);
368
                //printf("sipm = %lf, M = %lf, d = %lf\n", detector->GetSiPM(), detector->GetM(), step[i]);
370
                printf("%.1lf | %.2lf | ", step[i], sipm_d);
369
                printf("%.1lf | %.2lf | ", step[i], sipm_d);
371
                Init();
370
                Init();
372
                acc[i] = RandIso(detector, parameters, NN, theta);
371
                acc[i] = RandIso(detector, parameters, NN, theta);
373
                PrintGuideStat(detector, NN);
372
                PrintGuideStat(acc[i]);
374
                sprintf(sbuff, "d%2d.gif", i);
373
                sprintf(sbuff, "d%2d.gif", i);
375
                //c3dview->SaveAs(sbuff);
374
                //c3dview->SaveAs(sbuff);
376
        }
375
        }
377
       
376
       
378
       
377
       
Line 427... Line 426...
427
                CDetector *detector = new CDetector(CENTER, parameters);
426
                CDetector *detector = new CDetector(CENTER, parameters);
428
                //printf("sipm = %lf, M = %lf, d = %lf\n", detector->GetSiPM(), detector->GetM(), step[i]);
427
                //printf("sipm = %lf, M = %lf, d = %lf\n", detector->GetSiPM(), detector->GetM(), step[i]);
429
                printf("%.1lf | ", step[i]);
428
                printf("%.1lf | ", step[i]);
430
                Init();
429
                Init();
431
                acc[i] = RandIso(detector, parameters, NN, theta);
430
                acc[i] = RandIso(detector, parameters, NN, theta);
432
                PrintGuideStat(detector, NN);
431
                PrintGuideStat(acc[i]);
433
                delete detector;
432
                delete detector;
434
        }
433
        }
435
       
434
       
436
        //char sbuff[256];
435
        //char sbuff[256];
437
        //sprintf(sbuff, "SiPM = %.1lf, M = %.1lf, d = %.1lf | gap(y,z) = (%.1lf, %.1lf) | #theta = %.1lf",
436
        //sprintf(sbuff, "SiPM = %.1lf, M = %.1lf, d = %.1lf | gap(y,z) = (%.1lf, %.1lf) | #theta = %.1lf",
Line 459... Line 458...
459
                step[i] = min + i*(max - min)/(double)steps;
458
                step[i] = min + i*(max - min)/(double)steps;
460
                parameters.setGuide(a, step[i], d);
459
                parameters.setGuide(a, step[i], d);
461
                CDetector *detector = new CDetector(CENTER, parameters);
460
                CDetector *detector = new CDetector(CENTER, parameters);
462
                Init();
461
                Init();
463
                acc[i] = RandIso(detector, parameters, NN, theta);
462
                acc[i] = RandIso(detector, parameters, NN, theta);
464
                PrintGuideStat(detector, NN);
463
                PrintGuideStat(acc[i]);
465
        }
464
        }
466
       
465
       
467
        //char sbuff[256];
466
        //char sbuff[256];
468
        //sprintf(sbuff, "SiPM = %.1lf, M = %.1lf, d = %.1lf | gap(y,z) = (%.1lf, %.1lf) | #theta = %.1lf",
467
        //sprintf(sbuff, "SiPM = %.1lf, M = %.1lf, d = %.1lf | gap(y,z) = (%.1lf, %.1lf) | #theta = %.1lf",
469
                //      detector->GetSiPM(), detector->GetM(), detector->GetD(), 
468
                //      detector->GetSiPM(), detector->GetM(), detector->GetD(),