Skip to content

Commit

Permalink
ITS-Studies: add average cluster size study (#11615)
Browse files Browse the repository at this point in the history
* Modify to find average cluster size per track

* Produce plots for mass, cosPA, average cluster size distributions, with no cuts

* Add changes for MC (WIP)

* Implement MC functionality, configuration

* Fix formatting

* Fix formatting, update parameters, include ROOT output

* Fix formatting

* Fix variable names for consistent styling

* Fix formatting, styling

* Alter output format (TTree->TNtuple) and configuration parameter implementation, add author info

---------

Co-authored-by: Tucker Hwang <[email protected]>
Co-authored-by: Tucker Hwang <[email protected]>
  • Loading branch information
3 people authored Jul 14, 2023
1 parent fb6b7ad commit b11d2a4
Show file tree
Hide file tree
Showing 8 changed files with 835 additions and 114 deletions.
9 changes: 7 additions & 2 deletions Detectors/ITSMFT/ITS/postprocessing/studies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@

o2_add_library(ITSPostprocessing
SOURCES src/ImpactParameter.cxx
src/K0sInvMass.cxx
src/AvgClusSize.cxx
src/ITSStudiesConfigParam.cxx
PUBLIC_LINK_LIBRARIES O2::GlobalTracking
O2::GlobalTrackingWorkflowReaders
O2::GlobalTrackingWorkflowHelpers
O2::DataFormatsGlobalTracking)
O2::DataFormatsGlobalTracking)

o2_target_root_dictionary(ITSPostprocessing
HEADERS include/ITSStudies/ITSStudiesConfigParam.h
LINKDEF src/ITSStudiesLinkDef.h)
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

/// \file AvgClusSize.h
/// \author Tucker Hwang [email protected]

#ifndef O2_AVGCLUSSIZE_STUDY_H
#define O2_AVGCLUSSIZE_STUDY_H

#include "Framework/DataProcessorSpec.h"
#include "ReconstructionDataFormats/GlobalTrackID.h"
#include "DataFormatsGlobalTracking/RecoContainer.h"
#include "DetectorsBase/GRPGeomHelper.h"
#include "ITStracking/IOUtils.h"
#include "DataFormatsITS/TrackITS.h"
#include "CommonUtils/TreeStreamRedirector.h"
#include "Framework/Task.h"
#include <Steer/MCKinematicsReader.h>

#include "ITSStudies/ITSStudiesConfigParam.h"

#include <TH1F.h>
#include <THStack.h>
#include <TNtuple.h>

namespace o2
{
namespace its
{
namespace study
{
using namespace o2::framework;
using namespace o2::globaltracking;

using GTrackID = o2::dataformats::GlobalTrackID;
using ITSCluster = o2::BaseCluster<float>;
using mask_t = o2::dataformats::GlobalTrackID::mask_t;
using MCLabel = o2::MCCompLabel;

class AvgClusSizeStudy : public Task
{
public:
AvgClusSizeStudy(std::shared_ptr<DataRequest> dr, std::shared_ptr<o2::base::GRPGeomRequest> gr, bool isMC) : mDataRequest{dr}, mGGCCDBRequest(gr), mUseMC(isMC){};
~AvgClusSizeStudy() = default;
void init(InitContext& ic) final;
void run(ProcessingContext&) final;
void endOfStream(EndOfStreamContext&) final;
void finaliseCCDB(ConcreteDataMatcher&, void*) final;
void setClusterDictionary(const o2::itsmft::TopologyDictionary* d) { mDict = d; }

private:
// Other functions
void process(o2::globaltracking::RecoContainer&);
void loadData(o2::globaltracking::RecoContainer&);

// Helper functions
void prepareOutput();
void setStyle();
void updateTimeDependentParams(ProcessingContext& pc);
float getAverageClusterSize(o2::its::TrackITS*);
void getClusterSizes(std::vector<int>&, const gsl::span<const o2::itsmft::CompClusterExt>, gsl::span<const unsigned char>::iterator&, const o2::itsmft::TopologyDictionary*);
void fitMassSpectrum();
void saveHistograms();
void plotHistograms();
void fillEtaBin(double eta, double clusSize, int i);

// Running options
bool mUseMC;

// Data
std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
std::shared_ptr<DataRequest> mDataRequest;
std::vector<int> mInputClusterSizes;
gsl::span<const int> mInputITSidxs;
std::vector<o2::MCTrack> mMCTracks;
const o2::itsmft::TopologyDictionary* mDict = nullptr;

// Output plots
std::unique_ptr<o2::utils::TreeStreamRedirector> mDBGOut;
std::unique_ptr<TNtuple> mOutputNtuple;

std::unique_ptr<THStack> mMassSpectrumFull{};
std::unique_ptr<TH1F> mMassSpectrumFullNC{};
std::unique_ptr<TH1F> mMassSpectrumFullC{};
std::unique_ptr<THStack> mMassSpectrumK0s{};
std::unique_ptr<TH1F> mMassSpectrumK0sNC{};
std::unique_ptr<TH1F> mMassSpectrumK0sC{};
std::unique_ptr<THStack> mAvgClusSize{};
std::unique_ptr<TH1F> mAvgClusSizeNC{};
std::unique_ptr<TH1F> mAvgClusSizeC{};
std::unique_ptr<THStack> mAvgClusSizeCEta{};
std::vector<std::unique_ptr<TH1F>> mAvgClusSizeCEtaVec{};
std::unique_ptr<THStack> mMCStackCosPA{};
std::unique_ptr<THStack> mStackDCA{};
std::unique_ptr<THStack> mStackR{};
std::unique_ptr<THStack> mStackPVDCA{};
std::unique_ptr<TH1F> mCosPA{};
std::unique_ptr<TH1F> mMCCosPAK0{};
std::unique_ptr<TH1F> mMCCosPAnotK0{};
std::unique_ptr<TH1F> mCosPAtrueK0{};
std::unique_ptr<TH1F> mR{};
std::unique_ptr<TH1F> mRK0{};
std::unique_ptr<TH1F> mRnotK0{};
std::unique_ptr<TH1F> mRtrueK0{};
std::unique_ptr<TH1F> mDCA{};
std::unique_ptr<TH1F> mDCAK0{};
std::unique_ptr<TH1F> mDCAnotK0{};
std::unique_ptr<TH1F> mDCAtrueK0{};
std::unique_ptr<TH1F> mEtaNC{};
std::unique_ptr<TH1F> mEtaC{};
std::unique_ptr<TH1F> mMCMotherPDG{};
std::unique_ptr<TH1F> mPVDCAK0{};
std::unique_ptr<TH1F> mPVDCAnotK0{};

int globalNClusters = 0;
int globalNPixels = 0;

std::vector<double> mEtaBinUL; // upper edges for eta bins

// Counters for K0s identification
int nNotValid = 0;
int nNullptrs = 0;
int nPiPi = 0;
int nIsPiPiNotK0s = 0;
int nIsPiPiIsK0s = 0;
int nIsNotPiPiIsK0s = 0;
int nMotherIDMismatch = 0;
int nEvIDMismatch = 0;
int nK0s = 0;
int nNotK0s = 0;
int nPionsInEtaRange = 0;
int nInvalidK0sMother = 0;

const std::string mOutName{"o2standalone_cluster_size_study.root"};
std::unique_ptr<o2::steer::MCKinematicsReader> mMCKinReader;
};

o2::framework::DataProcessorSpec getAvgClusSizeStudy(mask_t srcTracksMask, mask_t srcClustersMask, bool useMC);
} // namespace study
} // namespace its
} // namespace o2

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

// #ifndef ALICEO2_ITSDPLTRACKINGPARAM_H_
// #define ALICEO2_ITSDPLTRACKINGPARAM_H_

#ifndef O2_AVGCLUSSIZE_STUDY_PARAM_H
#define O2_AVGCLUSSIZE_STUDY_PARAM_H

#include "CommonUtils/ConfigurableParam.h"
#include "CommonUtils/ConfigurableParamHelper.h"

namespace o2
{
namespace its
{
namespace study
{

struct AvgClusSizeStudyParamConfig : public o2::conf::ConfigurableParamHelper<AvgClusSizeStudyParamConfig> {

// K0s ID cuts
double Rmin = 0.5; // lower limit on V0 decay length
double Rmax = 5.4; // upper limit on V0 decay length
double cosPAmin = 0.995; // lower limit on cosine of pointing angle
double prongDCAmax = 0.2; // upper limit on DCA between two daughter prongs
double dauPVDCAmin = 0.2; // lower limit on DCA between prong and primary vertex

// Plotting options
bool performFit = false; // determine if fit to K0s mass spectrum will be done (set to false in the case of low statistics)
bool generatePlots = true; // TODO: not yet tested

// Average cluster size plot: eta binning parameters
double etaMin = -1.5; // lower edge of lowest bin for eta binning on average cluster size
double etaMax = 1.5; // upper edge for highest bin for eta binning on average cluster size
int etaNBins = 5; // number of eta bins

// Average cluster size plot: cluster size binning parameters
double sizeMax = 15; // upper edge of highest bin for average cluster size
int sizeNBins = 20; // number of cluster size bins

O2ParamDef(AvgClusSizeStudyParamConfig, "AvgClusSizeStudyParam");
};

} // namespace study
} // namespace its
} // namespace o2
#endif
Loading

0 comments on commit b11d2a4

Please sign in to comment.