ARA ROOT Test BEd Software

AraCorrelator/makeCorrelationMaps.cxx

00001 #include <iostream>
00002 #include <libgen.h>
00003 
00004 #include "TTree.h"
00005 #include "TFile.h"
00006 #include "TSystem.h"
00007 #include "TH2.h"
00008 
00009 #include "RawIcrrStationEvent.h"  
00010 #include "UsefulIcrrStationEvent.h"
00011 #include "AraEventCorrelator.h"
00012 
00013 
00014 
00015 int main(int argc, char **argv)
00016 {
00017   if(argc<3) {
00018     std::cout << "Usage " << basename(argv[0]) << " <input file> <output file>" << std::endl;
00019     return -1;
00020   }
00021 
00022   TFile *fpIn = new TFile(argv[1],"OLD");
00023   if(!fpIn) {
00024     std::cerr << "Can not open " << argv[1] << "\n";
00025     return -1;
00026   }
00027   TTree *eventTree = (TTree*) fpIn->Get("eventTree");
00028   if(!eventTree) {
00029     std::cerr << "Can't get eventTree\n";
00030     return -1;
00031   }
00032   RawIcrrStationEvent *rawEvPtr=0;
00033   eventTree->SetBranchAddress("event",&rawEvPtr);
00034   
00035   TFile *fpOut = new TFile(argv[2],"RECREATE");
00036   if(!fpOut) {
00037     std::cout << "Can not open " << argv[2] << "\n";
00038     return -1;
00039   }
00040   
00041   AraEventCorrelator *theCorrelator = AraEventCorrelator::Instance();
00042   //theCorrelator->fDebugMode=1;
00043 
00044   char histName[180];
00045   for(int i=0;i<50;i++) {
00046     eventTree->GetEvent(i);
00047     fpOut->cd();
00048     UsefulIcrrStationEvent usefulEvent(rawEvPtr,AraCalType::kFirstCalib);
00049     TH2D *histMap = theCorrelator->getInterferometricMap(&usefulEvent,AraAntPol::kVertical);
00050     sprintf(histName,"vmap%d",i);
00051     histMap->SetName(histName);
00052     TH2D *histMap2 = theCorrelator->getInterferometricMap(&usefulEvent,AraAntPol::kHorizontal);
00053     sprintf(histName,"hmap%d",i);
00054     histMap2->SetName(histName);
00055     //histMap->Write();
00056     //histMap2->Write();
00057   }
00058   fpOut->Close();
00059 
00060 
00061 }
00062 

Generated on Wed Aug 8 16:20:07 2012 for ARA ROOT Test Bed Software by doxygen 1.4.7