- Timestamp:
- 05/17/04 09:35:10 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcPosFromFile.cc
r4074 r4084 60 60 // 61 61 MSrcPosFromFile::MSrcPosFromFile(TString cardpath, OnOffMode_t mode, const char *name, const char *title) 62 : fRawRunHeader(NULL), fSourcePositionFilePath(cardpath)62 : MSrcPlace(TString(gsDefName+"Hist").Data()), fRawRunHeader(NULL), fSourcePositionFilePath(cardpath) 63 63 { 64 64 fName = name ? name : gsDefName.Data(); … … 66 66 SetMode(mode); 67 67 68 fRunList=0x0; 69 fRunSrcPos=0x0; 70 fRunMap=0x0; 71 68 72 fLastRun = 0; 69 73 fLastValidSrcPosCam=0x0; 74 } 75 // ------------------------------------------------------------------------- 76 // 77 // Destructor 78 // 79 MSrcPosFromFile::~MSrcPosFromFile() 80 { 81 if(fRunList) 82 delete [] fRunList; 83 if(fRunSrcPos) 84 delete [] fRunSrcPos; 85 if(fRunMap) 86 delete fRunMap; 87 } 88 89 // ------------------------------------------------------------------------- 90 // 91 // Open and read the input file. 92 Int_t MSrcPosFromFile::PreProcess(MParList *pList) 93 { 70 94 // Count the number of runs in the card with the source poistions 71 95 ReadSourcePositionsFile(kCount); 72 96 73 fRunList = new Int_t[fNumRuns]; 74 fRunSrcPos = new MSrcPosCam[fNumRuns]; 75 fRunMap = new TExMap(fNumRuns); 97 if(!fRunList) 98 fRunList = new Int_t[fNumRuns]; 99 if(!fRunSrcPos) 100 fRunSrcPos = new MSrcPosCam[fNumRuns]; 101 if(!fRunMap) 102 fRunMap = new TExMap(fNumRuns); 76 103 77 104 // Read card with the source poistions 78 105 ReadSourcePositionsFile(kRead); 79 } 80 81 MSrcPosFromFile::~MSrcPosFromFile() 82 { 83 delete [] fRunList; 84 delete [] fRunSrcPos; 85 delete fRunMap; 86 } 87 88 // ------------------------------------------------------------------------- 89 // 90 Int_t MSrcPosFromFile::PreProcess(MParList *pList) 91 { 106 107 92 108 if(!SearchForSrcPos(pList)) 93 109 return kFALSE; … … 119 135 Float_t y; 120 136 137 *fLog << inf << "Source position for run " << run; 121 138 if (srcpos) 122 139 { 140 fLastValidSrcPosCam = srcpos; 123 141 x = srcpos->GetX(); 124 142 y = srcpos->GetY(); 143 } 144 else if(fLastValidSrcPosCam) 145 { 146 x = fLastValidSrcPosCam->GetX(); 147 y = fLastValidSrcPosCam->GetY(); 125 148 126 GetSrcPosCam()->SetXY(x,y); 127 128 *fLog << inf << "Source position for run " << run; 129 *fLog << inf << "\tX\t" << setprecision(3) << x; 130 *fLog << inf << "\tY\t" << setprecision(3) << y << endl; 131 } 149 *fLog << inf << " not found in file. Taking previous position: "; 150 } 132 151 else 133 152 { 134 *fLog << inf << "Source position for run " << run << " not found in file. "; 135 *fLog << inf << "Taking previous position: "; 136 *fLog << inf << "\tX\t" << setprecision(3) << x; 137 *fLog << inf << "\tY\t" << setprecision(3) << y << endl; 153 *fLog << err << "MSrcPosFromFile::ComputeNewSrcPosition error: no value for the first run. Don't know what values to take" << endl; 154 return kFALSE; 138 155 } 156 157 GetSrcPosCam()->SetXY(x,y); 158 159 *fLog << inf << "\tX\t" << setprecision(3) << x; 160 *fLog << inf << "\tY\t" << setprecision(3) << y << endl; 139 161 } 140 162
Note:
See TracChangeset
for help on using the changeset viewer.