Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:18:22

0001 
0002 // ? export LD_LIBRARY_PATH=/home/ayk/eic/EicSandbox/build/lib:${LD_LIBRARY_PATH}
0003 //   export LD_LIBRARY_PATH=/home/ayk/eic/irt/build/lib:${LD_LIBRARY_PATH}
0004 //
0005 //   root -l './hit-map-tstand.C("pfrich.root")'
0006 //
0007 
0008 void hit_map_tstand(const char *dfname, const char *cfname = 0)
0009 {
0010   auto fcfg  = new TFile(cfname ? cfname : dfname);
0011   auto geometry = dynamic_cast<CherenkovDetectorCollection*>(fcfg->Get("CherenkovDetectorCollection"));
0012   auto fdata = new TFile(dfname);
0013   TTree *t = dynamic_cast<TTree*>(fdata->Get("t")); 
0014   auto event = new CherenkovEvent();
0015   t->SetBranchAddress("e", &event);
0016 
0017   int nEvents = t->GetEntries();
0018 
0019   auto hxy = new TH2D("hxy", "", 100, -2.5, 2.5, 100, -2.5, 2.5);
0020   auto hx  = new TH1D("hx",  "", 100, -2.5, 2.5);
0021   auto hy  = new TH1D("hy",  "", 100, -2.5, 2.5);
0022 
0023   for(unsigned ev=0; ev<nEvents; ev++) {
0024     t->GetEntry(ev);
0025 
0026     printf("%d\n", event->OrphanPhotons().size());
0027 
0028     for(auto photon: event->OrphanPhotons()) {
0029       if (!photon->WasDetected() ) continue;
0030 
0031       printf("Here!\n");
0032       TVector3 phx = photon->GetDetectionPosition();
0033       hxy->Fill(phx.X(), phx.Y());
0034       hx->Fill(phx.X());
0035       hy->Fill(phx.Y());
0036     } //for photon
0037   } //for ev
0038 
0039   gStyle->SetOptStat(0);
0040   auto cv = new TCanvas("cv", "", 1200, 400);
0041   cv->Divide(3);
0042   cv->cd(1);
0043   hxy->GetXaxis()->SetTitle("Sensor plane X, [mm]");
0044   hxy->GetYaxis()->SetTitle("Sensor plane Y, [mm]");
0045   hxy->GetXaxis()->SetTitleOffset(1.20);
0046   hxy->GetYaxis()->SetTitleOffset(1.40);
0047   hxy->Draw("COL");
0048   cv->cd(2); hx->Draw();
0049   cv->cd(3); hy->Draw();
0050 } // hit_map_tstand()