This will plot the hit pattern, where the abscissa is the detector number as calced for PndDskDetector::fDetNumber and the ordinate is the time of flight PndDskDetector::fTime - fDetTime,
20 Bool_t fSecondaries = kTRUE;
22 gROOT->LoadMacro(
"$VMCWORKDIR/gconfig/rootlogon.C");
23 gROOT->LoadMacro(
"$VMCWORKDIR/gconfig/basiclibs.C");
26 gSystem->Load(
"libDsk");
28 TString fTitle =
"Hit Pattern: Pion 4GeV 15deg - hits: ";
32 TString fFileName =
TString(
"sim_dsk.").Append(theRunName).Append(
".root");
34 fFile = gROOT->GetFile(fFileName);
36 fFile =
new TFile(fFileName);
38 TTree *fTree = (TTree *)fFile->Get(
"pndsim");
39 fTree->SetBranchStatus(
"*",0);
40 fTree->SetBranchStatus(
"DskCerenkov.*",1);
41 fTree->SetBranchStatus(
"DskParticle.*",1);
43 Int_t fNofEvents = fTree->GetEntries();
45 TClonesArray *cArray = 0;
46 cArray =
new TClonesArray(
"PndDskCerenkov");
47 fTree->SetBranchAddress(
"DskCerenkov",&cArray);
50 TClonesArray *pArray = 0;
51 pArray =
new TClonesArray(
"PndDskParticle");
52 fTree->SetBranchAddress(
"DskParticle",&pArray);
56 if (fEventMax == -2) fEventMax = fEventMin;
57 if (fEventMax == -1) fEventMax = fNofEvents-1;
61 const Int_t fArraySize = 1000*600;
70 printf(
"Will process events %i to %i\n",fEventMin,fEventMax);
73 for (Int_t j=fEventMin; j<=fEventMax; j++) {
76 printf(
"Processing event %i\n",j);
84 if (pEntry->GetTrackID() == 0 )
97 priTof[pris] = cEntry->
GetDetTime() - pEntry->GetTime();
99 cout <<
"added primary "
100 << cEntry->GetTrackID()
103 }
else if (theWhat > 1) {
105 secTof[secs] = cEntry->
GetDetTime() - pEntry->GetTime();
108 << cEntry->GetTrackID()
120 TMultiGraph *
mg =
new TMultiGraph();
121 char priStr[3]; sprintf(priStr,
"%i",pris);
122 char secStr[3]; sprintf(secStr,
"%i",secs);
123 mg->SetTitle(
TString(fTitle).Append(priStr).Append(
". From Secondaries: ").Append(secStr));
126 TGraph* grPris =
new TGraph(pris, priDetNum, priTof);
127 grPris->SetMarkerColor(2);
128 grPris->SetFillStyle(0);
132 if (fSecondaries && secs>0) {
133 TGraph* grSecs =
new TGraph(secs, secDetNum, secTof);
134 grSecs->SetMarkerColor(4);
135 grSecs->SetFillStyle(0);
141 mg->GetXaxis()->SetTitle(
"detector number");
142 mg->GetYaxis()->SetTitle(
"time of flight [ns]");
146 cout <<
"This is Event No. " << fEventMin <<
". Detected Cerenkovs: " << pris <<
" from primary, " << secs <<
" from secondaries." << endl;
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
Int_t GetMotherPdgCode() const
Int_t GetDetNumber() const
Double_t GetDetTime() const
Int_t GetMotherTrackID() const
Double_t GetWavelength() const