Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
*.[oa]
*~
*.dat
*.txt
*.png
*.root
__init__.py
*.old
pippo*
*processDump.py
*.pyc
html/*
LSF*
*.list
6 changes: 4 additions & 2 deletions EcalTiming/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@
<use name="RecoLocalCalo/EcalRecAlgos"/>
<use name="RecoEcal/EgammaCoreTools"/>
<use name="RecoEcal/EgammaClusterProducers"/>
<use name="Geometry/EcalMapping"/>
<use name="Geometry/CaloGeometry"/>
<use name="DataFormats/PatCandidates"/>
<use name="RecoTracker/TrackProducer"/>
<use name="Geometry/CommonDetUnit"/>
<use name="Geometry/TrackerGeometryBuilder"/>
<use name="MagneticField/Engine"/>
<use name="MagneticField/Records"/>
<use name="FWCore/PluginManager"/>

<use name="DataFormats/EgammaCandidates"/>
<use name="DataFormats/DetId"/>
<use name="hepmc"/>
<use name="root"/>
<lib name="Minuit"/>
<use name="clhep"/>
<export>
<lib name="1"/>
</export>
20 changes: 18 additions & 2 deletions EcalTiming/doc/AlCaPhiSymStream_test.doc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,24 @@
Testing file:
\verbatim
file=root://eoscms//eos/cms/store/data/Run2015A/AlCaPhiSym/RAW/v1/000/246/908/00000/C0DA4527-2F0A-E511-ADFD-02163E014349.root
cmsRun test/ecalTimeTreeMaker_FromRaw_CosmicOrBeamSplash_cfg.py files=root://eoscms/$file
cmsRun test/ecalTime_fromAlcaStream_cfg.py files=root://eoscms/$file
\endverbatim

The code is in debug mode that have to be switched off
## Options for `cmsRun test/ecalTime_fromAlcaStream_cfg.py`
Options | Default | Description
------- | ------- | -------
files | "" | input files (can be RAW if step contains "RECO")
output | "" | output files. If TIME in step, it contains the calibration trees, otherwise it will be the RECO files.
maxEvents | -1 | # of events to run over
jsonFile |"" | path to the json file which designates which lumisections to use
step |"RECOTIMEANALYSIS" | Do reco, time analysis or both, RECO or TIMEANALYSIS or RECOTIMEANALYSIS
offset |0.0 | add this to each crystal time, (this was used in splash analysis, should probably be removed)
minEnergyEB | 0.0 | add this to minimum energy threshold in EB (0.520 GeV)
minEnergyEE | 0.0 | add this to minimum energy threshold in EE (which is a function of iRing)
isSplash | 0 | 0=false, 1=true, performs RECO as splash data and shifts timing in analyzer by TOF difference
streamName | "AlCaPhiSym" | type of stream, changes RECO path: AlCaPhiSym or AlCaP0


The script `scripts/testCAF.sh` automatically can run over RAW files for specific runs, setting the options above appropriately.
Probably should use it as a template rather than running it as is.
*/
8 changes: 5 additions & 3 deletions EcalTiming/doc/instructions.doc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ Download the code:
scram project CMSSW_7_4_2
cd CMSSW_7_4_2/src
cmsenv
git clone git@github.com:ECALELFS/EcalTiming.git
git clone git@github.com:ECALELFS/PhiSym.git
git cms-merge-topic shervin86:iRingInSubdet
git clone git@github.com:previsualconsent/EcalTiming.git
cd EcalTiming
checkout energystability
scram b -j16
\endverbatim

Expand All @@ -32,4 +34,4 @@ cd -


Go back to \ref index
*/
*/
14 changes: 14 additions & 0 deletions EcalTiming/doc/splach.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
\page Splash
\section Splash_sec How to analyze Splash events

The offset are set to make the ieta = 1 bin average to 0.
\verbatim
output=/path/to/output.root
beam1file=/store/caf/user/ccecal/TPG/splash_events_run_239895_26_events_beam_1.root
beam2file=/store/caf/user/ccecal/TPG/splash_events_run_239895_31_events_beam_2.root
cmsRun test/ ecalTime_fromAlcaStream_cfg.py files=$beam1file output=$output offset=1.75589609219 isSplash=1
cmsRun test/ ecalTime_fromAlcaStream_cfg.py files=$beam2file output=$output offset=-0.709605624194 isSplash=1
\endverbatim

*/
2 changes: 1 addition & 1 deletion EcalTiming/doc/timing.doc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
\section introduction_ Timing package

This package can be used to analyze
- splash event data in RAW format
- splash event data in RAW format: \ref Splash_sec
- data from AlCaPhiSymmetry stream: \ref AlCaPhiSymmetry_test_sec


Expand Down
2 changes: 1 addition & 1 deletion EcalTiming/fulldoc
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ EXTRACT_ALL = NO
# be included in the documentation.
# The default value is: NO.

EXTRACT_PRIVATE = NO
EXTRACT_PRIVATE = YES

# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
# scope will be included in the documentation.
Expand Down
67 changes: 52 additions & 15 deletions EcalTiming/interface/EcalCrystalTimingCalibration.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
#include "EcalTiming/EcalTiming/interface/EcalTimingEvent.h"

#include <vector>
#include <TTree.h>

/** \class EcalCrystalTimingCalibration EcalCrystalTimingCalibration.cc EcalCrystalTimingCalibration.cc
/** \class EcalCrystalTimingCalibration EcalCrystalTimingCalibration.h EcalTiming/EcalTiming/interface/EcalCrystalTimingCalibration.h
*
* Description: add a description here
* This class contains all the timing information for a single crystal
*/

//Defines for Dump Status (reason for dumping each crystal)
#define DS_NONE 0x00
#define DS_HIGH_SKEW 0x01
#define DS_UNSTABLE_EN 0x02
#define DS_CCU_OOT 0x04
#define DS_RING 0x08
#define DS_CRYS 0x10

void dumpAllToTree(TTree * tree, int ix_, int iy_, int iz_, float time_, float energy_, float chiSquare_, float thrApplied_);

class EcalCrystalTimingCalibration
{
Expand All @@ -21,7 +30,12 @@ class EcalCrystalTimingCalibration
float _sum2; ///< scalar sum of the square of the time of each timingEvent
unsigned long int _num; ///< number of timingEvents;

float _sumE;
float _sumE; ///< scalar sum of the energy of each timingEvent: needed for average energy
bool _storingEvents;

mutable std::map<float, float> _sumWithinNSigma, _sum2WithinNSigma, _sum3WithinNSigma, _sumEWithinNSigma; ///< variables for calculation of mean, stdDev within n-times the origina stdDev (to remove tails)
mutable std::map<float, unsigned int> _numWithinNSigma; ///< variables for calculation of mean, stdDev within n-times the origina stdDev (to remove tails)


std::vector<EcalTimingEvent> timingEvents; ///< vector containing all the events for this crystal
std::vector<EcalTimingEvent>::iterator maxChi2Itr;
Expand All @@ -31,7 +45,7 @@ class EcalCrystalTimingCalibration
/// default constructor
EcalCrystalTimingCalibration(bool weightMean = true) :
//_detId(),
_sum(0), _sum2(0), _num(0), _sumE(0)
_sum(0), _sum2(0), _num(0), _sumE(0), _storingEvents(true)
//totalChi2(-1),
//useWeightedMean(weightMean)
{
Expand All @@ -43,6 +57,7 @@ class EcalCrystalTimingCalibration
};
inline float mean() const
{
if(!_num) return -999.f;
return _sum / _num;
}; ///< average time (mean of the time distribution)
inline float stdDev() const ///< standard deviation of the time distribution
Expand All @@ -65,6 +80,11 @@ class EcalCrystalTimingCalibration
/* } */
//float totalChi2;

float getMeanWithinNSigma(float sigma, float maxRange) const; ///< returns the mean time within abs(mean+ n * stdDev) to reject tails
float getStdDevWithinNSigma(float sigma, float maxRange) const; ///< returns the stdDev calculated within abs(mean+ n * stdDev) to reject tails
float getNumWithinNSigma(float sigma, float maxRange) const; ///< returns the num calculated within abs(mean+ n * stdDev) to reject tails
float getMeanErrorWithinNSigma(float sigma, float maxRange) const; ///< returns the error on the mean calculated within abs(mean+ n * stdDev) to reject tails
float getSkewnessWithinNSigma(float sigma, float maxRange) const; ///< returns the skewness calculated within abs(mean+ n * stdDev) to reject tails

friend std::ostream& operator<< (std::ostream& os, const EcalCrystalTimingCalibration& s)
{
Expand All @@ -73,29 +93,46 @@ class EcalCrystalTimingCalibration
}

/// add new event for this crystal
inline bool add(EcalTimingEvent te_)
inline bool add(EcalTimingEvent te_, bool storeEvent = true)
{
return insertEvent(te_);
return insertEvent(te_,storeEvent);
}
inline void clear()
{
_sum = 0.0f;
_sum2 = 0.0f;
_num = 0;
_sumE = 0.0f;

timingEvents.clear();
_sum = 0.0f;
_sum2 = 0.0f;
_num = 0;
_sumE = 0.0f;
_sumWithinNSigma.clear();
_sum2WithinNSigma.clear();
_sum3WithinNSigma.clear();
_numWithinNSigma.clear();

timingEvents.clear();
}

void dumpToTree(TTree *tree, int ix_, int iy_, int iz_, unsigned int status_, unsigned int elecID_, int iRing_); ///< dump the full set of events in a TTree: need an empty tree
void dumpCalibToTree(TTree * tree, int rawid_, int ix_, int iy_, int iz_, unsigned int elecID_, int iRing_) const; ///< dump the callibratoin to the tree
//void dumpAllToTree(TTree * tree, int ix_, int iy_, int iz_, float time_, float energy_, float chiSquare_, float thrApplied_);

/// checks if the time measurement is stable changing the min energy threshold
bool isStableInEnergy(float min, float max, float step, std::vector< std::pair<float, EcalCrystalTimingCalibration*> > &ret);

private:
void calcAllWithinNSigma(float n_sigma, float maxRange = 10) const; ///< calculate sum, sum2, sum3, n for time if time within n x stdDev and store the result
// since the values are stored, the calculation is done only once with only one loop over the events

/// \todo weighted average by timeError
bool insertEvent(EcalTimingEvent te_)
bool insertEvent(EcalTimingEvent te_, bool storeEvent)
{
if(true || te_.timeError() > 0) {
if(!storeEvent) _storingEvents = false;
if(te_.timeError() > 0 && te_.timeError() < 1000 && te_.timeError() < 3) { //exclude values with wrong timeError estimation
_sum += te_.time();
_sum2 += te_.time() * te_.time();
_sumE += te_.energy();
_num++;
timingEvents.push_back(te_);
if(_storingEvents)
timingEvents.push_back(te_);
//updateChi2();
return true;
} else {
Expand Down
13 changes: 13 additions & 0 deletions EcalTiming/interface/EcalTimeCalibrationMapFwd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** In this file the time Map is defined
*/

class EcalTimingEvent;
class EcalCrystalTimingCalibration;

// Map of detId and Crystal time
typedef std::map<DetId, EcalCrystalTimingCalibration> EcalTimeCalibrationMap;
typedef std::map<unsigned int, EcalCrystalTimingCalibration> EcalHWCalibrationMap;


typedef std::map<DetId, EcalTimingEvent> EventTimeMap;

2 changes: 2 additions & 0 deletions EcalTiming/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
<use name="CondFormats/DataRecord"/>
<use name="DataFormats/EcalDetId"/>
<use name="Geometry/CaloGeometry"/>
<use name="Geometry/EcalMapping"/>
<use name="Geometry/Records"/>
<use name="clhep"/>
<use name="root"/>
<use name="xerces-c"/>
<use name="EcalTiming/EcalTiming"/>
Loading