Changeset 5431 for trunk/MagicSoft/Mars/mbadpixels
- Timestamp:
- 11/18/04 15:55:40 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mbadpixels
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.cc
r4635 r5431 106 106 if (!fPedPhotCam) 107 107 { 108 *fLog << err << "MPedPhotCamnot found... aborting." << endl;108 *fLog << err << fNamePedPhotContainer << "[MPedPhotCam] not found... aborting." << endl; 109 109 return kFALSE; 110 110 } … … 117 117 } 118 118 } 119 120 *fLog << inf << "Name of MPedPhotCam container : " << fNamePedPhotContainer 121 << endl; 122 119 123 return kTRUE; 120 124 } … … 257 261 fPedPhotCam->ReCalc(*fGeomCam, fBadPixels); 258 262 } 263 259 264 return kTRUE; 260 265 } -
trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.h
r5117 r5431 37 37 38 38 #endif 39 40 41 42 -
trunk/MagicSoft/Mars/mbadpixels/MHBadPixels.cc
r4887 r5431 35 35 #include "MBadPixelsCam.h" 36 36 #include "MGeomCam.h" 37 #include "MPedPhotCam.h" 37 38 #include "MParList.h" 38 39 #include "MBinning.h" … … 47 48 // ------------------------------------------------------------------------- 48 49 // 49 // DefaultConstructor.50 // Constructor. 50 51 // 51 52 MHBadPixels::MHBadPixels(const char *name, const char *title) 52 : fNamePedPhotCam("MPedPhotCam")53 53 { 54 54 fName = name ? name : "MHBadPixels"; 55 55 fTitle = title ? title : "Histogram for Bad Pixels vs. Theta"; 56 56 57 fBadId.SetName("2D-IdBadPixels"); 58 fBadId.SetTitle("2D-IdBadPixels"); 59 fBadId.SetDirectory(NULL); 60 fBadId.SetXTitle("\\Theta [\\circ]"); 61 fBadId.SetYTitle("pixel Id"); 62 63 fBadN.SetName("2D-NBadPixels"); 64 fBadN.SetTitle("2D-NBadPixels"); 65 fBadN.SetDirectory(NULL); 66 fBadN.SetXTitle("\\Theta [\\circ]"); 67 fBadN.SetYTitle("number of bad pixels"); 68 57 fBadId = new TH2D; 58 fBadId->SetName("2D-IdBadPixels"); 59 fBadId->SetTitle("2D-IdBadPixels"); 60 fBadId->SetDirectory(NULL); 61 fBadId->UseCurrentStyle(); 62 fBadId->SetXTitle("\\Theta [\\circ]"); 63 fBadId->SetYTitle("pixel Id"); 64 fBadId->SetTitleOffset(1.2, "Y"); 65 66 fBadN = new TH2D; 67 fBadN->SetName("2D-NBadPixels"); 68 fBadN->SetTitle("2D-NBadPixels"); 69 fBadN->SetDirectory(NULL); 70 fBadN->UseCurrentStyle(); 71 fBadN->SetXTitle("\\Theta [\\circ]"); 72 fBadN->SetYTitle("number of bad pixels"); 73 fBadN->SetTitleOffset(1.2, "Y"); 74 75 // define default binnings 76 fBinsTheta = new MBinning; 77 fBinsTheta->SetEdgesCos(10, 0.0, 90.0); // theta 78 79 fBinsPix = new MBinning; 80 fBinsPix->SetEdges(578, -0.5, 577.5); // pixel id 81 82 SetBinning(fBadId, fBinsTheta, fBinsPix); 83 SetBinning(fBadN, fBinsTheta, fBinsPix); 84 85 //----------------------------------------- 86 fNamePedPhotCam = "MPedPhotCamFromData"; 87 } 88 89 90 // ------------------------------------------------------------------------- 91 // 92 // Destructor. 93 // 94 MHBadPixels::~MHBadPixels() 95 { 96 delete fBadId; 97 delete fBadN; 98 99 delete fBinsTheta; 100 delete fBinsPix; 69 101 } 70 102 … … 75 107 Bool_t MHBadPixels::SetupFill(const MParList *plist) 76 108 { 77 MGeomCam *fCam = (MGeomCam*)plist->FindObject(AddSerialNumber("MGeomCam"));109 fCam = (MGeomCam*)plist->FindObject(AddSerialNumber("MGeomCam")); 78 110 if (!fCam) 79 111 { 80 *fLog << err << "MGeomCam not found... aborting." << endl; 81 return kFALSE; 82 } 112 *fLog << err << "MHBadPixels::SetupFill; MGeomCam not found... aborting." << endl; 113 return kFALSE; 114 } 115 *fLog << "MHBadPixels::SetupFill; fCam = " << fCam << endl; 116 83 117 fPointPos = (MPointingPos*)plist->FindObject("MPointingPos"); 84 118 if (!fPointPos) … … 87 121 return kFALSE; 88 122 } 123 124 fPedPhot = (MPedPhotCam*)plist->FindObject(AddSerialNumber(fNamePedPhotCam), "MPedPhotCam"); 125 if (!fPedPhot) 126 { 127 *fLog << err << AddSerialNumber(fNamePedPhotCam) 128 << "[MPedPhotCam] not found... aborting." << endl; 129 return kFALSE; 130 } 131 fPedPhot->InitSize(fCam->GetNumPixels()); 132 89 133 90 134 //---------------------------------------------------- 135 *fLog << inf << "Name of MPedPhotCam container : " << fNamePedPhotCam 136 << endl; 137 138 139 //---------------------------------------------------- 140 // redefine the binnings 141 91 142 // Get Theta Binning 92 MBinning* binstheta = (MBinning*)plist->FindObject("BinningTheta", "MBinning");143 const MBinning* binstheta = (MBinning*)plist->FindObject("BinningTheta", "MBinning"); 93 144 if (!binstheta) 94 145 { 95 *fLog << err << " BinningTheta [MBinning] not found... aborting" << endl;96 return kFALSE;97 } 98 99 // Getbinning for pixel number100 const UInt_t npix1 = f Cam->GetNumPixels()+1;101 146 *fLog << err << "Object 'BinningTheta' [MBinning] not found... use default binning." << endl; 147 binstheta = fBinsTheta; 148 } 149 150 // Define binning for pixel number 151 const UInt_t npix1 = fPedPhot->GetSize()+1; 152 //*fLog << "MHBadPixels::SetupFill(); npix1 = " << npix1 << endl; 102 153 MBinning binspix("BinningPixel"); 103 154 binspix.SetEdges(npix1, -0.5, npix1-0.5); 104 155 105 156 // Set binnings in histograms 106 SetBinning(&fBadId, binstheta, &binspix); 107 SetBinning(&fBadN, binstheta, &binspix); 157 SetBinning(fBadId, binstheta, &binspix); 158 SetBinning(fBadN, binstheta, &binspix); 159 160 *fLog << "MHBadPixels::SetupFill(); binnings were set" << endl; 161 162 108 163 109 164 return kTRUE; … … 122 177 Double_t theta = fPointPos->GetZd(); 123 178 124 const MBadPixelsCam *badpixels = (MBadPixelsCam*)par; 125 126 const UInt_t entries = badpixels->GetSize(); 127 179 const MBadPixelsCam *fBadPixels = (MBadPixelsCam*)par; 180 181 const UInt_t entries = fPedPhot->GetSize(); 128 182 UInt_t nb = 0; 129 183 for (UInt_t i=0; i<entries; i++) 130 184 { 131 if ( (*badpixels)[i].IsUnsuitable() ) 132 { 133 fBadId.Fill(theta, i, w); 134 nb++; 135 } 136 } 137 fBadN.Fill(theta, nb, w); 185 //*fLog << "MHBadPixels::Fill; i = " << i << endl; 186 187 if ( (*fBadPixels)[i].IsUnsuitable() ) 188 { 189 //*fLog << "MHBadPixels::Fill; (UnSuitable) " << endl; 190 191 fBadId->Fill(theta, i, w); 192 nb++; 193 } 194 } 195 fBadN->Fill(theta, nb, w); 138 196 139 197 return kTRUE; … … 154 212 155 213 pad->cd(1); 156 fBadId .Draw(option);214 fBadId->Draw(option); 157 215 158 216 pad->cd(2); 159 fBadN .Draw(option);217 fBadN->Draw(option); 160 218 161 219 pad->cd(3); 162 220 gPad->SetBorderMode(0); 163 h = ((TH2*) &fBadId)->ProjectionY("ProjY-pixId", -1, 9999, "");221 h = ((TH2*)fBadId)->ProjectionY("ProjY-pixId", -1, 9999, ""); 164 222 h->SetDirectory(NULL); 165 223 h->SetTitle("Distribution of bad pixel Id"); 166 224 h->SetXTitle("Id of bad pixel"); 167 225 h->SetYTitle("No. of events"); 226 h->SetTitleOffset(1.2, "Y"); 168 227 h->Draw(option); 169 228 h->SetBit(kCanDelete); … … 171 230 pad->cd(4); 172 231 gPad->SetBorderMode(0); 173 h = ((TH2*) &fBadN)->ProjectionY("ProjY-pixN", -1, 9999, "");232 h = ((TH2*)fBadN)->ProjectionY("ProjY-pixN", -1, 9999, ""); 174 233 h->SetDirectory(NULL); 175 234 h->SetTitle("Distribution of no.of bad pixels"); 176 235 h->SetXTitle("No. of bad pixels"); 177 236 h->SetYTitle("No. of events"); 237 h->SetTitleOffset(1.2, "Y"); 178 238 h->Draw(option); 179 239 h->SetBit(kCanDelete); … … 182 242 pad->Update(); 183 243 } 244 //========================================================================== 245 246 247 248 249 250 251 252 253 254 255 -
trunk/MagicSoft/Mars/mbadpixels/MHBadPixels.h
r4887 r5431 18 18 private: 19 19 MGeomCam *fCam; //! 20 MPedPhotCam *fPedPhot; //! 20 21 MPointingPos *fPointPos; //! 21 22 22 23 TString fNamePedPhotCam; //! name of the 'MPedPhotCam' container 24 MBinning *fBinsTheta; //! 25 MBinning *fBinsPix; //! 23 26 24 TH2D fBadId; // 2D-histogram : pixel Id vs. Theta25 TH2D fBadN; // 2D-histogram : no.of bad pixels vs. Theta27 TH2D *fBadId; // 2D-histogram : pixel Id vs. Theta 28 TH2D *fBadN; // 2D-histogram : no.of bad pixels vs. Theta 26 29 27 30 public: 28 31 MHBadPixels(const char *name=NULL, const char *title=NULL); 32 ~MHBadPixels(); 29 33 30 34 void SetNamePedPhotCam(const char *name) { fNamePedPhotCam = name; } 31 35 32 const TH2D *GetBadId() { return &fBadId; }33 const TH2D *GetBadId() const { return &fBadId; }36 const TH2D *GetBadId() { return fBadId; } 37 const TH2D *GetBadId() const { return fBadId; } 34 38 35 const TH2D *GetBadN() { return &fBadN; } 36 const TH2D *GetBadN() const { return &fBadN; } 39 const TH2D *GetBadN() { return fBadN; } 40 const TH2D *GetBadN() const { return fBadN; } 41 42 TH2 *GetBadIdByName(const TString name) { return fBadId; } 43 TH2 *GetBadNByName(const TString name) { return fBadN; } 37 44 38 45 void Draw(Option_t* option = "");
Note:
See TracChangeset
for help on using the changeset viewer.