/**************************************************************************** * Very important, delicate and rather obscure macro. * * * * Creates list of "trackable" tracks, * * calculates efficiency, resolutions etc. * * There is a possibility to run this macro over several events. * * * * Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch * * with several nice improvements by: M.Ivanov, GSI, m.ivanov@gsi.de * ****************************************************************************/ #if defined(__CINT__) && !defined(__MAKECINT__) { gSystem->AddIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT -I$ALICE_ROOT/TPC -I$ALICE/geant3/TGeant3 -I$ALICE_ROOT/HLT/TPCLib/HWCFemulator -I$ALICE_ROOT/HLT/TPCLib -I$ALICE_ROOT/HLT/BASE "); AliHLTPluginBase::GetInstance()->LoadComponentLibraries("libAliHLTTPC.so"); gROOT->LoadMacro("ClusterMergerQA.C++"); runTest("NoMerge/TPC.RecPoints.root"); } #else #include #include #include #include #include #include #include #include #include #include #include #include #include #include "TString.h" #include "AliTPCclusterMI.h" #include "AliStack.h" #include "AliHeader.h" #include "AliTrackReference.h" #include "AliRunLoader.h" #include "AliRun.h" #include "AliTPCtrack.h" #include "AliTracker.h" #include "AliTPC.h" #include "AliTPCClustersArray.h" #include "AliTPCClustersRow.h" #include "AliTPCcluster.h" #include "AliTPCLoader.h" #include "TParticlePDG.h" #include "TDatabasePDG.h" #include "AliGeomManager.h" #include #include #include "AliCDBManager.h" #include "AliHLTTPCHWClusterMerger.h" #include "AliHLTTPCTransform.h" extern AliRun *gAlice; extern TROOT *gROOT; void myDraw(TH1F *h) { Int_t minc=33; if (h->GetEntries()Draw(); else h->Fit("gaus","Q"); } Int_t runTest(const char *recPointsName ) { // access clusters //const Char_t* recPointsName = "NoMerge/TPC.RecPoints.root"; AliRunLoader *rl = AliRunLoader::Open("galice.root","COMPARISON"); if (!rl) return 1; rl->LoadgAlice(); rl->LoadHeader(); AliCDBManager *man=AliCDBManager::Instance(); man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); //man->SetDefaultStorage("local:///lustre/alice/alien/alice/simulation/2008/v4-15-Release/Residual/"); man->SetSpecificStorage("GRP/GRP/Data", Form("local://%s",gSystem->pwd())); man->SetRun(0); //man->SetRun(137366); if(AliGeomManager::GetGeometry()==NULL){ AliGeomManager::LoadGeometry(); } AliGeomManager::ApplyAlignObjsFromCDB("TPC"); //TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 1., 1., AliMagF::k5kG, AliMagF::kBeamTypeAA, 1300.)); TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 1., 1., AliMagF::k5kG)); // Check field if (!TGeoGlobalMagField::Instance()) { ::Error("","magnetic field not initialized, please set up TGeoGlobalMagField and AliMagF"); return 1; } Int_t nev=rl->GetNumberOfEvents(); // ******* Loop over events ********* AliMagF *field = (AliMagF*)TGeoGlobalMagField::Instance()->GetField(); if(! field) { ::Error("","No mag. field found!!!"); return 1; } AliHLTTPCHWClusterMerger merger; merger.Init(); int statNGood=0, statNMerged=0; //nev = 1; // ******** Loop over generated events for (Int_t nEv=0; nEv vClusters; // Read clusters { rl->GetEvent(nEv); TFile* file = new TFile(recPointsName, "READ"); { TString str = "Event"; str+= nEv; file->cd(str.Data()); } TTree* tRecPoints = dynamic_cast (gDirectory->Get("TreeR")); AliTPCClustersRow *row = new AliTPCClustersRow(); tRecPoints->GetBranch("Segment")->SetAddress(&row); for (Int_t iRow = 0; iRow < tRecPoints->GetEntriesFast(); iRow++) { tRecPoints->GetEntry(iRow); for (Int_t nCl = 0; nCl < row->GetArray()->GetEntriesFast(); nCl++){ AliTPCclusterMI * cl = static_cast (row->GetArray()->UncheckedAt(nCl)); int slice=-1, padRow=-1; if( !AliHLTTPCTransform::Sector2Slice(slice, padRow, cl->GetDetector(), cl->GetRow() ) ) continue; int patch = AliHLTTPCTransform::GetPatch(padRow); padRow -=AliHLTTPCTransform::GetFirstRow(patch); double yW = AliHLTTPCTransform::GetPadPitchWidth(patch); double zW = AliHLTTPCTransform::GetZWidth(); AliHLTTPCRawCluster rawCluster; rawCluster.SetPadRow(padRow); rawCluster.SetPad(cl->GetPad()); rawCluster.SetTime(cl->GetTimeBin()); rawCluster.SetSigmaY2(cl->GetSigmaY2()/yW/yW); rawCluster.SetSigmaZ2(cl->GetSigmaZ2()/zW/zW); rawCluster.SetCharge((UShort_t)cl->GetQ()); rawCluster.SetQMax((UShort_t)cl->GetMax()); AliHLTTPCClusterMCLabel mc; int l0 = ( cl->GetLabel(0)>=0 ); int l1 = ( cl->GetLabel(1)>=0 ); int l2 = ( cl->GetLabel(2)>=0 ); int nmc = l0+l1+l2; float w = (nmc>0) ? cl->GetQ()/nmc :0; mc.fClusterID[0].fMCID = cl->GetLabel(0); mc.fClusterID[0].fWeight=l0*w; mc.fClusterID[1].fMCID = cl->GetLabel(1); mc.fClusterID[0].fWeight=l1*w; mc.fClusterID[2].fMCID = cl->GetLabel(2); mc.fClusterID[0].fWeight=l2*w; nClusters++; if( !merger.CheckCandidate(slice, patch, rawCluster) ) continue; int id = merger.AddCandidate(slice, patch, ~AliHLTUInt32_t(0), rawCluster, mc); if( id>=0 ){ nAccepted++; vClusters.push_back(*cl); } //if( (id>=0) &&(merger.GetRecords()[id].GetBorder()>=0) ) nAccepted++; } } // loop over clusters delete row; file->Close(); } cout<<"Merge..."< 5 ) continue; isPartner = 1 ; // check if it has been a merged with a cluster with the same label int id = merger.GetRecords()[b2[i2].fClusterRecordID].IsMergedTo(); if( id<0 ) continue; const AliTPCclusterMI &c21 = vClusters[id]; if( c21.GetLabel(0) == lab ) isMerged = 1; } if( isPartner ) statNGood++; if( isMerged ) statNMerged++; } /* cout<<" Merging efficiency: merged "<0 ?statNGood :1)<<" %"<0 ?statNGood :1)<<" %"<SetOptStat(111110); gStyle->SetOptFit(1); //hphidist->Draw(); Int_t minc=33; { TCanvas *c1=new TCanvas("c0","Offline vs HLT clusters",0,0,1500,800); c1->Divide(1,3); c1->cd(1); hQ->Draw(); c1->cd(2); hQ10->Draw(); c1->cd(3); hQ30->Draw(); c1->cd(0); c1->Update(); } */ return 0; } #endif