Commit 6a9a1855 authored by j.a.galan.81@gmail.com's avatar j.a.galan.81@gmail.com
Browse files

First commit

parents
set(contents)
set(excludes)
# We remove from compilation those processs that connect to other libraries
if (NOT DEFINED RESTLIB_RAW OR NOT ${RESTLIB_RAW} MATCHES "ON")
set(excludes ${excludes} TRestDetectorSignalToRawSignalProcess )
endif (NOT DEFINED RESTLIB_RAW OR NOT ${RESTLIB_RAW} MATCHES "ON")
if (NOT DEFINED RESTLIB_TRACK OR NOT ${RESTLIB_TRACK} MATCHES "ON")
set(excludes ${excludes} TRestDetectorHitsToTrackProcess TRestDetectorHitsToTrackFastProcess)
endif (NOT DEFINED RESTLIB_TRACK OR NOT ${RESTLIB_TRACK} MATCHES "ON")
COMPILEDIR(RestDetector)
////////////////////////////////////////////////////////////////////////////////////
///
///
/// RESTSoft : Software for Rare Event Searches with TPCs
///
/// TRestDetector.h
///
/// Metadata class to be used to store basic detector setup info
/// inherited from TRestMetadata
///
/// jun 2016: First concept. Javier Galan
///
////////////////////////////////////////////////////////////////////////////////////
#ifndef RestCore_TRestDetector
#define RestCore_TRestDetector
#include <Rtypes.h>
#include <TVector3.h>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include "TFile.h"
#include "TRestMetadata.h"
#include "TRestStringOutput.h"
#include "TRestTools.h"
using namespace std;
class TRestDetector : public TRestMetadata {
public:
string fDetectorName = "REST Detector";
Int_t fRunNumber = 0;
Double_t fDriftVoltage; // In V
Double_t fDriftDistance; // in mm
Double_t fDriftGain; // in mm
Double_t fAmplificationVoltage; // In V
Double_t fAmplificationDistance; // in mm
Double_t fAmplificationGain; //
Double_t fMass; // in kg
Double_t fHeight; // in mm
Double_t fRadius; // in mm
Double_t fLength; // in mm
Double_t fWidth; // in mm
Double_t fDAQShapingTime; // in us
Double_t fDAQSamplingTime; // in us
Double_t fDAQDynamicRange;
Double_t fDAQThreshold;
void InitFromConfigFile() { ReadAllParameters(); }
void PrintMetadata();
// Constructors
TRestDetector() {}
// Destructor
~TRestDetector() {}
ClassDef(TRestDetector, 1);
};
#endif
///______________________________________________________________________________
///______________________________________________________________________________
///______________________________________________________________________________
///
///
/// RESTSoft : Software for Rare Event Searches with TPCs
///
/// TRestDetectorAvalancheProcess.h
///
/// feb 2016: First concept
/// Created as part of the conceptualization of existing REST
/// software.
/// Javier G. Garza
///_______________________________________________________________________________
#ifndef RestCore_TRestDetectorAvalancheProcess
#define RestCore_TRestDetectorAvalancheProcess
#include <TRestDetectorGas.h>
#include <TRestDetectorHitsEvent.h>
#include "TRestEventProcess.h"
class TRestDetectorAvalancheProcess : public TRestEventProcess {
private:
TRestDetectorHitsEvent* fHitsInputEvent; //!
TRestDetectorHitsEvent* fHitsOutputEvent; //!
Double_t fEnergyRef; ///< reference energy for the FWHM
Double_t fResolutionAtEref; ///< FWHM at Energy of reference
Double_t fDetectorGain; ///< Detector's gain.
void InitFromConfigFile();
void Initialize();
void LoadDefaultConfig();
protected:
// add here the members of your event process
TRestDetectorGas* fGas; //!
public:
any GetInputEvent() { return fHitsInputEvent; }
any GetOutputEvent() { return fHitsOutputEvent; }
void InitProcess();
TRestEvent* ProcessEvent(TRestEvent* eventInput);
void EndProcess();
void LoadConfig(std::string cfgFilename);
void PrintMetadata() {
BeginPrintProcess();
metadata << " reference energy (Eref): " << fEnergyRef << endl;
metadata << " resolution at Eref : " << fResolutionAtEref << endl;
metadata << " detector gain : " << fDetectorGain << endl;
EndPrintProcess();
}
TRestMetadata* GetProcessMetadata() { return fGas; }
TString GetProcessName() { return (TString) "avalancheProcess"; }
Double_t GetEnergyReference() { return fEnergyRef; }
Double_t GetResolutionReference() { return fResolutionAtEref; }
Double_t GetDetectorGain() { return fDetectorGain; }
// Constructor
TRestDetectorAvalancheProcess();
TRestDetectorAvalancheProcess(char* cfgFileName);
// Destructor
~TRestDetectorAvalancheProcess();
ClassDef(TRestDetectorAvalancheProcess, 1); // Template for a REST "event process"
// class inherited from TRestEventProcess
};
#endif
///______________________________________________________________________________
///______________________________________________________________________________
///______________________________________________________________________________
///
///
/// RESTSoft : Software for Rare Event Searches with TPCs
///
/// TRestDetectorDaqChannelSwitchingProcess.h
///
///_______________________________________________________________________________
#ifndef RestCore_TRestDetectorDaqChannelSwitchingProcess
#define RestCore_TRestDetectorDaqChannelSwitchingProcess
#include <TH1D.h>
//#include <TCanvas.h>
#include <TRestDetectorReadout.h>
#include <TRestDetectorGas.h>
#include <TRestDetectorHitsEvent.h>
#include <TRestDetectorSignalEvent.h>
#include "TRestEventProcess.h"
class TRestDetectorDaqChannelSwitchingProcess : public TRestEventProcess {
private:
#ifndef __CINT__
TRestEvent* fEvent; //!
TRestDetectorReadout* fReadout; //!
#endif
std::map<int, int> fFirstDaqChannelDef; //[module id, first daq id]
bool fIgnoreUndefinedModules;
void InitFromConfigFile();
void Initialize();
public:
any GetInputEvent() { return fEvent; }
any GetOutputEvent() { return fEvent; }
void InitProcess();
TRestEvent* ProcessEvent(TRestEvent* eventInput);
void EndProcess();
void PrintMetadata() {
BeginPrintProcess();
metadata << "module's daq channel re-definition: " << endl;
auto iter = fFirstDaqChannelDef.begin();
while (iter != fFirstDaqChannelDef.end()) {
metadata << "module id: " << iter->first << " first daq channel: " << iter->second << endl;
iter++;
}
metadata << endl;
EndPrintProcess();
}
// Constructor
TRestDetectorDaqChannelSwitchingProcess();
// Destructor
~TRestDetectorDaqChannelSwitchingProcess();
ClassDef(TRestDetectorDaqChannelSwitchingProcess, 1); // Template for a REST "event process" class inherited from
// TRestEventProcess
};
#endif
/*************************************************************************
* This file is part of the REST software framework. *
* *
* Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
* For more information see http://gifna.unizar.es/trex *
* *
* REST is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* REST is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have a copy of the GNU General Public License along with *
* REST in $REST_PATH/LICENSE. *
* If not, see http://www.gnu.org/licenses/. *
* For the list of contributors see $REST_PATH/CREDITS. *
*************************************************************************/
#ifndef RestCore_TRestDetectorDriftVolume
#define RestCore_TRestDetectorDriftVolume
#include <stdlib.h>
#include <fstream>
#include <iostream>
#include <TROOT.h>
#include "TApplication.h"
#include "TArrayI.h"
#include "TAxis.h"
#include "TCanvas.h"
#include "TGraph.h"
#include "TNamed.h"
#include "TString.h"
#include "TSystem.h"
#include "TVector3.h"
#include "TRestMetadata.h"
class TRestDetectorDriftVolume : public TRestMetadata {
protected:
string fMaterial; // material description string
Double_t fW; // Work function for electron extraction, in unit eV.
Double_t fElectricField; // in unit V/mm
Double_t fDriftVelocity; // in unit mm/us
Double_t fElectronLifeTime; // in unit us
Double_t fLongitudinalDiffusion; // in unit (cm)^1/2
Double_t fTransversalDiffusion; // in unit (cm)^1/2
Double_t fTownsendCoefficient;
Double_t fAttachmentCoefficient;
Double_t fPressureInAtm; // Pressure of the gas in atm.
Double_t fTemperatureInK; // Temperature of the gas in K.
public:
TRestDetectorDriftVolume();
TRestDetectorDriftVolume(const char* cfgFileName, string name = "");
virtual void Initialize();
virtual void InitFromConfigFile();
virtual string GetMaterial() { return fMaterial; }
virtual Double_t GetW() { return fW; }
virtual Double_t GetWvalue() { return fW; }
virtual Double_t GetElectricField() { return fElectricField; }
virtual Double_t GetDriftVelocity() { return fDriftVelocity; }
virtual Double_t GetElectronLifeTime() { return fElectronLifeTime; }
virtual Double_t GetLongitudinalDiffusion() { return fLongitudinalDiffusion; }
virtual Double_t GetTransversalDiffusion() { return fTransversalDiffusion; }
virtual Double_t GetTownsendCoefficient() { return fTownsendCoefficient; }
virtual Double_t GetAttachmentCoefficient() { return fAttachmentCoefficient; }
virtual Double_t GetPressure() { return fPressureInAtm; }
virtual Double_t GetTemperature() { return fTemperatureInK; }
virtual void SetMaterial(string value) { fMaterial = value; }
virtual void SetW(double value) { fW = value; }
virtual void SetElectricField(double value) { fElectricField = value; }
// returned drift velocity is in unit mm/us
virtual void SetDriftVelocity(double value) { fDriftVelocity = value; }
virtual void SetElectronLifeTime(double value) { fElectronLifeTime = value; }
virtual void SetLongitudinalDiffusion(double value) { fLongitudinalDiffusion = value; }
virtual void SetTransversalDiffusion(double value) { fTransversalDiffusion = value; }
virtual void SetTownsendCoefficient(double value) { fTownsendCoefficient = value; }
virtual void SetAttachmentCoefficient(double value) { fAttachmentCoefficient = value; }
virtual void SetPressure(double value) { fPressureInAtm = value; }
virtual void SetTemperature(double value) { fTemperatureInK = value; }
virtual void UpdateCondition() {}
virtual void PrintMetadata();
ClassDef(TRestDetectorDriftVolume, 1); // Gas Parameters
};
#endif
\ No newline at end of file
///______________________________________________________________________________
///______________________________________________________________________________
///______________________________________________________________________________
///
///
/// RESTSoft : Software for Rare Event Searches with TPCs
///
/// TRestDetectorElectronDiffusionProcess.h
///
///_______________________________________________________________________________
#ifndef RestCore_TRestDetectorElectronDiffusionProcess
#define RestCore_TRestDetectorElectronDiffusionProcess
#include <TRandom3.h>
#include <TRestDetectorReadout.h>
#include <TRestDetectorGas.h>
#include <TRestDetectorHitsEvent.h>
#include "TRestEventProcess.h"
class TRestDetectorElectronDiffusionProcess : public TRestEventProcess {
private:
#ifndef __CINT__
TRestDetectorHitsEvent* fInputHitsEvent; //!
TRestDetectorHitsEvent* fOutputHitsEvent; //!
TRestDetectorGas* fGas; //!
TRestDetectorReadout* fReadout; //!
TRandom3* fRandom; //!
#endif
void InitFromConfigFile();
void Initialize();
void LoadDefaultConfig();
protected:
Double_t fElectricField;
Double_t fAttachment;
Double_t fGasPressure;
Double_t fWvalue;
Double_t fLonglDiffCoeff;
Double_t fTransDiffCoeff;
Int_t fMaxHits;
Double_t fSeed = 0;
public:
any GetInputEvent() { return fInputHitsEvent; }
any GetOutputEvent() { return fOutputHitsEvent; }
void InitProcess();
TRestEvent* ProcessEvent(TRestEvent* eventInput);
void EndProcess();
void LoadConfig(std::string cfgFilename, std::string name = "");
void PrintMetadata() {
BeginPrintProcess();
metadata << " eField : " << fElectricField * units("V/cm") << " V/cm" << endl;
metadata << " attachment coeficient : " << fAttachment << " V/cm" << endl;
metadata << " gas pressure : " << fGasPressure << " atm" << endl;
metadata << " longitudinal diffusion coefficient : " << fLonglDiffCoeff << " cm^1/2" << endl;
metadata << " transversal diffusion coefficient : " << fTransDiffCoeff << " cm^1/2" << endl;
metadata << " W value : " << fWvalue << " eV" << endl;
metadata << " Maximum number of hits : " << fMaxHits << endl;
metadata << " seed : " << fSeed << endl;
EndPrintProcess();
}
TRestMetadata* GetProcessMetadata() { return fGas; }
TString GetProcessName() { return (TString) "electronDiffusion"; }
Double_t GetElectricField() { return fElectricField; }
Double_t GetAttachmentCoefficient() { return fAttachment; }
Double_t GetGasPressure() { return fGasPressure; }
// Constructor
TRestDetectorElectronDiffusionProcess();
TRestDetectorElectronDiffusionProcess(char* cfgFileName);
// Destructor
~TRestDetectorElectronDiffusionProcess();
ClassDef(TRestDetectorElectronDiffusionProcess, 2); // Template for a REST "event process" class inherited from
// TRestEventProcess
};
#endif
///______________________________________________________________________________
///______________________________________________________________________________
///______________________________________________________________________________
///
///
/// RESTSoft : Software for Rare Event Searches with TPCs
///
/// TRestDetectorFiducializationProcess.h
///
///_______________________________________________________________________________
#ifndef RestCore_TRestDetectorFiducializationProcess
#define RestCore_TRestDetectorFiducializationProcess
#include <TRestDetectorReadout.h>
#include <TRestDetectorHitsEvent.h>
#include "TRestEventProcess.h"
class TRestDetectorFiducializationProcess : public TRestEventProcess {
private:
#ifndef __CINT__
TRestDetectorHitsEvent* fInputHitsEvent; //!
TRestDetectorHitsEvent* fOutputHitsEvent; //!
TRestDetectorReadout* fReadout; //!
#endif
void InitFromConfigFile();
void Initialize();
void LoadDefaultConfig();
protected:
public:
any GetInputEvent() { return fInputHitsEvent; }
any GetOutputEvent() { return fOutputHitsEvent; }
void InitProcess();
TRestEvent* ProcessEvent(TRestEvent* eventInput);
void EndProcess();
void LoadConfig(std::string cfgFilename, std::string name = "");
void PrintMetadata() {
BeginPrintProcess();
EndPrintProcess();
}
TString GetProcessName() { return (TString) "fiducialization"; }
// Constructor
TRestDetectorFiducializationProcess();
TRestDetectorFiducializationProcess(char* cfgFileName);
// Destructor
~TRestDetectorFiducializationProcess();
ClassDef(TRestDetectorFiducializationProcess, 1); // Template for a REST "event process" class inherited from
// TRestEventProcess
};
#endif
/*************************************************************************
* This file is part of the REST software framework. *
* *
* Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
* For more information see http://gifna.unizar.es/trex *
* *
* REST is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* REST is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have a copy of the GNU General Public License along with *
* REST in $REST_PATH/LICENSE. *
* If not, see http://www.gnu.org/licenses/. *
* For the list of contributors see $REST_PATH/CREDITS. *
*************************************************************************/
#ifndef RestCore_TRestCalibration
#define RestCore_TRestCalibration
#include <TROOT.h>
#include <stdlib.h>
#include <fstream>
#include <iostream>
#include "TApplication.h"
#include "TArrayI.h"
#include "TAxis.h"
#include "TCanvas.h"
#include "TGraph.h"
#include "TH2.h"
#include "TH3.h"
#include "TNamed.h"
#include "TRestMetadata.h"
#include "TString.h"
#include "TSystem.h"
#include "TVector3.h"
class TRestDetectorReadoutModule;
class TRestDetectorReadout;
class TRestDetectorGainMap : public TRestMetadata {
public:
bool relative;
map<int, double> fChannelGain; // [channel id, gain]
TH2F* f2DGainMapping = 0; //->
TH3F* f3DGainMapping = 0; //->
void InitFromConfigFile();
void SaveToText(string filename) {}
void ReadGainText(string filename) {}
void DrawChannelGainMap(TRestDetectorReadoutModule* mod = 0);
ClassDef(TRestDetectorGainMap, 1); // Gas Parameters
};
#endif
///______________________________________________________________________________
///______________________________________________________________________________
///______________________________________________________________________________
///
///
/// RESTSoft : Software for Rare Event Searches with TPCs
///
/// Process which create ionization electrons and drift them toward
/// the readout plane (stop 1mm above)
///
/// TRestDetectorGarfieldDriftProcess.h
///
///_______________________________________________________________________________
#ifndef RestCore_TRestDetectorGarfieldDriftProcess
#define RestCore_TRestDetectorGarfieldDriftProcess
#include <TRestDetectorGas.h>
#if defined USE_Garfield
#include "AvalancheMC.hh"
#include "ComponentBase.hh"
#include "Sensor.hh"
// TODO Could we have this as an option given through metadata?
#define DRIFT_METHOD AvalancheMC
#endif
#include <TRandom3.h>
#include <TRestDetectorGeometry.h>
#include <TRestDetectorHitsEvent.h>
#include <TRestDetectorReadout.h>
#include <TRestDetectorSignalEvent.h>
#include "TRestEventProcess.h"
class TRestDetectorGarfieldDriftProcess : public TRestEventProcess {
private:
void Initialize();
TRandom3* fRandom;
TRestDetectorHitsEvent* fInputHitsEvent; //!
TRestDetectorHitsEvent* fOutputHitsEvent; //!
#if defined USE_Garfield
TRestDetectorReadout* fReadout; //!
TRestDetectorGas* fGas; //!