// This class has been written for the Mixed Event Analysis // It helps in analyzing the AOD from RKDSTMaker.C // Written from the Mean pt paper ////////////////////////////////////////////////////////// #ifndef PtCorr_mix_h #define PtCorr_mix_h #include #include #include #include #include class PtCorr_mix { public : TTree *fChain; //!pointer to the analyzed TTree or TChain Int_t fCurrent; //!current Tree number in a TChain TFile *fpw; // Root file pointer TTree *tree; // Tree Defined // Declaration of leaf types static const Int_t kTr = 8000; Float_t fPx[kTr]; Float_t fPy[kTr]; Float_t fPz[kTr]; Float_t fCharge[kTr]; Int_t fRefMult; Int_t fRefMult3; Int_t fNtrack; Int_t tcounttracks; Float_t tmpt; Int_t tcent; Float_t tmptmix; PtCorr_mix(TTree *tree=0); virtual ~PtCorr_mix(); 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 PtCorr_mix_cxx PtCorr_mix::PtCorr_mix(TTree *tree){ if (tree == 0) { TChain *chain = new TChain("Spectra"," "); ifstream is("file.list"); if(!is) //if the pointer is is null { Printf(" Give the input file"); return; } Char_t buf[4096]; while(!is.eof()) // while the pointer is does not reach end of file { is.getline(buf, 4096); if (is.eof()) break; // cout << buf << endl; chain->Add(buf); } is.close(); // cout << tree->GetEntries() << endl; //chain->Add("/star/data03/scratch/rutikmani/AvgPt/Momentum_AOD_8CFBC7B642C2AC058CF79336FE1D3A83_0.root"); //chain->Add("./Momentum_AOD.root"); tree = chain; } Init(tree); } PtCorr_mix::~PtCorr_mix() { if (!fChain) return; delete fChain->GetCurrentFile(); } Int_t PtCorr_mix::GetEntry(Long64_t entry) { // Read contents of entry. if (!fChain) return 0; return fChain->GetEntry(entry); } Long64_t PtCorr_mix::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 PtCorr_mix::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("fNtrack", &fNtrack); //Attaches our new variables to the branches. fChain->SetBranchAddress("fPx", fPx); fChain->SetBranchAddress("fPy", fPy); fChain->SetBranchAddress("fPz", fPz); fChain->SetBranchAddress("fRefMult", &fRefMult); fChain->SetBranchAddress("fCharge",fCharge); Notify(); } Bool_t PtCorr_mix::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 PtCorr_mix::Show(Long64_t entry) { // Print contents of entry. // If entry is not specified, print current entry if (!fChain) return; fChain->Show(entry); } Int_t PtCorr_mix::Cut(Long64_t entry) { // This function may be called from Loop. // returns 1 if entry is accepted. // returns -1 otherwise. return 1; } #endif // #ifdef PtCorr_mix_cxx