TrackingNtupleObjs.hpp 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. /** TrackingNtupleObjs.hpp created on 2018-01-21 23:00:12.588429 by generate_class.py
  2. * AVOID EDITING THIS FILE BY HAND!! Instead edit TrackingNtupleObjs.yaml and re-run
  3. * generate_class.py
  4. */
  5. #include "filval/filval.hpp"
  6. #include "filval/root/filval.hpp"
  7. #include<cmath>
  8. #include "TrackingNtuple.h"
  9. using namespace std;
  10. using namespace fv;
  11. using namespace fv::root;
  12. typedef TreeDataSet<TrackingNtuple> TrackingDataSet;
  13. struct Seed;
  14. class SeedCollection {
  15. public:
  16. class iter {
  17. public:
  18. iter(const SeedCollection* collection, size_t idx)
  19. :collection(collection), idx(idx) { }
  20. iter operator++() { ++idx; return *this; }
  21. bool operator!=(const iter & other) { return idx != other.idx; }
  22. const Seed operator*() const;
  23. private:
  24. const SeedCollection* collection;
  25. size_t idx;
  26. };
  27. Value<vector<short>>* val_fitok;
  28. Value<vector<float>>* val_px;
  29. Value<vector<float>>* val_py;
  30. Value<vector<float>>* val_pz;
  31. Value<vector<float>>* val_pt;
  32. Value<vector<float>>* val_eta;
  33. Value<vector<float>>* val_phi;
  34. Value<vector<float>>* val_dxy;
  35. Value<vector<float>>* val_dz;
  36. Value<vector<float>>* val_ptErr;
  37. Value<vector<float>>* val_etaErr;
  38. Value<vector<float>>* val_phiErr;
  39. Value<vector<float>>* val_dxyErr;
  40. Value<vector<float>>* val_dzErr;
  41. Value<vector<float>>* val_chi2;
  42. Value<vector<int>>* val_q;
  43. Value<vector<unsigned int>>* val_nValid;
  44. Value<vector<unsigned int>>* val_nPixel;
  45. Value<vector<unsigned int>>* val_nGlued;
  46. Value<vector<unsigned int>>* val_nStrip;
  47. Value<vector<unsigned int>>* val_algo;
  48. Value<vector<int>>* val_trkIdx;
  49. Value<vector<vector<float>>>* val_shareFrac;
  50. Value<vector<vector<int>>>* val_simTrkIdx;
  51. Value<vector<unsigned int>>* val_offset;
  52. Value<vector<vector<int>>>* val_isBarrel;
  53. Value<vector<vector<int>>>* val_layerOrDiskNr;
  54. Value<vector<vector<int>>>* val_isValidPos;
  55. Value<vector<vector<float>>>* val_dRZPos;
  56. Value<vector<vector<float>>>* val_dPhiPos;
  57. Value<vector<vector<int>>>* val_isValidNeg;
  58. Value<vector<vector<float>>>* val_dRZNeg;
  59. Value<vector<vector<float>>>* val_dPhiNeg;
  60. SeedCollection() { }
  61. void init(TrackingDataSet& tds){
  62. val_fitok = tds.track_branch_obj<vector<short>>("see_fitok");
  63. val_px = tds.track_branch_obj<vector<float>>("see_px");
  64. val_py = tds.track_branch_obj<vector<float>>("see_py");
  65. val_pz = tds.track_branch_obj<vector<float>>("see_pz");
  66. val_pt = tds.track_branch_obj<vector<float>>("see_pt");
  67. val_eta = tds.track_branch_obj<vector<float>>("see_eta");
  68. val_phi = tds.track_branch_obj<vector<float>>("see_phi");
  69. val_dxy = tds.track_branch_obj<vector<float>>("see_dxy");
  70. val_dz = tds.track_branch_obj<vector<float>>("see_dz");
  71. val_ptErr = tds.track_branch_obj<vector<float>>("see_ptErr");
  72. val_etaErr = tds.track_branch_obj<vector<float>>("see_etaErr");
  73. val_phiErr = tds.track_branch_obj<vector<float>>("see_phiErr");
  74. val_dxyErr = tds.track_branch_obj<vector<float>>("see_dxyErr");
  75. val_dzErr = tds.track_branch_obj<vector<float>>("see_dzErr");
  76. val_chi2 = tds.track_branch_obj<vector<float>>("see_chi2");
  77. val_q = tds.track_branch_obj<vector<int>>("see_q");
  78. val_nValid = tds.track_branch_obj<vector<unsigned int>>("see_nValid");
  79. val_nPixel = tds.track_branch_obj<vector<unsigned int>>("see_nPixel");
  80. val_nGlued = tds.track_branch_obj<vector<unsigned int>>("see_nGlued");
  81. val_nStrip = tds.track_branch_obj<vector<unsigned int>>("see_nStrip");
  82. val_algo = tds.track_branch_obj<vector<unsigned int>>("see_algo");
  83. val_trkIdx = tds.track_branch_obj<vector<int>>("see_trkIdx");
  84. val_shareFrac = tds.track_branch_obj<vector<vector<float>>>("see_shareFrac");
  85. val_simTrkIdx = tds.track_branch_obj<vector<vector<int>>>("see_simTrkIdx");
  86. val_offset = tds.track_branch_obj<vector<unsigned int>>("see_offset");
  87. val_isBarrel = tds.track_branch_obj<vector<vector<int>>>("see_isBarrel");
  88. val_layerOrDiskNr = tds.track_branch_obj<vector<vector<int>>>("see_layerOrDiskNr");
  89. val_isValidPos = tds.track_branch_obj<vector<vector<int>>>("see_isValidPos");
  90. val_dRZPos = tds.track_branch_obj<vector<vector<float>>>("see_dRZPos");
  91. val_dPhiPos = tds.track_branch_obj<vector<vector<float>>>("see_dPhiPos");
  92. val_isValidNeg = tds.track_branch_obj<vector<vector<int>>>("see_isValidNeg");
  93. val_dRZNeg = tds.track_branch_obj<vector<vector<float>>>("see_dRZNeg");
  94. val_dPhiNeg = tds.track_branch_obj<vector<vector<float>>>("see_dPhiNeg");
  95. }
  96. size_t size() const { return val_fitok->get_value().size();}
  97. const Seed operator[](size_t) const;
  98. iter begin() const { return iter(this, 0); }
  99. iter end() const { return iter(this, size()); }
  100. };
  101. struct Seed {
  102. const SeedCollection* collection;
  103. const size_t idx;
  104. Seed(const SeedCollection* collection, const size_t idx)
  105. :collection(collection), idx(idx) { }
  106. const short& fitok() const {return collection->val_fitok->get_value().at(idx);}
  107. const float& px() const {return collection->val_px->get_value().at(idx);}
  108. const float& py() const {return collection->val_py->get_value().at(idx);}
  109. const float& pz() const {return collection->val_pz->get_value().at(idx);}
  110. const float& pt() const {return collection->val_pt->get_value().at(idx);}
  111. const float& eta() const {return collection->val_eta->get_value().at(idx);}
  112. const float& phi() const {return collection->val_phi->get_value().at(idx);}
  113. const float& dxy() const {return collection->val_dxy->get_value().at(idx);}
  114. const float& dz() const {return collection->val_dz->get_value().at(idx);}
  115. const float& ptErr() const {return collection->val_ptErr->get_value().at(idx);}
  116. const float& etaErr() const {return collection->val_etaErr->get_value().at(idx);}
  117. const float& phiErr() const {return collection->val_phiErr->get_value().at(idx);}
  118. const float& dxyErr() const {return collection->val_dxyErr->get_value().at(idx);}
  119. const float& dzErr() const {return collection->val_dzErr->get_value().at(idx);}
  120. const float& chi2() const {return collection->val_chi2->get_value().at(idx);}
  121. const int& q() const {return collection->val_q->get_value().at(idx);}
  122. const unsigned int& nValid() const {return collection->val_nValid->get_value().at(idx);}
  123. const unsigned int& nPixel() const {return collection->val_nPixel->get_value().at(idx);}
  124. const unsigned int& nGlued() const {return collection->val_nGlued->get_value().at(idx);}
  125. const unsigned int& nStrip() const {return collection->val_nStrip->get_value().at(idx);}
  126. const unsigned int& algo() const {return collection->val_algo->get_value().at(idx);}
  127. const int& trkIdx() const {return collection->val_trkIdx->get_value().at(idx);}
  128. const vector<float>& shareFrac() const {return collection->val_shareFrac->get_value().at(idx);}
  129. const vector<int>& simTrkIdx() const {return collection->val_simTrkIdx->get_value().at(idx);}
  130. const unsigned int& offset() const {return collection->val_offset->get_value().at(idx);}
  131. const vector<int>& isBarrel() const {return collection->val_isBarrel->get_value().at(idx);}
  132. const vector<int>& layerOrDiskNr() const {return collection->val_layerOrDiskNr->get_value().at(idx);}
  133. const vector<int>& isValidPos() const {return collection->val_isValidPos->get_value().at(idx);}
  134. const vector<float>& dRZPos() const {return collection->val_dRZPos->get_value().at(idx);}
  135. const vector<float>& dPhiPos() const {return collection->val_dPhiPos->get_value().at(idx);}
  136. const vector<int>& isValidNeg() const {return collection->val_isValidNeg->get_value().at(idx);}
  137. const vector<float>& dRZNeg() const {return collection->val_dRZNeg->get_value().at(idx);}
  138. const vector<float>& dPhiNeg() const {return collection->val_dPhiNeg->get_value().at(idx);}
  139. };
  140. const Seed SeedCollection::iter::operator*() const {
  141. return {collection, idx};
  142. }
  143. const Seed SeedCollection::operator[](size_t idx) const {
  144. return {this, idx};
  145. }
  146. struct Track;
  147. class TrackCollection {
  148. public:
  149. class iter {
  150. public:
  151. iter(const TrackCollection* collection, size_t idx)
  152. :collection(collection), idx(idx) { }
  153. iter operator++() { ++idx; return *this; }
  154. bool operator!=(const iter & other) { return idx != other.idx; }
  155. const Track operator*() const;
  156. private:
  157. const TrackCollection* collection;
  158. size_t idx;
  159. };
  160. Value<vector<float>>* val_px;
  161. Value<vector<float>>* val_py;
  162. Value<vector<float>>* val_pz;
  163. Value<vector<float>>* val_pt;
  164. Value<vector<float>>* val_inner_px;
  165. Value<vector<float>>* val_inner_py;
  166. Value<vector<float>>* val_inner_pz;
  167. Value<vector<float>>* val_inner_pt;
  168. Value<vector<float>>* val_outer_px;
  169. Value<vector<float>>* val_outer_py;
  170. Value<vector<float>>* val_outer_pz;
  171. Value<vector<float>>* val_outer_pt;
  172. Value<vector<float>>* val_eta;
  173. Value<vector<float>>* val_lambda;
  174. Value<vector<float>>* val_cotTheta;
  175. Value<vector<float>>* val_phi;
  176. Value<vector<float>>* val_dxy;
  177. Value<vector<float>>* val_dz;
  178. Value<vector<float>>* val_ptErr;
  179. Value<vector<float>>* val_etaErr;
  180. Value<vector<float>>* val_lambdaErr;
  181. Value<vector<float>>* val_phiErr;
  182. Value<vector<float>>* val_dxyErr;
  183. Value<vector<float>>* val_dzErr;
  184. Value<vector<float>>* val_refpoint_x;
  185. Value<vector<float>>* val_refpoint_y;
  186. Value<vector<float>>* val_refpoint_z;
  187. Value<vector<float>>* val_nChi2;
  188. Value<vector<int>>* val_q;
  189. Value<vector<unsigned int>>* val_nValid;
  190. Value<vector<unsigned int>>* val_nInvalid;
  191. Value<vector<unsigned int>>* val_nPixel;
  192. Value<vector<unsigned int>>* val_nStrip;
  193. Value<vector<unsigned int>>* val_nPixelLay;
  194. Value<vector<unsigned int>>* val_nStripLay;
  195. Value<vector<unsigned int>>* val_n3DLay;
  196. Value<vector<unsigned int>>* val_nOuterLost;
  197. Value<vector<unsigned int>>* val_nInnerLost;
  198. Value<vector<unsigned int>>* val_algo;
  199. Value<vector<unsigned int>>* val_originalAlgo;
  200. Value<vector<ULong64_t>>* val_algoMask;
  201. Value<vector<unsigned int>>* val_stopReason;
  202. Value<vector<short>>* val_isHP;
  203. Value<vector<int>>* val_seedIdx;
  204. Value<vector<float>>* val_vtxx;
  205. Value<vector<float>>* val_vtxy;
  206. Value<vector<float>>* val_vtxz;
  207. Value<vector<vector<float>>>* val_shareFrac;
  208. Value<vector<vector<int>>>* val_simTrkIdx;
  209. Value<vector<int>>* val_genIdx;
  210. Value<vector<float>>* val_genDR;
  211. TrackCollection() { }
  212. void init(TrackingDataSet& tds){
  213. val_px = tds.track_branch_obj<vector<float>>("trk_px");
  214. val_py = tds.track_branch_obj<vector<float>>("trk_py");
  215. val_pz = tds.track_branch_obj<vector<float>>("trk_pz");
  216. val_pt = tds.track_branch_obj<vector<float>>("trk_pt");
  217. val_inner_px = tds.track_branch_obj<vector<float>>("trk_inner_px");
  218. val_inner_py = tds.track_branch_obj<vector<float>>("trk_inner_py");
  219. val_inner_pz = tds.track_branch_obj<vector<float>>("trk_inner_pz");
  220. val_inner_pt = tds.track_branch_obj<vector<float>>("trk_inner_pt");
  221. val_outer_px = tds.track_branch_obj<vector<float>>("trk_outer_px");
  222. val_outer_py = tds.track_branch_obj<vector<float>>("trk_outer_py");
  223. val_outer_pz = tds.track_branch_obj<vector<float>>("trk_outer_pz");
  224. val_outer_pt = tds.track_branch_obj<vector<float>>("trk_outer_pt");
  225. val_eta = tds.track_branch_obj<vector<float>>("trk_eta");
  226. val_lambda = tds.track_branch_obj<vector<float>>("trk_lambda");
  227. val_cotTheta = tds.track_branch_obj<vector<float>>("trk_cotTheta");
  228. val_phi = tds.track_branch_obj<vector<float>>("trk_phi");
  229. val_dxy = tds.track_branch_obj<vector<float>>("trk_dxy");
  230. val_dz = tds.track_branch_obj<vector<float>>("trk_dz");
  231. val_ptErr = tds.track_branch_obj<vector<float>>("trk_ptErr");
  232. val_etaErr = tds.track_branch_obj<vector<float>>("trk_etaErr");
  233. val_lambdaErr = tds.track_branch_obj<vector<float>>("trk_lambdaErr");
  234. val_phiErr = tds.track_branch_obj<vector<float>>("trk_phiErr");
  235. val_dxyErr = tds.track_branch_obj<vector<float>>("trk_dxyErr");
  236. val_dzErr = tds.track_branch_obj<vector<float>>("trk_dzErr");
  237. val_refpoint_x = tds.track_branch_obj<vector<float>>("trk_refpoint_x");
  238. val_refpoint_y = tds.track_branch_obj<vector<float>>("trk_refpoint_y");
  239. val_refpoint_z = tds.track_branch_obj<vector<float>>("trk_refpoint_z");
  240. val_nChi2 = tds.track_branch_obj<vector<float>>("trk_nChi2");
  241. val_q = tds.track_branch_obj<vector<int>>("trk_q");
  242. val_nValid = tds.track_branch_obj<vector<unsigned int>>("trk_nValid");
  243. val_nInvalid = tds.track_branch_obj<vector<unsigned int>>("trk_nInvalid");
  244. val_nPixel = tds.track_branch_obj<vector<unsigned int>>("trk_nPixel");
  245. val_nStrip = tds.track_branch_obj<vector<unsigned int>>("trk_nStrip");
  246. val_nPixelLay = tds.track_branch_obj<vector<unsigned int>>("trk_nPixelLay");
  247. val_nStripLay = tds.track_branch_obj<vector<unsigned int>>("trk_nStripLay");
  248. val_n3DLay = tds.track_branch_obj<vector<unsigned int>>("trk_n3DLay");
  249. val_nOuterLost = tds.track_branch_obj<vector<unsigned int>>("trk_nOuterLost");
  250. val_nInnerLost = tds.track_branch_obj<vector<unsigned int>>("trk_nInnerLost");
  251. val_algo = tds.track_branch_obj<vector<unsigned int>>("trk_algo");
  252. val_originalAlgo = tds.track_branch_obj<vector<unsigned int>>("trk_originalAlgo");
  253. val_algoMask = tds.track_branch_obj<vector<ULong64_t>>("trk_algoMask");
  254. val_stopReason = tds.track_branch_obj<vector<unsigned int>>("trk_stopReason");
  255. val_isHP = tds.track_branch_obj<vector<short>>("trk_isHP");
  256. val_seedIdx = tds.track_branch_obj<vector<int>>("trk_seedIdx");
  257. val_vtxx = tds.track_branch_obj<vector<float>>("trk_vtxx");
  258. val_vtxy = tds.track_branch_obj<vector<float>>("trk_vtxy");
  259. val_vtxz = tds.track_branch_obj<vector<float>>("trk_vtxz");
  260. val_shareFrac = tds.track_branch_obj<vector<vector<float>>>("trk_shareFrac");
  261. val_simTrkIdx = tds.track_branch_obj<vector<vector<int>>>("trk_simTrkIdx");
  262. val_genIdx = tds.track_branch_obj<vector<int>>("trk_genIdx");
  263. val_genDR = tds.track_branch_obj<vector<float>>("trk_genDR");
  264. }
  265. size_t size() const { return val_px->get_value().size();}
  266. const Track operator[](size_t) const;
  267. iter begin() const { return iter(this, 0); }
  268. iter end() const { return iter(this, size()); }
  269. };
  270. struct Track {
  271. const TrackCollection* collection;
  272. const size_t idx;
  273. Track(const TrackCollection* collection, const size_t idx)
  274. :collection(collection), idx(idx) { }
  275. const float& px() const {return collection->val_px->get_value().at(idx);}
  276. const float& py() const {return collection->val_py->get_value().at(idx);}
  277. const float& pz() const {return collection->val_pz->get_value().at(idx);}
  278. const float& pt() const {return collection->val_pt->get_value().at(idx);}
  279. const float& inner_px() const {return collection->val_inner_px->get_value().at(idx);}
  280. const float& inner_py() const {return collection->val_inner_py->get_value().at(idx);}
  281. const float& inner_pz() const {return collection->val_inner_pz->get_value().at(idx);}
  282. const float& inner_pt() const {return collection->val_inner_pt->get_value().at(idx);}
  283. const float& outer_px() const {return collection->val_outer_px->get_value().at(idx);}
  284. const float& outer_py() const {return collection->val_outer_py->get_value().at(idx);}
  285. const float& outer_pz() const {return collection->val_outer_pz->get_value().at(idx);}
  286. const float& outer_pt() const {return collection->val_outer_pt->get_value().at(idx);}
  287. const float& eta() const {return collection->val_eta->get_value().at(idx);}
  288. const float& lambda() const {return collection->val_lambda->get_value().at(idx);}
  289. const float& cotTheta() const {return collection->val_cotTheta->get_value().at(idx);}
  290. const float& phi() const {return collection->val_phi->get_value().at(idx);}
  291. const float& dxy() const {return collection->val_dxy->get_value().at(idx);}
  292. const float& dz() const {return collection->val_dz->get_value().at(idx);}
  293. const float& ptErr() const {return collection->val_ptErr->get_value().at(idx);}
  294. const float& etaErr() const {return collection->val_etaErr->get_value().at(idx);}
  295. const float& lambdaErr() const {return collection->val_lambdaErr->get_value().at(idx);}
  296. const float& phiErr() const {return collection->val_phiErr->get_value().at(idx);}
  297. const float& dxyErr() const {return collection->val_dxyErr->get_value().at(idx);}
  298. const float& dzErr() const {return collection->val_dzErr->get_value().at(idx);}
  299. const float& refpoint_x() const {return collection->val_refpoint_x->get_value().at(idx);}
  300. const float& refpoint_y() const {return collection->val_refpoint_y->get_value().at(idx);}
  301. const float& refpoint_z() const {return collection->val_refpoint_z->get_value().at(idx);}
  302. const float& nChi2() const {return collection->val_nChi2->get_value().at(idx);}
  303. const int& q() const {return collection->val_q->get_value().at(idx);}
  304. const unsigned int& nValid() const {return collection->val_nValid->get_value().at(idx);}
  305. const unsigned int& nInvalid() const {return collection->val_nInvalid->get_value().at(idx);}
  306. const unsigned int& nPixel() const {return collection->val_nPixel->get_value().at(idx);}
  307. const unsigned int& nStrip() const {return collection->val_nStrip->get_value().at(idx);}
  308. const unsigned int& nPixelLay() const {return collection->val_nPixelLay->get_value().at(idx);}
  309. const unsigned int& nStripLay() const {return collection->val_nStripLay->get_value().at(idx);}
  310. const unsigned int& n3DLay() const {return collection->val_n3DLay->get_value().at(idx);}
  311. const unsigned int& nOuterLost() const {return collection->val_nOuterLost->get_value().at(idx);}
  312. const unsigned int& nInnerLost() const {return collection->val_nInnerLost->get_value().at(idx);}
  313. const unsigned int& algo() const {return collection->val_algo->get_value().at(idx);}
  314. const unsigned int& originalAlgo() const {return collection->val_originalAlgo->get_value().at(idx);}
  315. const ULong64_t& algoMask() const {return collection->val_algoMask->get_value().at(idx);}
  316. const unsigned int& stopReason() const {return collection->val_stopReason->get_value().at(idx);}
  317. const short& isHP() const {return collection->val_isHP->get_value().at(idx);}
  318. const int& seedIdx() const {return collection->val_seedIdx->get_value().at(idx);}
  319. const float& vtxx() const {return collection->val_vtxx->get_value().at(idx);}
  320. const float& vtxy() const {return collection->val_vtxy->get_value().at(idx);}
  321. const float& vtxz() const {return collection->val_vtxz->get_value().at(idx);}
  322. const vector<float>& shareFrac() const {return collection->val_shareFrac->get_value().at(idx);}
  323. const vector<int>& simTrkIdx() const {return collection->val_simTrkIdx->get_value().at(idx);}
  324. const int& genIdx() const {return collection->val_genIdx->get_value().at(idx);}
  325. const float& genDR() const {return collection->val_genDR->get_value().at(idx);}
  326. };
  327. const Track TrackCollection::iter::operator*() const {
  328. return {collection, idx};
  329. }
  330. const Track TrackCollection::operator[](size_t idx) const {
  331. return {this, idx};
  332. }
  333. struct SimTrack;
  334. class SimTrackCollection {
  335. public:
  336. class iter {
  337. public:
  338. iter(const SimTrackCollection* collection, size_t idx)
  339. :collection(collection), idx(idx) { }
  340. iter operator++() { ++idx; return *this; }
  341. bool operator!=(const iter & other) { return idx != other.idx; }
  342. const SimTrack operator*() const;
  343. private:
  344. const SimTrackCollection* collection;
  345. size_t idx;
  346. };
  347. Value<vector<int>>* val_event;
  348. Value<vector<int>>* val_bunchCrossing;
  349. Value<vector<int>>* val_pdgId;
  350. Value<vector<float>>* val_px;
  351. Value<vector<float>>* val_py;
  352. Value<vector<float>>* val_pz;
  353. Value<vector<float>>* val_pt;
  354. Value<vector<float>>* val_eta;
  355. Value<vector<float>>* val_phi;
  356. Value<vector<float>>* val_pca_pt;
  357. Value<vector<float>>* val_pca_eta;
  358. Value<vector<float>>* val_pca_lambda;
  359. Value<vector<float>>* val_pca_cotTheta;
  360. Value<vector<float>>* val_pca_phi;
  361. Value<vector<float>>* val_pca_dxy;
  362. Value<vector<float>>* val_pca_dz;
  363. Value<vector<int>>* val_q;
  364. Value<vector<unsigned int>>* val_nValid;
  365. Value<vector<unsigned int>>* val_nPixel;
  366. Value<vector<unsigned int>>* val_nStrip;
  367. Value<vector<unsigned int>>* val_nLay;
  368. Value<vector<unsigned int>>* val_nPixelLay;
  369. Value<vector<unsigned int>>* val_n3DLay;
  370. Value<vector<vector<int>>>* val_trkIdx;
  371. Value<vector<vector<float>>>* val_shareFrac;
  372. Value<vector<int>>* val_parentVtxIdx;
  373. Value<vector<vector<int>>>* val_decayVtxIdx;
  374. Value<vector<vector<int>>>* val_seedIdx;
  375. SimTrackCollection() { }
  376. void init(TrackingDataSet& tds){
  377. val_event = tds.track_branch_obj<vector<int>>("sim_event");
  378. val_bunchCrossing = tds.track_branch_obj<vector<int>>("sim_bunchCrossing");
  379. val_pdgId = tds.track_branch_obj<vector<int>>("sim_pdgId");
  380. val_px = tds.track_branch_obj<vector<float>>("sim_px");
  381. val_py = tds.track_branch_obj<vector<float>>("sim_py");
  382. val_pz = tds.track_branch_obj<vector<float>>("sim_pz");
  383. val_pt = tds.track_branch_obj<vector<float>>("sim_pt");
  384. val_eta = tds.track_branch_obj<vector<float>>("sim_eta");
  385. val_phi = tds.track_branch_obj<vector<float>>("sim_phi");
  386. val_pca_pt = tds.track_branch_obj<vector<float>>("sim_pca_pt");
  387. val_pca_eta = tds.track_branch_obj<vector<float>>("sim_pca_eta");
  388. val_pca_lambda = tds.track_branch_obj<vector<float>>("sim_pca_lambda");
  389. val_pca_cotTheta = tds.track_branch_obj<vector<float>>("sim_pca_cotTheta");
  390. val_pca_phi = tds.track_branch_obj<vector<float>>("sim_pca_phi");
  391. val_pca_dxy = tds.track_branch_obj<vector<float>>("sim_pca_dxy");
  392. val_pca_dz = tds.track_branch_obj<vector<float>>("sim_pca_dz");
  393. val_q = tds.track_branch_obj<vector<int>>("sim_q");
  394. val_nValid = tds.track_branch_obj<vector<unsigned int>>("sim_nValid");
  395. val_nPixel = tds.track_branch_obj<vector<unsigned int>>("sim_nPixel");
  396. val_nStrip = tds.track_branch_obj<vector<unsigned int>>("sim_nStrip");
  397. val_nLay = tds.track_branch_obj<vector<unsigned int>>("sim_nLay");
  398. val_nPixelLay = tds.track_branch_obj<vector<unsigned int>>("sim_nPixelLay");
  399. val_n3DLay = tds.track_branch_obj<vector<unsigned int>>("sim_n3DLay");
  400. val_trkIdx = tds.track_branch_obj<vector<vector<int>>>("sim_trkIdx");
  401. val_shareFrac = tds.track_branch_obj<vector<vector<float>>>("sim_shareFrac");
  402. val_parentVtxIdx = tds.track_branch_obj<vector<int>>("sim_parentVtxIdx");
  403. val_decayVtxIdx = tds.track_branch_obj<vector<vector<int>>>("sim_decayVtxIdx");
  404. val_seedIdx = tds.track_branch_obj<vector<vector<int>>>("sim_seedIdx");
  405. }
  406. size_t size() const { return val_event->get_value().size();}
  407. const SimTrack operator[](size_t) const;
  408. iter begin() const { return iter(this, 0); }
  409. iter end() const { return iter(this, size()); }
  410. };
  411. struct SimTrack {
  412. const SimTrackCollection* collection;
  413. const size_t idx;
  414. SimTrack(const SimTrackCollection* collection, const size_t idx)
  415. :collection(collection), idx(idx) { }
  416. const int& event() const {return collection->val_event->get_value().at(idx);}
  417. const int& bunchCrossing() const {return collection->val_bunchCrossing->get_value().at(idx);}
  418. const int& pdgId() const {return collection->val_pdgId->get_value().at(idx);}
  419. const float& px() const {return collection->val_px->get_value().at(idx);}
  420. const float& py() const {return collection->val_py->get_value().at(idx);}
  421. const float& pz() const {return collection->val_pz->get_value().at(idx);}
  422. const float& pt() const {return collection->val_pt->get_value().at(idx);}
  423. const float& eta() const {return collection->val_eta->get_value().at(idx);}
  424. const float& phi() const {return collection->val_phi->get_value().at(idx);}
  425. const float& pca_pt() const {return collection->val_pca_pt->get_value().at(idx);}
  426. const float& pca_eta() const {return collection->val_pca_eta->get_value().at(idx);}
  427. const float& pca_lambda() const {return collection->val_pca_lambda->get_value().at(idx);}
  428. const float& pca_cotTheta() const {return collection->val_pca_cotTheta->get_value().at(idx);}
  429. const float& pca_phi() const {return collection->val_pca_phi->get_value().at(idx);}
  430. const float& pca_dxy() const {return collection->val_pca_dxy->get_value().at(idx);}
  431. const float& pca_dz() const {return collection->val_pca_dz->get_value().at(idx);}
  432. const int& q() const {return collection->val_q->get_value().at(idx);}
  433. const unsigned int& nValid() const {return collection->val_nValid->get_value().at(idx);}
  434. const unsigned int& nPixel() const {return collection->val_nPixel->get_value().at(idx);}
  435. const unsigned int& nStrip() const {return collection->val_nStrip->get_value().at(idx);}
  436. const unsigned int& nLay() const {return collection->val_nLay->get_value().at(idx);}
  437. const unsigned int& nPixelLay() const {return collection->val_nPixelLay->get_value().at(idx);}
  438. const unsigned int& n3DLay() const {return collection->val_n3DLay->get_value().at(idx);}
  439. const vector<int>& trkIdx() const {return collection->val_trkIdx->get_value().at(idx);}
  440. const vector<float>& shareFrac() const {return collection->val_shareFrac->get_value().at(idx);}
  441. const int& parentVtxIdx() const {return collection->val_parentVtxIdx->get_value().at(idx);}
  442. const vector<int>& decayVtxIdx() const {return collection->val_decayVtxIdx->get_value().at(idx);}
  443. const vector<int>& seedIdx() const {return collection->val_seedIdx->get_value().at(idx);}
  444. };
  445. const SimTrack SimTrackCollection::iter::operator*() const {
  446. return {collection, idx};
  447. }
  448. const SimTrack SimTrackCollection::operator[](size_t idx) const {
  449. return {this, idx};
  450. }
  451. struct SimVertex;
  452. class SimVertexCollection {
  453. public:
  454. class iter {
  455. public:
  456. iter(const SimVertexCollection* collection, size_t idx)
  457. :collection(collection), idx(idx) { }
  458. iter operator++() { ++idx; return *this; }
  459. bool operator!=(const iter & other) { return idx != other.idx; }
  460. const SimVertex operator*() const;
  461. private:
  462. const SimVertexCollection* collection;
  463. size_t idx;
  464. };
  465. Value<vector<int>>* val_event;
  466. Value<vector<int>>* val_bunchCrossing;
  467. Value<vector<unsigned int>>* val_processType;
  468. Value<vector<float>>* val_x;
  469. Value<vector<float>>* val_y;
  470. Value<vector<float>>* val_z;
  471. Value<vector<vector<int>>>* val_sourceSimIdx;
  472. Value<vector<vector<int>>>* val_daughterSimIdx;
  473. SimVertexCollection() { }
  474. void init(TrackingDataSet& tds){
  475. val_event = tds.track_branch_obj<vector<int>>("simvtx_event");
  476. val_bunchCrossing = tds.track_branch_obj<vector<int>>("simvtx_bunchCrossing");
  477. val_processType = tds.track_branch_obj<vector<unsigned int>>("simvtx_processType");
  478. val_x = tds.track_branch_obj<vector<float>>("simvtx_x");
  479. val_y = tds.track_branch_obj<vector<float>>("simvtx_y");
  480. val_z = tds.track_branch_obj<vector<float>>("simvtx_z");
  481. val_sourceSimIdx = tds.track_branch_obj<vector<vector<int>>>("simvtx_sourceSimIdx");
  482. val_daughterSimIdx = tds.track_branch_obj<vector<vector<int>>>("simvtx_daughterSimIdx");
  483. }
  484. size_t size() const { return val_event->get_value().size();}
  485. const SimVertex operator[](size_t) const;
  486. iter begin() const { return iter(this, 0); }
  487. iter end() const { return iter(this, size()); }
  488. };
  489. struct SimVertex {
  490. const SimVertexCollection* collection;
  491. const size_t idx;
  492. SimVertex(const SimVertexCollection* collection, const size_t idx)
  493. :collection(collection), idx(idx) { }
  494. const int& event() const {return collection->val_event->get_value().at(idx);}
  495. const int& bunchCrossing() const {return collection->val_bunchCrossing->get_value().at(idx);}
  496. const unsigned int& processType() const {return collection->val_processType->get_value().at(idx);}
  497. const float& x() const {return collection->val_x->get_value().at(idx);}
  498. const float& y() const {return collection->val_y->get_value().at(idx);}
  499. const float& z() const {return collection->val_z->get_value().at(idx);}
  500. const vector<int>& sourceSimIdx() const {return collection->val_sourceSimIdx->get_value().at(idx);}
  501. const vector<int>& daughterSimIdx() const {return collection->val_daughterSimIdx->get_value().at(idx);}
  502. };
  503. const SimVertex SimVertexCollection::iter::operator*() const {
  504. return {collection, idx};
  505. }
  506. const SimVertex SimVertexCollection::operator[](size_t idx) const {
  507. return {this, idx};
  508. }