File indexing completed on 2025-08-05 08:15:08
0001
0002
0003 #include "TString.h"
0004 #include "TFile.h"
0005 #include "TSystem.h"
0006 #include "TTree.h"
0007 #include "TH1F.h"
0008 #include "TH3I.h"
0009 #include "TCanvas.h"
0010 #include "TNtuple.h"
0011 #include <iostream>
0012
0013
0014 void Ana( TNtuple*, TNtuple*, TNtuple*, char[2], int, double tot[24], double dead[24], int );
0015
0016 void SectorMap_Display( )
0017 {
0018
0019 char name[100];
0020 int run_num;
0021
0022 cout << "Input run number: ";
0023 cin >> run_num;
0024
0025
0026
0027 const char* run_str[24] = { "00", "01", "02", "03" ,"04", "05", "06", "07", "08", "09", "10" , "11", "12" , "13" , "14", "15" , "16" , "17", "18" , "19", "20", "21" , "22", "23" };
0028 double tot[24] = {0};
0029 double dead[24] = {0};
0030
0031 double tot_ult[24]={0};
0032 double dead_ult[24]={0};
0033
0034 sprintf(name, "pedestal-%d-outfile.root", run_num);
0035
0036
0037 TFile h_outfile10305(name, "RECREATE");
0038 TNtuple *h_Alive=new TNtuple("h_Alive","Location Tntuple Cuts","chan_id:fee_id:module_id:pedMean:pedStdi:sec_id");
0039 TNtuple *h_AliveTot=new TNtuple("h_AliveTot","Location Tntuple No Cuts","chan_id:fee_id:module_id:pedMean:pedStdi:sec_id");
0040 TNtuple *h_AliveNoise=new TNtuple("h_AliveNoise","Location Tntuple Cuts","chan_id:fee_id:module_id:pedMean:pedStdi:sec_id:noise");
0041
0042 for( int i = 0; i < 24; i++ )
0043 {
0044 char run[2];
0045 std::sprintf(run,run_str[i]);
0046
0047 Ana( h_Alive, h_AliveTot,h_AliveNoise, run, run_num, tot, dead, i);
0048
0049 tot_ult[i] += tot[i];
0050 dead_ult[i] += dead[i];
0051 }
0052
0053 h_outfile10305.cd();
0054 h_Alive->Write();
0055 h_AliveTot->Write();
0056 h_outfile10305.Close();
0057
0058 }
0059
0060
0061
0062 void Ana(TNtuple *Alive, TNtuple *AliveTot, TNtuple *AliveNoise, char run[2] = "11", int runNumber = 00000, double tot[24]={0}, double dead[24]={0}, int j = 0)
0063 {
0064
0065
0066 const TString filename2( Form( "/sphenix/u/llegnosky/Livechan_Pedestals_Noise/run_%d/outputfile_TPC_ebdc%s_pedestal-000%d.root", runNumber,run,runNumber) );
0067
0068 TFile* infile2 = TFile::Open(filename2);
0069
0070 if(!infile2) return;
0071
0072 TTree *treesd;
0073 treesd = (TTree*) infile2->Get("outputTree");
0074
0075 Int_t isAlive, chan, fee, module, slot;
0076 Float_t pedMean, pedStdi;
0077
0078 treesd->SetBranchAddress("isAlive",&isAlive);
0079 treesd->SetBranchAddress("chan",&chan);
0080 treesd->SetBranchAddress("fee",&fee);
0081 treesd->SetBranchAddress("module",&module);
0082 treesd->SetBranchAddress("slot", &slot);
0083 treesd->SetBranchAddress("pedMean",&pedMean);
0084 treesd->SetBranchAddress("pedStdi",&pedStdi);
0085
0086 std::cout << "sector = "<< run <<std::endl;
0087
0088 UInt_t nEntries = treesd->GetEntries();
0089 std::string fs(run);
0090 float sec = std::stof(fs);
0091
0092 std::cout << "sector from char = " << sec << std::endl;
0093
0094
0095 for (int i=0;i<nEntries;i++){
0096 treesd->GetEntry(i);
0097
0098 double pedestal = pedMean;
0099 double noise = pedStdi;
0100
0101 AliveTot->Fill(1.0*chan,1.0*fee,1.0*module,pedMean,pedStdi,1.0*sec);
0102
0103 if (isAlive == 1){
0104 Alive->Fill(1.0*chan,1.0*fee,1.0*module,pedMean, pedStdi, 1.0*sec);
0105 }
0106 }
0107 }