Ignore:
Timestamp:
01/19/13 19:59:50 (12 years ago)
Author:
Jens Buss
Message:
distribution histos filled
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/rootmacros/PulseTemplates/FCalcPulseTemplate.C

    r14753 r14781  
    9797int FCalcPulseTemplate(
    9898    TString     InRootFileName        = "20120309_017.root",
     99//    TString     InRootFileName        = "20120309_032.root",
    99100    TString     InputPath           = "analysis/analysis/FPulseTemplate/20120309_017/Overlay/",
     101//    TString     InputPath           = "analysis/analysis/FPulseTemplate/20120309_032/Overlay/",
    100102    TString     OutputRootFileName     = "test.root",
    101103    TString     OutPutPath          = "analysis/FPulseTemplate/20120309_017/",
    102104    int         firstpixel          = 0,
    103     int         npixel              = 10,
     105    int         npixel              = 100,
    104106    int         pixelSetSize        = 200,
    105     int         maxPulseOrder       = 4,
     107    int         maxPulseOrder       = 1,
    106108//    TString     histoOptions        = "SRM",
    107109    bool        ProduceGraphic      = true,
     
    261263    TH1D hIntegral[maxPulseOrder];
    262264    TH1D hAmplitude[maxPulseOrder];
     265    TH1D hRiseTime[maxPulseOrder];
    263266
    264267    //Lopp over pulse order configure distribution histograms
     
    300303        title.Append(i);
    301304        hIntegral[i].SetNameTitle(title, title);
    302         hIntegral[i].SetBins(400, (i+1)*99.5, (i+1)*499.5);
     305        hIntegral[i].SetBins(500, (i+1)*-0.5, (i+1)*499.5);
    303306
    304307        //Amplitude
     
    307310        hAmplitude[i].SetNameTitle(title, title);
    308311        hAmplitude[i].SetBins(400, (i+1)*4.95, (i+1)*24.95);
    309     }
     312
     313        //hRiseTime
     314        title = "hRiseTime";
     315        title.Append(i);
     316        hRiseTime[i].SetNameTitle(title, title);
     317        hRiseTime[i].SetBins(20, -0, 10);
     318    }
     319
     320    // Error Histograms
     321
     322    TH1D hMedianErrors[maxPulseOrder];
     323    TH1D hMeanErrors[maxPulseOrder];
     324    TH1D hMaxErrors[maxPulseOrder];
     325
     326    //Lopp over pulse order configure distribution histograms
     327    for (int i = 0; i<maxPulseOrder; i++)
     328    {
     329        //hMedianErrors
     330        TString title;
     331        title = "hMedianErrors";
     332        title.Append(i);
     333        hMedianErrors[i].SetNameTitle(title, title);
     334        hMedianErrors[i].SetBins(300, -0.5, 300.5);
     335
     336        //hMeanErrors
     337        title = "hMeanErrors";
     338        title.Append(i);
     339        hMeanErrors[i].SetNameTitle(title, title);
     340        hMeanErrors[i].SetBins(300, -0.5, 300.5);
     341
     342        //hMaxErrors
     343        title = "hMaxErrors";
     344        title.Append(i);
     345        hMaxErrors[i].SetNameTitle(title, title);
     346        hMaxErrors[i].SetBins(300, -0.5, 300.5);
     347    }
     348
    310349
    311350//-----------------------------------------------------------------------------
     
    379418
    380419        //--------------------------------------------------------------------
    381         // Loops over every Pixel of a Set of Pixels
     420        // Loop over every Pixel of a Set of Pixels
    382421        //--------------------------------------------------------------------
    383422        for ( int pixelID = firstPixelOfSet;
     
    492531                            "Maximum",
    493532                            pulse_order,
     533                            10,
    494534                            verbosityLevel
    495535                            );
     
    505545                            "Edge",
    506546                            pulse_order,
     547                            10,
    507548                            verbosityLevel
    508549                            );
     
    743784                Pulse* pulseFits[6];
    744785
    745                 pulses.cd(1);
     786//                pulses.cd(1);
    746787                Pulse maxMaxPulse("maxMaxPulse", pixel[pixelID]->hPixelMax[pulse_order], "Q", 1);
    747788                pulseFits[0] = &maxMaxPulse;
    748789
    749                 pulses.cd(2);
     790//                pulses.cd(2);
    750791                Pulse maxMedianPulse("maxMedianPulse", pixel[pixelID]->hPixelMedian[pulse_order], "Q",1);
    751792                pulseFits[1] = &maxMedianPulse;
    752793
    753                 pulses.cd(3);
     794//                pulses.cd(3);
    754795                Pulse maxMeanPulse("maxMeanPulse", pixel[pixelID]->hPixelMean[pulse_order], "Q",1);
    755796                pulseFits[2] = &maxMeanPulse;
     
    778819                }
    779820                //-------------------------------------
     821                // Fill Error Histogramms
     822                //-------------------------------------
     823
     824                for (int i = pixel[pixelID]->hPixelEdgeMedian[pulse_order]->GetXaxis()->GetFirst();
     825                     i <= pixel[pixelID]->hPixelEdgeMedian[pulse_order]->GetXaxis()->GetLast();
     826                     i++)
     827                {
     828
     829                    hMedianErrors[pulse_order].SetBinContent(
     830                                i,
     831                                pixel[pixelID]->hPixelEdgeMedian[pulse_order]->GetBinError(i)
     832                                );
     833
     834                    hMeanErrors[pulse_order].SetBinContent(
     835                                i,
     836                                pixel[pixelID]->hPixelEdgeMean[pulse_order]->GetBinError(i)
     837                                );
     838
     839                    hMaxErrors[pulse_order].SetBinContent(
     840                                i,
     841                                pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetBinError(i)
     842                                );
     843                }
     844
     845                if (ProduceGraphic && debugPixel)
     846                {
     847                    int current_order = 0;
     848                    pulses.cd(1);
     849                    hMaxErrors[current_order].Draw();
     850
     851                    pulses.cd(2);
     852                    hMedianErrors[current_order].Draw();
     853
     854                    pulses.cd(3);
     855                    hMeanErrors[current_order].Draw();
     856                    pulses.Update();
     857                }
     858
     859                //-------------------------------------
    780860                // Fill Distribution Histogramms
    781861                //-------------------------------------
     
    788868                hIntegral[pulse_order].Fill(    edgeMedianPulse.GetIntegral());
    789869                hAmplitude[pulse_order].Fill(   edgeMedianPulse.GetAmplitude());
     870                hRiseTime[pulse_order].Fill(    edgeMedianPulse.GetRiseTime());
    790871
    791872                //-------------------------------------
    792                 // Fill Distribution Containers
     873                // Fill Distribution Graphs
    793874                //-------------------------------------
    794875
     
    901982                TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
    902983                timer.TurnOn();
    903                 TString input = Getline("Type 'q' to exit, <return> to go on: ");
     984                TString input = Getline("Type 'q' to exit, Type 's' to exit set, <return> to go on: ");
    904985                timer.TurnOff();
    905986                if (input=="q\n")
    906987                {
    907988                    return(0);
     989                }
     990                if (input=="s\n")
     991                {
     992                    break;
    908993                }
    909994            }
     
    9791064                    "Maximum",
    9801065                    pulse_order,
     1066                    10,
    9811067                    verbosityLevel
    9821068                    );
     
    9971083                    "Edge",
    9981084                    pulse_order,
     1085                    10,
    9991086                    verbosityLevel
    10001087                    );
     
    11131200            cgpDistributions[i]->cd(7);
    11141201            hAmplitude[i].Draw();
     1202            cgpDistributions[i]->cd(8);
     1203            hRiseTime[i].Draw();
    11151204
    11161205
Note: See TracChangeset for help on using the changeset viewer.