trackCutMonitor_TpcNSigma.cxx 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. #include "StHbtMaker/Infrastructure/StHbtTrack.hh"
  2. #include "StHbtMaker/Infrastructure/StHbtTypes.hh"
  3. #include "StHbtMaker/Cut/trackCutMonitor_TpcNSigma.h"
  4. #ifdef __ROOT__
  5. #include <TString.h>
  6. ClassImp(trackCutMonitor_TpcNSigma)
  7. #endif
  8. //_________________
  9. trackCutMonitor_TpcNSigma::trackCutMonitor_TpcNSigma() {
  10. mCharge = 0;
  11. mPartType = 0;
  12. hNSigmaElectron = new TH1F(Form("trackCutMonitor_nSigmaElectron"),
  13. Form("nSigmaElectron; n#sigma(e); dN/dn#sigma(e)"),
  14. 40,-10.,10.);
  15. hNSigmaPion = new TH1F(Form("trackCutMonitor_nSigmaPion"),
  16. Form("nSigmaPion; n#sigma(#pi); dN/dn#sigma(e)"),
  17. 40,-10.,10.);
  18. hNSigmaKaon = new TH1F(Form("trackCutMonitor_nSigmaKaon"),
  19. Form("nSigmaKaon; n#sigma(K); dN/dn#sigma(e)"),
  20. 40,-10.,10.);
  21. hNSigmaProton = new TH1F(Form("trackCutMonitor_nSigmaProton"),
  22. Form("nSigmaProton; n#sigma(p); dN/dn#sigma(e)"),
  23. 40, -10., 10.);
  24. }
  25. //_________________
  26. trackCutMonitor_TpcNSigma::trackCutMonitor_TpcNSigma(Int_t Charge,
  27. Int_t PartType) {
  28. if(Charge<-1. || Charge>1) {
  29. std::cout << "trackCutMonitor_TpcNSigma: Wrong particle charge: " << Charge
  30. << " Set it to 0 (all charges)" << std::endl;
  31. Charge = 0;
  32. }
  33. mCharge = Charge;
  34. if(PartType<0 || PartType>4) {
  35. std::cout << "trackCutMonitor_TpcNSigma: Wrong particle type: " << PartType
  36. << " Set it to 0 (all hypotheses)" << std::endl;
  37. PartType = 0;
  38. }
  39. mPartType = PartType; //0-all, 1-elec, 2-pion, 3-kaon, 4-proton
  40. switch(mPartType) {
  41. case 0:
  42. hNSigmaElectron = new TH1F(Form("trackCutMonitor_nSigmaElectron"),
  43. Form("nSigmaElectron charge=%2d; n#sigma(e); dN/dn#sigma(e)", mCharge),
  44. 40,-10.,10.);
  45. hNSigmaPion = new TH1F(Form("trackCutMonitor_nSigmaPion"),
  46. Form("nSigmaPion charge=%2d; n#sigma(#pi); dN/dn#sigma(e)", mCharge),
  47. 40,-10.,10.);
  48. hNSigmaKaon = new TH1F(Form("trackCutMonitor_nSigmaKaon"),
  49. Form("nSigmaKaon charge=%2d; n#sigma(K); dN/dn#sigma(e)", mCharge),
  50. 40,-10.,10.);
  51. hNSigmaProton = new TH1F(Form("trackCutMonitor_nSigmaProton"),
  52. Form("nSigmaProton charge=%2d; n#sigma(p); dN/dn#sigma(e)", mCharge),
  53. 40,-10.,10.);
  54. break;
  55. case 1:
  56. hNSigmaElectron = new TH1F(Form("trackCutMonitor_nSigmaElectron"),
  57. Form("nSigmaElectron charge=%2d; n#sigma(e); dN/dn#sigma(e)", mCharge),
  58. 40,-10.,10.);
  59. break;
  60. case 2:
  61. hNSigmaPion = new TH1F(Form("trackCutMonitor_nSigmaPion"),
  62. Form("nSigmaPion charge=%2d; n#sigma(#pi); dN/dn#sigma(e)", mCharge),
  63. 40,-10.,10.);
  64. break;
  65. case 3:
  66. hNSigmaKaon = new TH1F(Form("trackCutMonitor_nSigmaKaon"),
  67. Form("nSigmaKaon charge=%2d; n#sigma(K); dN/dn#sigma(e)", mCharge),
  68. 40,-10.,10.);
  69. break;
  70. case 4:
  71. hNSigmaProton = new TH1F(Form("trackCutMonitor_nSigmaProton"),
  72. Form("nSigmaProton charge=%2d; n#sigma(p); dN/dn#sigma(e)", mCharge),
  73. 40,-10.,10.);
  74. break;
  75. default:
  76. hNSigmaElectron = new TH1F(Form("trackCutMonitor_nSigmaElectron"),
  77. Form("nSigmaElectron charge=%2d; n#sigma(e); dN/dn#sigma(e)", mCharge),
  78. 40,-10.,10.);
  79. hNSigmaPion = new TH1F(Form("trackCutMonitor_nSigmaPion"),
  80. Form("nSigmaPion charge=%2d; n#sigma(#pi); dN/dn#sigma(e)", mCharge),
  81. 40,-10.,10.);
  82. hNSigmaKaon = new TH1F(Form("trackCutMonitor_nSigmaKaon"),
  83. Form("nSigmaKaon charge=%2d; n#sigma(K); dN/dn#sigma(e)", mCharge),
  84. 40,-10.,10.);
  85. hNSigmaProton = new TH1F(Form("trackCutMonitor_nSigmaProton"),
  86. Form("nSigmaProton charge=%2d; n#sigma(p); dN/dn#sigma(e)", mCharge),
  87. 40,-10.,10.);
  88. };
  89. }
  90. //_________________
  91. trackCutMonitor_TpcNSigma::trackCutMonitor_TpcNSigma(Int_t Charge, Int_t PartType,
  92. const Char_t* TitCutMoni) {
  93. if(Charge<-1. || Charge>1) {
  94. std::cout << "trackCutMonitor_TpcNSigma: Wrong particle charge: " << Charge
  95. << " Set it to 0 (all charges)" << std::endl;
  96. Charge = 0;
  97. }
  98. mCharge = Charge;
  99. if(PartType<0 || PartType>4) {
  100. std::cout << "trackCutMonitor_TpcNSigma: Wrong particle type: " << PartType
  101. << " Set it to 0 (all hypotheses)" << std::endl;
  102. PartType = 0;
  103. }
  104. mPartType = PartType; //0-all, 1-elec, 2-pion, 3-kaon, 4-proton
  105. TString title(TitCutMoni);
  106. switch(mPartType) {
  107. case 0:
  108. hNSigmaElectron = new TH1F(title.Data(),
  109. Form("nSigmaElectron charge=%2d; n#sigma(e); dN/dn#sigma(e)", mCharge),
  110. 40,-10.,10.);
  111. hNSigmaPion = new TH1F(title.Data(),
  112. Form("nSigmaPion charge=%2d; n#sigma(#pi); dN/dn#sigma(e)", mCharge),
  113. 40,-10.,10.);
  114. hNSigmaKaon = new TH1F(title.Data(),
  115. Form("nSigmaKaon charge=%2d; n#sigma(K); dN/dn#sigma(e)", mCharge),
  116. 40,-10.,10.);
  117. hNSigmaProton = new TH1F(title.Data(),
  118. Form("nSigmaProton charge=%2d; n#sigma(p); dN/dn#sigma(e)", mCharge),
  119. 40,-10.,10.);
  120. break;
  121. case 1:
  122. hNSigmaElectron = new TH1F(title.Data(),
  123. Form("nSigmaElectron charge=%2d; n#sigma(e); dN/dn#sigma(e)", mCharge),
  124. 40,-10.,10.);
  125. break;
  126. case 2:
  127. hNSigmaPion = new TH1F(title.Data(),
  128. Form("nSigmaPion charge=%2d; n#sigma(#pi); dN/dn#sigma(e)", mCharge),
  129. 40,-10.,10.);
  130. break;
  131. case 3:
  132. hNSigmaKaon = new TH1F(title.Data(),
  133. Form("nSigmaKaon charge=%2d; n#sigma(K); dN/dn#sigma(e)", mCharge),
  134. 40,-10.,10.);
  135. break;
  136. case 4:
  137. hNSigmaProton = new TH1F(title.Data(),
  138. Form("nSigmaProton charge=%2d; n#sigma(p); dN/dn#sigma(e)", mCharge),
  139. 40,-10.,10.);
  140. break;
  141. default:
  142. hNSigmaElectron = new TH1F(title.Data(),
  143. Form("nSigmaElectron charge=%2d; n#sigma(e); dN/dn#sigma(e)", mCharge),
  144. 40,-10.,10.);
  145. hNSigmaPion = new TH1F(title.Data(),
  146. Form("nSigmaPion charge=%2d; n#sigma(#pi); dN/dn#sigma(e)", mCharge),
  147. 40,-10.,10.);
  148. hNSigmaKaon = new TH1F(title.Data(),
  149. Form("nSigmaKaon charge=%2d; n#sigma(K); dN/dn#sigma(e)", mCharge),
  150. 40,-10.,10.);
  151. hNSigmaProton = new TH1F(title.Data(),
  152. Form("nSigmaProton charge=%2d; n#sigma(p); dN/dn#sigma(e)", mCharge),
  153. 40,-10.,10.);
  154. };
  155. }
  156. //_________________
  157. trackCutMonitor_TpcNSigma::trackCutMonitor_TpcNSigma(Int_t Charge, Int_t PartType,
  158. const Char_t* TitCutMoni,
  159. Int_t nBinsNSigma,
  160. Double_t NSigmaLow,
  161. Double_t NSigmaHi) {
  162. if(Charge<-1. || Charge>1) {
  163. std::cout << "trackCutMonitor_TpcNSigma: Wrong particle charge: " << Charge
  164. << " Set it to 0 (all charges)" << std::endl;
  165. Charge = 0;
  166. }
  167. mCharge = Charge;
  168. if(PartType<0 || PartType>4) {
  169. std::cout << "trackCutMonitor_TpcNSigma: Wrong particle type: " << PartType
  170. << " Set it to 0 (all hypotheses)" << std::endl;
  171. PartType = 0;
  172. }
  173. mPartType = PartType; //0-all, 1-elec, 2-pion, 3-kaon, 4-proton
  174. TString title(TitCutMoni);
  175. Int_t mNBinsX = nBinsNSigma;
  176. Double_t mBinXLo = NSigmaLow;
  177. Double_t mBinXHi = NSigmaHi;
  178. switch(mPartType) {
  179. case 0:
  180. hNSigmaElectron = new TH1F(title.Data(),
  181. Form("nSigmaElectron charge=%2d; n#sigma(e); dN/dn#sigma(e)", mCharge),
  182. mNBinsX, mBinXLo, mBinXHi);
  183. hNSigmaPion = new TH1F(title.Data(),
  184. Form("nSigmaPion charge=%2d; n#sigma(#pi); dN/dn#sigma(e)", mCharge),
  185. mNBinsX, mBinXLo, mBinXHi);
  186. hNSigmaKaon = new TH1F(title.Data(),
  187. Form("nSigmaKaon charge=%2d; n#sigma(K); dN/dn#sigma(e)", mCharge),
  188. mNBinsX, mBinXLo, mBinXHi);
  189. hNSigmaProton = new TH1F(title.Data(),
  190. Form("nSigmaProton charge=%2d; n#sigma(p); dN/dn#sigma(e)", mCharge),
  191. mNBinsX, mBinXLo, mBinXHi);
  192. break;
  193. case 1:
  194. hNSigmaElectron = new TH1F(title.Data(),
  195. Form("nSigmaElectron charge=%2d; n#sigma(e); dN/dn#sigma(e)", mCharge),
  196. mNBinsX, mBinXLo, mBinXHi);
  197. break;
  198. case 2:
  199. hNSigmaPion = new TH1F(title.Data(),
  200. Form("nSigmaPion charge=%2d; n#sigma(#pi); dN/dn#sigma(e)", mCharge),
  201. mNBinsX, mBinXLo, mBinXHi);
  202. break;
  203. case 3:
  204. hNSigmaKaon = new TH1F(title.Data(),
  205. Form("nSigmaKaon charge=%2d; n#sigma(K); dN/dn#sigma(e)", mCharge),
  206. mNBinsX, mBinXLo, mBinXHi);
  207. break;
  208. case 4:
  209. hNSigmaProton = new TH1F(title.Data(),
  210. Form("nSigmaProton charge=%2d; n#sigma(p); dN/dn#sigma(e)", mCharge),
  211. mNBinsX, mBinXLo, mBinXHi);
  212. break;
  213. default:
  214. hNSigmaElectron = new TH1F(title.Data(),
  215. Form("nSigmaElectron charge=%2d; n#sigma(e); dN/dn#sigma(e)", mCharge),
  216. mNBinsX, mBinXLo, mBinXHi);
  217. hNSigmaPion = new TH1F(title.Data(),
  218. Form("nSigmaPion charge=%2d; n#sigma(#pi); dN/dn#sigma(e)", mCharge),
  219. mNBinsX, mBinXLo, mBinXHi);
  220. hNSigmaKaon = new TH1F(title.Data(),
  221. Form("nSigmaKaon charge=%2d; n#sigma(K); dN/dn#sigma(e)", mCharge),
  222. mNBinsX, mBinXLo, mBinXHi);
  223. hNSigmaProton = new TH1F(title.Data(),
  224. Form("nSigmaProton charge=%2d; n#sigma(p); dN/dn#sigma(e)", mCharge),
  225. mNBinsX, mBinXLo, mBinXHi);
  226. };
  227. }
  228. //_________________
  229. trackCutMonitor_TpcNSigma::~trackCutMonitor_TpcNSigma() {
  230. if(hNSigmaElectron) delete hNSigmaElectron;
  231. if(hNSigmaPion) delete hNSigmaPion;
  232. if(hNSigmaKaon) delete hNSigmaKaon;
  233. if(hNSigmaProton) delete hNSigmaProton;
  234. }
  235. //_________________
  236. void trackCutMonitor_TpcNSigma::Fill(const StHbtTrack *track) {
  237. if(track->Charge() == mCharge || mCharge==0) {
  238. switch(mPartType) {
  239. case 0:
  240. hNSigmaElectron->Fill(track->NSigmaElectron());
  241. hNSigmaPion->Fill(track->NSigmaPion());
  242. hNSigmaKaon->Fill(track->NSigmaKaon());
  243. hNSigmaProton->Fill(track->NSigmaProton());
  244. break;
  245. case 1:
  246. hNSigmaElectron->Fill(track->NSigmaElectron());
  247. break;
  248. case 2:
  249. hNSigmaPion->Fill(track->NSigmaPion());
  250. break;
  251. case 3:
  252. hNSigmaKaon->Fill(track->NSigmaKaon());
  253. break;
  254. case 4:
  255. hNSigmaProton->Fill(track->NSigmaProton());
  256. break;
  257. default:
  258. hNSigmaElectron->Fill(track->NSigmaElectron());
  259. hNSigmaPion->Fill(track->NSigmaPion());
  260. hNSigmaKaon->Fill(track->NSigmaKaon());
  261. hNSigmaProton->Fill(track->NSigmaProton());
  262. }; //switch(mPartType)
  263. } //if(track->Charge() == mCharge || mCharge==0)
  264. }