Skip to content

Commit ecbbddd

Browse files
chiarazampolliktf
authored andcommitted
Adapting to new cluster format
1 parent 6602dad commit ecbbddd

1 file changed

Lines changed: 88 additions & 38 deletions

File tree

macro/checkTOFMatching.C

Lines changed: 88 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ void checkTOFMatching()
1515
// getting TOF info
1616
TFile* fmatchTOF = new TFile("o2match_tof.root");
1717
TTree* matchTOF = (TTree*)fmatchTOF->Get("matchTOF");
18-
std::vector<std::pair<int, o2::dataformats::MatchInfoTOF>>* TOFMatchInfo;
19-
TOFMatchInfo = new std::vector<std::pair<int, o2::dataformats::MatchInfoTOF>>;
18+
std::vector<std::pair<o2::dataformats::EvIndex<int, int>, o2::dataformats::MatchInfoTOF>>* TOFMatchInfo;
19+
TOFMatchInfo = new std::vector<std::pair<o2::dataformats::EvIndex<int, int>, o2::dataformats::MatchInfoTOF>>;
2020
matchTOF->SetBranchAddress("TOFMatchInfo", &TOFMatchInfo);
2121

2222
// getting the ITSTPCtracks
@@ -29,9 +29,9 @@ void checkTOFMatching()
2929
TFile* ftracksTPC = new TFile("tpctracks.root");
3030
TTree* tpcTree = (TTree*)ftracksTPC->Get("events");
3131
std::vector<o2::TPC::TrackTPC>* mTPCTracksArrayInp = new std::vector<o2::TPC::TrackTPC>;
32-
tpcTree->SetBranchAddress("TPCTracks", &mTPCTracksArrayInp);
32+
tpcTree->SetBranchAddress("Tracks", &mTPCTracksArrayInp);
3333
o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mcTPC = new o2::dataformats::MCTruthContainer<o2::MCCompLabel>();
34-
tpcTree->SetBranchAddress("TPCTracksMCTruth", &mcTPC);
34+
tpcTree->SetBranchAddress("TracksMCTruth", &mcTPC);
3535

3636
// getting the ITS tracks
3737
TFile* ftracksITS = new TFile("o2trac_its.root");
@@ -63,7 +63,7 @@ void checkTOFMatching()
6363
// now looping over the matched tracks
6464
nMatches += TOFMatchInfo->size();
6565
for (int imatch = 0; imatch < TOFMatchInfo->size(); imatch++) {
66-
int indexITSTPCtrack = TOFMatchInfo->at(imatch).first;
66+
int indexITSTPCtrack = TOFMatchInfo->at(imatch).first.getIndex();
6767
o2::dataformats::MatchInfoTOF infoTOF = TOFMatchInfo->at(imatch).second;
6868
int tofClIndex = infoTOF.getTOFClIndex();
6969
float chi2 = infoTOF.getChi2();
@@ -86,42 +86,92 @@ void checkTOFMatching()
8686
int nContributingChannels = tofCluster.getNumOfContributingChannels();
8787
int mainContributingChannel = tofCluster.getMainContributingChannel();
8888
Printf("The TOF cluster has %d contributing channels, and the main one is %d", nContributingChannels, mainContributingChannel);
89-
int* indices;
89+
int* indices = new int();
9090
o2::tof::Geo::getVolumeIndices(mainContributingChannel, indices);
9191
Printf("Indices of main contributing channel are %d, %d, %d, %d, %d", indices[0], indices[1], indices[2], indices[3], indices[4]);
92-
int* secondaryContributingChannels = new int[nContributingChannels];
93-
for (int ich = 1; ich < nContributingChannels; ich++) {
94-
bool isUpLeft = tofCluster.isUpLeftContributing();
95-
bool isUp = tofCluster.isUpContributing();
96-
bool isUpRight = tofCluster.isUpRightContributing();
97-
bool isRight = tofCluster.isRightContributing();
98-
bool isDownRight = tofCluster.isDownRightContributing();
99-
bool isDown = tofCluster.isDownContributing();
100-
bool isDownLeft = tofCluster.isDownLeftContributing();
101-
bool isLeft = tofCluster.isLeftContributing();
102-
Printf("isUpLeft = %d, isUp = %d, isUpRight = %d, isRight = %d, isDownRight = %d, isDown = %d, isDownLeft = %d, isLeft = %d", isUpLeft, isUp, isUpRight, isRight, isDownRight, isDown, isDownLeft, isLeft);
103-
int* indexCont = new int();
104-
indexCont[0] = indices[0];
105-
indexCont[1] = indices[1];
106-
indexCont[2] = indices[2];
107-
indexCont[3] = indices[3];
108-
indexCont[4] = indices[4];
109-
if (isDown || isDownRight || isDownLeft) { // decrease padZ
110-
indexCont[3]--;
111-
}
112-
if (isUp || isUpRight || isUpLeft) { // decrease padZ
113-
indexCont[3]++;
114-
}
115-
if (isRight || isDownRight || isUpRight) { // decrease padZ
116-
indexCont[4]++;
117-
}
118-
if (isLeft || isDownLeft || isUpLeft) { // decrease padZ
119-
indexCont[4]--;
120-
}
121-
secondaryContributingChannels[ich - 1] = o2::tof::Geo::getIndex(indexCont);
122-
Printf("secondaryContributingChannels[%d] = %d", ich - 1, secondaryContributingChannels[ich - 1]);
92+
bool isUpLeft = tofCluster.isAdditionalChannelSet(o2::tof::Cluster::kUpLeft);
93+
bool isUp = tofCluster.isAdditionalChannelSet(o2::tof::Cluster::kUp);
94+
bool isUpRight = tofCluster.isAdditionalChannelSet(o2::tof::Cluster::kUpRight);
95+
bool isRight = tofCluster.isAdditionalChannelSet(o2::tof::Cluster::kRight);
96+
bool isDownRight = tofCluster.isAdditionalChannelSet(o2::tof::Cluster::kDownRight);
97+
bool isDown = tofCluster.isAdditionalChannelSet(o2::tof::Cluster::kDown);
98+
bool isDownLeft = tofCluster.isAdditionalChannelSet(o2::tof::Cluster::kDownLeft);
99+
bool isLeft = tofCluster.isAdditionalChannelSet(o2::tof::Cluster::kLeft);
100+
Printf("isUpLeft = %d, isUp = %d, isUpRight = %d, isRight = %d, isDownRight = %d, isDown = %d, isDownLeft = %d, isLeft = %d", isUpLeft, isUp, isUpRight, isRight, isDownRight, isDown, isDownLeft, isLeft);
101+
int* indexCont = new int();
102+
indexCont[0] = indices[0];
103+
indexCont[1] = indices[1];
104+
indexCont[2] = indices[2];
105+
indexCont[3] = indices[3];
106+
indexCont[4] = indices[4];
107+
int numberOfSecondaryContributingChannels = 0;
108+
int secondaryContributingChannel = -1;
109+
if (isDown) {
110+
indexCont[3]--;
111+
numberOfSecondaryContributingChannels++;
112+
secondaryContributingChannel = o2::tof::Geo::getIndex(indexCont);
113+
Printf("secondaryContributingChannel[down] = %d", secondaryContributingChannel);
114+
indexCont[3] = indices[3];
123115
}
124-
116+
if (isDownRight) {
117+
indexCont[3]--;
118+
indexCont[4]++;
119+
numberOfSecondaryContributingChannels++;
120+
secondaryContributingChannel = o2::tof::Geo::getIndex(indexCont);
121+
Printf("secondaryContributingChannel[downright] = %d", secondaryContributingChannel);
122+
indexCont[3] = indices[3];
123+
indexCont[4] = indices[4];
124+
}
125+
if (isDownLeft) {
126+
indexCont[3]--;
127+
indexCont[4]--;
128+
numberOfSecondaryContributingChannels++;
129+
secondaryContributingChannel = o2::tof::Geo::getIndex(indexCont);
130+
Printf("secondaryContributingChannel[downleft] = %d", secondaryContributingChannel);
131+
indexCont[3] = indices[3];
132+
indexCont[4] = indices[4];
133+
}
134+
if (isUp) {
135+
indexCont[3]++;
136+
numberOfSecondaryContributingChannels++;
137+
secondaryContributingChannel = o2::tof::Geo::getIndex(indexCont);
138+
Printf("secondaryContributingChannel[up] = %d", secondaryContributingChannel);
139+
indexCont[3] = indices[3];
140+
}
141+
if (isUpRight) {
142+
indexCont[3]++;
143+
indexCont[4]++;
144+
numberOfSecondaryContributingChannels++;
145+
secondaryContributingChannel = o2::tof::Geo::getIndex(indexCont);
146+
Printf("secondaryContributingChannel[upright] = %d", secondaryContributingChannel);
147+
indexCont[3] = indices[3];
148+
indexCont[4] = indices[4];
149+
}
150+
if (isUpLeft) { // increase padZ
151+
indexCont[3]++;
152+
indexCont[4]--;
153+
numberOfSecondaryContributingChannels++;
154+
secondaryContributingChannel = o2::tof::Geo::getIndex(indexCont);
155+
Printf("secondaryContributingChannel[upleft] = %d", secondaryContributingChannel);
156+
indexCont[3] = indices[3];
157+
indexCont[4] = indices[4];
158+
}
159+
if (isRight) { // increase padX
160+
indexCont[4]++;
161+
numberOfSecondaryContributingChannels++;
162+
secondaryContributingChannel = o2::tof::Geo::getIndex(indexCont);
163+
Printf("secondaryContributingChannel[right] = %d", secondaryContributingChannel);
164+
indexCont[4] = indices[4];
165+
}
166+
if (isLeft) { // decrease padX
167+
indexCont[4]--;
168+
numberOfSecondaryContributingChannels++;
169+
secondaryContributingChannel = o2::tof::Geo::getIndex(indexCont);
170+
Printf("secondaryContributingChannel[left] = %d", secondaryContributingChannel);
171+
indexCont[4] = indices[4];
172+
}
173+
Printf("Total number of secondary channels= %d", numberOfSecondaryContributingChannels);
174+
125175
o2::dataformats::TrackTPCITS trackITSTPC = mTracksArrayInp->at(indexITSTPCtrack);
126176
const o2::dataformats::EvIndex<int, int>& evIdxTPC = trackITSTPC.getRefTPC();
127177
Printf("matched TPCtrack: eventID = %d, indexID = %d", evIdxTPC.getEvent(), evIdxTPC.getIndex());

0 commit comments

Comments
 (0)