From: Benjamin Linnik Date: Tue, 3 Dec 2013 16:25:10 +0000 (+0100) Subject: ChargeSpectrum: bugfix: changed tupel to tree structure in energyspectra calculation X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=073e128531283d2a80ad51b8bbd100942897b9fc;p=radhard.git ChargeSpectrum: bugfix: changed tupel to tree structure in energyspectra calculation --- diff --git a/newCOMBI/ChargeSpektrum.c b/newCOMBI/ChargeSpektrum.c index e214027..001eba4 100755 --- a/newCOMBI/ChargeSpektrum.c +++ b/newCOMBI/ChargeSpektrum.c @@ -40,7 +40,7 @@ #define FIT_FUNC "gaus" #define DRAW_FITS true -#define DATAPATH "/d/salt/data_recovered/maps/DennisDoering/root/Analysedata/" +#define DATAPATH "/d/salt/data_recovered/maps/Benny/Mimosa34_Analyse/" struct laborbook { Int_t inputRun; @@ -92,7 +92,7 @@ void ChargeSpektrum() noiseHisto[lauf]=Noise(runList[lauf]); arrayHisto[lauf]=GenerateHisto(runList[lauf]); } - + Double_t w = 600; Double_t h = 600; TCanvas * c1 = new TCanvas("c", "c", w, h); @@ -156,7 +156,7 @@ struct histogram GenerateHisto(Int_t inputRun) // Read Laborbook, save it in the struct laborbookdata struct laborbook laborbookdata; laborbookdata=LaborBuchSQL(inputRun); - +// cout<<"TEST2 Run:"<Get("hit"); +// TNtuple* hitNtuple = (TNtuple*) f->Get("hit"); //TNtuple* hitsNtuple = (TNtuple*) f->Get("hits"); // one array element and one branch for each pixel - Float_t pixel[NUMPIXELS]; - TBranch* pixelBranch[NUMPIXELS]; - for (Int_t cnt=0; cntSetBranchAddress(Form("p%i",cnt+1), &pixel[cnt], &pixelBranch[cnt]); - } - UInt_t frame; - TBranch* frameBranch; - hitNtuple->SetBranchAddress("frame", &frame, &frameBranch); - UInt_t seedPixel; - TBranch* seedPixelBranch; - hitNtuple->SetBranchAddress("pixel", &seedPixel, &seedPixelBranch); +// Float_t pixel[NUMPIXELS]; + + + + +// TBranch* pixelBranch[NUMPIXELS]; +// for (Int_t cnt=0; cntSetBranchAddress(Form("p%i",cnt+1), &pixel[cnt], &pixelBranch[cnt]); +// } +// UInt_t frame; +// TBranch* frameBranch; +// hitNtuple->SetBranchAddress("frame", &frame, &frameBranch); +// UInt_t seedPixel; +// TBranch* seedPixelBranch; +// hitNtuple->SetBranchAddress("pixel", &seedPixel, &seedPixelBranch); + + TTree* hitNtuple = (TTree*) f->Get("hit"); + + UInt_t frame; + UInt_t hits; + UInt_t seedPixel[10000]; + Float_t pixel[25][10000]; + + + + hitNtuple->SetBranchAddress ("frame" , &frame); + hitNtuple->SetBranchAddress ("hits" , &hits); + hitNtuple->SetBranchAddress ("pixel" , seedPixel ); +// hitNtuple->SetBranchAddress ( "p13" , pixel ); + + + + for(int i=0;i<25;i++) { hitNtuple->SetBranchAddress( Form("p%i",i+1) , &pixel[i][0] ); } + + // fHitTree = new TTree("hit", "hit"); + + // fHitTree->SetBranchAddress("frame" , &fFrameInfo.frame ); + // fHitTree->SetBranchAddress("hits" , &fFrameInfo.hits ); + // fHitTree->SetBranchAddress("pixel" , &fFrameInfo.pixel[0] ); + // loop over all hits to fill histogram Int_t nentries = hitNtuple->GetEntries(); - +// cout<<"TEST4 Run:"<GetEntry(cnt); - // take only frames with a maximum of one hit - // hitsNtuple->GetEntry((Int_t) frame); - // if (frameCounts > 1) - // continue; +// cout << cnt << " " << laborbookdata.inputRun << " " << tempsamirvar << " " ; +// cout<Fill(pixel[12]); - - // histogram with the summed pixels - Double_t pixelSum = 0; - for (Int_t i=0; iFill(pixelSum); - - // histogram with the single pixel and with "veto trigger" - // for the "histNtupleVeto" take only hits where only the seed pixel contains charge - Double_t notSeedSum = 0; - for (Int_t i=0; i<12; i++) - notSeedSum += pixel[i]; - for (Int_t i=13; i VETO_THRESHOLD) - continue; - // meanNotSeedSum+=notSeedSum; - // nhits++; - histNtupleVeto->Fill(pixel[12]); // histogram with the single pixel - + for(unsigned int i=0; i "<GetEntry((Int_t) frame); + // if (frameCounts > 1) + // continue; + + + // histogram with the single pixel + histNtuple->Fill(pixel[12][i]); + + // histogram with the summed pixels +// Double_t pixelSum = 0; +// for (Int_t i=0; iFill(pixelSum); + + // histogram with the single pixel and with "veto trigger" + // for the "histNtupleVeto" take only hits where only the seed pixel contains charge +// Double_t notSeedSum = 0; +// for (Int_t i=0; i<12; i++) +// notSeedSum += pixel[i]; +// for (Int_t i=13; i VETO_THRESHOLD) +// continue; + // meanNotSeedSum+=notSeedSum; + // nhits++; +// histNtupleVeto->Fill(pixel[12]); // histogram with the single pixel + }} } TCanvas* c1 = new TCanvas(); c1->SetTitle(Form("Seed%i",inputRun)); @@ -276,7 +317,7 @@ struct histogram GenerateHisto(Int_t inputRun) histNtupleSumSame->SetLineColor(1); histNtupleVetoSame->SetLineColor(2); - + struct histogram arrayHisto; arrayHisto.Seed=(TH1F*)histNtuple->Clone(Form("hist%i",inputRun)); @@ -286,7 +327,10 @@ struct histogram GenerateHisto(Int_t inputRun) arrayHisto.posSeed=posSeed; arrayHisto.posSum=posSum; arrayHisto.posVeto=posVeto; +// cout<<"TEST1"<ServerInfo()); +// printf("Server info: %s\n", db->ServerInfo()); TSQLRow *rowsql; TSQLResult *res; try { - // query database and print results - char sqlquery[200]; +// query database and print results + char sqlquery[400]; sprintf(sqlquery, "select System,TempCooling,COALESCE(TempChipStart,-10000) as TempChipStart,COALESCE(TempChipEnd,-10000) as TempChipEnd,ChipNum,RadiationSource,Matrix,ChipRadiation from radhard.labbook WHERE runnumber=%d", inputRun); res = db->Query(sqlquery); int nrows = res->GetRowCount(); - // printf("\nGot %d rows in result\n", nrows); +// printf("\nGot %d rows in result\n", nrows); if (nrows > 0) { @@ -526,8 +570,8 @@ struct laborbook LaborBuchSQL(Int_t inputRun) cout << "Error while reading laboratory book (run number " << inputRun << ")!\n"; } - // cout<<"Run:"< Common Mode suspiciously high! "< Common Mode suspiciously high! "<