Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-07-16 08:12:45

0001 #include <iostream>
0002 #include <vector>
0003 #include <string>
0004 #include <cmath>
0005 
0006 #include <TFile.h>
0007 #include <TTree.h>
0008 #include <TStyle.h>
0009 #include <TH1F.h>
0010 #include <TH2F.h>
0011 #include <TNtuple.h>
0012 
0013 #include "INTT_Calo_Ana.h"
0014 #include "LoadData.h"
0015 #include "AnalyzeEvent.h"
0016 #include "EventDisplay.h"
0017 #include "INTT_Calo_trkReco.h"
0018 #include "INTT_Calo_trkUser.h"
0019 
0020 #include "LoadData.cpp"
0021 #include "AnalyzeEvent.cpp"
0022 #include "EventDisplay.cpp"
0023 #include "INTT_Calo_trkReco.cpp"
0024 #include "INTT_Calo_trkUser.cpp"
0025 
0026 
0027 void INTT_Calo_Ana(void) {
0028 
0029   cout <<"Welcome to INTT_Calo_Ana"<<endl;
0030   cout <<"This is analysis program of INTT_Calo nDST with event display!"<<endl;
0031 
0032   const int MaxLoop = 100;
0033 
0034   // open data file and load the data
0035   //input data file
0036   //  idatafile = "run2pp/53876/ana_53876_00001.root";
0037   //  idatafile = "../../2605/ana_53879_1kevt_4evtdisplay.root";
0038   //  idatafile = "53876_100evt/ana_53876_00000.root";
0039   //  idatafile = "53876_100evt/merge53876.root";
0040   //
0041   // current data. 10 files are merged
0042   //  idatafile = "run2pp_new/ana_53876_0000m.root";
0043   // simulaiton data
0044   // electron
0045   idatafile = "ana_electron/single_e_1M.root";
0046   // pi minus
0047   //idatafile = "ana_pionn/single_pionn_1M.root";
0048 
0049   cout << "Enter datafile to analyze" <<endl;
0050   cin >> idatafile;
0051 
0052   LoadData(idatafile);
0053   NmaxEvent = evtTree->GetEntries();  
0054   cout <<"# of events in the file:"<<NmaxEvent<<endl;
0055   
0056   cout << "Select Mode: " <<endl;
0057   cout << " 1: run AnalyzeEvent" << endl;
0058   cout << " 2: event display" <<endl;
0059   cin >> imode;
0060   if(imode == 1) {
0061     int istart = 0;
0062     int nevent=0;
0063     
0064     cout << "enter istart (first event)"<<endl;
0065     cin >> istart;
0066     if(istart<0) istart=0;
0067     
0068     cout << "how many event:"<<endl;
0069     cin >> nevent;
0070     if(nevent<0) nevent=0;
0071     if(istart+nevent > NmaxEvent) {
0072       cout <<" Exceeds the # of events in the file" <<endl;
0073       nevent = NmaxEvent - istart;
0074     }
0075     cout << "analyze "<< nevent << " events" <<endl;
0076 
0077     cout << "Enter name of the output ROOT file"<<endl;
0078     cin >> rootfile;
0079 
0080     AnalyzeInit();
0081     for(int i=istart;i<istart+nevent;i++) {
0082       i_event = i;
0083       GetEvent(i_event);
0084       AnalyzeEvent();
0085 
0086       if(i%1000 == 0) cout << i << endl;
0087     }//for
0088     AnalyzeEnd();
0089   } else if(imode == 2 ) { // Event Display
0090     gStyle->SetCanvasPreferGL();
0091     AnalyzeInit();
0092     for(int i=0;i<MaxLoop;i++) {
0093       EventSelection( i_event);
0094       if(i_event<0) break;
0095       GetEvent(i_event);
0096       AnalyzeEvent();  // do additional analysis
0097       EventDisplay(0);
0098       EventDisplay(1);
0099     }//for
0100   }//if
0101 }