本文整理汇总了C++中TClonesArray::Sort方法的典型用法代码示例。如果您正苦于以下问题:C++ TClonesArray::Sort方法的具体用法?C++ TClonesArray::Sort怎么用?C++ TClonesArray::Sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TClonesArray
的用法示例。
在下文中一共展示了TClonesArray::Sort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
//.........这里部分代码省略.........
示例2: mergeDigits
int mergeDigits(TString digitdir, Int_t /*simEvOffset*/)
{
AliRunLoader *rl = AliRunLoader::Open(digitdir+TString("/galice.root"));
AliPHOSLoader *prl = (AliPHOSLoader*)rl->GetDetectorLoader("PHOS");
prl->LoadDigits("UPDATE");
//prl->LoadDigits();
Int_t nEvents = rl->GetNumberOfEvents();
TClonesArray *mydigits = 0;
simTree->SetBranchAddress("Digits", &mydigits);
Int_t nDigits = 0;
Int_t nEmbedDigits = 0;
Int_t nOverlappingDigits = 0;
Int_t nNewDigits = 0;
Int_t nPhosDigits = prl->Digits()->GetEntries();
Int_t nMyEvents = simTree->GetEntries();
std::cout << "Number of real events: " << nEvents << std::endl;
std::cout << "Number of sim events: " << nMyEvents << std::endl;
nEvents = TMath::Min(nEvents, nMyEvents);
std::cout << "Looping over: " << nEvents << std::endl;
for (Int_t ev = 0; ev < nEvents; ev++)
{
rl->GetEvent(ev);
simTree->GetEntry(ev);
Int_t nMyDigits = mydigits->GetEntries();
//Int_t nDigsFound = 0;
nEmbedDigits += nMyDigits;
TClonesArray *phosDigits = prl->Digits();
nPhosDigits = prl->Digits()->GetEntries();
for (Int_t iDig = 0; iDig < nPhosDigits; iDig++)
{
//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) ) ;
//.........这里部分代码省略.........