From 3b2603adb24ff95eea7723fbc30d3393cd09ae16 Mon Sep 17 00:00:00 2001 From: marian Date: Tue, 13 Nov 2007 15:16:22 +0000 Subject: [PATCH] Adding the class for specifiing cut criterias AliTPCcalibTracksCuts + Adding the class to hold pad region specific information (e.g. fit parameters, LinearFitter) AliTPCCalPadRegion (S.Gaertner, L.Bozyk) --- TPC/TPCcalib/AliTPCCalPadRegion.cxx | 87 +++++++++++++++++ TPC/TPCcalib/AliTPCCalPadRegion.h | 46 +++++++++ TPC/TPCcalib/AliTPCcalibTracksCuts.cxx | 128 +++++++++++++++++++++++++ 3 files changed, 261 insertions(+) create mode 100644 TPC/TPCcalib/AliTPCCalPadRegion.cxx create mode 100644 TPC/TPCcalib/AliTPCCalPadRegion.h create mode 100644 TPC/TPCcalib/AliTPCcalibTracksCuts.cxx diff --git a/TPC/TPCcalib/AliTPCCalPadRegion.cxx b/TPC/TPCcalib/AliTPCCalPadRegion.cxx new file mode 100644 index 00000000000..4857ab13ec0 --- /dev/null +++ b/TPC/TPCcalib/AliTPCCalPadRegion.cxx @@ -0,0 +1,87 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +//////////////////////////////////////////////////////////////////////////// +// +// === Class for properties specific to pad regions === +// +// Each segment of the TPC (i.e. IROC and corresponding OROC) consists +// of three different pad sizes (short, medium, long). This class +// is useful for scenarios, where it is appropriate to describe +// some behaviour per pad size region. It provides an easy interface +// for getting and setting arbitrary objects for each pad size region. +// There is no need that this object is of the same type for each +// pad size region (though it probably will be in most of the cases), +// nor that it is set at all (e.g. when no data for this region +// exists and such an object is not needed). +// +// An example that makes usage of this class is the AliTPCFitPad class +// which stores TLinearFitter objects for each pad region. +// +//////////////////////////////////////////////////////////////////////////// + +#include "AliTPCCalPadRegion.h" + +ClassImp(AliTPCCalPadRegion); + +AliTPCCalPadRegion::AliTPCCalPadRegion(): + TNamed(), + fObjects(0) +{ + // + // Default constructor. + // +} + +AliTPCCalPadRegion::AliTPCCalPadRegion(const char *name, const char *title) : + TNamed(name, title), + fObjects(0) +{ + // + // Constructor. + // + + fObjects = new TObjArray(fgkNSegments * fgkNPadTypes); +} + +AliTPCCalPadRegion::AliTPCCalPadRegion(const AliTPCCalPadRegion& obj) : + TNamed(obj) +{ + // + // Copy constructor. + // + + fObjects = new TObjArray(*(obj.fObjects)); +} + +AliTPCCalPadRegion& AliTPCCalPadRegion::operator=(const AliTPCCalPadRegion& rhs) { + // + // Assignment operator. + // + + if (this != &rhs) { + TNamed::operator=(rhs); + fObjects = new TObjArray(*(rhs.fObjects)); + } + return *this; +} + +void AliTPCCalPadRegion::GetPadRegionCenterLocal(UInt_t padType, Double_t* xy) { + // + // Return the center of the pad size region in local + // coordinates as an Double_t array xy of length 2. + // + Error("GetPadRegionCenterLocal", "Not yet implemented."); +} diff --git a/TPC/TPCcalib/AliTPCCalPadRegion.h b/TPC/TPCcalib/AliTPCCalPadRegion.h new file mode 100644 index 00000000000..ca7410efef2 --- /dev/null +++ b/TPC/TPCcalib/AliTPCCalPadRegion.h @@ -0,0 +1,46 @@ +#ifndef ALITPCCALPADREGION_H +#define ALITPCCALPADREGION_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +#include +#include +#include +#include + +class AliTPCCalPadRegion: public TNamed { +public: + AliTPCCalPadRegion(); + AliTPCCalPadRegion(const AliTPCCalPadRegion& obj); + AliTPCCalPadRegion(const char *name, const char *title); + AliTPCCalPadRegion(const TString &name, const TString &title) : TNamed(name, title) { AliTPCCalPadRegion(name.Data(), title.Data()); } + virtual ~AliTPCCalPadRegion() { delete fObjects; } + AliTPCCalPadRegion& operator=(const AliTPCCalPadRegion& obj); + + virtual TObject* GetObject(UInt_t segment, UInt_t padType) + { return BoundsOk("GetObject", segment, padType) ? fObjects->At(segment+fgkNSegments*padType) : 0x0; } + virtual void SetObject(TObject* obj, UInt_t segment, UInt_t padType) + { if (BoundsOk("SetObject", segment, padType)) fObjects->AddAt(obj, segment+fgkNSegments*padType); } + virtual void Delete(Option_t* option = "") { if (fObjects) fObjects->Delete(); } + virtual TIterator* MakeIterator(Bool_t direction = kIterForward) const { return fObjects->MakeIterator(direction); } + static UInt_t GetNSegments() { return fgkNSegments; } + static UInt_t GetNPadTypes() { return fgkNPadTypes; } + void GetPadRegionCenterLocal(UInt_t padType, Double_t* xy); + +protected: + virtual Bool_t BoundsOk(const char* where, UInt_t segment, UInt_t padType) const + { return (segment >= fgkNSegments || padType >= fgkNPadTypes) ? OutOfBoundsError(where, segment, padType) : kTRUE; } + virtual Bool_t OutOfBoundsError(const char* where, UInt_t segment, UInt_t padType) const + { Error(where, "Index out of bounds (trying to access segment %d, pad type %d).", segment, padType); return kFALSE; } + + TObjArray* fObjects; // array containing an object for each pad region + + static const UInt_t fgkNSegments = 36; // number of TPC sectors, 0-17: A side, 18-35: C side (IROC and OROC are treated as one sector) + static const UInt_t fgkNPadTypes = 3; // number of pad types, 0: short pads, 1: medium pads, 2: long pads + + ClassDef(AliTPCCalPadRegion, 1) +}; + + +#endif diff --git a/TPC/TPCcalib/AliTPCcalibTracksCuts.cxx b/TPC/TPCcalib/AliTPCcalibTracksCuts.cxx new file mode 100644 index 00000000000..085d95be80b --- /dev/null +++ b/TPC/TPCcalib/AliTPCcalibTracksCuts.cxx @@ -0,0 +1,128 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +#include +#include +#include +#include "AliTPCcalibTracksCuts.h" + +ClassImp(AliTPCcalibTracksCuts); + +AliTPCcalibTracksCuts::AliTPCcalibTracksCuts(Int_t minClusters, Float_t minRatio, Float_t max1pt, + Float_t edgeXZCutNoise, Float_t edgeThetaCutNoise, char* outputFileName): + TNamed("calibTracksCuts", "calibTracksCuts") { + // + // Constructor for AliTPCcalibTracksCuts + // specify the cuts to be set on the processed tracks + // default cuts are for comics + // + fMinClusters = minClusters; + fMinRatio = minRatio; + fMax1pt = max1pt; + fEdgeYXCutNoise = edgeXZCutNoise; + fEdgeThetaCutNoise = edgeThetaCutNoise; + fOutputFileName = new TObjString(outputFileName); +} + +AliTPCcalibTracksCuts::AliTPCcalibTracksCuts(AliTPCcalibTracksCuts *cuts){ + // + // copy constructor + // + fMinClusters = cuts->GetMinClusters(); + fMinRatio = cuts->GetMinRatio(); + fMax1pt = cuts->GetMax1pt(); + fEdgeYXCutNoise = cuts->GetEdgeYXCutNoise(); + fEdgeThetaCutNoise = cuts->GetEdgeThetaCutNoise(); + fOutputFileName = new TObjString(cuts->GetOutputFileName()); +} + +AliTPCcalibTracksCuts::AliTPCcalibTracksCuts(){ + // + // default constructor + // + fMinClusters = 0; + fMinRatio = 0; + fMax1pt = 0; + fEdgeYXCutNoise = 0; + fEdgeThetaCutNoise = 0; + fOutputFileName = new TObjString(""); +} + +void AliTPCcalibTracksCuts::AddCuts(TChain * chain, char* ctype, char* outputFileName){ + // + // add predefined cuts to the chain for processing + // (creates AliTPCcalibTracksCuts object) + // the cuts are set in the following order: + // fMinClusters (number of clusters) + // fMinRatio + // fMax1pt 1 over p_t + // fEdgeYXCutNoise + // fEdgeThetaCutNoise + // + // The following predefined sets of cuts can be selected: + // laser: 20, 0.4, 0.5, 0.13, 0.018 + // cosmic: 20, 0.4, 0.5, 0.13, 0.018 + // lowflux: 20, 0.4, 5, 0.2, 0.0001 + // highflux: 20, 0.4, 5, 0.2, 0.0001 + // + + TString cutType(ctype); + cutType.ToUpper(); + AliTPCcalibTracksCuts *cuts = 0; + if (cutType == "LASER") +// cuts = new AliTPCcalibTracksCuts(20, 0.4, 0.5, 0.13, 0.018); + cuts = new AliTPCcalibTracksCuts(20, 0.4, 5, 0.13, 0.018, outputFileName); + else if (cutType == "COSMIC") + cuts = new AliTPCcalibTracksCuts(20, 0.4, 0.5, 0.13, 0.018, outputFileName); + else if (cutType == "LOWFLUX") + cuts = new AliTPCcalibTracksCuts(20, 0.4, 5, 0.2, 0.0001, outputFileName); + else if (cutType == "HIGHFLUX") + cuts = new AliTPCcalibTracksCuts(20, 0.4, 5, 0.2, 0.0001, outputFileName); + else { + cuts = new AliTPCcalibTracksCuts(20, 0.4, 5, 0.2, 0.0001, outputFileName); + cerr << "WARNING! unknown type '" << ctype << "', cuts set to default values for cosmics." << endl; + cutType = "COSMIC"; + } + chain->GetUserInfo()->AddLast(cuts); + cout << "Cuts were set to predefined set: " << cutType << endl; +} + +void AliTPCcalibTracksCuts::AddCuts(TChain * chain, Int_t minClusters, Float_t minRatio, Float_t max1pt, + Float_t edgeXZCutNoise, Float_t edgeThetaCutNoise, char* outputFileName){ + // + // add user defined cuts to the chain for processing + // (creates AliTPCcalibTracksCuts object) + // the cuts are set in the following order: + // fMinClusters (number of clusters) + // fMinRatio + // fMax1pt 1 over p_t + // fEdgeYXCutNoise + // fEdgeThetaCutNoise + // + chain->GetUserInfo()->AddLast(new AliTPCcalibTracksCuts(minClusters, minRatio, max1pt, edgeXZCutNoise, edgeThetaCutNoise, outputFileName)); + printf("Cuts were set to the individal values: minClusters: %i, minRatio: %f, max1pt: %f, edgeXZCutNoise: %f, edgeThetaCutNoise: %f \n", + minClusters, minRatio, max1pt, edgeXZCutNoise, edgeThetaCutNoise); +} + +void AliTPCcalibTracksCuts::Print(Option_t* option) { + option = option; // to avoid compiler warnings + cout << ": The following cuts are specified: " << endl; + cout << "fMinClusters: " << fMinClusters << endl; + cout << "fMinRatio: " << fMinRatio << endl; + cout << "fMax1pt: " << fMax1pt << endl; + cout << "fEdgeYXCutNoise: " << fEdgeYXCutNoise << endl; + cout << "fEdgeThetaCutNoise: " << fEdgeThetaCutNoise << endl; + cout << "fOutputFileName: " << fOutputFileName->String().Data() << endl; +} // Prints out the specified cuts -- 2.43.0