本文整理汇总了C++中TObjArray::AddAtAndExpand方法的典型用法代码示例。如果您正苦于以下问题:C++ TObjArray::AddAtAndExpand方法的具体用法?C++ TObjArray::AddAtAndExpand怎么用?C++ TObjArray::AddAtAndExpand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TObjArray
的用法示例。
在下文中一共展示了TObjArray::AddAtAndExpand方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddHist
//_____________________________________________________
TLegendEntry* GFHistManager::AddHist(TH1* hist, Int_t layer, const char* legendTitle,
const char* legOpt)
{
// add hist to 'layer'th list of histos (expands, if layer does not already exist!)
if(!hist){
this->Warning("AddHist", "adding NULL pointer will be ignored!");
return NULL;
}
if(!this->CheckDepth("AddHist", layer)) return NULL;
GFHistArray* newHist = new GFHistArray;
newHist->Add(hist);
TObjArray* layerHistArrays = static_cast<TObjArray*>(fHistArrays->At(layer));
layerHistArrays->Add(newHist);
if(legendTitle){
TObjArray* legends = this->MakeLegends(layer);
TLegend* legend = new TLegend(fLegendX1, fLegendY1, fLegendX2, fLegendY2);
#if ROOT_VERSION_CODE < ROOT_VERSION(5,6,0)
if (TString(gStyle->GetName()) == "Plain") legend->SetBorderSize(1);
#endif
legends->AddAtAndExpand(legend, layerHistArrays->IndexOf(newHist));
return legend->AddEntry(hist, legendTitle, legOpt ? legOpt : fgLegendEntryOption.Data());
}
return NULL;
}
示例2: AddHistSame
//_____________________________________________________
TLegendEntry* GFHistManager::AddHistSame(TH1* hist, Int_t layer, Int_t histNum,
const char* legendTitle, const char* legOpt)
{
// adds hist to layer to draw it in the same pad as histNum's histo of that layer
if(!hist){
this->Warning("AddHistSame", "adding NULL pointer will be ignored!");
return NULL;
}
if (histNum > 0 && this->CheckDepth("AddHistSame", layer, kTRUE) //maybe added layer?
&& !this->GetHistsOf(layer, histNum-1)) {
this->Error("AddHistSame", "usage as AddHist only for next free histNum, not %d", histNum);
return NULL;
}
GFHistArray *histsArray = this->GetHistsOf(layer, histNum, kTRUE);// expand!
TLegendEntry* result = NULL;
if(histsArray) {
histsArray->Add(hist);
if(legendTitle && strlen(legendTitle)){
TObjArray* legends = this->MakeLegends(layer);
TLegend* legend = NULL;
if(legends->GetLast() >= histNum
&& legends->At(histNum)){
legend = static_cast<TLegend*>(legends->At(histNum));
} else {
legend = new TLegend(fLegendX1, fLegendY1, fLegendX2, fLegendY2);
#if ROOT_VERSION_CODE < ROOT_VERSION(5,6,0)
if (TString(gStyle->GetName()) == "Plain") legend->SetBorderSize(1);
#endif
legends->AddAtAndExpand(legend, histNum);
}
result = legend->AddEntry(hist,legendTitle, legOpt ? legOpt : fgLegendEntryOption.Data());
}
}
return result;
}
示例3: darklightcolor
///
/// Copied from TColor::GetColorDark(Int_t n), but customized
/// the 'darkness'.
///
int ColorBuilder::darklightcolor(int n, float scale)
{
if (n < 0) return -1;
// Get list of all defined colors
TObjArray *colors = (TObjArray*) gROOT->GetListOfColors();
Int_t ncolors = colors->GetSize();
// Get existing color at index n
TColor *color = 0;
if (n < ncolors) color = (TColor*)colors->At(n);
if (!color) return -1;
// Get the rgb of the the new dark color corresponding to color n
Float_t r,g,b;
TColor::HLStoRGB(color->GetHue(), scale*color->GetLight(), color->GetSaturation(), r, g, b);
// Build the dark color (unless the slot nd is already used)
Int_t nd = scale<1. ? n+100 : n+150;
TColor *colord = 0;
if (nd < ncolors) colord = (TColor*)colors->At(nd);
if (colord) return nd;
colord = new TColor(nd,r,g,b);
colord->SetName(scale<1. ? Form("%s_dark",color->GetName()) : Form("%s_light",color->GetName()));
colors->AddAtAndExpand(colord,nd);
return nd;
}
示例4: MakeQAThresholdsEntry
void MakeQAThresholdsEntry(const char* storageUri="local://$ALICE_ROOT/../AliRoot/OCDB", Int_t firstRun=0, Int_t lastRun=999999999)
{
AliCDBManager *cdb = AliCDBManager::Instance();
cdb->SetDefaultStorage(storageUri);
// QAThresholds
TObjArray* qaThrArray = new TObjArray();
for (Int_t idet = 0; idet < AliDAQ::kNDetectors; idet++){
TString detName = AliDAQ::OnlineName(idet);
if (detName == "TRI" || detName == "HLT" || detName == "TST") continue; // skipping TRI, HLT, TST since they do not produce QAThresholds
Printf("Processing QAThreshold for detector %s",detName.Data());
TString inFile(gSystem->ExpandPathName("$ALICE_ROOT/../AliRoot/GRP/ShuttleInput/"));
inFile += "run000168322_";
inFile += detName;
inFile += "_DQM_QAThresholds";
Printf("Opening QAThreshold file %s", inFile.Data());
TFile dqmFile(inFile.Data(),"READ");
if (dqmFile.IsOpen()) {
AliQAThresholds* qaThr = dynamic_cast<AliQAThresholds*>(dqmFile.Get(detName.Data()));
if (qaThr){
Int_t qaThrId = qaThr->GetDetectorId();
if (qaThrId != idet){
Printf("ERROR: Expecting QA threshold for detector %s, but found that for detector %s, skipping",detName.Data(), AliDAQ::OnlineName(qaThrId));
continue;
}
else{
qaThrArray->AddAtAndExpand(qaThr, qaThrId);
}
}
else {
Printf("ERROR: No QAThresholds object found in the file for detector %s, skipping",detName.Data());
continue;
}
}
else {
Printf("ERROR: Can't open QAThreshold file for detector %s, skipping",detName.Data());
continue;
}
}
if (qaThrArray->GetEntries() > 0){
AliCDBMetaData md;
md.SetResponsible("Barthélémy von Haller");
md.SetComment("QA Threshold TObjArray");
AliCDBId id("GRP/Calib/QAThresholds", firstRun, lastRun);
cdb->Put(qaThrArray, id, &md);
}
else{
Printf("No valid QAThresholds entries found, storing nothing in the OCDB");
}
}
示例5: MakeObjList
//________________________________________________________
TList* GFHistManager::MakeObjList(Int_t layer, Int_t histoNum)
{
// return list of objects to be drawn upon hists in pad histoNum of 'layer'
// (to be called if 'layer' really exist!)
if(!fObjLists) fObjLists = new TObjArray(fDepth);
if(layer > fObjLists->GetLast() || !fObjLists->At(layer)){
fObjLists->AddAtAndExpand(new TObjArray(this->GetNumHistsOf(layer)),layer);
}
TObjArray* layerLists = static_cast<TObjArray*>(fObjLists->At(layer));
if(histoNum > layerLists->GetLast() || !layerLists->At(histoNum)){
layerLists->AddAtAndExpand(new TList, histoNum);
}
return static_cast<TList*>(layerLists->At(histoNum));
}
示例6: while
const char *Next(int &kind,int &idx,double &exe,double &heap,double &free,double &inc) {
if(!inp) return 0;
kind=0;idx=0;exe=0;heap=0;free=0,inc=0;
TString ts;
char *endMaker,*clear,*ctr,*doPs,*fr,*to,*and;
while(fgets(line,500,inp)) {
doPs = strstr(line,"doPs for");
if (!doPs) continue;
endMaker = strstr(line,"EndMaker");
clear = strstr(line,"Clear");
ctr = strstr(line,"constructor");
kind = 0;
if (ctr ) kind = 1;
if (clear ) kind = 2;
if (endMaker) kind = 3;
if (!kind) continue;
fr = doPs+8 +strspn(doPs+8," \t");
to = strstr(fr,":");
ts = ""; ts.Append(fr,to-fr);
if (!ts.Length()) continue;
fr = strstr(fr,"total"); if (!fr) continue;
fr = strstr(fr,"=" ); if (!fr) continue;
exe = atof(fr+1);
fr = strstr(fr,"heap" ); if (!fr) continue;
fr = strstr(fr,"=" ); if (!fr) continue;
heap = atof(fr+1);
and = strstr(fr,"and");
if (and) free = atof(and+3);
fr = strstr(fr,"(" ); if (!fr) continue;
inc = atof(fr+1);
if (kind==1) continue;
TNamed *tn = (TNamed*)hash.FindObject(ts.Data());
if (!tn) {
tn = new TNamed(ts.Data(),"");
hash.Add(tn);
fNMakers++;
tn->SetUniqueID((UInt_t)fNMakers);
mArray.AddAtAndExpand(tn,fNMakers);
}
idx = tn->GetUniqueID();
return tn->GetName();
}
fclose(inp); inp = 0;
return 0;
}};
示例7: AddLegend
//_____________________________________________________
void GFHistManager::AddLegend(TLegend* leg, Int_t layer, Int_t histoNum)
{
// hist and layer must already exist
if(!this->CheckHistNum("AddLegend", layer, histoNum)) return;
TObjArray* legendsOfLayer = this->MakeLegends(layer);
TLegend* legend = (legendsOfLayer->GetSize() < histoNum ?
NULL : static_cast<TLegend*>(legendsOfLayer->At(histoNum)));
if(legend) {
this->Error("AddLegend", "legend exists, replacing it");
delete legend;
}
legend = leg;
legendsOfLayer->AddAtAndExpand(legend, histoNum);
if(layer < fCanArrays->GetEntriesFast()) {
this->Update(layer); // if canvas already drawn
}
}
示例8: CheckHistNum
//________________________________________________________
Bool_t GFHistManager::CheckHistNum(const char* method, Int_t layer,
Int_t histNum, Bool_t mayExpand)
{
// true if hist 'histNum' exists in 'layer'
// if(mayExpand == kTRUE) expands to this size if necessary! (default: kFALSE)
if(!this->CheckDepth(method, layer, mayExpand)) return kFALSE;
TObjArray * layerArr = static_cast<TObjArray*>(fHistArrays->At(layer));
if(histNum < 0) {
this->Warning("CheckHistNum", "histogram number %d requested!", histNum);
return kFALSE;
}
while(histNum >= layerArr->GetEntriesFast()){
if(mayExpand){
layerArr->AddAtAndExpand(new GFHistArray, layerArr->GetEntriesFast());
} else {
this->Warning("CheckHistNum", "layer %d has only %d histograms, number %d requested!",
layer, layerArr->GetEntriesFast(), histNum);
return kFALSE;
}
}
return kTRUE;
}
示例9: ProcessSummary
//.........这里部分代码省略.........
grSigAZ->SetName(Form("%s%s",prefs.Data(),"sigmaZan"));
grSigAZ->SetTitle(Form("%s%s",prefs.Data(),"#sigmaZ an"));
}
//
//
TGraphErrors * grSigPt = 0; // MC res. in pt
{
grSigPt = new TGraphErrors(nb);
grSigPt->SetName(Form("%s%s",prefs.Data(),"sigmaPt"));
grSigPt->SetTitle(Form("%s%s",prefs.Data(),"#sigmaPt"));
}
//
TGraphErrors * grSigAPt = 0; // analitycal res. in pt
{
grSigAPt = new TGraphErrors(nb);
grSigAPt->SetName(Form("%s%s",prefs.Data(),"sigmaPtan"));
grSigAPt->SetTitle(Form("%s%s",prefs.Data(),"#sigmaPt an"));
}
//
TGraphErrors * grEff = 0; // MC efficiency
{
grEff = new TGraphErrors(nb);
grEff->SetName(Form("%s_rate",prefs.Data()));
grEff->SetTitle(Form("%s Rate",prefs.Data()));
}
//
TGraphErrors * grUpd = 0; // number of Kalman track updates
{
grUpd = new TGraphErrors(nb);
grUpd->SetName(Form("%s_updCalls",prefs.Data()));
grUpd->SetTitle(Form("%s Updates",prefs.Data()));
}
//
for (int ib=0;ib<nb;ib++) {
sums = (TObjArray*) arrs->At(ib);
sm = (KMCTrackSummary*)sums->At(icl);
KMCProbe& prbRef = sm->GetRefProbe();
KMCProbe& prbAn = sm->GetAnProbe();
double pt = prbRef.Pt();
//
if (grSigAD) {
grSigAD->SetPoint(ib, pt,prbAn.GetSigmaY2()>0 ? TMath::Sqrt(prbAn.GetSigmaY2()) : 0.);
}
//
if (grSigAZ) {
grSigAZ->SetPoint(ib, pt,prbAn.GetSigmaZ2()>0 ? TMath::Sqrt(prbAn.GetSigmaZ2()) : 0.);
}
//
if (grSigAPt) {
double pts = TMath::Sqrt(prbAn.GetSigma1Pt2());
grSigAPt->SetPoint(ib, pt,pts>0 ? pts*pt : 0.);
}
//
if (grSigPt) {
h = sm->GetHMCSigPt();
h->Fit(gs,"0q");
grSigPt->SetPoint(ib, pt, gs->GetParameter(2));
grSigPt->SetPointError(ib, 0, gs->GetParError(2));
}
//
if (grSigD) {
h = sm->GetHMCSigDCARPhi();
h->Fit(gs,"0q");
grSigD->SetPoint(ib, pt,gs->GetParameter(2));
grSigD->SetPointError(ib, 0,gs->GetParError(2));
}
//
if (grSigZ) {
h = sm->GetHMCSigDCAZ();
h->Fit(gs,"0q");
grSigZ->SetPoint(ib, pt,gs->GetParameter(2));
grSigZ->SetPointError(ib, 0,gs->GetParError(2));
}
//
if (grEff) {
grEff->SetPoint(ib, pt,sm->GetEff());
grEff->SetPointError(ib, 0,sm->GetEffErr());
}
//
if (grUpd) {
grUpd->SetPoint(ib, pt,sm->GetUpdCalls());
grUpd->SetPointError(ib, 0, 0);
}
}
//
TObjArray* dest = new TObjArray();
dest->AddAtAndExpand(grSigAD,kSigAD);
dest->AddAtAndExpand(grSigAZ,kSigAZ);
dest->AddAtAndExpand(grSigAPt,kSigAPt);
dest->AddAtAndExpand(grSigD,kSigD);
dest->AddAtAndExpand(grSigZ,kSigZ);
dest->AddAtAndExpand(grSigPt,kSigPt);
dest->AddAtAndExpand(grEff,kEff);
dest->AddAtAndExpand(grUpd,kUpd);
//
if (!prefs.IsNull()) dest->SetName(pref);
return dest;
}
示例10: compClusHitsMod2
//.........这里部分代码省略.........
trOut->Branch("nRowPatt", &cSum.nRowPatt, "nRowPatt/I");
trOut->Branch("nColPatt", &cSum.nColPatt, "nColPatt/I");
TopDatabase DB;
for (Int_t iEvent = 0; iEvent < ntotev; iEvent++) {
printf("\n Event %i \n",iEvent);
runLoader->GetEvent(iEvent);
AliStack *stack = runLoader->Stack();
cluTree=dl->TreeR();
hitTree=dl->TreeH();
hitTree->SetBranchAddress("ITS",&hitList);
//
// read clusters
for (int ilr=nlr;ilr--;) {
TBranch* br = cluTree->GetBranch(Form("ITSRecPoints%d",ilr));
if (!br) {printf("Did not find cluster branch for lr %d\n",ilr); exit(1);}
br->SetAddress(its->GetLayerActive(ilr)->GetClustersAddress());
}
cluTree->GetEntry(0);
its->ProcessClusters();
//
// read hits
for(Int_t iEnt=0;iEnt<hitTree->GetEntries();iEnt++){//entries loop of the hits
hitTree->GetEntry(iEnt);
int nh = hitList->GetEntries();
for(Int_t iHit=0; iHit<nh;iHit++){
AliITSMFTHit *pHit = (AliITSMFTHit*)hitList->At(iHit);
int mcID = pHit->GetTrack();
//printf("MCid: %d %d %d Ch %d\n",iEnt,iHit, mcID, pHit->GetChip());
TClonesArray* harr = arrMCTracks.GetEntriesFast()>mcID ? (TClonesArray*)arrMCTracks.At(mcID) : 0;
if (!harr) {
harr = new TClonesArray("AliITSMFTHit"); // 1st encounter of the MC track
arrMCTracks.AddAtAndExpand(harr,mcID);
}
//
new ( (*harr)[harr->GetEntriesFast()] ) AliITSMFTHit(*pHit);
}
}
// return;
//
// compare clusters and hits
//
printf(" tree entries: %lld\n",cluTree->GetEntries());
//
for (int ilr=0;ilr<nlr;ilr++) {
AliITSURecoLayer* lr = its->GetLayerActive(ilr);
TClonesArray* clr = lr->GetClusters();
int nClu = clr->GetEntries();
//printf("Layer %d : %d clusters\n",ilr,nClu);
//
for (int icl=0;icl<nClu;icl++) {
AliITSMFTClusterPix *cl = (AliITSMFTClusterPix*)clr->At(icl);
int modID = cl->GetVolumeId();
//------------ check if this is a split cluster
int sInL = modID - gm->GetFirstChipIndex(ilr);
if (!cl->TestBit(kSplCheck)) {
cl->SetBit(kSplCheck);
// check if there is no other cluster with same label on this module
AliITSURecoSens* sens = lr->GetSensor(sInL);
int nclSn = sens->GetNClusters();
int offs = sens->GetFirstClusterId();
// printf("To check for %d (mod:%d) N=%d from %d\n",icl,modID,nclSn,offs);
for (int ics=0;ics<nclSn;ics++) {
AliITSMFTClusterPix* clusT = (AliITSMFTClusterPix*)lr->GetCluster(offs+ics); // access to clusters