StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
doMuEvent_picoFromEmbedding.C
1 //
3 // macro: doMuEvent_picoFromEmbedding.C
4 // author: R. Debbe (2015)
5 //
6 // This macro loops over events in muDST files from Mixed embedding, runs the
7 // BEMC cluster finder with proper gain calibration. It also prepares track pairs
8 // that satisfy the UPC criterea.
9 // Finally it outputs a root tree ntuple that includes a branch with cluster information
10 //
11 //
13 #include "TH1.h"
14 #include "TH2.h"
15 #include "TChain.h"
16 #include "TSystem.h"
17 #include "TFile.h"
18 #include "iostream.h"
19 
20 
21 class StMuDstMaker;
22 StMuDstMaker* reader;
23 class StChain;
24 // TMemStat memory;
25 
26 StChain *chain = 0;
27 int stat = 0;
28 int n = 0;
29 int count = 1;
30 
31 
32 
34 // This is the main method in the macro.
35 // It loads the libraries, creates the chain and
36 // instantiate the makers.
37 // This macro works only with MuDST events
38 //
39 // the parameters are:
40 // char* list = defines the list of data files
41 // Int_t nFiles = defines how many files should be read from the list
42 void doMuEvent_picoFromEmbedding(char* list = "./file.lis",const char* outFile)
43 {
44  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
45 
46  loadSharedLibraries();
47  gSystem->Load("StDetectorDbMaker");
48  gSystem->Load("StDbBroker");
49  gSystem->Load("St_db_Maker");
50  gSystem->Load("StDaqLib");
51  gSystem->Load("StEmcRawMaker");
52  gSystem->Load("StEmcADCtoEMaker");
53 
54  gSystem->Load("libGeom");
55  gSystem->Load("St_g2t");
56  gSystem->Load("geometry");
57 
58  gSystem->Load("St_geant_Maker");
59  gSystem->Load("StBTofUtil");
60  gSystem->Load("StVpdCalibMaker");
61  gSystem->Load("StBTofCalibMaker");
62 
63 
64 
65  gSystem->Load("/star/u/ramdebbe/.sl64_gcc447/lib/StPeCMaker");
66  gStyle->SetOptStat(0);
67 
68 
69  // create chain
70  chain = new StChain("StChain");
71 
73  maker = new StMuDstMaker(0,0,"",list,"",50000);
74 
75 
76  StMuDbReader* db = StMuDbReader::instance();
77 
78 
79  St_db_Maker *dbMk = new St_db_Maker("StarDb","MySQL:StarDb");
80  StVpdCalibMaker *vpdCalib = new StVpdCalibMaker();
81  vpdCalib->setMuDstIn();
82  StBTofCalibMaker * btofCalib = new StBTofCalibMaker();
83  btofCalib->setMuDstIn();
84 
85  St_geant_Maker *geantMk = new St_geant_Maker("myGeant");
86  geantMk->LoadGeometry("detp geometry y2010");
87  geantMk->SetActive(kFALSE);
88 
89 
90  //instanciate StPeCMaker
91  StPeCMaker* UPCmaker = new StPeCMaker(outFile);
92  UPCmaker->treeFileName = outFile ;
93 
94  UPCmaker->setUseTracks(kTRUE);
95  UPCmaker->setUseBemc(kTRUE);
96  UPCmaker->setUseTOF(kFALSE); //this only affect TOFtracks
97  UPCmaker->setUseVertex(kTRUE);
98  UPCmaker->setRomanPots(kFALSE);
99  UPCmaker->setReadStMuDst(kTRUE);
100  UPCmaker->setReadStEvent(kFALSE);
101  UPCmaker->setReadBothInputs(kFALSE);
102  UPCmaker->setTriggerOfInterest("Ignore"); //embedding doesn't have a trigger
103  UPCmaker->SetDebug(10);
104 
105  chain->Init();
106 
107 
108  while ( (stat==0 || stat==1))
109  {
110  chain->Clear();
111  StMuDst* mudst = maker->muDst();
112  UPCmaker->setMuDst(mudst);
113  stat = chain->Make();
114  if(n%count==0)
115  {
116  cout << "Finished processing event number "<<n <<endl;
117 
118  }
119  n++;
120  }
121 }
122 
StMuDst * muDst()
Definition: StMuDstMaker.h:425
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
static void setLevel(unsigned int level)
sets the debug level
Definition: StMuDebug.h:74
void setMuDstIn(const bool val=kTRUE)
switch to read in StEvent/MuDst
virtual Int_t Make()
Definition: StChain.cxx:110
virtual void SetActive(Bool_t k=kTRUE)
Setters for flags and switches.
Definition: StMaker.h:208
void setMuDstIn()
switch to read in StEvent/MuDst
virtual void LoadGeometry(const Char_t *option="detp geometry field_only")
Specifies GEANT3 geometry command.