Skip to content

Commit 0290ee5

Browse files
committed
explicit added
1 parent a705103 commit 0290ee5

9 files changed

Lines changed: 197 additions & 183 deletions

File tree

Lines changed: 47 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,93 @@
1-
#include "T0Simulation/Detector.h"
1+
#if !defined(__CLING__) || defined(__ROOTCLING__)
22
#include "FITBase/Digit.h"
3+
#include "FITSimulation/HitType.h"
34
#include <TH2F.h>
4-
void readHitsDigits()
5+
#include <TTree.h>
6+
#include <TFile.h>
7+
void readHitsDigits()
58
{
69
using namespace o2::fit;
710
// using namespace o2::fit::Digit;
8-
11+
912
// Create histograms
1013
TDirectory* cwd = gDirectory;
1114
gDirectory = 0x0;
12-
13-
TH2F *hMultHit = new TH2F("hMultHits","photons Hits ",210, 0, 210, 500, 0, 5000);
14-
TH2F *hTimeHitA = new TH2F("hTimeAhit", "Time Hits", 210, 0, 210, 1000, 11, 12);
15-
TH2F *hTimeHitC = new TH2F("hTimeChit", "Time Hits", 210, 0, 210, 1000, 2.8, 3.8);
16-
TH2F *hMultDig = new TH2F("hMultDig","photons Digits ",210, 0, 210, 500, 0, 20);
17-
TH2F *hTimeDig = new TH2F("hTimeDig", "Time Digits", 210, 0, 210, 100, -1, 1);
1815

19-
gDirectory = cwd;
20-
21-
TFile *fhit = new TFile("o2sim.root");
22-
TTree *hitTree = (TTree*)fhit->Get("o2sim");
16+
TH2F* hMultHit = new TH2F("hMultHits", "photons Hits ", 210, 0, 210, 500, 0, 5000);
17+
TH2F* hTimeHitA = new TH2F("hTimeAhit", "Time Hits", 210, 0, 210, 1000, 11, 12);
18+
TH2F* hTimeHitC = new TH2F("hTimeChit", "Time Hits", 210, 0, 210, 1000, 2.8, 3.8);
19+
TH2F* hMultDig = new TH2F("hMultDig", "photons Digits ", 210, 0, 210, 500, 0, 20);
20+
TH2F* hTimeDig = new TH2F("hTimeDig", "Time Digits", 210, 0, 210, 100, -1, 1);
21+
22+
gDirectory = cwd;
23+
24+
TFile* fhit = new TFile("o2sim.root");
25+
TTree* hitTree = (TTree*)fhit->Get("o2sim");
2326
std::vector<o2::fit::HitType>* hitArray = nullptr;
2427
hitTree->SetBranchAddress("T0Hit", &hitArray);
2528
Int_t nevH = hitTree->GetEntries(); // hits are stored as one event per entry
2629
// std::cout << "Found " << nevH << " events with hits " << std::endl;
27-
30+
2831
Double_t hit_time[240];
2932
Int_t countE[240];
30-
// Event ------------------------- LOOP
31-
for (Int_t ievent=0; ievent<nevH; ievent++){
33+
// Event ------------------------- LOOP
34+
for (Int_t ievent = 0; ievent < nevH; ievent++) {
3235
hitTree->GetEntry(ievent);
33-
for (int ii=0; ii<240; ii++) { countE[ii]=0;hit_time[ii]=0; }
36+
for (int ii = 0; ii < 240; ii++) {
37+
countE[ii] = 0;
38+
hit_time[ii] = 0;
39+
}
3440
for (auto& hit : *hitArray) {
3541
Int_t detID = hit.GetDetectorID();
3642
hit_time[detID] = hit.GetTime();
37-
hTimeHitA -> Fill(detID, hit_time[detID]);
38-
hTimeHitC -> Fill(detID, hit_time[detID]);
39-
countE[detID]++;
43+
hTimeHitA->Fill(detID, hit_time[detID]);
44+
hTimeHitC->Fill(detID, hit_time[detID]);
45+
countE[detID]++;
4046
}
41-
for (int ii=0; ii<208; ii++) {
42-
if (countE[ii]>100) {
43-
hMultHit -> Fill(ii, countE[ii]);
44-
// std::cout<<ii<<" "<<countE[ii]<<endl;
47+
for (int ii = 0; ii < 208; ii++) {
48+
if (countE[ii] > 100) {
49+
hMultHit->Fill(ii, countE[ii]);
50+
// std::cout<<ii<<" "<<countE[ii]<<endl;
4551
}
4652
}
4753
}
48-
54+
4955
TFile* fdig = TFile::Open("t0digits.root");
5056
std::cout << " Open digits file " << std::endl;
5157
TTree* digTree = (TTree*)fdig->Get("o2sim");
52-
std::vector<o2::fit::Digit> * digArr = new std::vector<Digit>;
58+
std::vector<o2::fit::Digit>* digArr = new std::vector<Digit>;
5359
digTree->SetBranchAddress("T0Digit", &digArr);
5460
Int_t nevD = digTree->GetEntries(); // digits in cont. readout may be grouped as few events per entry
55-
std::cout << "Found " << nevD << " events with digits " << std::endl;
61+
// std::cout << "Found " << nevD << " events with digits " << std::endl;
5662
Float_t cfd[208], amp[208], part[208];
5763
for (Int_t iev = 0; iev < nevD; iev++) {
5864
digTree->GetEvent(iev);
5965
for (const auto& digit : *digArr) {
60-
for (int ii=0; ii<208; ii++) { cfd[ii]=amp[ii]=0; }
66+
for (int ii = 0; ii < 208; ii++) {
67+
cfd[ii] = amp[ii] = 0;
68+
}
6169
Double_t evtime = digit.getTime();
6270
for (const auto& d : digit.getChDgData()) {
63-
Int_t mcp = d.ChId;
64-
cfd[mcp] = d.CFDTime - evtime - 12.5;
65-
amp[mcp] = d.QTCAmpl;
66-
part[mcp] = d.numberOfParticles;
67-
cout<<iev<<" "<<mcp<<" "<< cfd[mcp]<<" "<< amp[mcp]<<" "<<part[mcp]<<endl;
68-
hMultDig ->Fill(Float_t (mcp),amp[mcp]);
69-
hTimeDig ->Fill(Float_t (mcp),cfd[mcp]);
71+
Int_t mcp = d.ChId;
72+
cfd[mcp] = d.CFDTime - evtime - 12.5;
73+
amp[mcp] = d.QTCAmpl;
74+
part[mcp] = d.numberOfParticles;
75+
// cout << iev << " " << mcp << " " << cfd[mcp] << " " << amp[mcp] << " " << part[mcp] << endl;
76+
hMultDig->Fill(Float_t(mcp), amp[mcp]);
77+
hTimeDig->Fill(Float_t(mcp), cfd[mcp]);
7078
}
7179
}
72-
}
73-
TFile *Hfile = new TFile("FigFit_hits_pp.root","RECREATE");
80+
}
81+
TFile* Hfile = new TFile("FigFit_hits_pp.root", "RECREATE");
7482
printf("Writting histograms to root file \n");
75-
Hfile->cd();
83+
Hfile->cd();
7684
//Create a canvas, set the view range, show histograms
7785
// TCanvas *c1 = new TCanvas("c1","Alice T0 Time ",400,10,600,600);
7886
hTimeHitA->Write();
7987
hTimeHitC->Write();
8088
hMultHit->Write();
8189
hTimeDig->Write();
8290
hMultDig->Write();
83-
8491

8592
} // end of macro
86-
87-
88-
89-
90-
93+
#endif

Detectors/FIT/T0/macros/run_reco_t0.C

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,57 +15,58 @@
1515
#endif
1616

1717
void run_reco_t0(std::string inpudDig = "t0digits.root",
18-
std::string outName = "o2reco_t0.root",
19-
std::string inputGRP = "o2sim_grp.root") {
18+
std::string outName = "o2reco_t0.root",
19+
std::string inputGRP = "o2sim_grp.root")
20+
{
2021

2122
// Initialize logger
22-
FairLogger *logger = FairLogger::GetLogger();
23+
FairLogger* logger = FairLogger::GetLogger();
2324
logger->SetLogVerbosityLevel("LOW");
2425
logger->SetLogScreenLevel("DEBUG");
25-
26+
2627
// Setup timer
2728
TStopwatch timer;
2829

2930
TFile* fdig = TFile::Open("t0digits.root");
3031
std::cout << " Open digits file " << std::endl;
3132
TTree* digTree = (TTree*)fdig->Get("o2sim");
3233
digTree->Print();
33-
std::vector<o2::fit::Digit> * digits = new std::vector<o2::fit::Digit>;
34+
std::vector<o2::fit::Digit>* digits = new std::vector<o2::fit::Digit>;
3435
digTree->SetBranchAddress("T0Digit", &digits);
3536
Int_t nevD = digTree->GetEntries(); // digits in cont. readout may be grouped as few events per entry
3637
std::cout << "Found " << nevD << " events with digits " << std::endl;
37-
38+
3839
//std::vector<o2::fit::RecPoints> recPoints;
3940
std::vector<o2::t0::RecPoints>* recPointsP = new std::vector<o2::t0::RecPoints>;
40-
41-
TFile outFile(outName.c_str(),"recreate");
41+
42+
TFile outFile(outName.c_str(), "recreate");
4243
TTree outTree("o2sim", "T0RecPoints");
4344
outTree.Branch("T0Cluster", &recPointsP);
44-
45+
4546
o2::t0::CollisionTimeRecoTask recoFIT;
4647
timer.Start();
47-
for (int iEv=0; iEv<nevD; iEv++) {
48+
for (int iEv = 0; iEv < nevD; iEv++) {
4849
digTree->GetEntry(iEv);
4950
recPointsP->resize(digits->size());
50-
for (size_t collID=0; collID < digits->size(); ++collID)
51+
for (size_t collID = 0; collID < digits->size(); ++collID)
5152
recoFIT.Process((*digits)[collID], (*recPointsP)[collID]);
5253
outTree.Fill();
5354
}
54-
55+
5556
outTree.Print();
5657
outFile.ls();
5758
timer.Stop();
5859
outTree.Write();
5960
Double_t rtime = timer.RealTime();
6061
Double_t ctime = timer.CpuTime();
61-
62-
Float_t cpuUsage=ctime/rtime;
62+
63+
Float_t cpuUsage = ctime / rtime;
6364
std::cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
6465
std::cout << cpuUsage;
6566
std::cout << "</DartMeasurement>" << std::endl;
6667
std::cout << "Macro finished succesfully." << std::endl;
67-
68+
6869
std::cout << "Real time " << rtime << " s, CPU time " << ctime
69-
<< "s" << std::endl << std::endl;
70-
70+
<< "s" << std::endl
71+
<< std::endl;
7172
}

Detectors/FIT/V0/base/src/Geometry.cxx

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,21 @@ ClassImp(o2::v0::Geometry);
2525

2626
using namespace o2::v0;
2727

28-
Geometry::Geometry(EGeoType initType){
28+
Geometry::Geometry(EGeoType initType)
29+
{
2930
mGeometryType = initType;
3031
initializeVectors();
3132
initializeLuts();
3233
buildGeometry();
3334
}
3435

35-
Geometry::Geometry(const Geometry& geom){
36+
Geometry::Geometry(const Geometry& geom)
37+
{
3638
this->mGeometryType = geom.mGeometryType;
3739
}
3840

39-
void Geometry::initializeVectors(){
41+
void Geometry::initializeVectors()
42+
{
4043
// RADII
4144
// Index of rAvgScint is NOT linked directly to any ring number
4245
mvrAvgScint.push_back(4.01); // ring 1 lower radius
@@ -47,25 +50,26 @@ void Geometry::initializeVectors(){
4750
mvrAvgScint.push_back(72.09);
4851

4952
// Set real plastic radi (reduced by painting of 0.06 and separation gap of 0.08)
50-
for(uint16_t ir=1; ir<mvrAvgScint.size(); ir++) { // shift of indices to match index with ring number (starting from 0)
53+
for (uint16_t ir = 1; ir < mvrAvgScint.size(); ir++) { // shift of indices to match index with ring number (starting from 0)
5154
mvrMaxScint.push_back(mvrAvgScint.at(ir) - sDrSeparationScint);
5255
}
53-
for(uint16_t ir=0; ir<mvrAvgScint.size()-1; ir++) {
56+
for (uint16_t ir = 0; ir < mvrAvgScint.size() - 1; ir++) {
5457
mvrMinScint.push_back(mvrAvgScint.at(ir) + sDrSeparationScint);
5558
}
5659
// Now indices of rMinScint and rMaxScint correspond to the same ring
5760

5861
// AZIMUTH
59-
for(uint16_t isector=0; isector<sBaseNumberOfSectors; isector++){
60-
float phiMin = sPhiMinScint + isector*sDphiScint + sGlobalPhiRotation;
62+
for (uint16_t isector = 0; isector < sBaseNumberOfSectors; isector++) {
63+
float phiMin = sPhiMinScint + isector * sDphiScint + sGlobalPhiRotation;
6164
std::stringstream ssNameRot;
6265
ssNameRot << "rotPhiSector" << isector;
6366
mvPhiRot.push_back(new TGeoRotation(ssNameRot.str().c_str(), phiMin, 0.0, 0.0));
64-
mvPhiRot.at(mvPhiRot.size()-1)->RegisterYourself();
67+
mvPhiRot.at(mvPhiRot.size() - 1)->RegisterYourself();
6568
}
6669
}
6770

68-
void Geometry::buildGeometry(){
71+
void Geometry::buildGeometry()
72+
{
6973
TGeoVolume* vALIC = gGeoManager->GetVolume("cave");
7074
if (!vALIC) {
7175
LOG(FATAL) << "Could not find the top volume";
@@ -76,46 +80,49 @@ void Geometry::buildGeometry(){
7680
LOG(INFO) << "Geometry::buildGeometry()::Volume name = " << volV0->GetName();
7781
assembleSectors(volV0);
7882

79-
TGeoTranslation* trGlobalZshift = new TGeoTranslation(0,0,sZposition);
83+
TGeoTranslation* trGlobalZshift = new TGeoTranslation(0, 0, sZposition);
8084

8185
vALIC->AddNode(volV0, 0, trGlobalZshift);
8286
}
8387

84-
TGeoVolumeAssembly* Geometry::buildSector(uint16_t iSector){
88+
TGeoVolumeAssembly* Geometry::buildSector(uint16_t iSector)
89+
{
8590
new TGeoBBox("boolBoxScintSeparator", mvrMaxScint.at(mvrMaxScint.size() - 1), sDySeparationScint * 2, sDzScint + sEpsilon);
8691

8792
std::stringstream ssName;
88-
ssName << "sector" << iSector+1;
89-
TGeoVolumeAssembly *sector = new TGeoVolumeAssembly(ssName.str().c_str());
90-
for(uint16_t ir=0; ir<mvrMinScint.size(); ir++){ // loop over rings
91-
int iCell = iSector*mvrMinScint.size() + ir;
93+
ssName << "sector" << iSector + 1;
94+
TGeoVolumeAssembly* sector = new TGeoVolumeAssembly(ssName.str().c_str());
95+
for (uint16_t ir = 0; ir < mvrMinScint.size(); ir++) { // loop over rings
96+
int iCell = iSector * mvrMinScint.size() + ir;
9297
std::stringstream ssNameGeoTube, ssNameGeoComposite;
93-
ssNameGeoTube << "cellGeoTube" << iCell+1;
94-
ssNameGeoComposite << "cellGeoComposite" << iCell+1;
98+
ssNameGeoTube << "cellGeoTube" << iCell + 1;
99+
ssNameGeoComposite << "cellGeoComposite" << iCell + 1;
95100

96101
// Generate separation between sectors by subtracting two cuboids from each tube segment
97102
new TGeoTubeSeg(ssNameGeoTube.str().c_str(), mvrMinScint.at(ir), mvrMaxScint.at(ir), sDzScint, sPhiMinScint, sDphiScint);
98103
std::string booleanFormula = "(";
99-
booleanFormula += ssNameGeoTube.str() + "-boolBoxScintSeparator)"; // subtract counter-clockwise box
100-
booleanFormula += (std::string)"-boolBoxScintSeparator" + ":rotPhiSector1"; // subtract clockwise box (same but rotated by 45 degrees)
104+
booleanFormula += ssNameGeoTube.str() + "-boolBoxScintSeparator)"; // subtract counter-clockwise box
105+
booleanFormula += (std::string) "-boolBoxScintSeparator" + ":rotPhiSector1"; // subtract clockwise box (same but rotated by 45 degrees)
101106
TGeoCompositeShape* geoCell = new TGeoCompositeShape(ssNameGeoComposite.str().c_str(), booleanFormula.c_str());
102107

103108
TGeoMedium* kMed = gGeoManager->GetMedium("V0_Scintillator$");
104109
TGeoVolume* volCell = new TGeoVolume("V0cell", geoCell, kMed);
105110

106111
volCell->SetLineColor(kYellow);
107-
sector->AddNode(volCell, iCell+1);
112+
sector->AddNode(volCell, iCell + 1);
108113
}
109114
return sector;
110115
}
111116

112-
void Geometry::assembleSectors(TGeoVolumeAssembly *volV0){
113-
for(uint16_t isector=0; isector<mvPhiRot.size(); isector++){
114-
TGeoVolumeAssembly *sector = buildSector(isector);
115-
volV0->AddNode(sector, isector+1, mvPhiRot.at(isector));
117+
void Geometry::assembleSectors(TGeoVolumeAssembly* volV0)
118+
{
119+
for (uint16_t isector = 0; isector < mvPhiRot.size(); isector++) {
120+
TGeoVolumeAssembly* sector = buildSector(isector);
121+
volV0->AddNode(sector, isector + 1, mvPhiRot.at(isector));
116122
}
117123
}
118124

119-
void Geometry::initializeLuts(){
125+
void Geometry::initializeLuts()
126+
{
120127
// TODO: initialize sth
121128
}

0 commit comments

Comments
 (0)