本文整理汇总了C++中TObjArray::RemoveAt方法的典型用法代码示例。如果您正苦于以下问题:C++ TObjArray::RemoveAt方法的具体用法?C++ TObjArray::RemoveAt怎么用?C++ TObjArray::RemoveAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TObjArray
的用法示例。
在下文中一共展示了TObjArray::RemoveAt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitRun
void KVIVRawDataReconstructor::InitRun()
{
// Creates new ROOT file with TTree for reconstructed/calibrated events.
// By default this file will be written in the same data repository as the raw data file we are reading.
// This can be changed by setting the environment variable(s):
//
// Reconstruction.DataAnalysisTask.OutputRepository: [name of repository]
// [name of dataset].Reconstruction.DataAnalysisTask.OutputRepository: [name of repository]
//
// If no value is set for the current dataset (second variable), the value of the
// first variable will be used. If neither is defined, the new file will be written in the same repository as
// the raw file (if possible, i.e. if repository is not remote).
// Create new KVIVReconEvent used to reconstruct & store events
// The condition used to seed new reconstructed particles (see KVReconstructedEvent::AnalyseTelescopes)
// is set by reading the value of the environment variables:
// Reconstruction.DataAnalysisTask.ParticleSeedCond: [all/any]
// [name of dataset].Reconstruction.DataAnalysisTask.ParticleSeedCond: [all/any]
// If no value is set for the current dataset (second variable), the value of the
// first variable will be used.
if (!recev) recev = fIVevent = new KVIVReconEvent;
KVINDRARawDataReconstructor::InitRun();
//Remove the first branch 'INDRAReconEvent' of tree created by KVINDRARawDataReconstructor::InitRun()
//and replace it by new branch 'IVReconEvent' with a KVIVReconEvent object
TObjArray* branches = tree->GetListOfBranches();
delete branches->RemoveAt(0);
branches->Compress();
KVEvent::MakeEventBranch(tree, "IVReconEvent", "KVIVReconEvent", &fIVevent);
//Detector events for INDRA and VAMOS
fINDRADetEv = new KVDetectorEvent;
fVAMOSDetEv = new KVDetectorEvent;
//initialise number of reconstructed VAMOS events
fNbVAMOSrecon = 0;
}
示例2: mergeDigits
//.........这里部分代码省略.........
//const AliPHOSDigit *digit = prl->Digit(iDig);
AliPHOSDigit *digit = (AliPHOSDigit*)phosDigits->At(iDig);
nDigits++;
for (Int_t n = 0; n < nMyDigits; n++)
{
AliPHOSDigit *myDigit = (AliPHOSDigit*)mydigits->At(n);
if (digit->GetId() == myDigit->GetId())
{
nOverlappingDigits++;
break;
}
}
}
if(nOverlappingDigits == nMyDigits)
{
std::cout << "Digits alredy embedded!" << std::endl;
continue;
}
for (Int_t iDig = 0; iDig < nMyDigits; iDig++)
{
AliPHOSDigit *myDigit = (AliPHOSDigit*)mydigits->At(iDig);
if (myDigit)
{
for (Int_t n = 0; n < nPhosDigits; n++)
{
//const AliPHOSDigit *digit = prl->Digit(n);
AliPHOSDigit *digit = (AliPHOSDigit*)phosDigits->At(n);
if (digit->GetId() == myDigit->GetId())
{
digit->SetALTROSamplesHG(0, 0);
digit->SetALTROSamplesLG(0, 0);
*digit += *myDigit;
myDigit = 0;
break;
}
}
if (myDigit)
{
TClonesArray *digArray = prl->Digits();
AliPHOSDigit *newDig = new((*digArray)[nPhosDigits+nNewDigits]) AliPHOSDigit(*myDigit);
newDig->SetALTROSamplesHG(0, 0);
newDig->SetALTROSamplesLG(0, 0);
nNewDigits++;
}
}
}
phosDigits->Compress();
Int_t ndigits = phosDigits->GetEntries() ;
phosDigits->Sort();
// Remove digits that are flagged bad in BCM. Then remove digits that are below threshold
for (Int_t i = 0 ; i < ndigits ; i++)
{
AliPHOSDigit *digit = static_cast<AliPHOSDigit*>( phosDigits->At(i) ) ;
//std::cout << digit->GetId() << std::endl;
if(digit->GetId())
{
vector<Int_t>::iterator it;
it = std::find (badChannels.begin(), badChannels.end(), digit->GetId() );
if(*it)
{
digit->SetEnergy(0.0);
}
}
if(digit->GetEnergy() <= recoParam->GetGlobalAltroThreshold())
{
phosDigits->RemoveAt(i);
}
}
//Set indexes in list of digits and make true digitization of the energy
phosDigits->Compress();
phosDigits->Sort();
ndigits = phosDigits->GetEntries();
for (Int_t i = 0 ; i < ndigits ; i++)
{
AliPHOSDigit *digit = static_cast<AliPHOSDigit*>( phosDigits->At(i) ) ;
digit->SetIndexInList(i) ;
}
// -- create Digits branch
Int_t bufferSize = 32000 ;
TObjArray *branchList = prl->TreeD()->GetListOfBranches();
branchList->RemoveAt(0);
TBranch * digitsBranch = prl->TreeD()->Branch("PHOS","TClonesArray",&phosDigits,bufferSize);
digitsBranch->Fill() ;
prl->WriteDigits("OVERWRITE");
}
prl->WriteDigits("OVERWRITE");
std::cout << "# Digits: " << nDigits << std::endl;
std::cout << "# Embedded digits: " << nEmbedDigits << std::endl;
std::cout << "# Overlapping digits: " << nOverlappingDigits << std::endl;
std::cout << "# New digits: " << nNewDigits << std::endl;
return 0;
}
示例3: PlotPubHisto
void PlotPubHisto(TObjArray histograms,TEnv *params){
// This is a modification of the AddHistos macro
// Number of histos to plot:
Int_t ntot = histograms.GetEntries();
// Check we have what we expect (the order should be: data, qcd, wjets, etc...)
for(Int_t i = 0; i<ntot; i++){
if(histograms[i]==0) {
cout<<"Error in AddHistos: histogram "<<i<<" is a NULL pointer!"<<endl;
return;
}
TH1F * hthis = (TH1F*) histograms[i];
// include the overflow/underflow bins:
int numbins = hthis->GetNbinsX(); //this is the last bin plotted
double hicontent = hthis->GetBinContent(numbins);
double overflow = hthis->GetBinContent(numbins+1);// this bin contains the overflow
double locontent = hthis->GetBinContent(1);// this is the first bin plotted
double underflow = hthis->GetBinContent(0);// this bin contains the underflow
if (underflow>0 || overflow>0){
//printf("%-20s numbins=%4i hicontent=%4.2f over=%4.2f locontent=%4.2f underflow=%4.2f \n",
// title.Data(),numbins,hicontent,overflow,locontent,underflow);
}
hthis->SetBinContent(numbins,hicontent+overflow);
hthis->SetBinContent(1,locontent+underflow);
}
// define a few additional line styles:
gStyle->SetLineStyleString(5,"20 12 4 12");
gStyle->SetLineStyleString(6,"20 12 4 12 4 12 4 12");
gStyle->SetLineStyleString(7,"20 20");
gStyle->SetLineStyleString(8,"20 12 4 12 4 12");
gStyle->SetLineStyleString(9,"80 25");
gStyle->SetLineStyleString(10,"50 10 10 10");
gStyle->SetLineStyleString(17,"30 25");
gStyle->SetLineStyleString(20,"60 20");
gStyle->SetLineStyleString(21,"60 20 20 20");
int lineStyle[20];
for(int i=0;i<20;i++) {
lineStyle[i]=i;
}
// the first histogram in the list:
TH1F *h0=((TH1F*) histograms[0])->Clone();
// histogram output filename
TString oFileName=params->GetValue("Histo.Output.Filename","bogus.eps");
// figure out the number of signals
Int_t nsig=1;
if(params->Defined("Histo.Signal.Title.1")) nsig=1;
if(params->Defined("Histo.Signal.Title.2")) nsig=2;
if(params->Defined("Histo.Signal.Title.3")) nsig=3;
cout << " I will use nsig = " << nsig << " signal sources" << endl;
// Do the cumulative summing, except for the data
TObjArray addedhistos; addedhistos.Clear();
TObjArray signalhistos; signalhistos.Clear();
TString sampletitles[20];
Int_t nbkg=0;
for(Int_t i = 1; i<ntot; i++){// i runs over histograms[i], so data is for i=0
ostringstream baseSrcName;
baseSrcName << "Files." << i+1 << ".";// Counting starts at 1: Files.1.Name: Data
TString bSrcName(baseSrcName.str().c_str());
// skip some if we want to show them as lines
TString htitle=params->GetValue(bSrcName+"Title","");
sampletitles[i-1]=htitle;
if(params->GetValue("Histo.ShowSignalSeparately",0)==1 &&
// skip the last two if the signal title is not defined:
( ( !(params->Defined("Histo.Signal.Title")||params->Defined("Histo.Signal.Title.1")) && i>=ntot-nsig)
// skip the signal if the signal title is defined
|| params->GetValue("Histo.Signal.Title",".")==htitle
|| params->GetValue("Histo.Signal.Title.1",".")==htitle
|| params->GetValue("Histo.Signal.Title.2",".")==htitle
|| params->GetValue("Histo.Signal.Title.3",".")==htitle
) ) {
TH1F * hthis = (TH1F*) histograms[i]->Clone();
cout<<" Found signal in location "<<i+1<<" with name "<<htitle.Data()<<endl;
signalhistos.Add(hthis);
} else {
TH1F * hthis = (TH1F*) histograms[i]->Clone();
addedhistos.Add(hthis); // Fill in the new TObjArray with a copy
//cout << " Adding bkg " << i << " " << htitle.Data() << " " << hthis->Integral() << endl;
// add all of the backgrounds
if (i>1) {// i=0 is the data, and we must start with the second
// background to add the previous
TH1F * hprevious = (TH1F*) addedhistos[i-2];
if ( hthis->GetXaxis()->GetNbins() != hprevious->GetXaxis()->GetNbins() ) {
// Protection against _whoran histogram.
// We cannot add two histograms with different numbers of bins!
cout<<"Error in AddHistos: incompatible number of bins!"<<endl;
return;
}
hthis->Add(hprevious); // Do the addition
addedhistos.RemoveAt(i-1); // And substitute whatever we had
addedhistos.AddAt(hthis,i-1);
nbkg++;
//cout << "Substituing bkg " << i << " + " << i-1 << " in addedhistos["<< i-1 <<"]" << endl;
}
//.........这里部分代码省略.........