24 std::cerr <<
"Unable to open " <<
inFileName << std::endl;
29 std::cerr <<
"Unable to find EICTree in " <<
inFileName << std::endl;
48 TClass branchClass(mcTree->GetBranch(
"event")->GetClassName());
49 if(branchClass.InheritsFrom(
"erhic::EventDis")) {
54 #ifdef WITH_PYTHIA6_OFF
55 else if(branchClass.InheritsFrom(
"erhic::hadronic::EventMC")) {
60 std::cerr << branchClass.GetName() <<
" is not supported for smearing" <<
66 TString outName = TString(
inFileName).ReplaceAll(
".root",
".smear.root");
67 outFile =
new TFile(outName,
"RECREATE");
69 std::cerr <<
"Unable to create " << outName << std::endl;
72 smearedTree =
new TTree(
"Smeared",
"A tree of smeared Monte Carlo events");
80 std::cout <<
"-E- EicSmearTask::Init: No MCTrack array found!" << std::endl;
85 std::cout <<
"-E- EicSmearTask::Init: No PidChargedCand array found!" << std::endl;
102 static unsigned evcounter;
104 if (!
mcTree->GetEntry(evcounter++))
return;
116 unsigned rcounter = 0;
118 for(
unsigned tr=0; tr<mcEvent->
GetNTracks(); tr++)
123 if (vp->
GetStatus() == 1)
id[rcounter++] = tr;
139 if( 0==mctrack)
continue;
171 std::cout <<
smearedTree->GetEntries() <<
" entries in the output tree" << std::endl;
177 for(
unsigned ev=0; ev<
smearedTree->GetEntries(); ev++)
181 std::cout <<
event->GetNTracks() <<
" tracks in the event" << std::endl;
183 for(
unsigned iq=0; iq<
event->GetNTracks(); iq++)
189 if (!vp || vp->
GetStatus() != 1)
continue;
191 std::cout << vp->
id <<
" " << vp->
GetPx() <<
" " << vp->
GetPy() <<
" " << vp->
GetPz() << std::endl;
196 std::cout <<
"About to finish!" << std::endl;