AliRoot Core  3dc7879 (3dc7879)
AliMUONMCDataInterface.cxx
Go to the documentation of this file.
1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15 
16 // $Id$
17 
18 //-----------------------------------------------------------------------------
25 // Moved parts of old AliMUONDataInterface interface to AliMUONMCDataInterface
26 // Artur Szostak <artursz@iafrica.com> (University of Cape Town)
27 //-----------------------------------------------------------------------------
28 
29 #include "AliMUONMCDataInterface.h"
30 #include "AliMUONVDigitStore.h"
31 #include "AliMUONVHitStore.h"
32 #include "AliMUONVTriggerStore.h"
33 #include "AliMUONHit.h"
34 #include "AliMUONVDigit.h"
35 #include "AliMUONLocalTrigger.h"
36 #include "AliMUONRegionalTrigger.h"
37 #include "AliMUONGlobalTrigger.h"
38 
39 #include "AliMpEncodePair.h"
40 #include "AliMpDEManager.h"
41 #include "AliMpConstants.h"
42 #include "AliMpCDB.h"
43 
44 #include "AliLog.h"
45 #include "AliLoader.h"
46 #include "AliRunLoader.h"
47 #include "AliHeader.h"
48 #include "AliStack.h"
49 #include "AliCDBManager.h"
50 
51 #include <TTree.h>
52 #include <Riostream.h>
53 #include <TClonesArray.h>
54 #include <TList.h>
55 #include <TParticle.h>
56 #include <TIterator.h>
57 #include <cstdlib>
58 #include <cassert>
59 
60 using std::endl;
61 using std::cout;
63 ClassImp(AliMUONMCDataInterface)
65 
66 Int_t AliMUONMCDataInterface::fgInstanceCounter(0);
67 
68 //_____________________________________________________________________________
70 TObject(),
71 fLoader(0x0),
72 fHitStore(0x0),
73 fSDigitStore(0x0),
74 fDigitStore(0x0),
75 fTriggerStore(0x0),
76 fTrackRefs(0x0),
77 fCurrentEvent(-1),
78 fIsValid(kFALSE),
79 fCurrentIteratorType(kNoIterator),
80 fCurrentIndex(-1),
81 fDataX(-1),
82 fDataY(-1),
83 fIterator(0x0)
84 {
86 
87  ++fgInstanceCounter;
88 
89  if ( AliCDBManager::Instance() != NULL &&
90  AliCDBManager::Instance()->GetDefaultStorage() == NULL ) {
91  AliFatal("CDB default storage not defined.");
92  }
93 
94  Open(filename);
95 
96  // Load mapping
97  if ( ! AliMpCDB::LoadMpSegmentation() ) {
98  AliFatal("Could not access mapping from OCDB !");
99  }
100 }
101 
102 //_____________________________________________________________________________
104 {
107 }
108 
109 //_____________________________________________________________________________
112 {
122 
123  if (not IsValid()) return 0x0;
124 
125  if (event == fCurrentEvent)
126  {
127  if (track == fDataX and fHitStore != 0x0) // using fDataX as track number.
128  return fHitStore;
129  }
130  else
131  {
132  ResetStores();
133  if ( not LoadEvent(event) ) return 0x0;
134  }
135 
136  fLoader->LoadHits();
137 
138  TTree* treeH = fLoader->TreeH();
139  if (treeH == 0x0)
140  {
141  AliError("Could not get treeH");
142  return 0x0;
143  }
144 
146  AliDebug(1,"Creating hitStore from treeH");
147  if ( fHitStore != 0x0 )
148  {
149  fHitStore->Connect(*treeH);
150  if ( treeH->GetEvent(track) == 0 )
151  {
152  AliError(Form("Could not read track %d",track));
153  fHitStore->Clear();
154  return 0x0;
155  }
156  fDataX = track; // using fDataX as track number.
157  }
158 
159  fLoader->UnloadHits();
160 
161  return fHitStore;
162 }
163 
164 //_____________________________________________________________________________
167 {
177 
178  if (not IsValid()) return 0x0;
179 
180  if (event == fCurrentEvent)
181  {
182  if (fSDigitStore != 0x0)
183  return fSDigitStore;
184  }
185  else
186  {
187  ResetStores();
188  if ( not LoadEvent(event) ) return 0x0;
189  }
190 
191  fLoader->LoadSDigits();
192 
193  TTree* treeS = fLoader->TreeS();
194  if (treeS == 0x0)
195  {
196  AliError("Could not get treeS");
197  return 0x0;
198  }
199 
201  if ( fSDigitStore != 0x0 )
202  {
203  fSDigitStore->Clear();
204  fSDigitStore->Connect(*treeS);
205  treeS->GetEvent(0);
206  }
207 
209 
210  return fSDigitStore;
211 }
212 
213 //_____________________________________________________________________________
216 {
225 
226  if (not IsValid()) return 0x0;
227 
228  if (event == fCurrentEvent)
229  {
230  if (fDigitStore != 0x0)
231  return fDigitStore;
232  }
233  else
234  {
235  ResetStores();
236  if ( not LoadEvent(event) ) return 0x0;
237  }
238 
239  fLoader->LoadDigits();
240 
241  TTree* treeD = fLoader->TreeD();
242  if (treeD == 0x0)
243  {
244  AliError("Could not get treeD");
245  return 0x0;
246  }
247 
249  if ( fDigitStore != 0x0 )
250  {
251  fDigitStore->Clear();
252  fDigitStore->Connect(*treeD);
253  treeD->GetEvent(0);
254  }
255 
257 
258  return fDigitStore;
259 }
260 
261 //_____________________________________________________________________________
262 AliStack*
264 {
273 
274  if ( not IsValid() ) return 0x0;
275 
276  if (event != fCurrentEvent)
277  {
278  ResetStores();
279  if ( not LoadEvent(event) ) return 0x0;
280  }
281 
283 
284  return fLoader->GetRunLoader()->Stack();
285 }
286 
287 //_____________________________________________________________________________
288 TClonesArray*
290 {
299 
300  if ( not IsValid() ) return 0x0;
301 
302  if (event == fCurrentEvent)
303  {
304  if (track == fDataX and fTrackRefs != 0x0) // using fDataX as track number.
305  return fTrackRefs;
306  }
307  else
308  {
309  ResetStores();
310  if ( not LoadEvent(event) ) return 0x0;
311  }
312 
314 
315  TTree* treeTR = fLoader->GetRunLoader()->TreeTR();
316 
317  if ( fTrackRefs != 0x0 ) fTrackRefs->Clear("C");
318 
319  if (treeTR != 0x0)
320  {
321  if ( treeTR->GetEvent(track) > 0 )
322  {
323  TBranch* branch = treeTR->GetBranch("TrackReferences");
324  branch->SetAddress(&fTrackRefs);
325  branch->GetEvent(track);
326  fDataX = track; // using fDataX as track number.
327  }
328  }
329  else
330  {
331  AliError("Could not get TreeTR");
332  }
333 
335 
336  return fTrackRefs;
337 }
338 
339 //_____________________________________________________________________________
342 {
352 
353  if (not IsValid()) return 0x0;
354 
355  if (event == fCurrentEvent)
356  {
357  if (fTriggerStore != 0x0)
358  return fTriggerStore;
359  }
360  else
361  {
362  ResetStores();
363  if ( not LoadEvent(event) ) return 0x0;
364  }
365 
366  fLoader->LoadDigits();
367 
368  TTree* treeD = fLoader->TreeD();
369  if ( treeD == 0x0 )
370  {
371  AliError("Could not get treeD");
372  return 0x0;
373  }
374 
376  if ( fTriggerStore != 0x0 )
377  {
378  fTriggerStore->Clear();
379  fTriggerStore->Connect(*treeD);
380  treeD->GetEvent(0);
381  }
382 
384 
385  return fTriggerStore;
386 }
387 
388 //_____________________________________________________________________________
389 void
390 AliMUONMCDataInterface::DumpDigits(Int_t event, Bool_t sorted)
391 {
393  DigitStore(event);
394 
395  if ( fDigitStore != 0x0 )
396  {
397  if ( sorted )
398  {
400  }
401  else
402  {
403  fDigitStore->Print();
404  }
405  }
406 }
407 
408 //_____________________________________________________________________________
409 void
411 {
413 
414  Int_t ntracks = NumberOfTracks(event);
415 
416  for ( Int_t i = 0; i < ntracks; ++i )
417  {
418  cout << ">> Track " << i << endl;
419  HitStore(event,i);
420  if ( fHitStore )
421  {
422  fHitStore->Print("","full");
423  }
424  }
425 }
426 
427 //_____________________________________________________________________________
428 void
430 {
432  AliStack* stack = Stack(event);
433 
434  if ( stack != 0x0 )
435  {
436  Int_t nparticles = (Int_t) stack->GetNtrack();
437 
438  for (Int_t iparticle=0; iparticle<nparticles; ++iparticle)
439  {
440  stack->Particle(iparticle)->Print("");
441  }
442  }
443  else
444  {
445  AliError("Could not get stack");
446  }
447 }
448 
449 //_____________________________________________________________________________
450 void
451 AliMUONMCDataInterface::DumpSDigits(Int_t event, Bool_t sorted)
452 {
454  SDigitStore(event);
455 
456  if ( fSDigitStore != 0x0 )
457  {
458  if ( sorted )
459  {
461  }
462  else
463  {
464  fSDigitStore->Print();
465  }
466  }
467 }
468 
469 //_____________________________________________________________________________
470 void
472 {
474 
475  TIter next(store.CreateIterator());
476  TObject* object;
477  TList list;
478  list.SetOwner(kFALSE);
479 
480  while ( ( object = next() ) )
481  {
482  list.Add(object);
483  }
484 
485  list.Sort();
486 
487  list.Print();
488 }
489 
490 //_____________________________________________________________________________
491 void
493 {
495  Int_t ntrackrefs = NumberOfTrackRefs(event);
496 
497  for ( Int_t i = 0; i < ntrackrefs; ++i )
498  {
499  TrackRefs(event,i);
500  if ( fTrackRefs != 0x0 )
501  {
502  fTrackRefs->Print("","*");
503  }
504  }
505 }
506 
507 //_____________________________________________________________________________
508 void
510 {
512 
513  TriggerStore(event);
514 
515  if ( fTriggerStore != 0x0 )
516  {
517  fTriggerStore->Print();
518  }
519 }
520 
521 //_____________________________________________________________________________
522 Bool_t
524 {
527 
528  assert( IsValid() );
529 
530  AliDebug(1,Form("Loading event %d using runLoader %p",event,fLoader->GetRunLoader()));
531  if (fLoader->GetRunLoader()->GetEvent(event) == 0)
532  {
533  fCurrentEvent = event;
534  return kTRUE;
535  }
536  else
537  return kFALSE;
538 }
539 
540 
541 //_____________________________________________________________________________
542 Int_t
544 {
546  if (not IsValid()) return -1;
548 }
549 
550 //_____________________________________________________________________________
551 Int_t
553 {
555  if ( not IsValid()) return -1;
556 
557  if (event != fCurrentEvent)
558  {
559  ResetStores();
560  if ( not LoadEvent(event) ) return -1;
561  }
562 
563  fLoader->LoadHits();
564 
565  Int_t rv(-1);
566 
567  TTree* treeH = fLoader->TreeH();
568  if (treeH != 0x0)
569  {
570  rv = static_cast<Int_t>(treeH->GetEntries());
571  }
572  else
573  {
574  AliError("Could not get TreeH");
575  }
576 
577  fLoader->UnloadHits();
578 
579  return rv;
580 }
581 
582 //_____________________________________________________________________________
583 Int_t
585 {
587  if ( not IsValid()) return -1;
588 
589  if (event != fCurrentEvent)
590  {
591  ResetStores();
592  if ( not LoadEvent(event) ) return -1;
593  }
594 
596 
597  Int_t rv(-1);
598 
599  TTree* treeTR = fLoader->GetRunLoader()->TreeTR();
600  if (treeTR != 0x0)
601  {
602  rv = static_cast<Int_t>(treeTR->GetEntries());
603  }
604  else
605  {
606  AliError("Could not get TreeTR");
607  }
608 
610 
611  return rv;
612 }
613 
614 //_____________________________________________________________________________
615 void
616 AliMUONMCDataInterface::Open(const char* filename)
617 {
619 
620  ResetStores();
621 
622  fCurrentEvent=-1;
623 
624  if ( fLoader != 0x0 )
625  {
626  delete fLoader->GetRunLoader();
627  }
628 
629  fLoader = 0x0;
630 
631  fIsValid = kTRUE;
632 
633  TString foldername(Form("%s-%d",ClassName(),fgInstanceCounter));
634 
635  while (AliRunLoader::GetRunLoader(foldername))
636  {
637  delete AliRunLoader::GetRunLoader(foldername);
638  }
639 
640  AliRunLoader* runLoader = AliRunLoader::Open(filename,foldername);
641  if (runLoader == 0x0)
642  {
643  AliError(Form("Cannot open file %s",filename));
644  fIsValid = kFALSE;
645  return;
646  }
647 
648  // Get run number and set it to CDB manager
649  runLoader->LoadHeader();
650  if ( ! runLoader->GetHeader() ) {
651  AliError("Cannot load header.");
652  fIsValid = kFALSE;
653  }
654  else {
655  Int_t runNumber = runLoader->GetHeader()->GetRun();
656  AliCDBManager::Instance()->SetRun(runNumber);
657  }
658  runLoader->UnloadHeader();
659 
660  fLoader = runLoader->GetDetectorLoader("MUON");
661  if (fLoader == 0x0)
662  {
663  AliError("Cannot get AliMUONLoader");
664  fIsValid = kFALSE;
665  }
666 
667  if (not IsValid())
668  {
669  AliError(Form("Could not access %s filename. Object is unuseable",filename));
670  }
671 }
672 
673 //_____________________________________________________________________________
675 {
677 
678  if (HitStore(event, 0) == 0x0) return kFALSE;
679  if (SDigitStore(event) == 0x0) return kFALSE;
680  if (DigitStore(event) == 0x0) return kFALSE;
681  if (TriggerStore(event) == 0x0) return kFALSE;
682  if (TrackRefs(event, 0) == 0x0) return kFALSE;
683  return kTRUE;
684 }
685 
686 //_____________________________________________________________________________
688 {
690 
691  AliStack* stack = Stack(fCurrentEvent);
692  if ( stack == 0x0 ) return -1;
693  return (Int_t) stack->GetNtrack();
694 }
695 
696 //_____________________________________________________________________________
697 TParticle* AliMUONMCDataInterface::Particle(Int_t index)
698 {
702 
703  AliStack* stack = Stack(fCurrentEvent);
704  if ( stack == 0x0 ) return 0x0;
705  return static_cast<TParticle*>( stack->Particle(index) );
706 }
707 
708 //_____________________________________________________________________________
710 {
712 
714 }
715 
716 //_____________________________________________________________________________
718 {
722 
723  TIterator* iter = GetIterator(kHitIterator, track);
724  return CountObjects(iter);
725 }
726 
727 //_____________________________________________________________________________
728 AliMUONHit*
730 {
736 
737  TIterator* iter = GetIterator(kHitIterator, track);
738  return static_cast<AliMUONHit*>( FetchObject(iter, index) );
739 }
740 
741 //_____________________________________________________________________________
743 {
746 
747  TIterator* iter = GetIterator(kSDigitIteratorByDetectorElement, detElemId);
748  return CountObjects(iter);
749 }
750 
751 //_____________________________________________________________________________
752 AliMUONVDigit* AliMUONMCDataInterface::SDigit(Int_t detElemId, Int_t index)
753 {
758 
759  TIterator* iter = GetIterator(kSDigitIteratorByDetectorElement, detElemId);
760  return static_cast<AliMUONVDigit*>( FetchObject(iter, index) );
761 }
762 
763 //_____________________________________________________________________________
764 Int_t AliMUONMCDataInterface::NumberOfSDigits(Int_t chamber, Int_t cathode)
765 {
770 
771  TIterator* iter = GetIterator(kSDigitIteratorByChamberAndCathode, chamber, cathode);
772  return CountObjects(iter);
773 }
774 
775 //_____________________________________________________________________________
776 AliMUONVDigit* AliMUONMCDataInterface::SDigit(Int_t chamber, Int_t cathode, Int_t index)
777 {
784 
785  TIterator* iter = GetIterator(kSDigitIteratorByChamberAndCathode, chamber, cathode);
786  return static_cast<AliMUONVDigit*>( FetchObject(iter, index) );
787 }
788 
789 //_____________________________________________________________________________
791 {
794 
795  TIterator* iter = GetIterator(kDigitIteratorByDetectorElement, detElemId);
796  return CountObjects(iter);
797 }
798 
799 //_____________________________________________________________________________
800 AliMUONVDigit* AliMUONMCDataInterface::Digit(Int_t detElemId, Int_t index)
801 {
806 
807  TIterator* iter = GetIterator(kDigitIteratorByDetectorElement, detElemId);
808  return static_cast<AliMUONVDigit*>( FetchObject(iter, index) );
809 }
810 
811 //_____________________________________________________________________________
812 Int_t AliMUONMCDataInterface::NumberOfDigits(Int_t chamber, Int_t cathode)
813 {
818 
819  TIterator* iter = GetIterator(kDigitIteratorByChamberAndCathode, chamber, cathode);
820  return CountObjects(iter);
821 }
822 
823 //_____________________________________________________________________________
824 AliMUONVDigit* AliMUONMCDataInterface::Digit(Int_t chamber, Int_t cathode, Int_t index)
825 {
832 
833  TIterator* iter = GetIterator(kDigitIteratorByChamberAndCathode, chamber, cathode);
834  return static_cast<AliMUONVDigit*>( FetchObject(iter, index) );
835 }
836 
837 //_____________________________________________________________________________
839 {
841 
842  TIterator* iter = GetIterator(kLocalTriggerIterator);
843  return CountObjects(iter);
844 }
845 
846 //_____________________________________________________________________________
848 {
852 
853  TIterator* iter = GetIterator(kLocalTriggerIterator);
854  return static_cast<AliMUONLocalTrigger*>( FetchObject(iter, index) );
855 }
856 
857 //_____________________________________________________________________________
859 {
861 
862  TIterator* iter = GetIterator(kRegionalTriggerIterator);
863  return CountObjects(iter);
864 }
865 
866 //_____________________________________________________________________________
868 {
872 
873  TIterator* iter = GetIterator(kRegionalTriggerIterator);
874  return static_cast<AliMUONRegionalTrigger*>( FetchObject(iter, index) );
875 }
876 
877 //_____________________________________________________________________________
879 {
881 
883  if (store == 0x0) return 0x0;
884  return store->Global();
885 }
886 
887 //_____________________________________________________________________________
889 {
891 
893 }
894 
895 //_____________________________________________________________________________
897 {
901 
902  return TrackRefs(fCurrentEvent, track);
903 }
904 
905 //_____________________________________________________________________________
907 {
910 
911  ResetIterator();
912  if (fHitStore != 0x0)
913  {
914  delete fHitStore;
915  fHitStore = 0x0;
916  }
917  if (fSDigitStore != 0x0)
918  {
919  delete fSDigitStore;
920  fSDigitStore = 0x0;
921  }
922  if (fDigitStore != 0x0)
923  {
924  delete fDigitStore;
925  fDigitStore = 0x0;
926  }
927  if (fTrackRefs != 0x0)
928  {
929  delete fTrackRefs;
930  fTrackRefs = 0x0;
931  }
932  if (fTriggerStore != 0x0)
933  {
934  delete fTriggerStore;
935  fTriggerStore = 0x0;
936  }
937 }
938 
939 //_____________________________________________________________________________
940 TIterator* AliMUONMCDataInterface::GetIterator(IteratorType type, Int_t x, Int_t y)
941 {
956 
957  if (type == fCurrentIteratorType and fDataX == x and fDataY == y)
958  return fIterator;
959 
960  if (fCurrentEvent == -1)
961  {
962  AliError("No event was selected. Try first using GetEvent().");
963  return 0x0;
964  }
965 
966  ResetIterator();
967 
968  switch (type)
969  {
970  case kHitIterator:
971  {
972  Int_t track = x;
973  AliMUONVHitStore* store = HitStore(fCurrentEvent, track);
974  if (store == 0x0) return 0x0;
975  fIterator = store->CreateIterator();
976  if (fIterator == 0x0) return 0x0;
978  return fIterator;
979  }
980 
982  {
983  Int_t detElem = x;
985  if (store == 0x0) return 0x0;
986  fIterator = store->CreateIterator(detElem, detElem, 2);
987  if (fIterator == 0x0) return 0x0;
989  fDataX = detElem;
990  return fIterator;
991  }
992 
994  {
995  Int_t chamber = x;
996  Int_t cathode = y;
997  if (chamber < 0 or AliMpConstants::NofChambers() <= chamber)
998  {
999  AliError(Form(
1000  "Must have give a chamber value in the range [0..%d], but got a value of: %d",
1002  chamber
1003  ));
1004  return 0x0;
1005  }
1006  if (cathode < 0 or 1 < cathode)
1007  {
1008  AliError(Form("Must have give a cathode value in the range [0..1], but got a value of: %d", cathode));
1009  return 0x0;
1010  }
1011 
1013  if (store == 0x0) return 0x0;
1015  fIterator = store->CreateIterator(AliMp::PairFirst(pair), AliMp::PairSecond(pair), cathode);
1016  if (fIterator == 0x0) return 0x0;
1018  fDataX = chamber;
1019  fDataY = cathode;
1020  return fIterator;
1021  }
1022 
1024  {
1025  Int_t detElem = x;
1027  if (store == 0x0) return 0x0;
1028  fIterator = store->CreateIterator(detElem, detElem, 2);
1029  if (fIterator == 0x0) return 0x0;
1031  fDataX = detElem;
1032  return fIterator;
1033  }
1034 
1036  {
1037  Int_t chamber = x;
1038  Int_t cathode = y;
1039  if (chamber < 0 or AliMpConstants::NofChambers() <= chamber)
1040  {
1041  AliError(Form(
1042  "Must have give a chamber value in the range [0..%d], but got a value of: %d",
1044  chamber
1045  ));
1046  return 0x0;
1047  }
1048  if (cathode < 0 or 1 < cathode)
1049  {
1050  AliError(Form("Must have give a cathode value in the range [0..1], but got a value of: %d", cathode));
1051  return 0x0;
1052  }
1053 
1055  if (store == 0x0) return 0x0;
1057  fIterator = store->CreateIterator(AliMp::PairFirst(pair), AliMp::PairSecond(pair), cathode);
1058  if (fIterator == 0x0) return 0x0;
1060  fDataX = chamber;
1061  fDataY = cathode;
1062  return fIterator;
1063  }
1064 
1065  case kLocalTriggerIterator:
1066  {
1068  if (store == 0x0) return 0x0;
1069  fIterator = store->CreateLocalIterator();
1070  if (fIterator == 0x0) return 0x0;
1072  return fIterator;
1073  }
1074 
1076  {
1078  if (store == 0x0) return 0x0;
1079  fIterator = store->CreateRegionalIterator();
1080  if (fIterator == 0x0) return 0x0;
1082  return fIterator;
1083  }
1084 
1085  default:
1086  return 0x0;
1087  }
1088 }
1089 
1090 //_____________________________________________________________________________
1092 {
1096 
1097  if (fIterator != 0x0) delete fIterator;
1099  fCurrentIndex = fDataX = fDataY = -1;
1100  fIterator = 0x0;
1101 }
1102 
1103 //_____________________________________________________________________________
1105 {
1108 
1109  if (iter == 0x0) return -1;
1110  Int_t count = 0;
1111  iter->Reset();
1112  while ( iter->Next() != 0x0 ) count++;
1113  iter->Reset();
1114  fCurrentIndex = -1;
1115  return count;
1116 }
1117 
1118 //_____________________________________________________________________________
1119 TObject* AliMUONMCDataInterface::FetchObject(TIterator* iter, Int_t index)
1120 {
1131 
1132  if (index < 0)
1133  {
1134  AliError(Form("Index is out of bounds. Got a value of %d.", index));
1135  return 0x0;
1136  }
1137 
1138  if (iter == 0x0) return 0x0;
1139  if (index <= fCurrentIndex)
1140  {
1141  iter->Reset();
1142  fCurrentIndex = -1;
1143  }
1144 
1145  TObject* object = 0x0;
1146  while (fCurrentIndex < index)
1147  {
1148  object = iter->Next();
1149  if (object == 0x0)
1150  {
1151  AliError(Form("Index is out of bounds. Got a value of %d.", index));
1152  iter->Reset();
1153  fCurrentIndex = -1;
1154  return 0x0;
1155  }
1156  fCurrentIndex++;
1157  }
1158  return object;
1159 }
AliMUONVDigitStore * SDigitStore(Int_t event)
TClonesArray * fTrackRefs
! current trackrefs (owner)
virtual TIterator * CreateIterator() const =0
Return an iterator to loop over the whole store.
virtual TIterator * CreateRegionalIterator() const =0
Create iterator on regional trigger.
static Int_t NofChambers()
Return number of chambers.
AliLoader * fLoader
! Tree accessor
TFile * Open(const char *filename, Long64_t &nevents)
virtual TIterator * CreateLocalIterator() const =0
Create iterator on local trigger.
Interface for a digit container.
virtual Int_t GetRun() const
Definition: AliHeader.h:35
Virtual store to hold digit.
virtual void Print(Option_t *wildcard="") const
Print all objects whose name matches wildcard.
TIterator * GetIterator(IteratorType type, Int_t x=0, Int_t y=0)
AliMUONVDigit * Digit(Int_t detElemId, Int_t index)
AliMUONVDigitStore * fDigitStore
! current digit store (owner)
void Open(const char *filename)
An iterator for iterating over the simulated regional triggers.
static MpPair_t GetDetElemIdRange(Int_t chamberId)
TTree * TreeD() const
Definition: AliLoader.h:87
AliLoader * GetDetectorLoader(const char *detname)
void UnloadTrackRefs()
An iterator for simulated digits to iterate over the detector elements.
Int_t fDataY
! Extra data parameter about the iterator, can be the cathode number.
static Int_t fgInstanceCounter
! To build unique folder name for each instance
TTree * TreeS() const
Definition: AliLoader.h:85
TParticle * Particle(Int_t index)
AliTPCfastTrack * track
AliMUONVTriggerStore * TriggerStore(Int_t event)
AliMUONRegionalTrigger * RegionalTrigger(Int_t index)
void DumpSorted(const AliMUONVStore &store) const
An iterator for simulated digits to iterate over chambers and cathodes.
AliMUONGlobalTrigger * GlobalTrigger()
Base class of a trigger information store.
TClonesArray * TrackRefs(Int_t event, Int_t track)
virtual TIterator * CreateIterator() const =0
Create an iterator to loop over all our digits.
static AliRunLoader * Open(const char *filename="galice.root", const char *eventfoldername=AliConfig::GetDefaultEventFolderName(), Option_t *option="READ")
AliMUONVDigitStore * fSDigitStore
! current sdigit store (owner)
AliMUONVDigitStore * DigitStore(Int_t event)
AliMUONVHitStore * fHitStore
! current hit store (owner)
Reconstructed regional Trigger object.
Int_t CountObjects(TIterator *iter)
Int_t LoadSDigits(Option_t *opt="")
Definition: AliLoader.h:101
virtual Int_t GetNtrack() const
Definition: AliStack.h:134
AliMUONHit * Hit(Int_t track, Int_t index)
Reconstructed Local Trigger object.
Int_t NumberOfSDigits(Int_t detElemId)
void UnloadDigits() const
Definition: AliLoader.h:131
virtual AliMUONVDigitStore * Create() const =0
Create an (empty) object of the same concrete class as *this.
virtual AliMUONVStore * Create() const =0
Create an empty copy of this.
IteratorType
The various identifiers for the type of iterator constructed.
Int_t fDataX
! Extra data parameter about the iterator, can be the chamber number, detector element or track numbe...
AliHeader * GetHeader() const
AliRunLoader * GetRunLoader()
Definition: AliLoader.cxx:495
void DumpDigits(Int_t event, Bool_t sorted=kTRUE)
Int_t LoadHeader()
virtual AliMUONGlobalTrigger * Global() const =0
Return global trigger.
An iterator for iterating over the simulated local triggers.
AliMUONVTriggerStore * fTriggerStore
! current trigger store (owner)
Int_t GetNumberOfEvents()
void SetRun(Int_t run)
An iterator to iterate over the hits.
#define AliFatal(message)
Definition: AliLog.h:640
TTree * TreeTR() const
Int_t LoadHits(Option_t *opt="")
Definition: AliLoader.h:96
IteratorType fCurrentIteratorType
! The type of iterator that is currently set.
TIterator * fIterator
! Iterator for various iteration operations.
Int_t GetEvent(Int_t evno)
Bool_t IsValid() const
Returns true if the data interface was able to open the root file correctly.
TParticle * Particle(Int_t id, Bool_t useInEmbedding=kFALSE)
Definition: AliStack.cxx:689
#define AliDebug(logLevel, message)
Definition: AliLog.h:300
void DumpSDigits(Int_t event, Bool_t sorted=kTRUE)
Bool_t fIsValid
! whether we were initialized properly or not
Int_t MpPair_t
Easy to use data access to MC information.
MonteCarlo hit.
Definition: AliMUONHit.h:24
void UnloadHits() const
Definition: AliLoader.h:129
TTree * TreeH() const
Definition: AliLoader.h:83
Int_t PairFirst(MpPair_t pair)
Decode the first integer from encoded pair.
Int_t LoadTrackRefs(Option_t *option="READ")
virtual TIterator * CreateIterator() const =0
Return an iterator to loop over hits.
Bool_t GetEvent(Int_t event=0)
Global trigger object.
ABC of a MUON digit.
Definition: AliMUONVDigit.h:18
void UnloadSDigits() const
Definition: AliLoader.h:130
virtual void Print(Option_t *wildcard="") const
Print all objects whose name matches wildcard.
static Int_t runNumber
Definition: pdc06_config.C:126
Int_t NumberOfDigits(Int_t detElemId)
AliMUONVHitStore * HitStore(Int_t event, Int_t track)
TObject * FetchObject(TIterator *iter, Int_t index)
AliMUONVDigit * SDigit(Int_t detElemId, Int_t index)
AliStack * Stack(Int_t event)
virtual void Clear(Option_t *opt="")=0
Clear ourselves (i.e. Reset)
#define AliError(message)
Definition: AliLog.h:591
Int_t PairSecond(MpPair_t pair)
Decode the second integer from encoded pair.
Int_t LoadDigits(Option_t *opt="")
Definition: AliLoader.h:106
static AliCDBManager * Instance(TMap *entryCache=NULL, Int_t run=-1)
static AliRunLoader * GetRunLoader(const char *eventfoldername)
Base class for MUON data stores.
Definition: AliMUONVStore.h:22
Int_t fCurrentIndex
! A current index number maintained for certain iteration operations.
Int_t fCurrentEvent
! Current event we&#39;ve read in
virtual Bool_t Connect(TTree &tree, Bool_t alone=kTRUE) const
Connect us to a TTree (only valid if CanConnect()==kTRUE)
A summable digit iterator to iterate over chambers and cathodes.
static Bool_t LoadMpSegmentation(Bool_t warn=false)
Definition: AliMpCDB.cxx:113
A summable digit iterator to iterate over the detector elements.
AliMUONLocalTrigger * LocalTrigger(Int_t index)
Int_t LoadKinematics(Option_t *option="READ")
AliStack * Stack() const
Definition: AliRunLoader.h:95