Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

AlignmentStripHistograms.cxx

Go to the documentation of this file.
00001 
00002 //
00003 //
00004 // AlignmentStripHistograms
00005 //
00006 // Package: DetectorAlignment
00007 //
00008 // Main alignment histograms class
00009 //
00010 // Contact: rustem@fnal.gov
00011 //
00012 // Created on: Tue Jul 26 11:40:05 2004
00013 //
00015 
00016 //Local package headers
00017 #include "AlignmentStripHistograms.h"
00018 #include "AlignmentStrip.h"
00019 
00020 //MINOS headers
00021 #include "MessageService/MsgService.h"
00022 #include "MessageService/MsgFormat.h"
00023 
00024 //ROOT headers
00025 #include "TH1.h"
00026 #include "TProfile.h"
00027 #include "TDirectory.h"
00028 
00029 //C++ headers
00030 #include <cassert>
00031 #include <cmath>
00032 #include <iostream>
00033 #include <string>
00034 #include <sstream>
00035 
00036 using namespace std;
00037 
00038 CVSID("$Id: AlignmentStripHistograms.cxx,v 1.4 2009/02/28 21:46:10 gmieg Exp $");
00039 
00040 //__________________________________________________________________________________________________
00041 AlignmentStripHistograms::AlignmentStripHistograms(TDirectory *ResidualDir,
00042                                                    TDirectory *ChargeDir,
00043                                                    TDirectory *AttenDir,
00044                                                    TDirectory *OccupancyDir,
00045                                                    TDirectory *RotResDir,
00046                                                    const AlignmentStrip &astrip)
00047    :fPlane(astrip.plane),
00048     fStrip(astrip.strip),
00049     fPlexSEId(astrip.plexseid),
00050     fLength(astrip.length),
00051     fPigTail(astrip.pigtail),
00052     fhCharge(0),
00053     fhChargePathCorr(0), 
00054     fhResidual(0), 
00055     fhOccupancy(0),
00056     fpAtten(0),
00057     fpAttenPigCorr(0),
00058     fpRotationalResidual(0),
00059     fNChargeBins(200),
00060     fNResidualBins(60),
00061     fChargeLimit(5000.0),
00062     fResidualLimit(0.12),
00063     fOccupancyBinWidth(0.04),
00064     fAttenuationBinWidth(0.4),
00065     fRotationalResidualBinWidth(0.5)
00066 {
00067 
00068    MSG("Align", Msg::kVerbose) << "Constructor AlignmentStripHistograms() " << endl;
00069 
00070    if(!ResidualDir || !ChargeDir || !AttenDir || !OccupancyDir || !RotResDir)
00071    {
00072       MSG("Align", Msg::kFatal) << "AlignmentStripHistograms ctor: TDirectory pointer is zero." << endl;
00073       abort();
00074    }
00075 
00076    fhCharge             = InitChargeHistogram(ChargeDir);
00077    fhChargePathCorr     = InitPathCorrChargeHistogram(ChargeDir);
00078    fhResidual           = InitResidualHistogram(ResidualDir);
00079    fhOccupancy          = InitOccupancyHistogram(OccupancyDir);
00080    fpAtten              = InitAttenHistogram(AttenDir);
00081    fpAttenPigCorr       = InitPigtailAttenHistogram(AttenDir);
00082    fpRotationalResidual = InitRotResidualHistogram(RotResDir);
00083 }
00084 
00085 
00086 //__________________________________________________________________________________________________
00087 void AlignmentStripHistograms::FillHistograms(const AlignmentStrip& astrip)
00088 {
00089    fhCharge         -> Fill(astrip.charge);
00090    fhChargePathCorr -> Fill(astrip.charge_pc);
00091    fhResidual       -> Fill(astrip.residual);
00092    fhOccupancy      -> Fill(astrip.lhitpos);
00093    
00094    if(!astrip.goodhit)
00095       return;
00096    
00097    fpRotationalResidual -> Fill(astrip.lhitpos+astrip.lposrelmdl, astrip.residual);
00098 
00099    if(astrip.wlsbypass > 0.001)
00100       return;
00101 
00102    fpAtten        -> Fill(fabs(astrip.lhitpos - astrip.length/2.0), astrip.charge_pc);
00103    fpAttenPigCorr -> Fill(astrip.pigtail + fabs(astrip.lhitpos - astrip.length/2.0), astrip.charge_pc);  
00104 }
00105 
00106 //__________________________________________________________________________________________________
00107 TH1D* AlignmentStripHistograms::InitChargeHistogram(TDirectory *dir)
00108 {
00109    char name[100], title[100];
00110    sprintf(name,"ChargeInPlane%03dStrip%03d", fPlane, fStrip);
00111    sprintf(title,"Charge plane %03d, strip %03d", fPlane, fStrip);
00112    MSG("Align", Msg::kVerbose) << "Creating histogram " << name << endl;
00113    TH1D *h = new TH1D(name, title, fNChargeBins, 0, fChargeLimit);
00114    h -> SetDirectory(dir);
00115    h -> GetXaxis() -> SetTitle("Raw ADC");
00116    h -> GetXaxis() -> CenterTitle();      
00117    return h;
00118 }
00119 
00120 //__________________________________________________________________________________________________
00121 TH1D* AlignmentStripHistograms::InitPathCorrChargeHistogram(TDirectory *dir)
00122 {
00123    char name[100], title[100];
00124    sprintf(name,"PathCorrChargeInPlane%03dStrip%03d", fPlane, fStrip);
00125    sprintf(title,"Path corrected charge plane %03d, strip %03d", fPlane, fStrip);
00126    MSG("Align", Msg::kVerbose) << "Creating histogram " << name << endl;
00127    TH1D *h = new TH1D(name, title, fNChargeBins, 0, fChargeLimit);
00128    h -> SetDirectory(dir);
00129    h -> GetXaxis() -> SetTitle("Raw ADC");
00130    h -> GetXaxis() -> CenterTitle();      
00131    return h;
00132 }
00133 
00134 //__________________________________________________________________________________________________
00135 TH1D* AlignmentStripHistograms::InitResidualHistogram(TDirectory *dir)
00136 {
00137    char name[100], title[100];
00138    sprintf(name,"ResidualInPlane%03dStrip%03d", fPlane, fStrip);
00139    sprintf(title,"Residual in hit strip, plane %03d, strip %03d", fPlane, fStrip);
00140    TH1D *h = new TH1D(name, title, 2*fNResidualBins, -fResidualLimit, fResidualLimit);
00141    h -> SetDirectory(dir);
00142    h -> GetXaxis() -> SetTitle("residual (m)");
00143    h -> GetXaxis() -> CenterTitle();
00144    return h;
00145 }
00146 
00147 
00148 //__________________________________________________________________________________________________
00149 TH1D* AlignmentStripHistograms::InitOccupancyHistogram(TDirectory *dir)
00150 {
00151    int nbin = int(fLength/fAttenuationBinWidth);
00152    char name[100], title[100];
00153    sprintf(name,"OccupancyInPlane%03dStrip%03d", fPlane, fStrip);
00154    sprintf(title,"Longitudinal occupancy, plane %03d, strip %03d", fPlane, fStrip);
00155    TH1D *h = new TH1D(name, title, nbin, -fLength/2.0, fLength/2.0);
00156    h -> SetDirectory(dir);
00157    h -> GetXaxis() -> SetTitle("residual (m)");
00158    h -> GetXaxis() -> CenterTitle();
00159    return h;
00160 }
00161 
00162 //__________________________________________________________________________________________________
00163 TProfile* AlignmentStripHistograms::InitAttenHistogram(TDirectory *dir)
00164 {       
00165    char name[100], title[100];
00166    int nbin = int(fLength/fAttenuationBinWidth);
00167    sprintf(name,"ProfileStripAtten%03d_%03d", fPlane, fStrip);
00168    sprintf(title,"Strip attenuation plane %03d and strip %03d", fPlane, fStrip);
00169    MSG("Align", Msg::kVerbose) << "Creating " << name << " histogram with "<< nbin << " bins"<<endl;
00170    TProfile *p = new TProfile(name, title, nbin, 0.0, fLength);
00171    p -> SetDirectory(dir);
00172    p -> GetXaxis() -> SetTitle("wls fiber length (m)");
00173    p -> GetXaxis() -> CenterTitle();
00174    p -> GetYaxis() -> SetTitle("charge (ADC)");
00175    p -> GetYaxis() -> CenterTitle();
00176    return p;
00177 }   
00178 
00179 //__________________________________________________________________________________________________
00180 TProfile* AlignmentStripHistograms::InitPigtailAttenHistogram(TDirectory *dir)
00181 {       
00182    char name[100], title[100];
00183    const int nbin = int(floor(fLength/fAttenuationBinWidth));
00184    sprintf(name,"ProfileStripPigAtten%03d_%03d", fPlane, fStrip);
00185    sprintf(title,"Strip attenuation plane %03d and strip %03d", fPlane, fStrip);
00186    MSG("Align", Msg::kVerbose) << "Creating " << name << " histogram with "<< nbin << " bins"<<endl;
00187    Double_t bins[10];
00188    bins[0] = 0.0;
00189    bins[1] = fPigTail;
00190    for(int i = 1; i <= 8; ++i)
00191    {
00192       double bin = i;
00193       bins[i+1] = bin*fAttenuationBinWidth + fPigTail;
00194    }
00195    TProfile *p = new TProfile(name, title, 9, bins);
00196    p -> SetDirectory(dir);
00197    p -> GetXaxis() -> SetTitle("wls fiber length (m)");
00198    p -> GetXaxis() -> CenterTitle();
00199    p -> GetYaxis() -> SetTitle("charge (ADC)");
00200    p -> GetYaxis() -> CenterTitle();
00201    return p;
00202 }   
00203 
00204 //__________________________________________________________________________________________________
00205 TProfile* AlignmentStripHistograms::InitRotResidualHistogram(TDirectory *dir)
00206 {
00207    char name[100], title[100];   
00208    sprintf(name,"RotResidualInPlane%03dStrip%03d", fPlane, fStrip);
00209    sprintf(title,"Profile rotational residuals plane %03d strip %03d", fPlane, fStrip);
00210    unsigned int nbin = int(floor(fLength/fRotationalResidualBinWidth));
00211    TProfile *p = new TProfile(name, title, nbin, -fLength/2.0, fLength/2.0);
00212    p -> SetDirectory(dir);
00213    p -> GetXaxis() -> SetTitle("position (m)");
00214    p -> GetXaxis() -> CenterTitle();
00215    p -> GetYaxis() -> SetTitle("residual (m)");
00216    p -> GetYaxis() -> CenterTitle();   
00217    return p;
00218 }
00219 
00220 
00221 //____________________________________________________________________________________________
00222 AlignmentStripHistograms::~AlignmentStripHistograms()
00223 {
00224    MSG("Align", Msg::kVerbose) << "Destructor ~AlignmentStripHistograms()..." << endl;
00225 }

Generated on Mon Feb 15 11:06:21 2010 for loon by  doxygen 1.3.9.1