Clover Addback Ready

This commit is contained in:
Peter DeRosa 2022-10-17 16:08:50 -04:00
parent 5b2957414a
commit 2298146873
5 changed files with 322 additions and 0 deletions

133
Analyzer.C Normal file
View File

@ -0,0 +1,133 @@
#define Analyzer_cxx
// The class definition in Analyzer.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("Analyzer.C")
// root> T->Process("Analyzer.C","some options")
// root> T->Process("Analyzer.C+")
//
#include "Analyzer.h"
#include <TH2.h>
#include <TStyle.h>
TH1F * hEnergy[64];
TH1F * hAddback[16];
void Analyzer::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).
TString option = GetOption();
for( int i = 0; i < 64; i++){
hEnergy[i] = new TH1F(Form("hE%02d", i), Form("hE%02d", i), 4000, 0, 4000);
if( i < 16 ){
hAddback[i] = new TH1F(Form("AE%02d",i), Form("AE%02d",i), 4000,0,4000);
}
}
}
void Analyzer::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 Analyzer::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 Analyzer::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.
b_energy->GetEntry(entry);
double addback[16] ={0};
for(int i =0; i < 64; i++){
if((*energy)[i] <= 0.) { continue ; }
/// printf("%2d, %f \n", i, (*energy)[i]);
hEnergy[i]->Fill((*energy)[i]);
int iclover = i/4;
addback[iclover] += (*energy)[i];
// if( entry < 10 ) printf("%d , %f, %d, %f \n", i, (*energy)[i], iclover, addback[iclover]);
}
for( int i = 0; i < 16; i++){
if(addback[i] <= 0.){continue;}
hAddback[i]->Fill(addback[i]);
// if( entry < 10 ) printf("=--==%d, %f \n", i, addback[i]);
}
return kTRUE;
}
void Analyzer::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 Analyzer::Terminate()
{
TFile * out = new TFile("CloverAddback.root","recreate");
out->cd();
for(int j = 0; j< 64; j++){
hEnergy[j]->Write();
}
for(int k = 0; k< 16; k++){
hAddback[k]->Write();
}
out->Close();
// 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.
hAddback[14]->Draw();
}

100
Analyzer.h Normal file
View File

@ -0,0 +1,100 @@
//////////////////////////////////////////////////////////
// This class has been automatically generated on
// Mon Oct 17 14:56:21 2022 by ROOT version 6.26/06
// from TTree Clover/Edep and TrackL
// found on file: AllCrystal_Co60.root
//////////////////////////////////////////////////////////
#ifndef Analyzer_h
#define Analyzer_h
#include <TROOT.h>
#include <TChain.h>
#include <TFile.h>
#include <TSelector.h>
// Header file for the classes stored in the TTree if any.
#include "vector"
class Analyzer : public TSelector {
public :
TTree *fChain; //!pointer to the analyzed TTree or TChain
// Fixed size dimensions of array or collections stored in the TTree if any.
// Declaration of leaf types
Int_t nTraj;
vector<double> *energy;
vector<double> *stepLength;
Double_t bEnergy;
Double_t theta;
Double_t phi;
// List of branches
TBranch *b_nTraj; //!
TBranch *b_energy; //!
TBranch *b_stepLength; //!
TBranch *b_bEnergy; //!
TBranch *b_theta; //!
TBranch *b_phi; //!
Analyzer(TTree * /*tree*/ =0) : fChain(0) { }
virtual ~Analyzer() { }
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(Analyzer,0);
};
#endif
#ifdef Analyzer_cxx
void Analyzer::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 object pointer
energy = 0;
stepLength = 0;
// Set branch addresses and branch pointers
if (!tree) return;
fChain = tree;
fChain->SetMakeClass(1);
fChain->SetBranchAddress("nTraj", &nTraj, &b_nTraj);
fChain->SetBranchAddress("energy", &energy, &b_energy);
fChain->SetBranchAddress("stepLength", &stepLength, &b_stepLength);
fChain->SetBranchAddress("bEnergy", &bEnergy, &b_bEnergy);
fChain->SetBranchAddress("theta", &theta, &b_theta);
fChain->SetBranchAddress("phi", &phi, &b_phi);
}
Bool_t Analyzer::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;
}
#endif // #ifdef Analyzer_cxx

89
Analyzer_C.d Normal file
View File

@ -0,0 +1,89 @@
# DO NOT DELETE
./Analyzer_C.so: Analyzer.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TROOT.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TDirectory.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TNamed.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TObject.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/Rtypes.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/RtypesCore.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/RConfig.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/RVersion.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/RConfigure.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/DllImport.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/strtok.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/strlcpy.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/snprintf.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TGenericClassInfo.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TSchemaHelper.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TIsAProxy.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TVirtualIsAProxy.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TStorage.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TVersionCheck.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/RVersion.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TString.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TMathBase.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/RStringView.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/TypeTraits.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TClass.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TDictionary.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ESTLType.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TObjArray.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TSeqCollection.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TCollection.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TIterator.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TVirtualRWMutex.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TVirtualMutex.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/RRangeCast.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/RSpan.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/span.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TUUID.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TList.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TBuffer.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TDataType.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/Bytes.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/Byteswap.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TChain.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TTree.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/Compression.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/TIOFeatures.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TArrayD.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TArray.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TArrayI.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TAttFill.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TAttLine.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TAttMarker.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TVirtualTreePlayer.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TBranch.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TBranchCacheInfo.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TBits.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TFile.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TDirectoryFile.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TDatime.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TUrl.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/RConcurrentHashColl.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/TRWSpinLock.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/TSpinMutex.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TSelector.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TSelectorList.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/THashList.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TH2.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TH1.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TAxis.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TAttAxis.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TArrayC.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TArrayS.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TArrayF.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/Foption.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/EExecutionPolicy.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TVectorFfwd.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TVectorDfwd.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TFitResultPtr.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TMatrixFBasefwd.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TMatrixDBasefwd.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TStyle.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TAttText.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TColor.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/RVersion.h /usr/local/Cellar/root/6.26.06_1/include/root/RConfig.h /usr/local/Cellar/root/6.26.06_1/include/root/TClass.h /usr/local/Cellar/root/6.26.06_1/include/root/TDictAttributeMap.h /usr/local/Cellar/root/6.26.06_1/include/root/TInterpreter.h /usr/local/Cellar/root/6.26.06_1/include/root/TROOT.h /usr/local/Cellar/root/6.26.06_1/include/root/TBuffer.h /usr/local/Cellar/root/6.26.06_1/include/root/TMemberInspector.h /usr/local/Cellar/root/6.26.06_1/include/root/TError.h /usr/local/Cellar/root/6.26.06_1/include/root/RtypesImp.h /usr/local/Cellar/root/6.26.06_1/include/root/TIsAProxy.h /usr/local/Cellar/root/6.26.06_1/include/root/TFileMergeInfo.h /usr/local/Cellar/root/6.26.06_1/include/root/TCollectionProxyInfo.h /usr/local/bin/rootcling
Analyzer_C__ROOTBUILDVERSION= 6.26/06

BIN
Analyzer_C.so Executable file

Binary file not shown.

Binary file not shown.