StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
runCentralityAnalyzer_Zr.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_Zr(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  //Zr pileup parameters
44  //---------------------------------------------------
45  //double a0=-1.21309838794601, a1=0.912951771896837, a2=-0.000367314265128479, a3=9.94347355669806e-07, a4=-1.31455343813894e-09;
46  //double b0=13.9009773648019, b1=1.44056038211802, b2=-0.00289508482803666, b3=7.46976650036052e-06, b4=-7.76886643291828e-09;
47  //double c0=-11.5092765154364, c1=0.422455652498953, c2=0.00184903353426273, c3=-4.6965709740072e-06, c4=4.43430319329608e-09;
48  //---------------------------------------------------
49  //New parameters from corrected bad-runs list
50  double a0=-1.19267140255075, a1=0.912703837475103, a2=-0.000366760799818202, a3=9.94532126858323e-07, a4=-1.31386727140715e-09;
51  double b0=13.5244327901538, b1=1.4429201808933, b2=-0.002873496957537, b3=7.29172798142226e-06, b4=-7.45759942317285e-09;
52  double c0=-11.2781454979572, c1=0.420728494449501, c2=0.00184005031913895, c3=-4.61008765754698e-06, c4=4.28291905929182e-09;
53  //---------------------------------------------------
54  anaMaker->setPileUpParameters(a0,a1,a2,a3,a4,b0,b1,b2,b3,b4,c0,c1,c2,c3,c4);
55 
56  //Zr luminosity correction parameters
57  //---------------------------------------------------
58  double lumcorr_a = -1.3917e-4;
59  double lumcorr_b = 98.412;
60  double lumcorr_bprime = 96.9914;
61  //---------------------------------------------------
62  anaMaker->setLumCorrParameters(lumcorr_a,lumcorr_b,lumcorr_bprime);
63 
64  //Vz correction parameters for Zr+Zr
65 
66  double vzCorPar0 = 300.296;
67  double vzCorPar1 = 0.0358743;
68  double vzCorPar2 = -0.000549242;
69  double vzCorPar3 = 0.000232057;
70  double vzCorPar4 = 5.86792e-06;
71  double vzCorPar5 = -2.91945e-07;
72  double vzCorPar6 = -6.33743e-09;
73 
74  anaMaker->setVzCorrParameters(vzCorPar0, vzCorPar1, vzCorPar2, vzCorPar3, vzCorPar4, vzCorPar5, vzCorPar6);
75 
76  //set shape correction weight index; 0: Ru, 1: Zr
77  anaMaker->setShapeIndex(1);
78  //---------------------------------------------------
79 
80 
81 
82  std::cout << "Initializing chain" << std::endl;
83  // Check that all maker has been successfully initialized
84  if( chain->Init() == kStErr ){
85  std::cout << "Error during the chain initializtion. Exit. " << std::endl;
86  return;
87  }
88  std::cout << "... done" << std::endl;
89 
90  int nEvents2Process = reader->chain()->GetEntries();
91  std::cout << " Number of events in files: " << nEvents2Process << std::endl;
92 
93  // Processing events
94  for (Int_t iEvent=0; iEvent<nEvents2Process; iEvent++) {
95 
96  if( iEvent % 1000 == 0 ) std::cout << "Macro: working on event: " << iEvent << std::endl;
97  chain->Clear();
98 
99  // Check return code
100  int iret = chain->Make();
101  // Quit event processing if return code is not 0
102  if (iret) { std::cout << "Bad return code!" << iret << endl; break; }
103  } // for (Int_t iEvent=0; iEvent<nEvents2Process; iEvent++)
104  std::cout << "Data have been processed, Master" << std::endl;
105 
106  std::cout << "Finalizing chain" << std::endl;
107  // Finalize all makers in chain
108  chain->Finish();
109  std::cout << "... done" << std::endl;
110 
111  std::cout << "Centrality analyzer finished the work" << std::endl;
112 }
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