FairRoot/PandaRoot
conMvdDigi.C
Go to the documentation of this file.
1 // root macro to analyze the clusterization output
2 {
3  bool verbose = false;
4 
5  // ----- Load libraries ------------------------------------------------
6  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
7  gROOT->LoadMacro("$VMCWORKDIR/macro/mvd/Tools.C");
9 
10  // ----- Timer --------------------------------------------------------
11  TStopwatch timer;
12  timer.Start();
13  // ------------------------------------------------------------------------
14  std::string HitFileName="data/testhits.hit";
15  std::string CalibFileName="calib.par";
16  std::string GeoFileName="teststation.root";
17  std::string SenParName="mvd.ddteststation.par";
18 
19  PndMvdConvertApv* ApvConverter= new PndMvdConvertApv(CalibFileName, HitFileName);
20  int nEvents = ApvConverter->GetNofEvents();
21 // if (nEvents > 1000) nEvents = 1000;
22 
23  FairRunAna *fRun= new FairRunAna();
24 
25  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
26  FairParAsciiFileIo* parInput2 = new FairParAsciiFileIo();
27  parInput2->open(SenParName.c_str(),"in");
28  rtdb->setFirstInput(parInput2);
29 
30  fRun->SetGeomFile(GeoFileName.c_str());
31  fRun->SetOutputFile("data/cosmic.root");
32 
33 //---- Set Converter
35  fRun->AddTask(ApvTask);
36 //----- Set Cluster
37 
38  // PndMvdStripClusterTask* mvdClusterizer = new PndMvdStripClusterTask();
39  // fRun->AddTask(mvdClusterizer);
40 
41  fRun->LoadGeometry();
42 // ---- start run
43  fRun->Init();
44  fRun->Run(0, nEvents);
45 
46 /*
47  // --------- HISTOS ---------
48  int n = 100; int low = 0;;
49 
50  TH2I* hisStripTop = new TH2I("hisstriptop","Strip Top channel&fe numbers",20,0,20,130,0,130);
51 
52  TH2I* hisStripBot = new TH2I("hisstripbot","Strip Bot channel&fe numbers",20,0,20,130,0,130);
53 
54  TH1I* hisStripStrip = new TH1I("hisstripstrip","Strip numbers",15*128,0,15*128);
55 
56  TH1D* hisStripCharge = new TH1D("hisstripcharge","Strip Charge content",100,0.,1e5);
57 
58  TH1D* hisStripChargeTop = new TH1D("hisstripchargetop","Strip Charge content",100,0.,1e5);
59  hisStripChargeTop->SetLineColor(kBlue);
60 
61  TH1D* hisStripChargeBot = new TH1D("hisstripchargebot","Strip Charge content",100,0.,1e5);
62  hisStripChargeBot->SetLineColor(kRed);
63  // --------- HISTOS ---------
64 
65 
66  TVector3 vecmc, mommc;
67  Double_t tmpx,tmpy,tmpz;
68  TVector2 locals, localmc, localdiff;
69  int col, row, fe;
70  double x,y;
71 
72  int nrFeChannels=3;
73  int nrStrips=3*128;
74 
75  for (Int_t j=0; j<nEvents && j<t->GetEntriesFast(); j++)
76  {
77  t->GetEntry(j);
78  if(verbose) cout<<"Event No "<<j<<endl;
79 
80  // ----- STRIP DIGIS -----
81  for (Int_t i=0; i<digiStrip_array->GetEntriesFast(); i++)
82  {
83  PndSdsDigiStrip *stripdigi = digiStrip_array->At(i);
84  fe = stripdigi->GetFE();
85  col = stripdigi->GetChannel();
86  int strip = fe * nrFeChannels + col;
87  hisStripStrip->Fill(strip);
88  hisStripCharge->Fill(stripdigi->GetCharge());
89  if (strip <= nrStrips)
90  {
91  hisStripTop->Fill(fe,col);
92  hisStripChargeTop->Fill(stripdigi->GetCharge());
93  } else {
94  hisStripBot->Fill(fe,col);
95  hisStripChargeBot->Fill(stripdigi->GetCharge());
96  }
97  }
98 
99  }// end for j (events)
100 
101 Int_t a = 1, b = 1;
102 
103 TCanvas* can1 = new TCanvas("MvdTestPlot","real Hit view",0,0,a*400,b*400);
104 can1->Divide(a,b);
105 TPad* mypad=0;
106 
107 can1->cd(1);
108 mypad=gPad;
109 mypad.Divide(2,2);
110 mypad->cd(1);DrawNice2DHisto(hisStripTop);
111 mypad->cd(2);DrawNice2DHisto(hisStripBot);
112 mypad->cd(3);hisStripStrip->DrawCopy();
113 mypad->cd(4);hisStripCharge->DrawCopy();
114 hisStripChargeTop->DrawCopy("sames");
115 hisStripChargeBot->DrawCopy("sames");
116 can1->Update();mypad=(TPad*)gPad; BetterStatBox(mypad);
117 
118 can1->cd(2);
119 mypad=gPad;
120 mypad.Divide(2,2);
121 mypad->cd(1);
122 mypad->cd(2);
123 mypad->cd(3);
124 mypad->cd(4);
125 
126 // can1->Update();
127 //can1->Print(picture.Data());*/
128 
129 
130  // ----- Finish -------------------------------------------------------
131  timer.Stop();
132  Double_t rtime = timer.RealTime();
133  Double_t ctime = timer.CpuTime();
134  cout << endl << endl;
135  cout << "Macro finished succesfully." << endl;
136  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
137  cout << endl;
138  // ------------------------------------------------------------------------
139 
140 }
#define verbose
Convert meassured data into PndSdsDigiStrip.
Convert Task of data.
FairRunAna * fRun
Definition: hit_dirc.C:58
TString HitFileName
Double_t
Int_t nEvents
Definition: hit_dirc.C:11
TStopwatch timer
Definition: hit_dirc.C:51
PndMvdConvertApv * ApvConverter
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
FairParAsciiFileIo * parInput2
Definition: conMvdDigi.C:26
Double_t ctime
Definition: hit_dirc.C:114
std::string SenParName
Definition: conMvdDigi.C:17
PndMvdConvertApvTask * ApvTask
Definition: conMvdDigi.C:34
std::string GeoFileName
Definition: conMvdDigi.C:16
Double_t rtime
Definition: hit_dirc.C:113
LoadPandaStyle()
TString CalibFileName