| 1 | /**  container with all attributes and histograms of a pixel. | 
|---|
| 2 | * | 
|---|
| 3 | * #include "XX.h" <BR> | 
|---|
| 4 | * -llib | 
|---|
| 5 | * | 
|---|
| 6 | * A longer description. | 
|---|
| 7 | * | 
|---|
| 8 | * @see something | 
|---|
| 9 | */ | 
|---|
| 10 |  | 
|---|
| 11 | #ifndef PIXEL_H | 
|---|
| 12 | #define PIXEL_H | 
|---|
| 13 |  | 
|---|
| 14 | // SYSTEM INCLUDES | 
|---|
| 15 | // | 
|---|
| 16 |  | 
|---|
| 17 | // PROJECT INCLUDES | 
|---|
| 18 | #include <TROOT.h> | 
|---|
| 19 | #include <TProfile.h> | 
|---|
| 20 | #include <TH2F.h> | 
|---|
| 21 | #include <TH1I.h> | 
|---|
| 22 | #include <TH1F.h> | 
|---|
| 23 | #include <TString.h> | 
|---|
| 24 | #include <TFile.h> | 
|---|
| 25 | #include <TVectorF.h> | 
|---|
| 26 |  | 
|---|
| 27 | #include "TCanvas.h" | 
|---|
| 28 | #include "TObjArray.h" | 
|---|
| 29 | // | 
|---|
| 30 |  | 
|---|
| 31 | //#include "rootfilehandler.h" | 
|---|
| 32 | //#include "rootfilehandler.C" | 
|---|
| 33 |  | 
|---|
| 34 | // LOCAL INCLUDES | 
|---|
| 35 | // | 
|---|
| 36 |  | 
|---|
| 37 | // FORWARD REFERENCES | 
|---|
| 38 | // | 
|---|
| 39 |  | 
|---|
| 40 |  | 
|---|
| 41 | class Pixel | 
|---|
| 42 | { | 
|---|
| 43 | public: | 
|---|
| 44 | // LIFECYCLE | 
|---|
| 45 |  | 
|---|
| 46 | /** Default constructor. | 
|---|
| 47 | */ | 
|---|
| 48 | Pixel( | 
|---|
| 49 | int         pixelID, | 
|---|
| 50 | int         maxPulsorder, | 
|---|
| 51 | int         verbosityLevel, | 
|---|
| 52 | bool        stats, | 
|---|
| 53 | TString     options, | 
|---|
| 54 | int         pixelOverlayXaxisLeft, | 
|---|
| 55 | int         pixelOverlayXaxisRight, | 
|---|
| 56 | float       bSLMean, | 
|---|
| 57 | float       gainMean, | 
|---|
| 58 | TFile*      filename, | 
|---|
| 59 | TFile*      outfilename | 
|---|
| 60 | ); | 
|---|
| 61 |  | 
|---|
| 62 | Pixel( | 
|---|
| 63 | int         pixelID, | 
|---|
| 64 | int         maxPulsorder, | 
|---|
| 65 | int         verbosityLevel, | 
|---|
| 66 | bool        stats, | 
|---|
| 67 | TString     options, | 
|---|
| 68 | int         pixelOverlayXaxisLeft, | 
|---|
| 69 | int         pixelOverlayXaxisRight, | 
|---|
| 70 | float       bSLMean, | 
|---|
| 71 | float       gainMean | 
|---|
| 72 | ); | 
|---|
| 73 |  | 
|---|
| 74 |  | 
|---|
| 75 | //    /** Copy constructor. | 
|---|
| 76 | //    * | 
|---|
| 77 | //    * @param from The value to copy to this object. | 
|---|
| 78 | //    */ | 
|---|
| 79 |  | 
|---|
| 80 |  | 
|---|
| 81 | /** Destructor. | 
|---|
| 82 | */ | 
|---|
| 83 | ~Pixel(); | 
|---|
| 84 |  | 
|---|
| 85 |  | 
|---|
| 86 | // OPERATORS | 
|---|
| 87 |  | 
|---|
| 88 | //    /** Assignment operator. | 
|---|
| 89 | //    * | 
|---|
| 90 | //    * @param from THe value to assign to this object. | 
|---|
| 91 | //    * | 
|---|
| 92 | //    * @return A reference to this object. | 
|---|
| 93 | //    */ | 
|---|
| 94 | //    XX&                     operator=(const XX& from); | 
|---|
| 95 |  | 
|---|
| 96 | // OPERATIONS | 
|---|
| 97 |  | 
|---|
| 98 | //Histogram Booking | 
|---|
| 99 | protected: | 
|---|
| 100 | void BookPixelHistos(); | 
|---|
| 101 | void BookDistributionHistos(); | 
|---|
| 102 | void BookTemplateHistos(); | 
|---|
| 103 | void BookEdgeTemplateHistos(); | 
|---|
| 104 |  | 
|---|
| 105 | //Histogram deletion | 
|---|
| 106 | void DeletePixelHistos(); | 
|---|
| 107 | void DeleteDistributionHistos(); | 
|---|
| 108 | void DeleteTemplateHistos(); | 
|---|
| 109 | void DeleteEdgeTemplateHistos(); | 
|---|
| 110 |  | 
|---|
| 111 | //Histogram Manipulation | 
|---|
| 112 | void SetRangeUser(float xMin, float xMax, int order); | 
|---|
| 113 |  | 
|---|
| 114 | void NormalizeSamplesTH2F(TH2F *histo); | 
|---|
| 115 | void Normalize2Dhistos(int order); | 
|---|
| 116 | //Histogram appeareance | 
|---|
| 117 | void | 
|---|
| 118 | MakeTH1Pretty( | 
|---|
| 119 | TH1*                histo, | 
|---|
| 120 | TString             histName, | 
|---|
| 121 | TString             histTitle, | 
|---|
| 122 | int                 order | 
|---|
| 123 | ); | 
|---|
| 124 | void | 
|---|
| 125 | MakeTH2Pretty( | 
|---|
| 126 | TH2*                histo, | 
|---|
| 127 | TString             histName, | 
|---|
| 128 | TString             histTitle, | 
|---|
| 129 | int                 order | 
|---|
| 130 | ); | 
|---|
| 131 | void | 
|---|
| 132 | MakeTProfilePretty( | 
|---|
| 133 | TProfile*           histo, | 
|---|
| 134 | TString             histName, | 
|---|
| 135 | TString             histTitle, | 
|---|
| 136 | int                 order | 
|---|
| 137 | ); | 
|---|
| 138 |  | 
|---|
| 139 | public: | 
|---|
| 140 | //Histogram Drawing | 
|---|
| 141 | void DrawOverlayHistograms( | 
|---|
| 142 | TCanvas     **pixelCanvas,   //Array of Canvases | 
|---|
| 143 | int         *histoFrameNR   //Array with Canvas Frame numbers | 
|---|
| 144 | ); | 
|---|
| 145 | void DrawDistributionHistograms( | 
|---|
| 146 | TCanvas     **pixelCanvas,   //Array of Canvases | 
|---|
| 147 | int         *histoFrameNr   //Array with Canvas Frame numbers | 
|---|
| 148 | ); | 
|---|
| 149 | void DrawTemplateHistograms( | 
|---|
| 150 | TCanvas     **pixelCanvas,   //Array of Canvases | 
|---|
| 151 | int         *histoFrameNr   //Array with Canvas Frame numbers | 
|---|
| 152 | ); | 
|---|
| 153 | void DrawEdgeTemplateHistograms( | 
|---|
| 154 | TCanvas     **pixelCanvas,   //Array of Canvases | 
|---|
| 155 | int         *histoFrameNr   //Array with Canvas Frame numbers | 
|---|
| 156 | ); | 
|---|
| 157 |  | 
|---|
| 158 | //File Handling | 
|---|
| 159 | void SavePixelHistograms( TString loc_fname, bool); | 
|---|
| 160 |  | 
|---|
| 161 | protected: | 
|---|
| 162 | void LoadPulseHistos( ); | 
|---|
| 163 |  | 
|---|
| 164 | public: | 
|---|
| 165 | //File Handling Service Functions | 
|---|
| 166 | TString HistoTitle(TString, int ); | 
|---|
| 167 | TString HistoName(TString, int); | 
|---|
| 168 | TString ChooseCycleNumber(TString , int); | 
|---|
| 169 | virtual TString CsvFileName(TString, TString, int ); | 
|---|
| 170 |  | 
|---|
| 171 | //fit funcitons | 
|---|
| 172 | //    void FitFallingEdge( | 
|---|
| 173 | //            TString             histoType,   //Max or Edge | 
|---|
| 174 | //            double , | 
|---|
| 175 | //            double , | 
|---|
| 176 | //            TH1F*               hMaximumTemp | 
|---|
| 177 | //            ); | 
|---|
| 178 |  | 
|---|
| 179 | //    double | 
|---|
| 180 | //    PolExp(double* x, double* par); | 
|---|
| 181 |  | 
|---|
| 182 | //shifting | 
|---|
| 183 | void ShiftHistoInY(TH1*, float); | 
|---|
| 184 |  | 
|---|
| 185 |  | 
|---|
| 186 |  | 
|---|
| 187 |  | 
|---|
| 188 | // ACCESS | 
|---|
| 189 | // INQUIRY | 
|---|
| 190 | int             mChid; | 
|---|
| 191 | bool            mStats; | 
|---|
| 192 | int             mMaxPulseOrder; | 
|---|
| 193 | int             mVerbosityLevel; | 
|---|
| 194 | int             mPixelOverlayXaxisLeft; | 
|---|
| 195 | int             mPixelOverlayXaxisRight; | 
|---|
| 196 | float           mBSLMean; | 
|---|
| 197 | float           mGainMean; | 
|---|
| 198 | int             mMarkerStyle; | 
|---|
| 199 | TString         mOptions; | 
|---|
| 200 |  | 
|---|
| 201 | //Pixel Histos | 
|---|
| 202 | TH2F**          hMaxOverlay;      //histogrammm for overlay of detected Peaks | 
|---|
| 203 | TH2F**          hEdgeOverlay; | 
|---|
| 204 | TProfile**      hMaxProfile;      //histogrammm for Profile of detected Peaks | 
|---|
| 205 | TProfile**      hEdgeProfile;  //histogrammm for Profile of detected Peaks | 
|---|
| 206 |  | 
|---|
| 207 | //Distribution Histos | 
|---|
| 208 | TH1F**          hSlopeRisingEdge; | 
|---|
| 209 | TH1I**          hRisingEdgeToMax; | 
|---|
| 210 | TH1I**          hPosOfMax; | 
|---|
| 211 | TH1F**          hChi2EdgetoMax; | 
|---|
| 212 |  | 
|---|
| 213 | //Max Overlay Template Histos | 
|---|
| 214 | TH1F**          hPixelMax; | 
|---|
| 215 | TH1F**          hPixelMedian; | 
|---|
| 216 | TH1F**          hPixelMean; | 
|---|
| 217 | //Edge OverlayTemplate Histos | 
|---|
| 218 | TH1F**          hPixelEdgeMax; | 
|---|
| 219 | TH1F**          hPixelEdgeMedian; | 
|---|
| 220 | TH1F**          hPixelEdgeMean; | 
|---|
| 221 |  | 
|---|
| 222 | //Lists | 
|---|
| 223 | TList*          hList; | 
|---|
| 224 | TList*          hMemberlist; | 
|---|
| 225 |  | 
|---|
| 226 | TFile*          mRootFile; | 
|---|
| 227 | TFile*          mOutRootFile; | 
|---|
| 228 | TDirectory*     mDirectory; | 
|---|
| 229 |  | 
|---|
| 230 | protected: | 
|---|
| 231 | int             mConstructorType; //0 delete distributions, 1 delete TemplateHistos | 
|---|
| 232 | private: | 
|---|
| 233 | }; | 
|---|
| 234 |  | 
|---|
| 235 |  | 
|---|
| 236 |  | 
|---|
| 237 | #endif  // _PIXEL_H_ | 
|---|