1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
19 #include <TParticle.h>
21 #include "AliRunLoader.h"
22 #include "AliLoader.h"
24 #include "AliMUONDataInterface.h"
25 #include "AliMUONLocalTrigger.h"
26 #include "AliMUONGlobalTrigger.h"
27 #include "AliMUONHit.h"
28 #include "AliMUONDigit.h"
29 #include "AliMUONRawCluster.h"
30 #include "AliMUONTrack.h"
33 #include <Riostream.h>
35 #include "AliMUONVDigitStore.h"
36 #include "AliMUONVTriggerStore.h"
37 #include "AliMUONVClusterStore.h"
38 #include "AliMUONVTrackStore.h"
39 #include "AliMUONVTriggerTrackStore.h"
40 #include "AliMUONDataManager.h"
45 /// \class AliMUONDataInterface
47 /// An easy to use interface to the MUON data data stored in
48 /// TreeS, TreeD, TreeR and TreeT.
50 /// For MC related information (i.e. TreeH, TreeK, TreeTR), see
51 /// AliMUONMCDataInterface.
54 /// This interface in not necessarily the fastest way to fetch the data but
55 /// it is the easiest.
57 /// \author Laurent Aphecetche, Subatech
60 ClassImp(AliMUONDataInterface)
63 //______________________________________________________________________________
64 AliMUONDataInterface::AliMUONDataInterface(const char* filename)
66 fDataManager(new AliMUONDataManager(filename))
69 /// @param filename should be the full path to a valid galice.root file
73 AliError("Improper initialization. Object will be unuseable");
77 //______________________________________________________________________________
78 AliMUONDataInterface::~AliMUONDataInterface()
84 //______________________________________________________________________________
86 AliMUONDataInterface::ClusterStore(Int_t event) const
88 /// Return the cluster store for a given event
89 if (!IsValid()) return 0x0;
90 return dynamic_cast<AliMUONVClusterStore*>(fDataManager->ReadConnectable(event,"R","Cluster"));
94 //______________________________________________________________________________
96 AliMUONDataInterface::DumpRecPoints(Int_t event, Bool_t sorted) const
98 /// Dump the recpoints for a given event, sorted if so required
99 DumpIt("R","Cluster",event,sorted);
102 //______________________________________________________________________________
104 AliMUONDataInterface::DigitStore(Int_t event) const
106 /// Return the digit store for a given event
107 if (!IsValid()) return 0x0;
108 return dynamic_cast<AliMUONVDigitStore*>(fDataManager->ReadConnectable(event,"D","Digit"));
111 //______________________________________________________________________________
113 AliMUONDataInterface::DigitStoreAsList(Int_t event) const
115 /// Return the digitStore as a TList
116 AliMUONVDigitStore* digitStore = DigitStore(event);
118 TIter next(digitStore->CreateIterator());
120 TList* list = new TList;
121 list->SetOwner(kTRUE);
124 while ( ( object = next() ) )
126 list->Add(object->Clone());
133 //______________________________________________________________________________
135 AliMUONDataInterface::DumpIt(const char* treeLetter, const char* what,
136 Int_t event, Bool_t sorted) const
138 /// Generic dump method used by the other DumpXXX methods
139 AliMUONVStore* store = fDataManager->ReadConnectable(event,treeLetter,what);
142 AliError(Form("Could not read %s from tree%s",what,treeLetter));
149 list.SetOwner(kFALSE);
150 TIter next(store->CreateIterator());
153 while ( ( object = next() ) )
170 //______________________________________________________________________________
172 AliMUONDataInterface::DumpDigits(Int_t event, Bool_t sorted) const
174 /// Dump digits of a given event, sorted if so required
175 DumpIt("D","Digit",event,sorted);
178 //______________________________________________________________________________
180 AliMUONDataInterface::IsValid() const
182 /// Whether we were properly initialized from a valid galice.root file
183 return fDataManager->IsValid();
186 //______________________________________________________________________________
188 AliMUONDataInterface::NumberOfEvents() const
190 /// Number of events in the current galice.root file we're attached to
191 if (!IsValid()) return 0;
192 return fDataManager->NumberOfEvents();
195 //______________________________________________________________________________
197 AliMUONDataInterface::SDigitStore(Int_t event) const
199 /// Return the SDigit store for a given event
200 if (!IsValid()) return 0x0;
201 return dynamic_cast<AliMUONVDigitStore*>(fDataManager->ReadConnectable(event,"S","SDigit"));
204 //______________________________________________________________________________
206 AliMUONDataInterface::DumpSDigits(Int_t event, Bool_t sorted) const
208 /// Dump sdigits for a given event, sorted if so required
209 DumpIt("S","Digit",event,sorted);
213 //______________________________________________________________________________
215 AliMUONDataInterface::TrackStore(Int_t event) const
217 /// Return the track store for a given event
218 if (!IsValid()) return 0x0;
219 return dynamic_cast<AliMUONVTrackStore*>(fDataManager->ReadConnectable(event,"T","Track"));
222 //______________________________________________________________________________
224 AliMUONDataInterface::DumpTracks(Int_t event, Bool_t sorted) const
226 /// Dump tracks for a given event, sorted if so required
227 DumpIt("T","Track",event,sorted);
230 //______________________________________________________________________________
231 AliMUONVTriggerStore*
232 AliMUONDataInterface::TriggerStore(Int_t event, const char* treeLetter) const
234 /// Return the trigger store for a given event, from a given tree (D or R)
235 if (!IsValid()) return 0x0;
236 return dynamic_cast<AliMUONVTriggerStore*>(fDataManager->ReadConnectable(event,treeLetter,"Trigger"));
239 //______________________________________________________________________________
241 AliMUONDataInterface::DumpTrigger(Int_t event, const char* treeLetter) const
243 /// Dump trigger for a given event, from a given tree, sorted if possible
244 DumpIt(treeLetter,"Trigger",event,kFALSE);
247 //______________________________________________________________________________
248 AliMUONVTriggerTrackStore*
249 AliMUONDataInterface::TriggerTrackStore(Int_t event) const
251 /// Return trigger track store for a given event
252 if (!IsValid()) return 0x0;
253 return dynamic_cast<AliMUONVTriggerTrackStore*>(fDataManager->ReadConnectable(event,"T","TriggerTrack"));
256 //______________________________________________________________________________
258 AliMUONDataInterface::DumpTriggerTracks(Int_t event, Bool_t sorted) const
260 /// Dump trigger tracks for a given event
261 DumpIt("T","Trigger",event,sorted);
264 //______________________________________________________________________________
265 //______________________________________________________________________________
266 //______________________________________________________________________________
267 //______________________________________________________________________________
269 void AliMUONDataInterface::Reset()
271 /// \deprecated Method is going to be removed
273 AliFatal("Deprecated");
276 Bool_t AliMUONDataInterface::UseCurrentRunLoader()
278 /// \deprecated Method is going to be removed
280 AliFatal("Deprecated");
284 Int_t AliMUONDataInterface::NumberOfEvents(TString , TString )
286 /// \deprecated Method is going to be removed
288 AliFatal("Deprecated");
293 Int_t AliMUONDataInterface::NumberOfParticles(TString , TString , Int_t )
295 /// \deprecated Method is going to be removed
297 AliFatal("Deprecated");
302 TParticle* AliMUONDataInterface::Particle(
303 TString , TString , Int_t , Int_t
306 /// \deprecated Method is going to be removed
308 AliFatal("Deprecated");
313 Int_t AliMUONDataInterface::NumberOfTracks(TString , TString , Int_t )
315 /// \deprecated Method is going to be removed
317 AliFatal("Deprecated");
322 Int_t AliMUONDataInterface::NumberOfHits(
323 TString , TString , Int_t , Int_t
326 /// \deprecated Method is going to be removed
328 AliFatal("Deprecated");
333 AliMUONHit* AliMUONDataInterface::Hit(
334 TString , TString , Int_t ,
338 /// \deprecated Method is going to be removed
340 AliFatal("Deprecated");
345 Int_t AliMUONDataInterface::NumberOfSDigits(
346 TString , TString , Int_t ,
350 /// \deprecated Method is going to be removed
352 AliFatal("Deprecated");
357 AliMUONDigit* AliMUONDataInterface::SDigit(
358 TString , TString , Int_t ,
359 Int_t , Int_t , Int_t
362 /// \deprecated Method is going to be removed
364 AliFatal("Deprecated");
369 Int_t AliMUONDataInterface::NumberOfDigits(
370 TString , TString , Int_t ,
374 /// \deprecated Method is going to be removed
376 AliFatal("Deprecated");
381 AliMUONDigit* AliMUONDataInterface::Digit(
382 TString , TString , Int_t ,
383 Int_t , Int_t , Int_t
386 /// \deprecated Method is going to be removed
388 AliFatal("Deprecated");
393 Int_t AliMUONDataInterface::NumberOfRawClusters(
394 TString , TString , Int_t , Int_t
397 /// \deprecated Method is going to be removed
399 AliFatal("Deprecated");
404 AliMUONRawCluster* AliMUONDataInterface::RawCluster(
405 TString , TString , Int_t ,
409 /// \deprecated Method is going to be removed
411 AliFatal("Deprecated");
416 Int_t AliMUONDataInterface::NumberOfLocalTriggers(TString , TString , Int_t )
418 /// \deprecated Method is going to be removed
420 AliFatal("Deprecated");
425 AliMUONLocalTrigger* AliMUONDataInterface::LocalTrigger(
426 TString , TString , Int_t , Int_t
429 /// \deprecated Method is going to be removed
431 AliFatal("Deprecated");
435 Bool_t AliMUONDataInterface::SetFile(TString , TString )
437 /// \deprecated Method is going to be removed
439 AliFatal("Deprecated");
444 Bool_t AliMUONDataInterface::GetEvent(Int_t )
446 /// \deprecated Method is going to be removed
448 AliFatal("Deprecated");
452 Int_t AliMUONDataInterface::NumberOfParticles()
454 /// \deprecated Method is going to be removed
456 AliFatal("Deprecated");
461 TParticle* AliMUONDataInterface::Particle(Int_t )
463 /// \deprecated Method is going to be removed
465 AliFatal("Deprecated");
470 Int_t AliMUONDataInterface::NumberOfTracks()
472 /// \deprecated Method is going to be removed
474 AliFatal("Deprecated");
479 Int_t AliMUONDataInterface::NumberOfHits(Int_t )
481 /// \deprecated Method is going to be removed
483 AliFatal("Deprecated");
489 AliMUONDataInterface::Hit(Int_t , Int_t )
491 /// \deprecated Method is going to be removed
493 AliFatal("Deprecated");
498 Int_t AliMUONDataInterface::NumberOfSDigits(Int_t , Int_t )
500 /// \deprecated Method is going to be removed
502 AliFatal("Deprecated");
507 AliMUONDigit* AliMUONDataInterface::SDigit(Int_t , Int_t , Int_t )
509 /// \deprecated Method is going to be removed
511 AliFatal("Deprecated");
517 Int_t AliMUONDataInterface::NumberOfDigits(Int_t , Int_t )
519 /// \deprecated Method is going to be removed
521 AliFatal("Deprecated");
527 AliMUONDigit* AliMUONDataInterface::Digit(Int_t , Int_t , Int_t )
529 /// \deprecated Method is going to be removed
531 AliFatal("Deprecated");
536 Int_t AliMUONDataInterface::NumberOfRawClusters(Int_t )
538 /// \deprecated Method is going to be removed
540 AliFatal("Deprecated");
545 AliMUONRawCluster* AliMUONDataInterface::RawCluster(Int_t , Int_t )
547 /// \deprecated Method is going to be removed
549 AliFatal("Deprecated");
554 Int_t AliMUONDataInterface::NumberOfLocalTriggers()
556 /// \deprecated Method is going to be removed
558 AliFatal("Deprecated");
563 AliMUONLocalTrigger* AliMUONDataInterface::LocalTrigger(Int_t )
565 /// \deprecated Method is going to be removed
567 AliFatal("Deprecated");
571 Int_t AliMUONDataInterface::NumberOfGlobalTriggers()
573 /// \deprecated Method is going to be removed
575 AliFatal("Deprecated");
579 AliMUONGlobalTrigger* AliMUONDataInterface::GlobalTrigger(Int_t )
581 /// \deprecated Method is going to be removed
583 AliFatal("Deprecated");
587 Int_t AliMUONDataInterface::NumberOfRecTracks()
589 /// \deprecated Method is going to be removed
591 AliFatal("Deprecated");
595 AliMUONTrack* AliMUONDataInterface::RecTrack(Int_t )
597 /// \deprecated Method is going to be removed
599 AliFatal("Deprecated");