#include #include #include #include #include #include #include #include #include #include #include const int NPaddles = 6; const int NPMTs = 2; const int NHits = 3; /* to run: root -b .L AnalyzeCutDown.C++ Analyze("pathToHistoFile") */ void GetHitHistos(TH1D *HitHistos[NPaddles][NHits], TFile *file, int Wall, int Tube); void GetCounterHistos(TH1D *CounterHistos[NPaddles][NPMTs], TFile *file, int Wall); // ANALYSIS FUNCTION ======================================================== void Analyze(char * InputHisto) { TFile *file = new TFile(InputHisto); if(file == NULL){ printf("Bad File! \n"); return; } // make output .txt data table FILE * data_table = fopen("AfterPulsingAnalysis.txt", "w"); // get histos from file TH1D *hHitsWall1Tube1[NPaddles][NHits]; TH1D *hCountersWall1[NPaddles][NPMTs]; GetHitHistos(hHitsWall1Tube1, file, 1, 1); GetCounterHistos(hCountersWall1, file, 1); // PRINT ANALYSIS TO .txt FILE printf("Creating txt file!"); fprintf(data_table, "AFTERPULSING ANALYSIS \n\n"); fprintf(data_table, "%% X AP = percent of events with at least X afterpulses \n\n"); fprintf(data_table, "Wall \t Paddle \t PMT \t %% 1 AP \t %% 2 AP \t %% 3 AP \n"); // WALL 1 WEST PMTs (1) for(int pad=0; padGetEntries(); double delta_times[3]; double percents[3]; for(int hit=0; hitIntegral(0,100); percents[hit] = (delta_times[hit] / total_evts)*100.0; } //Hit loop fprintf(data_table, "1 \t %d \t 1 \t %f \t %f \t %f", pad+1, percents[0], percents[1], percents[2]); } //Paddle loop } //end of Analyze // GET HIT HISTOS FUNCTION ================================================= void GetHitHistos(TH1D *HitHistos[NPaddles][NHits], TFile *file, int Wall, int Tube){ char HitHistoName[100]; for(int pad=0; padGet(HitHistoName); if(HitHistos[pad][hit] == NULL){ printf("Bad histo! \n"); continue; } } //Hit loop } //Paddle loop } // GetHistos // GET COUNTER HISTOS FUNCTION ============================================ void GetCounterHistos(TH1D *CounterHistos[NPaddles][NPMTs], TFile *file, int Wall){ char CounterHistoName[100]; for(int pad=0; padGet(CounterHistoName); if(CounterHistos[pad][pmt] == NULL){ printf("Bad histo! \n"); continue; } } //PMT loop } //Paddle loop } //GetCounterHistos