Re: Script failing at unexpected point

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Mon, 16 Mar 2009 09:09:55 +0100


Hi,

apart from Rene's comment you probably also meant to call TH3F::Draw("X.TD1:X.GE1:X.PE1>>hTD1_GE1_PE1","gt1g1p1||pt1g1p1") i.e. the second parameter should probably be a string to make it valid C++ and to make sense.

Cheers, Axel.

Russell Leslie wrote:
> Greetings all,
>
> I am trying to do a basic sort of data that was collected from an
> experiment last week (I haven't had problems with related sorts in
> the last few months). The data collection system used four germanium
> detectors (GE 1 to 4), five silicon particle detectors (PE 1 to 5)
> and four time discriminator circuits (TD 1 to 4).
>
> My first task is to generate a series of cuts of coincidences between
> each GE, PE and TD (80 in all - 4x5x4). The first step is to just
> try the single case with GE1, PE1 and TD1. I can do a related manual
> sort using the treeviewer, but I need to be able to automate the
> process (for some 20 run files each which would need 80 cuts/sorts).
>
> The script example below gives the following error message ""Error:
> Can't call
> TH3F::Draw("X.TD1:X.GE1:X.PE1>>hTD1_GE1_PE1",gt1g1p1||pt1g1p1) in
> current scope sortRIV-T1G1P1.C:90:".
>
> I can't figure out why the script falls over at this point and unless
> I can get past this point I can't do the next important steps (doing
> corrections for random coincidences and compton background).
>
> Any guidance you can give on what I am doing wrong would be greatly
> appreciated.
>
> Regards
>
> Russell Leslie Nuclear Physics R.S.Phys.S.E. ANU
>
> {
> //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//
> //%%%%%%%%%%%%%% Original data file from the experiment in ROOT
> format %%%%%%%%%%%%%%%%%// TString fname="PD1060309_R05.root";
> TString tree_name="TREE"; //
> //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//
> //%%%%%%%%%%%%%%%%%%GERMANIUM
> DETECTORS%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%// Double_t GE1_min
> = 750; Double_t GE1_max = 1250; // Sensible energy range for GE1
> //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//
> //%%%%%%%%%%%%%%%%%%PARTICLE
> DETECTORS%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%// Double_t PE1_min
> = 300; Double_t PE1_max = 3300; // Sensible energy range for PE1
> //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//
> //%%%%%%%%% TDC limits for Random subtraction %%%%%%%%%%%%%%%%%%%//
> Double_t TD1_GE1_PE1_min = 3900; Double_t TD1_GE1_PE1_max = 4100; //
> Peak limits Double_t TD1_GE1_PE1_L1 = 3400; Double_t TD1_GE1_PE1_L2 =
> 3800; // Left background limits Double_t TD1_GE1_PE1_R1 = 4150;
> Double_t TD1_GE1_PE1_R2 = 4450; // Right background limits
> //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//
> //%%%%%%%%%%%%%%%% Total Gamma energy Cut %%%%%%%%%%%%%%%%%%%// TCut
> ra_GE1 = Form("X.GE1>%g && X.GE1<%g",GE1_min,GE1_max);
> //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//
> //%%%%%%%%%%%%%%%% Total Particle Cut %%%%%%%%%%%%%%%%%%%// TCut
> ra_PE1 = Form("X.PE1>%g && X.PE1<%g",PE1_min,PE1_max);
> //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//
> //%%%% Gamma/Particle TDC Cuts for Random Subtraction %%%%%%%// TCut
> t1g1p1 = Form("X.TD1_GE1_PE1>%g &&
> X.TD1_GE1_PE1<%g",TD1_GE1_PE1_min,TD1_GE1_PE1_max); //Block begin
> TCut t1g1p1L = Form("X.TD1_GE1_PE1>%g &&
> X.TD1_GE1_PE1<%g",TD1_GE1_PE1_L1,TD1_GE1_PE1_L2); TCut t1g1p1R =
> Form("X.TD1_GE1_PE1>%g &&
> X.TD1_GE1_PE1<%g",TD1_GE1_PE1_R1,TD1_GE1_PE1_R2);
> //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//
> //%%%%%%%%%%%%% Individual cuts for Gamma Detectors
> %%%%%%%%%%%%%%%%%%%%%%//
> //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//
> TCut gt1g1p1 = ra_GE1 && t1g1p1; TCut gt1g1p1L = ra_GE1 && t1g1p1L;
> TCut gt1g1p1R = ra_GE1 && t1g1p1R;
> //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//
> //%%%%%%%%%%%%% Individual cuts for Gamma Detectors
> %%%%%%%%%%%%%%%%%%%%%%// TCut pt1g1p1 = ra_PE1 && t1g1p1; TCut
> pt1g1p1L = ra_PE1 && t1g1p1L; TCut pt1g1p1R = ra_PE1 && t1g1p1R;
> //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//
> //%%%%%%%%%%%%% {Normalization Factor = (peak width in
> TDC)/(background width in TDC)}%%%%%%%%%%%%% //%%%% Top & Bottom
> %%%%%%%// Double_t nrt1g1p1 = ((TD1_GE1_PE1_max - TD1_GE1_PE1_min +1)
> / ((TD1_GE1_PE1_L2 - TD1_GE1_PE1_L1 +1) + (TD1_GE1_PE1_R2 -
> TD1_GE1_PE1_R1 +1))); //Begin block
> //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//
> //%%%%%%%%%%%%%%%% Sorted Matrices for TD1 GE1 PD1
> %%%%%%%%%%%%%%%%// TString fTD1_GE1_PE1 =
> "Mat_TD1_GE1_PE1_RIV_PD106_R05.root"; TString hTD1_GE1_PE1 =
> "hTD1_GE1_PE1"; //BEGIN BLOCK TString fTD1_GE1_PE1_TC =
> "Mat_TD1_GE1_PE1_RIV_PD106_TC_R05.root"; TString hTD1_GE1_PE1_TC =
> "hTD1_GE1_PE1_TC"; TString fTD1_GE1_PE1_C =
> "Mat_TD1_GE1_PE1_RIV_PD106_C_R05.root"; TString hTD1_GE1_PE1_C =
> "hTD1_GE1_PE1_C";
>
> //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//
> //&&&&&&&&&&&&&&&&&&&& FINAL DATA SORTING
> &&&&&&&&&&&&&&&&&&&&&&&&&&&&&//
> //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//
> //%%%%%%%%%%%%%%%%%%%%% TD1 GE1 PD1
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%// //
> //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//
> //%%%%%%%%%%%%%%%%%%%%% True + Chance %%%%%%%%%%%%%%%%%%%%%%%%%%%%//
> // TFile* f=TFile::Open( fname.Data(), "READ" ); TTree *TREE =
> (TTree*)f.Get("tree_name"); // TCanvas *C1 = new
> TCanvas("C1","Fitting canvas",10,10,400,200); C1->Divide(2,2); //
> C1->cd(1); TH3F *hTD1GE1PE1 = new
> TH3F("hTD1_GE1_PE1","",4096,10.5,4090,4096,10.5,4090,8192,10.5,8191.5);
> //
> hTD1GE1PE1->Draw("X.TD1:X.GE1:X.PE1>>hTD1_GE1_PE1",gt1g1p1||pt1g1p1);
> //Problem occurs here // hTD1GE1PE1->GetXaxis()->SetTitle("PE1");
> hTD1GE1PE1->GetYaxis()->SetTitle("GE1");
> hTD1GE1PE1->GetZaxis()->SetTitle("TD1"); // TFile* f_out=TFile::Open(
> fhTD1_GE1_PE1_TC.Data(), "RECREATE" );
> hTD1GE1PE1->SetName(hTD1_GE1_PE1_TC.Data()); f_out->cd();
> hTD1GE1PE1->Write(); f_out->Close(); // }
>
Received on Mon Mar 16 2009 - 09:08:22 CET

This archive was generated by hypermail 2.2.0 : Mon Mar 16 2009 - 11:50:01 CET