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; }
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(>pc.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(); hsy->Draw(); pad21->cd(); hsx2->Draw(); pad22->cd(); hsy2->Draw(); pad31->cd(); harea->Draw(); pad32->cd(); hmax->Draw(); pad41->cd(); harea2->Draw(); pad42->cd(); hmax2->Draw(); c1->cd(); TPaveText * comment = new TPaveText(0.05,0.02,0.95,0.14,"NDC"); comment->SetTextAlign(12); comment->SetFillColor(42); comment->ReadFile("clusters.txt"); comment->Draw(); c2->cd(); pad11_2->cd(); harea2p->Draw(); pad12_2->cd(); hmax2p->Draw(); }
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; new((*array)[j++]) AliAlignObjParams(sm_symname.Data(),0,dx,dy,dz,rx,ry,rz,kFALSE); } // apply supermodules' alignment objects Int_t smCounter=0; for(Int_t iSect=0; iSect<18; iSect++){ if( (TString(gSystem->Getenv("REALSETUP")) == TString("kTRUE")) && !sActive[iSect] ) continue; AliAlignObjParams* smobj = (AliAlignObjParams*)array->UncheckedAt(smCounter++); if(!smobj->ApplyToGeometry()){ Fatal(macroname,Form("application of full misalignment object for sector %d failed!",iSect)); return; } } // create the chambers' alignment objects ran = new TRandom(4357); Int_t chId; for (Int_t iLayer = AliGeomManager::kTRD1; iLayer <= AliGeomManager::kTRD6; iLayer++) { chId=-1; for (Int_t iSect = 0; iSect < 18; iSect++){ for (Int_t iCh = 0; iCh < 5; iCh++) { dx = AliMathBase::TruncatedGaus(0.0,chdx,cutChdx); dy = AliMathBase::TruncatedGaus(0.0,chdy,cutChdy); dz = AliMathBase::TruncatedGaus(0.0,chdz,cutChdz); rx = gRandom->Rndm() * 2.0*chrx - chrx; ry = gRandom->Rndm() * 2.0*chry - chry; rz = gRandom->Rndm() * 2.0*chrz - chrz; chId++; if ((iSect==13 || iSect==14 || iSect==15) && iCh==2) continue; volid = AliGeomManager::LayerToVolUID(iLayer,chId); if( (TString(gSystem->Getenv("REALSETUP")) == TString("kTRUE")) && !sActive[iSect] ) continue; symname = AliGeomManager::SymName(volid); new((*array)[j++]) AliAlignObjParams(symname,volid,dx,dy,dz,rx,ry,rz,kFALSE); } } } if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "TRDfullMisalignment.root"; TFile f(filename,"RECREATE"); if(!f){ Error(macroname,"cannot open file for output\n"); return; } Info(macroname,"Saving alignment objects to the file %s", filename); f.cd(); f.WriteObject(array,"TRDAlignObjs","kSingleKey"); f.Close(); }else{ // save in CDB storage Info(macroname,"Saving alignment objects in CDB storage %s", Storage.Data()); AliCDBMetaData* md = new AliCDBMetaData(); md->SetResponsible("Dariusz Miskowiec"); md->SetComment("Full misalignment for TRD"); md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); AliCDBId id("TRD/Align/Data",0,AliCDBRunRange::Infinity()); storage->Put(array,id,md); } array->Delete(); }
/** * 1. Data sample : pp200 W->e nu with pile-up corresponding to 1 MHz min. bias * events, 50 K event y2011, 10 K event y2012. * * 2. Proof of principal: no pile-up for both PPV and KFV * * a. Reconstructed primary track multiplicity versus corresponding MC * "reconstructable" (i.e. in n STAR acceptance,no. TPC MC hits >= 15) tracks * multiplicity. * * b. Corrected reconstructed primary track multiplicity (i.e. multiplied by * QA/100.) versus corresponding MC "reconstructable" (i.e. in n STAR * acceptance,no. TPC MC hits >= 15) tracks multiplicity. * * c. Efficiency primary vertex reconstruction versus MC "reconstructable" * tracks multiplicity. * * 3. With pileup. repeat above (a-c) with old ranking scheme for * * I. Any reconstructed primary vertex which is matched with MC trigger * vertex (MC = 1) * * II. The best (in sense of ranking) reconstructed primary vertex which is * matched with MC trigger vertex (MC = 1) * * III. The best (in sense of ranking) reconstructed primary vertex which is * not matched with MC trigger vertex (MC != 1) * * 4. With pileup. repeat above (a-c) with new ranking scheme for cases I-III */ void MuMcPrVKFV2012(Long64_t nevent, const char *file, const std::string& outFile, bool fillNtuple) { #ifdef __TMVA__ boost::replace_last(outFile, ".root", ""); outFile += ".TMVArank.root"; // create a set of variables and declare them to the reader // - the variable names must corresponds in name and type to // those given in the weight file(s) that you use TString separator(":"); TString Vnames(vnames); TObjArray *array = Vnames.Tokenize(separator); std::vector<std::string> inputVars; TIter next(array); TObjString *objs; while ((objs = (TObjString *) next())) { std::cout << objs->GetString() << std::endl; } inputVars.push_back("beam"); inputVars.push_back("postx"); inputVars.push_back("prompt"); inputVars.push_back("cross"); inputVars.push_back("tof"); inputVars.push_back("notof"); inputVars.push_back("EEMC"); inputVars.push_back("noEEMC"); inputVars.push_back("chi2"); std::vector<double> *inputVec = new std::vector<double>( inputVars.size() ); IClassifierReader *classReader = new ReadBDT( inputVars ); #endif /* __TMVA__ */ TFile *fOut = TFile::Open(outFile.c_str(), "recreate"); data_t data; // Book histograms const int nMcRecMult = 75; TArrayD xMult(nMcRecMult + 1); xMult[0] = -0.5; for (int i = 1; i <= nMcRecMult; i++) { if (xMult[i - 1] < 50) xMult[i] = xMult[i - 1] + 1; // 1 - 50 else if (xMult[i - 1] < 100) xMult[i] = xMult[i - 1] + 2; // 51 - 75 else if (xMult[i - 1] < 200) xMult[i] = xMult[i - 1] + 10; // 76 - 85 else xMult[i] = xMult[i - 1] + 100; // 86 -100 } TH1D *McRecMulT = new TH1D("McRecMulT", "Reconstructable multiplicity for trigger Mc Vertex", nMcRecMult, xMult.GetArray()); struct Name_t { const Char_t *Name; const Char_t *Title; }; const Name_t HCases[3] = { {"Any", "Any vertex matched with MC == 1"}, {"Good", "The best rank vertex with MC == 1"}, {"Bad", "The best rank vertex with MC != 1"} }; const Name_t Plots[4] = { {"Mult" , "the reconstructed (uncorrected) track multiplicity versus Reconstructable multiplicity"}, {"MultQA" , "the reconstructed (corrected for QA) track multiplicity versus Reconstructable multiplicity"}, {"McRecMul", "Reconstructable multiplicity"}, {"YvsX" , "Bad versus Good value"} }; /* h p */ TH1 *hists[3][4]; for (int h = 0; h < 3; h++) { for (int p = 0; p < 4; p++) { TString Name(Plots[p].Name); Name += HCases[h].Name; TString Title(Plots[p].Title); Title += " for "; Title += HCases[h].Title; Title += " vertex"; if (p < 2) hists[h][p] = new TH2D(Name, Title, nMcRecMult, xMult.GetArray(), nMcRecMult, xMult.GetArray()); else if (p == 2) hists[h][p] = new TH1D(Name, Title, nMcRecMult, xMult.GetArray()); } } TNtuple *VertexG = new TNtuple("VertexG", "good vertex & global params info", vnames); TNtuple *VertexB = new TNtuple("VertexB", "bad vertex & global params info", vnames); // ---------------------------------------------- StMuDstMaker *maker = new StMuDstMaker(0, 0, "", file, "st:MuDst.root", 1e9); // set up maker in read mode // 0,0 this mean read mode // dir read all files in this directory // file bla.lis real all file in this list, if (file!="") dir is ignored // filter apply filter to filenames, multiple filters are separated by ':' // 10 maximum number of file to read maker->SetStatus("*", 0); std::vector<std::string> activeBranchNames = { "MuEvent", "PrimaryVertices", "StStMuMcVertex", "StStMuMcTrack" }; // Set Active braches for (const auto& branchName : activeBranchNames) maker->SetStatus(branchName.c_str(), 1); TChain *tree = maker->chain(); Long64_t nentries = tree->GetEntries(); nevent = TMath::Min(nevent, nentries); std::cout << nentries << " events in chain " << nevent << " will be read." << std::endl; tree->SetCacheSize(-1); //by setting the read cache to -1 we set it to the AutoFlush value when writing tree->SetCacheLearnEntries(1); //one entry is sufficient to learn tree->SetCacheEntryRange(0, nevent); for (Long64_t ev = 0; ev < nevent; ev++) { if (maker->Make()) break; StMuDst *muDst = maker->muDst(); // get a pointer to the StMuDst class, the class that points to all the data StMuEvent *muEvent = muDst->event(); // get a pointer to the class holding event-wise information 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; // Check Mc if (recoVertex->idTruth() < 0 || recoVertex->idTruth() > nMuMcVertices) { std::cout << "ERROR: Illegal idTruth " << recoVertex->idTruth() << " The track is ignored" << std::endl; continue; } StMuMcVertex *mcVertex = (StMuMcVertex *) MuMcVertices->UncheckedAt(recoVertex->idTruth() - 1); if (mcVertex->Id() != recoVertex->idTruth()) { std::cout << "ERROR: Mismatched idTruth " << recoVertex->idTruth() << " and mcVertex Id " << mcVertex->Id() << " The vertex is ignored" << std::endl; continue; } reco2McVertices[recoVertex] = mcVertex; vertexRanks[recoVertexIndex] = recoVertex->ranking(); if (recoVertex->idTruth() == 1 && recoVertex->noTracks() > vertexMaxMultiplicity) { mcMatchedVertexIndex = recoVertexIndex; vertexMaxMultiplicity = recoVertex->noTracks(); } FillData(data, recoVertex); #ifdef __TMVA__ Float_t *dataArray = &data.beam; for (size_t j = 0; j < inputVec->size(); j++) (*inputVec)[j] = dataArray[j]; vertexRanks[recoVertexIndex] = classReader->GetMvaValue( *inputVec ); #endif } // If we reconstructed a vertex which matches the MC one we fill the // numerator of the "Any" efficiency histogram if (mcMatchedVertexIndex != -1) { StMuPrimaryVertex *recoVertexMatchedMc = (StMuPrimaryVertex*) PrimaryVertices->UncheckedAt(mcMatchedVertexIndex); double nTracks = recoVertexMatchedMc->noTracks(); double nTracksQA = nTracks * recoVertexMatchedMc->qaTruth() / 100.; hists[0][0]->Fill(nMcTracksWithHits, nTracks); hists[0][1]->Fill(nMcTracksWithHits, nTracksQA); hists[0][2]->Fill(nMcTracksWithHits); } // Now deal with the highest rank vertex int maxRankVertexIndex = TMath::LocMax(nPrimaryVertices, vertexRanks.GetArray()); StMuPrimaryVertex *recoVertexMaxRank = (StMuPrimaryVertex*) PrimaryVertices->UncheckedAt(maxRankVertexIndex); StMuMcVertex *mcVertex = reco2McVertices[recoVertexMaxRank]; double nTracks = recoVertexMaxRank->noTracks(); double nTracksQA = nTracks * recoVertexMaxRank->qaTruth() / 100.; // Fill numerator for "good" and "bad" efficiencies int h = ( mcVertex && mcVertex->Id() == 1) ? 1 : 2; hists[h][0]->Fill(nMcTracksWithHits, nTracks); hists[h][1]->Fill(nMcTracksWithHits, nTracksQA); hists[h][2]->Fill(nMcTracksWithHits); // Proceed with filling ntuple only if requested by the user if ( !fillNtuple ) continue; // Second loop over all verticies in this event for (int recoVertexIndex = 0; recoVertexIndex < nPrimaryVertices; recoVertexIndex++) { StMuPrimaryVertex *recoVertex = (StMuPrimaryVertex *) PrimaryVertices->UncheckedAt(recoVertexIndex); if ( !AcceptVX(recoVertex) ) continue; StMuMcVertex *mcVertex = reco2McVertices[recoVertex]; if ( !mcVertex ) { std::cout << "No Match from RC to MC" << std::endl; continue; } if (vtxeval::gDebugFlag) { std::cout << Form("Vx[%3i]", recoVertexIndex) << *recoVertex << " " << *mcVertex; int nMcTracksWithHitsatL = Mc2McHitTracks.count(recoVertex->idTruth()); std::cout << Form("Number of McTkHit %4i rank %8.3f", nMcTracksWithHitsatL, vertexRanks[recoVertexIndex]); } int IdPar = mcVertex->IdParTrk(); if (IdPar > 0 && IdPar <= nMuMcTracks) { StMuMcTrack *mcTrack = (StMuMcTrack *) MuMcTracks->UncheckedAt(IdPar - 1); if (mcTrack && vtxeval::gDebugFlag) std::cout << " " << mcTrack->GeName(); } FillData(data, recoVertex); double nTracks = recoVertex->noTracks(); if (mcVertex->Id() == 1 && nTracks == vertexMaxMultiplicity) {// good VertexG->Fill(&data.beam); } else { // bad VertexB->Fill(&data.beam); } } if ( !gROOT->IsBatch() ) { if (vtxeval::ask_user()) return; } else { vtxeval::gDebugFlag = false; } } fOut->Write(); }