34    gSystem->Load(
"libHypGe");
 
   43         Int_t IndexPreEnergy = Filename.Index(
"_",1,0,0);
 
   44         Int_t IndexPostEnergy = Filename.Index(
"MeV",3,0,0);
 
   45         TString EnergyFromFileName = Filename(IndexPreEnergy+1,IndexPostEnergy-IndexPreEnergy-1);
 
   47         Double_t Energy = EnergyFromFileName.Atof()/1000;
 
   52         if(Filename.EndsWith(
".root",1))
 
   54                 Filename.ReplaceAll(
".root",
"");
 
   55                 cout << 
"Filename ending chopped!" << endl;
 
   60         TFile* 
g = 
new TFile(CompleteFilename);
 
   63         TString SIMDATADIR = getenv(
"SIMDATADIR");
 
   64         TString OutPath = SIMDATADIR+
"/Gamma/Ana/" + Filename;
 
   65         TString MkDir = 
".!mkdir -p " + OutPath;
 
   66         gROOT->ProcessLine(MkDir);
 
   67         cout << MkDir << endl;
 
   74         txtfileName += 
".txt";
 
   75         TFile* 
fi = 
new TFile(outfile,
"RECREATE");
 
   79   TTree *
b=(TTree *) g->Get(
"pndsim") ;
 
   80   TClonesArray* 
hit_bar=
new TClonesArray(
"PndHypGePoint");
 
   81   b->SetBranchAddress(
"HypGePoint",&hit_bar);
 
   82   TClonesArray* 
mc_bar=
new TClonesArray(
"PndMCTrack");
 
   83   b->SetBranchAddress(
"MCTrack",&mc_bar);
 
   89         Double_t HistoUpperThreshold = Energy*1.2;
 
   90         string Name = 
"total gam energy deposit, " + Filename;
 
   91         Int_t ChannelResolution = 10000000;             
 
   93         TH1D* 
gamTde = 
new TH1D(
"gamTde",Name.c_str(),ChannelResolution*HistoUpperThreshold,0.0000,HistoUpperThreshold);
 
   94         TH1D* ParameterBuffer = 
new TH1D(
"ParameterBuffer", 
"ParameterBuffer",4,0,3);
 
   95         ParameterBuffer->SetBinContent(1,Energy);
 
   96         ParameterBuffer->SetBinContent(2,b->GetEntriesFast());
 
   97         ParameterBuffer->SetBinContent(3,ChannelResolution);
 
   98         ParameterBuffer->SetBinContent(4,Resolution);
 
  101   ParameterBuffer->Write();
 
  106         TH1D *hNoHits = 
new TH1D(
"Number of Hits", 
"Number of Hits", 10,0,10);
 
  113         std::set<int> SetOfCrystalHit;                                  
 
  114         std::set<int>::iterator it;
 
  116         Int_t 
nEvents = b->GetEntriesFast();
 
  117         cout<< 
"Number of Simulated Events: "<<nEvents<<endl;
 
  123         Int_t StartEvent = nEvents/NoOfJobs*(JobNumber-1);
 
  124         Int_t EndEvent = nEvents/NoOfJobs*(JobNumber);
 
  125         cout << 
"Analysing job number " << JobNumber <<
"; from Event " << StartEvent << 
" to " << EndEvent-1 << endl;
 
  128         for (Int_t k=StartEvent; k<EndEvent; k++)
 
  134                 if (!((k*10)% (EndEvent-StartEvent)))
 
  139                 for (Int_t 
i=0; 
i<hit_bar->GetEntriesFast(); 
i++)
 
  146                         Eng += gRandom->Gaus(0,0.000001*Resolution/2.3548);
 
  157                 if (
TMath::Abs(Eng-Energy) < 10*0.000001*Resolution/2.3548)                     
 
  159                         std::cout << 
"SetOfCrystalHit contains Crystal No";
 
  160                         for (it=SetOfCrystalHit.begin(); it!=SetOfCrystalHit.end(); ++it)
 
  162                                 std::cout << 
' ' << *it;
 
  164                         std::cout << 
" and is " << SetOfCrystalHit.size() << 
" long\n";
 
  165                         hNoHits->Fill(SetOfCrystalHit.size());
 
  174                 SetOfCrystalHit.clear();
 
  183         gamTde->SetXTitle(
"Energy [GeV]");
 
  184         gamTde->SetYTitle(
"Counts");
 
  185         gamTde->GetYaxis()->SetTitleOffset(1.35);
 
  186         hNoHits->SetXTitle(
"Number of Hits");
 
  187         hNoHits->SetYTitle(
"Counts");
 
  188         hNoHits->GetYaxis()->SetTitleOffset(1.1);
 
  200         cout << endl << endl;
 
  201         cout << 
"Macro finished succesfully." << endl;
 
  202         cout << 
"Output file is "    << outfile << endl;
 
  203         cout << 
"Parameter file is " << txtfileName << endl;
 
  204         cout << 
"Real time " << rtime << 
" s, CPU time " << ctime << 
" s" << endl;
 
TString CompleteFilename(TString mu, TString Q, TString Psf)
Int_t GetDetectorID() const 
Double_t GetEnergyLoss() const