6 #include "TGeoManager.h"
9 #include "TGeoMatrix.h"
12 #include "TGeoTrack.h"
29 mcHit->SetLineColor(kGreen);
31 TGeoShape* stripShape =
gGeoManager->GetVolume(
"StripSensor")->GetShape();
32 TGeoVolume* stripVol =
new TGeoVolume(
"StripSensorRed",stripShape,
gGeoManager->GetMedium(
"vacuum"));
33 stripVol->SetLineColor(kRed);
35 stripVol =
gGeoManager->GetVolume(
"StripSensorRed");
37 TGeoShape* pixShape1 =
gGeoManager->GetVolume(
"SensorActiveAreao[NrFE=8ooE]")->GetShape();
38 TGeoVolume* pixVol1 =
new TGeoVolume(
"PixelSensor8",pixShape1,
gGeoManager->GetMedium(
"vacuum"));
39 pixVol1->SetLineColor(kRed);
43 TGeoShape* pixShape2 =
gGeoManager->GetVolume(
"SensorActiveAreao[NrFE=4]")->GetShape();
44 TGeoVolume* pixVol2 =
new TGeoVolume(
"PixelSensor4",pixShape2,
gGeoManager->GetMedium(
"vacuum"));
45 pixVol2->SetLineColor(kRed);
49 TGeoShape* pixShape3 =
gGeoManager->GetVolume(
"SensorActiveAreao[NrFE=5]")->GetShape();
50 TGeoVolume* pixVol3 =
new TGeoVolume(
"PixelSensor5",pixShape3,
gGeoManager->GetMedium(
"vacuum"));
51 pixVol3->SetLineColor(kRed);
55 TGeoVolume* stripVolG =
new TGeoVolume(
"StripSensorGreen",stripShape,
gGeoManager->GetMedium(
"vacuum"));
56 stripVolG->SetLineColor(kGreen);
58 stripVolG =
gGeoManager->GetVolume(
"StripSensorGreen");
60 TGeoVolume* pixVolG1 =
new TGeoVolume(
"PixelSensor8Green",pixShape1,
gGeoManager->GetMedium(
"vacuum"));
61 pixVolG1->SetLineColor(kGreen);
63 pixVolG1 =
gGeoManager->GetVolume(
"PixelSensor8Green");
65 TGeoVolume* pixVolG2 =
new TGeoVolume(
"PixelSensor4Green",pixShape2,
gGeoManager->GetMedium(
"vacuum"));
66 pixVolG2->SetLineColor(kGreen);
68 pixVolG2 =
gGeoManager->GetVolume(
"PixelSensor4Green");
70 TGeoVolume* pixVolG3 =
new TGeoVolume(
"PixelSensor5Green",pixShape3,
gGeoManager->GetMedium(
"vacuum"));
71 pixVolG3->SetLineColor(kGreen);
73 pixVolG3 =
gGeoManager->GetVolume(
"PixelSensor5Green");
95 fFile =
new TFile(fileName.Data());
96 fTree = (TTree*)fFile->Get(
"pndsim");
98 fTree->AddFriend(
"digi=pndsim",nameCreator.GetDigiFileName().c_str());
99 fTree->AddFriend(
"reco=pndsim",nameCreator.GetRecoFileName().c_str());
100 fTree->AddFriend(
"trackF=pndsim",nameCreator.GetTrackFindingFileName().c_str());
102 fHitArray=
new TClonesArray(
"PndSdsMCPoint");
103 fDigiArray =
new TClonesArray(
"PndSdsDigiPixel");
109 fTree->SetBranchAddress(
"MVDPoint",&
fHitArray);
110 fTree->SetBranchAddress(
"MVDPixelDigis",&
fDigiArray);
112 fTree->SetBranchAddress(
"MVDClusterHit",&
fRecoArray);
114 if (fTree->FindBranch(
"GeoTracks") != 0)
119 f3DMCHisto =
new TH3D(
"h3D",
"h3D", 50,-15,15, 50, -15,15, 50, -30,30);
120 f3DRecoHisto =
new TH3D(
"h3D",
"h3D", 50,-15,15, 50, -15,15, 50, -30,30);
158 std::cout <<
"hitArray: " <<
fHitArray->GetEntries() << std::endl;
159 std::cout <<
"digiArray: " <<
fDigiArray->GetEntries() << std::endl;
160 std::cout <<
"clusterArray: " <<
fClusterArray->GetEntries() << std::endl;
161 std::cout <<
"recoArray: " <<
fRecoArray->GetEntries() << std::endl;
183 std::cout <<
i <<
": ";
185 std::cout << *myPoint;
192 std::cout <<
i <<
": ";
194 std::cout << *myDigi;
200 std::cout <<
"Cluster " <<
i <<
": " << std::endl;
204 for (UInt_t j = 0; j < myClusterList.size(); j++){
206 std::cout << myClusterList[j] <<
": ";
207 std::cout << *myDigi;
215 std::cout <<
i <<
": ";
233 TGeoHMatrix* transMat =
gGeoManager->GetCurrentMatrix();
235 transMat->MasterToLocal(in, local);
237 TGeoVolume* actVolume =
gGeoManager->GetCurrentVolume();
238 TGeoBBox* actBox = (TGeoBBox*)(actVolume->GetShape());
240 result.SetX(local[0] + actBox->GetDX());
241 result.SetY(local[1] + actBox->GetDY());
242 result.SetZ(local[2] + actBox->GetDZ());
251 TString detName = myPoint->GetDetName();
254 fHistos[detName] =
new TH2I(
"MCHisto",detName.Data(), 1000,0,1000,201,0,200);
261 TVector3 in(myPoint->GetX(), myPoint->GetY(), myPoint->GetZ());
263 TVector3 inLocal, outLocal;
267 fHistos[detName]->Fill(inLocal.X()*100, inLocal.Y()*100);
268 fHistos[detName]->Fill(outLocal.X()*100, outLocal.Y()*100);
283 fDigiHistos[hit->GetDetName()] =
new TH2I(
"digiHisto",hit->GetDetName().Data(), 1000,0,1000,201,0,200);
286 TH2* tempHisto = (TH2*)(
fDigiHistos[hit->GetDetName()]);
289 tempHisto->Fill(mySensorPixel.GetCol(), mySensorPixel.GetRow(),mySensorPixel.GetCharge());
301 fClusterHistos[sensorID] =
new TH2I(
"clusterHisto",detName.Data(), 1000,0,1000,201,0,200);
305 for (Int_t j = 0; j < clusterList.size(); j++){
309 tempHisto->Fill(mySensorPixel.GetCol(), mySensorPixel.GetRow());
318 TString detName = myHit->GetDetName();
321 fRecoHistos[detName] =
new TH2I(
"RecoHisto",detName.Data(), 1000,0,1000,201,0,200);
326 TVector3 in(myHit->GetX(), myHit->GetY(), myHit->GetZ());
330 fRecoHistos[detName]->Fill(inLocal.X()*100, inLocal.Y()*100);
345 TString detName = point->GetDetName();
352 std::cout <<
"Hits in Cluster: " << hits.size() <<
" for Det: " << detName.Data() << std::endl;
360 TString detName = myHit->GetDetName();
361 std::cout <<
"HitResolution for: " << detName << std::endl;
363 std::cout <<
"RecoPos: " << recoPos.X() <<
" " << recoPos.Y() <<
" " << recoPos.Z() << std::endl;
364 std::cout <<
"MC point RefIndex: " << myHit->GetRefIndex() << std::endl;
365 std::cout <<
"Cluster Index: " << myHit->
GetClusterIndex() << std::endl;
368 for (UInt_t k = 0; k < points.size();
i++)
369 std::cout <<
"ClusterPoints: " << points[k] << std::endl;
371 std::cout <<
"HitPos: " << hitPos.X() <<
" " << hitPos.Y() <<
" " << hitPos.Z() << std::endl;
376 TVector3 resPos = recoPos - hitPos;
379 std::cout <<
"HitRes: " << resPos.Mag() << std::endl;
387 f3DRecoHisto->Fill(myHit->GetX(), myHit->GetY(), myHit->GetZ());
389 for (Int_t j = 0; j <
fHitArray->GetEntries(); j++){
391 f3DMCHisto->Fill(myPoint->GetX(), myPoint->GetY(), myPoint->GetZ());
400 unsigned int detID, hitID;
405 TH2D* myHistoXY =
new TH2D(
"recohisxy",
"MVD Reco Points, xy view",400,-15.,15.,400,-15.,15.);
406 myHistoXY->SetMarkerStyle(7);
407 myHistoXY->SetMarkerColor(
i+1);
409 TH2D* myHistoRZ =
new TH2D(
"recohisrz",
"MVD Reco Points, rz view",400,-20.,20.,400,-20.,20.);
410 myHistoRZ->SetMarkerStyle(7);
411 myHistoRZ->SetMarkerColor(
i+1);
415 for (UInt_t j = 0; j < trackC->
getNHits(); j++){
416 trackC->
getHit(j, detID, hitID);
418 vec.SetXYZ(myHit->GetX(), myHit->GetY(), myHit->GetZ());
419 myHistoXY->Fill(vec.x(), vec.y());
420 myHistoRZ->Fill(vec.z(), vec.Perp());
430 for (UInt_t
i = 0;
i < points.size();
i++){
433 std::cout <<
"posIn: " << posIn.X() <<
" " << posIn.Y() <<
" " << posIn.Z() << std::endl;
435 std::cout <<
"posOut: " << posOut.X() <<
" " << posOut.Y() <<
" " << posOut.Z() << std::endl;
437 TVector3 posHit = posIn + posOut;
440 std::cout <<
"posHit: " << posHit.X() <<
" " << posHit.Y() <<
" " << posHit.Z() << std::endl;
442 energy += myPoint->GetEnergyLoss();
490 fCan1 =
new TCanvas();
499 fCan1->Modified(kTRUE);
505 std::map<TString,TH1*>::const_iterator ki;
506 Int_t histoSize =
fHistos.size();
508 if (index >= histoSize)
return;
510 for (Int_t
i = 0;
i < index;
i++)
513 std::cout <<
"DetName: " << detName.Data() << std::endl;
520 extCan =
new TCanvas();
536 extCan =
new TCanvas();
549 extCan =
new TCanvas();
552 std::map<Int_t, Int_t> trackUsed;
555 std::cout <<
"Hit " <<
i <<
" TrackID " << myPoint->GetTrackID() << std::endl;
556 if (trackUsed[myPoint->GetTrackID()] == 0){
559 if (myPoint->GetTrackID() == myTrack->GetId()){
564 trackUsed[myPoint->GetTrackID()] = 1;
593 for (UInt_t
i = 1;
i < vec->size();
i++)
594 (*vec)[
i]->Draw(
"same");
609 fCan2 =
new TCanvas();
631 std::vector<Int_t> result;
633 bool isInResult =
false;
634 for (UInt_t
i = 0;
i < digiPos.size();
i++){
637 std::cout <<
" -I- GetHitPerCluster: mcID: " << mcID << std::endl;
638 for (UInt_t j = 0; j < result.size() && isInResult ==
false; j++){
640 if (mcID == result[j])
643 if (isInResult ==
false)
644 result.push_back(mcID);
647 for (UInt_t k = 0; k < result.size(); k++)
648 std::cout <<
" Result: " << k <<
": " << result[k] << std::endl;
656 for (Int_t
i = 0;
i <
fHitArray->GetEntriesFast();
i++){
658 fGeoList->
AddHit(
"MCHits", myPoint->GetX(), myPoint->GetY(), myPoint->GetZ());
659 std::cout <<
"gGeoManager cd: " << myPoint->GetDetName() <<
" " <<
gGeoManager->cd(
fGeoH->
GetPath(myPoint->GetDetName())) << std::endl;
660 TGeoHMatrix* mat =
gGeoManager->GetCurrentMatrix();
662 if (myPoint->GetDetName().Contains(
"71")){
663 std::cout <<
"StripHits added!" << std::endl;
667 else if (myPoint->GetDetName().Contains(
"89")){
668 std::cout <<
"PixHits4 added!" << std::endl;
672 else if (myPoint->GetDetName().Contains(
"56")){
673 std::cout <<
"PixHits8 added!" << std::endl;
683 for (std::map<TString,TH1*>::const_iterator ki = myMaps->begin(); ki != myMaps->end(); ki++){
684 ki->second->Delete();
685 (*myMaps)[ki->first] = 0;
688 std::cout <<
" Maps.size: " << myMaps->size() << std::endl;
710 for (UInt_t
i = 0;
i < myVectors->size();
i++)
712 delete ((*myVectors)[
i]);
719 std::vector<TString> result;
721 std::cout <<
"First: " << ki->first << std::endl;
722 std::cout <<
"Path: " <<
fGeoH->
GetPath(ki->first) << std::endl;
void DrawRecoHisto(TString detName, TCanvas *extCan=0, Int_t pad=0)
Int_t GetPixelRow() const
std::vector< Int_t > GetHitPerCluster(PndSdsCluster *clusterCand)
std::map< TString, TH1 * > fRecoHistos
std::vector< Int_t > GetClusterList() const
void ClearHits(TString groupName)
TVector3 CalcMeanHitPos(std::vector< Int_t > points)
std::vector< TH1 * > fDigiHistoVec
void DrawHisxy(TCanvas *extCan=0, Int_t pad=0)
TClonesArray * fDigiArray
void AddHit(TString groupName, FairHit *hit, Bool_t vis=kTRUE)
Int_t GetSensorID() const
TClonesArray * fRecoArray
PndSdsCalcFePixel * fPixelCon
std::vector< TString > GetModulesHit()
TH1 * fAllHitPerClusterHistos
TVector3 GetPosition() const
Class to store the Digis which belong to one cluster This class holds the information which Digi belo...
Int_t GetIndex(int i=0) const
PndEventDisplay * fGeoList
Int_t GetPixelColumn() const
void DrawHitHisto(TString detName, TCanvas *extCan=0, Int_t pad=0)
void DrawDigiHisto(TString detName, TCanvas *extCan=0, Int_t pad=0)
virtual void InitHistos()
unsigned int getNHits() const
void SetCanvasColumns(Int_t col)
virtual void ClearHistos()
Double_t GetCharge() const
TVector3 GetPositionOut() const
display of hits inside the gGeoManager
virtual void Init(TString filename)
TClonesArray * fGeoTrackArray
TGeoManager * gGeoManager
std::map< TString, TH1 * > fClusterHistos
TString GetPath(Int_t shortID)
for a given shortID the path is returned
std::map< TString, TH1 * > fHistos
void Draw3D(TString opt="", TCanvas *extCan=0, Int_t pad=0)
TVector3 GetLocalHitPoints(TString detName, TVector3 input)
void DrawHitTracks(TCanvas *extCan=0, Int_t pad=0)
std::map< TString, TH1 * > fHitPerClusterHistos
void DrawHistoVec(std::vector< TH1 * > *vec, TCanvas *extCan=0, Int_t pad=0) const
virtual void InitBranch()
TClonesArray * fClusterArray
void DrawClusterHisto(TString detName, TCanvas *extCan=0, Int_t pad=0)
A simple class which adds the corresponding file extensions to a given base class.
void AddNewGroup(TString groupName, PndGeoHitList *newList)
void DrawAllHistos(TString detName, TCanvas *extCan=0)
void getHit(unsigned int i, unsigned int &detId, unsigned int &hitId) const
Get detector ID and cluster index (hitId) for hit number i.
void ClearHistoVector(std::vector< TH1 * > *myVectors) const
std::vector< TH1 * > fClusterHistoVec
std::vector< TH1 * > fRecoHistoVec
void DrawAllTracks(TCanvas *extCan=0, Int_t pad=0)
Track candidate – a list of cluster indices.
TGeoVolume * fMvdTopVolume
static PndGeoHandling * Instance()
std::vector< TH1 * > fRecoHisrz
TH1 * fAllHitResolutionHistos
std::vector< TH1 * > fRecoHisxy
TVector3 GetPosition() const
void DrawHisto(TH1 *histo, TCanvas *extCan=0, Int_t pad=0) const
void DrawEvent(bool tracks=false, TCanvas *extCan=0)
void FillHitResolutionHistos()
void DrawTopVolume(TCanvas *extCan=0, Int_t pad=0, const char *opt="")
std::map< TString, TH1 * > fHitResolutionHistos
std::map< TString, TH1 * > fDigiHistos
void DrawHisrz(TCanvas *extCan=0, Int_t pad=0)
Data class to store the digi output of a pixel module.
Int_t GetClusterIndex() const
void SetHits(TString groupName, TClonesArray *hits, Bool_t vis=kTRUE)
Class to calculate the position of digis on a front-end from the digis on a sensor.
void FillHitPerClusterHistos()
TClonesArray * fTrackFArray
std::vector< TH1 * > fHitHistoVec
void ClearHistoMaps(std::map< TString, TH1 * > *myHistos) const