36 #include "AliLoader.h"
37 #include "AliRunLoader.h"
38 #include "AliHeader.h"
39 #include "AliCDBManager.h"
42 #include <Riostream.h>
47 #include <TIterator.h>
84 fCurrentIteratorType(kNoIterator),
95 if ( AliCDBManager::Instance() != NULL &&
96 AliCDBManager::Instance()->GetDefaultStorage() == NULL ) {
97 AliFatal(
"CDB default storage not defined.");
104 AliFatal(
"Could not access mapping from OCDB !");
145 TTree* treeD =
fLoader->TreeD();
148 AliError(
"Could not get treeD");
194 TTree* treeR =
fLoader->TreeR();
197 AliError(
"Could not get treeR");
258 TString stree(treeLetter);
266 else if ( stree ==
"R" )
274 AliError(Form(
"Could not get tree%s",treeLetter));
290 else if ( stree ==
"R" )
346 list.SetOwner(kFALSE);
348 while ( (
object = next() ) )
388 TString sTreeLetter(treeLetter);
389 sTreeLetter.ToUpper();
391 if ( sTreeLetter !=
"R" && sTreeLetter !=
"D" )
393 AliError(Form(
"Cannot handle tree%s. Use D or R",treeLetter));
398 TNtuple tupleGlo(
"TgtupleGlo",
"Global Trigger Ntuple",
399 "ev:slpt:shpt:uplpt:uphpt:lplpt:lplpt");
400 TNtuple tupleLoc(
"TgtupleLoc",
"Local Trigger Ntuple",
401 "ev:LoCircuit:LoStripX:LoDev:StripY:LoLpt:LoHpt:y11:y21:x11");
413 gSystem->DirName(
fLoader->GetRunLoader()->GetFileName())));
417 Char_t fileNameOut[30];
418 if (sTreeLetter ==
"D")
420 AliInfo(Form(
"reading from Digits\n"));
421 sprintf(fileNameOut,
"TriggerCheckFromDigits.root");
423 else if (sTreeLetter ==
"R")
425 AliInfo(Form(
"reading from RecPoints\n"));
426 sprintf(fileNameOut,
"TriggerCheckFromRP.root");
432 for (Int_t ievent=0; ievent<nevents; ++ievent)
434 if (ievent%100==0) AliInfo(Form(
"Processing event %d\n",ievent));
440 AliError(Form(
"Could not read %s from tree%s",
"Trigger",treeLetter));
456 while ( ( locTrg = static_cast<AliMUONLocalTrigger*>(next()) ) )
458 Bool_t xTrig=locTrg->IsTrigX();
459 Bool_t yTrig=locTrg->IsTrigY();
463 tupleLoc.Fill(ievent,locTrg->LoCircuit(),
469 triggerCircuit.
GetY11Pos(locTrg->LoCircuit(),locTrg->LoStripX()),
470 triggerCircuit.
GetY21Pos(locTrg->LoCircuit(),locTrg->LoStripX()+locTrg->LoDev()+1),
471 triggerCircuit.
GetX11Pos(locTrg->LoCircuit(),locTrg->LoStripY()));
481 printf(
"=============================================\n");
482 printf(
"================ SUMMARY ==================\n");
484 printf(
"Total number of events processed %d \n",nevents);
486 printf(
" Global Trigger output Low pt High pt\n");
487 printf(
" number of Single :\t");
488 printf(
"%i\t%i\t",sLowpt,sHighpt);
490 printf(
" number of UnlikeSign pair :\t");
491 printf(
"%i\t%i\t",uSLowpt,uSHighpt);
493 printf(
" number of LikeSign pair :\t");
494 printf(
"%i\t%i\t",lSLowpt,lSHighpt);
496 printf(
"=============================================\n");
499 TFile myFile(fileNameOut,
"RECREATE");
514 AliDebug(1,Form(
"Loading event %d using runLoader %p",event,
fLoader->GetRunLoader()));
515 if (
fLoader->GetRunLoader()->GetEvent(event) == 0)
530 return fLoader->GetRunLoader()->GetNumberOfEvents();
545 delete fLoader->GetRunLoader();
554 while (AliRunLoader::GetRunLoader(foldername) != 0x0)
556 delete AliRunLoader::GetRunLoader(foldername);
560 if (runLoader == 0x0)
562 AliError(Form(
"Cannot open file %s",filename));
567 runLoader->LoadHeader();
568 if ( ! runLoader->GetHeader() ) {
569 AliError(
"Cannot load header.");
573 Int_t runNumber = runLoader->GetHeader()->GetRun();
574 AliCDBManager::Instance()->SetRun(runNumber>=0 ? runNumber : 1);
576 runLoader->UnloadHeader();
578 fLoader = runLoader->GetDetectorLoader(
"MUON");
581 AliError(
"Cannot get AliMUONLoader");
587 AliError(Form(
"Could not access %s filename. Object is unuseable",filename));
718 if (store == 0x0)
return 0x0;
767 AliError(
"No event was selected. Try first using GetEvent().");
779 if (store == 0x0)
return 0x0;
794 "Must have give a chamber value in the range [0..%d], but got a value of: %d",
800 if (cathode < 0 or 1 < cathode)
802 AliError(Form(
"Must have give a cathode value in the range [0..1], but got a value of: %d", cathode));
807 if (store == 0x0)
return 0x0;
821 if (store == 0x0)
return 0x0;
832 if (store == 0x0)
return 0x0;
842 if (store == 0x0)
return 0x0;
873 if (iter == 0x0)
return -1;
876 while ( iter->Next() != 0x0 ) count++;
898 AliError(Form(
"Index is out of bounds. Got a value of %d.", index));
902 if (iter == 0x0)
return 0x0;
909 TObject*
object = 0x0;
912 object = iter->Next();
915 AliError(Form(
"Index is out of bounds. Got a value of %d.", index));
Int_t fCurrentIndex
! A current index number maintained for certain iteration operations.
Int_t NumberOfDigits(Int_t detElemId)
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.
TObject * FetchObject(TIterator *iter, Int_t index)
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
TFile * Open(const char *filename, Long64_t &nevents)
void DumpTrigger(Int_t event, const char *treeLetter="R")
Int_t NumberOfRawClusters(Int_t chamber)
virtual TIterator * CreateLocalIterator() const =0
Create iterator on local trigger.
Int_t CountObjects(TIterator *iter)
Float_t GetY21Pos(Int_t localBoardId, Int_t istrip) const
Interface for a digit container.
virtual void Print(Option_t *wildcard="") const
Print all objects whose name matches wildcard.
Bool_t IsValid() const
Returns true if the data interface was able to open the root file correctly.
Int_t fCurrentEvent
! Current event we've read in
An easy to use interface to MUON data.
void DumpDigits(Int_t event, Bool_t sorted=kTRUE)
AliMUONVDigitStore * fDigitStore
! current digit store (owner)
AliMUONGlobalTrigger * GlobalTrigger()
static MpPair_t GetDetElemIdRange(Int_t chamberId)
AliMUONRegionalTrigger * RegionalTrigger(Int_t index)
A digit iterator for iterating over detector elements.
static Bool_t LoadDDLStore(Bool_t warn=false)
AliMUONVDigitStore * DigitStore(Int_t event)
IteratorType fCurrentIteratorType
! The type of iterator that is currently set.
Bool_t GetEvent(Int_t event=0)
virtual void Clear(Option_t *opt="")=0
Clear container.
A digit iterator for iterating over chambers and cathodes.
void Open(const char *filename)
No iterator was constructed.
Base class of a trigger information store.
AliMUONVClusterStore * fClusterStore
! current cluster store (owner)
virtual TIterator * CreateIterator() const =0
Create an iterator to loop over all our digits.
virtual TIterator * CreateIterator() const
Create iterator (on local card)
Int_t SingleLpt() const
Return number of Single Low pt.
Reconstructed regional Trigger object.
AliMUONVTriggerStore * fTriggerStore
! current trigger store (owner)
Int_t NumberOfEvents() const
abstract base class for clusters
IteratorType
The various identifiers for the type of iterator constructed.
AliLoader * fLoader
! Tree accessor
Reconstructed Local Trigger object.
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.
AliMUONVTriggerStore * TriggerStore(Int_t event, const char *treeLetter="R")
An iterator for iterating over reconstructed regional triggers.
Float_t GetY11Pos(Int_t localBoardId, Int_t istrip) const
TIterator * fIterator
! Iterator for various iteration operations.
TString fTreeLetter
! The tree letter used in the last call to TriggerStore().
static Int_t fgInstanceCounter
! To build unique folder name for each instance
Int_t NumberOfLocalTriggers()
virtual ~AliMUONDataInterface()
Bool_t LoadEvent(Int_t event)
Interface of a cluster container.
virtual AliMUONGlobalTrigger * Global() const =0
Return global trigger.
virtual TIterator * CreateChamberIterator(Int_t firstChamberId, Int_t lastChamberId) const =0
Return an iterator to loop over the store in the given chamber range.
AliMUONLocalTrigger * LocalTrigger(Int_t index)
void DumpSorted(const AliMUONVStore &store) const
Int_t NumberOfRegionalTriggers()
An iterator for iterating over reconstructed local triggers.
Int_t fDataX
! Extra data parameter about the iterator, can be the chamber number or detector element.
Int_t PairLikeHpt() const
Return number of Like sign pair High pt.
Int_t PairFirst(MpPair_t pair)
Decode the first integer from encoded pair.
void DumpRecPoints(Int_t event, Bool_t sorted=kTRUE)
Bool_t fIsValid
! whether we were initialized properly or not
virtual void Print(Option_t *wildcard="") const
Print all objects whose name matches wildcard.
AliMUONVDigit * Digit(Int_t detElemId, Int_t index)
virtual void Clear(Option_t *opt="")=0
Clear ourselves (i.e. Reset)
TIterator * GetIterator(IteratorType type, Int_t x=0, Int_t y=0)
Int_t PairSecond(MpPair_t pair)
Decode the second integer from encoded pair.
Int_t fDataY
! Extra data parameter about the iterator, can be the cathode number.
Base class for MUON data stores.
Int_t PairLikeLpt() const
Return number of Like sign pair Low pt.
virtual Bool_t Connect(TTree &tree, Bool_t alone=kTRUE) const
Connect us to a TTree (only valid if CanConnect()==kTRUE)
Int_t SingleHpt() const
Return number of Single High pt.
AliMUONVClusterStore * ClusterStore(Int_t event)
void NtupleTrigger(const char *treeLetter)
AliMUONVCluster * RawCluster(Int_t chamber, Int_t index)
Float_t GetX11Pos(Int_t localBoardId, Int_t istrip) const
Int_t PairUnlikeLpt() const
Return number of Unlike sign pair Low pt.
Int_t PairUnlikeHpt() const
Return number of Unlike sign pair High pt.