////////////////////////////////////////////////////////// // This class has been automatically generated on // Tue Oct 24 17:31:36 2017 by ROOT version 6.08/04 // from TChain / ////////////////////////////////////////////////////////// #ifndef SelSensitivity_h #define SelSensitivity_h #include #include #include #include #include #include #include #include #include #include #include // Headers needed by this particular selector //#include "MSimIOCorsika.h" #include "MSimRT.h" #include "MSimCameraLayout.h" #include "MSimElectronicsConfig.h" #include "MSimPatternTrigger.h" #include "MSimImageAnalyser.h" #include "MSimAux.h" class SelSensitivity : public TSelector { public : TTreeReader fReader; //!the tree reader TTree *fChain ; //!pointer to the analyzed TTree or TChain // Readers to access the parameters. TTreeReaderValue **fParameters ; TTreeReaderValue *fSize ; TTreeReaderValue *fTriggerStatus ; TTreeReaderValue fEnergy = {fReader,"ShowerHead.energy"} ; TTreeReaderValue fCoreDist = {fReader,"ShowerHead.coredist"} ; TTreeReaderValue fViewCone = {fReader,"ShowerHead.viewcone"} ; // MCuts to apply cuts MCuts **mcuts ; Float_t fSizeCut ; Int_t fNvars ; // number of total (dependent +independent) variables to be read Int_t fNcuts ; // number of cuts Bool_t readervalueinitiated ; // TParameter *dummy_sens = 0 ; TH1F *hist = 0 ; TH1F *histT = 0 ; TH2F *histLVsS = 0 ; SelSensitivity(TTree * /*tree*/ = 0) ; virtual ~SelSensitivity() ; virtual Int_t Version() const { return 2; } virtual void Begin(TTree *tree); virtual void SlaveBegin(TTree *tree); virtual void Init(TTree *tree); virtual Bool_t Notify(); virtual Bool_t Process(Long64_t entry); virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0) { return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0; } virtual void SetOption(const char *option) { fOption = option; } virtual void SetObject(TObject *obj) { fObject = obj; } virtual void SetInputList(TList *input) { fInput = input; } virtual TList *GetOutputList() const { return fOutput; } virtual void SlaveTerminate(); virtual void Terminate(); ClassDef(SelSensitivity,0); }; #endif #ifdef SelSensitivity_cxx void SelSensitivity::Init(TTree *tree) { // The Init() function is called when the selector needs to initialize // a new tree or chain. Typically here the reader is initialized. // It is normally not necessary to make changes to the generated // code, but the routine can be extended by the user if needed. // Init() will be called many times when running on PROOF // (once per file to be processed). fReader.SetTree(tree); if(!readervalueinitiated) { TParameter *fInSize = dynamic_cast *>(fInput -> FindObject("CURRENT_SIZE_CUT")) ; if(fInSize) { fSizeCut = fInSize -> GetVal() ; Info("Init","Setting size cut = %f\n",fSizeCut) ; } else { fSizeCut = 0.0 ; Warning("SlaveBegin","No size cut found\nSetting it to 0.0\n") ; } fSize = new TTreeReaderValue(fReader,"HillasPars.Size") ; TNamed *nm = dynamic_cast(fInput -> FindObject("CURRENT_TRIGGER_CONF")) ; if(nm) { TString str = TString::Format("TriggerStatus.status_%s",nm->GetTitle()) ; fTriggerStatus = new TTreeReaderValue(fReader,str.Data()) ; Info("Init","Trigger configuration = %s\n",nm -> GetTitle()) ; } else { Error("SlaveBegin","No trigger configuration found\n") ; Abort("Can't proceed\n") ; } TList *listofcuts = dynamic_cast (fInput -> FindObject("CutsList")) ; if(listofcuts) { fNcuts = listofcuts -> GetSize() ; Info("Init","Number of cuts = %d\n",fNcuts) ; mcuts = new MCuts*[fNcuts] ; fNvars = 0 ; TIter next1(listofcuts) ; Int_t i = 0 ; MCuts *mcut ; while ( (mcut = (MCuts*)next1()) ) { Info("Init","%s : Variable = %s and Independent Variable = %s\n",mcut -> GetName(), mcut -> GetParamName().Data(), mcut -> GetIndVar().Data() ) ; mcuts[i] = mcut ; // Info("Init","%s : Variable = %s and Independent Variable = %s\n",mcuts[i] -> GetName(), // mcuts[i] -> GetParamName().Data(), mcuts[i] -> GetIndVar().Data() ) ; ++i ; ++fNvars ; if(!((mcut -> GetIndVar()).EqualTo("-"))) ++fNvars ; } Info("SelSensitivity :: Init","Number of variables = %d\n",fNvars) ; fParameters = new TTreeReaderValue*[fNvars] ; TIter next2(listofcuts) ; i = 0 ; while (( mcut = (MCuts*)next2() )) { fParameters[i] = new TTreeReaderValue(fReader,(mcut -> GetParamName()).Data()) ; ++i ; if(!((mcut -> GetIndVar()).EqualTo("-"))) { fParameters[i] = new TTreeReaderValue(fReader,(mcut -> GetIndVar()).Data()) ; ++i ; } } readervalueinitiated = true ; } else { Error("SlaveBegin","No cuts list found\n") ; Abort("Can't proceed without cuts list\n") ; } } } Bool_t SelSensitivity::Notify() { // The Notify() function is called when a new file is opened. This // can be either for a new TTree in a TChain or when when a new TTree // is started when using PROOF. It is normally not necessary to make changes // to the generated code, but the routine can be extended by the // user if needed. The return value is currently not used. /* TTree *currentTree = fReader.GetTree()->GetTree() ; * Info("Notify","File %s\n",currentTree -> GetCurrentFile() -> GetName()) ; * MCskRunHeader *CskRunHead = (MCskRunHeader*)currentTree -> GetUserInfo() -> FindObject("RUNHEADER") ; * CskRunHead -> SetDataType("FOCAL") ; * CskRunHead -> Dump() ; */ return kTRUE; } #endif // #ifdef SelSensitivity_h