#include #include #include #include #include #include #include #include #include "analysis.h" #include #include "decoding.h" using namespace std; char input[200]; // Develop all functions TChain *read_pedestal_XY(Int_t startrun, Int_t endrun, Int_t check_MS, Char_t *inputdir) { // cout << inputdir <Get("DataTree"); if(!temp) { ftemp->Close(); cout << "Segment " << k << " of run " << i << " is not present " << endl; continue; } ch->Add(input,0); cout << "Added segment " << k << " of run " << i << endl; } } return ch; } Double_t **pedestal_calc(char* inputdir,char* outputdir,int pederun, int check_max_subrun, Option_t *direction) { cout << " HELLO bis" << endl; Double_t **pedestal_value = new Double_t*[32]; for(int i=0;i *q_p; // Create a vector to contain the 32 signals for each one of the 32 strips vector *sat_p; // Create a vector to contain the 32 indexes saying, for each of the 32 strips, if the signal is saturated TBranch *charge_p = 0; // Create pointers to the branches of the TTree TBranch *saturation_p = 0; TBranch *card_p = 0; TBranch *time_p = 0; t_p->SetBranchAddress("time",&time_ns_p); // Get the branches t_p->SetBranchAddress("card",&card_nb_p); t_p->SetBranchAddress("Q", &q_p, &charge_p); t_p->SetBranchAddress("S", &sat_p, &saturation_p); // The next operation is performed just to set the single channel histogram range and binning; int nEntries_p=t_p->GetEntries(); double temp_mean_card1 = 0; double temp_mean_card2 = 0; double flag_card1 = 0; double flag_card2 = 0; /* for (Int_t i = 0; i < nEntries_p; i++) { // This loop is used to read the TTree data and fill the histograms. t_p->GetEntry(i); //cout << "time " << time_ns_p << endl; //cout << "card_nb " << card_nb_p << endl; Long64_t tentry_p = t_p->LoadTree(i); charge_p->GetEntry(tentry_p); saturation_p->GetEntry(tentry_p); //for (UInt_t j = 0; j < q->size(); ++j) { // printf("%lf %d \n", q->at(j) , sat->at(j));} if(card_nb_p==1) { for (UInt_t j = 0; j < q_p->size(); ++j) { cout << q_p->at(j) << endl; } } if(card_nb_p==2) { for (UInt_t j = 0; j < q_p->size(); ++j) { cout << q_p->at(j) << endl; } } } */ Int_t ii = 0; while(flag_card1==0 ||flag_card2 ==0) { if(ii>=nEntries_p) {cout << "You have data only from one card or no card at all " << endl; exit(0);} if(iiGetEntry(ii); Long64_t tentry_p = t_p->LoadTree(ii); charge_p->GetEntry(tentry_p); saturation_p->GetEntry(tentry_p); /* if(card_nb_p==1 && flag_card1==0 ) { flag_card1 = 1; for (UInt_t j = 0; j < q_p->size(); ++j) { temp_mean_card1 += q_p->at(j); } } if(card_nb_p==2 && flag_card2==0) { flag_card2 = 1; for (UInt_t j = 0; j < q_p->size(); ++j) { temp_mean_card2+=q_p->at(j); } } */ ii++;} } /* cout << temp_mean_card1/XYSTRIPS << endl; cout << temp_mean_card2/XYSTRIPS << endl; *//* TFile *fpede = new TFile(TString::Format("%spedestal_histo_%s_run%d.root",outputdir, direction, pederun),"RECREATE"); TH1F *pedestal_histo[XYSTRIPS]; int nbins = sqrt(nEntries_p/2)/2; for(Int_t i=0; iGetXaxis()->SetTitle("Q (pC)"); pedestal_histo[i]->GetYaxis()->SetTitle("Occurrence"); for(int j=1;j<=nbins;j++) pedestal_histo[i]->SetBinContent(j,0); } */ /* for(Int_t i=0; iGetEntry(i); for (int j=0;jsize(); ++j) pedestal_histo[j]->Fill(data_tree_p.q_p->at(j));} if (strcmp(direction,"Y")==0) {if(data_tree_p.card_nb_p==2) for (UInt_t j = 0; j < data_tree_p.q_p->size(); ++j) pedestal_histo[j]->Fill(data_tree_p.q_p->at(j));}} } */ //t_p->ResetBranchAddresses(); /* delete t_p; for(Int_t i=0; iWrite(); for(Int_t i=0; iGetMean()-20,pedestal_histo[i]->GetMean()+20); pedestal_histo[i]->Fit("ffit","RQ0+"); Float_t p_mean = ffit->GetParameter(1); Float_t p_errmean = ffit->GetParError(1); Float_t p_sigma = ffit->GetParameter(2); Float_t p_errsigma = ffit->GetParError(2); pedestal_value[i][0]=p_mean; pedestal_value[i][1]=p_errmean; pedestal_value[i][2]=p_sigma; pedestal_value[i][3]=p_errsigma; } // cout << pedestal_value[0][0] << " " << pedestal_value[0][1] << " " << pedestal_value[0][2] << " " << pedestal_value[0][3]<Close(); for(Int_t i=0; i