ROOT logo
HYDRA - THE HADES ANALYSIS PACKAGE » (UNKNOWN) » HParticleTree

class HParticleTree: public HReconstructor

_HADES_CLASS_DESCRIPTION



 HParticleTree

 Reconstructor to create an filtered root output.
 The output is generated independend for each HParticleTree
 reconstructor and das not affect Hades. The purpose
 is to create different output files with different event
 structure in parallel and allow to reduce the data volume
 for special analysis tasks (for example rare dilepton decays
 in Au+Au collisions).
 The filtering starts from HParticleCand. Only objects
 which are flagged kIsUsed are copied to the output.
 The user can specify selectLeptons() and selectHadrons()
 functions. By default the functions of HParticleTracksorter
 are used (for the documentation of the selection functions see
 HParticleTrackSorter). In addition the user can specify a selectEvent()
 function function which allows to check the full event.

 The program works the following way:

 I.    The original flags of the HParticleCand objects and HParticleSorter
       are backupted. This alows to run the task without affecting other tasks.
 II.   In the input HParticleCand objects are flagged using the user specified
       selection functions or default functions.
 III.  If the user provides a Bool_t selectEvent(TObjArray*) function the
       properties of the full event can be evaluated. If the function returns
       kFALSE an empty event ist stored to preserve the 1 to 1 correlation
       with the dst file.
       With setSkipEmptyEvents (kTRUE) skipping of not selected events can be forced
 III.  From HParticleCand objects which are flagged kIsUsed the selection
       procedure starts. Only flagged objects are considered and the detector
       hits belonging to the candidates are stored in the output too if enabled.
       With setSkipTracks(kFALSE) all tracks will forced to the output.
       HParticleEvtInfo, HStart2Cal, HStartHit and HWallHit are fully copied
       if enabled (see list below).
       Alternatively (not at the same time!) to using flagged candidates as
       selection the user can provide a function to select the kept particles by
       setUserkeepTrack(Bool_t (*function)(HParticleCand* )). The function
       has to return kTRUE for selected candidates.
       All indices are resorted. The new event will look like the old one,
       but containing only "good" candidates. The full features of the analysis
       of the DSTs are preserved.

       SUPPORTED CATEGORIES:

       catParticleCand
       catParticleMdc           (extracted from HParticleCand only)
       catParticleEvtInfo       (fullcopy only)
       catStart2Hit             (fullcopy only)
       catStart2Cal             (fullcopy only)
       catTBoxChan              (fullcopy only)
       catWallHit               (fullcopy only)
       catWallEventPlane        (fullcopy only)
       catPionTrackerRaw        (fullcopy only)
       catPionTrackerCal        (fullcopy only)
       catPionTrackerHit        (fullcopy only)
       catPionTrackerTrack      (fullcopy only)
       catTofHit                (fullcopy or extracted from HParticleCand)
       catTofCluster            (fullcopy or extracted from HParticleCand)
       catRpcCluster            (fullcopy or extracted from HParticleCand)
       catShowerHit             (fullcopy or extracted from HParticleCand)
       catEmcCluster            (fullcopy only)
       catEmcCal                (fullcopy only)
       catRichHit               (fullcopy or extracted from HParticleCand)
       catRichDirClus           (fullcopy only)
       catRichCal               (fullcopy only)
       catMdcSeg                (extracted from HParticleCand only)
       catMdcHit                (extracted from HParticleCand only)
       catMdcCal1               (extracted from HParticleCand only)
       catMdcClus               (extracted from HParticleCand only)
       catMdcClusInf            (extracted from HParticleCand only)
       catMdcClusFit            (extracted from HParticleCand only)
       catMdcWireFit            (extracted from HParticleCand only)
       catGeantKine             (fullcopy only)
       catMdcGeantRaw           (fullcopy only)
       catTofGeantRaw           (fullcopy only)
       catRpcGeantRaw           (fullcopy only)
       catShowerGeantRaw        (fullcopy only)
       catEmcGeantRaw           (fullcopy only)
       catWallGeantRaw          (fullcopy only)
       catRichGeantRaw (+1,+2)  (fullcopy only)


 create output:
 by
 1. set outputfilename       ( full name including path, dir or suffix not used)
 2. by hades output name     ( dir / file stem + suffix + _cyclecount.root)
 3. by datasource input name ( dir / file stem + suffix + _cyclecount.root)

 Example: Filter dilepton events :

 I.   use the standard selectLeptons() from HParticleTrackSorter
 II.  ignore hadrons : take simple user defined function below
 III. select events which have at least 1 positron and 1 electron candidate
 IV.  create the event structure you need

  //------------------------------------------------------
  Bool_t selectLeptons(HParticleCand* pcand){

    //  selection function for lepton candidates.
    Bool_t select = kFALSE;
    if(pcand->isFlagAND(5,
			Particle::kIsAcceptedHitRICH,
			Particle::kIsAcceptedHitInnerMDC,
			Particle::kIsAcceptedHitOuterMDC,
			Particle::kIsAcceptedHitMETA,
			Particle::kIsAcceptedRK)
       &&
       pcand->getInnerSegmentChi2() > 0
       &&
       pcand->getChi2() < 1000
       &&
       pcand->getBeta() > 0.9
    ) select = kTRUE;

   return select;
  }
  //------------------------------------------------------
  //------------------------------------------------------
  Bool_t selectNoHadron(HParticleCand*){
      // do not use this selection
      return kFALSE;
  }

  //------------------------------------------------------
  Bool_t selectEvent(TObjArray* ar){
    // select events which have at least
    // one lepton canddate pair . TObjArray* can
    // be used to pas parameters into the function

    HCategory* catCand = gHades->getCurrentEvent()->getCategory(catParticleCand);
    if(catCand){
    Int_t n=catCand->getEntries();
    HParticleCand* cand=0;
    Int_t nEle = 0;
    Int_t nPos = 0;
        for(Int_t i = 0; i < n; i ++){
    	cand = HCategoryManager::getObject(cand,catCand,i);
    	if(cand){
    	    if(cand->isFlagBit(kIsLepton)){
    		if      (cand->getCharge() == -1 ) nEle++;
    		else if (cand->getCharge() ==  1 ) nPos++;
    	    }
    	}
        }
        if( (nPos < 1 && nEle < 2) || (nPos < 2 && nEle < 1) ) return kFALSE; // accept 2likesign or 1 unlikesign pair
     } else return kFALSE;
     return kTRUE;
  }
  //------------------------------------------------------

  HParticleTree* parttree = new HParticleTree("leptontree","leptontree");
  // 1. set outputfilename       ( full name including path, dir or suffix not used)
  // 2. by hades output name     ( dir / file stem + suffix + _cyclecount.root)
  // 3. by datasource input name ( dir / file stem + suffix + _cyclecount.root)

  // case 1:
  // parttree->setOutputFile ("/lustre/hades/filter_tree.root","Filter","RECREATE",2 ); // set outfile by hand
  // case 2+3:
  partree->setOutputFileSuffix("filter_tree"); // take outfile name from Hades output or data input and add _filter_tree at the end
  parttree->setOutputDir("/lustre/hades");     // take outfile name from Hades output or data input and change the dir

  parttree->setSkipEmptyEvents(kTRUE);   (default kFALSE)
  parttree->setSkipTracks(kTRUE);        (default kTRUE)

  //-------CONFIGURE HParticleTrackSorter-----------------
  parttree->setIgnoreRICH         (kTRUE);
  parttree->setIgnoreInnerMDC     (kTRUE);
  parttree->setIgnoreOuterMDC     (kTRUE);
  parttree->setIgnoreMETA         (kTRUE);
  parttree->setIgnorePreviousIndex(kTRUE);
  parttree->setRICHMatching(Particle::kUseRKRICHWindowSorter, 4.); // matching type and window
  //------------------------------------------------------

  //-------CONFIGURE EventStructure-----------------------
  Cat_t PersistentCat[] = {
    catParticleCand,
    catParticleMdc,
    catParticleEvtInfo,
    catStart2Hit,
    catStart2Cal,
    catTBoxChan,
    catWallHit,
    catPionTrackerTrack,
    //catPionTrackerRaw,
    //catPionTrackerCal,
    //catPionTrackerHit,
    //-----------------------------
    // NO OPTION FULL COPY : ONLY OBJECTS USED BY HParticleCand WILL BE COPIED!
    // IF YOU WANT A FULL COPY SET THE FULL COPY IN ADDIION!
    //catTofHit,
    //catTofCluster,
    //catRpcCluster,
    //catEmcCluster,
    //catShowerHit,
    //catRichHit,
    //-----------------------------
    catEmcCluster,
    //catRichDirClus,
    //catRichCal,
    //catMdcSeg,
    //catMdcHit,
    //catMdcCal1,
    //catMdcClus,
    //catMdcClusInf,
    //catMdcClusFit,
    //catMdcWireFit
    //-----------------------------
    // GEANT
    //catGeantKine,
    //catMdcGeantRaw,
    //catTofGeantRaw,
    //catRpcGeantRaw,
    //catShowerGeantRaw,
    //catEmcGeantRaw,
    //catWallGeantRaw,
    //catRichGeantRaw,
    //catRichGeantRaw+1,
    //catRichGeantRaw+2,
    //catEmcGeantRaw,
    //catStartGeantRaw
    //-----------------------------
   };

  // list of categories which should be fully copied
  // (only these contained in HParticleCand as Hit Index)

    //-----------------------------
    // OPTION FULL COPY : ONLY FOR OBJECTS USED BY HParticleCand!
    // IF THE CAT IS SELECTED ALREADY, YOU CAN SWITCH IT TO FULL COPY HERE!
    Cat_t PersistentCatFullCopy[] = {
    //catTofHit,
    //catTofCluster,
    //catRpcCluster,
    //catShowerHit,
    //catRichHit
   };
    //-----------------------------

  parttree->setEventStructure(sizeof(PersistentCat)        /sizeof(Cat_t),PersistentCat,kFALSE); // filter these cats
  parttree->setEventStructure(sizeof(PersistentCatFullCopy)/sizeof(Cat_t),PersistentCat,kTRUE);  // copy these cats witt all entries
  //------------------------------------------------------
  //-------CONFIGURE SELECTIONS-----------------------
  parttree->setUserSelectionLeptons(selectLeptons);   // use own lepton selector
  parttree->setUserSelectionHadrons(selectNoHadron); // use only standard leptons from HParticlesorter
  parttree->setUserSelectionEvent(selectEvent,NULL); // no params used
  //------------------------------------------------------


Function Members (Methods)

public:
HParticleTree(const Text_t* name = "", const Text_t* title = "")
virtual~HParticleTree()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidHReconstructor::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual Bool_tHReconstructor::connectTask(HTask* task, Int_t n = 0)
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual Int_texecute()
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual Bool_tfinalize()
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual HTask*HReconstructor::getComposite()
virtual voidHReconstructor::getConnections()
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
virtual const char*TNamed::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual HTask*HTask::getOwner()
sorter_setup&getSorterSetup()
TObjArrayHReconstructor::getTable()
virtual HTask*HReconstructor::getTask(const Char_t* name)
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual Bool_tinit()
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tHReconstructor::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
virtual voidHReconstructor::isTimed(Bool_t flag = kTRUE)
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual HTask*HReconstructor::next(Int_t& errCode)
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
HTask&HTask::operator=(const HTask&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
virtual voidHReconstructor::printTimer()
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
virtual Bool_tHTask::reinit()
voidTObject::ResetBit(UInt_t f)
virtual voidHReconstructor::resetTimer()
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidHReconstructor::setActive(Bool_t state)MENU
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual Bool_tHTask::setConnections()
voidsetDoSorter(Bool_t sort)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
voidsetEventStructure(Int_t n, Cat_t* PersistentCat, Bool_t fullCopy = kFALSE)
voidsetIgnoreInnerMDC(Bool_t ignore = kTRUE)
voidsetIgnoreMETA(Bool_t ignore = kTRUE)
voidsetIgnoreOuterMDC(Bool_t ignore = kTRUE)
voidsetIgnorePreviousIndex(Bool_t ignore = kTRUE)
voidsetIgnoreRICH(Bool_t ignore = kTRUE)
voidHTask::setManual()
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
voidsetOutputDir(TString dir = "")
voidsetOutputFile(TString fname = "filter_tree.root", TString ftitle = "Filter", TString fopt = "RECREATE", Int_t fcomp = 2)
voidsetOutputFileSuffix(TString suff = "filter_tree")
virtual voidHTask::setOwner(HTask* atask)
voidsetRICHMatching(Particle::ERichMatch match, Float_t window = 4.)
voidsetSkipEmptyEvents(Bool_t skip)
voidsetSkipTracks(Bool_t skip)
voidsetSortType(Particle::ESwitch type)
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
voidsetUserkeepTrack(Bool_t (*)(HParticleCand*) function)
voidsetUserSelectionEvent(Bool_t (*)(TObjArray*) function, TObjArray* ar)
voidsetUserSelectionHadrons(Bool_t (*)(HParticleCand*) function)
voidsetUserSelectionLeptons(Bool_t (*)(HParticleCand*) function)
virtual voidShowMembers(TMemberInspector&)
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
private:
voidcloseOutput()
Bool_tdoFullCopy(Cat_t cat)
voidextractMdcCal1(Bool_t isSim, Int_t segInd)
voidextractMdcCal1FromClus(Bool_t isSim, Int_t segInd)
voidextractMdcSeg(HParticleCand* cand, Bool_t isSim, Int_t segInd1, Int_t& segInd2)
Bool_tmakeTree()
voidrecreateOutput()
voidsetEvent()

Data Members

protected:
Bool_tHReconstructor::fActiveActive flag
TList*HReconstructor::fHistogramsList of histograms generated by this reconstructor.
Bool_tHTask::fIsTimedtimer flag
TStringTNamed::fNameobject identifier
TObjArrayHReconstructor::fOutputs
TStopwatchHReconstructor::fTimerTask timer
TStringTNamed::fTitleobject title
Bool_tHTask::isConnected
Bool_tHTask::isInitialised
Bool_tHTask::manual
HTask*HTask::owner
private:
Int_tctMdcClus[6][2]!
Int_tctMdcHit[6][4]!
Int_tctMdcSeg[6][2]!
Int_tctRpcClus[6]!
vector<Int_t>fCatNums! list of persistent output categories
HRecEvent*fCurrentEvent! Event under reconstruction
Int_tfCycleNumber! cycle number of output file
Bool_tfOutFound!
Int_tfOutputCompression! output file compression
TStringfOutputDir! outputdir
TFile*fOutputFile! File used to store the output tree
TStringfOutputFileName! output file name (derived from hades output name)
TStringfOutputFileSuffix! replace .root by fOutputFileSuffix.root
TStringfOutputOption! output file option
TStringfOutputTitle! output file title
TObjArray*fParamSelectEvent! object array for optional parameters of event selection function
HTree*fTree! Output tree
map<TString,Int_t>fmCatNameToNum!
map<TString,HCategory*>fmCatNameToPointer!
vector<Int_t>fmCatNumFullCopySupport!
vector<Int_t>fmCatNumSupport!
map<Int_t,Int_t>fmCatNumToFullCopy!
map<Int_t,TString>fmCatNumToName!
map<Int_t,HCategory*>fmCatNumToPointer!
Bool_tkDoSorter! kTRUE run new tracksorter (default = kTRUE)
Bool_tkSkipEmptyEvents! kTRUE = skip not selected events (default = kFALSE)
Bool_tkSkipTracks! kTRUE = skip not selected tracks (default = kTRUE)
HSrcKeeper*keeper!
HMdcLayer*mdclayer!
HGeantMedia*media!
Bool_t (*)(HParticleCand*)pUserKeepTrack! user provided function pointer to keep/discard tracks independent of sorterflags
Bool_t (*)(TObjArray*)pUserSelectEvent! user provided function pointer event selection (TObjArray for parameters)
Bool_t (*)(HParticleCand*)pUserSelectHadrons! user provided function pointer to hadron selection
Bool_t (*)(HParticleCand*)pUserSelectLeptons! user provided function pointer to lepton selection
Particle::ESwitchsortType
HParticleTrackSortersorter

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

HParticleTree(const Text_t* name = "", const Text_t* title = "")
~HParticleTree()
closeOutput();
if (fTree)             delete fTree;
if (fCurrentEvent)     delete fCurrentEvent;
Bool_t init()
Int_t execute()
 create output:
 by
 1. set outputfilename       ( full name including path, dir or suffix not used)
 2. by hades output name     ( dir / file stem + suffix + _cyclecount.root)
 3. by datasource input name ( dir / file stem + suffix + _cyclecount.root)


Bool_t finalize()
void setEventStructure(Int_t n, Cat_t* PersistentCat, Bool_t fullCopy = kFALSE)
void setEvent()
 analyzes the current event of Hades and
 sets the own event structure arccording
 to the selected categories.
void setOutputFile(TString fname = "filter_tree.root", TString ftitle = "Filter", TString fopt = "RECREATE", Int_t fcomp = 2)
 fname = filename (including path)
 if this function is called the output filename
 will not be derived from Hades output (if exists)
 or the data input
Bool_t makeTree(void)
 Creates an output tree from the information in the event structure
 and according to the splitLevel (see setSplitLevel() )
void closeOutput()
 close the output file and write
 the Hades event structure
void recreateOutput(void)
 Create new output file in case a split file is
 needed. Takes care of the special Hades tree
 features
void extractMdcSeg(HParticleCand* cand, Bool_t isSim, Int_t segInd1, Int_t& segInd2)
 extract HMdcSeg. HMdcHit,HMdcCal1,HMdcClus,HMdcClusInf,
 HMdcClusFit,HMdcWireFit are extracted for this segment
 it enabled.
void extractMdcCal1(Bool_t isSim, Int_t segInd)
 extract all HMdcCal1 objects for a given HMdcSeg
void extractMdcCal1FromClus(Bool_t isSim, Int_t segInd)
 extract all HMdcCal1 objects for a given HMdcClus
Bool_t doFullCopy(Cat_t cat)
 returns kTRUE if the catgeory is set to full copy
 else or if the catgeory is not known kFALSE.
void setSkipEmptyEvents(Bool_t skip)
{ kSkipEmptyEvents = skip; }
void setSkipTracks(Bool_t skip)
{ kSkipTracks = skip; }
void setOutputFileSuffix(TString suff = "filter_tree")
void setOutputDir(TString dir = "")
{ fOutputDir = dir ;}
void setSortType(Particle::ESwitch type)
{ sortType = type; }
void setDoSorter(Bool_t sort)
{ kDoSorter=sort;}
sorter_setup& getSorterSetup()
{return sorter.getSetup();}
void setIgnoreRICH(Bool_t ignore = kTRUE)
{ sorter.getSetup().kIgnoreRICH = ignore;}
void setIgnoreInnerMDC(Bool_t ignore = kTRUE)
void setIgnoreOuterMDC(Bool_t ignore = kTRUE)
void setIgnoreMETA(Bool_t ignore = kTRUE)
{ sorter.getSetup().kIgnoreMETA = ignore;}
void setIgnorePreviousIndex(Bool_t ignore = kTRUE)
void setRICHMatching(Particle::ERichMatch match, Float_t window = 4.)
void setUserSelectionEvent(Bool_t (*)(TObjArray*) function, TObjArray* ar)
{ pUserSelectEvent = function; fParamSelectEvent = ar;}
void setUserSelectionLeptons(Bool_t (*)(HParticleCand*) function)
{ pUserSelectLeptons = function;}
void setUserSelectionHadrons(Bool_t (*)(HParticleCand*) function)
{ pUserSelectHadrons = function;}
void setUserkeepTrack(Bool_t (*)(HParticleCand*) function)
{ pUserKeepTrack = function;}