MultReader.cxx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef MULTREADER_CXX
  2. #define MULTREADER_CXX
  3. #include "MultReader.h"
  4. #include <iostream>
  5. MultReader::MultReader(TTree *tree) : BaseReader(tree)
  6. {
  7. }
  8. MultReader::~MultReader()
  9. {
  10. }
  11. void MultReader::LoopMultiplicity(TString outName)
  12. {
  13. if (fChain == 0) return;
  14. Long64_t nentries = fChain->GetEntries();
  15. Long64_t nbytes = 0, nb = 0;
  16. Int_t refMult, refMultPHENIX;
  17. TH1F *hMult = new TH1F("hMult","hMult",2500,0.,2500.);
  18. TH1F *hMultPHENIX = new TH1F("hMultPHENIX","hMultPHENIX",2500,0.,2500.);
  19. for (Long64_t jentry=0; jentry<nentries;jentry++)
  20. {
  21. Long64_t ientry = LoadTree(jentry);
  22. if (ientry < 0) break;
  23. if (jentry%1000 == 0)
  24. std::cout << "Event [" << jentry << "/"
  25. << nentries << "]" << std::endl;
  26. nb = fChain->GetEntry(jentry); nbytes += nb;
  27. // if (Cut(ientry) < 0) continue;
  28. refMult = GetMult();
  29. refMultPHENIX = GetMultPHENIX();
  30. if (refMult >= 4)hMult->Fill(refMult);
  31. if (refMultPHENIX > 0)hMultPHENIX->Fill(refMultPHENIX);
  32. }
  33. TFile *fo = new TFile(outName.Data(),"recreate");
  34. fo->cd();
  35. hMult->Write();
  36. hMultPHENIX->Write();
  37. fo->Close();
  38. }
  39. #endif