1 #include "P0DAnalysisUtils.hxx" 2 #include "EventBoxId.hxx" 28 for (
int it = 0; it <
event.nParticles; it++) {
31 if (!p0dParticle)
continue;
32 selParts[count] = p0dParticle;
45 for (
int iv = 0; iv <
event.nVertices; iv++) {
47 if (!p0dVertex)
continue;
48 selverts[count] = p0dVertex;
59 std::vector<AnaBunchC*> bunches = spill.
Bunches;
66 std::vector<int> clustersUsed;
67 for (std::vector<AnaBunchC*>::iterator it = bunches.begin(); it != bunches.end(); ++it) {
70 if (!p0dBunch)
return nmichels;
73 if (p0dBunch->
Bunch < firstBunch && p0dBunch->
Bunch!=-1)
continue;
76 for (Int_t c = 0 ; c<p0dBunch->nClusters; c++){
79 if (cluster->AlgorithmName.compare(
"TP0DTagMuonDecay") == 0 && find(clustersUsed.begin(),clustersUsed.end(),cluster->UniqueID) == clustersUsed.end() ){
86 for (Int_t h = 0 ; h<cluster->nHits; h++){
92 if (hit->Time>maxTime) maxTime=hit->Time;
93 if (hit->Time<minTime) minTime=hit->Time;
94 delayedClusters[nmichels]->NHits++;
95 delayedClusters[nmichels]->RawChargeSum += hit->Charge;
97 delayedClusters[nmichels]->MinTime = maxTime;
98 delayedClusters[nmichels]->MaxTime = minTime;
101 clustersUsed.push_back(cluster->UniqueID);
128 if (anaP0DVertex->nClusters == 0)
return nmichels;
130 std::vector<int> clustersUsed;
131 for (Int_t c = 0 ; c < anaP0DVertex->nClusters; c++){
134 if (cluster->AlgorithmName.compare(
"TP0DTagMuonDecay") == 0 && find(clustersUsed.begin(),clustersUsed.end(),cluster->UniqueID) == clustersUsed.end() ){
138 Float_t minTime=1e10;
139 for (Int_t h = 0 ; h<cluster->nHits; h++){
145 if (hit->Time>maxTime) maxTime=hit->Time;
146 if (hit->Time<minTime) minTime=hit->Time;
147 delayedClusters[nmichels]->NHits++;
148 delayedClusters[nmichels]->RawChargeSum += hit->Charge;
150 delayedClusters[nmichels]->MinTime = maxTime;
151 delayedClusters[nmichels]->MaxTime = minTime;
154 clustersUsed.push_back(cluster->UniqueID);
170 for(
int i = 0; i < nObj; ++i){
188 for(
int i = 0; i < nObj; ++i){
197 for(
int i = 0; i < nObj; ++i){
198 tgtArr[i] = srcArr[i];
203 void boxP0DUtils::FillVerticesFinal(
AnaEventB& event){
209 if (EventBox->VerticesInGroup[EventBoxP0D2::kVerticesInP0DFinal])
return;
212 Int_t nP0D = p0dUtils::GetAllP0DVertices(event,vertices);
215 p0dUtils::CopyArray(EventBox->VerticesInGroup[EventBoxP0D2::kVerticesInP0DFinal],vertices,nP0D);
221 void boxP0DUtils::FillP0DParticles(
AnaEventB& event){
227 if (EventBox->RecObjectsInGroup[EventBoxP0D2::kAllP0DParticles])
return;
231 Int_t nP0D = p0dUtils::GetAllP0DParticles(event,p0dParticles);
236 anaUtils::CreateArray(EventBox->RecObjectsInGroup[EventBoxP0D2::kAllP0DParticles],nP0D);
237 anaUtils::CreateArray(EventBox->RecObjectsInGroup[EventBoxP0D2::kP0DTracks], nP0D);
238 anaUtils::CreateArray(EventBox->RecObjectsInGroup[EventBoxP0D2::kP0DShowers], nP0D);
241 for(
int i = 0; i < nP0D; ++i){
242 EventBox->RecObjectsInGroup[EventBoxP0D2::kAllP0DParticles][i] = p0dParticles[i];
245 if (p0dParticles[i]->AlgorithmName.find(
"Shower")!=std::string::npos)
246 EventBox->RecObjectsInGroup[EventBoxP0D2::kP0DShowers][nShowers++] = p0dParticles[i];
248 EventBox->RecObjectsInGroup[EventBoxP0D2::kP0DTracks][nTracks++] = p0dParticles[i];
252 anaUtils::ResizeArray(EventBox->RecObjectsInGroup[EventBoxP0D2::kP0DTracks], nTracks);
253 anaUtils::ResizeArray(EventBox->RecObjectsInGroup[EventBoxP0D2::kP0DShowers], nShowers);
AnaP0DParticle * GetP0DParticle(AnaParticleB *part)
Get the P0D particle from a AnaParticleB: either a segment in a global track or the cast of the P0D-o...
int nP0DSegments
How many P0D tracks are associated with this track.
Int_t GetNMichelElectrons(const AnaSpillB &spill, Int_t firstBunch=0)
Get the number of P0D michel electrons.
Representation of a global track.
AnaP0DParticleB * P0DSegments[NMAXP0DS]
The P0D segments that contributed to this global track.
Int_t nVerticesInGroup[NMAXVERTEXGROUPS]
Different groups of tracks used for selection and systematics.
std::vector< AnaBunchC * > Bunches
The reconstructed objects, split into timing bunches.
void ResizeArray(AnaDelayedClustersB **&tgtArr, int nObj)
Resize the array.
AnaBunchB * OutOfBunch
Reconstructed objects that didn't fit into one of the timing bunches.
Int_t nRecObjectsInGroup[NMAXRECOBJECTGROUPS]
----—— RecObjects and TrueRecObjects used in the selection and systematics ------------—— ...
void CreateArray(AnaDelayedClustersB **&tgtArr, int nObj)
Create variable sized arrays of pointers.
Int_t Bunch
The index of this bunch (0-7).
Representation of a reconstructed particle (track or shower).
Int_t GetMichelElectrons(const AnaSpillB &spill, AnaDelayedClustersB **&delayedClusters, Int_t firstBunch=0)
Get the number of P0D michel electrons.