#define ciro_cxx // The class definition in ciro.h has been generated automatically // by the ROOT utility TTree::MakeSelector(). This class is derived // from the ROOT class TSelector. For more information on the TSelector // framework see $ROOTSYS/README/README.SELECTOR or the ROOT User Manual. // The following methods are defined in this file: // Begin(): called every time a loop on the tree starts, // a convenient place to create your histograms. // SlaveBegin(): called after Begin(), when on PROOF called only on the // slave servers. // Process(): called for each event, in this function you decide what // to read and fill your histograms. // SlaveTerminate: called at the end of the loop on the tree, when on PROOF // called only on the slave servers. // Terminate(): called at the end of the loop on the tree, // a convenient place to draw/fit your histograms. // // To use this file, try the following session on your Tree T: // // Root > T->Process("ciro.C") // Root > T->Process("ciro.C","some options") // Root > T->Process("ciro.C+") // #include "ciro.h" #include #include #include void ciro::Begin(TTree * /*tree*/) { // The Begin() function is called at the start of the query. // When running with PROOF Begin() is only called on the client. // The tree argument is deprecated (on PROOF 0 is passed). cout << " Begin " << endl; TString option = GetOption(); if (option.Contains("Book")) { EnergyLookUpTable = new TH3D("EnergyLUT","EnergyLUT",// DistanceBins,MinDistance,MaxDistance,// EccentricityBins,MinEccentricity,MaxEccentricity,// LogSizeBins,MinLogSize,MaxLogSize); DispLookUpTable = new TH3D("DispLUT","DispLUT",// DistanceBins,MinDistance,MaxDistance,// EccentricityBins,MinEccentricity,MaxEccentricity,// LogSizeBins,MinLogSize,MaxLogSize); ImpactParameterLookUpTable = new TH3D("ImpactParameterLUT","ImpactParameterLUT",// DistanceBins,MinDistance,MaxDistance,// EccentricityBins,MinEccentricity,MaxEccentricity,// LogSizeBins,MinLogSize,MaxLogSize); EnergyLookUpTable->Sumw2(); DispLookUpTable->Sumw2(); ImpactParameterLookUpTable->Sumw2(); EnergyEntries = (TH3D*)EnergyLookUpTable->Clone("EnergyEntries"); DispEntries = (TH3D*)DispLookUpTable->Clone("DispEntries"); ImpactParameterEntries = (TH3D*)ImpactParameterLookUpTable->Clone("ImpactParameterEntries"); } } void ciro::SlaveBegin(TTree * /*tree*/) { // The SlaveBegin() function is called after the Begin() function. // When running with PROOF SlaveBegin() is called on each slave server. // The tree argument is deprecated (on PROOF 0 is passed). TString option = GetOption(); } Bool_t ciro::Process(Long64_t entry) { // The Process() function is called for each entry in the tree (or possibly // keyed object in the case of PROOF) to be processed. The entry argument // specifies which entry in the currently loaded tree is to be processed. // It can be passed to either ciro::GetEntry() or TBranch::GetEntry() // to read either all or the required parts of the data. When processing // keyed objects with PROOF, the object is already loaded and is available // via the fObject pointer. // // This function should contain the "body" of the analysis. It can contain // simple or elaborate selection criteria, run algorithms on the data // of the event and typically fill histograms. // // The processing can be stopped by calling Abort(). // // Use fStatus to set the return value of TTree::Process(). // // The return value is currently not used. cout << " Process Entry " << entry << endl; TString option = GetOption(); if (! option.Contains("Fill")) return kFALSE; b_ntubes->GetEntry(entry); // cout << " Process Ntubes " << ntubes << endl; if (ntubes < 4) return kFALSE; b_size->GetEntry(entry); Double_t LogSize = TMath::Log10(size); if (LogSize < MinLogSize || LogSize > MaxLogSize) return kFALSE; b_dist->GetEntry(entry); b_width->GetEntry(entry); b_length->GetEntry(entry); if (width <= 0.0 || length <= 0.0) return kFALSE; cout << " Process Selected Entry " << entry << endl; b_alpha->GetEntry(entry); b_MCenergy->GetEntry(entry); Double_t ecc = width/length; // cout << " Process " << ecc << endl; EnergyLookUpTable->Fill(dist,ecc,LogSize,MCe0); EnergyEntries->Fill(dist,ecc,LogSize); Double_t Disp = dist * TMath::Cos(TMath::DegToRad()*alpha); DispLookUpTable->Fill(dist,ecc,LogSize,Disp); DispEntries->Fill(dist,ecc,LogSize); b_MCxcore->GetEntry(entry); b_MCycore->GetEntry(entry); Double_t X = MCxcore - TelX; Double_t Y = MCycore - TelY; b_MCxcos->GetEntry(entry); b_MCycos->GetEntry(entry); X *= MCxcos; Y *= MCycos; Double_t ImpactParameter = TMath::Sqrt(X*X + Y*Y); ImpactParameterLookUpTable->Fill(dist,ecc,LogSize,ImpactParameter); ImpactParameterEntries->Fill(dist,ecc,LogSize); return kTRUE; } void ciro::SlaveTerminate() { // The SlaveTerminate() function is called after all entries or objects // have been processed. When running with PROOF SlaveTerminate() is called // on each slave server. } void ciro::Terminate() { // The Terminate() function is the last function to be called during // a query. It always runs on the client, it can be used to present // the results graphically or save the results to file. cout << " Terminate " << endl; TString option = GetOption(); if (! option.Contains("Norm")) return; EnergyLookUpTable->Divide(EnergyEntries); DispLookUpTable->Divide(DispEntries); ImpactParameterLookUpTable->Divide(ImpactParameterEntries); }