TrackingNtupleObjs.hpp 28 KB

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