StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
runCentralityAnalyzer_Ru.C
1 #include <iostream>
2 
3 class StMaker;
4 class StChain;
5 class StPicoDstReader;
6 
7 const Char_t* testInFName = "/star/u/gnigmat/soft/u/centrality_definition/Centrality/input/st_physics_adc_19084053_raw_0000006.picoDst.root";
8 
9 //________________
10 void runCentralityAnalyzer_Ru(const Char_t* inFileName = testInFName,
11  const Char_t* oFileName = "oTestAna.root") {
12 
13  std::cout << "Start running centrality analyzer" << std::endl;
14  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
15  loadSharedLibraries();
16  // Load specific libraries
17  gSystem->Load("StPicoEvent");
18  gSystem->Load("StPicoDstMaker");
19  gSystem->Load("StCentralityAnalyzer");
20 
21  // Create new chain
22  StChain *chain = new StChain();
23 
24  StPicoDstReader *reader = new StPicoDstReader(inFileName);
25  reader->Init();
26  reader->SetStatus("*", 0);
27  reader->SetStatus("Event*", 1);
28  reader->SetStatus("Track*", 0);
29  reader->SetStatus("BTofPidTraits*", 0);
30 
31  StCentralityAnalyzer *anaMaker = new StCentralityAnalyzer(reader, oFileName);
32  anaMaker->setUsePileUp(true);
33  anaMaker->setUseLumCorr(false);
34  anaMaker->setUseVzCorr(false);
35  anaMaker->setVtxZCut(-35., 25.);
36  anaMaker->addTriggerId(600001);
37  anaMaker->addTriggerId(600011);
38  anaMaker->addTriggerId(600021);
39  anaMaker->addTriggerId(600031);
40  anaMaker->setRunIdParameters(57990, 19071030, 19129020);
41 
42  //These are found by the pileup code in ../QA/pileup
43  //Ru pileup parameters
44  //---------------------------------------------------
45  //double a0=-1.1761972238142, a1=0.91190057314294, a2=-0.000361521536620541, a3=9.77684373134588e-07, a4=-1.28146895587406e-09;
46  //double b0=13.5471357600988, b1=1.44271774447208, b2=-0.00288349264907301, b3=7.3544264332388e-06, b4=-7.54314488345979e-09;
47  //double c0=-11.2648623623068, c1=0.419490120285247, c2=0.001856323147039, c3=-4.68448675939297e-06, c4=4.40012904437496e-09;
48  //---------------------------------------------------
49  //New parameters from corrected bad-runs list
50  double a0=-1.17135278798859, a1=0.911627701794553, a2=-0.000359098306320787, a3=9.61800858474059e-07, a4=-1.25136113760776e-09;
51  double b0=13.5426221755897, b1=1.44261201539344, b2=-0.00288428931227279, b3=7.35384541646783e-06, b4=-7.53407759526067e-09;
52  double c0=-11.2591376113937, c1=0.419541462167548, c2=0.00185578651291454, c3=-4.68933832723005e-06, c4=4.4151761900593e-09;
53  //---------------------------------------------------
54  anaMaker->setPileUpParameters(a0,a1,a2,a3,a4,b0,b1,b2,b3,b4,c0,c1,c2,c3,c4);
55 
56  //Ru luminosity correction parameters
57  double lumcorr_a = -1.1624e-5;
58  double lumcorr_b = 98.113;
59  double lumcorr_bprime = 97.9927;
60  //---------------------------------------------------
61  //---------------------------------------------------
62  anaMaker->setLumCorrParameters(lumcorr_a,lumcorr_b,lumcorr_bprime);
63 
64  //Vz correction parameters for Ru+Ru
65  double vzCorPar0 = 302.019;
66  double vzCorPar1 = 0.0270308;
67  double vzCorPar2 = -0.0017795;
68  double vzCorPar3 = 0.000243777;
69  double vzCorPar4 = 1.18462e-05;
70  double vzCorPar5 = -3.3121e-07;
71  double vzCorPar6 = -1.22651e-08;
72 
73  anaMaker->setVzCorrParameters(vzCorPar0, vzCorPar1, vzCorPar2, vzCorPar3, vzCorPar4, vzCorPar5, vzCorPar6);
74 
75  //set shape correction weight index; 0: Ru, 1: Zr
76  anaMaker->setShapeIndex(0);
77  //---------------------------------------------------
78 
79  std::cout << "Initializing chain" << std::endl;
80  // Check that all maker has been successfully initialized
81  if( chain->Init() == kStErr ){
82  std::cout << "Error during the chain initializtion. Exit. " << std::endl;
83  return;
84  }
85  std::cout << "... done" << std::endl;
86 
87  int nEvents2Process = reader->chain()->GetEntries();
88  std::cout << " Number of events in files: " << nEvents2Process << std::endl;
89 
90  // Processing events
91  for (Int_t iEvent=0; iEvent<nEvents2Process; iEvent++) {
92 
93  if( iEvent % 1000 == 0 ) std::cout << "Macro: working on event: " << iEvent << std::endl;
94  chain->Clear();
95 
96  // Check return code
97  int iret = chain->Make();
98  // Quit event processing if return code is not 0
99  if (iret) { std::cout << "Bad return code!" << iret << endl; break; }
100  } // for (Int_t iEvent=0; iEvent<nEvents2Process; iEvent++)
101  std::cout << "Data have been processed, Master" << std::endl;
102 
103  std::cout << "Finalizing chain" << std::endl;
104  // Finalize all makers in chain
105  chain->Finish();
106  std::cout << "... done" << std::endl;
107 
108  std::cout << "Centrality analyzer finished the work" << std::endl;
109 }
Allows to read picoDst file(s)
TChain * chain()
Return pointer to the chain of .picoDst.root files.
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
void SetStatus(const Char_t *branchNameRegex, Int_t enable)
Set enable/disable branch matching when reading picoDst.
virtual Int_t Finish()
Definition: StChain.cxx:85
Process and build distributions for centrality determination.
virtual Int_t Make()
Definition: StChain.cxx:110
void Init()
Calls openRead()
StPicoDstReader(const Char_t *inFileName)
Definition: Stypes.h:44