////////////////////////////////////////////////////////// // This class has been automatically generated on // Mon Oct 29 10:21:47 2012 by ROOT version 5.26/00e // from TTree run28_1/run28-1 // found on file: trees.root ////////////////////////////////////////////////////////// #ifndef wedges_h #define wedges_h #include #include #include class wedges { public : TTree *fChain; //!pointer to the analyzed TTree or TChain Int_t fCurrent; //!current Tree number in a TChain // A second tree for saving analysis results TTree *fOutputTree; // Declaration of leaf types Int_t adcs_step; Float_t adcs_ts; Float_t adcs_xcm; Float_t adcs_InA; Float_t adcs_amp[4]; Float_t adcs_mean[4]; Float_t adcs_sigma[4]; // Extensions for holding analysis results Float_t exts_ampsub[4]; // amp with pedestals subtracted Float_t exts_ampcor[4]; // ampsub after correction for baseline shift Float_t exts_ampcur[4]; // ampcor after current normalization // List of branches TBranch *b_adcs; //! TBranch *b_exts; //! wedges(TTree *tree=0); virtual ~wedges(); virtual Int_t Cut(Long64_t entry); virtual Int_t GetEntry(Long64_t entry); virtual Long64_t LoadTree(Long64_t entry); virtual void Init(TTree *tree); virtual void Loop(); virtual Bool_t Notify(); virtual void Show(Long64_t entry = -1); }; #endif #ifdef wedges_cxx wedges::wedges(TTree *tree) { // if parameter tree is not specified (or zero), connect the file // used to generate this class and read the Tree. if (tree == 0) { TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("trees.root"); if (!f) { f = new TFile("trees.root"); } tree = (TTree*)gDirectory->Get("run28_1"); } Init(tree); } wedges::~wedges() { if (!fChain) return; //delete fChain->GetCurrentFile(); } Int_t wedges::GetEntry(Long64_t entry) { // Read contents of entry. if (!fChain) return 0; return fChain->GetEntry(entry); } Long64_t wedges::LoadTree(Long64_t entry) { // Set the environment to read one entry if (!fChain) return -5; Long64_t centry = fChain->LoadTree(entry); if (centry < 0) return centry; if (!fChain->InheritsFrom(TChain::Class())) return centry; TChain *chain = (TChain*)fChain; if (chain->GetTreeNumber() != fCurrent) { fCurrent = chain->GetTreeNumber(); Notify(); } return centry; } void wedges::Init(TTree *tree) { // The Init() function is called when the selector needs to initialize // a new tree or chain. Typically here the branch addresses and branch // pointers of the tree will be set. // 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). // Set branch addresses and branch pointers if (!tree) return; fChain = tree; fCurrent = -1; fChain->SetMakeClass(1); fChain->SetBranchAddress("adcs", &adcs_step, &b_adcs); // Make a new tree for writing with extensions std::string name = fChain->GetName(); std::string title = fChain->GetTitle(); name += "e"; fOutputTree = new TTree(name.c_str(),title.c_str()); fOutputTree->Branch("adcs", &adcs_step, "step/I:" "ts/F:" "xcm/F:" "InA/F:" "amp[4]/F:" "mean[4]/F:" "sigma[4]/F"); fOutputTree->Branch("exts", exts_ampsub, "ampsub[4]/F:" "ampcor[4]/F:" "ampcur[4]/F"); Notify(); } Bool_t wedges::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. return kTRUE; } void wedges::Show(Long64_t entry) { // Print contents of entry. // If entry is not specified, print current entry if (!fChain) return; fChain->Show(entry); } Int_t wedges::Cut(Long64_t entry) { // This function may be called from Loop. // returns 1 if entry is accepted. // returns -1 otherwise. return 1; } #endif // #ifdef wedges_cxx