Utility.cxx 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230
  1. #include <Utility.h>
  2. #include <TDatabasePDG.h>
  3. #include <TParticlePDG.h>
  4. ClassImp(qaUtility);
  5. qaUtility *qaUtility::fUtility = nullptr;
  6. ;
  7. qaUtility::qaUtility() : Nevents(-1),
  8. debug(0),
  9. format("mctree"),
  10. Is_minbias(1),
  11. Is_refmult(1),
  12. Is_v1(1),
  13. Is_v2(1),
  14. Is_v3(1),
  15. Is_v4(1),
  16. Cut_minbias_Event_bmin(0.),
  17. Cut_minbias_Event_bmax(16.),
  18. Cut_minbias_Particle_ptmin(0.),
  19. Cut_minbias_Particle_ptmax(100.),
  20. Cut_minbias_Particle_etamin(-100.),
  21. Cut_minbias_Particle_etamax(100.),
  22. Cut_minbias_Particle_ymin(-100.),
  23. Cut_minbias_Particle_ymax(100.),
  24. Cut_refmult_Event_bmin(0.),
  25. Cut_refmult_Event_bmax(16.),
  26. Cut_refmult_Particle_ptmin(0.15),
  27. Cut_refmult_Particle_ptmax(3.),
  28. Cut_refmult_Particle_etamin(-0.5),
  29. Cut_refmult_Particle_etamax(0.5),
  30. Cut_refmult_Particle_isCharged(1),
  31. Cut_v1_Event_bmin(0.),
  32. Cut_v1_Event_bmax(16.),
  33. sCut_v1_Event_bCent(""),
  34. sCut_v1_Event_mCent(""),
  35. Cut_v1_Event_bCent({}),
  36. Cut_v1_Event_mCent({}),
  37. Cut_v1_Particle_ptmin(1.0),
  38. Cut_v1_Particle_ptmax(1.5),
  39. Cut_v1_Particle_etamin(-100.),
  40. Cut_v1_Particle_etamax(100.),
  41. Cut_v1_Particle_ymin(-0.25),
  42. Cut_v1_Particle_ymax(-0.15),
  43. Cut_v1_Particle_ptmin_pi(0.0),
  44. Cut_v1_Particle_ptmax_pi(0.5),
  45. Cut_v1_Particle_ymin_pi(-0.25),
  46. Cut_v1_Particle_ymax_pi(-0.15),
  47. Cut_v1_Particle_ptmin_ka(0.2),
  48. Cut_v1_Particle_ptmax_ka(0.9),
  49. Cut_v1_Particle_ymin_ka(-0.25),
  50. Cut_v1_Particle_ymax_ka(-0.15),
  51. Cut_v1_Particle_ptmin_pr(1.0),
  52. Cut_v1_Particle_ptmax_pr(1.5),
  53. Cut_v1_Particle_ymin_pr(-0.25),
  54. Cut_v1_Particle_ymax_pr(-0.15),
  55. Cut_v1_Particle_ptmin_ne(1.0),
  56. Cut_v1_Particle_ptmax_ne(1.5),
  57. Cut_v1_Particle_ymin_ne(-0.25),
  58. Cut_v1_Particle_ymax_ne(-0.15),
  59. Cut_v2_Event_bmin(0.),
  60. Cut_v2_Event_bmax(16.),
  61. sCut_v2_Event_bCent(""),
  62. sCut_v2_Event_mCent(""),
  63. Cut_v2_Event_bCent({}),
  64. Cut_v2_Event_mCent({}),
  65. Cut_v2_Particle_ptmin(1.0),
  66. Cut_v2_Particle_ptmax(1.5),
  67. Cut_v2_Particle_etamin(-100.),
  68. Cut_v2_Particle_etamax(100.),
  69. Cut_v2_Particle_ymin(-0.05),
  70. Cut_v2_Particle_ymax(0.05),
  71. Cut_v2_Particle_ptmin_pi(0.0),
  72. Cut_v2_Particle_ptmax_pi(0.5),
  73. Cut_v2_Particle_ymin_pi(-0.05),
  74. Cut_v2_Particle_ymax_pi(0.05),
  75. Cut_v2_Particle_ptmin_ka(0.2),
  76. Cut_v2_Particle_ptmax_ka(0.9),
  77. Cut_v2_Particle_ymin_ka(-0.05),
  78. Cut_v2_Particle_ymax_ka(0.05),
  79. Cut_v2_Particle_ptmin_pr(1.0),
  80. Cut_v2_Particle_ptmax_pr(1.5),
  81. Cut_v2_Particle_ymin_pr(-0.05),
  82. Cut_v2_Particle_ymax_pr(0.05),
  83. Cut_v2_Particle_ptmin_ne(1.0),
  84. Cut_v2_Particle_ptmax_ne(1.5),
  85. Cut_v2_Particle_ymin_ne(-0.05),
  86. Cut_v2_Particle_ymax_ne(0.05),
  87. Cut_v3_Event_bmin(0.),
  88. Cut_v3_Event_bmax(16.),
  89. sCut_v3_Event_bCent(""),
  90. sCut_v3_Event_mCent(""),
  91. Cut_v3_Event_bCent({}),
  92. Cut_v3_Event_mCent({}),
  93. Cut_v3_Particle_ptmin(1.0),
  94. Cut_v3_Particle_ptmax(1.5),
  95. Cut_v3_Particle_etamin(-100.),
  96. Cut_v3_Particle_etamax(100.),
  97. Cut_v3_Particle_ymin(-0.05),
  98. Cut_v3_Particle_ymax(0.05),
  99. Cut_v3_Particle_ptmin_pi(0.0),
  100. Cut_v3_Particle_ptmax_pi(0.5),
  101. Cut_v3_Particle_ymin_pi(-0.05),
  102. Cut_v3_Particle_ymax_pi(0.05),
  103. Cut_v3_Particle_ptmin_ka(0.2),
  104. Cut_v3_Particle_ptmax_ka(0.9),
  105. Cut_v3_Particle_ymin_ka(-0.05),
  106. Cut_v3_Particle_ymax_ka(0.05),
  107. Cut_v3_Particle_ptmin_pr(1.0),
  108. Cut_v3_Particle_ptmax_pr(1.5),
  109. Cut_v3_Particle_ymin_pr(-0.05),
  110. Cut_v3_Particle_ymax_pr(0.05),
  111. Cut_v3_Particle_ptmin_ne(1.0),
  112. Cut_v3_Particle_ptmax_ne(1.5),
  113. Cut_v3_Particle_ymin_ne(-0.05),
  114. Cut_v3_Particle_ymax_ne(0.05),
  115. Cut_v4_Event_bmin(0.),
  116. Cut_v4_Event_bmax(16.),
  117. sCut_v4_Event_bCent(""),
  118. sCut_v4_Event_mCent(""),
  119. Cut_v4_Event_bCent({}),
  120. Cut_v4_Event_mCent({}),
  121. Cut_v4_Particle_ptmin(1.0),
  122. Cut_v4_Particle_ptmax(1.5),
  123. Cut_v4_Particle_etamin(-100.),
  124. Cut_v4_Particle_etamax(100.),
  125. Cut_v4_Particle_ymin(-0.05),
  126. Cut_v4_Particle_ymax(0.05),
  127. Cut_v4_Particle_ptmin_pi(0.0),
  128. Cut_v4_Particle_ptmax_pi(0.5),
  129. Cut_v4_Particle_ymin_pi(-0.05),
  130. Cut_v4_Particle_ymax_pi(0.05),
  131. Cut_v4_Particle_ptmin_ka(0.2),
  132. Cut_v4_Particle_ptmax_ka(0.9),
  133. Cut_v4_Particle_ymin_ka(-0.05),
  134. Cut_v4_Particle_ymax_ka(0.05),
  135. Cut_v4_Particle_ptmin_pr(1.0),
  136. Cut_v4_Particle_ptmax_pr(1.5),
  137. Cut_v4_Particle_ymin_pr(-0.05),
  138. Cut_v4_Particle_ymax_pr(0.05),
  139. Cut_v4_Particle_ptmin_ne(1.0),
  140. Cut_v4_Particle_ptmax_ne(1.5),
  141. Cut_v4_Particle_ymin_ne(-0.05),
  142. Cut_v4_Particle_ymax_ne(0.05)
  143. {
  144. }
  145. qaUtility::~qaUtility()
  146. {
  147. }
  148. qaUtility *qaUtility::GetInstance()
  149. {
  150. if (fUtility == nullptr)
  151. {
  152. fUtility = new qaUtility();
  153. }
  154. return fUtility;
  155. }
  156. Bool_t qaUtility::ReadConfig(const TString &configFileName)
  157. {
  158. if (configFileName.Length() == 0)
  159. {
  160. return false;
  161. }
  162. TEnv env(configFileName);
  163. Nevents = env.GetValue("Nevents", 0);
  164. debug = env.GetValue("debug", 0);
  165. Is_minbias = env.GetValue("Is_minbias", 0);
  166. Cut_minbias_Event_bmin = env.GetValue("Cut_minbias_Event_bmin", 0.);
  167. Cut_minbias_Event_bmax = env.GetValue("Cut_minbias_Event_bmax", 0.);
  168. Cut_minbias_Particle_ptmin = env.GetValue("Cut_minbias_Particle_ptmin", 0.);
  169. Cut_minbias_Particle_ptmax = env.GetValue("Cut_minbias_Particle_ptmax", 0.);
  170. Cut_minbias_Particle_etamin = env.GetValue("Cut_minbias_Particle_etamin", 0.);
  171. Cut_minbias_Particle_etamax = env.GetValue("Cut_minbias_Particle_etamax", 0.);
  172. Cut_minbias_Particle_ymin = env.GetValue("Cut_minbias_Particle_ymin", 0.);
  173. Cut_minbias_Particle_ymax = env.GetValue("Cut_minbias_Particle_ymax", 0.);
  174. Is_refmult = env.GetValue("Is_refmult", 0);
  175. Cut_refmult_Event_bmin = env.GetValue("Cut_refmult_Event_bmin", 0.);
  176. Cut_refmult_Event_bmax = env.GetValue("Cut_refmult_Event_bmax", 0.);
  177. Cut_refmult_Particle_ptmin = env.GetValue("Cut_refmult_Particle_ptmin", 0.);
  178. Cut_refmult_Particle_ptmax = env.GetValue("Cut_refmult_Particle_ptmax", 0.);
  179. Cut_refmult_Particle_etamin = env.GetValue("Cut_refmult_Particle_etamin", 0.);
  180. Cut_refmult_Particle_etamax = env.GetValue("Cut_refmult_Particle_etamax", 0.);
  181. Cut_refmult_Particle_isCharged = env.GetValue("Cut_refmult_Particle_isCharged", 0);
  182. Is_v1 = env.GetValue("Is_v1", 0);
  183. Cut_v1_Event_bmin = env.GetValue("Cut_v1_Event_bmin", 0.);
  184. Cut_v1_Event_bmax = env.GetValue("Cut_v1_Event_bmax", 0.);
  185. sCut_v1_Event_bCent = env.GetValue("Cut_v1_Event_bCent", "");
  186. sCut_v1_Event_mCent = env.GetValue("Cut_v1_Event_mCent", "");
  187. Cut_v1_Particle_ptmin = env.GetValue("Cut_v1_Particle_ptmin", 0.);
  188. Cut_v1_Particle_ptmax = env.GetValue("Cut_v1_Particle_ptmax", 0.);
  189. Cut_v1_Particle_etamin = env.GetValue("Cut_v1_Particle_etamin", 0.);
  190. Cut_v1_Particle_etamax = env.GetValue("Cut_v1_Particle_etamax", 0.);
  191. Cut_v1_Particle_ymin = env.GetValue("Cut_v1_Particle_ymin", 0.);
  192. Cut_v1_Particle_ymax = env.GetValue("Cut_v1_Particle_ymax", 0.);
  193. Cut_v1_Particle_ptmin_pi = env.GetValue("Cut_v1_Particle_ptmin_pi", 0.);
  194. Cut_v1_Particle_ptmax_pi = env.GetValue("Cut_v1_Particle_ptmax_pi", 0.);
  195. Cut_v1_Particle_ymin_pi = env.GetValue("Cut_v1_Particle_ymin_pi", 0.);
  196. Cut_v1_Particle_ymax_pi = env.GetValue("Cut_v1_Particle_ymax_pi", 0.);
  197. Cut_v1_Particle_ptmin_ka = env.GetValue("Cut_v1_Particle_ptmin_ka", 0.);
  198. Cut_v1_Particle_ptmax_ka = env.GetValue("Cut_v1_Particle_ptmax_ka", 0.);
  199. Cut_v1_Particle_ymin_ka = env.GetValue("Cut_v1_Particle_ymin_ka", 0.);
  200. Cut_v1_Particle_ymax_ka = env.GetValue("Cut_v1_Particle_ymax_ka", 0.);
  201. Cut_v1_Particle_ptmin_pr = env.GetValue("Cut_v1_Particle_ptmin_pr", 0.);
  202. Cut_v1_Particle_ptmax_pr = env.GetValue("Cut_v1_Particle_ptmax_pr", 0.);
  203. Cut_v1_Particle_ymin_pr = env.GetValue("Cut_v1_Particle_ymin_pr", 0.);
  204. Cut_v1_Particle_ymax_pr = env.GetValue("Cut_v1_Particle_ymax_pr", 0.);
  205. Cut_v1_Particle_ptmin_ne = env.GetValue("Cut_v1_Particle_ptmin_ne", 0.);
  206. Cut_v1_Particle_ptmax_ne = env.GetValue("Cut_v1_Particle_ptmax_ne", 0.);
  207. Cut_v1_Particle_ymin_ne = env.GetValue("Cut_v1_Particle_ymin_ne", 0.);
  208. Cut_v1_Particle_ymax_ne = env.GetValue("Cut_v1_Particle_ymax_ne", 0.);
  209. Is_v2 = env.GetValue("Is_v2", 0);
  210. Cut_v2_Event_bmin = env.GetValue("Cut_v2_Event_bmin", 0.);
  211. Cut_v2_Event_bmax = env.GetValue("Cut_v2_Event_bmax", 0.);
  212. sCut_v2_Event_bCent = env.GetValue("Cut_v2_Event_bCent", "");
  213. sCut_v2_Event_mCent = env.GetValue("Cut_v2_Event_mCent", "");
  214. Cut_v2_Particle_ptmin = env.GetValue("Cut_v2_Particle_ptmin", 0.);
  215. Cut_v2_Particle_ptmax = env.GetValue("Cut_v2_Particle_ptmax", 0.);
  216. Cut_v2_Particle_etamin = env.GetValue("Cut_v2_Particle_etamin", 0.);
  217. Cut_v2_Particle_etamax = env.GetValue("Cut_v2_Particle_etamax", 0.);
  218. Cut_v2_Particle_ymin = env.GetValue("Cut_v2_Particle_ymin", 0.);
  219. Cut_v2_Particle_ymax = env.GetValue("Cut_v2_Particle_ymax", 0.);
  220. Cut_v2_Particle_ptmin_pi = env.GetValue("Cut_v2_Particle_ptmin_pi", 0.);
  221. Cut_v2_Particle_ptmax_pi = env.GetValue("Cut_v2_Particle_ptmax_pi", 0.);
  222. Cut_v2_Particle_ymin_pi = env.GetValue("Cut_v2_Particle_ymin_pi", 0.);
  223. Cut_v2_Particle_ymax_pi = env.GetValue("Cut_v2_Particle_ymax_pi", 0.);
  224. Cut_v2_Particle_ptmin_ka = env.GetValue("Cut_v2_Particle_ptmin_ka", 0.);
  225. Cut_v2_Particle_ptmax_ka = env.GetValue("Cut_v2_Particle_ptmax_ka", 0.);
  226. Cut_v2_Particle_ymin_ka = env.GetValue("Cut_v2_Particle_ymin_ka", 0.);
  227. Cut_v2_Particle_ymax_ka = env.GetValue("Cut_v2_Particle_ymax_ka", 0.);
  228. Cut_v2_Particle_ptmin_pr = env.GetValue("Cut_v2_Particle_ptmin_pr", 0.);
  229. Cut_v2_Particle_ptmax_pr = env.GetValue("Cut_v2_Particle_ptmax_pr", 0.);
  230. Cut_v2_Particle_ymin_pr = env.GetValue("Cut_v2_Particle_ymin_pr", 0.);
  231. Cut_v2_Particle_ymax_pr = env.GetValue("Cut_v2_Particle_ymax_pr", 0.);
  232. Cut_v2_Particle_ptmin_ne = env.GetValue("Cut_v2_Particle_ptmin_ne", 0.);
  233. Cut_v2_Particle_ptmax_ne = env.GetValue("Cut_v2_Particle_ptmax_ne", 0.);
  234. Cut_v2_Particle_ymin_ne = env.GetValue("Cut_v2_Particle_ymin_ne", 0.);
  235. Cut_v2_Particle_ymax_ne = env.GetValue("Cut_v2_Particle_ymax_ne", 0.);
  236. Is_v3 = env.GetValue("Is_v3", 0);
  237. Cut_v3_Event_bmin = env.GetValue("Cut_v3_Event_bmin", 0.);
  238. Cut_v3_Event_bmax = env.GetValue("Cut_v3_Event_bmax", 0.);
  239. sCut_v3_Event_bCent = env.GetValue("Cut_v3_Event_bCent", "");
  240. sCut_v3_Event_mCent = env.GetValue("Cut_v3_Event_mCent", "");
  241. Cut_v3_Particle_ptmin = env.GetValue("Cut_v3_Particle_ptmin", 0.);
  242. Cut_v3_Particle_ptmax = env.GetValue("Cut_v3_Particle_ptmax", 0.);
  243. Cut_v3_Particle_etamin = env.GetValue("Cut_v3_Particle_etamin", 0.);
  244. Cut_v3_Particle_etamax = env.GetValue("Cut_v3_Particle_etamax", 0.);
  245. Cut_v3_Particle_ymin = env.GetValue("Cut_v3_Particle_ymin", 0.);
  246. Cut_v3_Particle_ymax = env.GetValue("Cut_v3_Particle_ymax", 0.);
  247. Cut_v3_Particle_ptmin_pi = env.GetValue("Cut_v3_Particle_ptmin_pi", 0.);
  248. Cut_v3_Particle_ptmax_pi = env.GetValue("Cut_v3_Particle_ptmax_pi", 0.);
  249. Cut_v3_Particle_ymin_pi = env.GetValue("Cut_v3_Particle_ymin_pi", 0.);
  250. Cut_v3_Particle_ymax_pi = env.GetValue("Cut_v3_Particle_ymax_pi", 0.);
  251. Cut_v3_Particle_ptmin_ka = env.GetValue("Cut_v3_Particle_ptmin_ka", 0.);
  252. Cut_v3_Particle_ptmax_ka = env.GetValue("Cut_v3_Particle_ptmax_ka", 0.);
  253. Cut_v3_Particle_ymin_ka = env.GetValue("Cut_v3_Particle_ymin_ka", 0.);
  254. Cut_v3_Particle_ymax_ka = env.GetValue("Cut_v3_Particle_ymax_ka", 0.);
  255. Cut_v3_Particle_ptmin_pr = env.GetValue("Cut_v3_Particle_ptmin_pr", 0.);
  256. Cut_v3_Particle_ptmax_pr = env.GetValue("Cut_v3_Particle_ptmax_pr", 0.);
  257. Cut_v3_Particle_ymin_pr = env.GetValue("Cut_v3_Particle_ymin_pr", 0.);
  258. Cut_v3_Particle_ymax_pr = env.GetValue("Cut_v3_Particle_ymax_pr", 0.);
  259. Cut_v3_Particle_ptmin_ne = env.GetValue("Cut_v3_Particle_ptmin_ne", 0.);
  260. Cut_v3_Particle_ptmax_ne = env.GetValue("Cut_v3_Particle_ptmax_ne", 0.);
  261. Cut_v3_Particle_ymin_ne = env.GetValue("Cut_v3_Particle_ymin_ne", 0.);
  262. Cut_v3_Particle_ymax_ne = env.GetValue("Cut_v3_Particle_ymax_ne", 0.);
  263. Is_v4 = env.GetValue("Is_v4", 0);
  264. Cut_v4_Event_bmin = env.GetValue("Cut_v4_Event_bmin", 0.);
  265. Cut_v4_Event_bmax = env.GetValue("Cut_v4_Event_bmax", 0.);
  266. sCut_v4_Event_bCent = env.GetValue("Cut_v4_Event_bCent", "");
  267. sCut_v4_Event_mCent = env.GetValue("Cut_v4_Event_mCent", "");
  268. Cut_v4_Particle_ptmin = env.GetValue("Cut_v4_Particle_ptmin", 0.);
  269. Cut_v4_Particle_ptmax = env.GetValue("Cut_v4_Particle_ptmax", 0.);
  270. Cut_v4_Particle_etamin = env.GetValue("Cut_v4_Particle_etamin", 0.);
  271. Cut_v4_Particle_etamax = env.GetValue("Cut_v4_Particle_etamax", 0.);
  272. Cut_v4_Particle_ymin = env.GetValue("Cut_v4_Particle_ymin", 0.);
  273. Cut_v4_Particle_ymax = env.GetValue("Cut_v4_Particle_ymax", 0.);
  274. Cut_v4_Particle_ptmin_pi = env.GetValue("Cut_v4_Particle_ptmin_pi", 0.);
  275. Cut_v4_Particle_ptmax_pi = env.GetValue("Cut_v4_Particle_ptmax_pi", 0.);
  276. Cut_v4_Particle_ymin_pi = env.GetValue("Cut_v4_Particle_ymin_pi", 0.);
  277. Cut_v4_Particle_ymax_pi = env.GetValue("Cut_v4_Particle_ymax_pi", 0.);
  278. Cut_v4_Particle_ptmin_ka = env.GetValue("Cut_v4_Particle_ptmin_ka", 0.);
  279. Cut_v4_Particle_ptmax_ka = env.GetValue("Cut_v4_Particle_ptmax_ka", 0.);
  280. Cut_v4_Particle_ymin_ka = env.GetValue("Cut_v4_Particle_ymin_ka", 0.);
  281. Cut_v4_Particle_ymax_ka = env.GetValue("Cut_v4_Particle_ymax_ka", 0.);
  282. Cut_v4_Particle_ptmin_pr = env.GetValue("Cut_v4_Particle_ptmin_pr", 0.);
  283. Cut_v4_Particle_ptmax_pr = env.GetValue("Cut_v4_Particle_ptmax_pr", 0.);
  284. Cut_v4_Particle_ymin_pr = env.GetValue("Cut_v4_Particle_ymin_pr", 0.);
  285. Cut_v4_Particle_ymax_pr = env.GetValue("Cut_v4_Particle_ymax_pr", 0.);
  286. Cut_v4_Particle_ptmin_ne = env.GetValue("Cut_v4_Particle_ptmin_ne", 0.);
  287. Cut_v4_Particle_ptmax_ne = env.GetValue("Cut_v4_Particle_ptmax_ne", 0.);
  288. Cut_v4_Particle_ymin_ne = env.GetValue("Cut_v4_Particle_ymin_ne", 0.);
  289. Cut_v4_Particle_ymax_ne = env.GetValue("Cut_v4_Particle_ymax_ne", 0.);
  290. if (!initCentrality())
  291. return false;
  292. return true;
  293. }
  294. TChain *qaUtility::initChain(const TString &inputFileName, const char *chainName)
  295. {
  296. TChain *chain = new TChain(chainName);
  297. std::ifstream file(inputFileName.Data());
  298. std::string line;
  299. while (std::getline(file, line))
  300. {
  301. chain->Add(line.c_str());
  302. }
  303. return chain;
  304. }
  305. std::vector<Float_t> qaUtility::ParseVector(std::string _input)
  306. {
  307. std::vector<Float_t> vB;
  308. std::istringstream iss(_input);
  309. std::copy(std::istream_iterator<Float_t>(iss),
  310. std::istream_iterator<Float_t>(),
  311. std::back_inserter(vB));
  312. return vB;
  313. }
  314. Bool_t qaUtility::initCentrality()
  315. {
  316. Cut_v1_Event_bCent = ParseVector(sCut_v1_Event_bCent);
  317. Cut_v2_Event_bCent = ParseVector(sCut_v2_Event_bCent);
  318. Cut_v3_Event_bCent = ParseVector(sCut_v3_Event_bCent);
  319. Cut_v4_Event_bCent = ParseVector(sCut_v4_Event_bCent);
  320. Cut_v1_Event_mCent = ParseVector(sCut_v1_Event_mCent);
  321. Cut_v2_Event_mCent = ParseVector(sCut_v2_Event_mCent);
  322. Cut_v3_Event_mCent = ParseVector(sCut_v3_Event_mCent);
  323. Cut_v4_Event_mCent = ParseVector(sCut_v4_Event_mCent);
  324. if (Cut_v1_Event_bCent.size() == 0 ||
  325. Cut_v2_Event_bCent.size() == 0 ||
  326. Cut_v3_Event_bCent.size() == 0 ||
  327. Cut_v4_Event_bCent.size() == 0 ||
  328. Cut_v1_Event_mCent.size() == 0 ||
  329. Cut_v2_Event_mCent.size() == 0 ||
  330. Cut_v3_Event_mCent.size() == 0 ||
  331. Cut_v4_Event_mCent.size() == 0)
  332. {
  333. return false;
  334. }
  335. return true;
  336. }
  337. Bool_t qaUtility::Cut_Event_minbias(qaEvent *const &event)
  338. {
  339. if (event->GetB() < Cut_minbias_Event_bmin)
  340. return false;
  341. if (event->GetB() > Cut_minbias_Event_bmax)
  342. return false;
  343. return true;
  344. }
  345. Bool_t qaUtility::Cut_Event_refmult(qaEvent *const &event)
  346. {
  347. if (event->GetB() < Cut_refmult_Event_bmin)
  348. return false;
  349. if (event->GetB() > Cut_refmult_Event_bmax)
  350. return false;
  351. return true;
  352. }
  353. Bool_t qaUtility::Cut_Event_v1(qaEvent *const &event)
  354. {
  355. if (event->GetB() < Cut_v1_Event_bmin)
  356. return false;
  357. if (event->GetB() > Cut_v1_Event_bmax)
  358. return false;
  359. return true;
  360. }
  361. Bool_t qaUtility::Cut_Event_v2(qaEvent *const &event)
  362. {
  363. if (event->GetB() < Cut_v2_Event_bmin)
  364. return false;
  365. if (event->GetB() > Cut_v2_Event_bmax)
  366. return false;
  367. return true;
  368. }
  369. Bool_t qaUtility::Cut_Event_v3(qaEvent *const &event)
  370. {
  371. if (event->GetB() < Cut_v3_Event_bmin)
  372. return false;
  373. if (event->GetB() > Cut_v3_Event_bmax)
  374. return false;
  375. return true;
  376. }
  377. Bool_t qaUtility::Cut_Event_v4(qaEvent *const &event)
  378. {
  379. if (event->GetB() < Cut_v4_Event_bmin)
  380. return false;
  381. if (event->GetB() > Cut_v4_Event_bmax)
  382. return false;
  383. return true;
  384. }
  385. Bool_t qaUtility::Cut_Particle_minbias(qaParticle *const &particle)
  386. {
  387. if (particle->GetPt() < Cut_minbias_Particle_ptmin)
  388. return false;
  389. if (particle->GetPt() > Cut_minbias_Particle_ptmax)
  390. return false;
  391. if (particle->GetEta() < Cut_minbias_Particle_etamin)
  392. return false;
  393. if (particle->GetEta() > Cut_minbias_Particle_etamax)
  394. return false;
  395. return true;
  396. }
  397. Bool_t qaUtility::Cut_Particle_refmult(qaParticle *const &particle)
  398. {
  399. if (particle->GetPt() < Cut_refmult_Particle_ptmin)
  400. return false;
  401. if (particle->GetPt() > Cut_refmult_Particle_ptmax)
  402. return false;
  403. if (particle->GetEta() < Cut_refmult_Particle_etamin)
  404. return false;
  405. if (particle->GetEta() > Cut_refmult_Particle_etamax)
  406. return false;
  407. Double_t charge = GetCharge(particle->GetPdg());
  408. if (Cut_refmult_Particle_isCharged)
  409. {
  410. if (charge == error_code)
  411. return false;
  412. if (charge == 0)
  413. return false;
  414. }
  415. return true;
  416. }
  417. Bool_t qaUtility::Cut_Particle_v1_acceptance(qaParticle *const &particle)
  418. {
  419. if (particle->GetEta() < Cut_v1_Particle_etamin)
  420. return false;
  421. if (particle->GetEta() > Cut_v1_Particle_etamax)
  422. return false;
  423. if (particle->GetPt() < Cut_v1_Particle_ptmin)
  424. return false;
  425. if (particle->GetPt() > Cut_v1_Particle_ptmax)
  426. return false;
  427. Double_t charge = GetCharge(particle->GetPdg());
  428. if (charge == error_code)
  429. return false;
  430. if (charge == 0 && TMath::Abs(particle->GetPdg()) != 2112)
  431. return false;
  432. return true;
  433. }
  434. // Bool_t qaUtility::Cut_Particle_v1_PID_pt(qaParticle *const &particle, Int_t _pid)
  435. // {
  436. // if (particle->GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 4)
  437. // return false;
  438. // // PID related kinematics cut
  439. // Double_t y = 0.5 * TMath::Log( (particle->GetEnergy() + particle->GetPz())/(particle->GetEnergy() - particle->GetPz()) );
  440. // if (_pid == 1 && y < Cut_v1_Particle_ymin_pi)
  441. // return false;
  442. // if (_pid == 1 && y > Cut_v1_Particle_ymax_pi)
  443. // return false;
  444. // if (_pid == 2 && y < Cut_v1_Particle_ymin_ka)
  445. // return false;
  446. // if (_pid == 2 && y > Cut_v1_Particle_ymax_ka)
  447. // return false;
  448. // if (_pid == 3 && y < Cut_v1_Particle_ymin_pr)
  449. // return false;
  450. // if (_pid == 3 && y > Cut_v1_Particle_ymax_pr)
  451. // return false;
  452. // if (_pid == 5 && y < Cut_v1_Particle_ymin_pi)
  453. // return false;
  454. // if (_pid == 5 && y > Cut_v1_Particle_ymax_pi)
  455. // return false;
  456. // if (_pid == 6 && y < Cut_v1_Particle_ymin_ka)
  457. // return false;
  458. // if (_pid == 6 && y > Cut_v1_Particle_ymax_ka)
  459. // return false;
  460. // if (_pid == 7 && y < Cut_v1_Particle_ymin_pr)
  461. // return false;
  462. // if (_pid == 7 && y > Cut_v1_Particle_ymax_pr)
  463. // return false;
  464. // Double_t charge = GetCharge(particle->GetPdg());
  465. // if (charge == error_code)
  466. // return false;
  467. // if (charge == 0)
  468. // return false;
  469. // if (_pid == 0 && charge < 0)
  470. // return false;
  471. // if (_pid == 4 && charge > 0)
  472. // return false;
  473. // return true;
  474. // }
  475. // Bool_t qaUtility::Cut_Particle_v1_PID_y(qaParticle *const &particle, Int_t _pid)
  476. // {
  477. // if (particle->GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 4)
  478. // return false;
  479. // // PID related kinematics cut
  480. // if (_pid == 1 && particle->GetPt() < Cut_v1_Particle_ptmin_pi)
  481. // return false;
  482. // if (_pid == 1 && particle->GetPt() > Cut_v1_Particle_ptmax_pi)
  483. // return false;
  484. // if (_pid == 2 && particle->GetPt() < Cut_v1_Particle_ptmin_ka)
  485. // return false;
  486. // if (_pid == 2 && particle->GetPt() > Cut_v1_Particle_ptmax_ka)
  487. // return false;
  488. // if (_pid == 3 && particle->GetPt() < Cut_v1_Particle_ptmin_pr)
  489. // return false;
  490. // if (_pid == 3 && particle->GetPt() > Cut_v1_Particle_ptmax_pr)
  491. // return false;
  492. // if (_pid == 5 && particle->GetPt() < Cut_v1_Particle_ptmin_pi)
  493. // return false;
  494. // if (_pid == 5 && particle->GetPt() > Cut_v1_Particle_ptmax_pi)
  495. // return false;
  496. // if (_pid == 6 && particle->GetPt() < Cut_v1_Particle_ptmin_ka)
  497. // return false;
  498. // if (_pid == 6 && particle->GetPt() > Cut_v1_Particle_ptmax_ka)
  499. // return false;
  500. // if (_pid == 7 && particle->GetPt() < Cut_v1_Particle_ptmin_pr)
  501. // return false;
  502. // if (_pid == 7 && particle->GetPt() > Cut_v1_Particle_ptmax_pr)
  503. // return false;
  504. // Double_t charge = GetCharge(particle->GetPdg());
  505. // if (charge == error_code)
  506. // return false;
  507. // if (charge == 0)
  508. // return false;
  509. // if (_pid == 0 && charge < 0)
  510. // return false;
  511. // if (_pid == 4 && charge > 0)
  512. // return false;
  513. // return true;
  514. // }
  515. Bool_t qaUtility::Cut_Particle_v1_PID_pt(qaParticleLight const &particle, Int_t _pid)
  516. {
  517. if (_pid == -1)
  518. return false;
  519. if (particle.GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 5)
  520. return false;
  521. // PID related kinematics cut
  522. Double_t y = particle.GetRapidity(); //0.5 * TMath::Log((particle.GetEnergy() + particle.GetPz()) / (particle.GetEnergy() - particle.GetPz()));
  523. if (_pid == 1 && y < Cut_v1_Particle_ymin_pi)
  524. return false;
  525. if (_pid == 1 && y > Cut_v1_Particle_ymax_pi)
  526. return false;
  527. if (_pid == 2 && y < Cut_v1_Particle_ymin_ka)
  528. return false;
  529. if (_pid == 2 && y > Cut_v1_Particle_ymax_ka)
  530. return false;
  531. if (_pid == 3 && y < Cut_v1_Particle_ymin_pr)
  532. return false;
  533. if (_pid == 3 && y > Cut_v1_Particle_ymax_pr)
  534. return false;
  535. if (_pid == 4 && y < Cut_v1_Particle_ymin_ne)
  536. return false;
  537. if (_pid == 4 && y > Cut_v1_Particle_ymax_ne)
  538. return false;
  539. if (_pid == 6 && y < Cut_v1_Particle_ymin_pi)
  540. return false;
  541. if (_pid == 6 && y > Cut_v1_Particle_ymax_pi)
  542. return false;
  543. if (_pid == 7 && y < Cut_v1_Particle_ymin_ka)
  544. return false;
  545. if (_pid == 7 && y > Cut_v1_Particle_ymax_ka)
  546. return false;
  547. if (_pid == 8 && y < Cut_v1_Particle_ymin_pr)
  548. return false;
  549. if (_pid == 8 && y > Cut_v1_Particle_ymax_pr)
  550. return false;
  551. if (_pid == 9 && y < Cut_v1_Particle_ymin_ne)
  552. return false;
  553. if (_pid == 9 && y > Cut_v1_Particle_ymax_ne)
  554. return false;
  555. Double_t charge = GetCharge(particle.GetPdg());
  556. if (charge == error_code)
  557. return false;
  558. if (charge == 0 && TMath::Abs(particle.GetPdg()) != 2112)
  559. return false;
  560. if (_pid == 0 && charge < 0)
  561. return false;
  562. if (_pid == 5 && charge > 0)
  563. return false;
  564. return true;
  565. }
  566. Bool_t qaUtility::Cut_Particle_v1_PID_y(qaParticleLight const &particle, Int_t _pid)
  567. {
  568. if (_pid == -1)
  569. return false;
  570. if (particle.GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 5)
  571. return false;
  572. // PID related kinematics cut
  573. if (_pid == 1 && particle.GetPt() < Cut_v1_Particle_ptmin_pi)
  574. return false;
  575. if (_pid == 1 && particle.GetPt() > Cut_v1_Particle_ptmax_pi)
  576. return false;
  577. if (_pid == 2 && particle.GetPt() < Cut_v1_Particle_ptmin_ka)
  578. return false;
  579. if (_pid == 2 && particle.GetPt() > Cut_v1_Particle_ptmax_ka)
  580. return false;
  581. if (_pid == 3 && particle.GetPt() < Cut_v1_Particle_ptmin_pr)
  582. return false;
  583. if (_pid == 3 && particle.GetPt() > Cut_v1_Particle_ptmax_pr)
  584. return false;
  585. if (_pid == 4 && particle.GetPt() < Cut_v1_Particle_ptmin_ne)
  586. return false;
  587. if (_pid == 4 && particle.GetPt() > Cut_v1_Particle_ptmax_ne)
  588. return false;
  589. if (_pid == 6 && particle.GetPt() < Cut_v1_Particle_ptmin_pi)
  590. return false;
  591. if (_pid == 6 && particle.GetPt() > Cut_v1_Particle_ptmax_pi)
  592. return false;
  593. if (_pid == 7 && particle.GetPt() < Cut_v1_Particle_ptmin_ka)
  594. return false;
  595. if (_pid == 7 && particle.GetPt() > Cut_v1_Particle_ptmax_ka)
  596. return false;
  597. if (_pid == 8 && particle.GetPt() < Cut_v1_Particle_ptmin_pr)
  598. return false;
  599. if (_pid == 8 && particle.GetPt() > Cut_v1_Particle_ptmax_pr)
  600. return false;
  601. if (_pid == 9 && particle.GetPt() < Cut_v1_Particle_ptmin_ne)
  602. return false;
  603. if (_pid == 9 && particle.GetPt() > Cut_v1_Particle_ptmax_ne)
  604. return false;
  605. Double_t charge = GetCharge(particle.GetPdg());
  606. if (charge == error_code)
  607. return false;
  608. if (charge == 0 && TMath::Abs(particle.GetPdg()) != 2112)
  609. return false;
  610. if (_pid == 0 && charge < 0)
  611. return false;
  612. if (_pid == 5 && charge > 0)
  613. return false;
  614. return true;
  615. }
  616. Bool_t qaUtility::Cut_Particle_v2_acceptance(qaParticle *const &particle)
  617. {
  618. if (particle->GetEta() < Cut_v2_Particle_etamin)
  619. return false;
  620. if (particle->GetEta() > Cut_v2_Particle_etamax)
  621. return false;
  622. if (particle->GetPt() < Cut_v2_Particle_ptmin)
  623. return false;
  624. if (particle->GetPt() > Cut_v2_Particle_ptmax)
  625. return false;
  626. Double_t charge = GetCharge(particle->GetPdg());
  627. if (charge == error_code)
  628. return false;
  629. if (charge == 0 && TMath::Abs(particle->GetPdg()) != 2112)
  630. return false;
  631. return true;
  632. }
  633. // Bool_t qaUtility::Cut_Particle_v2_PID_pt(qaParticle *const &particle, Int_t _pid)
  634. // {
  635. // if (particle->GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 4)
  636. // return false;
  637. // // PID related kinematics cut
  638. // Double_t y = 0.5 * TMath::Log( (particle->GetEnergy() + particle->GetPz())/(particle->GetEnergy() - particle->GetPz()) );
  639. // if (_pid == 1 && y < Cut_v2_Particle_ymin_pi)
  640. // return false;
  641. // if (_pid == 1 && y > Cut_v2_Particle_ymax_pi)
  642. // return false;
  643. // if (_pid == 2 && y < Cut_v2_Particle_ymin_ka)
  644. // return false;
  645. // if (_pid == 2 && y > Cut_v2_Particle_ymax_ka)
  646. // return false;
  647. // if (_pid == 3 && y < Cut_v2_Particle_ymin_pr)
  648. // return false;
  649. // if (_pid == 3 && y > Cut_v2_Particle_ymax_pr)
  650. // return false;
  651. // if (_pid == 5 && y < Cut_v2_Particle_ymin_pi)
  652. // return false;
  653. // if (_pid == 5 && y > Cut_v2_Particle_ymax_pi)
  654. // return false;
  655. // if (_pid == 6 && y < Cut_v2_Particle_ymin_ka)
  656. // return false;
  657. // if (_pid == 6 && y > Cut_v2_Particle_ymax_ka)
  658. // return false;
  659. // if (_pid == 7 && y < Cut_v2_Particle_ymin_pr)
  660. // return false;
  661. // if (_pid == 7 && y > Cut_v2_Particle_ymax_pr)
  662. // return false;
  663. // Double_t charge = GetCharge(particle->GetPdg());
  664. // if (charge == error_code)
  665. // return false;
  666. // if (charge == 0)
  667. // return false;
  668. // if (_pid == 0 && charge < 0)
  669. // return false;
  670. // if (_pid == 4 && charge > 0)
  671. // return false;
  672. // return true;
  673. // }
  674. // Bool_t qaUtility::Cut_Particle_v2_PID_y(qaParticle *const &particle, Int_t _pid)
  675. // {
  676. // if (particle->GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 4)
  677. // return false;
  678. // // PID related kinematics cut
  679. // if (_pid == 1 && particle->GetPt() < Cut_v2_Particle_ptmin_pi)
  680. // return false;
  681. // if (_pid == 1 && particle->GetPt() > Cut_v2_Particle_ptmax_pi)
  682. // return false;
  683. // if (_pid == 2 && particle->GetPt() < Cut_v2_Particle_ptmin_ka)
  684. // return false;
  685. // if (_pid == 2 && particle->GetPt() > Cut_v2_Particle_ptmax_ka)
  686. // return false;
  687. // if (_pid == 3 && particle->GetPt() < Cut_v2_Particle_ptmin_pr)
  688. // return false;
  689. // if (_pid == 3 && particle->GetPt() > Cut_v2_Particle_ptmax_pr)
  690. // return false;
  691. // if (_pid == 5 && particle->GetPt() < Cut_v2_Particle_ptmin_pi)
  692. // return false;
  693. // if (_pid == 5 && particle->GetPt() > Cut_v2_Particle_ptmax_pi)
  694. // return false;
  695. // if (_pid == 6 && particle->GetPt() < Cut_v2_Particle_ptmin_ka)
  696. // return false;
  697. // if (_pid == 6 && particle->GetPt() > Cut_v2_Particle_ptmax_ka)
  698. // return false;
  699. // if (_pid == 7 && particle->GetPt() < Cut_v2_Particle_ptmin_pr)
  700. // return false;
  701. // if (_pid == 7 && particle->GetPt() > Cut_v2_Particle_ptmax_pr)
  702. // return false;
  703. // Double_t charge = GetCharge(particle->GetPdg());
  704. // if (charge == error_code)
  705. // return false;
  706. // if (charge == 0)
  707. // return false;
  708. // if (_pid == 0 && charge < 0)
  709. // return false;
  710. // if (_pid == 4 && charge > 0)
  711. // return false;
  712. // return true;
  713. // }
  714. Bool_t qaUtility::Cut_Particle_v2_PID_pt(qaParticleLight const &particle, Int_t _pid)
  715. {
  716. if (_pid == -1)
  717. return false;
  718. if (particle.GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 5)
  719. return false;
  720. // PID related kinematics cut
  721. Double_t y = particle.GetRapidity(); //0.5 * TMath::Log((particle.GetEnergy() + particle.GetPz()) / (particle.GetEnergy() - particle.GetPz()));
  722. if (_pid == 1 && y < Cut_v2_Particle_ymin_pi)
  723. return false;
  724. if (_pid == 1 && y > Cut_v2_Particle_ymax_pi)
  725. return false;
  726. if (_pid == 2 && y < Cut_v2_Particle_ymin_ka)
  727. return false;
  728. if (_pid == 2 && y > Cut_v2_Particle_ymax_ka)
  729. return false;
  730. if (_pid == 3 && y < Cut_v2_Particle_ymin_pr)
  731. return false;
  732. if (_pid == 3 && y > Cut_v2_Particle_ymax_pr)
  733. return false;
  734. if (_pid == 4 && y < Cut_v2_Particle_ymin_ne)
  735. return false;
  736. if (_pid == 4 && y > Cut_v2_Particle_ymax_ne)
  737. return false;
  738. if (_pid == 6 && y < Cut_v2_Particle_ymin_pi)
  739. return false;
  740. if (_pid == 6 && y > Cut_v2_Particle_ymax_pi)
  741. return false;
  742. if (_pid == 7 && y < Cut_v2_Particle_ymin_ka)
  743. return false;
  744. if (_pid == 7 && y > Cut_v2_Particle_ymax_ka)
  745. return false;
  746. if (_pid == 8 && y < Cut_v2_Particle_ymin_pr)
  747. return false;
  748. if (_pid == 8 && y > Cut_v2_Particle_ymax_pr)
  749. return false;
  750. if (_pid == 9 && y < Cut_v2_Particle_ymin_ne)
  751. return false;
  752. if (_pid == 9 && y > Cut_v2_Particle_ymax_ne)
  753. return false;
  754. Double_t charge = GetCharge(particle.GetPdg());
  755. if (charge == error_code)
  756. return false;
  757. if (charge == 0 && TMath::Abs(particle.GetPdg()) != 2112)
  758. return false;
  759. if (_pid == 0 && charge < 0)
  760. return false;
  761. if (_pid == 5 && charge > 0)
  762. return false;
  763. return true;
  764. }
  765. Bool_t qaUtility::Cut_Particle_v2_PID_y(qaParticleLight const &particle, Int_t _pid)
  766. {
  767. if (_pid == -1)
  768. return false;
  769. if (particle.GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 5)
  770. return false;
  771. // PID related kinematics cut
  772. if (_pid == 1 && particle.GetPt() < Cut_v2_Particle_ptmin_pi)
  773. return false;
  774. if (_pid == 1 && particle.GetPt() > Cut_v2_Particle_ptmax_pi)
  775. return false;
  776. if (_pid == 2 && particle.GetPt() < Cut_v2_Particle_ptmin_ka)
  777. return false;
  778. if (_pid == 2 && particle.GetPt() > Cut_v2_Particle_ptmax_ka)
  779. return false;
  780. if (_pid == 3 && particle.GetPt() < Cut_v2_Particle_ptmin_pr)
  781. return false;
  782. if (_pid == 3 && particle.GetPt() > Cut_v2_Particle_ptmax_pr)
  783. return false;
  784. if (_pid == 4 && particle.GetPt() < Cut_v2_Particle_ptmin_ne)
  785. return false;
  786. if (_pid == 4 && particle.GetPt() > Cut_v2_Particle_ptmax_ne)
  787. return false;
  788. if (_pid == 6 && particle.GetPt() < Cut_v2_Particle_ptmin_pi)
  789. return false;
  790. if (_pid == 6 && particle.GetPt() > Cut_v2_Particle_ptmax_pi)
  791. return false;
  792. if (_pid == 7 && particle.GetPt() < Cut_v2_Particle_ptmin_ka)
  793. return false;
  794. if (_pid == 7 && particle.GetPt() > Cut_v2_Particle_ptmax_ka)
  795. return false;
  796. if (_pid == 8 && particle.GetPt() < Cut_v2_Particle_ptmin_pr)
  797. return false;
  798. if (_pid == 8 && particle.GetPt() > Cut_v2_Particle_ptmax_pr)
  799. return false;
  800. if (_pid == 9 && particle.GetPt() < Cut_v2_Particle_ptmin_ne)
  801. return false;
  802. if (_pid == 9 && particle.GetPt() > Cut_v2_Particle_ptmax_ne)
  803. return false;
  804. Double_t charge = GetCharge(particle.GetPdg());
  805. if (charge == error_code)
  806. return false;
  807. if (charge == 0 && TMath::Abs(particle.GetPdg()) != 2112)
  808. return false;
  809. if (_pid == 0 && charge < 0)
  810. return false;
  811. if (_pid == 5 && charge > 0)
  812. return false;
  813. return true;
  814. }
  815. Bool_t qaUtility::Cut_Particle_v3_acceptance(qaParticle *const &particle)
  816. {
  817. if (particle->GetEta() < Cut_v3_Particle_etamin)
  818. return false;
  819. if (particle->GetEta() > Cut_v3_Particle_etamax)
  820. return false;
  821. if (particle->GetPt() < Cut_v3_Particle_ptmin)
  822. return false;
  823. if (particle->GetPt() > Cut_v3_Particle_ptmax)
  824. return false;
  825. Double_t charge = GetCharge(particle->GetPdg());
  826. if (charge == error_code)
  827. return false;
  828. if (charge == 0 && TMath::Abs(particle->GetPdg()) != 2112)
  829. return false;
  830. return true;
  831. }
  832. Bool_t qaUtility::Cut_Particle_v3_PID_pt(qaParticleLight const &particle, Int_t _pid)
  833. {
  834. if (_pid == -1)
  835. return false;
  836. if (particle.GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 5)
  837. return false;
  838. // PID related kinematics cut
  839. Double_t y = particle.GetRapidity(); //0.5 * TMath::Log((particle.GetEnergy() + particle.GetPz()) / (particle.GetEnergy() - particle.GetPz()));
  840. if (_pid == 1 && y < Cut_v3_Particle_ymin_pi)
  841. return false;
  842. if (_pid == 1 && y > Cut_v3_Particle_ymax_pi)
  843. return false;
  844. if (_pid == 2 && y < Cut_v3_Particle_ymin_ka)
  845. return false;
  846. if (_pid == 2 && y > Cut_v3_Particle_ymax_ka)
  847. return false;
  848. if (_pid == 3 && y < Cut_v3_Particle_ymin_pr)
  849. return false;
  850. if (_pid == 3 && y > Cut_v3_Particle_ymax_pr)
  851. return false;
  852. if (_pid == 4 && y < Cut_v3_Particle_ymin_ne)
  853. return false;
  854. if (_pid == 4 && y > Cut_v3_Particle_ymax_ne)
  855. return false;
  856. if (_pid == 6 && y < Cut_v3_Particle_ymin_pi)
  857. return false;
  858. if (_pid == 6 && y > Cut_v3_Particle_ymax_pi)
  859. return false;
  860. if (_pid == 7 && y < Cut_v3_Particle_ymin_ka)
  861. return false;
  862. if (_pid == 7 && y > Cut_v3_Particle_ymax_ka)
  863. return false;
  864. if (_pid == 8 && y < Cut_v3_Particle_ymin_pr)
  865. return false;
  866. if (_pid == 8 && y > Cut_v3_Particle_ymax_pr)
  867. return false;
  868. if (_pid == 9 && y < Cut_v3_Particle_ymin_ne)
  869. return false;
  870. if (_pid == 9 && y > Cut_v3_Particle_ymax_ne)
  871. return false;
  872. Double_t charge = GetCharge(particle.GetPdg());
  873. if (charge == error_code)
  874. return false;
  875. if (charge == 0 && TMath::Abs(particle.GetPdg()) != 2112)
  876. return false;
  877. if (_pid == 0 && charge < 0)
  878. return false;
  879. if (_pid == 5 && charge > 0)
  880. return false;
  881. return true;
  882. }
  883. Bool_t qaUtility::Cut_Particle_v3_PID_y(qaParticleLight const &particle, Int_t _pid)
  884. {
  885. if (_pid == -1)
  886. return false;
  887. if (particle.GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 5)
  888. return false;
  889. // PID related kinematics cut
  890. if (_pid == 1 && particle.GetPt() < Cut_v3_Particle_ptmin_pi)
  891. return false;
  892. if (_pid == 1 && particle.GetPt() > Cut_v3_Particle_ptmax_pi)
  893. return false;
  894. if (_pid == 2 && particle.GetPt() < Cut_v3_Particle_ptmin_ka)
  895. return false;
  896. if (_pid == 2 && particle.GetPt() > Cut_v3_Particle_ptmax_ka)
  897. return false;
  898. if (_pid == 3 && particle.GetPt() < Cut_v3_Particle_ptmin_pr)
  899. return false;
  900. if (_pid == 3 && particle.GetPt() > Cut_v3_Particle_ptmax_pr)
  901. return false;
  902. if (_pid == 4 && particle.GetPt() < Cut_v3_Particle_ptmin_ne)
  903. return false;
  904. if (_pid == 4 && particle.GetPt() > Cut_v3_Particle_ptmax_ne)
  905. return false;
  906. if (_pid == 6 && particle.GetPt() < Cut_v3_Particle_ptmin_pi)
  907. return false;
  908. if (_pid == 6 && particle.GetPt() > Cut_v3_Particle_ptmax_pi)
  909. return false;
  910. if (_pid == 7 && particle.GetPt() < Cut_v3_Particle_ptmin_ka)
  911. return false;
  912. if (_pid == 7 && particle.GetPt() > Cut_v3_Particle_ptmax_ka)
  913. return false;
  914. if (_pid == 8 && particle.GetPt() < Cut_v3_Particle_ptmin_pr)
  915. return false;
  916. if (_pid == 8 && particle.GetPt() > Cut_v3_Particle_ptmax_pr)
  917. return false;
  918. if (_pid == 9 && particle.GetPt() < Cut_v3_Particle_ptmin_ne)
  919. return false;
  920. if (_pid == 9 && particle.GetPt() > Cut_v3_Particle_ptmax_ne)
  921. return false;
  922. Double_t charge = GetCharge(particle.GetPdg());
  923. if (charge == error_code)
  924. return false;
  925. if (charge == 0 && TMath::Abs(particle.GetPdg()) != 2112)
  926. return false;
  927. if (_pid == 0 && charge < 0)
  928. return false;
  929. if (_pid == 5 && charge > 0)
  930. return false;
  931. return true;
  932. }
  933. Bool_t qaUtility::Cut_Particle_v4_acceptance(qaParticle *const &particle)
  934. {
  935. if (particle->GetEta() < Cut_v4_Particle_etamin)
  936. return false;
  937. if (particle->GetEta() > Cut_v4_Particle_etamax)
  938. return false;
  939. if (particle->GetPt() < Cut_v4_Particle_ptmin)
  940. return false;
  941. if (particle->GetPt() > Cut_v4_Particle_ptmax)
  942. return false;
  943. Double_t charge = GetCharge(particle->GetPdg());
  944. if (charge == error_code)
  945. return false;
  946. if (charge == 0 && TMath::Abs(particle->GetPdg()) != 2112)
  947. return false;
  948. return true;
  949. }
  950. Bool_t qaUtility::Cut_Particle_v4_PID_pt(qaParticleLight const &particle, Int_t _pid)
  951. {
  952. if (_pid == -1)
  953. return false;
  954. if (particle.GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 5)
  955. return false;
  956. // PID related kinematics cut
  957. Double_t y = 0.5 * TMath::Log((particle.GetEnergy() + particle.GetPz()) / (particle.GetEnergy() - particle.GetPz()));
  958. if (_pid == 1 && y < Cut_v4_Particle_ymin_pi)
  959. return false;
  960. if (_pid == 1 && y > Cut_v4_Particle_ymax_pi)
  961. return false;
  962. if (_pid == 2 && y < Cut_v4_Particle_ymin_ka)
  963. return false;
  964. if (_pid == 2 && y > Cut_v4_Particle_ymax_ka)
  965. return false;
  966. if (_pid == 3 && y < Cut_v4_Particle_ymin_pr)
  967. return false;
  968. if (_pid == 3 && y > Cut_v4_Particle_ymax_pr)
  969. return false;
  970. if (_pid == 4 && y < Cut_v4_Particle_ymin_ne)
  971. return false;
  972. if (_pid == 4 && y > Cut_v4_Particle_ymax_ne)
  973. return false;
  974. if (_pid == 6 && y < Cut_v4_Particle_ymin_pi)
  975. return false;
  976. if (_pid == 6 && y > Cut_v4_Particle_ymax_pi)
  977. return false;
  978. if (_pid == 7 && y < Cut_v4_Particle_ymin_ka)
  979. return false;
  980. if (_pid == 7 && y > Cut_v4_Particle_ymax_ka)
  981. return false;
  982. if (_pid == 8 && y < Cut_v4_Particle_ymin_pr)
  983. return false;
  984. if (_pid == 8 && y > Cut_v4_Particle_ymax_pr)
  985. return false;
  986. if (_pid == 9 && y < Cut_v4_Particle_ymin_ne)
  987. return false;
  988. if (_pid == 9 && y > Cut_v4_Particle_ymax_ne)
  989. return false;
  990. Double_t charge = GetCharge(particle.GetPdg());
  991. if (charge == error_code)
  992. return false;
  993. if (charge == 0 && TMath::Abs(particle.GetPdg()) != 2112)
  994. return false;
  995. if (_pid == 0 && charge < 0)
  996. return false;
  997. if (_pid == 5 && charge > 0)
  998. return false;
  999. return true;
  1000. }
  1001. Bool_t qaUtility::Cut_Particle_v4_PID_y(qaParticleLight const &particle, Int_t _pid)
  1002. {
  1003. if (_pid == -1)
  1004. return false;
  1005. if (particle.GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 5)
  1006. return false;
  1007. // PID related kinematics cut
  1008. if (_pid == 1 && particle.GetPt() < Cut_v4_Particle_ptmin_pi)
  1009. return false;
  1010. if (_pid == 1 && particle.GetPt() > Cut_v4_Particle_ptmax_pi)
  1011. return false;
  1012. if (_pid == 2 && particle.GetPt() < Cut_v4_Particle_ptmin_ka)
  1013. return false;
  1014. if (_pid == 2 && particle.GetPt() > Cut_v4_Particle_ptmax_ka)
  1015. return false;
  1016. if (_pid == 3 && particle.GetPt() < Cut_v4_Particle_ptmin_pr)
  1017. return false;
  1018. if (_pid == 3 && particle.GetPt() > Cut_v4_Particle_ptmax_pr)
  1019. return false;
  1020. if (_pid == 4 && particle.GetPt() < Cut_v4_Particle_ptmin_ne)
  1021. return false;
  1022. if (_pid == 4 && particle.GetPt() > Cut_v4_Particle_ptmax_ne)
  1023. return false;
  1024. if (_pid == 6 && particle.GetPt() < Cut_v4_Particle_ptmin_pi)
  1025. return false;
  1026. if (_pid == 6 && particle.GetPt() > Cut_v4_Particle_ptmax_pi)
  1027. return false;
  1028. if (_pid == 7 && particle.GetPt() < Cut_v4_Particle_ptmin_ka)
  1029. return false;
  1030. if (_pid == 7 && particle.GetPt() > Cut_v4_Particle_ptmax_ka)
  1031. return false;
  1032. if (_pid == 8 && particle.GetPt() < Cut_v4_Particle_ptmin_pr)
  1033. return false;
  1034. if (_pid == 8 && particle.GetPt() > Cut_v4_Particle_ptmax_pr)
  1035. return false;
  1036. if (_pid == 9 && particle.GetPt() < Cut_v4_Particle_ptmin_ne)
  1037. return false;
  1038. if (_pid == 9 && particle.GetPt() > Cut_v4_Particle_ptmax_ne)
  1039. return false;
  1040. Double_t charge = GetCharge(particle.GetPdg());
  1041. if (charge == error_code)
  1042. return false;
  1043. if (charge == 0 && TMath::Abs(particle.GetPdg()) != 2112)
  1044. return false;
  1045. if (_pid == 0 && charge < 0)
  1046. return false;
  1047. if (_pid == 5 && charge > 0)
  1048. return false;
  1049. return true;
  1050. }
  1051. Double_t qaUtility::GetCharge(Int_t pdg)
  1052. {
  1053. auto particle = (TParticlePDG *)TDatabasePDG::Instance()->GetParticle(pdg);
  1054. if (!particle)
  1055. return error_code;
  1056. return particle->Charge() / 3.;
  1057. }
  1058. Int_t qaUtility::GetPdgId(Int_t pdg)
  1059. {
  1060. if (pdg == vpdg.at(1))
  1061. return 1;
  1062. if (pdg == vpdg.at(2))
  1063. return 2;
  1064. if (pdg == vpdg.at(3))
  1065. return 3;
  1066. if (pdg == vpdg.at(4))
  1067. return 4;
  1068. if (pdg == vpdg.at(6))
  1069. return 6;
  1070. if (pdg == vpdg.at(7))
  1071. return 7;
  1072. if (pdg == vpdg.at(8))
  1073. return 8;
  1074. if (pdg == vpdg.at(9))
  1075. return 9;
  1076. return -1;
  1077. }
  1078. Int_t qaUtility::GetCentralityBin(Float_t b, std::vector<Float_t> vcent)
  1079. {
  1080. if (vcent.size() == 0)
  1081. return -1;
  1082. for (int i = 0; i < (int)vcent.size() - 1; i++)
  1083. {
  1084. if (b >= vcent.at(i) && b < vcent.at(i + 1))
  1085. return i;
  1086. }
  1087. return -1;
  1088. }
  1089. Int_t qaUtility::GetCentMultBin(Int_t mult, std::vector<Float_t> vcent)
  1090. {
  1091. if (vcent.size() == 0)
  1092. return -1;
  1093. for (int i = 0; i < (int)vcent.size() - 1; i++)
  1094. {
  1095. if (mult >= vcent.at(i) && mult < vcent.at(i + 1))
  1096. return i;
  1097. }
  1098. return -1;
  1099. }