47 gStyle->SetPalette(1);
53 std::vector<histos*> histosVector;
60 TFile*
out =
new TFile(outFile.c_str(),
"RECREATE");
62 TFile*
f =
new TFile(inFile.c_str());
63 TTree *
t=(TTree *) f->Get(
"pndsim") ;
66 TFile*
par =
new TFile(parFile.c_str());
67 (TGeoManager*)par->Get(
"FairGeoParSet");
77 histosVector.push_back(
new histos(
"stt", [](
TString& path){
return path.Contains(
"stt"); }, 181, 361));
78 histosVector.push_back(
new histos(
"stt_support", [](
TString& path){
return (path.Contains(
"stt") && !path.Contains(
"tubestt")); }));
79 histosVector.push_back(
new histos(
"stt_straw", [](
TString& path){
return (path.Contains(
"stt") && path.Contains(
"tubestt")); }));
80 histosVector.push_back(
new histos(
"mvd", [](
TString& path){
return (path.Contains(
"Mvd")); }));
81 histosVector.push_back(
new histos(
"gem", [](
TString& path){
return (path.Contains(
"Gem")); }));
85 TClonesArray*
radlen_array =
new TClonesArray(
"FairRadLenPoint");
86 t->SetBranchAddress(
"RadLen", &radlen_array);
88 TClonesArray*
mc_array=
new TClonesArray(
"PndMCTrack");
89 t->SetBranchAddress(
"MCTrack",&mc_array);
99 cout<<
">>>> Event No "<<j<<endl;
100 for (
auto detector : histosVector){
101 detector->fRadLengthOnTrack.clear();
102 detector->fRadLengthOnTrack.resize(10,0.0);
105 for (Int_t
i=0;
i<radlen_array->GetEntriesFast();
i++)
107 if(verbose) cout<<
"Point No "<<
i<<endl;
108 FairRadLenPoint *
point=(FairRadLenPoint*)radlen_array->At(
i);
109 if (verbose) cout <<
"Track ID: " << point->GetTrackID() << std::endl;
110 if (point->GetTrackID() > 10)
continue;
111 TVector3
pos, posOut,
res;
112 pos = point->GetPosition();
113 posOut = point->GetPositionOut();
116 if (myTrack ==
nullptr) {
120 TGeoNode* node =
gGeoManager->FindNode(point->GetX(),point->GetY(),point->GetZ());
123 std::cout<<
"Warning: There is a node not defined properly!"<<std::endl;
130 std::cout <<
"Time: " << point->GetTime() <<
" Length: " << point->GetLength() << std::endl;
131 std::cout <<
"Pos: " << pos.x() <<
"/" << pos.y() <<
"/" << pos.z();
132 std::cout <<
" OutPos: " << posOut.x() <<
"/" << posOut.y() <<
"/" << posOut.z() << std::endl;
133 std::cout <<
"TrackLength: " << res.Mag() <<
" RadLength: " << point->GetRadLength() <<
" Res: " << res.Mag() / point->GetRadLength() << std::endl;
134 std::cout <<
"Detname: " << detname.Data() << std::endl;
136 for(
auto detector : histosVector) {
138 if (point->GetTrackID() > -1 && point->GetTrackID() < 10 && detector->fSelector(detname)){
139 detector->fRadLengthOnTrack[point->GetTrackID()] += res.Mag()/point->GetRadLength()*100;
146 for(
auto detector : histosVector) {
148 if ( detector->fRadLengthOnTrack.size() > 0 && detector->fRadLengthOnTrack[k] > 0){
151 detector->hisRadLen->Fill(detector->fRadLengthOnTrack[k]);
152 detector->hisRadLen2D->Fill(mcTrack->
GetMomentum().Theta()*TMath::RadToDeg(), mcTrack->
GetMomentum().Phi()*TMath::RadToDeg(), detector->fRadLengthOnTrack[k]);
153 detector->hisRadLenCount->Fill(mcTrack->
GetMomentum().Theta()*TMath::RadToDeg(), mcTrack->
GetMomentum().Phi()*TMath::RadToDeg());
158 for(
auto detector : histosVector) {
159 detector->hisRadLen2D->Divide(detector->hisRadLenCount);
161 TCanvas*
can1 =
new TCanvas();
164 gStyle->SetPalette(1);
166 detector->hisRadLen->DrawCopy();
168 detector->hisRadLen2D->DrawCopy(
"colz");
178 cout << endl << endl;
179 cout <<
"Macro finished succesfully." << endl;
182 cout <<
"Real time " << rtime <<
" s, CPU time " << ctime <<
" s" << endl;
std::map< int, int > trackHitMap
std::string GetParFileName(std::string addon="", bool cut=false)
TVector3 GetMomentum() const
cout<< "POINTs for new FwEndCap == "<< tsim-> GetEntriesFast()
TGeoManager * gGeoManager
std::string GetSimFileName(std::string addon="", bool cut=false)
A simple class which adds the corresponding file extensions to a given base class.
std::string GetCustomFileName(std::string ext, std::string addon="", bool cut=false)
PndFileNameCreator namecreator("../data/Lars/MvdDtsSim.root")
Int_t GetMotherID() const
TClonesArray * radlen_array