当前位置: 首页>>代码示例>>C++>>正文


C++ TClonesArray::UncheckedAt方法代码示例

本文整理汇总了C++中TClonesArray::UncheckedAt方法的典型用法代码示例。如果您正苦于以下问题:C++ TClonesArray::UncheckedAt方法的具体用法?C++ TClonesArray::UncheckedAt怎么用?C++ TClonesArray::UncheckedAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TClonesArray的用法示例。


在下文中一共展示了TClonesArray::UncheckedAt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: renderHLTClusters

void renderHLTClusters(TTree* clustersTree)
{
    
    /**************************
     *  Visualization of Clusters
     **************************/
    const Int_t kMaxCl=100*160;
    Int_t fNColorBins = 5;
    
    TEvePointSet* clusters = new TEvePointSet(kMaxCl);
    clusters->SetOwnIds(kTRUE);
    
    TEvePointSetArray * cc = new TEvePointSetArray("TPC Clusters Colorized");
    cc->SetMainColor(kRed);
    cc->SetMarkerStyle(8);
    cc->SetMarkerSize(1.0);
    cc->InitBins("Cluster Charge", fNColorBins, 0., fNColorBins*60.);
    
    cc->GetBin(0)->SetMainColor(kGray);
    cc->GetBin(0)->SetMarkerSize(1.0);
    cc->GetBin(1)->SetMainColor(kBlue);
    cc->GetBin(1)->SetMarkerSize(1.0);
    cc->GetBin(2)->SetMainColor(kCyan);
    cc->GetBin(2)->SetMarkerSize(1.0);
    cc->GetBin(3)->SetMainColor(kGreen);
    cc->GetBin(3)->SetMarkerSize(1.0);
    cc->GetBin(4)->SetMainColor(kYellow);
    cc->GetBin(4)->SetMarkerSize(1.0);
    cc->GetBin(5)->SetMainColor(kRed);
    cc->GetBin(5)->SetMarkerSize(1.0);
    cc->GetBin(6)->SetMainColor(kMagenta);
    cc->GetBin(6)->SetMarkerSize(1.0);
    
    
    // Loop over clusters
    Int_t nentries = clustersTree->GetEntriesFast();
    
    AliTPCClustersRow *clrow = new AliTPCClustersRow();
    clrow->SetClass("AliTPCclusterMI");
    //clrow->SetArray(kMaxCl);
    clustersTree->SetBranchAddress("Segment", &clrow);
    
    for (Int_t i=0; i<nentries; i++) {
        if (!clustersTree->GetEvent(i)) continue;
        
        TClonesArray *cl = clrow->GetArray();
        Int_t ncl = cl->GetEntriesFast();
        
        while (ncl--)
        {
            AliTPCclusterMI* clusterMI = (AliTPCclusterMI*) cl->At(ncl);
            
            AliCluster *c = (AliCluster*) cl->UncheckedAt(ncl);
            Float_t g[3]; //global coordinates
            c->GetGlobalXYZ(g);
            cout<<g[0]<<"\t"<<g[1]<<"\t"<<g[2]<<endl;
            cc->Fill(g[0], g[1], g[2], clusterMI->GetQ());
            clusters->SetNextPoint(g[0], g[1], g[2]);
            AliCluster *atp = new AliCluster(*clusterMI);
            clusters->SetPointId(atp);
            
        }
        cl->Clear();
    }
    
//    delete clrow;
    
    clusters->SetName("TPC Clusters");
    clusters->SetTitle(Form("N=%d", clusters->Size()));
    
//    const TString viz_tag("REC Clusters TPC"); // to be changed
//    clusters->ApplyVizTag(viz_tag, "Clusters");
    
    cc->SetRnrSelf(kTRUE);
    
    gEve->AddElement(cc);
    
    return;
}
开发者ID:alisw,项目名称:AliRoot,代码行数:79,代码来源:tpc_raw.C

示例2: tpccfind

void tpccfind(Int_t threshold, Float_t thr = 2,
	      Int_t i1 = 2, Int_t i2 = 2, 
	      Int_t tharea =20, Int_t thmax=100)
{  
  ///////////////////////GRAPHICS//DECLARATION//////////////////////
  TCanvas  * c1 = new TCanvas("padcluster","Cluster finder 1",700,900);
  c1->cd();
  TCanvas  * c2 = new TCanvas("padcluster2","Cluster finder 2",700,900);
  c2->cd();
  c1->cd();
  TPad * pad11 = new TPad("pad11","",0.01,0.76,0.48,0.95,21);
  pad11->Draw();
  TPad * pad12 = new TPad("pad12","",0.51,0.76,0.95,0.95,21);
  pad12->Draw();
  TPad * pad21 = new TPad("pad21","",0.01,0.56,0.49,0.74,21);
  pad21->Draw();
  TPad * pad22 = new TPad("pad22","",0.51,0.56,0.95,0.74,21);
  pad22->Draw();
  TPad * pad31 = new TPad("pad31","",0.01,0.36,0.49,0.54,21);
  pad31->Draw();
  TPad * pad32 = new TPad("pad32","",0.51,0.36,0.95,0.54,21);
  pad32->Draw();
  TPad * pad41 = new TPad("pad41","",0.01,0.16,0.49,0.34,21);
  pad41->Draw();
  TPad * pad42 = new TPad("pad42","",0.51,0.16,0.95,0.34,21);
  pad42->Draw();

  c2->cd();
  TPad * pad11_2 = new TPad("pad11_2","",0.01,0.76,0.48,0.95,21);
  pad11_2->Draw();
  TPad * pad12_2 = new TPad("pad12_2","",0.51,0.76,0.95,0.95,21);
  pad12_2->Draw();
  /////////////////////HISTOGRAMS///DECLARATION///////////////////////
  pad11->cd();
  TH1F * hsx = new TH1F("hsx","Sigma of distribution in time",40,0,2);
  pad12->cd();
  TH1F * hsy = new TH1F("hsy","Sigma of distribution in pads",40,0,2);

  pad21->cd();
  TProfile * hsx2 = new TProfile("hsx2","Sigma of distribution in time",
			 20,100,500);
  pad22->cd();
  TProfile * hsy2 = new TProfile("hsy2","Sigma of distribution in pads",
			 20,100,500);

  pad31->cd();
  TH1F * harea = new TH1F("harea","Area of the peak",26,0,52);
  pad32->cd();
  TH1F * hmax = new TH1F("hmax","Maximal amplitude in peak",30,0,150);
 

  pad41->cd();  
  TProfile * harea2= new TProfile("harea2","Area dependence z coordinata",
			 20,100,500);
  pad42->cd();
  TProfile * hmax2 = new TProfile("hmax2","Maximal amplitude dependence",
			 20,100,500);
  pad41->cd();  

  pad11_2->cd();
  TProfile * harea2p= new TProfile("harea2p","Area dependence on pad coordinata",
			 20,0,100);
  pad12_2->cd();
  TProfile * hmax2p = new TProfile("hmax2p","Maximal amplitude dependence on pad",
			 20,0,50);
  //////////////////CALCULATION//////////////////////////////////////////

  for (Int_t k = i1;k <=i2; k++)
    {
      tpcanal(1,k,10,0,kFALSE);
      TClusterFinder * cf=new TClusterFinder(0,0,threshold,1);
      cf->GetHisto(&gtpc.GetHis1());
      TClonesArray * arr = cf->FindClusters();
      cf->Delete();
      Int_t size = arr->GetEntries();
      
      if ( size>0 )   
	for (Int_t i=0 ; i<size;i++)
	  {
	    Int_t index;
	    TCluster *c=(TCluster*)arr->UncheckedAt(i);
	    hsx->Fill(TMath::Sqrt(c.fSigmaX2));
	    hsy->Fill(TMath::Sqrt(c.fSigmaY2));    
	    if  (TMath::Sqrt(c.fSigmaX2)<thr)
	      hsx2->Fill(c.fX,TMath::Sqrt(c.fSigmaX2),1);
	    if  (TMath::Sqrt(c.fSigmaY2)<thr)
	      hsy2->Fill(c.fX,TMath::Sqrt(c.fSigmaY2),1);       
	    hmax->Fill(c.fMax);
	    harea->Fill(c.fArea);
	    if (c.fArea<tharea)  harea2->Fill(c.fX,c.fArea,1);
            if (c.fMax<thmax) hmax2->Fill(c.fX,c.fMax,1);
	    if (c.fArea<tharea)  harea2p->Fill(c.fY,c.fArea,1);
            if (c.fMax<thmax) hmax2p->Fill(c.fY,c.fMax,1);
	    
	  }
    } 
  gStyle->SetOptStat(1);
  pad11->cd();
  hsx->Draw();
  pad12->cd();
//.........这里部分代码省略.........
开发者ID:alisw,项目名称:AliRoot,代码行数:101,代码来源:diganal.C

示例3: MakeTRDFullMisAlignment

void MakeTRDFullMisAlignment(){
  // Create TClonesArray of full misalignment objects for TRD
  // Expects to read objects for FRAME
  // 
  TClonesArray *array = new TClonesArray("AliAlignObjParams",1000);
  const char* macroname = "MakeTRDFullMisAlignment.C";

  // Activate CDB storage and load geometry from CDB
  AliCDBManager* cdb = AliCDBManager::Instance();
  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  cdb->SetRun(0);
  
  AliCDBStorage* storage;
  TString Storage;
  
  if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){
    Storage = gSystem->Getenv("STORAGE");
    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
      return;
    }
    storage = cdb->GetStorage(Storage.Data());
    if(!storage){
      Error(macroname,"Unable to open storage %s\n",Storage.Data());
      return;
    }
    AliCDBPath path("GRP","Geometry","Data");
    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
    entry->SetOwner(0);
    TGeoManager* geom = (TGeoManager*) entry->GetObject();
    AliGeomManager::SetGeometry(geom);
  }else{
    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
  }    
		  
  // load FRAME full misalignment objects (if needed, the macro
  // for FRAME has to be ran in advance) and apply them to geometry
  AliCDBPath fpath("GRP","Align","Data");
  AliCDBEntry *eFrame;
  if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){
    Info(macroname,"Loading FRAME alignment objects from CDB storage %s",
      Storage.Data());
    eFrame = storage->Get(fpath.GetPath(),cdb->GetRun());
  }else{
    eFrame = cdb->Get(fpath.GetPath());
  }
  if(!eFrame) Fatal(macroname,"Could not get the specified CDB entry!");
  TClonesArray* arFrame = (TClonesArray*) eFrame->GetObject();
  arFrame->Sort();
  Int_t nvols = arFrame->GetEntriesFast();
  Bool_t flag = kTRUE;
  for(Int_t j=0; j<nvols; j++)
  {
    AliAlignObj* alobj = (AliAlignObj*) arFrame->UncheckedAt(j);
    if (alobj->ApplyToGeometry() == kFALSE) flag = kFALSE;
  }
  if(!flag) Fatal(macroname,"Error in the application of FRAME objects");

  // Sigmas for the chambers
  Double_t smdx    = 0.3; // 3 mm
  Double_t smdy    = 0.3; // 3 mm
  Double_t smdz    = 0.3; // 3 mm
  Double_t smrx    = 0.4 / 1000.0 / TMath::Pi()*180; // 0.4 mrad
  Double_t smry    = 2.0 / 1000.0 / TMath::Pi()*180; // 2.0 mrad
  Double_t smrz    = 0.4 / 1000.0 / TMath::Pi()*180; // 0.4 mrad
  // Truncation for the chambers
  Double_t cutSmdx = 3.0 * smdx;
  Double_t cutSmdy = 3.0 * smdy;
  Double_t cutSmdz = 3.0 * smdz;

  // Sigmas for the chambers
  Double_t chdx    = 0.05;  // 0.5 mm
  Double_t chdy    = 0.1;   // 1.0 mm
  Double_t chdz    = 0.007; // 70  microns
  Double_t chrx    = 0.0005 / 1000.0 / TMath::Pi()*180; // 0 mrad
  Double_t chry    = 0.0005 / 1000.0 / TMath::Pi()*180; // 0 mrad
  Double_t chrz    = 0.3    / 1000.0 / TMath::Pi()*180; // 0.3 mrad
  // Truncation for the chambers
  Double_t cutChdx = 1.0  * chdx;
  Double_t cutChdy = 1.0  * chdy;
  Double_t cutChdz = 0.14 * chdz;

  Int_t sActive[18]={1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1};
  Double_t dx,dy,dz,rx,ry,rz;

  Int_t j=0;
  UShort_t volid;
  const char *symname;

  // create the supermodules' alignment objects
  for (int iSect; iSect<18; iSect++) {
    TString sm_symname(Form("TRD/sm%02d",iSect));
    dx = AliMathBase::TruncatedGaus(0.0,smdx,cutSmdx); 
    dy = AliMathBase::TruncatedGaus(0.0,smdy,cutSmdy); 
    dz = AliMathBase::TruncatedGaus(0.0,smdz,cutSmdz); 
    rx = gRandom->Rndm() * 2.0*smrx - smrx;
    ry = gRandom->Rndm() * 2.0*smry - smry;
    rz = gRandom->Rndm() * 2.0*smrz - smrz;
    if( (TString(gSystem->Getenv("REALSETUP")) == TString("kTRUE")) && !sActive[iSect] ) continue;
//.........这里部分代码省略.........
开发者ID:alisw,项目名称:AliRoot,代码行数:101,代码来源:MakeTRDFullMisAlignment.C

示例4: MuMcPrVKFV2012


//.........这里部分代码省略.........
      int referenceMultiplicity = muEvent->refMult(); // get the reference multiplicity

      TClonesArray *PrimaryVertices   = muDst->primaryVertices();
      int nPrimaryVertices = PrimaryVertices->GetEntriesFast();

      TClonesArray *MuMcVertices   = muDst->mcArray(0);
      int nMuMcVertices = MuMcVertices->GetEntriesFast();

      TClonesArray *MuMcTracks     = muDst->mcArray(1);
      int nMuMcTracks = MuMcTracks->GetEntriesFast();

      if ( nevent >= 10 && ev % int(nevent*0.1) == 0 )
      {
         std::cout << "Event #" << ev << "\tRun\t" << muEvent->runId()
                   << "\tId: " << muEvent->eventId()
                   << " refMult= " << referenceMultiplicity
                   << "\tPrimaryVertices " << nPrimaryVertices
                   << "\t" << " " << nMuMcVertices
                   << "\t" << " " << nMuMcTracks
                   << std::endl;
      }

      //    const Double_t field = muEvent->magneticField()*kilogauss;
      if (! nMuMcVertices || ! nMuMcTracks || nPrimaryVertices <= 0) {
         std::cout << "Ev. " << ev << " has no MC information ==> skip it" << std::endl;
         std::cout << "OR no reconstructed verticies found" << std::endl;
         continue;
      }

      // Count number of MC tracks at a vertex with TPC reconstructable tracks
      std::multimap<int, int> Mc2McHitTracks;

      for (int m = 0; m < nMuMcTracks; m++) {
         StMuMcTrack *McTrack = (StMuMcTrack *) MuMcTracks->UncheckedAt(m);

         if (McTrack->No_tpc_hit() < 15) continue;

         Mc2McHitTracks.insert(std::pair<int, int>(McTrack->IdVx(), McTrack->Id()));
      }

      // This is the "reconstructable" track multiplicity
      int nMcTracksWithHits = Mc2McHitTracks.count(1);

      // Let's skip events in which we do not expect to reconstruct any tracks
      // (and thus vertex) from the primary vertex
      if (nMcTracksWithHits <= 0) continue;

      // This is our denominator histogram for efficiencies
      McRecMulT->Fill(nMcTracksWithHits);

      // =============  Build map between  Rc and Mc vertices
      std::map<StMuPrimaryVertex *, StMuMcVertex *> reco2McVertices;
      TArrayF vertexRanks(nPrimaryVertices);
      int mcMatchedVertexIndex  = -1; // any vertex with MC==1 and highest reconstrated multiplicity.
      int vertexMaxMultiplicity = -1;

      // First loop over all verticies in this event. There is at least one
      // must be available
      for (int recoVertexIndex = 0; recoVertexIndex < nPrimaryVertices; recoVertexIndex++)
      {
         vertexRanks[recoVertexIndex] = -1e10;

         StMuPrimaryVertex *recoVertex = (StMuPrimaryVertex *) PrimaryVertices->UncheckedAt(recoVertexIndex);

         if ( !AcceptVX(recoVertex) ) continue;
开发者ID:star-bnl,项目名称:star-travex,代码行数:66,代码来源:MuMcPrVKFV2012.C


注:本文中的TClonesArray::UncheckedAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。