On 2 Dec, 2013, at 3:38 PM, Chris Jones <notifications@github.com> wrote:

> In CondFormats/SiPixelObjects/src/SiPixelGainCalibrationForHLT.cc:
> 
> >     if (deadFlag_ > 0xFF)
> >        throw cms::Exception("GainCalibration Payload configuration error")
> >           << "[SiPixelGainCalibrationHLT::SiPixelGainCalibrationHLT] Dead flag was set to " << deadFlag_ << ", and it must be set less than or equal to 255";
> >  }
> >  
> > +
> > +void SiPixelGainCalibrationForHLT::initialize() const {
> > +  pedPrecision  = (maxPed_-minPed_)/static_cast<float>(nBinsToUseForEncoding_);
> 
> Just change pedPrecision and gainPrecision to be std::atomic and use #if defined to hide the std::atomic from ROOT. The sizes of a float and std::atomic are the same. I did the following test to check:
no. because it is not necessary and will create a storm in the cache when used…
root (or edm) shall  call “initialize” ones when the object is constructed w/o a constructor.  
I expect this to happen.
I expect the CMS core team to publish instruction on how to initialize transient data members when read from disk given that this operation  is outside the C++ language standard.
this data member do not need to be transient either. maybe they wil be written in the database if calling “initialize() as post-construction method is impossible.


in any case on x86_64 and ARM pedPrecision and gainPrecision will either have the previous value or the new value.
x86_64 and ARM architecture does not allow anything else
it is fully thread safe



> 
> #include <atomic>
> #include <iostream>
> 
> int main()
> {
>   std::cout <<"int "<<sizeof(std::atomic<int>)<<std::endl;
>   std::cout <<"int* "<<sizeof(std::atomic<int*>)<<std::endl;
>   std::cout<<"float "<<sizeof(std::atomic<float>)<<std::endl;
>   std::cout<<"double "<<sizeof(std::atomic<double>)<<std::endl;
>   return 0;
> }
> 
> which returned
> 
> int 4
> int* 8
> float 4
> double 8
> 
> —
> Reply to this email directly or view it on GitHub.
> 

--
Il est bon de suivre sa pente, pourvu que ce soit en montant. 
A.G.
http://www.flickr.com/photos/vin60/1320965757/