/* anaMomentum.C the macro measures difference between monte carlo momentum and momentum from hit point fitting Auther: Manoj */ { #include "TCanvas.h" std::cout; //load library by run macro gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C"); rootlogon(); //Timer TStopwatch timer; timer.Start(); //variable defination int nEvents = 10; bool verbose = false; double pi = TMath::Pi(); //to open data file for MC Points and tracks TString inRecoFile = "reco_complete.root"; TString inDigiFile = "digi_complete.root"; TString inSimFile = "sim_complete.root"; TFile *inFile = TFile::Open(inSimFile,"READ"); TFile *fiDigiFile = TFile::Open(inDigiFile,"READ"); TFile *fiReco1File = TFile::Open(inRecoFile,"READ"); TTree *tree=(TTree *) inFile->Get("cbmsim") ; tree->AddFriend("cbmsim",inRecoFile); tree->AddFriend("cbmsim",inDigiFile); TClonesArray *ftsmcarray = new TClonesArray("PndFtsPoint"); tree->SetBranchAddress("FTSPoint", &ftsmcarray); TClonesArray *mc_array = new TClonesArray("PndMCTrack"); tree->SetBranchAddress("MCTrack", &mc_array); TClonesArray *trk_array = new TClonesArray("PndTrack"); tree->SetBranchAddress("FtsIdealGenTrack", &trk_array); TClonesArray *ftsarray = new TClonesArray("PndFtsHit"); tree->SetBranchAddress("FTSHit", &ftsarray); TList *bl = (TList*) fiDigiFile->Get("BranchList"); FairRootManager *fairman = new FairRootManager(); fairman->SetBranchNameList(bl); int ftsdetid = fairman->GetBranchId("FTSHit"); cout<< "detector id for fts is "<GetEntriesFast()<GetEntriesFast(); i++) { tree->GetEntry(i); // tree1->GetEntry(i); cout<<"the Event No. is "<GetEntriesFast()<GetEntriesFast()<GetEntriesFast() > 0) // { for (int j=0; jGetEntriesFast(); j++) { // if(mc_array.fChamberID==1 || mc_array.fChamberID==2) // { // if(hit_array->GetEntriesFast()!=mc_array->GetEntriesFast()) continue; PndTrack *trk = (PndTrack*)trk_array->At(j); if(!trk) { cout<<"ERROR track "<< itrk << " does not exit"<GetTrackCandPtr(); if(!cand) { cout<<"ERROR track "<< itrk << " has no candidate association"<GetNHits(); ihit++){ PndTrackCandHit candhit = cand->GetSortedHit(ihit); Int_t hitId = candhit.GetHitId(); Int_t detId = candhit.GetDetId(); cout<<"HitId: "<< hitId << " DetId: "<GetBranchId("FTSHit")) { hit = (FairHit*) ftsarray->At(hitId); if(!hit) { cout<<"Error fts " << hitId << " does not exist"<GetRefIndex()==-1) cout <<"Error fts: ref index -1"<At(hit->GetRefIndex())); mcx = point->GetX(); mcy = point->GetY(); mcz = point->GetZ(); cout << "hits for reco X:"<< hit->GetX() <<" Y: " << hit->GetY() << " Z: " << hit->GetZ() << endl; } } cout<<"the mcX, mcY, mcZ are "<GetTrackID(); PndMCTrack *track = (PndMCTrack*)mc_array->At(iTrack); if(track->GetMotherID()==-1){ trackthe = track->GetMomentum().Theta(); momentum = track->GetMomentum().Mag(); } cout<<"the track theta is "<Fit("trackFit", "ONF"); mctheta = TMath::ATan(trackFit->GetParameter(1)); cout<<"the mc fit theta is "<Fit("trackFit","ONF"); rctheta=TMath::ATan(trackFit->GetParameter(1)); cout<<"the rc fit theta is "<Fill(momentum); // mcTheta->Fill(mctheta); // refTheta->Fill(trackthe); // dTheta->Fill(dtheta); // } cout<<"===================================================================================="<SetLineColor(kRed); total->SetLineWidth(1); TCanvas *can1 = new TCanvas("Theta","MC, Track theata", 0, 0, 800, 800); can1->Divide(2,2); TPad* mypad = 0; can1->cd(1); mcTheta->DrawCopy(); // can1->cd(2); rcTheta->DrawCopy(); can1->cd(3); refTheta->DrawCopy(); can1->cd(4); mom->DrawCopy(); gStyle->SetOptFit(); TCanvas *can2 = new TCanvas("Dealta Theta", "Track", 0, 0, 800, 800); dTheta ->DrawCopy(); dTheta->Fit("total","R"); */ timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); cout<