StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEventHitIter.cxx
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <assert.h>
4 #include "StEvent.h"
6 #include "StHit.h"
7 #include "StEventHitIter.h"
8 #include "StTpcHitCollection.h"
9 #include "StTpcSectorHitCollection.h"
10 #include "StTpcPadrowHitCollection.h"
11 #include "StFtpcHitCollection.h"
12 #include "StFtpcPlaneHitCollection.h"
13 #include "StSsdHitCollection.h"
14 #include "StSvtHitCollection.h"
15 #include "StRnDHitCollection.h"
16 #include "StEtrHitCollection.h"
17 #include "StTofCollection.h"
18 #include "StFgtCollection.h"
19 #include "StFgtHitCollection.h"
20 #include "StFgtPointCollection.h"
21 #include "StIstHitCollection.h"
22 #include "StFstHitCollection.h"
23 
24 ClassImp(StHitIter)
25 ClassImp(StHitIterGroup)
26 ClassImp(StEventHitIter)
27 
28 //________________________________________________________________________________
30 {
31 fCont = 0;
32 fDowIter=0;
33 fJIter=-1;
34 fNIter=0;
35 }
36 //________________________________________________________________________________
37 StHitIter::~StHitIter()
38 {
39  delete fDowIter;fDowIter=0;
40 }
41 //________________________________________________________________________________
42 const TObject *StHitIter::Reset(const TObject *cont)
43 {
44  fCont = cont;
45  if (!fCont) return 0;
46  fNIter = GetSize();
47  for (fJIter =0;fJIter<fNIter;fJIter++) {
48  const TObject *dowCont = GetObject(fJIter);
49  if (!dowCont) continue;
50  if (!fDowIter) return dowCont;
51  const TObject *to = fDowIter->Reset(dowCont);
52  if (to) return to;
53  }
54  return 0;
55 }
56 //________________________________________________________________________________
57 const TObject *StHitIter::Get() const
58 {
59  if (fJIter>=fNIter) return 0;
60  const TObject *obj = GetObject(fJIter);
61  if (!obj) return 0;
62  if (!fDowIter) return obj;
63  return fDowIter->Get();
64 }
65 //________________________________________________________________________________
66 const TObject *StHitIter::operator++()
67 {
68  const TObject *to=0;
69  if (fJIter>=fNIter) return 0;
70  if (!fDowIter) { //Lowest level. Hits are there
71  while (++fJIter<fNIter) {
72  if ((to = GetObject(fJIter))) return to;;
73  }
74  return 0;
75  }
76 // Intermediate level, containers there
77  if ((to= ++(*fDowIter))) return to;
78  while(++fJIter<fNIter) {
79  if (!(to=GetObject(fJIter))) continue;;
80  if ( (to=fDowIter->Reset(to))) return to;
81  }
82  return 0;
83 }
84 //________________________________________________________________________________
85 void StHitIter::UPath(ULong64_t &upath) const
86 {
87  if (fDowIter) fDowIter->UPath(upath);
88  upath*=fNIter; upath+=fJIter;
89 }
90 
91 //________________________________________________________________________________
92 //________________________________________________________________________________
93 StHitIterGroup::StHitIterGroup()
94 {
95  fDetectorId = kUnknownId;
96 }
97 //________________________________________________________________________________
98 StHitIterGroup::~StHitIterGroup()
99 {
100  for (int i=0;i<(int)fGroup.size();i++) { delete fGroup[i];}
101 }
102 //________________________________________________________________________________
103 const TObject *StHitIterGroup::Reset(const TObject *cont)
104 {
105  if (cont) fCont=cont;
106  if (!fCont) return 0;
107  fDetectorId = kUnknownId;
108  fNIter = fGroup.size();
109  for (fJIter=0;fJIter<fNIter;fJIter++) {
110  const TObject *to=fGroup[fJIter]->Reset(fCont);
111  if (to) return to;
112  }
113  return 0;
114 }
115 //________________________________________________________________________________
116 void StHitIterGroup::Add(StHitIter* iter)
117 {
118  fGroup.push_back(iter);
119  fNIter = fGroup.size();
120 }
121 //________________________________________________________________________________
122 const TObject *StHitIterGroup::GetObject (int) const
123 { assert(0 && "In StHitIterGroup::GetObject");}
124 //________________________________________________________________________________
125 const TObject *StHitIterGroup::Get () const
126 {
127  fDetectorId = kUnknownId;
128  if (fJIter>=fNIter) return 0;
129  fDetectorId = fGroup[fJIter]->DetectorId();
130  return fGroup[fJIter]->Get();
131 }
132 //________________________________________________________________________________
134 {
135  if (fJIter>=fNIter) return 0;
136  const TObject *to;
137  if ((to=++(*fGroup[fJIter]))) return to;
138 
139  while(++fJIter<fNIter) {
140  to = fGroup[fJIter]->Reset(fCont);
141  if (to) return to;
142  }
143  return 0;
144 }
145 //________________________________________________________________________________
146 UInt_t StHitIterGroup::UPath() const
147 {
148  ULong64_t ul=0;
149  UPath(ul);
150  assert(!(ul>>32));
151  return ul;
152 }
153 //________________________________________________________________________________
154 void StHitIterGroup::UPath(ULong64_t &ul) const
155 {
156  fGroup[fJIter]->UPath(ul);
157 }
158 
159 //________________________________________________________________________________
160 //_______TPC_______TPC_______TPC_______TPC_______TPC_______TPC_______TPC_______TPC
161 //________________________________________________________________________________
162 
163 //..............................................................................
164 class StTpcHitIter : public StHitIter {
165 public:
166  StTpcHitIter();
167 virtual ~StTpcHitIter(){;}
168 virtual const TObject *Reset(const TObject *cont);
169 virtual const TObject *GetObject (int idx) const;
170 virtual int GetSize () const;
171  StDetectorId DetectorId() const {return kTpcId;}
172 protected:
173 };
174 
175 //..............................................................................
177 public:
178  StTpcSectorHitIter(){;}
179 virtual ~StTpcSectorHitIter(){;}
180 virtual const TObject *GetObject (int idx) const;
181 virtual int GetSize () const;
182 protected:
183 };
184 //..............................................................................
186 public:
187  StTpcPadrowHitIter(){;}
188 virtual ~StTpcPadrowHitIter(){;}
189 virtual const TObject *GetObject (int idx) const;
190 virtual int GetSize () const;
191 protected:
192 };
193 
194 //________________________________________________________________________________
195 StTpcHitIter::StTpcHitIter()
196 {
197  StHitIter *obj=this,*hi;
198 
199  // Create a new iterator over sectors and register it with tpc hit iter
200  hi = new StTpcSectorHitIter();
201  obj->SetDowIter(hi);
202  obj = hi;
203 
204  // Create a new iterator over padrows and register it with sector iter
205  hi = new StTpcPadrowHitIter();
206  obj->SetDowIter(hi);
207  obj = hi;
208 }
209 //________________________________________________________________________________
210 const TObject *StTpcHitIter::Reset(const TObject *cont)
211 {
212  const StTpcHitCollection *to = 0;
213  if (cont) to = ((StEvent*)cont)->tpcHitCollection();
214  return StHitIter::Reset(to);
215 }
216 
217 //________________________________________________________________________________
219 { return ((StTpcHitCollection*)fCont)->numberOfSectors();}
220 
221 
222 //________________________________________________________________________________
223 const TObject *StTpcHitIter::GetObject (int idx) const
224 {
225  return ((StTpcHitCollection*)fCont)->sector(idx);
226 }
227 //________________________________________________________________________________
228 const TObject *StTpcSectorHitIter::GetObject (int idx) const
229 {
230  return ((StTpcSectorHitCollection*)fCont)->padrow(idx);
231 }
232 //________________________________________________________________________________
234 {
235  return ((StTpcSectorHitCollection*)fCont)->numberOfPadrows();
236 }
237 //________________________________________________________________________________
238 const TObject *StTpcPadrowHitIter::GetObject (int idx) const
239 {
240  return (const TObject*)((StTpcPadrowHitCollection*)fCont)->hits().at(idx);
241 }
242 //________________________________________________________________________________
244 {
245  return ((StTpcPadrowHitCollection*)fCont)->hits().size();
246 }
247 
248 //________________________________________________________________________________
249 //_______SVT_______SVT_______SVT_______SVT_______SVT_______SVT_______SVT_______SVT
250 //________________________________________________________________________________
251 
252 //..............................................................................
253 class StSvtHitIter : public StHitIter {
254 public:
255  StSvtHitIter();
256 virtual ~StSvtHitIter(){;}
257 virtual const TObject *Reset(const TObject *cont);
258 virtual const TObject *GetObject (int idx) const;
259 virtual int GetSize () const;
260  StDetectorId DetectorId() const {return kSvtId;}
261 protected:
262 };
263 //..............................................................................
265 public:
266 virtual ~StSvtBarrelHitIter(){;}
267 virtual const TObject *GetObject (int idx) const;
268 virtual int GetSize () const;
269 protected:
270 };
271 //..............................................................................
273 public:
274 virtual ~StSvtLadderHitIter(){;}
275 virtual const TObject *GetObject (int idx) const;
276 virtual int GetSize () const;
277 protected:
278 };
279 //..............................................................................
280 class StSvtWaferHitIter : public StHitIter {
281 public:
282 virtual ~StSvtWaferHitIter(){;}
283 virtual const TObject *GetObject (int idx) const;
284 virtual int GetSize () const;
285 protected:
286 };
287 //________________________________________________________________________________
288 StSvtHitIter::StSvtHitIter()
289 {
290  StHitIter *iter = this,*jter=0;
291  iter->SetDowIter((jter=new StSvtBarrelHitIter())); iter=jter;
292  iter->SetDowIter((jter=new StSvtLadderHitIter())); iter=jter;
293  iter->SetDowIter((jter=new StSvtWaferHitIter ())); iter=jter;
294 }
295 //________________________________________________________________________________
296 const TObject *StSvtHitIter::Reset(const TObject *cont)
297 {
298  const StSvtHitCollection *to = 0;
299  if (cont) to = ((StEvent*)cont)->svtHitCollection();
300  return StHitIter::Reset(to);
301 }
302 //________________________________________________________________________________
303 const TObject *StSvtHitIter::GetObject (int idx) const
304 {
305  return (const TObject*)((StSvtHitCollection*)fCont)->barrel(idx);
306 }
307 //________________________________________________________________________________
309 {
310  return ((StSvtHitCollection*)fCont)->numberOfBarrels();
311 }
312 
313 //________________________________________________________________________________
314 const TObject *StSvtBarrelHitIter::GetObject (int idx) const
315 {
316  return (const TObject*)((StSvtBarrelHitCollection*)fCont)->ladder(idx);
317 }
318 //________________________________________________________________________________
320 {
321  return ((StSvtBarrelHitCollection*)fCont)->numberOfLadders();
322 }
323 //________________________________________________________________________________
324 const TObject *StSvtLadderHitIter::GetObject (int idx) const
325 {
326  return (const TObject*)((StSvtLadderHitCollection*)fCont)->wafer(idx);
327 }
328 //________________________________________________________________________________
330 {
331  return ((StSvtLadderHitCollection*)fCont)->numberOfWafers();
332 }
333 //________________________________________________________________________________
334 const TObject *StSvtWaferHitIter::GetObject (int idx) const
335 {
336  return (const TObject*)((StSvtWaferHitCollection*)fCont)->hits().at(idx);
337 }
338 //________________________________________________________________________________
340 {
341  return ((StSvtWaferHitCollection*)fCont)->hits().size();
342 }
343 
344 //________________________________________________________________________________
345 //_______ETR_______ETR_______ETR_______ETR_______ETR_______ETR_______ETR_______ETR
346 //________________________________________________________________________________
347 //..............................................................................
348 class StEtrHitIter : public StHitIter {
349 public:
350  StEtrHitIter(){;}
351 virtual ~StEtrHitIter(){;}
352 virtual const TObject *Reset(const TObject *cont);
353 virtual const TObject *GetObject (int idx) const;
354 virtual int GetSize () const;
355  StDetectorId DetectorId() const {return kEtrId;}
356 public:
357 protected:
358 };
359 //________________________________________________________________________________
360 const TObject *StEtrHitIter::Reset(const TObject *cont)
361 {
362  const StEtrHitCollection *to = 0;
363  if (cont) to = ((StEvent*)cont)->etrHitCollection();
364  return StHitIter::Reset(to);
365 }
366 //________________________________________________________________________________
367 const TObject *StEtrHitIter::GetObject (int idx) const
368 {
369  return (const TObject*)((StEtrHitCollection*)fCont)->hits().at(idx);
370 }
371 //________________________________________________________________________________
373 {
374  return ((StEtrHitCollection*)fCont)->hits().size();
375 }
376 //________________________________________________________________________________
377 //_______SSD_______SSD_______SSD_______SSD_______SSD_______SSD_______SSD_______SSD
378 //________________________________________________________________________________
379 //..............................................................................
380 class StSsdHitIter : public StHitIter {
381 public:
382  StSsdHitIter();
383 virtual ~StSsdHitIter(){;}
384 virtual const TObject *Reset(const TObject *cont);
385 virtual const TObject *GetObject (int idx) const;
386 virtual int GetSize () const;
387  StDetectorId DetectorId() const {return kSsdId;}
388 protected:
389 };
390 //..............................................................................
392 public:
393 virtual ~StSsdLadderHitIter(){;}
394 virtual const TObject *GetObject (int idx) const;
395 virtual int GetSize () const;
396 protected:
397 };
398 //..............................................................................
399 class StSsdWaferHitIter : public StHitIter {
400 public:
401 virtual ~StSsdWaferHitIter(){;}
402 virtual const TObject *GetObject (int idx) const;
403 virtual int GetSize () const;
404 protected:
405 };
406 //________________________________________________________________________________
407 StSsdHitIter::StSsdHitIter()
408 {
409  StHitIter *iter = this,*jter=0;
410  iter->SetDowIter((jter=new StSsdLadderHitIter())); iter=jter;
411  iter->SetDowIter((jter=new StSsdWaferHitIter ()));
412 }
413 //________________________________________________________________________________
414 const TObject *StSsdHitIter::Reset(const TObject *cont)
415 {
416  const StSsdHitCollection *to = 0;
417  if (cont) to = ((StEvent*)cont)->ssdHitCollection();
418  return StHitIter::Reset(to);
419 }
420 //________________________________________________________________________________
421 const TObject *StSsdHitIter::GetObject (int idx) const
422 {
423  return (const TObject*)((StSsdHitCollection*)fCont)->ladder(idx);
424 }
425 //________________________________________________________________________________
427 {
428  return ((StSsdHitCollection*)fCont)->numberOfLadders();
429 }
430 
431 //________________________________________________________________________________
432 const TObject *StSsdLadderHitIter::GetObject (int idx) const
433 {
434  return (const TObject*)((StSsdLadderHitCollection*)fCont)->wafer(idx);
435 }
436 //________________________________________________________________________________
438 {
439  return ((StSsdLadderHitCollection*)fCont)->numberOfWafers();
440 }
441 //________________________________________________________________________________
442 const TObject *StSsdWaferHitIter::GetObject (int idx) const
443 {
444  return (const TObject*)((StSsdWaferHitCollection*)fCont)->hits().at(idx);
445 }
446 //________________________________________________________________________________
448 {
449  return ((StSsdWaferHitCollection*)fCont)->hits().size();
450 }
451 
452 //_______IST_______IST_______IST_______IST_______IST_______IST_______IST_______IST
453 //________________________________________________________________________________
454 //..............................................................................
455 class StIstHitIter : public StHitIter {
456 public:
457  StIstHitIter();
458 virtual ~StIstHitIter(){;}
459 virtual const TObject *Reset(const TObject *cont);
460 virtual const TObject *GetObject (int idx) const;
461 virtual int GetSize () const;
462  StDetectorId DetectorId() const {return kIstId;}
463 protected:
464 };
465 //..............................................................................
467 public:
468  StIstLadderHitIter(){;}
469 virtual ~StIstLadderHitIter(){;}
470 virtual const TObject *GetObject (int idx) const;
471 virtual int GetSize () const;
472 protected:
473 };
474 //..............................................................................
476 public:
477  StIstSensorHitIter(){;}
478 virtual ~StIstSensorHitIter(){;}
479 virtual const TObject *GetObject (int idx) const;
480 virtual int GetSize () const;
481 protected:
482 };
483 //________________________________________________________________________________
484 StIstHitIter::StIstHitIter()
485 {
486  StHitIter *iter = this,*jter=0;
487  iter->SetDowIter((jter=new StIstLadderHitIter())); iter=jter;
488  iter->SetDowIter((jter=new StIstSensorHitIter ()));
489 }
490 //________________________________________________________________________________
491 const TObject *StIstHitIter::Reset(const TObject *cont)
492 {
493  const StIstHitCollection *to = 0;
494  if (cont) to = ((StEvent*)cont)->istHitCollection();
495  return StHitIter::Reset(to);
496 }
497 //________________________________________________________________________________
498 const TObject *StIstHitIter::GetObject (int idx) const
499 {
500  return (const TObject*)((StIstHitCollection*)fCont)->ladder(idx);
501 }
502 //________________________________________________________________________________
504 {
505  return kIstNumLadders;
506 }
507 //________________________________________________________________________________
508 const TObject *StIstLadderHitIter::GetObject (int idx) const
509 {
510  return (const TObject*)((StIstLadderHitCollection*)fCont)->sensor(idx);
511 }
512 //________________________________________________________________________________
514 {
516 }
517 //________________________________________________________________________________
518 const TObject *StIstSensorHitIter::GetObject (int idx) const
519 {
520  return (const TObject*)((StIstSensorHitCollection*)fCont)->hits().at(idx);
521 }
522 //________________________________________________________________________________
524 {
525  return ((StIstSensorHitCollection*)fCont)->hits().size();
526 }
527 
528 //_______FST_______FST_______FST_______FST_______FST_______FST_______FST_______FST
529 //________________________________________________________________________________
530 //..............................................................................
531 class StFstHitIter : public StHitIter {
532 public:
533  StFstHitIter();
534 virtual ~StFstHitIter(){;}
535 virtual const TObject *Reset(const TObject *cont);
536 virtual const TObject *GetObject (int idx) const;
537 virtual int GetSize () const;
538  StDetectorId DetectorId() const {return kFstId;}
539 protected:
540 };
541 //..............................................................................
542 class StFstWedgeHitIter : public StHitIter {
543 public:
544  StFstWedgeHitIter(){;}
545 virtual ~StFstWedgeHitIter(){;}
546 virtual const TObject *GetObject (int idx) const;
547 virtual int GetSize () const;
548 protected:
549 };
550 //..............................................................................
552 public:
553  StFstSensorHitIter(){;}
554 virtual ~StFstSensorHitIter(){;}
555 virtual const TObject *GetObject (int idx) const;
556 virtual int GetSize () const;
557 protected:
558 };
559 //________________________________________________________________________________
560 StFstHitIter::StFstHitIter()
561 {
562  StHitIter *iter = this,*jter=0;
563  iter->SetDowIter((jter=new StFstWedgeHitIter())); iter=jter;
564  iter->SetDowIter((jter=new StFstSensorHitIter ()));
565 }
566 //________________________________________________________________________________
567 const TObject *StFstHitIter::Reset(const TObject *cont)
568 {
569  const StFstHitCollection *to = 0;
570  if (cont) to = ((StEvent*)cont)->fstHitCollection();
571  return StHitIter::Reset(to);
572 }
573 //________________________________________________________________________________
574 const TObject *StFstHitIter::GetObject (int idx) const
575 {
576  return (const TObject*)((StFstHitCollection*)fCont)->wedge(idx);
577 }
578 //________________________________________________________________________________
580 {
581  return kFstNumWedges;
582 }
583 //________________________________________________________________________________
584 const TObject *StFstWedgeHitIter::GetObject (int idx) const
585 {
586  return (const TObject*)((StFstWedgeHitCollection*)fCont)->sensor(idx);
587 }
588 //________________________________________________________________________________
590 {
591  return kFstNumSensorsPerWedge;
592 }
593 //________________________________________________________________________________
594 const TObject *StFstSensorHitIter::GetObject (int idx) const
595 {
596  return (const TObject*)((StFstSensorHitCollection*)fCont)->hits().at(idx);
597 }
598 //________________________________________________________________________________
600 {
601  return ((StFstSensorHitCollection*)fCont)->hits().size();
602 }
603 
604 //________________________________________________________________________________
605 //_______FTPC______FTPC______FTPC______FTPC______FTPC______FTPC______FTPC______TPC
606 //________________________________________________________________________________
607 
608 //..............................................................................
609 class StFtpcHitIter : public StHitIter {
610 public:
611  StFtpcHitIter();
612 virtual ~StFtpcHitIter(){;}
613 virtual const TObject *Reset(const TObject *cont);
614 virtual const TObject *GetObject (int idx) const;
615 virtual int GetSize () const;
616  StDetectorId DetectorId() const {return kFtpcEastId;}
617 protected:
618 };
619 
620 //..............................................................................
622 public:
623  StFtpcPlaneHitIter(){;}
624 virtual ~StFtpcPlaneHitIter(){;}
625 virtual const TObject *GetObject (int idx) const;
626 virtual int GetSize () const;
627 protected:
628 };
629 //..............................................................................
631 public:
633 virtual ~StFtpcSectorHitIter(){;}
634 virtual const TObject *GetObject (int idx) const;
635 virtual int GetSize () const;
636 protected:
637 };
638 
639 //________________________________________________________________________________
640 StFtpcHitIter::StFtpcHitIter()
641 {
642  StHitIter *obj=this,*hi;
643  obj->SetDowIter((hi=new StFtpcPlaneHitIter())); obj = hi;
644  obj->SetDowIter((hi=new StFtpcSectorHitIter())); obj = hi;
645 }
646 //________________________________________________________________________________
647 const TObject *StFtpcHitIter::Reset(const TObject *cont)
648 {
649  const StFtpcHitCollection *to = 0;
650  if (cont) to = ((StEvent*)cont)->ftpcHitCollection();
651  return StHitIter::Reset(to);
652 }
653 
654 //________________________________________________________________________________
656 { return ((StFtpcHitCollection*)fCont)->numberOfPlanes();}
657 
658 
659 //________________________________________________________________________________
660 const TObject *StFtpcHitIter::GetObject (int idx) const
661 {
662  return ((StFtpcHitCollection*)fCont)->plane(idx);
663 }
664 //________________________________________________________________________________
665 const TObject *StFtpcPlaneHitIter::GetObject (int idx) const
666 {
667  return ((StFtpcPlaneHitCollection*)fCont)->sector(idx);
668 }
669 //________________________________________________________________________________
671 {
672  return ((StFtpcPlaneHitCollection*)fCont)->numberOfSectors();
673 }
674 //________________________________________________________________________________
675 const TObject *StFtpcSectorHitIter::GetObject (int idx) const
676 {
677  return (const TObject*)((StFtpcSectorHitCollection*)fCont)->hits().at(idx);
678 }
679 //________________________________________________________________________________
681 {
682  return ((StFtpcSectorHitCollection*)fCont)->hits().size();
683 }
684 
685 //________________________________________________________________________________
686 //_______RND_______RND_______RND_______RND_______RND_______RND_______RND_______TPC
687 //________________________________________________________________________________
688 //..............................................................................
689 class StRnDHitIter : public StHitIter {
690 public:
691  StRnDHitIter(StDetectorId id){fDetectorId=id;}
692 virtual ~StRnDHitIter(){;}
693 virtual const TObject *Reset(const TObject *cont);
694 virtual const TObject *GetObject (int idx) const;
695 virtual int GetSize () const;
696  StDetectorId DetectorId() const {return fDetectorId;}
697 protected:
698 StDetectorId fDetectorId;
699 };
700 //________________________________________________________________________________
701 const TObject *StRnDHitIter::Reset(const TObject *cont)
702 {
703  const StRnDHitCollection *to = 0;
704  if (cont) to = ((StEvent*)cont)->rndHitCollection();
705  return StHitIter::Reset(to);
706 }
707 //________________________________________________________________________________
708 const TObject *StRnDHitIter::GetObject (int idx) const
709 {
710  return (const TObject*)((StRnDHitCollection*)fCont)->hits().at(idx);
711 }
712 //________________________________________________________________________________
714 {
715  return ((StRnDHitCollection*)fCont)->hits().size();
716 }
717 //________________________________________________________________________________
718 //_______TOF_______TOF_______TOF_______TOF_______TOF_______TOF_______TOF_______TOF
719 //________________________________________________________________________________
720 //..............................................................................
721 #define StTofHitCollection StTofCollection
722 #define tofHitCollection tofCollection
723 
724 class StTofHitIter : public StHitIter {
725 public:
726  StTofHitIter(){;}
727 virtual ~StTofHitIter(){;}
728 virtual const TObject *Reset(const TObject *cont);
729 virtual const TObject *GetObject (int idx) const;
730 virtual int GetSize () const;
731  StDetectorId DetectorId() const {return kTofId;}
732 public:
733 protected:
734 };
735 //________________________________________________________________________________
736 const TObject *StTofHitIter::Reset(const TObject *cont)
737 {
738  const StTofHitCollection *to = 0;
739  if (cont) to = ((StEvent*)cont)->tofHitCollection();
740  return StHitIter::Reset(to);
741 }
742 //________________________________________________________________________________
743 const TObject *StTofHitIter::GetObject (int idx) const
744 {
745  return (const TObject*)((StTofHitCollection*)fCont)->tofHits().at(idx);
746 }
747 //________________________________________________________________________________
749 {
750  return ((StTofHitCollection*)fCont)->tofHits().size();
751 }
752 
753 
754 // -------------------------------------------------------------------------------
755 // -------------------------------------------------------------------------------
756 // -------------------------------------------------------------------------------
757 
758 //________________________________________________________________________________
759 //_______ FGT _____ FGT _____ FGT _____ FGT _____ FGT _____ FGT _____ FGT ____ FGT
760 //________________________________________________________________________________
761 class StFgtHitIter : public StHitIter
762 { public:
763  StFgtHitIter(); // implementation below...
764  virtual ~StFgtHitIter(){ /* nada */ };
765  virtual const TObject *Reset( const TObject *container );
766  virtual const TObject *GetObject( Int_t idx ) const;
767  virtual Int_t GetSize() const;
768  StDetectorId DetectorId() const { return kFgtId; }
769  protected:
770  // StDetectorId fDetectorId;
771 };
772 
774 { public:
775  StFgtPointHitIter(){ /* nada */ };
776  virtual ~StFgtPointHitIter(){ /* nada */ };
777  virtual const TObject *GetObject( Int_t idx ) const;
778  virtual Int_t GetSize() const;
779 };
780 // -------------------------------------------------------------------------------
781 StFgtHitIter::StFgtHitIter()
782 {
783  this -> SetDowIter( new StFgtPointHitIter() );
784 }
785 // -------------------------------------------------------------------------------
786 const TObject *StFgtHitIter::Reset( const TObject *cont )
787 {
788  const StFgtCollection *to = 0;
789  if ( cont ) to = ((StEvent *)cont)->fgtCollection();
790  return StHitIter::Reset( to );
791 }
792 // -------------------------------------------------------------------------------
794 {
795  return 1; // note mispelling in StEvent
796 }
797 // -------------------------------------------------------------------------------
798 const TObject *StFgtHitIter::GetObject( Int_t idx ) const
799 {
800  return (const TObject *)((StFgtCollection *)fCont)->getPointCollection();
801 }
802 // -------------------------------------------------------------------------------
803 const TObject *StFgtPointHitIter::GetObject( Int_t idx ) const
804 {
805  return (const TObject *)((StFgtPointCollection *)fCont)->getPointVec().at(idx);
806 }
807 // -------------------------------------------------------------------------------
809 {
810  return (Int_t)((StFgtPointCollection *)fCont)->getPointVec().size();
811 }
812 // -------------------------------------------------------------------------------
813 
814 //_______PXL_______PXL_______PXL_______PXL_______PXL_______PXL_______PXL_______PXL
815 //________________________________________________________________________________
816 #include "StEvent/StPxlHitCollection.h"
817 #include "StEvent/StPxlHit.h"
818 #include "StEvent/StPxlLadderHitCollection.h"
819 #include "StEvent/StPxlSectorHitCollection.h"
820 #include "StEvent/StPxlSensorHitCollection.h"
821 //Sector/Ladder/Sensor/Hit
822 
823 
824 //..............................................................................
825 class StPxlHitIter : public StHitIter {
826 public:
827  StPxlHitIter();
828 virtual ~StPxlHitIter(){;}
829 virtual const TObject *Reset(const TObject *cont);
830 virtual const TObject *GetObject (int idx) const;
831 virtual int GetSize () const;
832  StDetectorId DetectorId() const {return kPxlId;}
833 protected:
834 };
835 //..............................................................................
837 public:
838  StPxlSectorHitIter(){;}
839 virtual ~StPxlSectorHitIter(){;}
840 virtual const TObject *GetObject (int idx) const;
841 virtual int GetSize () const;
842 protected:
843 };
844 //..............................................................................
846 public:
847  StPxlLadderHitIter(){;}
848 virtual ~StPxlLadderHitIter(){;}
849 virtual const TObject *GetObject (int idx) const;
850 virtual int GetSize () const;
851 protected:
852 };
853 //..............................................................................
855 public:
856  StPxlSensorHitIter(){;}
857 virtual ~StPxlSensorHitIter(){;}
858 virtual const TObject *GetObject (int idx) const;
859 virtual int GetSize () const;
860 protected:
861 };
862 //________________________________________________________________________________
863 StPxlHitIter::StPxlHitIter()
864 {
865  StHitIter *iter = this,*jter=0;
866  iter->SetDowIter((jter=new StPxlSectorHitIter())); iter=jter;
867  iter->SetDowIter((jter=new StPxlLadderHitIter())); iter=jter;
868  iter->SetDowIter((jter=new StPxlSensorHitIter ()));
869 }
870 //________________________________________________________________________________
871 const TObject *StPxlHitIter::Reset(const TObject *cont)
872 {
873  const StPxlHitCollection *to = 0;
874  if (cont) to = ((StEvent*)cont)->pxlHitCollection();
875  return StHitIter::Reset(to);
876 }
877 //________________________________________________________________________________
878 const TObject *StPxlHitIter::GetObject (int idx) const
879 {
880  return (const TObject*)((StPxlHitCollection*)fCont)->sector(idx);
881 }
882 //________________________________________________________________________________
883 const TObject *StPxlSectorHitIter::GetObject (int idx) const
884 {
885  return (const TObject*)((StPxlSectorHitCollection*)fCont)->ladder(idx);
886 }
887 //________________________________________________________________________________
889 {
890  return ((StPxlHitCollection*)fCont)->numberOfSectors();
891 }
892 //________________________________________________________________________________
894 {
895  return ((StPxlSectorHitCollection*)fCont)->numberOfLadders();
896 }
897 //________________________________________________________________________________
898 const TObject *StPxlLadderHitIter::GetObject (int idx) const
899 {
900  return (const TObject*)((StPxlLadderHitCollection*)fCont)->sensor(idx);
901 }
902 //________________________________________________________________________________
904 {
905  return ((StPxlLadderHitCollection*)fCont)->numberOfSensors();
906 }
907 //________________________________________________________________________________
908 const TObject *StPxlSensorHitIter::GetObject (int idx) const
909 {
910  return (const TObject*)((StPxlSensorHitCollection*)fCont)->hits().at(idx);
911 }
912 //________________________________________________________________________________
914 {
915  return ((StPxlSensorHitCollection*)fCont)->hits().size();
916 }
917 
918 
919 //________________________________________________________________________________
920 //_______EVENT_____EVENT_____EVENT_____EVENT_____EVENT_____EVENT_____EVENT_____TOF
921 //________________________________________________________________________________
922 int StEventHitIter::AddDetector(StDetectorId detId)
923 {
924  switch ((int)detId) {
925 
926  case kTpcId: Add(new StTpcHitIter());break;
927  case kSvtId: Add(new StSvtHitIter());break;
928  case kSsdId: Add(new StSsdHitIter());break;
929  case kFtpcWestId:;
930  case kFtpcEastId:
931  Add(new StFtpcHitIter());break;
932  case kPxlId: Add(new StPxlHitIter()) ;break;
933  case kIstId: Add(new StIstHitIter()) ;break;
934  /* case kFgtId: n.b. This will be removing the RnD version of the FGT */
935  case kFmsId:
936  Add(new StRnDHitIter(detId));break;
937 
938  case kTofId: Add(new StTofHitIter()) ;break;
939  case kEtrId: Add(new StEtrHitIter()) ;break;
940  case kFgtId: Add(new StFgtHitIter()) ;break;
941 
942 
943  default: printf("StEventHitIter::AddDetector: No iterator for detectorId=%d",(int)detId);
944  assert(0 && "No iterator for detectorId");
945  return 1;
946  }
947  return 0;
948 }
StDetectorId DetectorId() const
Returns the STAR ID of the detector.
StDetectorId DetectorId() const
Returns the STAR ID of the detector.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
StDetectorId DetectorId() const
Returns the STAR ID of the detector.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
StEventHitIter is the top level hook, providing hits to the Stv tracking code.
void SetDowIter(StHitIter *it)
For the case of nested collections, sets the iterator over another collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
StDetectorId DetectorId() const
Returns the STAR ID of the detector.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
StDetectorId DetectorId() const
Returns the STAR ID of the detector.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual const TObject * GetObject(Int_t idx) const
Gets an object at a specified position in the collection.
StDetectorId DetectorId() const
Returns the STAR ID of the detector.
const int kIstNumLadders
24 IST Ladders
StDetectorId DetectorId() const
Returns the STAR ID of the detector.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual const TObject * GetObject(Int_t idx) const
Gets an object at a specified position in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
StDetectorId DetectorId() const
Returns the STAR ID of the detector.
StDetectorId DetectorId() const
Returns the STAR ID of the detector.
StHitIter is an abstract base class, establishing the interface between hit collections in StEvent an...
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual const TObject * operator++()
Increments the iterator, returning the next object in the collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual Int_t GetSize() const
Returns the number of entries in the collection.
virtual int GetSize() const =0
Returns the number of entries in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual Int_t GetSize() const
Returns the number of entries in the collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual const TObject * Get() const
Gets the current object in the collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual const TObject * GetObject(int idx) const =0
Gets an object at a specified position in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual const TObject * Get() const
Gets the current object in the collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
StDetectorId DetectorId() const
Returns the STAR ID of the detector.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
StDetectorId DetectorId() const
Returns the STAR ID of the detector.
const int kIstNumSensorsPerLadder
6 sensor per one IST Ladder
virtual int GetSize() const
Returns the number of entries in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual const TObject * operator++()
Increments the iterator, returning the next object in the collection.
virtual int GetSize() const
Returns the number of entries in the collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.
virtual const TObject * GetObject(int idx) const
Gets an object at a specified position in the collection.