- Timestamp:
- 05/08/15 12:32:23 (10 years ago)
- Location:
- branches/Corsika7405Compatibility
- Files:
-
- 4 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Corsika7405Compatibility/Makefile
r17980 r18179 78 78 mmovie \ 79 79 mtools \ 80 mmuon 80 mmuon \ 81 mdebug 81 82 82 83 LIBNOVA_PATH := `which libnovaconfig` -
branches/Corsika7405Compatibility/mbase/MQuaternion.h
r9564 r18179 9 9 #ifndef ROOT_TQuaternion 10 10 #include <math.h> 11 #define sqrt ::sqrt11 //#define sqrt ::sqrt 12 12 #include <TQuaternion.h> 13 13 #undef sqrt -
branches/Corsika7405Compatibility/mcorsika/MCorsikaFormat.cc
r10213 r18179 57 57 } 58 58 59 char *buffer = new char[ 5];60 memset(buffer, 0, 5);61 fileIn->read(buffer, 4);62 fileIn->seekg(- 4, ios::cur);59 char *buffer = new char[9]; 60 memset(buffer, 0, 9); 61 fileIn->read(buffer, 8); 62 fileIn->seekg(-8, ios::cur); 63 63 64 64 if (strcmp(buffer, "RUNH") == 0) … … 67 67 return new MCorsikaFormatRaw(fileIn); 68 68 } 69 69 else if(strcmp(&buffer[4], "RUNH") == 0) 70 { 71 fileIn->seekg(4, ios::cur); 72 delete [] buffer; 73 return new MCorsikaFormatRaw(fileIn, true); 74 } 70 75 if (*reinterpret_cast<unsigned int*>(buffer) == kSyncMarker) 71 76 { 77 //std::cout << "EventIO!!" << std::endl; 72 78 delete [] buffer; 73 79 return new MCorsikaFormatEventIO(fileIn); … … 84 90 Bool_t MCorsikaFormat::Read(void *ptr, Int_t i) const 85 91 { 92 //std::cout << "RawRead of " << i << " Bytes" << std::endl; 86 93 fIn->read((char*)ptr, i); 87 94 return !fIn->fail(); … … 114 121 Int_t & blockLength) const 115 122 { 116 123 //std::cout << "||||||| NextBlock " << std::endl; 117 124 int blockHeader; 118 125 fIn->read((char*)&blockHeader, 4); … … 120 127 return kFALSE; 121 128 129 122 130 blockVersion = 0; 123 131 blockIdentifier = 0; … … 134 142 case 1213486661 : // EVTH 135 143 if (readState != 10) 136 blockType = 1202;144 { blockType = 1202; } 137 145 else 138 146 { 139 147 blockType = 1105; 140 148 fIn->seekg(-4, ios::cur); 141 149 blockLength += 4; … … 159 167 for (int i=1; i<22; i++) 160 168 { 161 fIn->seekg(-i*273*4, ios::end); 169 if(fFortranRaw) 170 fIn->seekg(-i*273*4 - 4, ios::end); 171 else 172 fIn->seekg(-i*273*4, ios::end); 162 173 163 174 char runh[5]="\0\0\0\0"; … … 196 207 fIn->read((char*)blockHeader, 3 * sizeof(int)); 197 208 198 209 if (fIn->eof()) 199 210 return kFALSE; 200 211 … … 204 215 blockIdentifier = blockHeader[1]; 205 216 blockLength = blockHeader[2] & 0x3FFFFFFF; 217 218 std::cout << "ReadState " << readState << " | Type:" 219 << blockType << " Version:" << blockVersion << " Length:" << blockLength << " Id:" << blockIdentifier << std::endl; 220 206 221 } 207 222 else … … 210 225 fIn->read((char*)blockHeader, 4 * sizeof(int)); 211 226 212 227 if (fIn->eof()) 213 228 return kFALSE; 214 229 … … 218 233 blockIdentifier = blockHeader[2]; 219 234 blockLength = blockHeader[3] & 0x3FFFFFFF; 235 236 std::cout << "ReadState " << readState << " | Type:" 237 << blockType << " Version:" << blockVersion << " Length:" << blockLength << " Id:" << blockIdentifier << std::endl; 238 220 239 221 240 if (blockType == 1200 || blockType == 1210 || -
branches/Corsika7405Compatibility/mcorsika/MCorsikaFormat.h
r10213 r18179 17 17 protected: 18 18 std::istream *fIn; 19 20 Bool_t fMMCS = true; 19 21 20 22 public: … … 38 40 Bool_t Read(void *ptr, Int_t i) const; 39 41 42 40 43 static MCorsikaFormat *CorsikaFormatFactory(const char *fileName); 44 45 const Bool_t isMMCS() {return fMMCS;} 41 46 }; 42 47 … … 45 50 { 46 51 private: 52 Bool_t fFortranRaw = false; 47 53 48 54 public: 49 55 MCorsikaFormatRaw(std::istream * in) 50 56 : MCorsikaFormat(in) {} 57 MCorsikaFormatRaw(std::istream* in, Bool_t fortranRaw) 58 : MCorsikaFormat(in), fFortranRaw (fortranRaw) {} 51 59 52 60 Bool_t NextBlock(Int_t readState, Int_t & blockType, Int_t & blockVersion, -
branches/Corsika7405Compatibility/mcorsika/MCorsikaRead.cc
r14892 r18179 290 290 status = fInFormat->Read(buffer, 272 * sizeof(Float_t)); 291 291 status = fRunHeader->ReadEventHeader(buffer); 292 //std::cout << "\x1b[31;1m EVTH Header: \x1b[0m"; 293 //fRunHeader->Print(nullptr); 292 294 break; 293 295 } … … 329 331 Int_t MCorsikaRead::ReadTelescopePosition() 330 332 { 331 333 if (!fInFormat->Read(&fNumTelescopes, 4)) return kERROR; 332 334 333 335 if (fTelescopeIdx>=fNumTelescopes) … … 474 476 Int_t MCorsikaRead::Process() 475 477 { 478 //std::cout << "Process \n\n" << std::endl; 476 479 while (1) // loop for multiple input files 477 480 { 481 //std::cout << "OuterLoop \n\n" << std::endl; 482 478 483 if (fInFormat) 479 484 { … … 492 497 493 498 Int_t status = kTRUE; 499 500 //std::cout << "||||ReadState: " << fReadState 501 // << " Block: " << fBlockType << "\n\n" << std::endl; 502 494 503 switch (fBlockType) 495 504 { … … 500 509 501 510 case 1201: // telescope position 511 // std::cout << "TelescopPos ||||||" << std::endl; 502 512 status = ReadTelescopePosition(); 503 513 break; … … 505 515 case 1202: // the event header 506 516 Float_t buffer[272]; 517 static int asd = 0; 518 // std::cout << "EventHeader |||||| " << ++asd << std::endl; 507 519 if (!fInFormat->Read(buffer, 272 * sizeof(Float_t))) 508 520 return kFALSE; … … 511 523 { 512 524 fRunHeader->ReadEventHeader(buffer); 513 fRunHeader->Print();525 //fRunHeader->Print(); 514 526 } 515 527 516 528 status = fEvtHeader->ReadEvt(buffer); 529 530 //fEvtHeader->Print(); 531 //std::cout << "TotReuse: " << fEvtHeader->GetTotReuse(); 532 517 533 if (fArrayIdx >= (Int_t)fEvtHeader->GetTotReuse()) 518 534 { … … 527 543 528 544 case 1204: // top level block for one array (only for eventio data) 545 // std::cout << "EventIO1 |||||||" << std::endl; 529 546 if (fArrayIdx < 0 || fArrayIdx == fBlockIdentifier) 530 547 { … … 535 552 // skip this array of telescopes 536 553 fInFormat->Seek(fBlockLength); 537 554 std::cout << "Skip Array!" << std::endl; 538 555 break; 539 556 … … 541 558 case 1205: // eventio data 542 559 { 560 // std::cout << "EventIO2 |||||||" << std::endl; 543 561 Int_t telIdx = fBlockIdentifier % 1000; 544 if (fBlockVersion == 0 && 545 (fTelescopeIdx < 0 || fTelescopeIdx == telIdx) ) 546 { 562 // std::cout << "TelIDX: " << telIdx << " fTelescopeIdx:" << fTelescopeIdx 563 // << " fBlockVersion" << fBlockVersion << std::endl; 564 565 if (fBlockVersion == 0 && (fTelescopeIdx < 0 || fTelescopeIdx == telIdx) ) 566 { 547 567 status = fEvent->ReadEventIoEvt(fInFormat); 568 569 //std::cout << " ArrayIdx:" << fBlockIdentifier / 1000.0 << std::endl; 548 570 549 571 Int_t arrayIdx = fBlockIdentifier / 1000; … … 560 582 else 561 583 // skip this telescope 584 { 562 585 fInFormat->Seek(fBlockLength); 586 587 std::cout << "Skip this telescope!" << std::endl; 588 } 563 589 } 564 590 break; 565 591 566 592 case 1209: // the event end 593 // std::cout << "EventEnd ||||||" << std::endl; 567 594 status = fEvtHeader->ReadEvtEnd(fInFormat); 568 595 … … 581 608 582 609 case 1210: // the run end 610 //std::cout << "RunEnd ||||||" << std::endl; 583 611 status = fRunHeader->ReadEvtEnd(fInFormat, kTRUE); 584 612 fNumEvents += fRunHeader->GetNumEvents(); … … 594 622 595 623 case 1105: // event block of raw format 624 static int NmrEventBlock = 0; 625 //std::cout << "EventBlock ||||||" << ++NmrEventBlock << std::endl; 596 626 if (fReadState == 2 || fReadState == 10) 597 627 { … … 607 637 608 638 case 1109: // save corsika events 639 //std::cout << "SaveCorsika ||||||" << std::endl; 609 640 fEvtHeader->InitXY(); 610 641 status = fEvent->ReadCorsikaEvt(&fRawEvemtBuffer[0], … … 630 661 default: 631 662 // unknown block, we skip it 663 std::cout << "UnknownBlock " << fBlockType << std::endl; 632 664 fReadState = 15; 633 665 fInFormat->Seek(fBlockLength); 634 666 635 667 } 668 669 std::cout << "Status: " << status << std::endl; 636 670 637 671 if (status != kTRUE) … … 640 674 641 675 Int_t headerStatus = ReadNextBlockHeader(); 676 677 std::cout << "Header Status: " << headerStatus << std::endl; 678 679 642 680 if (headerStatus == kFALSE) 643 681 // end of file -
branches/Corsika7405Compatibility/mcorsika/MCorsikaRunHeader.cc
r10060 r18179 179 179 fCerenkovFlag = TMath::Nint(g[75]); 180 180 181 fZdMin = g[79]; // lower edge of theta in °182 fZdMax = g[80]; // upper edge of theta in °183 fAzMin = 180-g[81]; // lower edge of phi in °184 fAzMax = 180-g[82]; // upper edge of phi in °181 fZdMin = g[79]; // lower edge of theta in � 182 fZdMax = g[80]; // upper edge of theta in � 183 fAzMin = 180-g[81]; // lower edge of phi in � 184 fAzMax = 180-g[82]; // upper edge of phi in � 185 185 // FIXME: Correct for direction of magnetic field! 186 186 … … 207 207 fWavelengthMax = g[95]; // Cherenkov bandwidth upper end in nm 208 208 209 fViewConeInnerAngle = g[151]; // inner angle of view cone (°) 210 fViewConeOuterAngle = g[152]; // outer angle of view cone (°) 209 std::cout << "Version: " << fProgramVersion << std::endl; 210 std::cout << "Wavelength: " << fWavelengthMin << " - " << fWavelengthMax << std::endl; 211 if((abs(fWavelengthMax - 700)< 0.1) && (abs(fProgramVersion - 7.4005)< 1E-5)) fWavelengthMax = 900; 212 213 fViewConeInnerAngle = g[151]; // inner angle of view cone (�) 214 fViewConeOuterAngle = g[152]; // outer angle of view cone (�) 211 215 212 216 return kTRUE; -
branches/Corsika7405Compatibility/msim/MPhotonData.cc
r10060 r18179 273 273 Int_t MPhotonData::FillEventIO(Float_t f[8]) 274 274 { 275 275 // photons in this bunch 276 276 const UInt_t n = TMath::Nint(f[6]); 277 277 if (n==0) … … 292 292 fTag = -1; 293 293 fWeight = 1; 294 294 295 295 296 return n; -
branches/Corsika7405Compatibility/msim/MPhotonData.h
r9941 r18179 16 16 #ifndef ROOT_TQuaternion 17 17 #include <math.h> 18 #define sqrt ::sqrt18 //#define sqrt ::sqrt 19 19 #include <TQuaternion.h> 20 20 #undef sqrt -
branches/Corsika7405Compatibility/msim/MPhotonEvent.cc
r10167 r18179 512 512 fInFormat->Read(bunchHeader, 3 * sizeof(Int_t)); 513 513 514 515 //std::cout << "BunchHeader: " << bunchHeader[0] << " " 516 // << bunchHeader[1] << " " 517 // << bunchHeader[2] << std::endl; 518 514 519 Int_t n = 0; 515 520 … … 520 525 521 526 if (Add(n).FillEventIO(buffer)) 522 n++;527 n++; 523 528 } 524 529 -
branches/Corsika7405Compatibility/msimcamera/MSimAPD.cc
r17643 r18179 307 307 *fLog << err << "ERROR - MSimAPD: Weight of " << i << "-th photon not 1, but " << ph.GetWeight() << endl; 308 308 ph.Print(); 309 return kERROR;309 //return kERROR; 310 310 } 311 311
Note:
See TracChangeset
for help on using the changeset viewer.