本文整理汇总了C++中TObjArray::UncheckedAt方法的典型用法代码示例。如果您正苦于以下问题:C++ TObjArray::UncheckedAt方法的具体用法?C++ TObjArray::UncheckedAt怎么用?C++ TObjArray::UncheckedAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TObjArray
的用法示例。
在下文中一共展示了TObjArray::UncheckedAt方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Bool_t
RecoParamWithTPCDistortions(AliCDBManager *man) {
// check methods exist
if (!AliRecoParam::Class()->GetMethodAny("SuggestRunEventSpecie"))
return kFALSE;
if (!AliTPCRecoParam::Class()->GetMethodAny("GetUseCorrectionMap"))
return kFALSE;
// get event specie from GRP
AliCDBEntry *grpe = man->Get("GRP/GRP/Data");
if (!grpe) return kFALSE;
AliGRPObject *grp = (AliGRPObject *)grpe->GetObject();
AliRecoParam::EventSpecie_t evs = AliRecoParam::SuggestRunEventSpecie(grp->GetRunType(),
grp->GetBeamType(),
grp->GetLHCState());
// get TPC RecoParam for event specie
AliCDBEntry *pare = man->Get("TPC/Calib/RecoParam");
if (!pare) return kFALSE;
TObjArray *parl = (TObjArray *)pare->GetObject();
AliTPCRecoParam *par = NULL;
for (Int_t i = parl->GetEntriesFast(); i--;) {
AliTPCRecoParam *p = (AliTPCRecoParam *)parl->UncheckedAt(i);
if (!p || !(p->GetEventSpecie() & evs)) continue;
par = p;
break;
}
// check if use correction map
if (!par->GetUseCorrectionMap())
return kFALSE;
return kTRUE;
}
示例2: fixLeafOffsets
void Output::fixLeafOffsets( TBranch * b)
{
// recalculates the addresses for all the leaves.
//
// when constructing a branch with containing a variable length array with the index
// variable in the same branch it is not possible to specify the span of the index variable
// This span defaults to zero. When the addresses are asigned to the various leaves in the branch
// it calculates the size of the particular leaf (variable length array) in the buffer by looking
// at the span of the index variable - 0 in this case! using the method TLeaf::GetLen().
// The following code shoudl be applied to the branch after the spans of the index variables have been
// specified manually using the TLeaf::SetMaximum method. This time the GetLen method calculates the correct offset.
TObjArray * leaves = b->GetListOfLeaves();
char * addr = b->GetAddress();
int offset = 0;
int nleaves = leaves->GetEntriesFast();
// loop over the leaves:
for( int i =0; i < nleaves; ++i) {
TLeaf * leaf = (TLeaf *)leaves->UncheckedAt(i);
leaf->SetAddress( addr + offset );
int oldOffset = leaf->GetOffset();
leaf->SetOffset( offset );
//std::cout << " offset changed from : " << oldOffset << " to " << offset << std::endl;
TLeaf * index = leaf->GetLeafCount();
int nelements = 1;
if( index ) {
nelements = index->GetMaximum(); // deal with variable length arrays
} else {
nelements = leaf->GetLenStatic(); // deal with single variables and fixed length arrays
}
offset += leaf->GetLenType() * nelements;
}
}
示例3: ResetDeleteBranches
void ResetDeleteBranches(TTree* tree) {
TObjArray* branches = tree->GetListOfBranches();
Int_t nb = branches->GetEntriesFast();
for (Int_t i = 0; i < nb; ++i) {
TBranch* br = (TBranch*) branches->UncheckedAt(i);
if (br->InheritsFrom(TBranchElement::Class())) {
((TBranchElement*) br)->ResetDeleteObject();
}
}
}
示例4: classtype
void D3PDSelector::loadBranch(std::string key )
{
//std::cout << "Getting List Of Leaves" << std::endl;
TObjArray* leaves = fChain->GetListOfLeaves();
//std::cout << "Got List Of Leaves" << std::endl;
//std::cout << "key " << key << std::endl;
for (int c=0; c<leaves->GetSize(); c++)
{
TLeaf* leaf = (TLeaf*)leaves->UncheckedAt(c);
TLeafObject* leafobj = (TLeafObject*)leaf;
const char* curbraname = leafobj->GetName();
//std::cout << "Got Leave " << curbraname << std::endl;
if (strcmp(curbraname, key.c_str()) == 0)
{
const char* curtitle = leafobj->GetTypeName();
std::string classtype(leafobj->ClassName());
m_types[key] = std::string(curtitle);
void* address;
//if (m_types[key].find("<") == std::string::npos) //vector type? //old check
//TLeafElement means it's a pointer to an obect
//Else its a more primitve type (int, float etc)
if (classtype.find("TLeafElement") == std::string::npos)
{
void* tmpfl = (void* )(new double(0.)); //make sure enough space, so make doube
address = tmpfl;
}
else
{
void** tmp = new void*; //works 1
*tmp = 0;
address=tmp;
}
m_data[key] = (void**)address;
TBranch* cur_branch = 0;
m_branches[key] = cur_branch;
fChain->SetBranchAddress(key.c_str(), m_data[key] , &m_branches[key] );
//m_branches[key]->GetEntry(m_curentry); //Entry is loaded in loadData method
return;
}
}
//std::cout << "Got All List Of Leaves" << std::endl;
//std::cout << "key " << key << std::endl;
std::cout << "WARNING: Requested variable " << key << " not found. The program might crash now." << std::endl;
}
示例5: SetElectronContainerPrefix
void D3PDSelector::Init(TTree *tree)
{
// The Init() function is called when the selector needs to initialize
// a new tree or chain. Typically here the branch addresses and branch
// pointers of the tree will be set.
// It is normally not necessary to make changes to the generated
// code, but the routine can be extended by the user if needed.
// Init() will be called many times when running on PROOF
// (once per file to be processed).
// Set object pointer
// Set branch addresses and branch pointers
std::cout << "INIT" << std::endl;
SetElectronContainerPrefix("el");
SetMuonContainerPrefix("mu_staco");
SetJetContainerPrefix("jet_AntiKt4TopoNewEM");
// SetJetContainerPrefix("jet_AntiKt4TopoEM");
//SetPhotonContainerPrefix("ph");
//Reset intenral data structure to Branch Addresses
m_data.clear();
m_branches.clear();
m_types.clear();
if (!tree) return;
fChain = tree;
fChain->SetMakeClass(1);
TObjArray* leaves = tree->GetListOfLeaves();
for (int c=0; c<leaves->GetSize(); c++)
{
TLeaf* leaf = (TLeaf*)leaves->UncheckedAt(c);
TLeafObject* leafobj = (TLeafObject*)leaf;
//TLeafObject* curbra = (TLeafObject*)tor->At(c);
const char* curbraname = leafobj->GetName();
const char* curtitle = leafobj->GetTypeName();
//const char* classn = leafobj->ClassName();
if (m_verbose)
std::cout << curbraname << " " << /*curbraclassName <<" " << */curtitle << std::endl;
}
}
示例6: names
////////////////////////////////////////////////////////////
// names -- get the names of the branches and their details
SEXP RootChainManager::names() const {
// Advance to the first entry
//m_chain->GetEntry(0);
// Above commented out 20090616 - for TMBTrees this crashed root
// on an unresolved symbol for allocator<char>.
// Get the branches
TObjArray* branches = m_chain->GetListOfBranches();
// How many?
unsigned int nBranches = branches->GetEntriesFast();
// Make the R list for returning the list of branch and detail names
SEXP rBranchList, rBranchListNames;
PROTECT(rBranchList = NEW_LIST(nBranches));
PROTECT(rBranchListNames = NEW_CHARACTER(nBranches));
// Loop over the branches in the tree
for ( unsigned int branchIter = 0; branchIter < nBranches; ++branchIter ) {
// Get the branch
TBranch* branch = (TBranch*) branches->UncheckedAt(branchIter);
// Save away the name of this branch for use as an attribute
SET_STRING_ELT(rBranchListNames, branchIter, mkChar(branch->GetName()));
SEXP details = NEW_CHARACTER(1);
SET_ELEMENT(rBranchList, branchIter, details);
SET_STRING_ELT(details, 0, mkChar( branch->GetTitle() ) );
} // for over branches
// Set the names attribute
SET_NAMES(rBranchList, rBranchListNames);
// Release rBranchList and rBranchListNames
UNPROTECT(2);
return rBranchList;
}
示例7: getT0RecoParam
void getT0RecoParam(Int_t run)
{
// Read calibration coefficients into the Calibration DB
// Arguments:
AliCDBManager* man = AliCDBManager::Instance();
man->SetDefaultStorage("raw://");
// man->SetDefaultStorage("local:///home/alla/alice/Jul14/OCDB/");
man->SetRun(run);
AliCDBEntry *entry = AliCDBManager::Instance()->Get("T0/Calib/RecoParam");
AliT0RecoParam* recoParam = 0x0;
cout<<" entry "<< entry<<endl;
if(entry) {
// load recoParam according OCDB content (single or array)
// if (!(recoParam = dynamic_cast<AliT0RecoParam*>(entry->GetObject()))) {
TObjArray* recoParamArray = static_cast<TObjArray*>(entry->GetObject());
cout<<" TObjArray* recoParamArray "<<recoParamArray->GetEntriesFast()<<endl;
for(Int_t ie = 0; ie < recoParamArray->GetEntriesFast()-1; ie++) {
recoParam = static_cast<AliT0RecoParam*>(recoParamArray->UncheckedAt(ie));
cout<<ie<<endl;
cout<<" eq "<<recoParam->GetEq()<<endl;
// recoParam->Dump();
cout<<" cfd range "<<recoParam->GetLow(300)<<" amplitude "<<recoParam->GetLow(200)<<" "<<recoParam->GetHigh(200)<<endl;
for (int i=0; i<500; i++)
if( recoParam->GetLow(i) !=0) cout<<i<<" low "<<recoParam->GetLow(i)<<" "<<endl;
for (int i=0; i<500; i++)
if( recoParam->GetHigh(i) !=50000) cout<<i<<" high "<<recoParam->GetHigh(i)<<endl;
recoParam = 0x0;
}
}
else
cout<<" no entry "<<endl;
}
示例8: Example_tags
void Example_tags(TString topDir = "/star/rcf/GC/daq/tags")
{
//////////////////////////////////////////////////////////////////////////
// //
// Example_tags.C //
// //
// shows how to use the STAR tags files //
// Input: top level directory //
// //
// what it does: //
// 1. creates TChain from all tags files down from the topDir //
// 2. loops over all events in the chain //
// //
// owner: Alexandre V. Vaniachine <[email protected]> //
//////////////////////////////////////////////////////////////////////////
gSystem->Load("libTable");
gSystem->Load("St_base");
// start benchmarks
gBenchmark = new TBenchmark();
gBenchmark->Start("total");
// set loop optimization level
gROOT->ProcessLine(".O4");
// gather all files from the same top directory into one chain
// topDir must end with "/"
topDir +='/';
St_FileSet dirs(topDir);
St_DataSetIter next(&dirs,0);
St_DataSet *set = 0;
TChain chain("Tag");
while ( (set = next()) ) {
if (strcmp(set->GetTitle(),"file") ||
!(strstr(set->GetName(),".tags.root"))) continue;
chain.Add(gSystem->ConcatFileName(topDir,set->Path()));
}
UInt_t nEvents = chain->GetEntries();
cout<<"chained "<<nEvents<<" events "<<endl;
TObjArray *files = chain.GetListOfFiles();
UInt_t nFiles = files->GetEntriesFast();
cout << "chained " << nFiles << " files from " << topDir << endl;
TObjArray *leaves = chain.GetListOfLeaves();
Int_t nleaves = leaves->GetEntriesFast();
TString tableName = " ";
TObjArray *tagTable = new TObjArray;
Int_t tableCount = 0;
Int_t *tableIndex = new Int_t[nleaves];
Int_t tagCount = 0;
// decode tag table names
for (Int_t l=0;l<nleaves;l++) {
TLeaf *leaf = (TLeaf*)leaves->UncheckedAt(l);
tagCount+=leaf->GetNdata();
TBranch *branch = leaf->GetBranch();
// new tag table name
if ( strstr(branch->GetName(), tableName.Data()) == 0 ) {
tableName = branch->GetName();
// the tableName is encoded in the branch Name before the "."
tableName.Resize(tableName->Last('.'));
tagTable->AddLast(new TObjString(tableName.Data()));
tableCount++;
}
tableIndex[l]=tableCount-1;
}
cout << " tot num tables, tags = " << tableCount << " "
<< tagCount << endl << endl;
//EXAMPLE 1: how to print out names of all tags and values for first event
for (l=0;l<nleaves;l++) {
leaf = (TLeaf*)leaves->UncheckedAt(l);
branch = leaf->GetBranch();
branch->GetEntry();
// tag comment is in the title
TString Title = leaf->GetTitle();
Int_t dim = leaf->GetNdata();
if (dim==1) {
Title.ReplaceAll('['," '");
Title.ReplaceAll(']',"'");
}
cout << "\n Table: ";
cout.width(10);
cout << ((TObjString*)tagTable->UncheckedAt(tableIndex[l]))->GetString()
<<" -- has tag: " << Title << endl;
for (Int_t i=0;i<dim;i++) {
cout <<" "<< leaf->GetName();
if (dim>1) cout << '['<<i<<']';
cout << " = " << leaf->GetValue(i) << endl;
}
}
// EXAMPLE 2: how to make a plot
c1 = new TCanvas("c1","Beam-Gas Rejection",600,1000);
gStyle->SetMarkerStyle(8);
chain->Draw("n_trk_tpc[0]:n_trk_tpc[1]");
// EXAMPLE 3: how to make a selection (write selected event numbers on the plot)
//.........这里部分代码省略.........
示例9: clusters
//.........这里部分代码省略.........
TTree *cTree = rl->GetTreeR(detNames[i], false);
if (cTree == 0)
continue;
IlcTracker* tracker = reco->GetTracker(det);
if (tracker == 0) continue;
tracker->LoadClusters(cTree);
tracker->FillClusterArray(clarr);
}
// Loop over tracks and friends, tag used clusters.
for (Int_t n = 0; n < esd->GetNumberOfTracks(); ++n)
{
IlcESDtrack* at = esd->GetTrack(n);
Int_t idx[200];
for (Int_t i = 0; i < detN; ++i)
{
Int_t det = detIds[i];
IlcTracker* tracker = reco->GetTracker(det);
if (tracker == 0) continue;
Int_t nclusters = at->GetClusters(det, idx);
Int_t p=0;
for (Int_t c = 0; c < nclusters; )
{
Int_t index = idx[p++];
if (index < 0) continue;
c++;
IlcCluster* cluster = tracker->GetCluster(index);
if (cluster) cluster->IncreaseClusterUsage();
//else printf("Zero cluster pointer for detector: %s\n",detNames[i]);
}
}
}
for (Int_t i = 0; i < detN; ++i)
rl->UnloadRecPoints(detNames[i]);
// Fill visualization structs
TEveElementList* list = new TEveElementList("Clusters");
gEve->AddElement(list);
TEvePointSet* shared = new TEvePointSet("Shared Clusters");
shared->SetMainColor(2);
shared->SetMarkerSize(0.4);
shared->SetMarkerStyle(2);
list->AddElement(shared);
TEvePointSet* used = new TEvePointSet("Single-used Clusters");
used->SetMainColor(3);
used->SetMarkerSize(0.4);
used->SetMarkerStyle(2);
list->AddElement(used);
TEvePointSet* nonused = new TEvePointSet("Not-used Clusters");
nonused->SetMainColor(4);
nonused->SetMarkerSize(0.4);
nonused->SetMarkerStyle(2);
list->AddElement(nonused);
// Loop over all clusters, fill appropriate container based
// on shared/used information.
Int_t ncl = clarr->GetEntriesFast();
for (Int_t i = 0; i < ncl; ++i)
{
IlcCluster *cluster = (IlcCluster*) clarr->UncheckedAt(i);
TEvePointSet *dest = 0;
if (cluster->IsClusterShared())
dest = shared;
else if (cluster->IsClusterUsed())
dest = used;
else
dest = nonused;
Float_t g[3]; //global coordinates
cluster->GetGlobalXYZ(g);
dest->SetNextPoint(g[0], g[1], g[2]);
dest->SetPointId(cluster);
}
delete clarr;
// ??? What to do with trackers ???
// I'd propose: have global reconstruction that owns them.
// IlcEveEventManager::AssertIlcReconstruction();
// do we have bit-field for detectors, like
// enum IlcDetectors_e {
// kITS = BIT(0),
// kTPC = BIT(1),
// ...
// kCentralTracking = kITS | kTPC | kTRD | kTOF,
// ...
// };
gEve->Redraw3D();
}
示例10: UserAnalysis
//_________________________________________________________
void UserAnalysis()
{
// Debug a particular event.
Int_t eventToDebug = -1;
if (jsf->GetEventNumber() == eventToDebug) {
gDEBUG = kTRUE;
cerr << "------------------------------------------" << endl;
cerr << "Event " << jsf->GetEventNumber();
cerr << endl;
} else {
gDEBUG = kFALSE;
}
Char_t msg[60];
// Analysis starts here.
Float_t selid = -0.5;
hStat->Fill(++selid);
if ( Ngoods == 0 ) strcpy(&cutName[(Int_t)selid][0],"No cut");
// Get event buffer and make combined tracks accessible.
JSFSIMDST *sds = (JSFSIMDST*)jsf->FindModule("JSFSIMDST");
JSFSIMDSTBuf *evt = (JSFSIMDSTBuf*)sds->EventBuf();
Int_t ntrks = evt->GetNLTKCLTracks(); // No. of tracks
TObjArray *trks = evt->GetLTKCLTracks(); // combined tracks
ANL4DVector qsum;
TObjArray tracks(500);
tracks.SetOwner();
// Select good tracks
fNtracks = 0;
for ( Int_t i = 0; i < ntrks; i++ ) {
JSFLTKCLTrack *t = (JSFLTKCLTrack*)trks->UncheckedAt(i);
if ( t->GetE() > xEtrack ) {
ANL4DVector *qt = new ANL4DVector(t->GetPV());
tracks.Add(qt); // track 4-momentum
qsum += *qt; // total 4-momentum
fNtracks++;
} // *qt stays.
}
// Cut on No. of tracks.
hNtracks->Fill(fNtracks);
if ( fNtracks < xNtracks ) return;
hStat->Fill(++selid);
if ( Ngoods == 0 ) {
sprintf(msg,"N_tracks > %g",xNtracks);
strcpy(&cutName[(Int_t)selid][0],msg);
}
fEvis = qsum.E(); // E_vis
fPt = qsum.GetPt(); // P_t
fPl = qsum.Pz(); // P_l
// Cut on Evis.
hEvis->Fill(fEvis);
if ( fEvis < xEvis ) return;
hStat->Fill(++selid);
if ( Ngoods == 0 ) {
sprintf(msg,"E_vis > %g",xEvis);
strcpy(&cutName[(Int_t)selid][0],msg);
}
// Cut on Pt.
hPt->Fill(fPt);
if ( fPt < xPt ) return;
hStat->Fill(++selid);
if ( Ngoods == 0 ) {
sprintf(msg,"Pt > %g",xPt);
strcpy(&cutName[(Int_t)selid][0],msg);
}
// Cut on Pl.
if ( TMath::Abs(fPl) > xPl ) return;
hStat->Fill(++selid);
if ( Ngoods == 0 ) {
sprintf(msg,"|Pl| <= %g",xPl);
strcpy(&cutName[(Int_t)selid][0],msg);
}
// Find jets.
fYcut = xYcut;
ANLJadeEJetFinder jclust(fYcut);
jclust.Initialize(tracks);
jclust.FindJets();
fYcut = jclust.GetYcut();
fNjets = jclust.GetNjets();
// Cut on No. of jets.
//.........这里部分代码省略.........
示例11: MakeADRecoParamEntry
void MakeADRecoParamEntry(AliRecoParam::EventSpecie_t defaultEventSpecie=AliRecoParam::kLowMult, const char *outputCDB = "local://$ALICE_ROOT/OCDB") {
//========================================================================
//
// Steering macro for AD reconstruction parameters
//
// Author: Michal Broz
//
//========================================================================
const char* macroname = "MakeADRecoParam.C";
// Activate CDB storage and load geometry from CDB
AliCDBManager* cdb = AliCDBManager::Instance();
cdb->SetDefaultStorage(outputCDB);
cdb->SetRun(0);
TObjArray *recoParamArray = new TObjArray();
{
AliADRecoParam * ADRecoParam = new AliADRecoParam;
ADRecoParam->SetEventSpecie(AliRecoParam::kCosmic);
ADRecoParam->SetStartClock(0);
ADRecoParam->SetEndClock(20);
ADRecoParam->SetNPreClocks(1);
ADRecoParam->SetNPostClocks(10);
ADRecoParam->SetTimeWindowBBALow(-2.5);
ADRecoParam->SetTimeWindowBBAUp(2.5);
ADRecoParam->SetTimeWindowBGALow(-4.0);
ADRecoParam->SetTimeWindowBGAUp(4.0);
ADRecoParam->SetTimeWindowBBCLow(-1.5);
ADRecoParam->SetTimeWindowBBCUp(1.5);
ADRecoParam->SetTimeWindowBGCLow(-2.0);
ADRecoParam->SetTimeWindowBGCUp(2.0);
ADRecoParam->SetAdcThresHold(5);
ADRecoParam->SetMaxResid(1.5);
ADRecoParam->SetResidRise(0.02);
recoParamArray->AddLast(ADRecoParam);
}
{
AliADRecoParam * ADRecoParam = new AliADRecoParam;
ADRecoParam->SetStartClock(0);
ADRecoParam->SetEndClock(20);
ADRecoParam->SetNPreClocks(1);
ADRecoParam->SetNPostClocks(10);
ADRecoParam->SetTimeWindowBBALow(-2.5);
ADRecoParam->SetTimeWindowBBAUp(2.5);
ADRecoParam->SetTimeWindowBGALow(-4.0);
ADRecoParam->SetTimeWindowBGAUp(4.0);
ADRecoParam->SetTimeWindowBBCLow(-1.5);
ADRecoParam->SetTimeWindowBBCUp(1.5);
ADRecoParam->SetTimeWindowBGCLow(-2.0);
ADRecoParam->SetTimeWindowBGCUp(2.0);
ADRecoParam->SetAdcThresHold(5);
ADRecoParam->SetMaxResid(1.5);
ADRecoParam->SetResidRise(0.02);
ADRecoParam->SetEventSpecie(AliRecoParam::kLowMult);
recoParamArray->AddLast(ADRecoParam);
}
{
AliADRecoParam * ADRecoParam = new AliADRecoParam;
ADRecoParam->SetStartClock(9);
ADRecoParam->SetEndClock(11);
ADRecoParam->SetNPostClocks(6);
ADRecoParam->SetTimeWindowBBALow(-2.5);
ADRecoParam->SetTimeWindowBBAUp(2.5);
ADRecoParam->SetTimeWindowBGALow(-4.0);
ADRecoParam->SetTimeWindowBGAUp(4.0);
ADRecoParam->SetTimeWindowBBCLow(-1.5);
ADRecoParam->SetTimeWindowBBCUp(1.5);
ADRecoParam->SetTimeWindowBGCLow(-2.0);
ADRecoParam->SetTimeWindowBGCUp(2.0);
ADRecoParam->SetAdcThresHold(5);
ADRecoParam->SetMaxResid(1.5);
ADRecoParam->SetResidRise(0.02);
ADRecoParam->SetEventSpecie(AliRecoParam::kHighMult);
recoParamArray->AddLast(ADRecoParam);
}
// Set the defaultEventSpecie
Bool_t defaultIsSet = kFALSE;
for(Int_t i =0; i < recoParamArray->GetEntriesFast(); i++) {
AliDetectorRecoParam *param = (AliDetectorRecoParam *)recoParamArray->UncheckedAt(i);
if (!param) continue;
if (defaultEventSpecie & param->GetEventSpecie()) {
param->SetAsDefault();
defaultIsSet = kTRUE;
}
}
if (!defaultIsSet) {
Error(macroname,"The default reconstruction parameters are not set! Exiting...");
return;
}
// save in CDB storage
AliCDBMetaData *md= new AliCDBMetaData();
md->SetResponsible("Michal Broz");
md->SetComment("Reconstruction parameters for AD");
md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
md->SetBeamPeriod(0);
//.........这里部分代码省略.........
示例12: AliTRDdisplayTracks
void AliTRDdisplayTracks(Int_t track=157)
{
c1 = new TCanvas( "RecPoints", "RecPoints Display", 10, 10, 710, 740);
c1->SetFillColor(1);
TView *v=new TView(1);
v->SetRange(-350.,-350.,-400.,350.,350.,400.); // full
// v->SetRange(0.,0.,0.,350.,350.,400.); // top right
// v->SetRange(-350.,0.,0.,0.,350.,400.); // top left
// v->SetRange(0.,-350.,0.,350.,0.,400.); // bottom right
// v->SetRange(-350.,-350.,0.,0.,0.,400.); // bottom left
// v->Side();
v->Top();
cerr<<"psi = "<<v->GetPsi()<<endl;
// Dynamically link some shared libs
if (gClassTable->GetID("AliRun") < 0) {
gROOT->LoadMacro("loadlibs.C");
loadlibs();
cout << "Loaded shared libraries" << endl;
}
// Load tracks
TFile *tf=TFile::Open("AliTRDtracks.root");
if (!tf->IsOpen()) {cerr<<"Can't open AliTRDtracks.root !\n"; return 3;}
TObjArray tarray(2000);
// tf->ls();
TTree *tracktree=(TTree*)tf->Get("TreeT0_TRD");
// tracktree->ls();
TBranch *tbranch=tracktree->GetBranch("tracks");
Int_t nentr=tracktree->GetEntries();
cerr<<"Found "<<nentr<<" entries in the track tree"<<endl;
for (Int_t i=0; i<nentr; i++) {
AliTRDtrack *iotrack=new AliTRDtrack;
tbranch->SetAddress(&iotrack);
tracktree->GetEvent(i);
tarray.AddLast(iotrack);
cerr<<"got track "<<i<<": index ="<<iotrack->GetLabel()<<endl;
}
tf->Close();
// Load clusters
Char_t *alifile = "TRDclusters.root";
Int_t nEvent = 0;
TObjArray rparray(2000);
TObjArray *RecPointsArray = &rparray;
const TFile *geofile =TFile::Open(alifile);
// AliTRDtracker *Tracker = new AliTRDtracker("dummy","dummy");
AliTRDtracker *Tracker = new AliTRDtracker(geofile);
Tracker->ReadClusters(RecPointsArray,alifile);
Int_t nRecPoints = RecPointsArray->GetEntriesFast();
cerr<<"Found "<<nRecPoints<<" rec. points"<<endl;
// Connect the AliRoot file containing Geometry, Kine, Hits, and Digits
alifile = "galice.root";
TFile *gafl = (TFile*) gROOT->GetListOfFiles()->FindObject(alifile);
if (!gafl) {
cout << "Open the ALIROOT-file " << alifile << endl;
gafl = new TFile(alifile);
}
else {
cout << alifile << " is already open" << endl;
}
// Get AliRun object from file or create it if not on file
gAlice = (AliRun*) gafl->Get("gAlice");
if (gAlice)
cout << "AliRun object found on file" << endl;
else
gAlice = new AliRun("gAlice","Alice test program");
AliTRDparameter *par = ( AliTRDparameter *par) gafl->Get("TRDparameter");
AliTRDv1 *TRD = (AliTRDv1*) gAlice->GetDetector("TRD");
AliTRDgeometry *fGeom = TRD->GetGeometry();
Int_t i,j,index,det,sector, ti[3];
Double_t x,y,z, cs,sn,tmp;
Float_t global[3], local[3];
// Display all TRD RecPoints
TPolyMarker3D *pm = new TPolyMarker3D(nRecPoints);
for (Int_t i = 0; i < nRecPoints; i++) {
printf("\r point %d out of %d",i,nRecPoints);
AliTRDcluster *rp = (AliTRDcluster *) RecPointsArray->UncheckedAt(i);
Int_t idet=rp->GetDetector();
Int_t iplan = fGeom->GetPlane(idet);
Int_t itt=rp->GetLocalTimeBin();
Float_t timeSlice = itt+0.5;
Float_t time0 = par->GetTime0(iplan);
//.........这里部分代码省略.........
示例13: bfcread_tagsBranch
void bfcread_tagsBranch(
const char *MainFile="/afs/rhic.bnl.gov/star/data/samples/gstar.tags.root",
Int_t printEvent=1,
const char *fname="qa_tags.out",
Int_t fullPrint=0)
{
// start timer
TStopwatch timer;
timer.Start();
cout << endl << endl;
cout << " bfcread_tagsBranch.C: input file = " << MainFile << endl;
cout << " bfcread_tagsBranch.C: print event # " << printEvent << endl;
cout << " bfcread_tagsBranch.C: output file = " << fname << endl;
cout << " bfcread_tagsBranch.C: full printout = " << fullPrint << endl;
cout << endl;
ofstream fout(fname);
fout << endl << endl;
fout << " bfcread_tagsBranch.C: input file = " << MainFile << endl;
fout << " bfcread_tagsBranch.C: print evt# = " << printEvent << endl;
fout << " bfcread_tagsBranch.C: output file = " << fname << endl;
fout << " bfcread_tagsBranch.C: full printout = " << fullPrint << endl;
fout << endl;
TFile *file = TFile::Open(MainFile);
TTree *tree = (TTree*)file->Get("Tag");
cout <<" read file: " << file->GetName() << endl << endl;
Int_t nEntries = tree->GetEntries();
cout << " Total # events = " << nEntries << endl;
TObjArray *leaves = tree->GetListOfLeaves();
Int_t nLeaves = leaves->GetEntriesFast();
cout << " Total # leaves = " << nLeaves << endl;
TString *tName = new TString(" ");
TNamed *tableName=0;
TObjArray *tagTable = new TObjArray;
Int_t tableCount = 0;
Int_t *tableIndex = new Int_t[nLeaves];
Int_t tagCount = 0;
TBranch *branch=0;
TLeaf *leaf=0;
Int_t ndim =0;
//count number of tag tables encoded in the TTree branch names
for (Int_t l=0;l<nLeaves;l++) {
leaf = (TLeaf*)leaves->UncheckedAt(l);
tagCount+=leaf->GetNdata();
branch = leaf->GetBranch();
cout << "leaf # " << l << " br name = " <<
branch->GetName() << endl;
//new tag table name
if ( strstr(branch->GetName(), tName->Data()) == 0 ) {
tName = new TString(branch->GetName());
tName->Resize(tName->Index("."));
//the tableName is encoded in the branch Name before the "."
tableName = new TNamed(tName->Data(),"Tag");
tagTable->AddLast(tableName);
tableCount++;
}
tableIndex[l]=tableCount-1;
}
cout << endl << " Total num tables(branches),tags = "
<< tableCount << " " << tagCount << endl << endl;
Int_t *countTagsTable = new Int_t[tableCount];
Int_t *countLeavesTable = new Int_t[tableCount];
Float_t *sumTagsLeaf = new Float_t[nLeaves];
Int_t *countTagsLeaf = new Int_t[nLeaves];
// Now loop over leaves (to get values of tags)
Int_t setBranch = -1;
Int_t nowBranch = -1;
for (Int_t l=0;l<nLeaves;l++) {
leaf = (TLeaf*)leaves->UncheckedAt(l);
branch = leaf->GetBranch();
ndim = leaf->GetNdata();
nowBranch = tableIndex[l];
//cout << " nowbranch, setBranch = " <<
// nowBranch << ", "<< setBranch << endl;
Float_t RtableIndex=tableIndex[l];
if (nowBranch != setBranch){
setBranch=nowBranch;
cout << " QAInfo: branch ";
cout.width(2);
cout << tableIndex[l] << " = ";
//.........这里部分代码省略.........