TrackingNtupleObjs.hpp 28 KB

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