本文整理汇总了C++中TChain::BuildIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ TChain::BuildIndex方法的具体用法?C++ TChain::BuildIndex怎么用?C++ TChain::BuildIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TChain
的用法示例。
在下文中一共展示了TChain::BuildIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sillyMacro
void sillyMacro(){
char headerName[1000];
char gpsName[1000];
char corName[1000];
RawAnitaHeader *header =0;
Adu5Pat *pat =0;
Adu5Pat *pat2 =0;
CorrelationSummaryAnita3 *cor=0;
TChain *gpsChain = new TChain("adu5PatTree");
TChain *gpsChain2 = new TChain("adu5PatTree");
TChain *headChain = new TChain("headTree");
TChain *corChain = new TChain("corTree");
for (unsigned int run=331;run<355;++run){
sprintf(headerName,"/unix/anita3/flight1415/root/run%d/timedHeadFile%d.root",run,run);
sprintf(gpsName,"/unix/anita3/flight1415/root/run%d/gpsEvent%d.root",run,run);
sprintf(corName, "/unix/anita3/linda/corTrees/corRun_NEW11_HPOL_%d.root", run);
headChain->Add(headerName);
gpsChain->Add(gpsName);
gpsChain2->Add(gpsName);
corChain->Add(corName);
}
headChain->SetBranchAddress("header",&header);
gpsChain->SetBranchAddress("pat",&pat);
gpsChain2->SetBranchAddress("pat",&pat2);
corChain->SetBranchAddress("cor",&cor);
UInt_t gps_eventNumber;
gpsChain->SetBranchAddress("eventNumber", &gps_eventNumber);
UInt_t gps2_eventNumber;
gpsChain2->SetBranchAddress("eventNumber", &gps2_eventNumber);
headChain->BuildIndex("header->eventNumber");
gpsChain->BuildIndex("eventNumber");
gpsChain2->BuildIndex("pat->realTime");
int maxEntry=corChain->GetEntries();
// AnitaPol::AnitaPol_t pol = AnitaPol::kHorizontal;
AnitaPol::AnitaPol_t pol = AnitaPol::kVertical;
Double_t sourceLat, sourceLon, sourceAlt, timeOffset;
char cpol[100];
Double_t phiWave, thetaWave, lower, upper;
Double_t maxCorrTime, deltaTExpected;
int ant1, ant2;
headChain->GetEntry(0);
double firstTS = header->triggerTime;
headChain->GetEntry(headChain->GetEntries()-1);
double lastTS = header->triggerTime;
Double_t additionalPhi = 22.5*TMath::DegToRad();
Double_t TwoPi = TMath::Pi()*2.;
// TH2D *h1 = new TH2D("h1", "", 100, firstTS, lastTS, 100, 0, 3600*24);
TH2D *h1 = new TH2D("h1", "", 100, firstTS, lastTS, 100, -49.5, 50.5);
TH1D *dHeading = new TH1D("dHeading", "", 100, -5, 5);
for(Long64_t entry=0;entry<maxEntry;++entry) {
corChain->GetEntry(entry);
Long64_t headEntry = headChain->GetEntryNumberWithIndex(cor->eventNumber);
if(headEntry < 0 ) continue;
headChain->GetEntry(headEntry);
Long64_t gpsEntry = gpsChain->GetEntryNumberWithIndex(cor->eventNumber);
if(gpsEntry < 0 ) continue;
gpsChain->GetEntry(gpsEntry);
Long64_t gpsEntry2 = gpsChain2->GetEntryNumberWithIndex(header->triggerTime);
if(gpsEntry2 < 0 ) continue;
gpsChain2->GetEntry(gpsEntry2);
if(gps_eventNumber!=gps2_eventNumber) cout << header->eventNumber << " " << gps2_eventNumber << endl;
// if ((header->triggerTime%(3600*24))!=(pat->timeOfDay/1e3)) cout << header->triggerTime%(3600*24) << " " << pat->timeOfDay/1e3 << endl;
double tday = (header->triggerTime%(3600*24));
h1->Fill(header->triggerTime, (tday - pat->timeOfDay/1e3) );
dHeading->Fill((pat->heading-pat2->heading));
}
h1->Draw("colz");
TCanvas *c1 = new TCanvas("c1");
gStyle->SetOptStat(1);
dHeading->SetTitle("Heading(eventNumber)-heading(realTime);Heading(eventNumber)-heading(realTime) [degrees];Number of events");
dHeading->Draw();
c1->Print("dheading.png");
}
示例2: fillArrays
void fillArrays(double *eventNumberIndex, double *thetaWaveIndex, double *phiWaveIndex, int *antIndex1, int *antIndex2, double *maxCorrTimeIndex, bool *adjacent){
// char headerName[FILENAME_MAX];
char gpsName[FILENAME_MAX];
char corName[FILENAME_MAX];
fGeomTool->useKurtAnita3Numbers(1);
// RawAnitaHeader *header =0;
Adu5Pat *pat =0;
CorrelationSummaryAnita3 *cor=0;
TChain *gpsChain = new TChain("adu5PatTree");
// TChain *headChain = new TChain("headTree");
TChain *corChain = new TChain("corTree");
for (unsigned int run=331;run<356;++run){
// sprintf(headerName,"/unix/anita3/flight1415/root/run%d/headFile%d.root",run,run);
// sprintf(headerName,"/unix/anita3/flight1415/root/run%d/timedHeadFile%d.root",run,run);
// sprintf(gpsName,"/unix/anita3/flight1415/root/run%d/gpsFile%d.root",run,run);
sprintf(gpsName,"/unix/anita3/flight1415/root/run%d/gpsEvent%d.root",run,run);
// sprintf(corName, "/unix/anita3/linda/corTrees/corRun_NEW6_HPOL_%d.root", run);
sprintf(corName, "/unix/anita3/linda/corTrees/corRun_NEW11_HPOL_%d.root", run);
// headChain->Add(headerName);
gpsChain->Add(gpsName);
corChain->Add(corName);
}
// headChain->SetBranchAddress("header",&header);
gpsChain->SetBranchAddress("pat",&pat);
corChain->SetBranchAddress("cor",&cor);
// headChain->BuildIndex("header->eventNumber");
// gpsChain->BuildIndex("pat->realTime");
gpsChain->BuildIndex("eventNumber");
int maxEntry=corChain->GetEntries();
AnitaPol::AnitaPol_t pol = AnitaPol::kHorizontal;
// AnitaPol::AnitaPol_t pol = AnitaPol::kVertical;
Double_t sourceLat, sourceLon, sourceAlt, timeOffset;
char cpol[100];
if (pol == AnitaPol::kVertical){
sourceLat = - (79 + (27.93728/60));
sourceLon = -(112 + (6.74974/60));
sourceAlt = 1813.42;
timeOffset = + 92.8;
// timeOffset = -99756.6;
sprintf(cpol, "VPOL");
}else{
sourceLat = - (79 + (27.94097/60));
sourceLon = -(112 + (6.76208/60));
sourceAlt = 1819.62;
timeOffset = + 92.8;
sprintf(cpol, "HPOL");
}
Double_t phiWave, thetaWave, lower, upper;
Double_t maxCorrTime, deltaTExpected;
int ant1, ant2;
int countIndex = 0;
int countNotsaved = 0;
bool save = false;
for (unsigned int ant=0;ant<MAX_ANTENNAS;++ant){
antPhi[ant] = fGeomTool->getAntPhiPositionRelToAftFore(ant, pol);
// meanPhi[ant] = fGeomTool->getAntPhiPosition(ant, pol);
}
Double_t additionalPhi = 22.5*TMath::DegToRad();//22.5*TMath::DegToRad();
Double_t TwoPi = TMath::Pi()*2.;
for(Long64_t entry=0;entry<maxEntry;++entry) {
save=false;
corChain->GetEntry(entry);
// Long64_t headEntry = headChain->GetEntryNumberWithIndex(cor->eventNumber);
// if(headEntry < 0 ) continue;
// headChain->GetEntry(headEntry);
// Long64_t gpsEntry = gpsChain->GetEntryNumberWithIndex(header->realTime);
Long64_t gpsEntry = gpsChain->GetEntryNumberWithIndex(cor->eventNumber);
if(gpsEntry < 0 ) continue;
gpsChain->GetEntry(gpsEntry);
//gpsChain->GetEntry(headEntry);
UsefulAdu5Pat usefulPat(pat);
usefulPat.getThetaAndPhiWave(sourceLon, sourceLat, sourceAlt, thetaWave, phiWave);
for(unsigned int corInd=0;corInd<NUM_CORRELATIONS_ANITA3;++corInd) {
//.........这里部分代码省略.........