- Timestamp:
- 12/02/08 11:23:24 (16 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r9185 r9186 23 23 * mbase/MStatusDisplay.[h,cc], mbase/MEvtLoop.cc: 24 24 - added Pause and Single Step option 25 26 * mcorsika/MCorsikaEvtHeader.[h,cc], mcorsika/MCorsikaRead.[h,cc]., 27 mcorsika/MCorsikaRunHeader.[h,cc]: 28 - moved filling of run header from first event header to 29 MCorsikaRunHeader 30 31 * mfileio/MWriteRootFile.cc: 32 - improved a check in the constructor if no filename is given 33 34 * mhbase/MH.cc: 35 - make SetBinning also work for TProfile2D 36 37 * mhist/MHCamera.[h,cc]: 38 - added functions to return the number of used pixels 39 40 * mjobs/MDataSet.cc, mjobs/MSequence.cc: 41 - improved by using new GetEnvValue3 42 43 * mbase/MParContainer.[h,cc]: 44 - added new member function GetEnvValue3 which is more flexible 45 in the number of leading zeroes within a resource name 25 46 26 47 -
trunk/MagicSoft/Mars/NEWS
r9181 r9186 49 49 displayed values. (tabs.php) These plots are linked from the DB 50 50 websites and the wiki. 51 52 ;statusdisplay 53 54 * The ''Loop'' entry in the menu bar now contains an option to pause 55 the loop and to process single events. 51 56 52 57 ;merpp -
trunk/MagicSoft/Mars/mbase/MParContainer.cc
r9025 r9186 1090 1090 // -------------------------------------------------------------------------- 1091 1091 // 1092 // This is a wrapper which checks the resource file for an id containing 1093 // a %d with different numbers of leading zeros (1 to 8). 1094 // 1095 // If athe entries in the resource file are not unambiguous a warning 1096 // is printed. 1097 // 1098 TString MParContainer::GetEnvValue3(const TEnv &env, const TString &prefix, TString id, UInt_t num) const 1099 { 1100 id.ReplaceAll("%d", "%%0%dd"); 1101 1102 TString rc; 1103 for (int i=1; i<9; i++) 1104 { 1105 const TString form = Form(id.Data(), i); 1106 const TString res = Form(form.Data(), num); 1107 1108 const TString str = GetEnvValue2(env, prefix, res, ""); 1109 1110 if (str.IsNull()) 1111 continue; 1112 1113 if (rc.IsNull()) 1114 rc = str; 1115 else 1116 *fLog << warn << "Entry " << res << " ambigous (was also found with less leading zeros)... ignored." << endl; 1117 } 1118 1119 return rc; 1120 } 1121 1122 // -------------------------------------------------------------------------- 1123 // 1092 1124 // If object to remove is fDisplay set fDisplay to NULL. 1093 1125 // If object to remove is fLog set fLog to NULL. -
trunk/MagicSoft/Mars/mbase/MParContainer.h
r9035 r9186 149 149 const char *GetEnvValue2(const TEnv &env, const TString &prefix, const TString &postfix, const char *dflt, Bool_t print=kFALSE) const; 150 150 151 TString GetEnvValue3(const TEnv &env, const TString &prefix, TString id, UInt_t num) const; 152 151 153 MParContainer *GetNewObject(const char *name, const char *base) const; 152 154 MParContainer *GetNewObject(const char *name, TClass *base=MParContainer::Class()) const; -
trunk/MagicSoft/Mars/mcorsika/MCorsikaEvtHeader.cc
r9182 r9186 37 37 38 38 #include "MMcEvt.hxx" 39 #include "MCorsikaRunHeader.h"40 39 41 40 ClassImp(MCorsikaEvtHeader); … … 78 77 // return FALSE if there is no header anymore, else TRUE 79 78 // 80 Int_t MCorsikaEvtHeader::ReadEvt(std::istream &fin , MCorsikaRunHeader &header)79 Int_t MCorsikaEvtHeader::ReadEvt(std::istream &fin) 81 80 { 82 81 char evth[4]; … … 125 124 fX = f[117]; 126 125 fY = -f[97]; 127 126 /* 128 127 if (fEvtNumber==1) 129 128 { … … 138 137 header.Print(); 139 138 } 140 139 */ 141 140 fin.seekg(1088-273*4, ios::cur); 142 141 -
trunk/MagicSoft/Mars/mcorsika/MCorsikaEvtHeader.h
r9182 r9186 13 13 //class ifstream; 14 14 #include <iosfwd> 15 16 class MCorsikaRunHeader;17 15 18 16 class MCorsikaEvtHeader : public MParContainer … … 57 55 Float_t GetY() const { return fY; } 58 56 59 Int_t ReadEvt(istream& fin, MCorsikaRunHeader &header); // read in event header block57 Int_t ReadEvt(istream& fin); // read in event header block 60 58 Bool_t ReadEvtEnd(istream& fin); // read in event end block 61 59 -
trunk/MagicSoft/Mars/mcorsika/MCorsikaRead.cc
r9182 r9186 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 1 2/2000<mailto:tbretz@astro.uni-wuerzburg.de>19 ! 20 ! Copyright: MAGIC Software Development, 2000-200718 ! Author(s): Thomas Bretz 11/2008 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! 20 ! Copyright: Software Development, 2000-2008 21 21 ! 22 22 ! … … 26 26 // 27 27 // MCorsikaRead 28 //29 // This tasks reads the raw binary file like specified in the TDAS???30 // and writes the data in the corresponding containers which are31 // either retrieved from the parameter list or created and added.32 //33 // Use SetInterleave() if you don't want to read all events, eg34 // SetInterleave(5) reads only each 5th event.35 28 // 36 29 // Input Containers: … … 38 31 // 39 32 // Output Containers: 40 // MCorsikaRunHeader, MCorsikaEvtHeader, MCorsikaEvtData, MCorsikaCrateArray, MCorsikaEvtTime 33 // MCorsikaRunHeader 34 // MCorsikaEvtHeader 35 // MPhotonEvent 41 36 // 42 37 ////////////////////////////////////////////////////////////////////////////// … … 51 46 #include "MLogManip.h" 52 47 53 //#include "MZlib.h"54 //#include "MTime.h"55 48 #include "MParList.h" 56 49 #include "MStatusDisplay.h" … … 59 52 #include "MCorsikaEvtHeader.h" 60 53 61 //#include "MPhotonData.h"62 54 #include "MPhotonEvent.h" 63 55 … … 103 95 // 104 96 MCorsikaRead::MCorsikaRead(const char *fname, const char *name, const char *title) 105 : fRunHeader(0), fEvtHeader(0), fEvent(0), fEvtData(0),fForceMode(kFALSE),97 : fRunHeader(0), fEvtHeader(0), fEvent(0), /*fEvtData(0),*/ fForceMode(kFALSE), 106 98 fFileNames(0), fNumFile(0), fNumEvents(0), fNumTotalEvents(0), 107 99 fIn(0), fParList(0) … … 212 204 213 205 const char *expname = gSystem->ExpandPathName(name); 214 fIn = new fstream(expname);206 fIn = new ifstream(expname); 215 207 216 208 const Bool_t noexist = !(*fIn); … … 245 237 if (!fRunHeader->ReadEvt(*fIn)) 246 238 return kERROR; 247 248 if (!(*fIn)) 249 { 250 *fLog << err << "Error: Accessing file '" << name << "'" << endl; 251 return kERROR; 252 } 239 // if (!fEvtHeader->ReadRunHeader(*fIn, *fRunHeader)) 240 // return kERROR; 253 241 254 242 const streampos pos = fIn->tellg(); 255 256 243 if (!ReadEvtEnd()) 257 244 return kERROR; 258 259 245 fIn->seekg(pos, ios::beg); 260 246 … … 267 253 // We print it after the first event was read because 268 254 // we still miss information which is stored in the event header?!? 269 //if (print)270 //fRunHeader->Print();255 if (print) 256 fRunHeader->Print(); 271 257 272 258 if (!fParList) … … 386 372 return kFALSE; 387 373 388 fEvtData = (MPhotonData*)pList->FindCreateObj("MPhotonData");389 if (!fEvtData)390 return kFALSE;391 392 374 fEvent = (MPhotonEvent*)pList->FindCreateObj("MPhotonEvent"); 393 375 if (!fEvent) 394 376 return kFALSE; 395 377 396 //*fLog << inf << "Maintaining " << fEvent->GetClassName() << " found in MCorsikaEvent." << endl;397 398 378 *fLog << inf << "Calculating number of total events..." << flush; 399 379 if (!CalcNumTotalEvents()) … … 419 399 // if there is no next event anymore stop eventloop 420 400 // 421 Int_t rc = fEvtHeader->ReadEvt(fin , *fRunHeader); //read event header block401 Int_t rc = fEvtHeader->ReadEvt(fin); //read event header block 422 402 if (!rc) 423 403 return kFALSE; -
trunk/MagicSoft/Mars/mcorsika/MCorsikaRead.h
r9182 r9186 12 12 class MCorsikaRunHeader; 13 13 class MCorsikaEvtHeader; 14 class MPhotonData;15 14 class MPhotonEvent; 16 15 … … 18 17 { 19 18 private: 20 MCorsikaRunHeader 21 MCorsikaEvtHeader 19 MCorsikaRunHeader *fRunHeader; // run header information container to fill from file 20 MCorsikaEvtHeader *fEvtHeader; // event header information container to fill from file 22 21 MPhotonEvent *fEvent; // event information 23 MPhotonData *fEvtData; // raw evt data information container to fill from file24 22 25 Bool_t fForceMode; // Force mode skipping defect events23 Bool_t fForceMode; // Force mode skipping defect RUNE 26 24 27 25 TList *fFileNames; // list of file names … … 30 28 UInt_t fNumTotalEvents; //! total number of events in all files 31 29 32 fstream*fIn; //! input stream (file to read from)30 ifstream *fIn; //! input stream (file to read from) 33 31 34 32 MParList *fParList; //! tasklist to call ReInit from -
trunk/MagicSoft/Mars/mcorsika/MCorsikaRunHeader.cc
r9182 r9186 170 170 fin.seekg(1020, ios::cur); // skip the remaining data of this block 171 171 172 return kTRUE; 172 // -------------------- Read first event header ------------------- 173 174 char evth[4]; 175 fin.read(evth, 4); 176 if (memcmp(evth, "EVTH", 4)) 177 { 178 *fLog << err << "ERROR - Wrong identifier: EVTH expected." << endl; 179 return kFALSE; 180 } 181 182 Float_t g[273]; 183 fin.read((char*)&g, 273*4); 184 if (fin.eof()) 185 return kFALSE; 186 187 fin.seekg(-274*4, ios::cur); 188 189 const Int_t n = TMath::Nint(g[96]); 190 if (n!=1) 191 { 192 *fLog << err << "ERROR - Currently only one impact parameter per event is supported." << endl; 193 return kFALSE; 194 } 195 196 //fImpactMax = g[86]; 197 198 fZdMin = g[79]; 199 fZdMax = g[80]; 200 fAzMin = 180-g[81]; 201 fAzMax = 180-g[82]; 202 203 fViewConeInnerAngle = g[151]; 204 fViewConeOuterAngle = g[152]; 205 206 return kTRUE;; 173 207 } 174 208 -
trunk/MagicSoft/Mars/mcorsika/MCorsikaRunHeader.h
r9182 r9186 33 33 Float_t fAzMax; // [rad] Azimuth (north=0; west=90) 34 34 35 //Float_t fImpactMax; // [cm] Maximum simulated impact 36 35 37 Float_t fViewConeInnerAngle; // [deg] 36 38 Float_t fViewConeOuterAngle; // [deg] … … 48 50 Float_t GetAzMax() const { return fAzMax; } 49 51 52 //Float_t GetImpactMax() const { return fImpactMax; } 53 54 Float_t GetViewConeOuterAngle() const { return fViewConeOuterAngle; } 55 50 56 UInt_t GetNumEvents() const { return fNumEvents; } 51 57 -
trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
r9036 r9186 224 224 // If no name is given we open the TFile in some kind of dummy mode... 225 225 // 226 if (!fname) 226 TString str(fname); 227 if (str.IsNull()) 227 228 { 228 229 fOut = new TFile("/dev/null", "READ", ftitle, comp); … … 231 232 } 232 233 233 TString str(fname);234 234 if (!str.EndsWith(".root", TString::kIgnoreCase)) 235 235 str += ".root"; -
trunk/MagicSoft/Mars/mhbase/MH.cc
r9153 r9186 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MH.cc,v 1.4 0 2008-11-11 11:42:13tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MH.cc,v 1.41 2008-12-02 11:22:15 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 352 352 y.SetTimeFormat(tfy); 353 353 #else 354 h->SetBins(bx.GetNumBins(), bx.GetEdges(), 355 by.GetNumBins(), by.GetEdges()); 354 if (h->InheritsFrom(TProfile2D::Class())) 355 { 356 h->SetBins(bx.GetNumBins(), 0, 1, 357 by.GetNumBins(), 0, 1); 358 359 h->SetBinsLength(); 360 361 x.Set(bx.GetNumBins(), bx.GetEdges()); 362 y.Set(by.GetNumBins(), by.GetEdges()); 363 } 364 else 365 h->SetBins(bx.GetNumBins(), bx.GetEdges(), 366 by.GetNumBins(), by.GetEdges()); 356 367 #endif 357 368 -
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r8988 r9186 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MHCamera.cc,v 1.1 09 2008-06-30 09:36:38tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MHCamera.cc,v 1.110 2008-12-02 11:22:19 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 363 363 } 364 364 365 UInt_t MHCamera::GetNumUsedSector(const TArrayI §or, const TArrayI &aidx) const 366 { 367 if (fNcells<=1) 368 return 0; 369 370 Int_t n=0; 371 372 for (int i=0; i<fNcells-2; i++) 373 { 374 if (!IsUsed(i) || !MatchSector(i, sector, aidx)) 375 continue; 376 377 if (TestBit(kProfile) && fBinEntries[i+1]==0) 378 continue; 379 n++; 380 } 381 382 // return Median of the profile data 383 return n; 384 } 385 365 386 // ------------------------------------------------------------------------ 366 387 // -
trunk/MagicSoft/Mars/mhist/MHCamera.h
r8988 r9186 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MHCamera.h,v 1.6 5 2008-06-30 09:36:38tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MHCamera.h,v 1.66 2008-12-02 11:22:19 tbretz Exp $ 3 3 \* ======================================================================== */ 4 4 #ifndef MARS_MHCamera … … 133 133 void SetUsed(Int_t idx) { SETBIT(fUsed[idx], kIsUsed); } 134 134 void SetAllUsed() { fUsed.Reset(BIT(kIsUsed)); } 135 136 UInt_t GetNumUsedSector(const TArrayI §or, const TArrayI &aidx) const; 137 UInt_t GetNumUsed() const { return GetNumUsedSector(TArrayI(), TArrayI()); } 138 UInt_t GetNumUsedSector(Int_t sector, Int_t aidx) const 139 { 140 return GetNumUsedSector(TArrayI(1, §or), TArrayI(1, &aidx)); 141 } 142 135 143 136 144 Int_t Fill(Axis_t x, Axis_t y, Stat_t w); -
trunk/MagicSoft/Mars/mjobs/MDataSet.cc
r9017 r9186 291 291 for (int i=0; i<num.GetSize(); i++) 292 292 { 293 const TString seqid = Form("Sequence%08d", num[i]); 294 295 TString name = GetEnvValue2(env, prefix, Form("%s.File", seqid.Data()), ""); 296 TString dir = GetEnvValue2(env, prefix, Form("%s.Dir", seqid.Data()), ""); 297 TString excl = GetEnvValue2(env, prefix, Form("%s.Exclude", seqid.Data()), ""); 293 TString name = GetEnvValue3(env, prefix, "Sequence%d.File", num[i]); 294 TString dir = GetEnvValue3(env, prefix, "Sequence%d.Dir", num[i]); 295 TString excl = GetEnvValue3(env, prefix, "Sequence%d.Exclude", num[i]); 298 296 299 297 // Set default sequence file and dir name -
trunk/MagicSoft/Mars/mjobs/MSequence.cc
r9057 r9186 300 300 TPRegexp regexp("([0-9]*:[0-9]+|[0-9]+(:[0-9]*)?)( +|$)"); 301 301 302 TString files = GetEnvValue 2(*env, prefix, Form("Run%08d", run), "");302 TString files = GetEnvValue3(*env, prefix, "Run%d", run); 303 303 if (files.IsNull()) 304 304 {
Note:
See TracChangeset
for help on using the changeset viewer.