StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RunMipHistogramMaker.C
1 #include <iostream>
2 #include <fstream>
3 #include <set>
4 using namespace std;
5 
6 void RunMipHistogramMaker(Int_t nEntries = 1e8,
7  const Char_t* listname="test.list",
8  const Char_t* outfile="testMipFile.root")
9 
10 {
11  gROOT->Macro("LoadLogger.C");
12  gROOT->Macro("loadMuDst.C");
13  gSystem->Load("StTpcDb");
14  gSystem->Load("StDaqLib");
15  gSystem->Load("StDetectorDbMaker");
16  gSystem->Load("St_db_Maker");
17  gSystem->Load("StDbUtilities");
18  gSystem->Load("StEmcRawMaker");
19  gSystem->Load("StMcEvent");
20  gSystem->Load("StMcEventMaker");//***
21  gSystem->Load("StEmcSimulatorMaker");//***
22  gSystem->Load("StEmcADCtoEMaker");
23  gSystem->Load("StEpcMaker");
24  gSystem->Load("StDbBroker");
25  gSystem->Load("StEEmcUtil");
26  gSystem->Load("StAssociationMaker");
27  gSystem->Load("StTriggerUtilities");
28  gSystem->Load("StEmcOfflineCalibrationMaker");
29 
30  //Instantiate StChain
31  StChain *chain = new StChain;
32 
33  TChain *MipChain = new TChain("calibTree");
34  Char_t file[300];
35  ifstream filelist(listname,ifstream::in);
36  while(1){
37  filelist >> file;
38  if (!filelist.good()) break;
39  cout << file << endl;
40  MipChain->Add(file);
41  }
42 
43  StEmcOfflineCalibrationMipAnalysis *mipAnalysis = new StEmcOfflineCalibrationMipAnalysis("StEmcOfflineCalibrationMipAnalysis",outfile,MipChain);
44 
45  //Initialize chain
46  chain->Init();
47  cout << "Successful Init" << endl;
48 
49  //Loop over all Make() in Chain
50  for (Int_t iEntry = 0; iEntry < MipChain->GetEntries(); ++iEntry){
51  if (MipChain->GetEvent(iEntry) <= 0)
52  break;
53 
54  if (iEntry%10000 == 0)
55  cout << "Working on event: " << iEntry << endl;
56 
57  chain->Clear();
58  Int_t iret = chain->Make(iEntry);
59  if(iret){
60  cout << "Bad return code" << endl;
61  break;
62  }
63  }
64 
65  chain->Finish();
66 }
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
virtual Int_t Finish()
Definition: StChain.cxx:85
virtual Int_t Make()
Definition: StChain.cxx:110