#include "TSystem.h" #include "TROOT.h" #include "TFile.h" #include "TTree.h" #include "TH1D.h" #include #include "TCanvas.h" #include "TClassTable.h" #include /*This is extremely WEIRD. When I use gSystem->Load("libPmtTools.so"); and then .L readData.C++, it does not recognise event and hit classes, so it says they're not declared. Compilations fails. When I use: .x readData.C, */ using namespace std; void readData(){ Int_t number; if(!TClassTable::GetDict("event")){ number = gSystem->Load("/eth/ethraid5/home/dnarrias/data_Daniel-Thomas/photondet/trace/PMTSignalsAnalysiscam/analysisDataTrcFiles/libPmtTools.so"); } if(number == 0) printf("%d : libPmtTools.so successfully loaded\n", number); else printf("%d : libPmtTools.so has been already loaded before", number); // gROOT->ProcessLine(".L libPmtTools.so"); //Vb = -68.7V, -69V TFile *file_687 = new TFile("15NovVb687TrcFiles.root"); // TFile *file_69 = new TFile(("15NovVb69trcfiles.root"); TFile *output = new TFile("trcHists.root", "RECREATE"); file_687->cd(); TTree *T_687 = (TTree*)file_687->Get("tree"); // file_69->cd(); // TTree *T_69 = (TTree*)file->Get("tree"); output->cd(); event *event_687 = new event(); // event *event_69 = new event(); T_687->SetBranchAddress("ev", &event_687); // T_69->SetBranchAddress("ev", &event_69); //In the analysis, the pedestal (member of event class) is the average amplitude of the noise signal before the 1st signal (trigger on p.e. signal). As the 1st signal is a p.e. signal (not correlated noise as afterpulses, crosstalk, etc) -trigger is on a p.e. signal-, we'll first make a charge distribution considering these pulses: 1st hit of every event. The pedestal charge will be in that case: width of 1st hit x pedestal. hit *firstHit_687; // hit *firstHit_69; vector hits_687; // vector hits_69; //Relevent hit parameters int width; double ampl, charge, pedestal, pedestalCharge; /* OBS: I need to find out what the units of charge and amplitude are when read from the analysis. I think the situation is: - Entire time interval can be got with event->GetTime(); Thomas said time interval is 2us. */ TH1D *hcharge = new TH1D("hcharge", "Charge distribution - Vb = -68.7V - 15Nov", 1000, -2, 14); TH1D *hampl = new TH1D("hampl", "Amplitude distribution - Vb = -68.7V - 15Nov", 1000, -1, 3); Long64_t nentries = T_687->GetEntries(); cout << "Number of entries = " << nentries << endl; for(Long64_t i = 0; i < nentries; i++){ T_687->GetEntry(i); hits_687 = event_687->getHits(); firstHit_687 = &hits_687.at(0); charge = firstHit_687->getIntegral(); //printf("%d\n", charge); ampl = firstHit_687->getMaximum(); width = firstHit_687->getWidth(); pedestal = event_687->getPedestal(); //Pedestal of event instance: average amplitude of noise signal before first hit pedestalCharge = pedestal*((double)width); //Possible charge is in 10⁻¹⁰ Vs units. It must be multiply by 10¹⁰ and just express it in [10⁻¹⁰ Vs] units //charge = charge*pow(10,10); cout << i << " Charge = " << charge << ", Amplitude = " << ampl << endl; hcharge->Fill(pedestalCharge); hcharge->Fill(charge); hampl->Fill(pedestal); hampl->Fill(ampl); hits_687.clear(); } //Now I'll plot the histograms. After seeing them, we can define proper axes limits, axes names, etc. /* TCanvas *c1 = new TCanvas("c1", "Charge distribution - 15Nov", 800, 600); c1->cd(); gPad->SetLogy(); hcharge->Draw(); c1->Update(); c1->Write(); TCanvas *c2 = new TCanvas("c2", "Amplitude distribution - 15Nov", 800, 600); c2->cd(); gPad->SetLogy(); hampl->Draw(); c2->Update(); c2->Write(); */ output->Write(); file_687->Close(); output->Close(); }