CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
SiStripGainFromCalibTree Class Reference
Inheritance diagram for SiStripGainFromCalibTree:
ConditionDBWriter< SiStripApvGain > edm::EDAnalyzer edm::EDConsumerBase

Classes

class  isEqual
 

Public Member Functions

 SiStripGainFromCalibTree (const edm::ParameterSet &)
 
 ~SiStripGainFromCalibTree ()
 
- Public Member Functions inherited from ConditionDBWriter< SiStripApvGain >
 ConditionDBWriter (const edm::ParameterSet &iConfig)
 
virtual ~ConditionDBWriter ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void algoAnalyze (const edm::Event &, const edm::EventSetup &) override
 
void algoAnalyzeTheTree ()
 
virtual void algoBeginRun (const edm::Run &run, const edm::EventSetup &iSetup) override
 
void algoComputeMPVandGain ()
 
virtual void algoEndJob () override
 
SiStripApvGaingetNewObject () override
 
void getPeakOfLandau (TH1 *InputHisto, double *FitResults, double LowRange=50, double HighRange=5400)
 
bool IsFarFromBorder (TrajectoryStateOnSurface *trajState, const uint32_t detid, const edm::EventSetup *iSetup)
 
bool IsGoodLandauFit (double *FitResults)
 
void MakeCalibrationMap ()
 
bool produceTagFilter ()
 
void storeOnTree ()
 

Private Attributes

std::string AlgoMode
 
bool AllowSaturation
 
__gnu_cxx::hash_map< unsigned
int, stAPVGain
*, __gnu_cxx::hash< unsigned
int >, isEqual
APVsColl
 
std::vector< stAPVGain * > APVsCollOrdered
 
unsigned int BAD
 
int CalibrationLevel
 
MonitorElementCharge_Vs_Index
 
MonitorElementCharge_Vs_Index_Absolute
 
MonitorElementCharge_Vs_PathlengthTECM1
 
MonitorElementCharge_Vs_PathlengthTECM2
 
MonitorElementCharge_Vs_PathlengthTECP1
 
MonitorElementCharge_Vs_PathlengthTECP2
 
MonitorElementCharge_Vs_PathlengthTIB
 
MonitorElementCharge_Vs_PathlengthTIDM
 
MonitorElementCharge_Vs_PathlengthTIDP
 
MonitorElementCharge_Vs_PathlengthTOB
 
DQMStoredbe
 
unsigned int ERun
 
bool FirstSetOfConstants
 
unsigned int GOOD
 
bool harvestingMode
 
string m_calibrationPath
 
unsigned int MASKED
 
double MaxChi2OverNDF
 
double MaxMPVError
 
unsigned int MaxNrStrips
 
double MaxTrackChiOverNdf
 
double MaxTrackEta
 
double MaxTrackMomentum
 
double MinNrEntries
 
double MinTrackEta
 
unsigned int MinTrackHits
 
double MinTrackMomentum
 
unsigned int NCluster
 
unsigned int NEvent
 
unsigned int NTrack
 
bool OldGainRemoving
 
std::string OutputGains
 
unsigned int SRun
 
double tagCondition_GoodFrac
 
double tagCondition_NClusters
 
TFileServicetfs
 
edm::InputTag theTracksLabel
 
bool useCalibration
 
bool Validation
 
vector< string > VInputFiles
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from ConditionDBWriter< SiStripApvGain >
void setDoStore (const bool doStore)
 When set to false the payload will not be written to the db. More...
 
void storeOnDbNow ()
 
cond::Time_t timeOfLastIOV ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 112 of file SiStripGainFromCalibTree.cc.

Constructor & Destructor Documentation

SiStripGainFromCalibTree::SiStripGainFromCalibTree ( const edm::ParameterSet iConfig)
explicit

Definition at line 202 of file SiStripGainFromCalibTree.cc.

References AlgoMode, AllowSaturation, CalibrationLevel, dbe, FirstSetOfConstants, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), harvestingMode, m_calibrationPath, MaxChi2OverNDF, MaxMPVError, MaxNrStrips, MaxTrackChiOverNdf, MaxTrackEta, MaxTrackMomentum, MinNrEntries, MinTrackEta, MinTrackHits, MinTrackMomentum, OldGainRemoving, cppFunctionSkipper::operator, OutputGains, AlCaHLTBitMon_QueryRunRegistry::string, tagCondition_GoodFrac, tagCondition_NClusters, theTracksLabel, useCalibration, Validation, and VInputFiles.

203 {
204  OutputGains = iConfig.getParameter<std::string>("OutputGains");
206 
207  AlgoMode = iConfig.getUntrackedParameter<std::string>("AlgoMode", "CalibTree");
208  MinNrEntries = iConfig.getUntrackedParameter<double> ("minNrEntries" , 20);
209  MaxMPVError = iConfig.getUntrackedParameter<double> ("maxMPVError" , 500.0);
210  MaxChi2OverNDF = iConfig.getUntrackedParameter<double> ("maxChi2OverNDF" , 5.0);
211  MinTrackMomentum = iConfig.getUntrackedParameter<double> ("minTrackMomentum" , 3.0);
212  MaxTrackMomentum = iConfig.getUntrackedParameter<double> ("maxTrackMomentum" , 99999.0);
213  MinTrackEta = iConfig.getUntrackedParameter<double> ("minTrackEta" , -5.0);
214  MaxTrackEta = iConfig.getUntrackedParameter<double> ("maxTrackEta" , 5.0);
215  MaxNrStrips = iConfig.getUntrackedParameter<unsigned>("maxNrStrips" , 2);
216  MinTrackHits = iConfig.getUntrackedParameter<unsigned>("MinTrackHits" , 8);
217  MaxTrackChiOverNdf = iConfig.getUntrackedParameter<double> ("MaxTrackChiOverNdf" , 3);
218  AllowSaturation = iConfig.getUntrackedParameter<bool> ("AllowSaturation" , false);
219  FirstSetOfConstants = iConfig.getUntrackedParameter<bool> ("FirstSetOfConstants", true);
220  Validation = iConfig.getUntrackedParameter<bool> ("Validation" , false);
221  OldGainRemoving = iConfig.getUntrackedParameter<bool> ("OldGainRemoving" , false);
222 
223  CalibrationLevel = iConfig.getUntrackedParameter<int> ("CalibrationLevel" , 0);
224  VInputFiles = iConfig.getParameter<vector<string> > ("InputFiles");
225 
226 
227  useCalibration = iConfig.getUntrackedParameter<bool> ("UseCalibration" , false);
228  m_calibrationPath = iConfig.getUntrackedParameter<string> ("calibrationPath");
229  harvestingMode = iConfig.getUntrackedParameter<bool> ("harvestingMode" , false);
230 
231  tagCondition_NClusters = iConfig.getUntrackedParameter<double> ("NClustersForTagProd" , 2E8);
232  tagCondition_GoodFrac = iConfig.getUntrackedParameter<double> ("GoodFracForTagProd" , 0.95);
233 
235  dbe->setVerbose(10);
236 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
SiStripGainFromCalibTree::~SiStripGainFromCalibTree ( )

Definition at line 778 of file SiStripGainFromCalibTree.cc.

779 {
780 }

Member Function Documentation

void SiStripGainFromCalibTree::algoAnalyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from ConditionDBWriter< SiStripApvGain >.

Definition at line 804 of file SiStripGainFromCalibTree.cc.

References a, AlgoMode, AllowSaturation, SiStripCluster::amplitudes(), sistrip::APV, APVsColl, stAPVGain::CalibGain, Charge_Vs_Index, Charge_Vs_Index_Absolute, Charge_Vs_PathlengthTECM1, Charge_Vs_PathlengthTECM2, Charge_Vs_PathlengthTECP1, Charge_Vs_PathlengthTECP2, Charge_Vs_PathlengthTIB, Charge_Vs_PathlengthTIDM, Charge_Vs_PathlengthTIDP, Charge_Vs_PathlengthTOB, reco::TrackBase::chi2(), SiStripRecHit1D::cluster(), SiStripRecHit2D::cluster(), edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, ERun, stAPVGain::Eta, reco::TrackBase::eta(), edm::false, MonitorElement::Fill(), FirstSetOfConstants, SiStripCluster::firstStrip(), TrackingRecHit::geographicalId(), edm::EventSetup::get(), edm::Event::getByLabel(), h, harvestingMode, edm::EventBase::id(), stAPVGain::Index, IsFarFromBorder(), edm::ESHandleBase::isValid(), TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localDirection(), PV3DBase< T, PVType, FrameType >::mag(), MaxNrStrips, MaxTrackChiOverNdf, MaxTrackEta, MaxTrackMomentum, Trajectory::measurements(), MinTrackEta, MinTrackHits, MinTrackMomentum, SiStripMatchedRecHit2D::monoCluster(), SiStripMatchedRecHit2D::monoId(), NCluster, reco::TrackBase::ndof(), NEvent, NTrack, NULL, reco::TrackBase::numberOfValidHits(), OldGainRemoving, reco::TrackBase::p(), CSCOverlapsAlignmentAlgorithm_cff::Path, stAPVGain::PreviousGain, DetId::rawId(), edm::EventID::run(), alignCSCRings::s, SRun, SiStripMatchedRecHit2D::stereoCluster(), SiStripMatchedRecHit2D::stereoId(), stAPVGain::SubDet, StripSubdetector::TEC, theTracksLabel, stAPVGain::Thickness, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, testEve_cfg::tracks, useCalibration, Validation, and PV3DBase< T, PVType, FrameType >::z().

805 {
806  // in AlCaHarvesting mode we just need to run the logic in the endJob step
807  if(harvestingMode) return;
808 
809  if(AlgoMode=="CalibTree")return;
810 
811  if(NEvent==0){
812  SRun = iEvent.id().run();
813  }
814  ERun = iEvent.id().run();
815  NEvent++;
816 
817  //FROM SHALLOW GAIN
818  edm::ESHandle<TrackerGeometry> theTrackerGeometry; iSetup.get<TrackerDigiGeometryRecord>().get( theTrackerGeometry );
819  edm::ESHandle<SiStripGain> gainHandle; iSetup.get<SiStripGainRcd>().get(gainHandle);
821  edm::Handle<TrajTrackAssociationCollection> associations; iEvent.getByLabel(theTracksLabel, associations);
822 
823  for( TrajTrackAssociationCollection::const_iterator association = associations->begin(); association != associations->end(); association++) {
824  const Trajectory* traj = association->key.get();
825  const reco::Track* track = association->val.get();
826 
827  //clean on the tracks
828  if(fabs(track->eta()) < MinTrackEta )continue;
829  if(fabs(track->eta()) > MaxTrackEta )continue;
830  if(track->p() < MinTrackMomentum )continue;
831  if(track->p() > MaxTrackMomentum )continue;
832  if(track->numberOfValidHits() < MinTrackHits )continue;
833  if(track->chi2()/track->ndof() > MaxTrackChiOverNdf )continue;
834  NTrack++;
835 
836  vector<TrajectoryMeasurement> measurements = traj->measurements();
837  for(vector<TrajectoryMeasurement>::const_iterator measurement_it = measurements.begin(); measurement_it!=measurements.end(); measurement_it++){
838  TrajectoryStateOnSurface trajState = measurement_it->updatedState();
839  if( !trajState.isValid() ) continue;
840 
841  const TrackingRecHit* hit = (*measurement_it->recHit()).hit();
842  const SiStripRecHit1D* sistripsimple1dhit = dynamic_cast<const SiStripRecHit1D*>(hit);
843  const SiStripRecHit2D* sistripsimplehit = dynamic_cast<const SiStripRecHit2D*>(hit);
844  const SiStripMatchedRecHit2D* sistripmatchedhit = dynamic_cast<const SiStripMatchedRecHit2D*>(hit);
845 
846  const SiStripCluster* Cluster = NULL;
847  uint32_t DetId = 0;
848 
849  for(unsigned int h=0;h<2;h++){
850  if(!sistripmatchedhit && h==1){
851  continue;
852  }else if(sistripmatchedhit && h==0){
853  Cluster = &sistripmatchedhit->monoCluster();
854  DetId = sistripmatchedhit->monoId();
855  }else if(sistripmatchedhit && h==1){
856  Cluster = &sistripmatchedhit->stereoCluster();;
857  DetId = sistripmatchedhit->stereoId();
858  }else if(sistripsimplehit){
859  Cluster = (sistripsimplehit->cluster()).get();
860  DetId = sistripsimplehit->geographicalId().rawId();
861  }else if(sistripsimple1dhit){
862  Cluster = (sistripsimple1dhit->cluster()).get();
863  DetId = sistripsimple1dhit->geographicalId().rawId();
864  }else{
865  continue;
866  }
867 
868  LocalVector trackDirection = trajState.localDirection();
869  double cosine = trackDirection.z()/trackDirection.mag();
870  const auto& Ampls = Cluster->amplitudes();
871  int FirstStrip = Cluster->firstStrip();
872  int APVId = FirstStrip/128;
873  bool Saturation = false;
874  bool Overlapping = false;
875  unsigned int charge = 0;
876  double PrevGain = -1;
877  stAPVGain* APV = APVsColl[(DetId<<3) | (FirstStrip/128)];
878  double Path = (10.0*APV->Thickness)/fabs(cosine);
879 
880 
881  if(gainHandle.isValid()){
882  SiStripApvGain::Range detGainRange = gainHandle->getRange(DetId);
883  PrevGain = *(detGainRange.first + APVId);
884  }
885 
886  for(unsigned int a=0;a<Ampls.size();a++){
887  charge+=Ampls[a];
888  if(Ampls[a] >=254)Saturation =true;
889  }
890 
891  if(FirstStrip==0 )Overlapping=true;
892  if(FirstStrip==128 )Overlapping=true;
893  if(FirstStrip==256 )Overlapping=true;
894  if(FirstStrip==384 )Overlapping=true;
895  if(FirstStrip==512 )Overlapping=true;
896  if(FirstStrip==640 )Overlapping=true;
897 
898  if(FirstStrip<=127 && FirstStrip+Ampls.size()>127)Overlapping=true;
899  if(FirstStrip<=255 && FirstStrip+Ampls.size()>255)Overlapping=true;
900  if(FirstStrip<=383 && FirstStrip+Ampls.size()>383)Overlapping=true;
901  if(FirstStrip<=511 && FirstStrip+Ampls.size()>511)Overlapping=true;
902  if(FirstStrip<=639 && FirstStrip+Ampls.size()>639)Overlapping=true;
903 
904  if(FirstStrip+Ampls.size()==127 )Overlapping=true;
905  if(FirstStrip+Ampls.size()==255 )Overlapping=true;
906  if(FirstStrip+Ampls.size()==383 )Overlapping=true;
907  if(FirstStrip+Ampls.size()==511 )Overlapping=true;
908  if(FirstStrip+Ampls.size()==639 )Overlapping=true;
909  if(FirstStrip+Ampls.size()==767 )Overlapping=true;
910 
911  //cleaning on the cluster
912  if(IsFarFromBorder(&trajState,DetId, &iSetup) == false )continue;
913  if(Overlapping == true )continue;
914  if(Saturation && !AllowSaturation )continue;
915  if(Ampls.size() > MaxNrStrips )continue;
916  NCluster++;
917 
918 
919  int Charge = 0;
921  bool Saturation = false;
922  for(unsigned int s=0;s<Ampls.size();s++){
923  int StripCharge = Ampls[s];
924  if(useCalibration && !FirstSetOfConstants){ StripCharge=(int)(StripCharge*(APV->PreviousGain/APV->CalibGain));
925  }else if(useCalibration){ StripCharge=(int)(StripCharge/APV->CalibGain);
926  }else if(!FirstSetOfConstants){ StripCharge=(int)(StripCharge*APV->PreviousGain);}
927  if(StripCharge>1024){
928  StripCharge = 255;
929  Saturation = true;
930  }else if(StripCharge>254){
931  StripCharge = 254;
932  Saturation = true;
933  }
934  Charge += StripCharge;
935  }
936  if(Saturation && !AllowSaturation)continue;
937  }else{
938  Charge = charge;
939  }
940 
941  //printf("ChargeDifference = %i Vs %i with Gain = %f\n",(*charge)[i],Charge,APV->CalibGain);
942 
943  double ClusterChargeOverPath = ( (double) Charge )/Path ;
944  if(Validation) {ClusterChargeOverPath/=PrevGain;}
945  if(OldGainRemoving){ClusterChargeOverPath*=PrevGain;}
946  Charge_Vs_Index_Absolute->Fill(APV->Index,Charge);
947  Charge_Vs_Index ->Fill(APV->Index,ClusterChargeOverPath);
948 
949 
950  if(APV->SubDet==StripSubdetector::TIB){ Charge_Vs_PathlengthTIB ->Fill(Path,Charge);
951  }else if(APV->SubDet==StripSubdetector::TOB){ Charge_Vs_PathlengthTOB ->Fill(Path,Charge);
952  }else if(APV->SubDet==StripSubdetector::TID){
953  if(APV->Eta<0){ Charge_Vs_PathlengthTIDM ->Fill(Path,Charge);
954  }else if(APV->Eta>0){ Charge_Vs_PathlengthTIDP ->Fill(Path,Charge);
955  }
956  }else if(APV->SubDet==StripSubdetector::TEC){
957  if(APV->Eta<0){
958  if(APV->Thickness<0.04){ Charge_Vs_PathlengthTECM1->Fill(Path,Charge);
959  }else if(APV->Thickness>0.04){ Charge_Vs_PathlengthTECM2->Fill(Path,Charge);
960  }
961  }else if(APV->Eta>0){
962  if(APV->Thickness<0.04){ Charge_Vs_PathlengthTECP1->Fill(Path,Charge);
963  }else if(APV->Thickness>0.04){ Charge_Vs_PathlengthTECP2->Fill(Path,Charge);
964  }
965  }
966  }
967 
968  }//loop on clusters
969  }//loop on measurements
970  }//loop on tracks
971 
972 }
RunNumber_t run() const
Definition: EventID.h:39
ClusterRef cluster() const
double p() const
momentum vector magnitude
Definition: TrackBase.h:568
unsigned int stereoId() const
SiStripCluster const & monoCluster() const
LocalVector localDirection() const
#define NULL
Definition: scimark2.h:8
uint16_t firstStrip() const
void Fill(long long x)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
DataContainer const & measurements() const
Definition: Trajectory.h:203
__gnu_cxx::hash_map< unsigned int, stAPVGain *, __gnu_cxx::hash< unsigned int >, isEqual > APVsColl
T mag() const
Definition: PV3DBase.h:67
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:604
double chi2() const
chi-squared of the fit
Definition: TrackBase.h:502
double ndof() const
number of degrees of freedom of the fit
Definition: TrackBase.h:508
Definition: Path.h:40
T z() const
Definition: PV3DBase.h:64
std::pair< ContainerIterator, ContainerIterator > Range
ClusterRef cluster() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
unsigned short numberOfValidHits() const
number of valid hits found
Definition: TrackBase.h:773
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
Definition: DetId.h:18
bool IsFarFromBorder(TrajectoryStateOnSurface *trajState, const uint32_t detid, const edm::EventSetup *iSetup)
tuple tracks
Definition: testEve_cfg.py:39
const T & get() const
Definition: EventSetup.h:55
SiStripCluster const & stereoCluster() const
edm::EventID id() const
Definition: EventBase.h:60
double a
Definition: hdecay.h:121
unsigned int monoId() const
DetId geographicalId() const
volatile std::atomic< bool > shutdown_flag false
bool isValid() const
Definition: ESHandle.h:47
const std::vector< uint8_t > & amplitudes() const
void SiStripGainFromCalibTree::algoAnalyzeTheTree ( )
private

Definition at line 413 of file SiStripGainFromCalibTree.cc.

References AllowSaturation, sistrip::APV, APVsColl, stAPVGain::CalibGain, Charge_Vs_Index, Charge_Vs_Index_Absolute, Charge_Vs_PathlengthTECM1, Charge_Vs_PathlengthTECM2, Charge_Vs_PathlengthTECP1, Charge_Vs_PathlengthTECP2, Charge_Vs_PathlengthTIB, Charge_Vs_PathlengthTIDM, Charge_Vs_PathlengthTIDP, Charge_Vs_PathlengthTOB, ERun, stAPVGain::Eta, edm::false, MonitorElement::Fill(), FirstSetOfConstants, i, stAPVGain::Index, MaxNrStrips, MaxTrackChiOverNdf, MaxTrackEta, MaxTrackMomentum, MinTrackEta, MinTrackHits, MinTrackMomentum, NCluster, NEvent, NTrack, NULL, OldGainRemoving, cmsHarvester::path, stAPVGain::PreviousGain, cond::runnumber, alignCSCRings::s, SRun, stAPVGain::SubDet, StripSubdetector::TEC, stAPVGain::Thickness, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, MainPageGenerator::tree, funct::true, useCalibration, Validation, and VInputFiles.

Referenced by algoEndJob().

414 {
415  for(unsigned int i=0;i<VInputFiles.size();i++){
416  printf("Openning file %3i/%3i --> %s\n",i+1, (int)VInputFiles.size(), (char*)(VInputFiles[i].c_str())); fflush(stdout);
417  TChain* tree = new TChain("gainCalibrationTree/tree");
418  tree->Add(VInputFiles[i].c_str());
419 
420  TString EventPrefix("");
421  TString EventSuffix("");
422 
423  TString TrackPrefix("track");
424  TString TrackSuffix("");
425 
426  TString CalibPrefix("GainCalibration");
427  TString CalibSuffix("");
428 
429  unsigned int eventnumber = 0; tree->SetBranchAddress(EventPrefix + "event" + EventSuffix, &eventnumber , NULL);
430  unsigned int runnumber = 0; tree->SetBranchAddress(EventPrefix + "run" + EventSuffix, &runnumber , NULL);
431  std::vector<bool>* TrigTech = 0; tree->SetBranchAddress(EventPrefix + "TrigTech" + EventSuffix, &TrigTech , NULL);
432 
433  std::vector<double>* trackchi2ndof = 0; tree->SetBranchAddress(TrackPrefix + "chi2ndof" + TrackSuffix, &trackchi2ndof , NULL);
434  std::vector<float>* trackp = 0; tree->SetBranchAddress(TrackPrefix + "momentum" + TrackSuffix, &trackp , NULL);
435  std::vector<float>* trackpt = 0; tree->SetBranchAddress(TrackPrefix + "pt" + TrackSuffix, &trackpt , NULL);
436  std::vector<double>* tracketa = 0; tree->SetBranchAddress(TrackPrefix + "eta" + TrackSuffix, &tracketa , NULL);
437  std::vector<double>* trackphi = 0; tree->SetBranchAddress(TrackPrefix + "phi" + TrackSuffix, &trackphi , NULL);
438  std::vector<unsigned int>* trackhitsvalid = 0; tree->SetBranchAddress(TrackPrefix + "hitsvalid" + TrackSuffix, &trackhitsvalid, NULL);
439 
440  std::vector<int>* trackindex = 0; tree->SetBranchAddress(CalibPrefix + "trackindex" + CalibSuffix, &trackindex , NULL);
441  std::vector<unsigned int>* rawid = 0; tree->SetBranchAddress(CalibPrefix + "rawid" + CalibSuffix, &rawid , NULL);
442  std::vector<float>* localdirx = 0; tree->SetBranchAddress(CalibPrefix + "localdirx" + CalibSuffix, &localdirx , NULL);
443  std::vector<float>* localdiry = 0; tree->SetBranchAddress(CalibPrefix + "localdiry" + CalibSuffix, &localdiry , NULL);
444  std::vector<float>* localdirz = 0; tree->SetBranchAddress(CalibPrefix + "localdirz" + CalibSuffix, &localdirz , NULL);
445  std::vector<unsigned short>* firststrip = 0; tree->SetBranchAddress(CalibPrefix + "firststrip" + CalibSuffix, &firststrip , NULL);
446  std::vector<unsigned short>* nstrips = 0; tree->SetBranchAddress(CalibPrefix + "nstrips" + CalibSuffix, &nstrips , NULL);
447  std::vector<bool>* saturation = 0; tree->SetBranchAddress(CalibPrefix + "saturation" + CalibSuffix, &saturation , NULL);
448  std::vector<bool>* overlapping = 0; tree->SetBranchAddress(CalibPrefix + "overlapping" + CalibSuffix, &overlapping , NULL);
449  std::vector<bool>* farfromedge = 0; tree->SetBranchAddress(CalibPrefix + "farfromedge" + CalibSuffix, &farfromedge , NULL);
450  std::vector<unsigned int>* charge = 0; tree->SetBranchAddress(CalibPrefix + "charge" + CalibSuffix, &charge , NULL);
451  std::vector<float>* path = 0; tree->SetBranchAddress(CalibPrefix + "path" + CalibSuffix, &path , NULL);
452  std::vector<float>* chargeoverpath = 0; tree->SetBranchAddress(CalibPrefix + "chargeoverpath" + CalibSuffix, &chargeoverpath, NULL);
453  std::vector<unsigned char>* amplitude = 0; tree->SetBranchAddress(CalibPrefix + "amplitude" + CalibSuffix, &amplitude , NULL);
454  std::vector<double>* gainused = 0; tree->SetBranchAddress(CalibPrefix + "gainused" + CalibSuffix, &gainused , NULL);
455 
456 
457  printf("Number of Events = %i + %i = %i\n",NEvent,(unsigned int)tree->GetEntries(),(unsigned int)(NEvent+tree->GetEntries()));
458  printf("Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
459  printf("Looping on the Tree :");
460  int TreeStep = tree->GetEntries()/50;if(TreeStep<=1)TreeStep=1;
461  for (unsigned int ientry = 0; ientry < tree->GetEntries(); ientry++) {
462  if(ientry%TreeStep==0){printf(".");fflush(stdout);}
463  tree->GetEntry(ientry);
464 
465  if(runnumber<SRun)SRun=runnumber;
466  if(runnumber>ERun)ERun=runnumber;
467 
468  NEvent++;
469  NTrack+=(*trackp).size();
470 
471  unsigned int FirstAmplitude=0;
472  for(unsigned int i=0;i<(*chargeoverpath).size();i++){
473  FirstAmplitude+=(*nstrips)[i];
474  int TI = (*trackindex)[i];
475  if((*tracketa )[TI] < MinTrackEta )continue;
476  if((*tracketa )[TI] > MaxTrackEta )continue;
477  if((*trackp )[TI] < MinTrackMomentum )continue;
478  if((*trackp )[TI] > MaxTrackMomentum )continue;
479  if((*trackhitsvalid)[TI] < MinTrackHits )continue;
480  if((*trackchi2ndof )[TI] > MaxTrackChiOverNdf )continue;
481  if((*farfromedge)[i] == false )continue;
482  if((*overlapping)[i] == true )continue;
483  if((*saturation )[i] && !AllowSaturation)continue;
484  if((*nstrips )[i] > MaxNrStrips )continue;
485  NCluster++;
486 
487  stAPVGain* APV = APVsColl[((*rawid)[i]<<3) | ((*firststrip)[i]/128)];
488  //printf("detId=%7i run=%7i event=%9i charge=%5i cs=%3i\n",(*rawid)[i],runnumber,eventnumber,(*charge)[i],(*nstrips)[i]);
489 
490  //double trans = atan2((*localdiry)[i],(*localdirx)[i])*(180/3.14159265);
491  //double alpha = acos ((*localdirx)[i] / sqrt( pow((*localdirx)[i],2) + pow((*localdirz)[i],2) ) ) * (180/3.14159265);
492  //double beta = acos ((*localdiry)[i] / sqrt( pow((*localdirx)[i],2) + pow((*localdirz)[i],2) ) ) * (180/3.14159265);
493 
494  //printf("NStrip = %i : Charge = %i --> Path = %f --> ChargeOverPath=%f\n",(*nstrips)[i],(*charge)[i],(*path)[i],(*chargeoverpath)[i]);
495  //printf("Amplitudes: ");
496  //for(unsigned int a=0;a<(*nstrips)[i];a++){printf("%i ",(*amplitude)[FirstAmplitude+a]);}
497  //printf("\n");
498 
499 
500  int Charge = 0;
502  bool Saturation = false;
503  for(unsigned int s=0;s<(*nstrips)[i];s++){
504  int StripCharge = (*amplitude)[FirstAmplitude-(*nstrips)[i]+s];
505  if(useCalibration && !FirstSetOfConstants){ StripCharge=(int)(StripCharge*(APV->PreviousGain/APV->CalibGain));
506  }else if(useCalibration){ StripCharge=(int)(StripCharge/APV->CalibGain);
507  }else if(!FirstSetOfConstants){ StripCharge=(int)(StripCharge*APV->PreviousGain);}
508  if(StripCharge>1024){
509  StripCharge = 255;
510  Saturation = true;
511  }else if(StripCharge>254){
512  StripCharge = 254;
513  Saturation = true;
514  }
515  Charge += StripCharge;
516  }
517  if(Saturation && !AllowSaturation)continue;
518  }else{
519  Charge = (*charge)[i];
520  }
521 
522  //printf("ChargeDifference = %i Vs %i with Gain = %f\n",(*charge)[i],Charge,APV->CalibGain);
523 
524  double ClusterChargeOverPath = ( (double) Charge )/(*path)[i] ;
525  if(Validation) {ClusterChargeOverPath/=(*gainused)[i];}
526  if(OldGainRemoving){ClusterChargeOverPath*=(*gainused)[i];}
527  Charge_Vs_Index_Absolute->Fill(APV->Index,Charge);
528  Charge_Vs_Index ->Fill(APV->Index,ClusterChargeOverPath);
529 
530 
531  if(APV->SubDet==StripSubdetector::TIB){ Charge_Vs_PathlengthTIB ->Fill((*path)[i],Charge);
532  }else if(APV->SubDet==StripSubdetector::TOB){ Charge_Vs_PathlengthTOB ->Fill((*path)[i],Charge);
533  }else if(APV->SubDet==StripSubdetector::TID){
534  if(APV->Eta<0){ Charge_Vs_PathlengthTIDM ->Fill((*path)[i],Charge);
535  }else if(APV->Eta>0){ Charge_Vs_PathlengthTIDP ->Fill((*path)[i],Charge);
536  }
537  }else if(APV->SubDet==StripSubdetector::TEC){
538  if(APV->Eta<0){
539  if(APV->Thickness<0.04){ Charge_Vs_PathlengthTECM1->Fill((*path)[i],Charge);
540  }else if(APV->Thickness>0.04){ Charge_Vs_PathlengthTECM2->Fill((*path)[i],Charge);
541  }
542  }else if(APV->Eta>0){
543  if(APV->Thickness<0.04){ Charge_Vs_PathlengthTECP1->Fill((*path)[i],Charge);
544  }else if(APV->Thickness>0.04){ Charge_Vs_PathlengthTECP2->Fill((*path)[i],Charge);
545  }
546  }
547  }
548 
549  }// END OF ON-CLUSTER LOOP
550  }printf("\n");// END OF EVENT LOOP
551 
552  }
553 }
int i
Definition: DBlmapReader.cc:9
#define NULL
Definition: scimark2.h:8
void Fill(long long x)
__gnu_cxx::hash_map< unsigned int, stAPVGain *, __gnu_cxx::hash< unsigned int >, isEqual > APVsColl
tuple path
else: Piece not in the list, fine.
volatile std::atomic< bool > shutdown_flag false
void SiStripGainFromCalibTree::algoBeginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from ConditionDBWriter< SiStripApvGain >.

Definition at line 238 of file SiStripGainFromCalibTree.cc.

References sistrip::APV, stAPVGain::APVId, APVsColl, APVsCollOrdered, BAD, stAPVGain::Bin, Charge_Vs_Index, Charge_Vs_Index_Absolute, Charge_Vs_PathlengthTECM1, Charge_Vs_PathlengthTECM2, Charge_Vs_PathlengthTECP1, Charge_Vs_PathlengthTECP2, Charge_Vs_PathlengthTIB, Charge_Vs_PathlengthTIDM, Charge_Vs_PathlengthTIDP, Charge_Vs_PathlengthTOB, gather_cfg::cout, dbe, stAPVGain::DetId, ERun, stAPVGain::Eta, cmsRelvalreport::exit, FirstSetOfConstants, stAPVGain::FitChi2, stAPVGain::FitMPV, stAPVGain::FitMPVErr, stAPVGain::FitWidth, stAPVGain::FitWidthErr, stAPVGain::Gain, edm::EventSetup::get(), GOOD, harvestingMode, i, stAPVGain::Index, stAPVGain::isMasked, edm::ESHandleBase::isValid(), j, MakeCalibrationMap(), MASKED, NCluster, stAPVGain::NEntries, NEvent, StripTopology::nstrips(), NTrack, stAPVGain::Phi, stAPVGain::PreviousGain, stAPVGain::R, DetId::rawId(), SRun, stAPVGain::SubDet, DetId::subdetId(), StripSubdetector::TEC, stAPVGain::Thickness, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, stAPVGain::x, stAPVGain::y, and stAPVGain::z.

239 {
240  cout << "algoBeginRun start" << endl;
241  if(!harvestingMode){
242  cout << " booking start" << endl;
243  dbe->setCurrentFolder("AlCaReco/SiStripGains/");
244  Charge_Vs_Index = dbe->book2D("Charge_Vs_Index" , "Charge_Vs_Index" , 72785, 0 , 72784,1000,0,2000);
245  Charge_Vs_Index_Absolute = dbe->book2D("Charge_Vs_Index_Absolute" , "Charge_Vs_Index_Absolute" , 72785, 0 , 72784, 500,0,2000);
246  Charge_Vs_PathlengthTIB = dbe->book2D("Charge_Vs_PathlengthTIB" , "Charge_Vs_PathlengthTIB" , 20 , 0.3 , 1.3 , 250,0,2000);
247  Charge_Vs_PathlengthTOB = dbe->book2D("Charge_Vs_PathlengthTOB" , "Charge_Vs_PathlengthTOB" , 20 , 0.3 , 1.3 , 250,0,2000);
248  Charge_Vs_PathlengthTIDP = dbe->book2D("Charge_Vs_PathlengthTIDP" , "Charge_Vs_PathlengthTIDP" , 20 , 0.3 , 1.3 , 250,0,2000);
249  Charge_Vs_PathlengthTIDM = dbe->book2D("Charge_Vs_PathlengthTIDM" , "Charge_Vs_PathlengthTIDM" , 20 , 0.3 , 1.3 , 250,0,2000);
250  Charge_Vs_PathlengthTECP1 = dbe->book2D("Charge_Vs_PathlengthTECP1", "Charge_Vs_PathlengthTECP1", 20 , 0.3 , 1.3 , 250,0,2000);
251  Charge_Vs_PathlengthTECP2 = dbe->book2D("Charge_Vs_PathlengthTECP2", "Charge_Vs_PathlengthTECP2", 20 , 0.3 , 1.3 , 250,0,2000);
252  Charge_Vs_PathlengthTECM1 = dbe->book2D("Charge_Vs_PathlengthTECM1", "Charge_Vs_PathlengthTECM1", 20 , 0.3 , 1.3 , 250,0,2000);
253  Charge_Vs_PathlengthTECM2 = dbe->book2D("Charge_Vs_PathlengthTECM2", "Charge_Vs_PathlengthTECM2", 20 , 0.3 , 1.3 , 250,0,2000);
254  }
256  iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom );
257  auto const & Det = tkGeom->dets();
258 
259  edm::ESHandle<SiStripGain> gainHandle;
260  iSetup.get<SiStripGainRcd>().get(gainHandle);
261  if(!gainHandle.isValid()){printf("\n#####################\n\nERROR --> gainHandle is not valid\n\n#####################\n\n");exit(0);}
262 
263  for(unsigned int i=0;i<gainHandle->getNumberOfTags();i++){
264  printf("Reccord %i --> Rcd Name = %s Label Name = %s\n",i,gainHandle->getRcdName(i).c_str(), gainHandle->getLabelName(i).c_str());
265  }
266 
267  edm::ESHandle<SiStripQuality> SiStripQuality_;
268  iSetup.get<SiStripQualityRcd>().get(SiStripQuality_);
269 
270  unsigned int Index=0;
271  for(unsigned int i=0;i<Det.size();i++){
272  DetId Detid = Det[i]->geographicalId();
273  int SubDet = Detid.subdetId();
274 
275  if( SubDet == StripSubdetector::TIB || SubDet == StripSubdetector::TID ||
276  SubDet == StripSubdetector::TOB || SubDet == StripSubdetector::TEC ){
277 
278  auto DetUnit = dynamic_cast<const StripGeomDetUnit*> (Det[i]);
279  if(!DetUnit)continue;
280 
281  const StripTopology& Topo = DetUnit->specificTopology();
282  unsigned int NAPV = Topo.nstrips()/128;
283  for(unsigned int j=0;j<NAPV;j++){
284  stAPVGain* APV = new stAPVGain;
285  APV->Index = Index;
286  APV->Bin = -1;
287  APV->DetId = Detid.rawId();
288  APV->APVId = j;
289  APV->SubDet = SubDet;
290  APV->FitMPV = -1;
291  APV->FitMPVErr = -1;
292  APV->FitWidth = -1;
293  APV->FitWidthErr = -1;
294  APV->FitChi2 = -1;
295  APV->Gain = -1;
296  APV->PreviousGain = 1;
297  APV->x = DetUnit->position().basicVector().x();
298  APV->y = DetUnit->position().basicVector().y();
299  APV->z = DetUnit->position().basicVector().z();
300  APV->Eta = DetUnit->position().basicVector().eta();
301  APV->Phi = DetUnit->position().basicVector().phi();
302  APV->R = DetUnit->position().basicVector().transverse();
303  APV->Thickness = DetUnit->surface().bounds().thickness();
304  APV->NEntries = 0;
305  APV->isMasked = SiStripQuality_->IsApvBad(Detid.rawId(),j);
306 
307  if(!FirstSetOfConstants){
308  if(gainHandle->getNumberOfTags()!=2){printf("ERROR: NUMBER OF GAIN TAG IS EXPECTED TO BE 2\n");fflush(stdout);exit(0);};
309  APV->PreviousGain = gainHandle->getApvGain(APV->APVId,gainHandle->getRange(APV->DetId, 1),1);
310  //printf("DETID = %7i APVID=%1i Previous Gain=%8.4f\n",APV->DetId,APV->APVId,APV->PreviousGain);
311  }
312 
313  APVsCollOrdered.push_back(APV);
314  APVsColl[(APV->DetId<<3) | APV->APVId] = APV;
315  Index++;
316  }
317  }
318  }
319 
321 
322  NEvent = 0;
323  NTrack = 0;
324  NCluster = 0;
325  SRun = 1<<31;
326  ERun = 0;
327  GOOD = 0;
328  BAD = 0;
329  MASKED = 0;
330 
331  cout << "algoBeginRun end" << endl;
332 }
virtual int nstrips() const =0
int i
Definition: DBlmapReader.cc:9
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
std::vector< stAPVGain * > APVsCollOrdered
__gnu_cxx::hash_map< unsigned int, stAPVGain *, __gnu_cxx::hash< unsigned int >, isEqual > APVsColl
int j
Definition: DBlmapReader.cc:9
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:55
tuple cout
Definition: gather_cfg.py:121
bool isValid() const
Definition: ESHandle.h:47
void SiStripGainFromCalibTree::algoComputeMPVandGain ( )
private

Definition at line 557 of file SiStripGainFromCalibTree.cc.

References sistrip::APV, stAPVGain::APVId, APVsColl, BAD, stAPVGain::Bin, CalibrationLevel, Charge_Vs_Index, stAPVGain::DetId, stAPVGain::FitChi2, stAPVGain::FitMPV, stAPVGain::FitMPVErr, stAPVGain::FitWidth, stAPVGain::FitWidthErr, stAPVGain::Gain, getPeakOfLandau(), MonitorElement::getTH2F(), GOOD, Exhume::I, i, stAPVGain::Index, IsGoodLandauFit(), stAPVGain::isMasked, MASKED, stAPVGain::NEntries, NULL, and stAPVGain::PreviousGain.

Referenced by algoEndJob().

557  {
558  unsigned int I=0;
559  TH1F* Proj = NULL;
560  double FitResults[5];
561  double MPVmean = 300;
562 
563  TH2F *chvsidx = Charge_Vs_Index->getTH2F();
564 
565 
566  printf("Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
567  printf("Fitting Charge Distribution :");
568  int TreeStep = APVsColl.size()/50;
569  for(__gnu_cxx::hash_map<unsigned int, stAPVGain*, __gnu_cxx::hash<unsigned int>, isEqual >::iterator it = APVsColl.begin();it!=APVsColl.end();it++,I++){
570  if(I%TreeStep==0){printf(".");fflush(stdout);}
571  stAPVGain* APV = it->second;
572  if(APV->Bin<0) APV->Bin = chvsidx->GetXaxis()->FindBin(APV->Index);
573 
574  if(APV->isMasked){MASKED++; continue;}
575 
576  Proj = (TH1F*)(chvsidx->ProjectionY("",chvsidx->GetXaxis()->FindBin(APV->Index),chvsidx->GetXaxis()->FindBin(APV->Index),"e"));
577  if(!Proj)continue;
578 
579  if(CalibrationLevel==0){
580  }else if(CalibrationLevel==1){
581  int SecondAPVId = APV->APVId;
582  if(SecondAPVId%2==0){ SecondAPVId = SecondAPVId+1; }else{ SecondAPVId = SecondAPVId-1; }
583  stAPVGain* APV2 = APVsColl[(APV->DetId<<3) | SecondAPVId];
584  if(APV2->Bin<0) APV2->Bin = chvsidx->GetXaxis()->FindBin(APV2->Index);
585  TH1F* Proj2 = (TH1F*)(chvsidx->ProjectionY("",APV2->Bin,APV2->Bin,"e"));
586  if(Proj2){Proj->Add(Proj2,1);delete Proj2;}
587  }else if(CalibrationLevel==2){
588  for(unsigned int i=0;i<6;i++){
589  __gnu_cxx::hash_map<unsigned int, stAPVGain*, __gnu_cxx::hash<unsigned int>, isEqual >::iterator tmpit;
590  tmpit = APVsColl.find((APV->DetId<<3) | i);
591  if(tmpit==APVsColl.end())continue;
592  stAPVGain* APV2 = tmpit->second;
593  if(APV2->DetId != APV->DetId || APV2->APVId == APV->APVId)continue;
594  if(APV2->Bin<0) APV2->Bin = chvsidx->GetXaxis()->FindBin(APV2->Index);
595  TH1F* Proj2 = (TH1F*)(chvsidx->ProjectionY("",APV2->Bin,APV2->Bin,"e"));
596  if(Proj2){Proj->Add(Proj2,1);delete Proj2;}
597  }
598  }else{
599  CalibrationLevel = 0;
600  printf("Unknown Calibration Level, will assume %i\n",CalibrationLevel);
601  }
602 
603  getPeakOfLandau(Proj,FitResults);
604  APV->FitMPV = FitResults[0];
605  APV->FitMPVErr = FitResults[1];
606  APV->FitWidth = FitResults[2];
607  APV->FitWidthErr = FitResults[3];
608  APV->FitChi2 = FitResults[4];
609  APV->NEntries = Proj->GetEntries();
610 
611  if(IsGoodLandauFit(FitResults)){
612  APV->Gain = APV->FitMPV / MPVmean;
613  GOOD++;
614  }else{
615  APV->Gain = APV->PreviousGain;
616  BAD++;
617  }
618  if(APV->Gain<=0) APV->Gain = 1;
619 
620  //printf("%5i/%5i: %6i - %1i %5E Entries --> MPV = %f +- %f\n",I,APVsColl.size(),APV->DetId, APV->APVId, Proj->GetEntries(), FitResults[0], FitResults[1]);fflush(stdout);
621  delete Proj;
622  }printf("\n");
623 }
int i
Definition: DBlmapReader.cc:9
#define NULL
Definition: scimark2.h:8
__gnu_cxx::hash_map< unsigned int, stAPVGain *, __gnu_cxx::hash< unsigned int >, isEqual > APVsColl
bool IsGoodLandauFit(double *FitResults)
const std::complex< double > I
Definition: I.h:8
void getPeakOfLandau(TH1 *InputHisto, double *FitResults, double LowRange=50, double HighRange=5400)
TH2F * getTH2F(void) const
void SiStripGainFromCalibTree::algoEndJob ( )
overrideprivatevirtual

Reimplemented from ConditionDBWriter< SiStripApvGain >.

Definition at line 335 of file SiStripGainFromCalibTree.cc.

References algoAnalyzeTheTree(), algoComputeMPVandGain(), AlgoMode, Charge_Vs_Index, Charge_Vs_Index_Absolute, Charge_Vs_PathlengthTECM1, Charge_Vs_PathlengthTECM2, Charge_Vs_PathlengthTECP1, Charge_Vs_PathlengthTECP2, Charge_Vs_PathlengthTIB, Charge_Vs_PathlengthTIDM, Charge_Vs_PathlengthTIDP, Charge_Vs_PathlengthTOB, gather_cfg::cout, dbe, MonitorElement::getTH2F(), harvestingMode, TFileService::make(), cppFunctionSkipper::operator, storeOnTree(), and tfs.

335  {
336  if(AlgoMode == "PCL" && !harvestingMode)return;//nothing to do in that case
337 
338  if(AlgoMode=="CalibTree"){
339  // Loop on calibTrees to fill the 2D histograms
341  }else if(harvestingMode){
342  // Load the 2D histograms from the DQM objects
343  // When running in AlCaHarvesting mode the histos are already booked and should be just retrieved from
344  // DQMStore so that they can be used in the fit
345  cout << " retrieving from DQMStore" << endl;
346  Charge_Vs_Index = dbe->get("AlCaReco/SiStripGains/Charge_Vs_Index");
347  Charge_Vs_Index_Absolute = dbe->get("AlCaReco/SiStripGains/Charge_Vs_Index_Absolute");
348  Charge_Vs_PathlengthTIB = dbe->get("AlCaReco/SiStripGains/Charge_Vs_PathlengthTIB");
349  Charge_Vs_PathlengthTOB = dbe->get("AlCaReco/SiStripGains/Charge_Vs_PathlengthTOB");
350  Charge_Vs_PathlengthTIDP = dbe->get("AlCaReco/SiStripGains/Charge_Vs_PathlengthTIDP");
351  Charge_Vs_PathlengthTIDM = dbe->get("AlCaReco/SiStripGains/Charge_Vs_PathlengthTIDM");
352  Charge_Vs_PathlengthTECP1 = dbe->get("AlCaReco/SiStripGains/Charge_Vs_PathlengthTECP1");
353  Charge_Vs_PathlengthTECP2 = dbe->get("AlCaReco/SiStripGains/Charge_Vs_PathlengthTECP2");
354  Charge_Vs_PathlengthTECM1 = dbe->get("AlCaReco/SiStripGains/Charge_Vs_PathlengthTECM1");
355  Charge_Vs_PathlengthTECM2 = dbe->get("AlCaReco/SiStripGains/Charge_Vs_PathlengthTECM2");
356  }
357 
358  // Now that we have the full statistics we can extract the information of the 2D histograms
360 
361  //FIXME: for the moment the tree is disabled in PCL, among other reasons the fact that the TFileSevice is not available @ Tier0
362  if(AlgoMode != "PCL"){
363  storeOnTree();
364  //also save the 2D monitor elements to this file as TH2D tfs
366  tfs->make<TH2F> (*Charge_Vs_Index->getTH2F());
376  }
377 }
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
tuple cout
Definition: gather_cfg.py:121
TH2F * getTH2F(void) const
SiStripApvGain * SiStripGainFromCalibTree::getNewObject ( )
overrideprivatevirtual

Implements ConditionDBWriter< SiStripApvGain >.

Definition at line 741 of file SiStripGainFromCalibTree.cc.

References a, sistrip::APV, APVsCollOrdered, gather_cfg::cout, stAPVGain::DetId, stAPVGain::Gain, harvestingMode, NULL, getGTfromDQMFile::obj, produceTagFilter(), SiStripApvGain::put(), and ConditionDBWriter< SiStripApvGain >::setDoStore().

742 {
744  if(!harvestingMode) return obj;
745 
746  if(!produceTagFilter()){
747  cout << "[SiStripGainFromCalibTree] getNewObject -> will not produce a paylaod because produceTagFilter returned false " << endl;
748  setDoStore(false);
749  return obj;
750  }
751 
752 
753  std::vector<float>* theSiStripVector = NULL;
754  unsigned int PreviousDetId = 0;
755  for(unsigned int a=0;a<APVsCollOrdered.size();a++)
756  {
758  if(APV==NULL){ printf("Bug\n"); continue; }
759  if(APV->DetId != PreviousDetId){
760  if(theSiStripVector!=NULL){
761  SiStripApvGain::Range range(theSiStripVector->begin(),theSiStripVector->end());
762  if ( !obj->put(PreviousDetId,range) ) printf("Bug to put detId = %i\n",PreviousDetId);
763  }
764  theSiStripVector = new std::vector<float>;
765  PreviousDetId = APV->DetId;
766  }
767  theSiStripVector->push_back(APV->Gain);
768  }
769  if(theSiStripVector!=NULL){
770  SiStripApvGain::Range range(theSiStripVector->begin(),theSiStripVector->end());
771  if ( !obj->put(PreviousDetId,range) ) printf("Bug to put detId = %i\n",PreviousDetId);
772  }
773 
774  return obj;
775 }
#define NULL
Definition: scimark2.h:8
bool put(const uint32_t &detID, Range input)
std::vector< stAPVGain * > APVsCollOrdered
std::pair< ContainerIterator, ContainerIterator > Range
void setDoStore(const bool doStore)
When set to false the payload will not be written to the db.
double a
Definition: hdecay.h:121
tuple cout
Definition: gather_cfg.py:121
void SiStripGainFromCalibTree::getPeakOfLandau ( TH1 *  InputHisto,
double *  FitResults,
double  LowRange = 50,
double  HighRange = 5400 
)
private

Definition at line 380 of file SiStripGainFromCalibTree.cc.

References MinNrEntries.

Referenced by algoComputeMPVandGain().

381 {
382  FitResults[0] = -0.5; //MPV
383  FitResults[1] = 0; //MPV error
384  FitResults[2] = -0.5; //Width
385  FitResults[3] = 0; //Width error
386  FitResults[4] = -0.5; //Fit Chi2/NDF
387 
388  if( InputHisto->GetEntries() < MinNrEntries)return;
389 
390  // perform fit with standard landau
391  TF1* MyLandau = new TF1("MyLandau","landau",LowRange, HighRange);
392  MyLandau->SetParameter(1,300);
393  InputHisto->Fit(MyLandau,"0QR WW");
394 
395  // MPV is parameter 1 (0=constant, 1=MPV, 2=Sigma)
396  FitResults[0] = MyLandau->GetParameter(1); //MPV
397  FitResults[1] = MyLandau->GetParError(1); //MPV error
398  FitResults[2] = MyLandau->GetParameter(2); //Width
399  FitResults[3] = MyLandau->GetParError(2); //Width error
400  FitResults[4] = MyLandau->GetChisquare() / MyLandau->GetNDF(); //Fit Chi2/NDF
401 
402  delete MyLandau;
403 }
bool SiStripGainFromCalibTree::IsFarFromBorder ( TrajectoryStateOnSurface trajState,
const uint32_t  detid,
const edm::EventSetup iSetup 
)
private

Definition at line 975 of file SiStripGainFromCalibTree.cc.

References Surface::bounds(), gather_cfg::cout, edm::EventSetup::get(), Bounds::length(), TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localPosition(), Parameters::parameters, LocalTrajectoryError::positionError(), GeomDet::surface(), PV3DBase< T, PVType, FrameType >::y(), and LocalError::yy().

Referenced by algoAnalyze().

976 {
977  edm::ESHandle<TrackerGeometry> tkGeom; iSetup->get<TrackerDigiGeometryRecord>().get( tkGeom );
978 
979  LocalPoint HitLocalPos = trajState->localPosition();
980  LocalError HitLocalError = trajState->localError().positionError() ;
981 
982  const GeomDetUnit* it = tkGeom->idToDetUnit(DetId(detid));
983  if (dynamic_cast<const StripGeomDetUnit*>(it)==0 && dynamic_cast<const PixelGeomDetUnit*>(it)==0) {
984  std::cout << "this detID doesn't seem to belong to the Tracker" << std::endl;
985  return false;
986  }
987 
988  const BoundPlane plane = it->surface();
989  const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
990  const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));
991 
992  double DistFromBorder = 1.0;
993  double HalfLength = it->surface().bounds().length() /2.0;
994 
995  if(trapezoidalBounds)
996  {
997  std::array<const float, 4> const & parameters = (*trapezoidalBounds).parameters();
998  //std::vector<float> const & parameters = (*trapezoidalBounds).parameters();
999  HalfLength = parameters[3];
1000  }else if(rectangularBounds){
1001  HalfLength = it->surface().bounds().length() /2.0;
1002  }else{return false;}
1003 
1004  if (fabs(HitLocalPos.y())+HitLocalError.yy() >= (HalfLength - DistFromBorder) ) return false;
1005 
1006  return true;
1007 }
dictionary parameters
Definition: Parameters.py:2
virtual float length() const =0
T y() const
Definition: PV3DBase.h:63
const Bounds & bounds() const
Definition: Surface.h:128
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
LocalError positionError() const
float yy() const
Definition: LocalError.h:26
const LocalTrajectoryError & localError() const
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:55
tuple cout
Definition: gather_cfg.py:121
bool SiStripGainFromCalibTree::IsGoodLandauFit ( double *  FitResults)
private

Definition at line 405 of file SiStripGainFromCalibTree.cc.

Referenced by algoComputeMPVandGain().

405  {
406  if(FitResults[0] <= 0 )return false;
407 // if(FitResults[1] > MaxMPVError )return false;
408 // if(FitResults[4] > MaxChi2OverNDF)return false;
409  return true;
410 }
void SiStripGainFromCalibTree::MakeCalibrationMap ( )
private

Definition at line 782 of file SiStripGainFromCalibTree.cc.

References sistrip::APV, APVsColl, stAPVGain::CalibGain, m_calibrationPath, and useCalibration.

Referenced by algoBeginRun().

782  {
783  if(!useCalibration)return;
784 
785  TChain* t1 = new TChain("SiStripCalib/APVGain");
786  t1->Add(m_calibrationPath.c_str());
787 
788  unsigned int tree_DetId;
789  unsigned char tree_APVId;
790  double tree_Gain;
791 
792  t1->SetBranchAddress("DetId" ,&tree_DetId );
793  t1->SetBranchAddress("APVId" ,&tree_APVId );
794  t1->SetBranchAddress("Gain" ,&tree_Gain );
795 
796  for (unsigned int ientry = 0; ientry < t1->GetEntries(); ientry++) {
797  t1->GetEntry(ientry);
798  stAPVGain* APV = APVsColl[(tree_DetId<<3) | (unsigned int)tree_APVId];
799  APV->CalibGain = tree_Gain;
800  }
801 }
__gnu_cxx::hash_map< unsigned int, stAPVGain *, __gnu_cxx::hash< unsigned int >, isEqual > APVsColl
bool SiStripGainFromCalibTree::produceTagFilter ( )
private

Definition at line 727 of file SiStripGainFromCalibTree.cc.

References BAD, Charge_Vs_Index, gather_cfg::cout, MonitorElement::getTH2F(), GOOD, tagCondition_GoodFrac, and tagCondition_NClusters.

Referenced by getNewObject().

727  {
728 
729  // The goal of this function is to check wether or not there is enough statistics to produce a meaningful tag for the DB or not
730  if(Charge_Vs_Index->getTH2F()->Integral() < tagCondition_NClusters) {
731  cout << "[SiStripGainFromCalibTree] produceTagFilter -> Return false: Statistics is too low : " << Charge_Vs_Index->getTH2F()->Integral() << endl;
732  return false;
733  }
734  if((1.0 * GOOD) / (GOOD+BAD) < tagCondition_GoodFrac) {
735  cout << "[SiStripGainFromCalibTree] produceTagFilter -> Return false: ratio of GOOD/TOTAL is too low: " << (1.0 * GOOD) / (GOOD+BAD) << endl;
736  return false;
737  }
738  return true;
739 }
tuple cout
Definition: gather_cfg.py:121
TH2F * getTH2F(void) const
void SiStripGainFromCalibTree::storeOnTree ( )
private

Definition at line 626 of file SiStripGainFromCalibTree.cc.

References a, AlgoMode, sistrip::APV, stAPVGain::APVId, APVsColl, APVsCollOrdered, BAD, Charge_Vs_Index, stAPVGain::DetId, stAPVGain::Eta, stAPVGain::FitChi2, stAPVGain::FitMPV, stAPVGain::FitMPVErr, stAPVGain::FitWidth, stAPVGain::FitWidthErr, stAPVGain::Gain, MonitorElement::getTH2F(), GOOD, stAPVGain::Index, stAPVGain::isMasked, TFileService::make(), NCluster, stAPVGain::NEntries, NEvent, NTrack, NULL, cppFunctionSkipper::operator, OutputGains, stAPVGain::Phi, stAPVGain::PreviousGain, stAPVGain::R, stAPVGain::SubDet, tfs, stAPVGain::Thickness, stAPVGain::x, stAPVGain::y, and stAPVGain::z.

Referenced by algoEndJob().

627 {
629 
630  unsigned int tree_Index;
631  unsigned int tree_Bin;
632  unsigned int tree_DetId;
633  unsigned char tree_APVId;
634  unsigned char tree_SubDet;
635  float tree_x;
636  float tree_y;
637  float tree_z;
638  float tree_Eta;
639  float tree_R;
640  float tree_Phi;
641  float tree_Thickness;
642  float tree_FitMPV;
643  float tree_FitMPVErr;
644  float tree_FitWidth;
645  float tree_FitWidthErr;
646  float tree_FitChi2NDF;
647  double tree_Gain;
648  double tree_PrevGain;
649  double tree_NEntries;
650  bool tree_isMasked;
651 
652  TTree* MyTree;
653  MyTree = tfs->make<TTree> ("APVGain","APVGain");
654  MyTree->Branch("Index" ,&tree_Index ,"Index/i");
655  MyTree->Branch("Bin" ,&tree_Bin ,"Bin/i");
656  MyTree->Branch("DetId" ,&tree_DetId ,"DetId/i");
657  MyTree->Branch("APVId" ,&tree_APVId ,"APVId/b");
658  MyTree->Branch("SubDet" ,&tree_SubDet ,"SubDet/b");
659  MyTree->Branch("x" ,&tree_x ,"x/F");
660  MyTree->Branch("y" ,&tree_y ,"y/F");
661  MyTree->Branch("z" ,&tree_z ,"z/F");
662  MyTree->Branch("Eta" ,&tree_Eta ,"Eta/F");
663  MyTree->Branch("R" ,&tree_R ,"R/F");
664  MyTree->Branch("Phi" ,&tree_Phi ,"Phi/F");
665  MyTree->Branch("Thickness" ,&tree_Thickness ,"Thickness/F");
666  MyTree->Branch("FitMPV" ,&tree_FitMPV ,"FitMPV/F");
667  MyTree->Branch("FitMPVErr" ,&tree_FitMPVErr ,"FitMPVErr/F");
668  MyTree->Branch("FitWidth" ,&tree_FitWidth ,"FitWidth/F");
669  MyTree->Branch("FitWidthErr" ,&tree_FitWidthErr,"FitWidthErr/F");
670  MyTree->Branch("FitChi2NDF" ,&tree_FitChi2NDF ,"FitChi2NDF/F");
671  MyTree->Branch("Gain" ,&tree_Gain ,"Gain/D");
672  MyTree->Branch("PrevGain" ,&tree_PrevGain ,"PrevGain/D");
673  MyTree->Branch("NEntries" ,&tree_NEntries ,"NEntries/D");
674  MyTree->Branch("isMasked" ,&tree_isMasked ,"isMasked/O");
675 
676 
677  FILE* Gains = stdout;
678  if(AlgoMode!="PCL"){
679  fprintf(Gains,"NEvents = %i\n",NEvent);
680  fprintf(Gains,"NTracks = %i\n",NTrack);
681  fprintf(Gains,"NClusters = %i\n",NCluster);
682  fprintf(Gains,"Number of APVs = %lu\n",static_cast<unsigned long>(APVsColl.size()));
683  fprintf(Gains,"GoodFits = %i BadFits = %i ratio = %f\n",GOOD,BAD,(100.0*GOOD)/(GOOD+BAD));
684  Gains=fopen(OutputGains.c_str(),"w");
685  }
686  fprintf(Gains,"NEvents = %i\n",NEvent);
687  fprintf(Gains,"NTracks = %i\n",NTrack);
688  fprintf(Gains,"NClusters = %i\n",NCluster);
689  fprintf(Gains,"Number of APVs = %lu\n",static_cast<unsigned long>(APVsColl.size()));
690  fprintf(Gains,"GoodFits = %i BadFits = %i ratio = %f\n",GOOD,BAD,(100.0*GOOD)/(GOOD+BAD));
691 
692  for(unsigned int a=0;a<APVsCollOrdered.size();a++){
694  if(APV==NULL)continue;
695 // printf( "%i | %i | PreviousGain = %7.5f NewGain = %7.5f (#clusters=%8.0f)\n", APV->DetId,APV->APVId,APV->PreviousGain,APV->Gain, APV->NEntries);
696  fprintf(Gains,"%i | %i | PreviousGain = %7.5f NewGain = %7.5f (#clusters=%8.0f)\n", APV->DetId,APV->APVId,APV->PreviousGain,APV->Gain, APV->NEntries);
697 
698  tree_Index = APV->Index;
699  tree_Bin = Charge_Vs_Index->getTH2F()->GetXaxis()->FindBin(APV->Index);
700  tree_DetId = APV->DetId;
701  tree_APVId = APV->APVId;
702  tree_SubDet = APV->SubDet;
703  tree_x = APV->x;
704  tree_y = APV->y;
705  tree_z = APV->z;
706  tree_Eta = APV->Eta;
707  tree_R = APV->R;
708  tree_Phi = APV->Phi;
709  tree_Thickness = APV->Thickness;
710  tree_FitMPV = APV->FitMPV;
711  tree_FitMPVErr = APV->FitMPVErr;
712  tree_FitWidth = APV->FitWidth;
713  tree_FitWidthErr= APV->FitWidthErr;
714  tree_FitChi2NDF = APV->FitChi2;
715  tree_Gain = APV->Gain;
716  tree_PrevGain = APV->PreviousGain;
717  tree_NEntries = APV->NEntries;
718  tree_isMasked = APV->isMasked;
719 
720  MyTree->Fill();
721  }
722  if(AlgoMode!="PCL")fclose(Gains);
723 
724 
725 }
#define NULL
Definition: scimark2.h:8
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
std::vector< stAPVGain * > APVsCollOrdered
__gnu_cxx::hash_map< unsigned int, stAPVGain *, __gnu_cxx::hash< unsigned int >, isEqual > APVsColl
double a
Definition: hdecay.h:121
TH2F * getTH2F(void) const

Member Data Documentation

std::string SiStripGainFromCalibTree::AlgoMode
private
bool SiStripGainFromCalibTree::AllowSaturation
private
__gnu_cxx::hash_map<unsigned int, stAPVGain*, __gnu_cxx::hash<unsigned int>, isEqual > SiStripGainFromCalibTree::APVsColl
private
std::vector<stAPVGain*> SiStripGainFromCalibTree::APVsCollOrdered
private

Definition at line 198 of file SiStripGainFromCalibTree.cc.

Referenced by algoBeginRun(), getNewObject(), and storeOnTree().

unsigned int SiStripGainFromCalibTree::BAD
private
int SiStripGainFromCalibTree::CalibrationLevel
private

Definition at line 157 of file SiStripGainFromCalibTree.cc.

Referenced by algoComputeMPVandGain(), and SiStripGainFromCalibTree().

MonitorElement* SiStripGainFromCalibTree::Charge_Vs_Index
private
MonitorElement* SiStripGainFromCalibTree::Charge_Vs_Index_Absolute
private
MonitorElement* SiStripGainFromCalibTree::Charge_Vs_PathlengthTECM1
private
MonitorElement* SiStripGainFromCalibTree::Charge_Vs_PathlengthTECM2
private
MonitorElement* SiStripGainFromCalibTree::Charge_Vs_PathlengthTECP1
private
MonitorElement* SiStripGainFromCalibTree::Charge_Vs_PathlengthTECP2
private
MonitorElement* SiStripGainFromCalibTree::Charge_Vs_PathlengthTIB
private
MonitorElement* SiStripGainFromCalibTree::Charge_Vs_PathlengthTIDM
private
MonitorElement* SiStripGainFromCalibTree::Charge_Vs_PathlengthTIDP
private
MonitorElement* SiStripGainFromCalibTree::Charge_Vs_PathlengthTOB
private
DQMStore* SiStripGainFromCalibTree::dbe
private

Definition at line 141 of file SiStripGainFromCalibTree.cc.

Referenced by algoBeginRun(), algoEndJob(), and SiStripGainFromCalibTree().

unsigned int SiStripGainFromCalibTree::ERun
private

Definition at line 185 of file SiStripGainFromCalibTree.cc.

Referenced by algoAnalyze(), algoAnalyzeTheTree(), and algoBeginRun().

bool SiStripGainFromCalibTree::FirstSetOfConstants
private
unsigned int SiStripGainFromCalibTree::GOOD
private
bool SiStripGainFromCalibTree::harvestingMode
private
string SiStripGainFromCalibTree::m_calibrationPath
private

Definition at line 160 of file SiStripGainFromCalibTree.cc.

Referenced by MakeCalibrationMap(), and SiStripGainFromCalibTree().

unsigned int SiStripGainFromCalibTree::MASKED
private

Definition at line 188 of file SiStripGainFromCalibTree.cc.

Referenced by algoBeginRun(), and algoComputeMPVandGain().

double SiStripGainFromCalibTree::MaxChi2OverNDF
private

Definition at line 145 of file SiStripGainFromCalibTree.cc.

Referenced by SiStripGainFromCalibTree().

double SiStripGainFromCalibTree::MaxMPVError
private

Definition at line 144 of file SiStripGainFromCalibTree.cc.

Referenced by SiStripGainFromCalibTree().

unsigned int SiStripGainFromCalibTree::MaxNrStrips
private
double SiStripGainFromCalibTree::MaxTrackChiOverNdf
private
double SiStripGainFromCalibTree::MaxTrackEta
private
double SiStripGainFromCalibTree::MaxTrackMomentum
private
double SiStripGainFromCalibTree::MinNrEntries
private

Definition at line 143 of file SiStripGainFromCalibTree.cc.

Referenced by getPeakOfLandau(), and SiStripGainFromCalibTree().

double SiStripGainFromCalibTree::MinTrackEta
private
unsigned int SiStripGainFromCalibTree::MinTrackHits
private
double SiStripGainFromCalibTree::MinTrackMomentum
private
unsigned int SiStripGainFromCalibTree::NCluster
private
unsigned int SiStripGainFromCalibTree::NEvent
private
unsigned int SiStripGainFromCalibTree::NTrack
private
bool SiStripGainFromCalibTree::OldGainRemoving
private
std::string SiStripGainFromCalibTree::OutputGains
private

Definition at line 167 of file SiStripGainFromCalibTree.cc.

Referenced by SiStripGainFromCalibTree(), and storeOnTree().

unsigned int SiStripGainFromCalibTree::SRun
private

Definition at line 184 of file SiStripGainFromCalibTree.cc.

Referenced by algoAnalyze(), algoAnalyzeTheTree(), and algoBeginRun().

double SiStripGainFromCalibTree::tagCondition_GoodFrac
private

Definition at line 163 of file SiStripGainFromCalibTree.cc.

Referenced by produceTagFilter(), and SiStripGainFromCalibTree().

double SiStripGainFromCalibTree::tagCondition_NClusters
private

Definition at line 162 of file SiStripGainFromCalibTree.cc.

Referenced by produceTagFilter(), and SiStripGainFromCalibTree().

TFileService* SiStripGainFromCalibTree::tfs
private

Definition at line 140 of file SiStripGainFromCalibTree.cc.

Referenced by algoEndJob(), and storeOnTree().

edm::InputTag SiStripGainFromCalibTree::theTracksLabel
private

Definition at line 165 of file SiStripGainFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripGainFromCalibTree().

bool SiStripGainFromCalibTree::useCalibration
private
bool SiStripGainFromCalibTree::Validation
private
vector<string> SiStripGainFromCalibTree::VInputFiles
private

Definition at line 168 of file SiStripGainFromCalibTree.cc.

Referenced by algoAnalyzeTheTree(), and SiStripGainFromCalibTree().